本文整理汇总了PHP中Calendar::dropdown方法的典型用法代码示例。如果您正苦于以下问题:PHP Calendar::dropdown方法的具体用法?PHP Calendar::dropdown怎么用?PHP Calendar::dropdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Calendar
的用法示例。
在下文中一共展示了Calendar::dropdown方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showHelpdeskOptions
/**
* @since version 0.84 (before in entitydata.class)
*
* @param $entity Entity object
**/
static function showHelpdeskOptions(Entity $entity)
{
global $CFG_GLPI;
$ID = $entity->getField('id');
if (!$entity->can($ID, READ) || !Session::haveRightsOr(self::$rightname, array(self::READHELPDESK, self::UPDATEHELPDESK))) {
return false;
}
$canedit = Session::haveRight(self::$rightname, self::UPDATEHELPDESK) && Session::haveAccessToEntity($ID);
echo "<div class='spaced'>";
if ($canedit) {
echo "<form method='post' name=form action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
}
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . _n('Ticket template', 'Ticket templates', 1) . "</td>";
echo "<td colspan='2'>";
$toadd = array();
if ($ID != 0) {
$toadd = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'));
}
$options = array('value' => $entity->fields["tickettemplates_id"], 'entity' => $ID, 'toadd' => $toadd);
TicketTemplate::dropdown($options);
if ($entity->fields["tickettemplates_id"] == self::CONFIG_PARENT && $ID != 0) {
echo "<font class='green'> ";
$tt = new TicketTemplate();
$tid = self::getUsedConfig('tickettemplates_id', $ID, '', 0);
if (!$tid) {
echo Dropdown::EMPTY_VALUE;
} else {
if ($tt->getFromDB($tid)) {
echo $tt->getLink();
}
}
echo "</font>";
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Calendar') . "</td>";
echo "<td colspan='2'>";
$options = array('value' => $entity->fields["calendars_id"], 'emptylabel' => __('24/7'));
if ($ID != 0) {
$options['toadd'] = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'));
}
Calendar::dropdown($options);
if ($entity->fields["calendars_id"] == self::CONFIG_PARENT && $ID != 0) {
echo "<font class='green'> ";
$calendar = new Calendar();
$cid = self::getUsedConfig('calendars_id', $ID, '', 0);
if (!$cid) {
_e('24/7');
} else {
if ($calendar->getFromDB($cid)) {
echo $calendar->getLink();
}
}
echo "</font>";
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Tickets default type') . "</td>";
echo "<td colspan='2'>";
$toadd = array();
if ($ID != 0) {
$toadd = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'));
}
Ticket::dropdownType('tickettype', array('value' => $entity->fields["tickettype"], 'toadd' => $toadd));
if ($entity->fields['tickettype'] == self::CONFIG_PARENT && $ID != 0) {
echo "<font class='green'> ";
echo Ticket::getTicketTypeName(self::getUsedConfig('tickettype', $ID, '', Ticket::INCIDENT_TYPE));
echo "</font>";
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Automatic assignment of tickets') . "</td>";
echo "<td colspan='2'>";
$autoassign = self::getAutoAssignMode();
if ($ID == 0) {
unset($autoassign[self::CONFIG_PARENT]);
}
Dropdown::showFromArray('auto_assign_mode', $autoassign, array('value' => $entity->fields["auto_assign_mode"]));
if ($entity->fields['auto_assign_mode'] == self::CONFIG_PARENT && $ID != 0) {
$auto_assign_mode = self::getUsedConfig('auto_assign_mode', $entity->fields['entities_id']);
echo "<font class='green'> ";
echo $autoassign[$auto_assign_mode];
echo "</font>";
}
echo "</td></tr>";
echo "<tr><th colspan='4'>" . __('Automatic closing configuration') . "</th></tr>";
echo "<tr class='tab_bg_1'>" . "<td colspan='2'>" . __('Automatic closing of solved tickets after') . "</td>";
echo "<td colspan='2'>";
$autoclose = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'), self::CONFIG_NEVER => __('Never'), 0 => __('Immediatly'));
if ($ID == 0) {
unset($autoclose[self::CONFIG_PARENT]);
}
Dropdown::showNumber('autoclose_delay', array('value' => $entity->fields['autoclose_delay'], 'min' => 1, 'max' => 99, 'step' => 1, 'toadd' => $autoclose, 'unit' => 'day'));
if ($entity->fields['autoclose_delay'] == self::CONFIG_PARENT && $ID != 0) {
$autoclose_mode = self::getUsedConfig('autoclose_delay', $entity->fields['entities_id'], '', self::CONFIG_NEVER);
echo "<br><font class='green'> ";
if ($autoclose_mode >= 0) {
//.........这里部分代码省略.........
示例2: showForm
/**
* Print the sla form
*
* @param $ID integer ID of the item
* @param $options array of possible options:
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
*@return boolean item found
**/
function showForm($ID, $options = array())
{
$rowspan = 4;
if ($ID > 0) {
$rowspan = 5;
}
$this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "name", array('value' => $this->fields["name"]));
echo "<td rowspan='" . $rowspan . "'>" . __('Comments') . "</td>";
echo "<td rowspan='" . $rowspan . "'>\n <textarea cols='45' rows='8' name='comment' class='form-control' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>";
if ($ID > 0) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Last update') . "</td>";
echo "<td>" . ($this->fields["date_mod"] ? Html::convDateTime($this->fields["date_mod"]) : __('Never'));
echo "</td></tr>";
}
echo "<tr class='tab_bg_1'><td>" . __('Calendar') . "</td>";
echo "<td>";
Calendar::dropdown(array('value' => $this->fields["calendars_id"], 'emptylabel' => __('24/7'), 'toadd' => array('-1' => __('Calendar of the ticket'))));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Maximum time to solve') . "</td>";
echo "<td>";
Dropdown::showNumber("resolution_time", array('value' => $this->fields["resolution_time"], 'min' => 0));
$possible_values = array('minute' => _n('Minute', 'Minutes', Session::getPluralNumber()), 'hour' => _n('Hour', 'Hours', Session::getPluralNumber()), 'day' => _n('Day', 'Days', Session::getPluralNumber()));
$rand = Dropdown::showFromArray('definition_time', $possible_values, array('value' => $this->fields["definition_time"], 'on_change' => 'appearhideendofworking()'));
echo "\n<script type='text/javascript' >\n";
echo "function appearhideendofworking() {\n";
echo "if (\$('#dropdown_definition_time{$rand} option:selected').val() == 'day') {\n \$('#title_endworkingday').show();\n \$('#dropdown_endworkingday').show();\n } else {\n \$('#title_endworkingday').hide();\n \$('#dropdown_endworkingday').hide();\n }";
echo "}\n";
echo "appearhideendofworking();\n";
echo "</script>\n";
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td><div id='title_endworkingday'>" . __('End of working day') . "</div></td>";
echo "<td><div id='dropdown_endworkingday'>";
Dropdown::showYesNo("end_of_working_day", $this->fields["end_of_working_day"]);
echo "</div></td></tr>";
$this->showFormButtons($options);
return true;
}
示例3: showForm
/**
* Print the sla form
*
* @param $ID integer ID of the item
* @param $options array of possible options:
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
*@return boolean item found
**/
function showForm($ID, $options = array())
{
$rowspan = 4;
if ($ID > 0) {
$rowspan = 6;
}
// Get SLA object
$sla = new SLA();
if (isset($options['parent'])) {
$sla = $options['parent'];
} else {
$sla->getFromDB($this->fields['slas_id']);
}
if ($ID > 0) {
$this->check($ID, READ);
} else {
// Create item
$options[static::$items_id] = $sla->getField('id');
//force itemtype of parent
static::$itemtype = get_class($sla);
$this->check(-1, CREATE, $options);
}
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "name", array('value' => $this->fields["name"]));
echo "<td rowspan='" . $rowspan . "'>" . __('Comments') . "</td>";
echo "<td rowspan='" . $rowspan . "'>\n <textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('SLA') . "</td>";
echo "<td>";
echo $sla->getLink();
echo "<input type='hidden' name='slas_id' value='" . $this->fields['slas_id'] . "'>";
echo "</td></tr>";
if ($ID > 0) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Last update') . "</td>";
echo "<td>" . ($this->fields["date_mod"] ? Html::convDateTime($this->fields["date_mod"]) : __('Never'));
echo "</td></tr>";
}
echo "<tr class='tab_bg_1'><td>" . __('Calendar') . "</td>";
echo "<td>";
Calendar::dropdown(array('value' => $this->fields["calendars_id"], 'emptylabel' => __('24/7'), 'toadd' => array('-1' => __('Calendar of the ticket'))));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Type') . "</td>";
echo "<td>";
self::getSltTypeDropdown(array('value' => $this->fields["type"]));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'><td>" . __('Maximum time to solve') . "</td>";
echo "<td>";
Dropdown::showNumber("resolution_time", array('value' => $this->fields["resolution_time"], 'min' => 0));
$possible_values = array('minute' => _n('Minute', 'Minutes', Session::getPluralNumber()), 'hour' => _n('Hour', 'Hours', Session::getPluralNumber()), 'day' => _n('Day', 'Days', Session::getPluralNumber()));
$rand = Dropdown::showFromArray('definition_time', $possible_values, array('value' => $this->fields["definition_time"], 'on_change' => 'appearhideendofworking()'));
echo "\n<script type='text/javascript' >\n";
echo "function appearhideendofworking() {\n";
echo "if (\$('#dropdown_definition_time{$rand} option:selected').val() == 'day') {\n \$('#title_endworkingday').show();\n \$('#dropdown_endworkingday').show();\n } else {\n \$('#title_endworkingday').hide();\n \$('#dropdown_endworkingday').hide();\n }";
echo "}\n";
echo "appearhideendofworking();\n";
echo "</script>\n";
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td><div id='title_endworkingday'>" . __('End of working day') . "</div></td>";
echo "<td><div id='dropdown_endworkingday'>";
Dropdown::showYesNo("end_of_working_day", $this->fields["end_of_working_day"]);
echo "</div></td></tr>";
$this->showFormButtons($options);
return true;
}
示例4: showForm
/**
* Print the sla form
*
* @param $ID integer ID of the item
* @param $options array of possible options:
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
*@return boolean item found
**/
function showForm($ID, $options = array())
{
$rowspan = 3;
if ($ID > 0) {
$rowspan = 4;
}
$this->initForm($ID, $options);
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "name", array('value' => $this->fields["name"]));
echo "<td rowspan='" . $rowspan . "'>" . __('Comments') . "</td>";
echo "<td rowspan='" . $rowspan . "'>\n <textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>";
if ($ID > 0) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Last update') . "</td>";
echo "<td>" . ($this->fields["date_mod"] ? Html::convDateTime($this->fields["date_mod"]) : __('Never'));
echo "</td></tr>";
}
echo "<tr class='tab_bg_1'><td>" . __('Calendar') . "</td>";
echo "<td>";
Calendar::dropdown(array('value' => $this->fields["calendars_id"], 'emptylabel' => __('24/7'), 'toadd' => array('-1' => __('Calendar of the ticket'))));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Maximum time to solve') . "</td>";
echo "<td>";
$possible_values = array();
for ($i = 10; $i < 60; $i += 10) {
$possible_values[$i * MINUTE_TIMESTAMP] = sprintf(_n('%d minutes', '%d minutes', $i), $i);
}
for ($i = 1; $i < 24; $i++) {
$possible_values[$i * HOUR_TIMESTAMP] = sprintf(_n('%d hour', '%d hours', $i), $i);
}
for ($i = 1; $i < 30; $i++) {
$possible_values[$i * DAY_TIMESTAMP] = sprintf(_n('%d day', '%d days', $i), $i);
}
Dropdown::showFromArray('resolution_time', $possible_values, array('value' => $this->fields["resolution_time"]));
echo "</td></tr>";
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例5: showForm
/**
* Print the sla form
*
* @param $ID integer ID of the item
* @param $options array of possible options:
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
*@return boolean item found
**/
function showForm($ID, $options = array())
{
$rowspan = 2;
$this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "name", array('value' => $this->fields["name"]));
echo "<td rowspan='" . $rowspan . "'>" . __('Comments') . "</td>";
echo "<td rowspan='" . $rowspan . "'>\n <textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Calendar') . "</td>";
echo "<td>";
Calendar::dropdown(array('value' => $this->fields["calendars_id"], 'emptylabel' => __('24/7'), 'toadd' => array('-1' => __('Calendar of the ticket'))));
echo "</td></tr>";
$this->showFormButtons($options);
return true;
}