. * --------------------------------------------------------------------- */ 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 0.84 **/ function getForbiddenStandardMassiveAction() { $forbidden = parent::getForbiddenStandardMassiveAction(); $forbidden[] = 'update'; return $forbidden; } /** * Show holidays for a calendar * * @param $calendar Calendar object * * @return void|boolean (HTML display) False if there is a rights error. */ static function showForCalendar(Calendar $calendar) { global $DB; $ID = $calendar->getField('id'); if (!$calendar->can($ID, READ)) { return false; } $canedit = $calendar->can($ID, UPDATE); $rand = mt_rand(); $iterator = $DB->request([ 'SELECT' => [ 'glpi_calendars_holidays.id AS linkid', 'glpi_holidays.*' ], 'DISTINCT' => true, 'FROM' => 'glpi_calendars_holidays', 'LEFT JOIN' => [ 'glpi_holidays' => [ 'ON' => [ 'glpi_calendars_holidays' => 'holidays_id', 'glpi_holidays' => 'id' ] ] ], 'WHERE' => [ 'glpi_calendars_holidays.calendars_id' => $ID ], 'ORDERBY' => 'glpi_holidays.name' ]); $numrows = count($iterator); $holidays = []; $used = []; while ($data = $iterator->next()) { $holidays[$data['id']] = $data; $used[$data['id']] = $data['id']; } if ($canedit) { echo "
| "; echo Html::getCheckAllAsCheckbox('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 "