Пример #1
0
<?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");
/**
 * $Id$
 *
 * @package    Mediboard
 * @subpackage SSR
 * @author     SARL OpenXtrem <*****@*****.**>
 * @license    GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version    $Revision$
 */
$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));