/** * check before store * * @return null|string */ function check() { $this->completeField("date_debut", "date_fin", "user_id"); $plage_conge = new CPlageConge(); $plage_conge->user_id = $this->user_id; $plages_conge = $plage_conge->loadMatchingList(); unset($plages_conge[$this->_id]); /** @var $plages_conge CPlageConge[] */ foreach ($plages_conge as $_plage) { if (CMbRange::collides($this->date_debut, $this->date_fin, $_plage->date_debut, $_plage->date_fin)) { return CAppUI::tr("CPlageConge-conflit %s", $_plage->_view); } } return parent::check(); }
$j++; } } else { list($a, $m, $j) = explode("-", $filter->date_debut); $debut_periode = "{$a}-{$m}-01"; $fin_periode = CMbDT::transform('+1 month', $debut_periode, '%Y-%m-%d'); $fin_periode = CMbDT::transform('-1 day', $fin_periode, '%Y-%m-%d'); } $tableau_periode = array(); for ($i = 0; $i < CMbDT::daysRelative($debut_periode, $fin_periode) + 1; $i++) { $tableau_periode[$i] = CMbDT::transform('+' . $i . 'day', $debut_periode, '%Y-%m-%d'); } $where = array(); $where[] = "((date_debut >= '{$debut_periode}' AND date_debut <= '{$fin_periode}'" . ")OR (date_fin >= '{$debut_periode}' AND date_fin <= '{$fin_periode}')" . "OR (date_debut <='{$debut_periode}' AND date_fin >= '{$fin_periode}'))"; $where["user_id"] = CSQLDataSource::prepareIn(array_keys($mediusers), $filter->user_id); $plageconge = new CPlageConge(); $plagesconge = array(); $orderby = "user_id"; /** @var CPlageConge[] $plagesconge */ $plagesconge = $plageconge->loadList($where, $orderby); $tabUser_plage = array(); $tabUser_plage_indices = array(); foreach ($plagesconge as $_plage) { $_plage->loadRefUser(); $_plage->_ref_user->loadRefFunction(); $_plage->_deb = CMbDT::daysRelative($debut_periode, $_plage->date_debut); $_plage->_fin = CMbDT::daysRelative($_plage->date_debut, $_plage->date_fin) + 1; $_plage->_duree = CMbDT::daysRelative($_plage->date_debut, $_plage->date_fin) + 1; } $smarty = new CSmartyDP(); $smarty->assign("debut_periode", $debut_periode);
/** * Charge la plage de congés pour un technicien à une date donnée * * @param date $date Date de référence * * @return CPlageConge */ function loadRefCongeDate($date) { $this->_ref_conge_date = new CPlageConge(); $this->_ref_conge_date->loadFor($this->kine_id, $date); return $this->_ref_conge_date; }
/** * $Id:$ * * @package Mediboard * @subpackage dPpersonnel * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision:$ */ //CCanDo::checkRead(); $user_id = CValue::getorSession("user_id"); $plage_id = CValue::get("plage_id"); $user = new CMediusers(); $user->load($user_id); // Plages de congés pour l'utilisateur $plage_conge = new CPlageConge(); $plage_conge->user_id = $user_id; $plages_conge = $plage_conge->loadMatchingList("date_debut"); foreach ($plages_conge as $_plage) { $_plage->loadFwdRef("replacer_id"); $replacer =& $_plage->_fwd["replacer_id"]; $replacer->loadRefFunction(); } $new_plageconge = new CPlageConge(); // Création du template $smarty = new CSmartyDP(); $smarty->assign("user", $user); $smarty->assign("plages_conge", $plages_conge); $smarty->assign("new_plageconge", $new_plageconge); $smarty->assign("plage_id", $plage_id); $smarty->display("inc_liste_plages_conge.tpl");
* $Id$ * * @package Mediboard * @subpackage SSR * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision$ */ CCanDo::checkEdit(); $type = CValue::getOrSession("type"); // Week dates $date = CValue::getOrSession("date", CMbDT::date()); $monday = CMbDT::date("last monday", CMbDT::date("+1 DAY", $date)); $sunday = CMbDT::date("next sunday", CMbDT::date("-1 DAY", $date)); // Chargement des conges $plage_conge = new CPlageConge(); $where = array(); $where["date_debut"] = "<= '{$sunday}'"; $where["date_fin"] = ">= '{$monday}'"; $order = "date_debut DESC, date_fin DESC"; /** @var CPlageConge[] $plages_conge */ $plages_conge = $plage_conge->loadList($where, $order); // Début et fin d'activite foreach (CEvenementSSR::getActiveTherapeutes($monday, $sunday) as $_therapeute) { // Pseudo plage de début if (($deb = $_therapeute->deb_activite) && $deb >= $monday) { $plage = CPlageConge::makePseudoPlage($_therapeute->_id, "deb", $monday); $plages_conge[$plage->_id] = $plage; } // Pseudo plage de fin if (($fin = $_therapeute->fin_activite) && $fin <= $sunday) {
foreach ($plagesOp as $_op) { $_op->loadRefSalle(); $_op->multicountOperations(); $color = "#BCE"; //to check if group is present group $g = CGroups::loadCurrent(); $_op->loadRefSalle(); $_op->_ref_salle->loadRefBloc(); if ($_op->_ref_salle->_ref_bloc->group_id != $g->_id) { $color = "#748dee"; } ajoutEvent($planning, $_op, $_op->date, $_op->_ref_salle->nom, $color, "operation"); } // plages conge if (CModule::getActive("dPpersonnel")) { $conge = new CPlageConge(); $where_conge = array(); $where_conge["date_debut"] = " <= '{$fin}' "; $where_conge["date_fin"] = " >= '{$debut}' "; $where_conge["user_id"] = " = '{$chirSel}' "; /** @var CPlageConge[] $conges */ $conges = $conge->loadList($where_conge); foreach ($conges as $_conge) { $_dates = array(); $_dates[] = $_conge->date_debut; $_date = $_conge->date_debut; if ($_conge->date_debut != $_conge->date_fin) { while ($_date != $_conge->date_fin) { $_date = CMbDT::date("+1 DAY", $_date); $_dates[] = $_date; }
$conge = new CPlageConge(); $conge->loadFor($therapeute_id, $_day); // Référent en congés if ($conge->_id) { $replacement = new CReplacement(); $replacement->conge_id = $conge->_id; $replacement->sejour_id = $sejour->_id; $replacement->loadMatchingObject(); if ($replacement->_id) { $evenement->therapeute_id = $replacement->replacer_id; } } } // Transfert kiné remplacant => kiné référant si présent if ($sejour->isReplacer($therapeute_id)) { $conge = new CPlageConge(); $conge->loadFor($referent->_id, $_day); // Référent présent if (!$conge->_id) { $evenement->therapeute_id = $referent->_id; } } // Si l'evenement n'est pas une seance collective if ($type_seance != "collective") { $evenement->prescription_line_element_id = $line_id; $evenement->sejour_id = $sejour_id; } // Store de l'evenement ou de la nouvelle seance $msg = $evenement->store(); CAppUI::displayMsg($msg, "CEvenementSSR-msg-create"); $evenement_actes_id = $evenement->_id;
<?php /** * $Id:$ * * @package Mediboard * @subpackage dPpersonnel * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision:$ */ CCanDo::checkRead(); $plage_id = CValue::get("plage_id"); $user_id = CValue::getOrSession("user_id"); $user = CMediusers::get($user_id); // Chargement de la plage $plageconge = new CPlageConge(); $plageconge->user_id = $user_id; $plageconge->load($plage_id); $plageconge->loadRefsNotes(); // Remplaçants disponibles $replacers = $user->loadUsers(); unset($replacers[$user->_id]); // Création du template $smarty = new CSmartyDP(); $smarty->assign("user", $user); $smarty->assign("plageconge", $plageconge); $smarty->assign("replacers", $replacers); $smarty->display("inc_edit_plage_conge.tpl");
*/ $sejour_id = CValue::post("sejour_id"); $conge_id = CValue::post("conge_id"); $replacer_id = CValue::post("replacer_id"); // Standard plage $conge = new CPlageConge(); $conge->load($conge_id); // Week dates $date = CValue::getOrSession("date", CMbDT::date()); $monday = CMbDT::date("last monday", CMbDT::date("+1 DAY", $date)); $sunday = CMbDT::date("next sunday", CMbDT::date("-1 DAY", $date)); // Pseudo plage for user activity if (preg_match("/[deb|fin][\\W][\\d]+/", $conge_id)) { list($activite, $user_id) = explode("-", $conge_id); $limit = $activite == "deb" ? $monday : $sunday; $conge = CPlageConge::makePseudoPlage($user_id, $activite, $limit); } // Events to be transfered $evenement = new CEvenementSSR(); $where = array(); $date_min = max($monday, $conge->date_debut); $date_max = CMbDT::date("+1 DAY", min($sunday, $conge->date_fin)); $where["therapeute_id"] = " = '{$conge->user_id}'"; $where["sejour_id"] = " = '{$sejour_id}'"; $where["debut"] = " BETWEEN '{$date_min}' AND '{$date_max}'"; /** @var CEvenementSSR[] $evenements */ $evenements = $evenement->loadList($where); foreach ($evenements as $_evenement) { $_evenement->therapeute_id = $replacer_id; $msg = $_evenement->store(); CAppUI::displayMsg($msg, "CEvenementSSR-msg-modify");
<?php /** * $Id:$ * * @package Mediboard * @subpackage dPpersonnel * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision:$ */ // Get filter $filter = new CPlageConge(); $year = date("Y"); $filter->user_id = CValue::get("user_id", CAppUI::$user->_id); $filter->_id = CValue::get("plage_id", ""); $filter->date_debut = CValue::get("date_debut", "{$year}-01-01"); $filter->date_fin = CValue::get("date_fin", "{$year}-12-31"); // load available users $mediuser = new CMediusers(); $mediusers = $mediuser->loadListFromType(); // load ref function foreach ($mediusers as $_medius) { $_medius->loadRefFunction(); } // Query $where = array(); $where["user_id"] = CSQLDataSource::prepareIn(array_keys($mediusers), $filter->user_id); $debut = CValue::first($filter->date_debut, $filter->date_fin); $fin = CValue::first($filter->date_fin, $filter->date_debut); if ($fin || $debut) {
$where = array(); if ($function_id) { $where["function_id"] = " = '{$function_id}'"; } else { $where["user_id"] = " = '{$prat_id}'"; } $prats = $prat->loadList($where); $function = new CFunctions(); $function->load($function_id); $ds = $function->getDS(); $calendar = new CPlanningMonth($date); $calendar->title = htmlentities(CMbDT::format($date, "%B %Y")); foreach ($prats as $_prat) { // plages de congés (si mode prat) if (!$function_id && CModule::getActive("dPpersonnel")) { $plage_cong = new CPlageConge(); $plages_cong = $plage_cong->loadListForRange($_prat->_id, $calendar->date_min, $calendar->date_max); foreach ($plages_cong as $_conge) { $first_day = $_conge->date_debut; $last_day = $_conge->date_fin; $replaced_by = new CMediusers(); $replaced_by->load($_conge->replacer_id); while ($last_day >= $first_day) { $calendar->addClassesForDay("disabled", $first_day); if ($replaced_by->_id) { $event = new CPlanningEvent($_conge->_guid, $first_day); $event->title = "<strong>" . ($_conge->_view ? $_conge->_view : "Congés"); if ($function_id) { $event->title .= " (" . $_prat->_shortview . ")"; } $event->title .= $replaced_by ? " remplacé par " . $replaced_by->_view . "</strong> " : null;
$actes = CValue::get("actes"); $function = new CFunctions(); $function->load($function_id); $muser = new CMediusers(); $musers = $muser->loadProfessionnelDeSanteByPref(PERM_READ, $function_id, null, true); $planning = new CPlanningWeek(0, 0, count($musers), count($musers), false, "auto"); $planning->title = "Planning du " . htmlentities(CMbDT::format($date, "%A %d %B %Y")); $planning->guid = "planning_j_n"; $planning->dragndrop = 1; $planning->hour_divider = 12; $planning->show_half = true; $i = 0; foreach ($musers as $_user) { $user_id = $_user->_id; // plages conge $conge = new CPlageConge(); $where = array(); $where["date_debut"] = " <= '{$date}'"; $where["date_fin"] = " >= '{$date}'"; $where["user_id"] = " = '{$_user->_id}'"; $nb_conges = $conge->countList($where); if ($nb_conges) { $conge->loadObject($where); $libelle = '<h3 style="text-align: center"> CONGES</h3> <p style="text-align: center">' . CMbString::htmlEntities($conge->libelle) . '</p>'; if ($conge->replacer_id) { $replacer = $conge->loadRefReplacer(); $libelle .= '<p style="text-align: center">Remplacé par : ' . CMbString::htmlEntities($replacer->_view) . '</p>'; } $event = new CPlanningEvent($conge->_guid, "{$i} {$conge->date_debut} 00:00:00", 1440, $libelle, "#ffe87e", true, "hatching", null, false);
/** * Charge les possibles congés du remplacant pendant le remplacement * * @return CPlageConge[] */ function checkCongesRemplacer() { $this->loadDates(); $conge = new CPlageConge(); return $this->_ref_replacer_conges = $conge->loadListForRange($this->replacer_id, $this->_min_deb, $this->_max_fin); }