本文整理汇总了PHP中Document_Item::showSimpleAddForItem方法的典型用法代码示例。如果您正苦于以下问题:PHP Document_Item::showSimpleAddForItem方法的具体用法?PHP Document_Item::showSimpleAddForItem怎么用?PHP Document_Item::showSimpleAddForItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document_Item
的用法示例。
在下文中一共展示了Document_Item::showSimpleAddForItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'>";
}
//.........这里部分代码省略.........
示例2: showForm
//.........这里部分代码省略.........
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));
echo "</td></tr>\n";
if ($ID <= 0) {
Document_Item::showSimpleAddForItem($item);
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('By') . "</td>";
echo "<td colspan='2'>";
echo Html::image($CFG_GLPI['root_doc'] . "/pics/user.png") . " ";
echo _n('User', 'Users', 1);
$rand_user = mt_rand();
$params = array('name' => "users_id_tech", 'value' => $ID > -1 ? $this->fields["users_id_tech"] : Session::getLoginUserID(), 'right' => "own_ticket", 'rand' => $rand_user, 'entity' => $item->fields["entities_id"], 'width' => '');
$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 " <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 "<br />";
echo Html::image($CFG_GLPI['root_doc'] . "/pics/group.png") . " ";
echo _n('Group', 'Groups', 1) . " ";
$rand_group = mt_rand();
$params = array('name' => "groups_id_tech", 'value' => $ID > -1 ? $this->fields["groups_id_tech"] : Dropdown::EMPTY_VALUE, 'condition' => "is_task", 'rand' => $rand_group, 'entity' => $item->fields["entities_id"]);
$params['toupdate'] = array('value_fieldname' => 'users_id', 'to_update' => "group_available{$rand_group}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/planningcheck.php");
Group::dropdown($params);
echo "</td>\n";
echo "<td>";
if ($canplan) {
echo __('Planning');
}
if (!empty($this->fields["begin"])) {
if (Session::haveRight('planning', Planning::READMY)) {
echo "<script type='text/javascript' >\n";
echo "function showPlan" . $ID . $rand_text . "() {\n";
echo Html::jsHide("plan{$rand_text}");
$params = array('action' => 'add_event_classic_form', 'form' => 'followups', 'users_id' => $this->fields["users_id_tech"], 'groups_id' => $this->fields["groups_id_tech"], 'id' => $this->fields["id"], 'begin' => $this->fields["begin"], 'end' => $this->fields["end"], 'rand_user' => $rand_user, 'rand_group' => $rand_group, 'entity' => $item->fields["entities_id"], 'itemtype' => $this->getType(), 'items_id' => $this->getID());
示例3: showForm
/** form for Followup
*
*@param $ID integer : Id of the followup
*@param $options array of possible options:
* - ticket Object : the ticket
**/
function showForm($ID, $options = array())
{
global $DB, $CFG_GLPI;
if (isset($options['parent']) && !empty($options['parent'])) {
$ticket = $options['parent'];
}
if ($ID > 0) {
$this->check($ID, READ);
} else {
// Create item
$options['tickets_id'] = $ticket->getField('id');
$this->check(-1, CREATE, $options);
}
$tech = Session::haveRight(self::$rightname, self::ADDALLTICKET) || $ticket->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']);
$reopen_case = false;
if ($this->isNewID($ID) && in_array($ticket->fields["status"], $ticket->getClosedStatusArray()) && $ticket->isAllowedStatus($ticket->fields['status'], Ticket::INCOMING)) {
$reopen_case = true;
echo "<div class='center b'>" . __('If you want to reopen the ticket, you must specify a reason') . "</div>";
}
if ($tech) {
$this->showFormHeader($options);
$rand = mt_rand();
echo "<tr class='tab_bg_1'>";
echo "<td rowspan='3' class='middle right'>" . __('Description') . "</td>";
echo "<td class='center middle' rowspan='3'>";
echo "<textarea id='content{$rand}' name='content' cols='70' rows='6'>" . $this->fields["content"] . "</textarea>";
echo Html::scriptBlock("\$(document).ready(function() { \$('#content{$rand}').autogrow(); });");
if ($this->fields["date"]) {
echo "</td><td>" . __('Date') . "</td>";
echo "<td>" . Html::convDateTime($this->fields["date"]);
} else {
echo "</td><td colspan='2'> ";
}
echo "<input type='hidden' name='tickets_id' value='" . $this->fields["tickets_id"] . "'>";
// Reopen case
if ($reopen_case) {
echo "<input type='hidden' name='add_reopen' value='1'>";
}
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Source of followup') . "</td><td>";
RequestType::dropdown(array('value' => $this->fields["requesttypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Private') . "</td><td>";
Dropdown::showYesNo('is_private', $this->fields["is_private"]);
echo "</td></tr>";
Document_Item::showSimpleAddForItem($this);
$this->showFormButtons($options);
} else {
$options['colspan'] = 1;
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td class='middle right'>" . __('Description') . "</td>";
echo "<td class='center middle'>";
echo "<textarea name='content' cols='80' rows='6'>" . $this->fields["content"] . "</textarea>";
echo "<input type='hidden' name='tickets_id' value='" . $this->fields["tickets_id"] . "'>";
echo "<input type='hidden' name='requesttypes_id' value='" . RequestType::getDefault('helpdesk') . "'>";
// Reopen case
if ($reopen_case) {
echo "<input type='hidden' name='add_reopen' value='1'>";
}
echo "</td></tr>\n";
Document_Item::showSimpleAddForItem($ticket);
$this->showFormButtons($options);
}
return true;
}