/**
  * create a pseudoPlage
  *
  * @param string $user_id  user id
  *
  * @param string $activite activity type (deb or fin)
  *
  * @param string $limit    date limit chosen
  *
  * @return CPlageConge
  */
 static function makePseudoPlage($user_id, $activite, $limit)
 {
     // Parameter check
     if (!in_array($activite, array("deb", "fin"))) {
         CMbObject::error("Activite%s should be one of 'deb' or 'fin'", $activite);
     }
     // Make plage
     $plage = new self();
     $plage->_id = "{$activite}-{$user_id}";
     $plage->user_id = $user_id;
     $plage->_activite = $activite;
     $plage->libelle = CAppUI::tr("{$plage->_class}._activite.{$activite}");
     // Concerned user
     $user = CMediusers::get($user_id);
     // Dates for deb case
     if ($activite == "deb") {
         $plage->date_debut = $limit;
         $plage->date_fin = CMbDT::date("-1 DAY", $user->deb_activite);
     }
     // Dates for fin case
     if ($activite == "fin") {
         $plage->date_debut = CMbDT::date("+1 DAY", $user->fin_activite);
         $plage->date_fin = $limit;
     }
     return $plage;
 }
Exemplo n.º 2
0
 /**
  * check if imap_lib exist
  *
  * @return null
  */
 static function checkImapLib()
 {
     if (!function_exists("imap_open")) {
         CMbObject::error("no-imap-lib");
         CAppUI::stepAjax("no-imap-lib", UI_MSG_ERROR);
         return false;
     }
     return true;
 }