resolution message non lus (fixes #34)
This commit is contained in:
parent
9067d50b8e
commit
77c6cd4362
@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
|
||||
(-100, 'DRAAF', '130007107');
|
||||
|
||||
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
|
||||
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}hQDYGlko/0bZ5TvumkZnJPgwgGF9FfC5
|
||||
(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}cmleGwso06Qj5cTZ+28U/BFQCTkB0Ur3
|
||||
', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple');
|
||||
|
||||
|
||||
|
@ -50,6 +50,7 @@ class CountMessageCommand extends Command
|
||||
$users=$this->em->getRepository("CadolesCoreBundle:User")->findAll();
|
||||
foreach($users as $user) {
|
||||
$cptnotread=0;
|
||||
|
||||
// Pour chaque group de l'utilisateur
|
||||
foreach($user->getGroups() as $usergroup) {
|
||||
// On calcule le nombre de message non lu pour l'utilisateur'
|
||||
@ -76,21 +77,23 @@ class CountMessageCommand extends Command
|
||||
|
||||
if($tm-$tr>0) $cptnotread+=($tm-$tr);
|
||||
}
|
||||
if($cptnotread>0) {
|
||||
$this->writeln($user->getUsername()." notifié de ".$cptnotread." messages non lus");
|
||||
|
||||
$template="template";
|
||||
|
||||
$mail_params=array(
|
||||
"subject" => $this->appname." : Messages non lus",
|
||||
"body_html"=>"<p>Vous avez ".$cptnotread." messages non lus sur ".$this->appname."</p><p>Vous pouvez les consulter sur <a href='".$this->url."'>".$this->url."</a></p>",
|
||||
"body_text"=>"Vous avez ".$cptnotread." messages non lus sur ".$this->appname."\nVous pouvez les consulter sur ".$this->url,
|
||||
);
|
||||
|
||||
$message = $this->container->get('cadoles.core.service.mail');
|
||||
$message->sendEmail($template, $mail_params, $user->getEmail(), $this->noreply, $this->appname);
|
||||
}
|
||||
}
|
||||
|
||||
// S'il l'utilisateur a des messages non lus
|
||||
if($cptnotread>0) {
|
||||
$this->writeln($user->getUsername()." notifié de ".$cptnotread." messages non lus");
|
||||
|
||||
$template="template";
|
||||
|
||||
$mail_params=array(
|
||||
"subject" => $this->appname." : Messages non lus",
|
||||
"body_html"=>"<p>Vous avez ".$cptnotread." messages non lus sur ".$this->appname."</p><p>Vous pouvez les consulter sur <a href='".$this->url."'>".$this->url."</a></p>",
|
||||
"body_text"=>"Vous avez ".$cptnotread." messages non lus sur ".$this->appname."\nVous pouvez les consulter sur ".$this->url,
|
||||
);
|
||||
|
||||
$message = $this->container->get('cadoles.core.service.mail');
|
||||
$message->sendEmail($template, $mail_params, $user->getEmail(), $this->noreply, $this->appname);
|
||||
}
|
||||
}
|
||||
$this->writeln('');
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user