Ejemplo n.º 1
0
 /**
  * Notifier le parent de l'eleve dont l'id est passer entre argument
  * @param type $ideleve
  * @param string $typemessage pour quel raison faut-il notifier le parent 
  * Conf. champ typemessage de la table messages de la BD
  * 
  */
 public function notifyParents($ideleve = "", $typemessage = "")
 {
     # Obtenir le numero de telephone de ce parent
     $responsables = $this->Eleve->getResponsables($ideleve);
     # Obtenir de la BD le message a envoye
     $message = $this->Message->getMessage($typemessage)['MESSAGE'];
     # Proceder a la notification pour chaque responsable, s'il dispose d'un numero specifiq pour sms
     # alors utiliser ce numero, sinon, utiliser son num portable ou son num telephone
     # Conf. Table responsables
     foreach ($responsables as $resp) {
         $tel = getRespNumPhone($resp);
         # Ne proceder a l'envoi que si le numero de telephone est non vide
         if (!empty($tel)) {
             $this->send($tel, $message);
             sleep(3);
         }
     }
 }
Ejemplo n.º 2
0
 public function notifyVersement($typemessage = "0006")
 {
     $operation = $this->Caisse->get($this->request->idcaisse);
     $this->activateSMS();
     # Obtenir de la BD le message a envoye
     $sms = $this->Message->getMessage($typemessage)['MESSAGE'];
     $params = ["#montant " => $operation['MONTANT'], "#eleve " => $operation['NOMEL'], "#refcaisse " => $operation['REFCAISSE']];
     $message = $this->personnalize($params, $sms);
     $responsables = $this->Eleve->getResponsables($operation['ELEVE']);
     foreach ($responsables as $resp) {
         $tel = getRespNumPhone($resp);
         if (!empty($tel)) {
             $this->send($tel, $message);
             sleep(5);
         }
     }
 }
Ejemplo n.º 3
0
 public function notifyAbsenceResumees($type = "0004")
 {
     $responsables = $this->Eleve->getResponsables($this->request->eleve);
     $eleve = $this->Eleve->get($this->request->eleve);
     $distribution = $this->request->distribution;
     $periode = $this->request->periode;
     $libelle = "";
     $this->getDateIntervals($periode, $distribution, $libelle);
     $message = $this->Messagetype->getMessage($type)['MESSAGE'];
     $total = $this->request->abs + $this->request->absjus + $this->request->retard + $this->request->exclu;
     $params = ["#eleve " => $eleve['NOM'], "#periode " => $libelle, "#abs " => $this->request->abs, "#absjus " => $this->request->absjus, "#retard " => $this->request->retard, "#exclu " => $this->request->exclu, "#total " => $total];
     $m = $this->personnalize($params, $message);
     foreach ($responsables as $resp) {
         $tel = getRespNumPhone($resp);
         if (!empty($tel)) {
             $this->send($tel, $m);
             sleep(5);
         }
     }
 }
Ejemplo n.º 4
0
 private function notifyResponsables($responsables, $message)
 {
     $retVal = false;
     foreach ($responsables as $resp) {
         $tel = getRespNumPhone($resp);
         if (!empty($tel)) {
             $v = $this->send($tel, $message);
             if ($v) {
                 $retVal = $v;
             }
             sleep(3);
         }
     }
     return $retVal;
 }
Ejemplo n.º 5
0
 public function sendBulletin($el, $effectif, $seq, &$nbreparent, &$nbsms)
 {
     $eleve = $this->Eleve->get($el['ELEVE']);
     $responsables = $this->Eleve->getResponsables($eleve['IDELEVE']);
     $sms = $this->Messagetype->getMessage("0008")['MESSAGE'];
     $params = ["#eleve " => $eleve['NOM'], "#seq " => $seq['ORDRE'], "#rang " => $el['RANG'] . "/" . $effectif, "#moyenne " => $el['MOYENNE'], "#moycl " => $el['MOYCLASSE'], "#maxi " => $el['MOYMAX']];
     $message = $this->personnalize($params, $sms);
     $retVal = false;
     foreach ($responsables as $resp) {
         $tel = getRespNumPhone($resp);
         if (!empty($tel)) {
             $nbreparent++;
             $retVal = $this->send($tel, $message);
             if ($retVal) {
                 $nbsms++;
                 sleep(3);
             }
         }
     }
     return $retVal;
 }
Ejemplo n.º 6
0
 /**
  * Fonction utiliser dans l'onglet 5 de index 
  * pour notifier par SMS les rappel sur la situation financiere 
  * des eleves de la classe
  */
 public function envoyerRappel()
 {
     $this->activateSMS();
     $eleves = $this->Classe->getSoldeEleves($this->request->idclasse);
     $montantfraisapplicable = $this->Frais->getTotalFraisApplicables($this->request->idclasse)['MONTANTAPPLICABLE'];
     # Obtenir de la BD le message a envoye
     $sms = $this->Messagetype->getMessage("0007")['MESSAGE'];
     $daterappel = date("Y-m-d", time());
     $nbparent = 0;
     $smsenvoye = 0;
     $personnel = $this->Personnel->getBy(["USER" => $this->session->iduser]);
     foreach ($eleves as $el) {
         if ($el['MONTANTPAYE'] < $montantfraisapplicable) {
             $nbparent++;
             $params = ["#montant " => $montantfraisapplicable - $el['MONTANTPAYE'], "#eleve " => $el['NOM']];
             $message = $this->personnalize($params, $sms);
             $responsables = $this->Eleve->getResponsables($el['IDELEVE']);
             $retVal = false;
             foreach ($responsables as $resp) {
                 $tel = getRespNumPhone($resp);
                 if (!empty($tel)) {
                     $ret = $this->send($tel, $message);
                     if ($ret) {
                         $retVal = true;
                         $smsenvoye++;
                         sleep(5);
                     }
                 }
             }
         }
     }
     $rappels = ["daterappel" => $daterappel, "nbparent" => $nbparent, "messageenvoye" => $smsenvoye, "realiserpar" => $personnel['IDPERSONNEL']];
     $json = array();
     if ($retVal) {
         $json[0] = true;
         $this->Messagerappel->insert($rappels);
     } else {
         $json[0] = false;
     }
     $view = new View();
     $notifications = $this->Messagerappel->selectAll();
     $view->Assign("notifications", $notifications);
     $json[1] = $view->Render("classe" . DS . "ajax" . DS . "notificationfinanciere", false);
     echo json_encode($json);
 }
Ejemplo n.º 7
0
 public function envoiParclasse()
 {
     $retval = true;
     if (!empty($this->request->messageparclasse)) {
         $message = $this->request->messageparclasse;
         $this->activateSMS();
         $params = ["contenu" => $message, "envoyerpar" => $this->getConnectedUser()["IDPERSONNEL"], "dateenvoi" => date("Y-m-d H:i:s", time)];
         $this->Message->insert($params);
         $idmessage = $this->Message->lastInsertId();
         # Get an unique parent if both have numsms
         $parents = $this->Responsableeleve->getDistinctResponsableByClasse($this->request->parclasse);
         foreach ($parents as $parent) {
             $numero = getRespNumPhone($parent);
             $retval = $this->send($numero, $message);
             $params = ["responsable" => $parent['IDRESPONSABLE'], "eleve" => $parent['IDELEVE'], "message" => $idmessage, "dateenvoi" => date("Y-m-d H:i:s", time()), "etat" => $retval];
             $this->Messageeleve->insert($params);
             sleep(7);
         }
     }
     header("Location:" . Router::url("message", "suivi"));
 }