本文整理汇总了PHP中Html::showSimpleForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::showSimpleForm方法的具体用法?PHP Html::showSimpleForm怎么用?PHP Html::showSimpleForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::showSimpleForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displaySpecificTypeField
function displaySpecificTypeField($ID, $field = array())
{
global $CFG_GLPI;
switch ($field['type']) {
case 'groups':
$groups = json_decode($this->fields[$field['name']], true);
if (!empty($groups)) {
echo "<table class='tab_cadrehov' cellpadding='5'>";
foreach ($groups as $key => $val) {
echo "<tr class='tab_bg_1 center'>";
echo "<td>";
echo Dropdown::getDropdownName("glpi_groups", $val);
echo "</td>";
echo "<td>";
Html::showSimpleForm(Toolbox::getItemTypeFormURL('PluginTimelineticketConfig'), 'delete_groups', _x('button', 'Delete permanently'), array('delete_groups' => 'delete_groups', 'id' => $ID, '_groups_id_assign' => $val), $CFG_GLPI["root_doc"] . "/pics/delete.png");
echo " </td>";
echo "</tr>";
}
echo "</table>";
} else {
_e('None');
}
break;
}
}
示例2: listOfTemplates
function listOfTemplates($target, $add = 0)
{
$restrict = "`is_template` = '1'";
$restrict .= getEntitiesRestrictRequest(" AND ", $this->getTable(), '', '', $this->maybeRecursive());
$restrict .= " ORDER BY `name`";
$templates = getAllDatasFromTable($this->getTable(), $restrict);
if (Session::isMultiEntitiesMode()) {
$colsup = 1;
} else {
$colsup = 0;
}
echo "<div align='center'><table class='tab_cadre_fixe'>";
if ($add) {
echo "<tr><th colspan='" . (2 + $colsup) . "'>" . __('Choose a template') . " - " . self::getTypeName(2) . "</th>";
} else {
echo "<tr><th colspan='" . (2 + $colsup) . "'>" . __('Templates') . " - " . self::getTypeName(2) . "</th>";
}
echo "</tr>";
if ($add) {
echo "<tr>";
echo "<td colspan='" . (2 + $colsup) . "' class='center tab_bg_1'>";
echo "<a href=\"{$target}?id=-1&withtemplate=2\"> " . __('Blank Template') . " </a></td>";
echo "</tr>";
}
foreach ($templates as $template) {
$templname = $template["template_name"];
if ($_SESSION["glpiis_ids_visible"] || empty($template["template_name"])) {
$templname .= "(" . $template["id"] . ")";
}
echo "<tr>";
echo "<td class='center tab_bg_1'>";
if (!$add) {
echo "<a href=\"{$target}?id=" . $template["id"] . "&withtemplate=1\"> {$templname} </a></td>";
if (Session::isMultiEntitiesMode()) {
echo "<td class='center tab_bg_2'>";
echo Dropdown::getDropdownName("glpi_entities", $template['entities_id']);
echo "</td>";
}
echo "<td class='center tab_bg_2'>";
Html::showSimpleForm($target, 'purge', _x('button', 'Delete permanently'), array('id' => $template["id"], 'withtemplate' => 1));
echo "</td>";
} else {
echo "<a href=\"{$target}?id=" . $template["id"] . "&withtemplate=2\"> {$templname} </a></td>";
if (Session::isMultiEntitiesMode()) {
echo "<td class='center tab_bg_2'>";
echo Dropdown::getDropdownName("glpi_entities", $template['entities_id']);
echo "</td>";
}
}
echo "</tr>";
}
if (!$add) {
echo "<tr>";
echo "<td colspan='" . (2 + $colsup) . "' class='tab_bg_2 center'>";
echo "<b><a href=\"{$target}?withtemplate=1\">" . __('Add a template...') . "</a></b>";
echo "</td>";
echo "</tr>";
}
echo "</table></div>";
}
示例3: showSummary
//.........这里部分代码省略.........
} else {
_e('Add a new followup');
}
echo "</a></div>\n";
}
}
}
if ($DB->numrows($result) == 0) {
echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2'>";
echo "<th class='b'>" . __('No followup for this ticket.') . "</th></tr></table>";
} else {
$today = strtotime('today');
$lastmonday = strtotime('last monday');
$lastlastmonday = strtotime('last monday', strtotime('last monday'));
// Case of monday
if ($today - $lastmonday == 7 * DAY_TIMESTAMP) {
$lastlastmonday = $lastmonday;
$lastmonday = $today;
}
$steps = array(0 => array('end' => $today, 'name' => __('Today')), 1 => array('end' => $lastmonday, 'name' => __('This week')), 2 => array('end' => $lastlastmonday, 'name' => __('Last week')), 3 => array('end' => strtotime('midnight first day of'), 'name' => __('This month')), 4 => array('end' => strtotime('midnight first day of last month'), 'name' => __('Last month')), 5 => array('end' => 0, 'name' => __('Before the last month')));
$currentpos = -1;
while ($data = $DB->fetch_assoc($result)) {
$this->getFromDB($data['id']);
$candelete = $this->canPurge() && $this->canPurgeItem();
$canedit = $this->canUpdate() && $this->canUpdateItem();
$time = strtotime($data['date']);
if (!isset($steps[$currentpos]) || $steps[$currentpos]['end'] > $time) {
$currentpos++;
while ($steps[$currentpos]['end'] > $time && isset($steps[$currentpos + 1])) {
$currentpos++;
}
if (isset($steps[$currentpos])) {
echo "<h3>" . $steps[$currentpos]['name'] . "</h3>";
}
}
$id = 'followup' . $data['id'] . $rand;
$color = 'byuser';
if (isset($techs[$data['users_id']])) {
$color = 'bytech';
}
$classtoadd = '';
if ($canedit) {
$classtoadd = " pointer";
}
echo "<div class='boxnote {$color}' id='view{$id}'";
echo ">";
echo "<div class='boxnoteleft'>";
echo "<img class='user_picture_verysmall' alt=\"" . __s('Picture') . "\" src='" . User::getThumbnailURLForPicture($data['picture']) . "'>";
echo "</div>";
// boxnoteleft
echo "<div class='boxnotecontent'";
echo ">";
echo "<div class='boxnotefloatleft'>";
$username = NOT_AVAILABLE;
if ($data['users_id']) {
$username = getUserName($data['users_id'], $showuserlink);
}
$name = sprintf(__('Create by %1$s on %2$s'), $username, Html::convDateTime($data['date']));
if ($data['requesttypes_id']) {
$name = sprintf(__('%1$s - %2$s'), $name, Dropdown::getDropdownName('glpi_requesttypes', $data['requesttypes_id']));
}
if ($showprivate && $data["is_private"]) {
$name = sprintf(__('%1$s - %2$s'), $name, __('Private'));
}
echo $name;
echo "</div>";
// floatright
echo "<div class='boxnotetext {$classtoadd}'";
if ($canedit) {
echo " onClick=\"viewEditFollowup" . $ticket->fields['id'] . $data['id'] . "{$rand}(); " . Html::jsHide("view{$id}") . " " . Html::jsShow("viewfollowup" . $ticket->fields['id'] . $data["id"] . "{$rand}") . "\" ";
}
echo ">";
$content = nl2br($data['content']);
if (empty($content)) {
$content = NOT_AVAILABLE;
}
echo $content . '</div>';
// boxnotetext
echo "</div>";
// boxnotecontent
echo "<div class='boxnoteright'>";
if ($candelete) {
Html::showSimpleForm(Toolbox::getItemTypeFormURL('TicketFollowup'), array('purge' => 'purge'), _x('button', 'Delete permanently'), array('id' => $data['id']), $CFG_GLPI["root_doc"] . "/pics/delete.png", '', __('Confirm the final deletion?'));
}
echo "</div>";
// boxnoteright
echo "</div>";
// boxnote
if ($canedit) {
echo "<div id='viewfollowup" . $ticket->fields['id'] . $data["id"] . "{$rand}' class='starthidden'></div>\n";
echo "\n<script type='text/javascript' >\n";
echo "function viewEditFollowup" . $ticket->fields['id'] . $data["id"] . "{$rand}() {\n";
$params = array('type' => __CLASS__, 'parenttype' => 'Ticket', 'tickets_id' => $data["tickets_id"], 'id' => $data["id"]);
Ajax::updateItemJsCode("viewfollowup" . $ticket->fields['id'] . $data["id"] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
echo "};";
echo "</script>\n";
}
}
}
}
示例4: showActorsPartForm
/**
* show actor part in ITIL object form
*
* @param $ID integer ITIL object ID
* @param $options array options for default values ($options of showForm)
*
* @return nothing display
**/
function showActorsPartForm($ID, array $options)
{
global $CFG_GLPI;
$showuserlink = 0;
if (User::canView()) {
$showuserlink = 1;
}
$options['_default_use_notification'] = 1;
if (isset($options['entities_id'])) {
$options['_default_use_notification'] = Entity::getUsedConfig('is_notif_enable_default', $options['entities_id'], '', 1);
}
// check is_hidden fields
foreach (array('_users_id_requester', '_groups_id_requester', '_users_id_observer', '_groups_id_observer', '_users_id_assign', '_groups_id_assign', '_suppliers_id_assign') as $f) {
$is_hidden[$f] = false;
if (isset($options['_tickettemplate']) && $options['_tickettemplate']->isHiddenField($f)) {
$is_hidden[$f] = true;
}
}
$can_admin = $this->canAdminActors();
$can_assign = $this->canAssign();
$can_assigntome = $this->canAssignToMe();
if (isset($options['_noupdate']) && !$options['_noupdate']) {
$can_admin = false;
$can_assign = false;
$can_assigntome = false;
}
// Manage actors : requester and assign
echo "<table class='tab_cadre_fixe' id='mainformtable5'>";
echo "<tr class='tab_bg_1'>";
echo "<th rowspan='2' width='13%'>" . __('Actor') . "</th>";
echo "<th width='29%'>";
if (!$is_hidden['_users_id_requester'] || !$is_hidden['_groups_id_requester']) {
_e('Requester');
}
$rand_requester = -1;
$candeleterequester = false;
if ($ID && $can_admin && (!$is_hidden['_users_id_requester'] || !$is_hidden['_groups_id_requester'])) {
$rand_requester = mt_rand();
echo " ";
echo "<img title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n onClick=\"" . Html::jsShow("itilactor{$rand_requester}") . "\"\n class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
$candeleterequester = true;
}
echo "</th>";
echo "<th width='29%'>";
if (!$is_hidden['_users_id_observer'] || !$is_hidden['_groups_id_observer']) {
_e('Watcher');
}
$rand_observer = -1;
$candeleteobserver = false;
if ($ID && $can_admin && (!$is_hidden['_users_id_observer'] || !$is_hidden['_groups_id_observer'])) {
$rand_observer = mt_rand();
echo " ";
echo "<img title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n onClick=\"" . Html::jsShow("itilactor{$rand_observer}") . "\"\n class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
$candeleteobserver = true;
} else {
if ($ID > 0 && !in_array($this->fields['status'], $this->getClosedStatusArray()) && !$is_hidden['_users_id_observer'] && !$this->isUser(CommonITILActor::OBSERVER, Session::getLoginUserID()) && !$this->isUser(CommonITILActor::REQUESTER, Session::getLoginUserID())) {
echo " ";
Html::showSimpleForm($this->getFormURL(), 'addme_observer', __('Associate myself'), array($this->getForeignKeyField() => $this->fields['id']), $CFG_GLPI["root_doc"] . "/pics/addme.png");
}
}
echo "</th>";
echo "<th width='29%'>";
if (!$is_hidden['_users_id_assign'] || !$is_hidden['_groups_id_assign'] || !$is_hidden['_suppliers_id_assign']) {
_e('Assigned to');
}
$rand_assign = -1;
$candeleteassign = false;
if ($ID && ($can_assign || $can_assigntome) && (!$is_hidden['_users_id_assign'] || !$is_hidden['_groups_id_assign'] || !$is_hidden['_suppliers_id_assign']) && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
$rand_assign = mt_rand();
echo " ";
echo "<img title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n onClick=\"" . Html::jsShow("itilactor{$rand_assign}") . "\"\n class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
}
if ($ID && $can_assigntome && !in_array($this->fields['status'], $this->getClosedStatusArray()) && !$is_hidden['_users_id_assign'] && !$this->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) && $this->isAllowedStatus($this->fields['status'], CommonITILObject::ASSIGNED)) {
Html::showSimpleForm($this->getFormURL(), 'addme_assign', __('Associate myself'), array($this->getForeignKeyField() => $this->fields['id']), $CFG_GLPI["root_doc"] . "/pics/addme.png");
}
if ($ID && $can_assign) {
$candeleteassign = true;
}
echo "</th></tr>";
echo "<tr class='tab_bg_1 top'>";
echo "<td>";
if ($rand_requester >= 0) {
$this->showActorAddForm(CommonITILActor::REQUESTER, $rand_requester, $this->fields['entities_id'], $is_hidden);
}
// Requester
if (!$ID) {
$reqdisplay = false;
if ($can_admin && !$is_hidden['_users_id_requester']) {
$this->showActorAddFormOnCreate(CommonITILActor::REQUESTER, $options);
$reqdisplay = true;
} else {
$delegating = User::getDelegateGroupsForUser($options['entities_id']);
//.........这里部分代码省略.........
示例5: showForm
/**
* Print the contact form
*
* @param $ID integer ID of the item
* @param $options array
* - target filename : where to go when done.
* - withtemplate boolean : template or basic item
*
* @return Nothing (display)
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
if (!Config::canView() || !$this->getFromDB($ID)) {
return false;
}
$options['candel'] = false;
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . "</td>";
echo "<td class ='b'>";
$name = $this->fields["name"];
if ($isplug = isPluginItemType($this->fields["itemtype"])) {
$name = sprintf(__('%1$s - %2$s'), $isplug["plugin"], $name);
}
echo $name . "</td>";
echo "<td rowspan='6' class='middle right'>" . __('Comments') . "</td>";
echo "<td class='center middle' rowspan='6'>";
echo "<textarea cols='45' rows='8' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Description') . "</td><td>";
echo $this->getDescription($ID);
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Run frequency') . "</td><td>";
$this->dropdownFrequency('frequency', $this->fields["frequency"]);
echo "</td></tr>";
$tmpstate = $this->fields["state"];
echo "<tr class='tab_bg_1'><td>" . __('Status') . "</td><td>";
if (is_file(GLPI_CRON_DIR . '/' . $this->fields["name"] . '.lock') || is_file(GLPI_CRON_DIR . '/all.lock')) {
echo "<span class='b'>" . __('System lock') . "</span><br>";
$tmpstate = self::STATE_DISABLE;
}
if ($isplug) {
$plug = new Plugin();
if (!$plug->isActivated($isplug["plugin"])) {
echo "<span class='b'>" . __('Disabled plugin') . "</span><br>";
$tmpstate = self::STATE_DISABLE;
}
}
if ($this->fields["state"] == self::STATE_RUNNING) {
echo "<span class='b'>" . $this->getStateName(self::STATE_RUNNING) . "</span>";
} else {
self::dropdownState('state', $this->fields["state"]);
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Run mode') . "</td><td>";
$modes = array();
if ($this->fields['allowmode'] & self::MODE_INTERNAL) {
$modes[self::MODE_INTERNAL] = self::getModeName(self::MODE_INTERNAL);
}
if ($this->fields['allowmode'] & self::MODE_EXTERNAL) {
$modes[self::MODE_EXTERNAL] = self::getModeName(self::MODE_EXTERNAL);
}
Dropdown::showFromArray('mode', $modes, array('value' => $this->fields['mode']));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Run period') . "</td><td>";
Dropdown::showNumber('hourmin', array('value' => $this->fields['hourmin'], 'min' => 0, 'max' => 24, 'width' => '35%'));
echo " -> ";
Dropdown::showNumber('hourmax', array('value' => $this->fields['hourmax'], 'min' => 0, 'max' => 24, 'width' => '35%'));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Number of days this action logs are stored') . "</td><td>";
Dropdown::showNumber('logs_lifetime', array('value' => $this->fields['logs_lifetime'], 'min' => 10, 'max' => 360, 'step' => 10, 'toadd' => array(0 => __('Infinite'))));
echo "</td><td>" . __('Last run') . "</td><td>";
if (empty($this->fields['lastrun'])) {
_e('Never');
} else {
echo Html::convDateTime($this->fields['lastrun']);
echo " ";
Html::showSimpleForm(static::getFormURL(), 'resetdate', __('Blank'), array('id' => $ID), $CFG_GLPI['root_doc'] . "/pics/reset.png");
}
echo "</td></tr>";
$label = $this->getParameterDescription();
echo "<tr class='tab_bg_1'><td>";
if (empty($label)) {
echo " </td><td> ";
} else {
echo $label . " </td><td>";
Dropdown::showNumber('param', array('value' => $this->fields['param'], 'min' => 0, 'max' => 400));
}
echo "</td><td>" . __('Next run') . "</td><td>";
if ($tmpstate == self::STATE_RUNNING) {
$launch = false;
} else {
$launch = $this->fields['allowmode'] & self::MODE_INTERNAL;
}
if ($tmpstate != self::STATE_WAITING) {
echo $this->getStateName($tmpstate);
} else {
if (empty($this->fields['lastrun'])) {
_e('As soon as possible');
//.........这里部分代码省略.........
示例6: showForItem
/**
* Show Infocom form for an item (not a standard showForm)
*
* @param $item CommonDBTM object
* @param $withtemplate integer template or basic item (default '')
**/
static function showForItem(CommonDBTM $item, $withtemplate = '')
{
global $CFG_GLPI;
// Show Infocom or blank form
if (!Session::haveRight("infocom", "r")) {
return false;
}
if (!$item) {
echo "<div class='spaced'>" . __('Requested item not found') . "</div>";
} else {
$date_tax = $CFG_GLPI["date_tax"];
$dev_ID = $item->getField('id');
$ic = new self();
$option = "";
if ($withtemplate == 2) {
$option = " readonly ";
}
if (!strpos($_SERVER['PHP_SELF'], "infocoms-show") && in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) {
echo "<div class='firstbloc center'>" . __('For this type of item, the financial and administrative information are only a model for the items which you should add.') . "</div>";
}
if (!$ic->getFromDBforDevice($item->getType(), $dev_ID)) {
$input = array('itemtype' => $item->getType(), 'items_id' => $dev_ID, 'entities_id' => $item->getEntityID());
if ($ic->can(-1, "w", $input) && $withtemplate != 2) {
echo "<div class='spaced b'>";
echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'><th>";
echo sprintf(__('%1$s - %2$s'), $item->getTypeName(1), $item->getName()) . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='center'>";
Html::showSimpleForm($CFG_GLPI["root_doc"] . "/front/infocom.form.php", 'add', __('Enable the financial and administrative information'), array('itemtype' => $item->getType(), 'items_id' => $dev_ID));
echo "</td></tr></table></div>";
}
} else {
// getFromDBforDevice
$canedit = $ic->can($ic->fields['id'], "w") && $withtemplate != 2;
if ($canedit) {
echo "<form name='form_ic' method='post' action='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php'>";
}
echo "<div class='spaced'>";
echo "<table class='tab_cadre" . (!strpos($_SERVER['PHP_SELF'], "infocoms-show") ? "_fixe" : "") . "'>";
echo "<tr><th colspan='4'>" . __('Financial and administrative information') . "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Supplier') . "</td>";
echo "<td>";
if ($withtemplate == 2) {
echo Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]);
} else {
Supplier::dropdown(array('value' => $ic->fields["suppliers_id"], 'entity' => $item->getEntityID()));
}
echo "</td>";
if (Session::haveRight("budget", "r")) {
echo "<td>" . __('Budget') . "</td><td >";
Budget::dropdown(array('value' => $ic->fields["budgets_id"], 'entity' => $item->getEntityID(), 'comments' => 1));
} else {
echo "<td colspan='2'>";
}
echo "</td></tr>";
// Can edit calendar ?
$editcalendar = $withtemplate != 2;
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Order number') . "</td>";
echo "<td >";
Html::autocompletionTextField($ic, "order_number", array('option' => $option));
echo "</td>";
echo "<td>" . __('Order date') . "</td><td>";
Html::showDateFormItem("order_date", $ic->fields["order_date"], true, $editcalendar);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
$istemplate = '';
if ($item->isTemplate() || in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) {
$istemplate = '*';
}
echo "<td>" . sprintf(__('%1$s%2$s'), __('Immobilization number'), $istemplate) . "</td>";
echo "<td>";
$objectName = autoName($ic->fields["immo_number"], "immo_number", $withtemplate == 2, 'Infocom', $item->getEntityID());
Html::autocompletionTextField($ic, "immo_number", array('value' => $objectName, 'option' => $option));
echo "</td>";
echo "<td>" . __('Date of purchase') . "</td><td>";
Html::showDateFormItem("buy_date", $ic->fields["buy_date"], true, $editcalendar);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Invoice number') . "</td>";
echo "<td>";
Html::autocompletionTextField($ic, "bill", array('option' => $option));
echo "</td>";
echo "<td>" . __('Delivery date') . "</td><td>";
Html::showDateFormItem("delivery_date", $ic->fields["delivery_date"], true, $editcalendar);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Delivery form') . "</td><td>";
Html::autocompletionTextField($ic, "delivery_number", array('option' => $option));
echo "</td>";
echo "<td>" . __('Startup date') . "</td><td>";
Html::showDateFormItem("use_date", $ic->fields["use_date"], true, $editcalendar);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
//.........这里部分代码省略.........
示例7: showFormReplicatesConfig
function showFormReplicatesConfig()
{
global $DB;
$ID = $this->getField('id');
$target = $this->getFormURL();
$rand = mt_rand();
AuthLdapReplicate::addNewReplicateForm($target, $ID);
$sql = "SELECT *\n FROM `glpi_authldapreplicates`\n WHERE `authldaps_id` = '{$ID}'\n ORDER BY `name`";
$result = $DB->query($sql);
if (($nb = $DB->numrows($result)) > 0) {
echo "<br>";
$canedit = Config::canUpdate();
echo "<div class='center'>";
Html::openMassiveActionsForm('massAuthLdapReplicate' . $rand);
$massiveactionparams = array('num_displayed' => $nb, 'container' => 'massAuthLdapReplicate' . $rand);
Html::showMassiveActions($massiveactionparams);
echo "<input type='hidden' name='id' value='{$ID}'>";
echo "<table class='tab_cadre_fixehov'>";
echo "<tr class='noHover'>" . "<th colspan='4'>" . __('List of LDAP directory replicates') . "</th></tr>";
if (isset($_SESSION["LDAP_TEST_MESSAGE"])) {
echo "<tr class='tab_bg_2'><td class='center' colspan='4'>";
echo $_SESSION["LDAP_TEST_MESSAGE"];
echo "</td></tr>";
unset($_SESSION["LDAP_TEST_MESSAGE"]);
}
$header_begin = "<tr>";
$header_top = "<th>" . Html::getCheckAllAsCheckbox('massAuthLdapReplicate' . $rand) . "</th>";
$header_bottom = "<th>" . Html::getCheckAllAsCheckbox('massAuthLdapReplicate' . $rand) . "</th>";
$header_end = "<th class='center b'>" . __('Name') . "</th>";
$header_end .= "<th class='center b'>" . _n('Replicate', 'Replicates', 1) . "</th>" . "<th class='center'></th></tr>";
echo $header_begin . $header_top . $header_end;
while ($ldap_replicate = $DB->fetch_assoc($result)) {
echo "<tr class='tab_bg_1'><td class='center' width='10'>";
Html::showMassiveActionCheckBox('AuthLdapReplicate', $ldap_replicate["id"]);
echo "</td>";
echo "<td class='center'>" . $ldap_replicate["name"] . "</td>";
echo "<td class='center'>" . sprintf(__('%1$s: %2$s'), $ldap_replicate["host"], $ldap_replicate["port"]);
echo "</td>";
echo "<td class='center'>";
Html::showSimpleForm(Toolbox::getItemTypeFormURL(self::getType()), 'test_ldap_replicate', _sx('button', 'Test'), array('id' => $ID, 'ldap_replicate_id' => $ldap_replicate["id"]));
echo "</td></tr>";
}
echo $header_begin . $header_bottom . $header_end;
echo "</table>";
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
Html::closeForm();
echo "</div>";
}
}
示例8: showForm
//.........这里部分代码省略.........
if (count($networkports_ids) == 0) {
unset($network);
} else {
$network->getFromDB($networkports_ids[0]);
}
}
if ($this->fields['unknown_interface_type'] == 1) {
$options['canedit'] = true;
$number_real_errors++;
$interface_cell = "th";
echo "<tr class='tab_bg_1'><th>" . $motives['unknown_interface_type'] . "</th>\n" . "<td>" . __('Transform this network port to');
echo "</td><td colspan=2>";
Dropdown::showItemTypes('transform_to', NetworkPort::getNetworkPortInstantiations(), array('value' => "NetworkPortEthernet"));
echo "</td></tr>\n";
}
if ($this->fields['invalid_network'] == 1) {
$number_real_errors++;
$network_cell = "th";
$address_cell = "th";
echo "<tr class='tab_bg_1'><th>" . $motives['invalid_network'] . "</th>\n<td colspan=3>";
if (isset($network)) {
printf(__('Network port information conflicting with %s'), $network->getLink());
} else {
if (!isset($address) || !isset($netmask)) {
_e('Invalid address or netmask');
} else {
_e('No conflicting network');
}
echo " <a href='" . Toolbox::getItemTypeFormURL('IPNetwork') . "'>" . __('you may have to add a network') . "</a>";
}
echo "</td></tr>\n";
}
if ($this->fields['invalid_gateway'] == 1) {
$number_real_errors++;
$gateway_cell = "th";
echo "<tr class='tab_bg_1'><th>" . $motives['invalid_gateway'] . "</th>\n<td colspan=3>";
if (isset($network)) {
printf(__('Append a correct gateway to the network %s'), $network->getLink());
} else {
printf(__('%1$s: %2$s'), __('Unknown network'), "<a href='" . Toolbox::getItemTypeFormURL('IPNetwork') . "'>" . __('Add a network') . "\n </a>");
}
echo "</td></tr>\n";
}
if ($this->fields['invalid_address'] == 1) {
$number_real_errors++;
$address_cell = "th";
echo "<tr class='tab_bg_1'><th>" . $motives['invalid_address'] . "</th>\n<td colspan=3>";
$networkPort = new NetworkPort();
if ($networkPort->getFromDB($this->getID())) {
$number_real_errors++;
echo "<a href='" . $networkPort->getLinkURL() . "'>" . __('Add a correct IP to the network port') . "</a>";
} else {
_e('Unknown network port');
}
echo "</td></tr>\n";
}
if ($number_real_errors == 0) {
echo "<tr class='tab_bg_1'><th colspan='3'>" . __('I don\'t understand why this migration error is not deleted.');
echo "</th><th>";
Html::showSimpleForm($this->getFormURL(), 'delete', __('You can delete this migration error'), array('id' => $this->getID()));
echo "</th></tr>\n";
} else {
echo "<tr class='tab_bg_1'><th>" . __('At all events') . "</th>\n";
echo "<td colspan='3'>";
Html::showSimpleForm($this->getFormURL(), 'delete', __('You can delete this migration error'), array('id' => $this->getID()));
echo "</td></tr>\n";
}
echo "<tr class='tab_bg_1'><td colspan='4'> </td></tr>\n";
echo "<tr class='tab_bg_1'><th colspan='4'>" . __('Original network port information') . "</th>" . "</tr>\n";
echo "<tr class='tab_bg_1'><td>";
$this->displayRecursiveItems($recursiveItems, 'Type');
echo "</td>\n<td>";
$this->displayRecursiveItems($recursiveItems, "Link");
echo "</td>\n";
echo "<td>" . __('Comments') . "</td>";
echo "<td class='middle'>" . $this->fields["comment"] . "</td></tr>\n";
echo "<tr class='tab_bg_1'><td>" . __('Network address') . "</td>\n";
echo "<{$network_cell}>" . $this->fields['subnet'] . "</{$network_cell}>\n";
echo "<td>" . IPNetmask::getTypeName(1) . "</td>\n";
echo "<{$network_cell}>" . $this->fields['netmask'] . "</{$network_cell}></tr>\n";
echo "<tr class='tab_bg_1'><td>" . IPAddress::getTypeName(1) . "</td>\n";
echo "<{$address_cell}>" . $this->fields['ip'] . "</{$address_cell}>\n";
echo "<td>" . __('Gateway') . "</td>\n";
echo "<{$gateway_cell}>" . $this->fields['gateway'] . "</{$gateway_cell}></tr>\n";
echo "<tr class='tab_bg_1'><td>" . __('Network interface') . "</td><{$interface_cell}>\n";
if (TableExists('glpi_networkinterfaces')) {
$query = "SELECT `name`\n FROM `glpi_networkinterfaces`\n WHERE `id`='" . $this->fields['networkinterfaces_id'] . "'";
$result = $DB->query($query);
if ($DB->numrows($result) > 0) {
$row = $DB->fetch_assoc($result);
echo $row['name'];
} else {
_e('Unknown interface');
}
}
echo "</{$interface_cell}>";
echo "<{$interface_cell}></{$interface_cell}>";
echo "<{$interface_cell}></{$interface_cell}></tr>\n";
$this->showFormButtons($options);
}
示例9: showForItem
/**
* Show notepads for an item
*
* @param $item CommonDBTM object
* @param $withtemplate integer template or basic item (default '')
**/
static function showForItem(CommonDBTM $item, $withtemplate = '')
{
global $CFG_GLPI;
if (!Session::haveRight($item::$rightname, READNOTE)) {
return false;
}
$notes = static::getAllForItem($item);
$rand = mt_rand();
$canedit = Session::haveRight($item::$rightname, UPDATENOTE);
$showuserlink = 0;
if (User::canView()) {
$showuserlink = 1;
}
if ($canedit) {
echo "<div class='boxnote center'>";
echo "<div class='boxnoteleft'></div>";
echo "<form name='addnote_form{$rand}' id='addnote_form{$rand}' ";
echo " method='post' action='" . Toolbox::getItemTypeFormURL('Notepad') . "'>";
echo Html::hidden('itemtype', array('value' => $item->getType()));
echo Html::hidden('items_id', array('value' => $item->getID()));
echo "<div class='boxnotecontent'>";
echo "<div class='floatleft'>";
echo "<textarea name='content' rows=5 cols=100></textarea>";
echo "</div>";
echo "</div>";
// box notecontent
echo "<div class='boxnoteright'><br>";
echo Html::submit(_x('button', 'Add'), array('name' => 'add'));
echo "</div>";
Html::closeForm();
echo "</div>";
// boxnote
}
if (count($notes)) {
foreach ($notes as $note) {
$id = 'note' . $note['id'] . $rand;
$classtoadd = '';
if ($canedit) {
$classtoadd = " pointer";
}
echo "<div class='boxnote' id='view{$id}'>";
echo "<div class='boxnoteleft'>";
echo "<img class='user_picture_verysmall' alt=\"" . __s('Picture') . "\" src='" . User::getThumbnailURLForPicture($note['picture']) . "'>";
echo "</div>";
// boxnoteleft
echo "<div class='boxnotecontent'>";
echo "<div class='boxnotefloatright'>";
$username = NOT_AVAILABLE;
if ($note['users_id_lastupdater']) {
$username = getUserName($note['users_id_lastupdater'], $showuserlink);
}
$update = sprintf(__('Last update by %1$s on %2$s'), $username, Html::convDateTime($note['date_mod']));
$username = NOT_AVAILABLE;
if ($note['users_id']) {
$username = getUserName($note['users_id'], $showuserlink);
}
$create = sprintf(__('Create by %1$s on %2$s'), $username, Html::convDateTime($note['date']));
printf(__('%1$s / %2$s'), $update, $create);
echo "</div>";
// floatright
echo "<div class='boxnotetext {$classtoadd}' ";
if ($canedit) {
echo "onclick=\"" . Html::jsHide("view{$id}") . " " . Html::jsShow("edit{$id}") . "\"";
}
echo ">";
$content = nl2br($note['content']);
if (empty($content)) {
$content = NOT_AVAILABLE;
}
echo $content . '</div>';
// boxnotetext
echo "</div>";
// boxnotecontent
echo "<div class='boxnoteright'>";
if ($canedit) {
Html::showSimpleForm(Toolbox::getItemTypeFormURL('Notepad'), array('purge' => 'purge'), _x('button', 'Delete permanently'), array('id' => $note['id']), $CFG_GLPI["root_doc"] . "/pics/delete.png", '', __('Confirm the final deletion?'));
}
echo "</div>";
// boxnoteright
echo "</div>";
// boxnote
if ($canedit) {
echo "<div class='boxnote starthidden' id='edit{$id}'>";
echo "<form name='update_form{$id}{$rand}' id='update_form{$id}{$rand}' ";
echo " method='post' action='" . Toolbox::getItemTypeFormURL('Notepad') . "'>";
echo "<div class='boxnoteleft'></div>";
echo "<div class='boxnotecontent'>";
echo Html::hidden('id', array('value' => $note['id']));
echo "<textarea name='content' rows=5 cols=100>" . $note['content'] . "</textarea>";
echo "</div>";
// boxnotecontent
echo "<div class='boxnoteright'><br>";
echo Html::submit(_x('button', 'Update'), array('name' => 'update'));
echo "</div>";
//.........这里部分代码省略.........
示例10: showForm
/**
* Prints the model add form (into devices)
*
* @param $device the device ID
* @param $type the device type
* @return nothing (print out a table)
*
*/
static function showForm($itemtype, $items_id)
{
global $DB, $CFG_GLPI;
$canedit = plugin_manufacturersimports_haveRight('manufacturersimports', 'w');
$query = "SELECT *\n FROM `glpi_plugin_manufacturersimports_models`\n WHERE `itemtype` = '" . $itemtype . "'\n AND `items_id` = '" . $items_id . "'";
$result = $DB->query($query);
$number = $DB->numrows($result);
echo "<form method='post' action=\"" . $CFG_GLPI["root_doc"] . "/plugins/manufacturersimports/front/config.form.php\">";
echo "<div align=\"center\"><table class=\"tab_cadre_fixe\" cellspacing=\"2\" cellpadding=\"2\">";
echo "<tr>";
echo "<th>" . PluginManufacturersimportsPreImport::getTypeName(2) . "</th>";
echo "<th>" . __('Model Number', 'manufacturersimports') . "</th>";
echo "</tr>";
if ($number == 1) {
while ($line = $DB->fetch_array($result)) {
$ID = $line["id"];
echo "<tr class='tab_bg_2'>";
echo "<td class='left'>";
echo "<input type='text' name='model_name' size='30' value='" . $line["model_name"] . "'>";
echo "</td>";
if ($canedit) {
echo "<td class='center' class='tab_bg_2'>";
Html::showSimpleForm($CFG_GLPI['root_doc'] . '/plugins/manufacturersimports/front/config.form.php', 'delete_model', _x('button', 'Delete permanently'), array('id' => $ID));
echo "</td>";
} else {
echo "<td>";
echo "</td>";
}
echo "</tr>";
}
} else {
if ($canedit) {
echo "<tr>";
echo "<th colspan='2'>";
echo "<input type='text' name='model_name' size='30'>";
echo "<input type='hidden' name='items_id' value='" . $items_id . "'>";
echo "<input type='hidden' name='itemtype' value='" . $itemtype . "'>";
echo "<input type=\"submit\" name=\"update_model\" class=\"submit\" value='" . _sx('button', 'Save') . "' >";
echo "</th></tr>";
}
}
echo "</table></div>";
Html::closeForm();
}
示例11: showBookmarkList
//.........这里部分代码省略.........
}
$rand = mt_rand();
$numrows = $DB->numrows($result);
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
echo "<div class='center' id='tabsbody' >";
$maactions = array('purge' => _x('button', 'Delete permanently'));
if ($is_private) {
$maactions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'move_bookmark'] = __('Move');
}
$massiveactionparams = array('num_displayed' => $numrows, 'container' => 'mass' . __CLASS__ . $rand, 'width' => 600, 'extraparams' => array('is_private' => $is_private), 'height' => 200, 'specific_actions' => $maactions);
// No massive action on bottom
echo "<table class='tab_cadre_fixehov'>";
echo "<tr>";
echo "<th>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
echo "<th class='center' colspan='2'>" . _n('Bookmark', 'Bookmarks', Session::getPluralNumber()) . "</th>";
echo "<th width='20px'> </th>";
echo "<th>" . __('Default view') . "</th>";
$colspan = 5;
if ($is_private) {
$colspan += 2;
echo "<th colspan='2'> </th>";
}
echo "</tr>";
if ($totalcount = count($ordered_bookmarks)) {
$current_type = -1;
$number = 0;
$current_type_name = NOT_AVAILABLE;
foreach ($ordered_bookmarks as $key => $this->fields) {
$number++;
if ($current_type != $this->fields['itemtype']) {
$current_type = $this->fields['itemtype'];
$current_type_name = NOT_AVAILABLE;
if ($current_type == "AllAssets") {
$current_type_name = __('Global');
} else {
if ($item = getItemForItemtype($current_type)) {
$current_type_name = $item->getTypeName(1);
}
}
}
$canedit = $this->canEdit($this->fields["id"]);
echo "<tr class='tab_bg_1'>";
echo "<td width='10px'>";
if ($canedit) {
Html::showMassiveActionCheckBox(__CLASS__, $this->fields["id"]);
} else {
echo " ";
}
echo "</td>";
echo "<td>{$current_type_name}</td>";
echo "<td>";
if ($canedit) {
echo "<a href=\"" . $CFG_GLPI['root_doc'] . "/front/bookmark.php?action=edit&id=" . $this->fields["id"] . "\" alt='" . _sx('button', 'Update') . "'>" . $this->fields["name"] . "</a>";
} else {
echo $this->fields["name"];
}
echo "</td>";
echo "<td><a href=\"" . $CFG_GLPI['root_doc'] . "/front/bookmark.php?action=load&id=" . $this->fields["id"] . "\" class='vsubmit'>" . __('Load') . "</a>";
echo "</td>";
echo "<td class='center'>";
if ($this->fields['type'] == self::SEARCH) {
if (is_null($this->fields['IS_DEFAULT'])) {
echo "<a href=\"" . $CFG_GLPI['root_doc'] . "/front/bookmark.php?action=edit&" . "mark_default=1&id=" . $this->fields["id"] . "\" alt=\"" . __s('Not default search') . "\" itle=\"" . __s('Not default search') . "\">" . "<img src=\"" . $CFG_GLPI['root_doc'] . "/pics/bookmark_record.png\" class='pointer'></a>";
} else {
echo "<a href=\"" . $CFG_GLPI['root_doc'] . "/front/bookmark.php?action=edit&" . "mark_default=0&id=" . $this->fields["id"] . "\" alt=\"" . __s('Default search') . "\" title=\"" . __s('Default search') . "\">" . "<img src=\"" . $CFG_GLPI['root_doc'] . "/pics/bookmark_default.png\" class='pointer'></a>";
}
}
echo "</td>";
if ($is_private) {
if ($number != 1) {
echo "<td>";
Html::showSimpleForm($this->getSearchURL(), array('action' => 'up'), '', array('id' => $this->fields["id"]), $CFG_GLPI["root_doc"] . "/pics/deplier_up.png");
echo "</td>";
} else {
echo "<td> </td>";
}
if ($number != $totalcount) {
echo "<td>";
Html::showSimpleForm($this->getSearchURL(), array('action' => 'down'), '', array('id' => $this->fields["id"]), $CFG_GLPI["root_doc"] . "/pics/deplier_down.png");
echo "</td>";
} else {
echo "<td> </td>";
}
}
echo "</tr>";
$first = false;
}
echo "</table></div>";
if ($is_private || Session::haveRight('bookmark_public', PURGE)) {
$massiveactionparams['ontop'] = false;
$massiveactionparams['forcecreate'] = true;
Html::showMassiveActions($massiveactionparams);
}
} else {
echo "<tr class='tab_bg_1'><td colspan='{$colspan}'>";
_e('You have not recorded any bookmarks yet');
echo "</td></tr></table>";
}
Html::closeForm();
}
示例12: ajaxFooter
/**
* Display Ajax Footer for debug
**/
static function ajaxFooter()
{
if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
// mode debug
$rand = mt_rand();
echo "<div class='center' id='debugajax'>";
echo "<a class='debug-float' href=\"javascript:showHideDiv('see_ajaxdebug{$rand}','','','');\">\n AJAX DEBUG</a>";
if (!isset($_POST['full_page_tab']) && strstr($_SERVER['REQUEST_URI'], '/ajax/common.tabs.php')) {
echo " ";
Html::showSimpleForm($_SERVER['REQUEST_URI'], 'full_page_tab', 'Display only tab for debug', $_POST);
}
echo "</div>";
echo "<div id='see_ajaxdebug{$rand}' name='see_ajaxdebug{$rand}' style=\"display:none;\">";
self::displayDebugInfos(false);
echo "</div></div>";
}
}
示例13: displayLinkedProjetTasksTo
/**
* Display linked projets to a projet
*
* @param $ID ID of the projet id
*
* @return nothing display
**/
static function displayLinkedProjetTasksTo($ID, $notif = false)
{
global $DB, $CFG_GLPI;
$tasks = self::getParentProjetTasksTo($ID);
$canupdate = plugin_projet_haveRight('task', 'w');
$task = new PluginProjetTask();
if (is_array($tasks) && count($tasks)) {
foreach ($tasks as $linkID => $data) {
if ($notif) {
return Dropdown::getDropdownName("glpi_plugin_projet_tasks", $data['plugin_projet_tasks_id']);
} else {
echo self::getLinkName($data['link']) . " ";
if (!$_SESSION['glpiis_ids_visible']) {
echo __('ID') . " " . $data['plugin_projet_tasks_id'] . " : ";
}
if ($task->getFromDB($data['plugin_projet_tasks_id'])) {
echo $task->getLink();
if ($canupdate) {
echo " ";
Html::showSimpleForm($CFG_GLPI['root_doc'] . '/plugins/projet/front/task.form.php', 'delete_link', _x('button', 'Delete permanently'), array('delete_link' => 'delete_link', 'id' => $linkID, 'plugin_projet_tasks_id' => $ID), $CFG_GLPI["root_doc"] . "/pics/delete.png");
}
}
}
}
}
}
示例14: showGlobalSwitch
/**
* Dropdown for global item management
*
* @param $ID item ID
* @param attrs array which contains the extra paramters
*
* Parameters can be :
* - target target for actions
* - withtemplate template or basic computer
* - value value of global state
* - management_restrict global management restrict mode
**/
static function showGlobalSwitch($ID, $attrs = array())
{
global $CFG_GLPI;
$params['management_restrict'] = 0;
$params['value'] = 0;
$params['name'] = 'is_global';
$params['target'] = '';
foreach ($attrs as $key => $value) {
if ($value != '') {
$params[$key] = $value;
}
}
if ($params['value'] && empty($params['withtemplate'])) {
_e('Global management');
if ($params['management_restrict'] == 2) {
echo " ";
Html::showSimpleForm($params['target'], 'unglobalize', __('Use unitary management'), array('id' => $ID), '', '', array(__('Do you really want to use unitary management for this item?'), __('Duplicate the element as many times as there are connections')));
echo " ";
echo "<img alt=\"" . __s('Duplicate the element as many times as there are connections') . "\" title=\"" . __s('Duplicate the element as many times as there are connections') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/info-small.png' class='pointer'>";
}
} else {
if ($params['management_restrict'] == 2) {
$rand = mt_rand();
$values = array(MANAGEMENT_UNITARY => __('Unit management'), MANAGEMENT_GLOBAL => __('Global management'));
Dropdown::showFromArray($params['name'], $values, array('value' => $params['value']));
} else {
// Templates edition
if (!empty($params['withtemplate'])) {
echo "<input type='hidden' name='is_global' value='" . $params['management_restrict'] . "'>";
echo !$params['management_restrict'] ? __('Unit management') : __('Global management');
} else {
echo !$params['value'] ? __('Unit management') : __('Global management');
}
}
}
}
示例15: title
/**
* Override title function to display the link to reinitialisation of the network tree
**/
function title()
{
parent::title();
if (Session::haveRight('internet', UPDATE) && Session::isViewAllEntities()) {
echo "<div class='spaced' id='tabsbody'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><td class='center'>";
Html::showSimpleForm(IPNetwork::getFormURL(), 'reinit_network', __('Reinit the network topology'));
echo "</td></tr>";
echo "</table>";
echo "</div>";
}
}