grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026. -------------------------------------------------------------------------- */ /** @file * @brief */ if (!defined('GLPI_ROOT')) { die("Sorry. You can't access this file directly"); } class Calendar_Holiday extends CommonDBRelation { public $auto_message_on_action = false; // From CommonDBRelation static public $itemtype_1 = 'Calendar'; static public $items_id_1 = 'calendars_id'; static public $itemtype_2 = 'Holiday'; static public $items_id_2 = 'holidays_id'; static public $checkItem_2_Rights = self::DONT_CHECK_ITEM_RIGHTS; /** * @since version 0.84 **/ function getForbiddenStandardMassiveAction() { $forbidden = parent::getForbiddenStandardMassiveAction(); $forbidden[] = 'update'; return $forbidden; } /** * Show holidays for a calendar * * @param $calendar Calendar object **/ static function showForCalendar(Calendar $calendar) { global $DB, $CFG_GLPI; $ID = $calendar->getField('id'); if (!$calendar->can($ID, READ)) { return false; } $canedit = $calendar->can($ID, UPDATE); $rand = mt_rand(); $query = "SELECT DISTINCT `glpi_calendars_holidays`.`id` AS linkID, `glpi_holidays`.* FROM `glpi_calendars_holidays` LEFT JOIN `glpi_holidays` ON (`glpi_calendars_holidays`.`holidays_id` = `glpi_holidays`.`id`) WHERE `glpi_calendars_holidays`.`calendars_id` = '$ID' ORDER BY `glpi_holidays`.`name`"; $result = $DB->query($query); $holidays = array(); $used = array(); if ($numrows = $DB->numrows($result)) { while ($data = $DB->fetch_assoc($result)) { $holidays[$data['id']] = $data; $used[$data['id']] = $data['id']; } } if ($canedit) { echo "
| "; Html::checkAllAsCheckbox('mass'.__CLASS__.$rand); echo " | "; } echo "".__('Name')." | "; echo "".__('Start')." | "; echo "".__('End')." | "; echo "".__('Recurrent')." | "; echo "
|---|---|---|---|---|
| "; Html::showMassiveActionCheckBox(__CLASS__, $data["linkID"]); echo " | "; } echo "". $data["name"]." | "; echo "".Html::convDate($data["begin_date"])." | "; echo "".Html::convDate($data["end_date"])." | "; echo "".Dropdown::getYesNo($data["is_perpetual"])." | "; echo "