本文整理汇总了PHP中Planning::dropdownState方法的典型用法代码示例。如果您正苦于以下问题:PHP Planning::dropdownState方法的具体用法?PHP Planning::dropdownState怎么用?PHP Planning::dropdownState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Planning
的用法示例。
在下文中一共展示了Planning::dropdownState方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForm
/**
* Print the reminder form
*
* @param $ID integer Id of the item to print
* @param $options array of possible options:
* - target filename : where to go when done.
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
$this->initForm($ID, $options);
// Show Reminder or blank form
$onfocus = "";
if (!$ID > 0) {
// Create item : do getempty before check right to set default values
$onfocus = "onfocus=\"if (this.value=='" . $this->fields['name'] . "') this.value='';\"";
}
$canedit = $this->can($ID, 'w');
if ($canedit) {
Html::initEditorSystem('text');
}
$this->showTabs($options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_2'><td>" . __('Title') . "</td>";
echo "<td>";
if ($canedit) {
Html::autocompletionTextField($this, "name", array('size' => 80, 'entity' => -1, 'user' => $this->fields["users_id"], 'option' => $onfocus));
} else {
echo $this->fields['name'];
}
echo "</td>\n";
echo "<td>" . __('By') . "</td>";
echo "<td>";
echo getUserName($this->fields["users_id"]);
if (!$ID) {
echo "<input type='hidden' name='users_id' value='" . $this->fields['users_id'] . "'>\n";
}
echo "</td></tr>\n";
echo "<tr class='tab_bg_2'>";
echo "<td>" . _x('reminder', 'Visibility') . "</td>";
echo "<td>";
echo '<table><tr><td>';
echo __('Begin') . '</td><td>';
Html::showDateTimeFormItem("begin_view_date", $this->fields["begin_view_date"], 1, true, $canedit);
echo '</td><td>' . __('End') . '</td><td>';
Html::showDateTimeFormItem("end_view_date", $this->fields["end_view_date"], 1, true, $canedit);
echo '</td></tr></table>';
echo "</td>";
echo "<td>" . __('Status') . "</td>";
echo "<td>";
if ($canedit) {
Planning::dropdownState("state", $this->fields["state"]);
} else {
echo Planning::getState($this->fields["state"]);
}
echo "</td>\n";
echo "</tr>\n";
echo "<tr class='tab_bg_2'><td >" . __('Calendar') . "</td>";
echo "<td class='center'>";
if ($canedit) {
echo "<script type='text/javascript' >\n";
echo "function showPlan() {\n";
echo "Ext.get('plan').setDisplayed('none');";
$params = array('form' => 'remind', 'users_id' => $this->fields["users_id"], 'itemtype' => $this->getType(), 'items_id' => $this->getID());
if ($ID && $this->fields["is_planned"]) {
$params['begin'] = $this->fields["begin"];
$params['end'] = $this->fields["end"];
}
Ajax::updateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params);
echo "}";
echo "</script>\n";
}
if (!$ID || !$this->fields["is_planned"]) {
if (Session::haveRight("show_planning", "1") || Session::haveRight("show_group_planning", "1") || Session::haveRight("show_all_planning", "1")) {
echo "<div id='plan' onClick='showPlan()'>\n";
echo "<a href='#' class='vsubmit'>" . __('Add to schedule') . "</a>";
}
} else {
if ($canedit) {
echo "<div id='plan' onClick='showPlan()'>\n";
echo "<span class='showplan'>";
}
//TRANS: %1$s is the begin date, %2$s is the end date
printf(__('From %1$s to %2$s'), Html::convDateTime($this->fields["begin"]), Html::convDateTime($this->fields["end"]));
if ($canedit) {
echo "</span>";
}
}
if ($canedit) {
echo "</div>\n";
echo "<div id='viewplan'>\n</div>\n";
}
echo "</td>";
if ($ID && $this->fields["is_planned"] && PlanningRecall::isAvailable()) {
echo "<td>" . _x('Planning', 'Reminder') . "</td>";
echo "<td>";
if ($canedit) {
PlanningRecall::dropdown(array('itemtype' => 'Reminder', 'items_id' => $ID));
} else {
// No edit right : use specific Planning Recall Form
//.........这里部分代码省略.........
示例2: getSpecificValueToSelect
/**
* @since version 0.84
*
* @param $field
* @param $name (default '')
* @param $values (default '')
* @param $options array
*
* @return string
**/
static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
$options['display'] = false;
switch ($field) {
case 'priority':
$options['name'] = $name;
$options['value'] = $values[$field];
$options['withmajor'] = 1;
return CommonITILObject::dropdownPriority($options);
case 'visibility':
$options['name'] = $name;
$options['value'] = $values[$field];
return self::dropdownVisibility($options);
case 'state':
return Planning::dropdownState($name, $values[$field], false);
}
return parent::getSpecificValueToSelect($field, $name, $values, $options);
}
示例3: showFormUserPrefs
//.........这里部分代码省略.........
$selected = "selected='selected'";
}
echo "<option value='{$key}' {$selected}>" . ucfirst($name) . "</option>";
}
echo Html::scriptBlock("\n function formatLayout(layout) {\n return \" <img src='../pics/layout_\" + layout.id.toLowerCase() + \".png'/>\"\n + \" \" + layout.text;\n }\n \$(\"#layout-selector\").select2({\n formatResult: formatLayout,\n formatSelection: formatLayout,\n escapeMarkup: function(m) { return m; }\n });\n ");
echo "</select>";
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_2'><td>" . __('Enable ticket timeline') . "</td>";
echo "<td>";
Dropdown::showYesNo('ticket_timeline', $data['ticket_timeline']);
echo "</td>";
echo "<td>" . __('Keep tabs replaced by the ticket timeline') . "</td><td>";
Dropdown::showYesNo('ticket_timeline_keep_replaced_tabs', $data['ticket_timeline_keep_replaced_tabs']);
echo "</td></tr>";
if ($oncentral) {
echo "<tr class='tab_bg_1'><th colspan='4'>" . __('Assistance') . "</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Private followups by default') . "</td><td>";
Dropdown::showYesNo("followup_private", $data["followup_private"]);
echo "</td><td>" . __('Show new tickets on the home page') . "</td><td>";
if (Session::haveRightsOr("ticket", array(Ticket::READMY, Ticket::READALL, Ticket::READASSIGN))) {
Dropdown::showYesNo("show_jobs_at_login", $data["show_jobs_at_login"]);
} else {
echo Dropdown::getYesNo(0);
}
echo " </td></tr>";
echo "<tr class='tab_bg_2'><td>" . __('Private tasks by default') . "</td><td>";
Dropdown::showYesNo("task_private", $data["task_private"]);
echo "</td><td> " . __('Request sources by default') . "</td><td>";
RequestType::dropdown(array('value' => $data["default_requesttypes_id"], 'name' => "default_requesttypes_id"));
echo "</td></tr>";
echo "<tr class='tab_bg_2'><td>" . __('Tasks state by default') . "</td><td>";
Planning::dropdownState("task_state", $data["task_state"]);
echo "</td><td colspan='2'> </td></tr>";
echo "<tr class='tab_bg_2'><td>" . __('Pre-select me as a technician when creating a ticket') . "</td><td>";
if (!$userpref || Session::haveRight('ticket', Ticket::OWN)) {
Dropdown::showYesNo("set_default_tech", $data["set_default_tech"]);
} else {
echo Dropdown::getYesNo(0);
}
echo "</td><td>" . __('Automatically refresh the list of tickets (minutes)') . "</td><td>";
Dropdown::showNumber('refresh_ticket_list', array('value' => $data["refresh_ticket_list"], 'min' => 1, 'max' => 30, 'step' => 1, 'toadd' => array(0 => __('Never'))));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Priority colors') . "</td>";
echo "<td colspan='3'>";
echo "<table><tr>";
echo "<td>1 ";
Html::showColorField('priority_1', array('value' => $data["priority_1"]));
echo "</td>";
echo "<td>2 ";
Html::showColorField('priority_2', array('value' => $data["priority_2"]));
echo "</td>";
echo "<td>3 ";
Html::showColorField('priority_3', array('value' => $data["priority_3"]));
echo "</td>";
echo "<td>4 ";
Html::showColorField('priority_4', array('value' => $data["priority_4"]));
echo "</td>";
echo "<td>5 ";
Html::showColorField('priority_5', array('value' => $data["priority_5"]));
echo "</td>";
echo "<td>6 ";
Html::showColorField('priority_6', array('value' => $data["priority_6"]));
示例4: getSpecificValueToSelect
/**
* @param $field
* @param $name (default '')
* @param $values (default '')
* @param $options array
**/
static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
{
if (!is_array($values)) {
$values = array($field => $values);
}
$options['display'] = false;
switch ($field) {
case 'refresh_rate':
return Planning::dropdownState($name, $values[$field], false);
}
return parent::getSpecificValueToSelect($field, $name, $values, $options);
}
示例5: showForm
/** form for Task
*
* @param $ID Integer : Id of the task
* @param $options array
* - parent Object : the object
**/
function showForm($ID, $options = array())
{
global $DB, $CFG_GLPI;
$rand_template = mt_rand();
$rand_text = mt_rand();
$rand_type = mt_rand();
$rand_time = mt_rand();
if (isset($options['parent']) && !empty($options['parent'])) {
$item = $options['parent'];
}
$fkfield = $item->getForeignKeyField();
if ($ID > 0) {
$this->check($ID, READ);
} else {
// Create item
$options[$fkfield] = $item->getField('id');
$this->check(-1, CREATE, $options);
}
$rand = mt_rand();
$this->showFormHeader($options);
$canplan = !$item->isStatusExists(CommonITILObject::PLANNED) || $item->isAllowedStatus($item->fields['status'], CommonITILObject::PLANNED);
$rowspan = 5;
if ($this->maybePrivate()) {
$rowspan++;
}
if (isset($this->fields["state"])) {
$rowspan++;
}
echo "<tr class='tab_bg_1'>";
echo "<td rowspan='{$rowspan}' style='width:100px'>" . __('Description') . "</td>";
echo "<td rowspan='{$rowspan}' style='width:50%' id='content{$rand_text}'>" . "<textarea name='content' style='width: 95%; height: 160px' id='task{$rand_text}'>" . $this->fields["content"] . "</textarea>";
echo Html::scriptBlock("\$(document).ready(function() { \$('#content{$rand}').autogrow(); });");
echo "</td>";
echo "<input type='hidden' name='{$fkfield}' value='" . $this->fields[$fkfield] . "'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td style='width:100px'>" . _n('Task template', 'Task templates', 1) . "</td><td>";
TaskTemplate::dropdown(array('value' => 0, 'entity' => $this->getEntityID(), 'rand' => $rand_template, 'on_change' => 'tasktemplate_update(this.value)'));
echo "</td>";
echo "</tr>";
echo Html::scriptBlock('
function tasktemplate_update(value) {
jQuery.ajax({
url: "' . $CFG_GLPI["root_doc"] . '/ajax/task.php",
type: "POST",
data: {
tasktemplates_id: value
}
}).done(function(datas) {
datas.taskcategories_id = isNaN(parseInt(datas.taskcategories_id)) ? 0 : parseInt(datas.taskcategories_id);
datas.actiontime = isNaN(parseInt(datas.actiontime)) ? 0 : parseInt(datas.actiontime);
$("#task' . $rand_text . '").html(datas.content);
$("#dropdown_taskcategories_id' . $rand_type . '").select2("val", parseInt(datas.taskcategories_id));
$("#dropdown_actiontime' . $rand_time . '").select2("val", parseInt(datas.actiontime));
});
}
');
if ($ID > 0) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Date') . "</td>";
echo "<td>";
Html::showDateTimeField("date", array('value' => $this->fields["date"], 'timestep' => 1, 'maybeempty' => false));
echo "</tr>";
} else {
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2'> ";
echo "</tr>";
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Category') . "</td><td>";
TaskCategory::dropdown(array('value' => $this->fields["taskcategories_id"], 'rand' => $rand_type, 'entity' => $item->fields["entities_id"], 'condition' => "`is_active` = '1'"));
echo "</td></tr>\n";
if (isset($this->fields["state"])) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Status') . "</td><td>";
Planning::dropdownState("state", $this->fields["state"]);
echo "</td></tr>\n";
}
if ($this->maybePrivate()) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Private') . "</td>";
echo "<td>";
Dropdown::showYesNo('is_private', $this->fields["is_private"]);
echo "</td>";
echo "</tr>";
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Duration') . "</td><td>";
$toadd = array();
for ($i = 9; $i <= 100; $i++) {
$toadd[] = $i * HOUR_TIMESTAMP;
}
Dropdown::showTimeStamp("actiontime", array('min' => 0, 'max' => 8 * HOUR_TIMESTAMP, 'value' => $this->fields["actiontime"], 'rand' => $rand_time, 'addfirstminutes' => true, 'inhours' => true, 'toadd' => $toadd));
//.........这里部分代码省略.........
示例6: showForm
/** form for Task
*
* @param $ID Integer : Id of the task
* @param $options array
* - parent Object : the object
**/
function showForm($ID, $options = array())
{
global $DB, $CFG_GLPI;
if (isset($options['parent']) && !empty($options['parent'])) {
$item = $options['parent'];
}
$fkfield = $item->getForeignKeyField();
if ($ID > 0) {
$this->check($ID, READ);
} else {
// Create item
$options[$fkfield] = $item->getField('id');
$this->check(-1, CREATE, $options);
}
$rand = mt_rand();
$this->showFormHeader($options);
$canplan = !$item->isStatusExists(CommonITILObject::PLANNED) || $item->isAllowedStatus($item->fields['status'], CommonITILObject::PLANNED);
$rowspan = 3;
if ($this->maybePrivate()) {
$rowspan++;
}
if (isset($this->fields["state"])) {
$rowspan++;
}
echo "<tr class='tab_bg_1'>";
echo "<td rowspan='{$rowspan}' class='middle'>" . __('Description') . "</td>";
echo "<td class='center middle' rowspan='{$rowspan}'>" . "<textarea id ='content{$rand}' name='content' cols='50' rows='{$rowspan}'>" . $this->fields["content"] . "</textarea>";
echo Html::scriptBlock("\$(document).ready(function() { \$('#content{$rand}').autogrow(); });");
echo "</td>";
if ($ID > 0) {
echo "<td>" . __('Date') . "</td>";
echo "<td>";
Html::showDateTimeField("date", array('value' => $this->fields["date"], 'timestep' => 1, 'maybeempty' => false));
} else {
echo "<td colspan='2'> ";
}
echo "<input type='hidden' name='{$fkfield}' value='" . $this->fields[$fkfield] . "'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Category') . "</td><td>";
TaskCategory::dropdown(array('value' => $this->fields["taskcategories_id"], 'entity' => $item->fields["entities_id"]));
echo "</td></tr>\n";
if (isset($this->fields["state"])) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Status') . "</td><td>";
Planning::dropdownState("state", $this->fields["state"]);
echo "</td></tr>\n";
}
if ($this->maybePrivate()) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Private') . "</td>";
echo "<td>";
Dropdown::showYesNo('is_private', $this->fields["is_private"]);
echo "</td>";
echo "</tr>";
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Duration') . "</td><td>";
$toadd = array();
for ($i = 9; $i <= 100; $i++) {
$toadd[] = $i * HOUR_TIMESTAMP;
}
Dropdown::showTimeStamp("actiontime", array('min' => 0, 'max' => 8 * HOUR_TIMESTAMP, 'value' => $this->fields["actiontime"], 'addfirstminutes' => true, 'inhours' => true, 'toadd' => $toadd));
echo "</td></tr>\n";
Document_Item::showSimpleAddForItem($item);
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('By');
echo " <a href='#' onClick=\"" . Html::jsGetElementbyID('planningcheck' . $rand) . ".dialog('open');\">";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/reservation-3.png'\n title=\"" . __s('Availability') . "\" alt=\"" . __s('Availability') . "\"\n class='calendrier'>";
echo "</a>";
Ajax::createIframeModalWindow('planningcheck' . $rand, $CFG_GLPI["root_doc"] . "/front/planning.php?checkavailability=checkavailability" . "&itemtype=" . $item->getType() . "&{$fkfield}=" . $item->getID(), array('title' => __('Availability')));
echo "</td>";
echo "<td class='center'>";
$rand_user = mt_rand();
$params = array('name' => "users_id_tech", 'value' => $this->fields["users_id_tech"] ? $this->fields["users_id_tech"] : Session::getLoginUserID(), 'right' => "own_ticket", 'rand' => $rand_user, 'entity' => $item->fields["entities_id"]);
$params['toupdate'] = array('value_fieldname' => 'users_id', 'to_update' => "user_available{$rand_user}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/planningcheck.php");
User::dropdown($params);
echo "</td>\n";
if ($canplan) {
echo "<td>" . __('Planning') . "</td>";
}
echo "<td>";
if (!empty($this->fields["begin"])) {
if (Session::haveRight('planning', Planning::READMY)) {
echo "<script type='text/javascript' >\n";
echo "function showPlan" . $ID . "() {\n";
echo Html::jsHide('plan');
$params = array('form' => 'followups', 'users_id' => $this->fields["users_id_tech"], 'id' => $this->fields["id"], 'begin' => $this->fields["begin"], 'end' => $this->fields["end"], 'rand_user' => $rand_user, 'entity' => $item->fields["entities_id"], 'itemtype' => $this->getType(), 'items_id' => $this->getID());
Ajax::updateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params);
echo "}";
echo "</script>\n";
echo "<div id='plan' onClick='showPlan" . $ID . "()'>\n";
echo "<span class='showplan'>";
}
//.........这里部分代码省略.........
示例7: showForm
/**
* Print the reminder form
*
* @param $ID integer Id of the item to print
* @param $options array of possible options:
* - target filename : where to go when done.
* - from_planning_ajax : set to disable planning form part
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
$this->initForm($ID, $options);
$rand = mt_rand();
// Show Reminder or blank form
$onfocus = "";
if (!$ID > 0) {
// Create item : do getempty before check right to set default values
$onfocus = "onfocus=\"if (this.value=='" . $this->fields['name'] . "') this.value='';\"";
}
$canedit = $this->can($ID, UPDATE);
$this->showFormHeader($options);
echo "<tr class='tab_bg_2'><td>" . __('Title') . "</td>";
echo "<td>";
if (!$ID) {
echo "<input type='hidden' name='users_id' value='" . $this->fields['users_id'] . "'>\n";
}
if ($canedit) {
Html::autocompletionTextField($this, "name", array('size' => '80', 'entity' => -1, 'user' => $this->fields["users_id"], 'option' => $onfocus));
} else {
echo $this->fields['name'];
}
if (isset($options['from_planning_edit_ajax']) && $options['from_planning_edit_ajax']) {
echo Html::hidden('from_planning_edit_ajax');
}
echo "</td>";
echo "</tr>";
if (!isset($options['from_planning_ajax'])) {
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Visibility') . "</td>";
echo "<td>";
echo '<table><tr><td>';
echo __('Begin') . '</td><td>';
Html::showDateTimeField("begin_view_date", array('value' => $this->fields["begin_view_date"], 'timestep' => 1, 'maybeempty' => true, 'canedit' => $canedit));
echo '</td><td>' . __('End') . '</td><td>';
Html::showDateTimeField("end_view_date", array('value' => $this->fields["end_view_date"], 'timestep' => 1, 'maybeempty' => true, 'canedit' => $canedit));
echo '</td></tr></table>';
echo "</td>";
echo "</tr>";
}
echo "<tr class='tab_bg_2'>";
echo "<td>" . __('Status') . "</td>";
echo "<td>";
if ($canedit) {
Planning::dropdownState("state", $this->fields["state"]);
} else {
echo Planning::getState($this->fields["state"]);
}
echo "</td>\n";
echo "</tr>\n";
echo "<tr class='tab_bg_2'><td >" . __('Calendar') . "</td>";
echo "<td>";
if (isset($options['from_planning_ajax']) && $options['from_planning_ajax']) {
echo Html::hidden('plan[begin]', array('value' => $options['begin']));
echo Html::hidden('plan[end]', array('value' => $options['end']));
printf(__('From %1$s to %2$s'), Html::convDateTime($options["begin"]), Html::convDateTime($options["end"]));
echo "</td>";
} else {
if ($canedit) {
echo "<script type='text/javascript' >\n";
echo "function showPlan{$rand}() {\n";
echo Html::jsHide("plan{$rand}");
$params = array('action' => 'add_event_classic_form', 'form' => 'remind', 'users_id' => $this->fields["users_id"], 'itemtype' => $this->getType(), 'items_id' => $this->getID());
if ($ID && $this->fields["is_planned"]) {
$params['begin'] = $this->fields["begin"];
$params['end'] = $this->fields["end"];
}
Ajax::updateItemJsCode("viewplan{$rand}", $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params);
echo "}";
echo "</script>\n";
}
if (!$ID || !$this->fields["is_planned"]) {
if (Session::haveRightsOr("planning", array(Planning::READMY, Planning::READGROUP, Planning::READALL))) {
echo "<div id='plan{$rand}' onClick='showPlan{$rand}()'>\n";
echo "<a href='#' class='vsubmit'>" . __('Add to schedule') . "</a>";
}
} else {
if ($canedit) {
echo "<div id='plan{$rand}' onClick='showPlan{$rand}()'>\n";
echo "<span class='showplan'>";
}
//TRANS: %1$s is the begin date, %2$s is the end date
printf(__('From %1$s to %2$s'), Html::convDateTime($this->fields["begin"]), Html::convDateTime($this->fields["end"]));
if ($canedit) {
echo "</span>";
}
}
if ($canedit) {
echo "</div>\n";
echo "<div id='viewplan{$rand}'>\n</div>\n";
}
//.........这里部分代码省略.........
示例8: showForm
/** form for Task
*
* @param $ID Integer : Id of the task
* @param $options array
* - parent Object : the object
**/
function showForm($ID, $options = array())
{
global $DB, $CFG_GLPI;
if (isset($options['parent']) && !empty($options['parent'])) {
$item = $options['parent'];
}
$fkfield = $item->getForeignKeyField();
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item
$options[$fkfield] = $item->getField('id');
$this->check(-1, 'w', $options);
}
$canplan = Session::haveRight("show_planning", "1");
$this->showFormHeader($options);
$rowspan = 5;
if ($this->maybePrivate()) {
$rowspan++;
}
// Recall
if (!empty($this->fields["begin"])) {
$rowspan++;
}
echo "<tr class='tab_bg_1'>";
echo "<td rowspan='{$rowspan}' class='middle right'>" . __('Description') . "</td>";
echo "<td class='center middle' rowspan='{$rowspan}'>" . "<textarea name='content' cols='50' rows='{$rowspan}'>" . $this->fields["content"] . "</textarea></td>";
if ($ID > 0) {
echo "<td>" . __('Date') . "</td>";
echo "<td>";
Html::showDateTimeFormItem("date", $this->fields["date"], 1, false);
} else {
echo "<td colspan='2'> ";
}
echo "<input type='hidden' name='{$fkfield}' value='" . $this->fields[$fkfield] . "'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Category') . "</td><td>";
TaskCategory::dropdown(array('value' => $this->fields["taskcategories_id"], 'entity' => $item->fields["entities_id"]));
echo "</td></tr>\n";
if (isset($this->fields["state"])) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Status') . "</td><td>";
Planning::dropdownState("state", $this->fields["state"]);
echo "</td></tr>\n";
}
if ($this->maybePrivate()) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Private') . "</td>";
echo "<td>";
Dropdown::showYesNo('is_private', $this->fields["is_private"]);
echo "</td>";
echo "</tr>";
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Duration') . "</td><td>";
$toadd = array();
for ($i = 9; $i <= 100; $i++) {
$toadd[] = $i * HOUR_TIMESTAMP;
}
Dropdown::showTimeStamp("actiontime", array('min' => 0, 'max' => 8 * HOUR_TIMESTAMP, 'value' => $this->fields["actiontime"], 'addfirstminutes' => true, 'inhours' => true, 'toadd' => $toadd));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Planning') . "</td>";
echo "<td>";
if (!empty($this->fields["begin"])) {
if (Session::haveRight('show_planning', 1)) {
echo "<script type='text/javascript' >\n";
echo "function showPlan" . $ID . "() {\n";
echo "Ext.get('plan').setDisplayed('none');";
$params = array('form' => 'followups', 'users_id' => $this->fields["users_id_tech"], 'id' => $this->fields["id"], 'begin' => $this->fields["begin"], 'end' => $this->fields["end"], 'entity' => $item->fields["entities_id"], 'itemtype' => $this->getType(), 'items_id' => $this->getID());
Ajax::updateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params);
echo "}";
echo "</script>\n";
echo "<div id='plan' onClick='showPlan" . $ID . "()'>\n";
echo "<span class='showplan'>";
}
if (isset($this->fields["state"])) {
echo Planning::getState($this->fields["state"]) . "<br>";
}
printf(__('From %1$s to %2$s'), Html::convDateTime($this->fields["begin"]), Html::convDateTime($this->fields["end"]));
echo "<br>" . getUserName($this->fields["users_id_tech"]);
if (Session::haveRight('show_planning', 1)) {
echo "</span>";
echo "</div>\n";
echo "<div id='viewplan'></div>\n";
}
} else {
if (Session::haveRight('show_planning', 1)) {
echo "<script type='text/javascript' >\n";
echo "function showPlanUpdate() {\n";
echo "Ext.get('plan').setDisplayed('none');";
$params = array('form' => 'followups', 'users_id' => Session::getLoginUserID(), 'entity' => $_SESSION["glpiactive_entity"], 'itemtype' => $this->getType(), 'items_id' => $this->getID());
Ajax::updateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params);
//.........这里部分代码省略.........
示例9: date
$end = date("Y-m-d H:i:s", strtotime($begin) + HOUR_TIMESTAMP);
}
$state = 0;
if (isset($_POST["state"])) {
$state = $_POST["state"];
}
echo "<table class='tab_cadre'>";
if (isset($_POST["users_id"]) && isset($_POST["entity"])) {
echo "<tr class='tab_bg_2'><td>" . $LANG['common'][95] . " : </td>";
echo "<td class='center'>";
User::dropdown(array('name' => "plan[users_id]", 'value' => $_POST["users_id"], 'right' => "own_ticket", 'entity' => $_POST["entity"]));
echo "</td></tr>\n";
}
echo "<tr class='tab_bg_2'><td>" . $LANG['state'][0] . " : </td>";
echo "<td class='center'>";
Planning::dropdownState("plan[state]", $state);
echo "</td></tr>";
echo "<tr class='tab_bg_2'><td>" . $LANG['search'][8] . " : </td><td>";
$rand_begin = showDateTimeFormItem("plan[begin]", $begin, -1, false, true, '', '', $CFG_GLPI["planning_begin"], $CFG_GLPI["planning_end"]);
echo "</td></tr>\n";
echo "<tr class='tab_bg_2'><td>" . $LANG['planning'][3] . " : </td><td>";
$values = array(0 => $LANG['search'][12], 15 * MINUTE_TIMESTAMP => '0' . $LANG['gmt'][2] . '15', 30 * MINUTE_TIMESTAMP => '0' . $LANG['gmt'][2] . '30', 45 * MINUTE_TIMESTAMP => '0' . $LANG['gmt'][2] . '45', 60 * MINUTE_TIMESTAMP => '1' . $LANG['gmt'][2] . '00', 90 * MINUTE_TIMESTAMP => '1' . $LANG['gmt'][2] . '30', 120 * MINUTE_TIMESTAMP => '2' . $LANG['gmt'][2] . '00', 150 * MINUTE_TIMESTAMP => '2' . $LANG['gmt'][2] . '30', 180 * MINUTE_TIMESTAMP => '3' . $LANG['gmt'][2] . '00', 210 * MINUTE_TIMESTAMP => '3' . $LANG['gmt'][2] . '30', 4 * HOUR_TIMESTAMP => '4' . $LANG['gmt'][2] . '00', 5 * HOUR_TIMESTAMP => '5' . $LANG['gmt'][2] . '00', 6 * HOUR_TIMESTAMP => '6' . $LANG['gmt'][2] . '00', 7 * HOUR_TIMESTAMP => '7' . $LANG['gmt'][2] . '00', 8 * HOUR_TIMESTAMP => '8' . $LANG['gmt'][2] . '00');
$default_delay = 0;
$begin_timestamp = strtotime($begin);
$end_timestamp = strtotime($end);
// Floor with MINUTE_TIMESTAMP for rounded purpose
$computed_delay = floor(($end_timestamp - $begin_timestamp) / 15 / MINUTE_TIMESTAMP) * 15 * MINUTE_TIMESTAMP;
if (isset($values[$computed_delay])) {
$default_delay = $computed_delay;
}
$rand = Dropdown::showFromArray("plan[_duration]", $values, array('value' => $default_delay));