本文整理汇总了PHP中Html::showDateTimeField方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::showDateTimeField方法的具体用法?PHP Html::showDateTimeField怎么用?PHP Html::showDateTimeField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::showDateTimeField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayField
public function displayField($canEdit = true)
{
if ($canEdit) {
$required = $canEdit && $this->fields['required'] ? ' required' : '';
$rand = mt_rand();
Html::showDateTimeField('formcreator_field_' . $this->fields['id'], array('value' => $this->getValue(), 'rand' => $rand));
echo '<script type="text/javascript">
jQuery(document).ready(function($) {
$( "#showdate' . $rand . '" ).on("change", function() {
formcreatorChangeValueOf(' . $this->fields['id'] . ', this.value);
});
$( "#resetdate' . $rand . '" ).on("click", function() {
formcreatorChangeValueOf(' . $this->fields['id'] . ', "");
});
});
</script>';
} else {
echo $this->getAnswer();
}
}
示例2: 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'>";
}
//.........这里部分代码省略.........
示例3: showForm
function showForm($ID, $options = array())
{
global $CFG_GLPI, $DB;
if (!static::canView()) {
return false;
}
// In percent
$colsize1 = '13';
$colsize2 = '37';
$default_use_notif = Entity::getUsedConfig('is_notif_enable_default', $_SESSION['glpiactive_entity'], '', 1);
// Set default options
if (!$ID) {
$values = array('_users_id_requester' => Session::getLoginUserID(), '_users_id_requester_notif' => array('use_notification' => $default_use_notif, 'alternative_email' => ''), '_groups_id_requester' => 0, '_users_id_assign' => 0, '_users_id_assign_notif' => array('use_notification' => $default_use_notif, 'alternative_email' => ''), '_groups_id_assign' => 0, '_users_id_observer' => 0, '_users_id_observer_notif' => array('use_notification' => $default_use_notif, 'alternative_email' => ''), '_suppliers_id_assign_notif' => array('use_notification' => $default_use_notif, 'alternative_email' => ''), '_groups_id_observer' => 0, '_suppliers_id_assign' => 0, 'priority' => 3, 'urgency' => 3, 'impact' => 3, 'content' => '', 'entities_id' => $_SESSION['glpiactive_entity'], 'name' => '', 'itilcategories_id' => 0);
foreach ($values as $key => $val) {
if (!isset($options[$key])) {
$options[$key] = $val;
}
}
if (isset($options['tickets_id'])) {
$ticket = new Ticket();
if ($ticket->getFromDB($options['tickets_id'])) {
$options['content'] = $ticket->getField('content');
$options['name'] = $ticket->getField('name');
$options['impact'] = $ticket->getField('impact');
$options['urgency'] = $ticket->getField('urgency');
$options['priority'] = $ticket->getField('priority');
$options['itilcategories_id'] = $ticket->getField('itilcategories_id');
$options['due_date'] = $ticket->getField('due_date');
}
}
if (isset($options['problems_id'])) {
$problem = new Problem();
if ($problem->getFromDB($options['problems_id'])) {
$options['content'] = $problem->getField('content');
$options['name'] = $problem->getField('name');
$options['impact'] = $problem->getField('impact');
$options['urgency'] = $problem->getField('urgency');
$options['priority'] = $problem->getField('priority');
$options['itilcategories_id'] = $problem->getField('itilcategories_id');
$options['due_date'] = $problem->getField('due_date');
}
}
}
if ($ID > 0) {
$this->check($ID, READ);
} else {
// Create item
$this->check(-1, CREATE, $options);
}
$showuserlink = 0;
if (User::canView()) {
$showuserlink = 1;
}
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<th class='left' width='{$colsize1}%'>" . __('Opening date') . "</th>";
echo "<td class='left' width='{$colsize2}%'>";
if (isset($options['tickets_id'])) {
echo "<input type='hidden' name='_tickets_id' value='" . $options['tickets_id'] . "'>";
}
if (isset($options['problems_id'])) {
echo "<input type='hidden' name='_problems_id' value='" . $options['problems_id'] . "'>";
}
$date = $this->fields["date"];
if (!$ID) {
$date = date("Y-m-d H:i:s");
}
Html::showDateTimeField("date", array('value' => $date, 'timestep' => 1, 'maybeempty' => false));
echo "</td>";
echo "<th width='{$colsize1}%'>" . __('Due date') . "</th>";
echo "<td width='{$colsize2}%' class='left'>";
if ($this->fields["due_date"] == 'NULL') {
$this->fields["due_date"] = '';
}
Html::showDateTimeField("due_date", array('value' => $this->fields["due_date"], 'timestep' => 1));
echo "</td></tr>";
if ($ID) {
echo "<tr class='tab_bg_1'><th>" . __('By') . "</th><td>";
User::dropdown(array('name' => 'users_id_recipient', 'value' => $this->fields["users_id_recipient"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<th>" . __('Last update') . "</th>";
echo "<td>" . Html::convDateTime($this->fields["date_mod"]) . "\n";
if ($this->fields['users_id_lastupdater'] > 0) {
printf(__('%1$s: %2$s'), __('By'), getUserName($this->fields["users_id_lastupdater"], $showuserlink));
}
echo "</td></tr>";
}
if ($ID && (in_array($this->fields["status"], $this->getSolvedStatusArray()) || in_array($this->fields["status"], $this->getClosedStatusArray()))) {
echo "<tr class='tab_bg_1'>";
echo "<th>" . __('Date of solving') . "</th>";
echo "<td>";
Html::showDateTimeField("solvedate", array('value' => $this->fields["solvedate"], 'timestep' => 1, 'maybeempty' => false));
echo "</td>";
if (in_array($this->fields["status"], $this->getClosedStatusArray())) {
echo "<th>" . __('Closing date') . "</th>";
echo "<td>";
Html::showDateTimeField("closedate", array('value' => $this->fields["closedate"], 'timestep' => 1, 'maybeempty' => false));
echo "</td>";
} else {
echo "<td colspan='2'> </td>";
//.........这里部分代码省略.........
示例4: displayAnswers
function displayAnswers($questions_id)
{
$psQuestion = new PluginSurveyticketQuestion();
$psAnswer = new PluginSurveyticketAnswer();
$a_answers = $psAnswer->find("`plugin_surveyticket_questions_id`='" . $questions_id . "'");
$psQuestion->getFromDB($questions_id);
switch ($psQuestion->fields['type']) {
case 'dropdown':
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' align='center'>";
echo "<select name='question" . $questions_id . "' id='question" . $questions_id . "' >";
echo "<option>" . Dropdown::EMPTY_VALUE . "</option>";
foreach ($a_answers as $data_answer) {
echo "<option value='" . $data_answer['id'] . "'>" . $psAnswer->getAnswer($data_answer) . "</option>";
}
echo "</select>";
echo "</td>";
echo "</tr>";
break;
case 'checkbox':
$i = 0;
foreach ($a_answers as $data_answer) {
echo "<tr class='tab_bg_1'>";
echo "<td width='40' align='center'>";
echo "<input type='checkbox' name='question" . $questions_id . "[]' id='question" . $questions_id . "-" . $i . "' \n value='" . $data_answer['id'] . "' />";
echo "</td>";
echo "<td>";
echo $psAnswer->getAnswer($data_answer);
echo "</td>";
$this->displayAnswertype($data_answer['answertype'], "text-" . $questions_id . "-" . $data_answer['id']);
echo "</tr>";
$i++;
}
break;
case 'radio':
case 'yesno':
$i = 0;
foreach ($a_answers as $data_answer) {
echo "<tr class='tab_bg_1'>";
echo "<td width='40' align='center'>";
echo "<input type='radio' name='question" . $questions_id . "' id='question" . $questions_id . "-" . $i . "' \n value='" . $data_answer['id'] . "' />";
echo "</td>";
echo "<td>";
echo $psAnswer->getAnswer($data_answer);
echo "</td>";
$this->displayAnswertype($data_answer['answertype'], "text-" . $questions_id . "-" . $data_answer['id']);
echo "</tr>";
$i++;
}
break;
case 'date':
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' align='center'>";
$data_answer = current($a_answers);
Html::showDateTimeField("question" . $questions_id, array('rand' => "question" . $questions_id));
echo '<input type="hidden" name="realquestion' . $questions_id . '" id="realquestion' . $questions_id . '" value="' . $data_answer['id'] . '" />';
echo "</td>";
echo "</tr>";
break;
case 'input':
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' align='center'>";
$data_answer = current($a_answers);
echo '<input type="text" name="question' . $questions_id . '" id="question' . $questions_id . '" value="" size="71" />';
echo '<input type="hidden" name="realquestion' . $questions_id . '" id="realquestion' . $questions_id . '" value="' . $data_answer['id'] . '" />';
echo "</td>";
echo "</tr>";
break;
}
return count($a_answers);
}
示例5: showForm
//.........这里部分代码省略.........
echo "<table class='tab_cadre_fixe' id='mainformtable'>";
// Optional line
$ismultientities = Session::isMultiEntitiesMode();
echo "<tr class='headerRow responsive_hidden'>";
echo "<th colspan='4'>";
if ($ID) {
$text = sprintf(__('%1$s - %2$s'), $this->getTypeName(1), sprintf(__('%1$s: %2$s'), __('ID'), $ID));
if ($ismultientities) {
$text = sprintf(__('%1$s (%2$s)'), $text, Dropdown::getDropdownName('glpi_entities', $this->fields['entities_id']));
}
echo $text;
} else {
if ($ismultientities) {
printf(__('The ticket will be added in the entity %s'), Dropdown::getDropdownName("glpi_entities", $this->fields['entities_id']));
} else {
_e('New ticket');
}
}
echo "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<th width='{$colsize1}%'>";
echo $tt->getBeginHiddenFieldText('date');
if (!$ID) {
printf(__('%1$s%2$s'), __('Opening date'), $tt->getMandatoryMark('date'));
} else {
_e('Opening date');
}
echo $tt->getEndHiddenFieldText('date');
echo "</th>";
echo "<td width='{$colsize2}%'>";
echo $tt->getBeginHiddenFieldValue('date');
$date = $this->fields["date"];
if ($canupdate) {
Html::showDateTimeField("date", array('value' => $date, 'timestep' => 1, 'maybeempty' => false));
} else {
echo Html::convDateTime($date);
}
echo $tt->getEndHiddenFieldValue('date', $this);
echo "</td><td colspan='2'></td></tr>";
// SLTs
echo "<tr class='tab_bg_1'>";
echo "<th width='{$colsize1}%'>" . $tt->getBeginHiddenFieldText('time_to_own');
if (!$ID) {
printf(__('%1$s%2$s'), __('Time to own'), $tt->getMandatoryMark('time_to_own'));
} else {
_e('Time to own');
}
echo $tt->getEndHiddenFieldText('time_to_own');
echo "</th>";
echo "<td width='{$colsize2}%' class='nopadding'>";
$slt = new SLT();
$slt->showSltForTicket($this, SLT::TTO, $tt, $canupdate);
echo "</td>";
echo "<th width='{$colsize3}%'>" . $tt->getBeginHiddenFieldText('due_date');
if (!$ID) {
printf(__('%1$s%2$s'), __('Time to resolve'), $tt->getMandatoryMark('due_date'));
} else {
_e('Time to resolve');
}
echo $tt->getEndHiddenFieldText('due_date');
echo "</th>";
echo "<td width='{$colsize4}%' class='nopadding'>";
$slt->showSltForTicket($this, SLT::TTR, $tt, $canupdate);
echo "</td>";
echo "</tr>";
if ($ID) {
示例6: showForm
/**
*
*
* @param $items_id integer ID
*
* @param $host_id integer associated host ID
* @param $options array
*
*@return bool true if form is ok
*
**/
function showForm($id = -1, $itemtype = 'Host', $items_id = -1, $options = array())
{
global $DB, $CFG_GLPI;
// Toolbox::logInFile("pm-ack", "acknowledge, showForm, id : $id, item type : $itemtype / $items_id\n");
$createAcknowledge = false;
if ($id == -1) {
// if ($itemtype == 'N/A') $itemtype = 'Computer';
// if ($itemtype == '') $itemtype = 'Computer';
$itemtype = 'PluginMonitoring' . $itemtype;
$item = new $itemtype();
$item->getFromDB($items_id);
if ($item->isCurrentlyAcknowledged()) {
// If host currently acknowledged, show current acknowledge ...
$pmAcknowledge = new PluginMonitoringAcknowledge();
$this->getFromDB($pmAcknowledge->getFromHost($this->getID()));
} else {
// .. else create new acknowledge
$createAcknowledge = true;
$this->getEmpty();
$this->setDefaultContent($itemtype, $items_id);
}
} else {
$this->getFromDB($id);
$createAcknowledge = true;
}
// Now ...
$nowDate = date('Y-m-d');
$nowTime = date('H:i:s');
$this->showFormHeader($options);
$this->isExpired();
$itemtype = $this->getField('itemtype');
if ($itemtype == 'N/A') {
$itemtype = 'Computer';
}
if ($itemtype == '') {
$itemtype = 'Computer';
}
$item = new $itemtype();
$item->getFromDB($this->getField("items_id"));
echo "<tr class='tab_bg_1'>";
echo "<td>" . $item->getTypeName() . "</td>";
echo "<td>";
echo "<input type='hidden' name='itemtype' value='" . $this->fields['itemtype'] . "' />";
echo "<input type='hidden' name='items_id' value='" . $this->fields['items_id'] . "' />";
echo $item->getLink() . " " . $item->getComments();
echo "</td>";
echo "<td>" . __('Sticky ?', 'monitoring') . "</td>";
echo "<td>";
if ($createAcknowledge) {
Dropdown::showYesNo('sticky', $this->fields['sticky']);
} else {
echo Dropdown::getYesNo($this->fields['sticky']);
}
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Start time', 'monitoring') . "</td>";
echo "<td>";
$date = $this->fields["start_time"];
Html::showDateTimeField("start_time", array('value' => $date, 'timestep' => 10, 'maybeempty' => false, 'canedit' => $createAcknowledge, 'mindate' => $nowDate, 'mintime' => $nowTime));
echo "</td>";
echo "<td>" . __('Persistent ?', 'monitoring') . "</td>";
echo "<td>";
if ($createAcknowledge) {
Dropdown::showYesNo('persistent', $this->fields['persistent']);
} else {
echo Dropdown::getYesNo($this->fields['persistent']);
}
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('End time', 'monitoring') . "</td>";
echo "<td>";
$date = $this->fields["end_time"];
Html::showDateTimeField("end_time", array('value' => $date, 'timestep' => 10, 'maybeempty' => false, 'canedit' => $createAcknowledge, 'mindate' => $nowDate, 'mintime' => $nowTime));
echo "</td>";
echo "<td>" . __('Notify ?', 'monitoring') . "</td>";
echo "<td>";
if ($createAcknowledge) {
Dropdown::showYesNo('notify', $this->fields['notify']);
} else {
echo Dropdown::getYesNo($this->fields['notify']);
}
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Comment', 'monitoring') . "</td>";
echo "<td >";
if ($createAcknowledge) {
//.........这里部分代码省略.........
示例7: showForm
/**
* Display for reservation
*
* @param $ID ID of the reservation (empty for create new)
* @param $options array of possibles options:
* - item reservation items ID for creation process
* - date date for creation process
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
if (!Session::haveRight("reservation", ReservationItem::RESERVEANITEM)) {
return false;
}
$resa = new self();
if (!empty($ID)) {
if (!$resa->getFromDB($ID)) {
return false;
}
if (!$resa->can($ID, UPDATE)) {
return false;
}
// Set item if not set
if ((!isset($options['item']) || count($options['item']) == 0) && ($itemid = $resa->getField('reservationitems_id'))) {
$options['item'][$itemid] = $itemid;
}
} else {
$resa->getEmpty();
$resa->fields["begin"] = $options['begin'];
if (!isset($options['end'])) {
$resa->fields["end"] = date("Y-m-d H:00:00", strtotime($resa->fields["begin"]) + HOUR_TIMESTAMP);
} else {
$resa->fields["end"] = $options['end'];
}
}
// No item : problem
if (!isset($options['item']) || count($options['item']) == 0) {
return false;
}
echo "<div class='center'><form method='post' name=form action='reservation.form.php'>";
if (!empty($ID)) {
echo "<input type='hidden' name='id' value='{$ID}'>";
}
echo "<table class='tab_cadre' width='700px'>";
echo "<tr><th colspan='2'>" . __('Reserve an item') . "</th></tr>\n";
// Add Hardware name
$r = new ReservationItem();
echo "<tr class='tab_bg_1'><td>" . __('Item') . "</td>";
echo "<td>";
foreach ($options['item'] as $itemID) {
$r->getFromDB($itemID);
$type = $r->fields["itemtype"];
$name = NOT_AVAILABLE;
$item = NULL;
if ($item = getItemForItemtype($r->fields["itemtype"])) {
$type = $item->getTypeName();
if ($item->getFromDB($r->fields["items_id"])) {
$name = $item->getName();
} else {
$item = NULL;
}
}
echo "<span class='b'>" . sprintf(__('%1$s - %2$s'), $type, $name) . "</span><br>";
echo "<input type='hidden' name='items[{$itemID}]' value='{$itemID}'>";
}
echo "</td></tr>\n";
if (!Session::haveRight("reservation", UPDATE) || is_null($item) || !Session::haveAccessToEntity($item->fields["entities_id"])) {
echo "<input type='hidden' name='users_id' value='" . Session::getLoginUserID() . "'>";
} else {
echo "<tr class='tab_bg_2'><td>" . __('By') . "</td>";
echo "<td>";
if (empty($ID)) {
User::dropdown(array('value' => Session::getLoginUserID(), 'entity' => $item->getEntityID(), 'right' => 'all'));
} else {
User::dropdown(array('value' => $resa->fields["users_id"], 'entity' => $item->getEntityID(), 'right' => 'all'));
}
echo "</td></tr>\n";
}
echo "<tr class='tab_bg_2'><td>" . __('Start date') . "</td><td>";
$rand_begin = Html::showDateTimeField("resa[begin]", array('value' => $resa->fields["begin"], 'timestep' => -1, 'maybeempty' => false));
echo "</td></tr>\n";
$default_delay = floor((strtotime($resa->fields["end"]) - strtotime($resa->fields["begin"])) / $CFG_GLPI['time_step'] / MINUTE_TIMESTAMP) * $CFG_GLPI['time_step'] * MINUTE_TIMESTAMP;
echo "<tr class='tab_bg_2'><td>" . __('Duration') . "</td><td>";
$rand = Dropdown::showTimeStamp("resa[_duration]", array('min' => 0, 'max' => 24 * HOUR_TIMESTAMP, 'value' => $default_delay, 'emptylabel' => __('Specify an end date')));
echo "<br><div id='date_end{$rand}'></div>";
$params = array('duration' => '__VALUE__', 'end' => $resa->fields["end"], 'name' => "resa[end]");
Ajax::updateItemOnSelectEvent("dropdown_resa[_duration]{$rand}", "date_end{$rand}", $CFG_GLPI["root_doc"] . "/ajax/planningend.php", $params);
if ($default_delay == 0) {
$params['duration'] = 0;
Ajax::updateItem("date_end{$rand}", $CFG_GLPI["root_doc"] . "/ajax/planningend.php", $params);
}
Alert::displayLastAlert('Reservation', $ID);
echo "</td></tr>\n";
if (empty($ID)) {
echo "<tr class='tab_bg_2'><td>" . __('Rehearsal') . "</td>";
echo "<td>";
$values = array('' => _x('periodicity', 'None'), 'day' => _x('periodicity', 'Daily'), 'week' => _x('periodicity', 'Weekly'), 'month' => _x('periodicity', 'Monthly'));
$rand = Dropdown::showFromArray('periodicity[type]', $values);
$field_id = Html::cleanId("dropdown_periodicity[type]{$rand}");
$params = array('type' => '__VALUE__', 'end' => $resa->fields["end"]);
//.........这里部分代码省略.........
示例8: show
public static function show($field, $datas)
{
$value = $datas['formcreator_field_' . $field['id']] != 'NULL' ? $datas['formcreator_field_' . $field['id']] : $field['default_values'];
if ($field['required']) {
$required = ' required';
} else {
$required = '';
}
echo '<div class="form-group' . $required . '" id="form-group-field' . $field['id'] . '">';
echo '<label>';
echo $field['name'];
if ($field['required']) {
echo ' <span class="red">*</span>';
}
echo '</label>';
echo '<div>';
Html::showDateTimeField('formcreator_field_' . $field['id'], array('value' => $value));
echo '</div>';
echo '<div class="help-block">' . html_entity_decode($field['description']) . '</div>';
switch ($field['show_condition']) {
case 'notequal':
$condition = '!=';
break;
case 'lower':
$condition = '<';
break;
case 'greater':
$condition = '>';
break;
default:
$condition = '==';
break;
}
if ($field['show_type'] == 'hide') {
$conditionnalField = new PluginFormcreatorQuestion();
$conditionnalField->getFromDB($field['show_field']);
switch ($conditionnalField->fields['fieldtype']) {
case 'checkboxes':
echo '<script type="text/javascript">
var inputElements = document.getElementsByName("formcreator_field_' . $field['show_field'] . '[]");
for(var i=0; inputElements[i]; ++i) {
inputElements[i].addEventListener("change", function(){showFormGroup' . $field['id'] . '()});
}
function showFormGroup' . $field['id'] . '() {
var checkedValue = false;
for(var i=0; inputElements[i]; ++i) {
if (inputElements[i].value ' . $condition . ' "' . $field['show_value'] . '" && inputElements[i].checked) {
checkedValue = true;
}
}
if(checkedValue) {
document.getElementById("form-group-field' . $field['id'] . '").style.display = "block";
} else {
document.getElementById("form-group-field' . $field['id'] . '").style.display = "none";
}
}';
break;
case 'multiselect':
echo '<script type="text/javascript">
var inputElements = document.getElementsByName("formcreator_field_' . $field['show_field'] . '[]")[1];
inputElements.addEventListener("change", function(){showFormGroup' . $field['id'] . '()});
function showFormGroup' . $field['id'] . '() {
var checkedValue = false;
for(var i=0; inputElements[i]; ++i) {
if (inputElements[i].value ' . $condition . ' "' . $field['show_value'] . '" && inputElements[i].selected) {
checkedValue = true;
}
}
if(checkedValue) {
document.getElementById("form-group-field' . $field['id'] . '").style.display = "block";
} else {
document.getElementById("form-group-field' . $field['id'] . '").style.display = "none";
}
}';
break;
case 'radios':
echo '<script type="text/javascript">
var inputElements = document.getElementsByName("formcreator_field_' . $field['show_field'] . '");
for(var i=0; inputElements[i]; ++i) {
inputElements[i].addEventListener("change", function(){showFormGroup' . $field['id'] . '()});
}
function showFormGroup' . $field['id'] . '() {
var checkedValue = false;
for(var i=0; inputElements[i]; ++i) {
if (inputElements[i].value ' . $condition . ' "' . $field['show_value'] . '" && inputElements[i].checked) {
checkedValue = true;
}
}
if(checkedValue) {
//.........这里部分代码省略.........
示例9: showFormDate
/**
* Affiche le cadre avec la date de debut / date de fin
**/
function showFormDate()
{
global $datesresa;
/*if(isset($_GET['resareturn'])) {
$_POST['reserve'] = $datesresa;
}
else */
if (!isset($datesresa)) {
$jour = date("d", time());
$mois = date("m", time());
$annee = date("Y", time());
$begin_time = time();
$datesresa["begin"] = date("Y-m-d H:i:s", $begin_time);
if ($begin_time > mktime(19, 0, 0, $mois, $jour, $annee)) {
$datesresa["end"] = date("Y-m-d H:i:s", $begin_time + 3600);
} else {
$datesresa["end"] = date("Y-m-d H:i:s", mktime(19, 0, 0, $mois, $jour, $annee));
}
}
if (isset($_POST['nextday'])) {
$tmpbegin = $datesresa["begin"];
$tmpend = $datesresa["end"];
$datesresa["begin"] = date("Y-m-d H:i:s", strtotime($datesresa["begin"]) + DAY_TIMESTAMP);
$datesresa["end"] = date("Y-m-d H:i:s", strtotime($datesresa["end"]) + DAY_TIMESTAMP);
}
if (isset($_POST['previousday'])) {
$tmpbegin = $datesresa["begin"];
$tmpend = $datesresa["end"];
$datesresa["begin"] = date("Y-m-d H:i:s", strtotime($datesresa["begin"]) - DAY_TIMESTAMP);
$datesresa["end"] = date("Y-m-d H:i:s", strtotime($datesresa["end"]) - DAY_TIMESTAMP);
}
echo "<div id='viewresasearch' class='center'>";
echo "<form method='post' name='form' action='" . Toolbox::getItemTypeSearchURL(__CLASS__) . "'>";
echo "<table class='tab_cadre'><tr class='tab_bg_2'>";
echo "<th colspan='5'>Choisissez une date</th></tr>";
echo "<tr class='tab_bg_2'>";
echo "<td rowspan='3'>";
echo "<input type='submit' class='submit' name='previousday' value=\"Jour precedent\">";
echo "</td>";
echo "<td>" . __('Start date') . "</td><td>";
Html::showDateTimeField("reserve[begin]", array('value' => $datesresa["begin"], 'maybeempty' => false));
echo "</td><td rowspan='3'>";
echo "<input type='submit' class='submit' name='submit' value=\"" . _sx('button', 'Search') . "\">";
echo "</td>";
echo "<td rowspan='3'>";
echo "<input type='submit' class='submit' name='nextday' value=\"Jour suivant\">";
echo "</td></tr>";
echo "<tr class='tab_bg_2'><td>" . __('End date') . "</td><td>";
Html::showDateTimeField("reserve[end]", array('value' => $datesresa["end"], 'maybeempty' => false));
echo "</td></tr>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
示例10: showForm
/**
* Print the computer form
*
* @param $ID integer ID of the item
* @param $options array
* - target for the Form
* - withtemplate template or basic computer
*
*@return Nothing (display)
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI, $DB;
$this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Creation date') . "</td>";
echo "<td>";
$date = $this->fields["date"];
if (!$ID) {
$date = $_SESSION['glpi_currenttime'];
}
Html::showDateTimeField("date", array('value' => $date, 'timestep' => 1, 'maybeempty' => false));
echo "</td>";
if ($ID) {
echo "<td>" . __('Last update') . "</td>";
echo "<td >" . Html::convDateTime($this->fields["date_mod"]) . "</td>";
} else {
echo "<td colspan='2'> </td>";
}
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, 'name');
echo "</td>";
echo "<td>" . __('Code') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, 'code');
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Priority') . "</td>";
echo "<td>";
CommonITILObject::dropdownPriority(array('value' => $this->fields['priority'], 'withmajor' => 1));
echo "</td>";
echo "<td>" . __('As child of') . "</td>";
echo "<td>";
$this->dropdown(array('entity' => $this->fields['entities_id'], 'value' => $this->fields['projects_id'], 'used' => array($this->fields['id'])));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . _x('item', 'State') . "</td>";
echo "<td>";
ProjectState::dropdown(array('value' => $this->fields["projectstates_id"]));
echo "</td>";
echo "<td>" . __('Percent done') . "</td>";
echo "<td>";
Dropdown::showNumber("percent_done", array('value' => $this->fields['percent_done'], 'min' => 0, 'max' => 100, 'step' => 5, 'unit' => '%'));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Type') . "</td>";
echo "<td>";
ProjectType::dropdown(array('value' => $this->fields["projecttypes_id"]));
echo "</td>";
echo "<td>" . __('Show on global GANTT') . "</td>";
echo "<td>";
Dropdown::showYesNo("show_on_global_gantt", $this->fields["show_on_global_gantt"]);
echo "</td>";
echo "</tr>";
echo "<tr><td colspan='4' class='subheader'>" . __('Manager') . "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>";
echo "<td>";
User::dropdown(array('name' => 'users_id', 'value' => $this->fields["users_id"], 'right' => 'see_project', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Group') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id', 'value' => $this->fields['groups_id'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_manager`'));
echo "</td></tr>\n";
echo "<tr><td colspan='4' class='subheader'>" . __('Planning') . "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Planned start date') . "</td>";
echo "<td>";
Html::showDateTimeField("plan_start_date", array('value' => $this->fields['plan_start_date']));
echo "</td>";
echo "<td>" . __('Real start date') . "</td>";
echo "<td>";
Html::showDateTimeField("real_start_date", array('value' => $this->fields['real_start_date']));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Planned end date') . "</td>";
echo "<td>";
Html::showDateTimeField("plan_end_date", array('value' => $this->fields['plan_end_date']));
echo "</td>";
echo "<td>" . __('Real end date') . "</td>";
echo "<td>";
Html::showDateTimeField("real_end_date", array('value' => $this->fields['real_end_date']));
echo "</td></tr>\n";
//.........这里部分代码省略.........
示例11: showForTicket
static function showForTicket(Ticket $item)
{
if (!self::canView()) {
return false;
}
$canedit = $item->canUpdate() && self::canUpdate();
echo "<form name='form' method='post' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<div align='center'><table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . __('Close ticket informations', 'moreticket') . "</th></tr>";
// Writer
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo __('Writer');
echo "</td>";
echo "<td>";
echo getUserName(Session::getLoginUserID());
echo "<input name='requesters_id' type='hidden' value='" . Session::getLoginUserID() . "'>";
echo "</td>";
echo "</tr>";
// Date
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo "</td>";
echo "<td>";
Html::showDateTimeField("date", array('value' => date('Y-m-d H:i:s')));
echo "</td>";
echo "</tr>";
// Comments
echo "<tr class='tab_bg_1'>";
echo "<td>";
echo __('Comments');
echo "</td>";
echo "<td>";
echo "<textarea cols='80' rows='8' name='comment'></textarea>";
echo "</td>";
echo "</tr>";
// Documents
echo "<tr class='tab_bg_1'>";
echo "<td colspan='2' style='padding:10px 20px 0px 20px'>";
echo Html::file();
echo "(" . Document::getMaxUploadSize() . ") ";
echo "</td>";
echo "</tr>";
if ($canedit) {
echo "<tr>";
echo "<td class='tab_bg_2 center' colspan='6'>";
echo "<input type='submit' name='add' class='submit' value='" . _sx('button', 'Add') . "' >";
echo "<input type='hidden' name='tickets_id' class='submit' value='" . $item->fields['id'] . "' >";
echo "<input type='hidden' name='items_id' class='submit' value='" . $item->fields['id'] . "' >";
echo "<input type='hidden' name='itemtype' class='submit' value='Ticket' >";
echo "</td>";
echo "</tr>";
}
echo "</table></div>";
Html::closeForm();
// List
self::showList($item, $canedit);
}
示例12: showDateTimeField
public function showDateTimeField($title, $varname, $options = array())
{
// Get datetime value if the object is defined
if ($this->fields['id'] > 0) {
$value = $this->fields[$varname];
} else {
// Else set default value to current date and time
if (array_key_exists('maybeempty', $options) and $options['maybeempty']) {
$value = "";
} else {
$value = date("Y-m-d H:i:s");
}
}
$options['value'] = $value;
echo "<label>" . $title . " :</label>";
echo "<div class='input_wrap datetime'>";
Html::showDateTimeField($varname, $options);
echo "</div>";
}
示例13: showForm
//.........这里部分代码省略.........
continue;
}
echo "<tr class='tab_bg_1'><td>" . $field['label'];
if (isset($field['comment']) && !empty($field['comment'])) {
echo " ";
Html::showToolTip($field['comment']);
}
echo "</td><td>";
switch ($field['type']) {
case 'UserDropdown':
$param = array('name' => $field['name'], 'value' => $this->fields[$field['name']], 'right' => 'interface', 'entity' => $this->fields["entities_id"]);
if (isset($field['right'])) {
$params['right'] = $field['right'];
}
User::dropdown($param);
break;
case 'dropdownValue':
$params = array('value' => $this->fields[$field['name']], 'name' => $field['name'], 'entity' => $this->getEntityID());
if (isset($field['condition'])) {
$params['condition'] = $field['condition'];
}
Dropdown::show(getItemTypeForTable(getTableNameForForeignKeyField($field['name'])), $params);
break;
case 'text':
Html::autocompletionTextField($this, $field['name']);
break;
case 'textarea':
$cols = 40;
$rows = 3;
if (isset($field['rows'])) {
$rows = $field['rows'];
}
if (isset($field['cols'])) {
$cols = $field['cols'];
}
echo "<textarea name='" . $field['name'] . "' cols='{$cols}' rows='{$rows}'>" . $this->fields[$field['name']] . "</textarea >";
break;
case 'integer':
Dropdown::showNumber($field['name'], array('value' => $this->fields[$field['name']]));
break;
case 'timestamp':
$param = array('value' => $this->fields[$field['name']]);
if (isset($field['min'])) {
$param['min'] = $field['min'];
}
if (isset($field['max'])) {
$param['max'] = $field['max'];
}
if (isset($field['step'])) {
$param['step'] = $field['step'];
}
Dropdown::showTimeStamp($field['name'], $param);
break;
case 'parent':
if ($field['name'] == 'entities_id') {
$restrict = -1;
} else {
$restrict = $this->getEntityID();
}
Dropdown::show(getItemTypeForTable($this->getTable()), array('value' => $this->fields[$field['name']], 'name' => $field['name'], 'entity' => $restrict, 'used' => $ID > 0 ? getSonsOf($this->getTable(), $ID) : array()));
break;
case 'icon':
Dropdown::dropdownIcons($field['name'], $this->fields[$field['name']], GLPI_ROOT . "/pics/icones");
if (!empty($this->fields[$field['name']])) {
echo " <img style='vertical-align:middle;' alt='' src='" . $CFG_GLPI["typedoc_icon_dir"] . "/" . $this->fields[$field['name']] . "'>";
}
break;
case 'bool':
Dropdown::showYesNo($field['name'], $this->fields[$field['name']]);
break;
case 'color':
Html::showColorField($field['name'], array('value' => $this->fields[$field['name']]));
break;
case 'date':
Html::showDateField($field['name'], array('value' => $this->fields[$field['name']]));
break;
case 'datetime':
Html::showDateTimeField($field['name'], array('value' => $this->fields[$field['name']]));
break;
case 'password':
echo "<input type='password' name='password' value='' size='20' autocomplete='off'>";
break;
default:
$this->displaySpecificTypeField($ID, $field);
break;
}
if (isset($field['unit'])) {
echo " " . $field['unit'];
}
echo "</td></tr>\n";
}
if (isset($this->fields['is_protected']) && $this->fields['is_protected']) {
$options['candel'] = false;
}
if (isset($_REQUEST['_in_modal'])) {
echo "<input type='hidden' name='_in_modal' value='1'>";
}
$this->showFormButtons($options);
return true;
}
示例14: getValueToSelect
//.........这里部分代码省略.........
case "color":
return Html::showColorField($name, $options);
case "date":
case "date_delay":
if (isset($options['relative_dates']) && $options['relative_dates']) {
if (isset($searchoptions['maybefuture']) && $searchoptions['maybefuture']) {
$options['with_future'] = true;
}
return Html::showGenericDateTimeSearch($name, $value, $options);
}
$copytooption = array('min', 'max', 'maybeempty', 'showyear');
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
$options['value'] = $value;
return Html::showDateField($name, $options);
case "datetime":
if (isset($options['relative_dates']) && $options['relative_dates']) {
if (isset($searchoptions['maybefuture']) && $searchoptions['maybefuture']) {
$options['with_future'] = true;
}
$options['with_time'] = true;
return Html::showGenericDateTimeSearch($name, $value, $options);
}
$copytooption = array('mindate', 'maxdate', 'mintime', 'maxtime', 'maybeempty', 'timestep');
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
$options['value'] = $value;
return Html::showDateTimeField($name, $options);
case "timestamp":
$copytooption = array('addfirstminutes', 'emptylabel', 'inhours', 'max', 'min', 'step', 'toadd', 'display_emptychoice');
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
$options['value'] = $value;
return Dropdown::showTimeStamp($name, $options);
case "itemlink":
// Do not use dropdown if wanted to select string value instead of ID
if (isset($options['itemlink_as_string']) && $options['itemlink_as_string']) {
break;
}
case "dropdown":
$copytooption = array('condition', 'displaywith', 'emptylabel', 'right', 'toadd');
$options['name'] = $name;
$options['value'] = $value;
foreach ($copytooption as $key) {
if (isset($searchoptions[$key]) && !isset($options[$key])) {
$options[$key] = $searchoptions[$key];
}
}
if (!isset($options['entity'])) {
$options['entity'] = $_SESSION['glpiactiveentities'];
}
$itemtype = getItemTypeForTable($searchoptions['table']);
return $itemtype::dropdown($options);
case "right":
return Profile::dropdownRights(Profile::getRightsFor($searchoptions['rightclass']), $name, $value, array('multiple' => false, 'display' => false));
case "itemtypename":
if (isset($searchoptions['itemtype_list'])) {
示例15: __
}
if ($_POST['inquest_config'] > 0) {
echo "<table class='tab_cadre_fixe' width='50%'>";
echo "<tr class='tab_bg_1'><td width='50%'>" . __('Create survey after') . "</td>";
echo "<td>";
Dropdown::showNumber('inquest_delay', array('value' => $inquest_delay, 'min' => 1, 'max' => 90, 'step' => 1, 'toadd' => array('0' => __('As soon as possible')), 'unit' => 'day'));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>" . "<td>" . __('Rate to trigger survey') . "</td>";
echo "<td>";
Dropdown::showNumber('inquest_rate', array('value' => $inquest_rate, 'min' => 10, 'max' => 100, 'step' => 10, 'toadd' => array(0 => __('Disabled')), 'unit' => '%'));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td width='50%'>" . __('Duration of survey') . "</td>";
echo "<td>";
Dropdown::showNumber('inquest_duration', array('value' => $inquest_duration, 'min' => 1, 'max' => 180, 'step' => 1, 'toadd' => array('0' => __('Unspecified')), 'unit' => 'day'));
echo "</td></tr>";
if ($max_closedate != '') {
echo "<tr class='tab_bg_1'><td>" . __('For tickets closed after') . "</td><td>";
Html::showDateTimeField("max_closedate", array('value' => $max_closedate, 'timestep' => 1));
echo "</td></tr>";
}
if ($_POST['inquest_config'] == 2) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Valid tags') . "</td><td>" . "[TICKET_ID] [TICKET_NAME] [TICKET_CREATEDATE] [TICKET_SOLVEDATE] " . "[REQUESTTYPE_ID] [REQUESTTYPE_NAME] [TICKET_PRIORITY] [TICKET_PRIORITYNAME] " . "[TICKETCATEGORY_ID] [TICKETCATEGORY_NAME] [TICKETTYPE_ID] " . "[TICKETTYPE_NAME] [SOLUTIONTYPE_ID] [SOLUTIONTYPE_NAME] " . "[SLA_ID] [SLA_NAME] [SLALEVEL_ID] [SLALEVEL_NAME]</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('URL') . "</td>";
echo "<td>";
Html::autocompletionTextField($entity, "inquest_URL");
echo "</td></tr>";
}
echo "</table>";
}
}