Example #1
0
/**
 * View astreintes calendar
 *  
 * @category Astreintes
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html 
 * @version  SVN: $Id:\$ 
 * @link     http://www.mediboard.org
 */
CCanDo::checkEdit();
$date = CValue::getOrSession("date", CMbDT::date());
$mode = CValue::getOrSession("mode", "week");
$group = CGroups::loadCurrent();
$user = CMediusers::get();
$astreinte = new CPlageAstreinte();
$where = array();
$where["group_id"] = " = '{$group->_id}' ";
$order = "start ASC,end ASC";
switch ($mode) {
    case 'day':
        $where["start"] = "< '{$date} 23:59:00'";
        $where["end"] = "> '{$date} 00:00:00'";
        $date_next = CMbDT::date("+1 DAY", $date);
        $date_prev = CMbDT::date("-1 DAY", $date);
        $calendar = new CPlanningDay($date);
        break;
    case 'month':
        $month_first = CMbDT::date("first day of this month", $date);
        $month_last = CMbDT::date("last day of this month", $month_first);
        $where["start"] = "< '{$month_last} 23:59:00'";
Example #2
0
        }
    } else {
        list($a, $m, $j) = explode("-", $filter->start);
        $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);
$plageastreinte = new CPlageAstreinte();
$plagesconge = array();
$orderby = "user_id";
/** @var CPlageAstreinte[] $plagesastreintes */
$plagesastreintes = $plageastreinte->loadList($where, $orderby);
$tabUser_plage = array();
$tabUser_plage_indices = array();
foreach ($plagesastreintes as $_plage) {
    $_plage->loadRefUser();
    $_plage->_ref_user->loadRefFunction();
    $_plage->_deb = CMbDT::daysRelative($debut_periode, $_plage->start);
    $_plage->_fin = CMbDT::daysRelative($_plage->start, $_plage->end) + 1;
    $_plage->_duree = CMbDT::daysRelative($_plage->start, $_plage->end) + 1;
}
$smarty = new CSmartyDP();
$smarty->assign("debut_periode", $debut_periode);
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 */
CCanDo::checkEdit();
$plage_id = CValue::get("plage_id");
$plage_date = CValue::get("date");
$plage_hour = CValue::get("hour");
$plage_minutes = CValue::get("minutes");
$user_id = CValue::get("user_id");
$user = CMediusers::get($user_id);
$group = CGroups::loadCurrent();
$users = array($user);
$ljoin = array("users" => "users.user_id = users_mediboard.user_id", "functions_mediboard" => "functions_mediboard.function_id = users_mediboard.function_id");
$where = array("users_mediboard.actif" => "= '1' ", "group_id" => " = '{$group->_id}' ");
$users = $user->loadListWithPerms(PERM_EDIT, $where, "users.user_last_name", null, null, $ljoin);
$plageastreinte = new CPlageAstreinte();
// edition
if ($plage_id) {
    $plageastreinte->load($plage_id);
    $plageastreinte->loadRefsNotes();
}
// creation
if (!$plageastreinte->_id) {
    // phone
    $plageastreinte->phone_astreinte = $user->_user_astreinte;
    $plageastreinte->group_id = CGroups::loadCurrent()->_id;
    // date & hour
    if ($plage_date && $plage_hour) {
        $plageastreinte->start = "{$plage_date} {$plage_hour}:{$plage_minutes}:00";
    }
    // user
<?php

/** $Id */
/**
 * @package Mediboard
 * @subpackage dPpersonnel
 * @version $Revision:
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 */
// Get filter
$filter = new CPlageAstreinte();
$year = date("Y");
$group = CGroups::loadCurrent();
$today = CMbDT::dateTime();
$filter->user_id = CValue::get("user_id", CAppUI::$user->_id);
$filter->_id = CValue::get("plage_id", "");
$filter->start = CValue::get("start", "{$year}-01-01");
$filter->end = CValue::get("end", "{$year}-12-31");
// load available users
$mediuser = new CMediusers();
$mediusers = $mediuser->loadListFromType();
$user = CMediusers::get($filter->user_id);
// load ref function
foreach ($mediusers as $mid => $_medius) {
    $_medius->loadRefFunction();
}
// Query
$where = array();
$where["user_id"] = CSQLDataSource::prepareIn(array_keys($mediusers), $filter->user_id);
$where["group_id"] = " = '{$group->_id}'";
<?php

/** $Id: **/
/**
 * @package Mediboard
 * @subpackage dPpersonnel
 * @version $Revision:
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 */
CCanDo::checkRead();
$date = CValue::get("date", CMbDT::date());
$group = CGroups::loadCurrent();
// Plages d'astreinte pour l'utilisateur
$plage_astreinte = new CPlageAstreinte();
$where = array();
$where["start"] = "< '{$date} 23:59:00'";
$where["end"] = "> '{$date} 00:00:00'";
$where["group_id"] = " = '{$group->_id}' ";
$plages_astreinte = $plage_astreinte->loadList($where);
/** @var $plages_astreinte CPlageAstreinte[] */
foreach ($plages_astreinte as $_plage) {
    $_plage->loadRefUser();
    $_plage->loadRefColor();
}
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("plages_astreinte", $plages_astreinte);
$smarty->assign("title", CAppUI::tr("CPlageAstreinte.For") . " " . htmlentities(CMbDT::format($date, CAppUI::conf("longdate"))));
$smarty->assign("date", $date);
$smarty->display("vw_list_day_astreinte.tpl");
<?php

/** $Id: */
/**
 * @package Mediboard
 * @subpackage dPpersonnel
 * @version $Revision:
 * @author SARL OpenXtrem
 * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 */
//CCanDo::checkRead();
$user_id = CValue::getorSession("user_id");
$user = new CMediusers();
$user->load($user_id);
$today = CMbDT::dateTime();
// Plages d'astreinte pour l'utilisateur
$plage_astreinte = new CPlageAstreinte();
$plage_astreinte->user_id = $user_id;
$plages_astreinte = $plage_astreinte->loadMatchingList("start DESC", 100);
$new_plageastreinte = new CPlageAstreinte();
$plage_id = CValue::get("plage_id");
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("user", $user);
$smarty->assign("plages_astreinte", $plages_astreinte);
$smarty->assign("new_plageastreinte", $new_plageastreinte);
$smarty->assign("plage_id", $plage_id);
$smarty->assign("today", $today);
$smarty->display("inc_liste_plages_astreinte.tpl");