本文整理汇总了PHP中Html::jsGetElementbyID方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::jsGetElementbyID方法的具体用法?PHP Html::jsGetElementbyID怎么用?PHP Html::jsGetElementbyID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::jsGetElementbyID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayDatas
/**
* Display datas extracted from DB
*
* @param $data array of search datas prepared to get datas
*
* @return nothing
**/
static function displayDatas(array &$data)
{
global $CFG_GLPI;
$item = null;
if (class_exists($data['itemtype'])) {
$item = new $data['itemtype']();
}
$rand = mt_rand();
if (!isset($data['data']) || !isset($data['data']['totalcount'])) {
return false;
}
// Contruct Pager parameters
$globallinkto = Toolbox::append_params(array('criteria' => Toolbox::stripslashes_deep($data['search']['criteria']), 'metacriteria' => Toolbox::stripslashes_deep($data['search']['metacriteria'])), '&');
$parameters = "sort=" . $data['search']['sort'] . "&order=" . $data['search']['order'] . '&' . $globallinkto;
if (isset($_GET['_in_modal'])) {
$parameters .= "&_in_modal=1";
}
// Global search header
if ($data['display_type'] == self::GLOBAL_SEARCH) {
if ($data['item']) {
echo "<div class='center'><h2>" . $data['item']->getTypeName();
// More items
if ($data['data']['totalcount'] > $data['search']['start'] + self::GLOBAL_DISPLAY_COUNT) {
echo " <a href='" . $data['search']['target'] . "?{$parameters}'>" . __('All') . "</a>";
}
echo "</h2></div>\n";
} else {
return false;
}
}
// If the begin of the view is before the number of items
if ($data['data']['count'] > 0) {
// Display pager only for HTML
if ($data['display_type'] == self::HTML_OUTPUT) {
// For plugin add new parameter if available
if ($plug = isPluginItemType($data['itemtype'])) {
$function = 'plugin_' . $plug['plugin'] . '_addParamFordynamicReport';
if (function_exists($function)) {
$out = $function($data['itemtype']);
if (is_array($out) && count($out)) {
$parameters .= Toolbox::append_params($out, '&');
}
}
}
$search_config_top = "";
$search_config_bottom = "";
if (!isset($_GET['_in_modal']) && Session::haveRightsOr('search_config', array(DisplayPreference::PERSONAL, DisplayPreference::GENERAL))) {
$search_config_top = $search_config_bottom = "<div class='pager_controls'><img alt=\"" . __s('Select default items to show') . "\" title=\"" . __s('Select default items to show') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/options_search.png' ";
$search_config_top .= " class='pointer' onClick=\"";
$search_config_top .= Html::jsGetElementbyID('search_config_top') . ".dialog('open');\">";
$search_config_bottom .= " class='pointer' onClick=\"";
$search_config_bottom .= Html::jsGetElementbyID('search_config_bottom') . ".dialog('open');\">";
$search_config_top .= Ajax::createIframeModalWindow('search_config_top', $CFG_GLPI["root_doc"] . "/front/displaypreference.form.php?itemtype=" . $data['itemtype'], array('title' => __('Select default items to show'), 'reloadonclose' => true, 'display' => false));
$search_config_bottom .= Ajax::createIframeModalWindow('search_config_bottom', $CFG_GLPI["root_doc"] . "/front/displaypreference.form.php?itemtype=" . $data['itemtype'], array('title' => __('Select default items to show'), 'reloadonclose' => true, 'display' => false));
}
if ($item !== null && $item->maybeDeleted()) {
$delete_ctrl = self::isDeletedSwitch($data['search']['is_deleted']);
$search_config_top .= $delete_ctrl;
}
Html::printPager($data['search']['start'], $data['data']['totalcount'], $data['search']['target'], $parameters, $data['itemtype'], 0, $search_config_top);
$search_config_top .= "</div>";
$search_config_bottom .= "</div>";
}
// Define begin and end var for loop
// Search case
$begin_display = $data['data']['begin'];
$end_display = $data['data']['end'];
// Form to massive actions
$isadmin = $data['item'] && $data['item']->canUpdate();
if (!$isadmin && InfoCom::canApplyOn($data['itemtype'])) {
$isadmin = Infocom::canUpdate() || Infocom::canCreate();
}
if ($data['itemtype'] != 'AllAssets') {
$showmassiveactions = count(MassiveAction::getAllMassiveActions($data['item'], $data['search']['is_deleted']));
} else {
$showmassiveactions = true;
}
$massformid = 'massform' . $data['itemtype'];
if ($showmassiveactions && $data['display_type'] == self::HTML_OUTPUT) {
Html::openMassiveActionsForm($massformid);
$massiveactionparams = $data['search']['massiveactionparams'];
$massiveactionparams['num_displayed'] = $end_display - $begin_display;
$massiveactionparams['fixed'] = false;
$massiveactionparams['is_deleted'] = $data['search']['is_deleted'];
$massiveactionparams['container'] = $massformid;
Html::showMassiveActions($massiveactionparams);
}
// Compute number of columns to display
// Add toview elements
$nbcols = count($data['data']['cols']);
if ($data['display_type'] == self::HTML_OUTPUT && $showmassiveactions) {
// HTML display - massive modif
$nbcols++;
//.........这里部分代码省略.........
示例2: updateItemJsCode
/**
* Javascript code for update an item (Javascript code only)
*
* @param $toupdate id of the item to update
* @param $url Url to get datas to update the item
* @param $parameters array of parameters to send to ajax URL
* @param $toobserve id of another item used to get value in case of __VALUE__ used
* or
* array of id to get value in case of __VALUE#__ used (default '')
* @param $display boolean display or get string (default true)
**/
static function updateItemJsCode($toupdate, $url, $parameters = array(), $toobserve = "", $display = true)
{
$out = Html::jsGetElementbyID($toupdate) . ".load('{$url}'\n";
if (count($parameters)) {
$out .= ",{";
$first = true;
foreach ($parameters as $key => $val) {
if ($first) {
$first = false;
} else {
$out .= ",";
}
$out .= $key . ":";
if (!is_array($val) && preg_match('/^__VALUE(\\d+)__$/', $val, $regs)) {
$out .= Html::jsGetElementbyID(Html::cleanId($toobserve[$regs[1]])) . ".val()";
} else {
if (!is_array($val) && $val === "__VALUE__") {
$out .= Html::jsGetElementbyID(Html::cleanId($toobserve)) . ".val()";
} else {
$out .= json_encode($val);
}
}
}
$out .= "}\n";
}
$out .= ")\n";
if ($display) {
echo $out;
} else {
return $out;
}
}
示例3: switch
// Security
if (!TableExists($_POST['table'])) {
exit;
}
switch ($_POST["table"]) {
case "glpi_users":
if ($_POST['value'] == 0) {
$tmpname['link'] = $CFG_GLPI['root_doc'] . "/front/user.php";
$tmpname['comment'] = "";
} else {
$tmpname = getUserName($_POST["value"], 2);
}
echo $tmpname["comment"];
if (isset($_POST['withlink'])) {
echo "<script type='text/javascript' >\n";
echo Html::jsGetElementbyID($_POST['withlink']) . ".attr('href', '" . $tmpname['link'] . "');";
echo "</script>\n";
}
break;
default:
if ($_POST["value"] > 0) {
$tmpname = Dropdown::getDropdownName($_POST["table"], $_POST["value"], 1);
echo $tmpname["comment"];
if (isset($_POST['withlink'])) {
echo "<script type='text/javascript' >\n";
echo Html::jsGetElementbyID($_POST['withlink']) . ".\n attr('href', '" . Toolbox::getItemTypeFormURL(getItemTypeForTable($_POST["table"])) . "?id=" . $_POST["value"] . "');";
echo "</script>\n";
}
}
}
}
示例4: getWidgetContentForItem
function getWidgetContentForItem($widgetId)
{
global $CFG_GLPI, $DB;
if (empty($this->form)) {
$this->init();
}
switch ($widgetId) {
case $this->getType() . "1":
$plugin = new Plugin();
if ($plugin->isActivated("tasklists")) {
$widget = new PluginMydashboardDatatable();
$headers = array(__('Name'), __('Priority'), _n('Context', 'Contexts', 1, 'tasklists'), __('User'), __('Percent done'), __('Due date'), __('Action'));
$query = "SELECT `glpi_plugin_tasklists_tasks`.*,`glpi_plugin_tasklists_tasktypes`.`completename` as 'type' \n FROM `glpi_plugin_tasklists_tasks`\n LEFT JOIN `glpi_plugin_tasklists_tasktypes` ON (`glpi_plugin_tasklists_tasks`.`plugin_tasklists_tasktypes_id` = `glpi_plugin_tasklists_tasktypes`.`id`) \n WHERE NOT `glpi_plugin_tasklists_tasks`.`is_deleted`\n AND `glpi_plugin_tasklists_tasks`.`state` < 2 ";
$query .= getEntitiesRestrictRequest('AND', 'glpi_plugin_tasklists_tasks');
$query .= "ORDER BY `glpi_plugin_tasklists_tasks`.`priority`DESC ";
$tasks = array();
if ($result = $DB->query($query)) {
if ($DB->numrows($result)) {
while ($data = $DB->fetch_array($result)) {
//$groups = Group_User::getGroupUsers($data['groups_id']);
$groupusers = Group_User::getGroupUsers($data['groups_id']);
$groups = array();
foreach ($groupusers as $groupuser) {
$groups[] = $groupuser["id"];
}
if ($data['visibility'] == 1 && $data['users_id'] == Session::getLoginUserID() || $data['visibility'] == 2 && ($data['users_id'] == Session::getLoginUserID() || in_array(Session::getLoginUserID(), $groups)) || $data['visibility'] == 3) {
$ID = $data['id'];
$rand = mt_rand();
$url = Toolbox::getItemTypeFormURL("PluginTasklistsTask") . "?id=" . $data['id'];
$tasks[$data['id']][0] = "<a id='task" . $data["id"] . $rand . "' target='_blank' href='{$url}'>" . $data['name'] . "</a>";
$tasks[$data['id']][0] .= Html::showToolTip($data['comment'], array('applyto' => 'task' . $data["id"] . $rand, 'display' => false));
$bgcolor = $_SESSION["glpipriority_" . $data['priority']];
$tasks[$data['id']][1] = "<div class='center' style='background-color:{$bgcolor};'>" . CommonITILObject::getPriorityName($data['priority']) . "</div>";
$tasks[$data['id']][2] = $data['type'];
$tasks[$data['id']][3] = getUserName($data['users_id']);
$tasks[$data['id']][4] = Dropdown::getValueWithUnit($data['percent_done'], "%");
$due_date = $data['due_date'];
$display = Html::convDate($data['due_date']);
if ($due_date <= date('Y-m-d') && !empty($due_date)) {
$display = "<div class='deleted'>" . Html::convDate($data['due_date']) . "</div>";
}
$tasks[$data['id']][5] = $display;
$tasks[$data['id']][6] = "<div align='center'>";
if (Session::haveRight("plugin_tasklists", UPDATE)) {
$tasks[$data['id']][6] .= "<a class='pointer' onclick=\" submitGetLink('" . $CFG_GLPI['root_doc'] . "/plugins/tasklists/front/task.form.php', {'done': 'done', 'id': '" . $data['id'] . "', '_glpi_csrf_token': '" . Session::getNewCSRFToken() . "', '_glpi_simple_form': '1'});\"><img src='" . $CFG_GLPI['root_doc'] . "/plugins/tasklists/pics/ok.png' title='" . __('Mark as done', 'tasklists') . "'></a>";
}
if (Session::haveRight("plugin_tasklists", UPDATENOTE)) {
$link = " <a href=\"javascript:" . Html::jsGetElementbyID('comment' . $rand) . ".dialog('open');\">";
$link .= "<img class='pointer' src='" . $CFG_GLPI['root_doc'] . "/plugins/tasklists/pics/plus.png' title='" . __('Add comment', 'tasklists') . "'>";
$link .= "</a>";
$link .= Ajax::createIframeModalWindow('comment' . $rand, $CFG_GLPI["root_doc"] . "/plugins/tasklists/front/comment.form.php?id=" . $ID, array('title' => __('Add comment', 'tasklists'), 'reloadonclose' => false, 'width' => 1100, 'display' => false, 'height' => 300));
$tasks[$data['id']][6] .= $link;
}
$tasks[$data['id']][6] .= "</div>";
}
}
}
}
$widget->setTabDatas($tasks);
$widget->setTabNames($headers);
$widget->setOption("bSort", false);
$widget->toggleWidgetRefresh();
$link = "<div align='right'><a class='vsubmit' href=\"javascript:" . Html::jsGetElementbyID('task') . ".dialog('open');\">";
$link .= __('Add task', 'tasklists');
$link .= "</a></div>";
$link .= Ajax::createIframeModalWindow('task', $CFG_GLPI["root_doc"] . "/plugins/tasklists/front/task.form.php", array('title' => __('Add task', 'tasklists'), 'reloadonclose' => false, 'width' => 1180, 'display' => false, 'height' => 600));
$widget->appendWidgetHtmlContent($link);
$widget->setWidgetTitle(__("Tasks list", 'tasklists'));
return $widget;
} else {
$widget = new PluginMydashboardDatatable();
$widget->setWidgetTitle(__("Tasks list", 'tasklists'));
return $widget;
}
break;
}
}
示例5: getDisplayOptionsLink
/**
* Get link for display options
*
* @since version 0.84
* @param $sub_itemtype string sub itemtype if needed for display options
* @return link
**/
static function getDisplayOptionsLink($sub_itemtype = '')
{
global $CFG_GLPI;
$rand = mt_rand();
$link = "<img alt=\"" . __s('Display options') . "\" title=\"";
$link .= __s('Display options') . "\" src='";
$link .= $CFG_GLPI["root_doc"] . "/pics/options_search.png' ";
$link .= " class='pointer' onClick=\"" . Html::jsGetElementbyID("displayoptions" . $rand) . ".dialog('open');\">";
$link .= Ajax::createIframeModalWindow("displayoptions" . $rand, $CFG_GLPI['root_doc'] . "/front/display.options.php?itemtype=" . static::getType() . "&sub_itemtype={$sub_itemtype}", array('display' => false, 'width' => 600, 'height' => 500, 'reloadonclose' => true));
return $link;
}
示例6: dropdownNetpoint
/**
* Print out an HTML "<select>" for a dropdown with preselected value
*
* @param $myname the name of the HTML select
* @param $value the preselected value we want (default 0)
* @param $locations_id default location ID for search (default -1)
* @param $display_comment display the comment near the dropdown (default 1)
* @param $entity_restrict Restrict to a defined entity(default -1)
* @param $devtype (default '')
*
* @return nothing (display the select box)
**/
static function dropdownNetpoint($myname, $value = 0, $locations_id = -1, $display_comment = 1, $entity_restrict = -1, $devtype = '')
{
global $CFG_GLPI;
$rand = mt_rand();
$name = Dropdown::EMPTY_VALUE;
$comment = "";
if (empty($value)) {
$value = 0;
}
if ($value > 0) {
$tmpname = Dropdown::getDropdownName("glpi_netpoints", $value, 1);
if ($tmpname["name"] != " ") {
$name = $tmpname["name"];
$comment = $tmpname["comment"];
}
}
$field_id = Html::cleanId("dropdown_" . $myname . $rand);
$param = array('value' => $value, 'valuename' => $name, 'entity_restrict' => $entity_restrict, 'devtype' => $devtype, 'locations_id' => $locations_id);
echo Html::jsAjaxDropdown($myname, $field_id, $CFG_GLPI['root_doc'] . "/ajax/getDropdownNetpoint.php", $param);
// Display comment
if ($display_comment) {
$comment_id = Html::cleanId("comment_" . $myname . $rand);
Html::showToolTip($comment, array('contentid' => $comment_id));
$item = new self();
if ($item->canCreate()) {
echo "<img alt='' title=\"" . __s('Add') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png' style='cursor:pointer; margin-left:2px;' " . "onClick=\"" . Html::jsGetElementbyID('netpoint' . $rand) . ".dialog('open');\">";
Ajax::createIframeModalWindow('netpoint' . $rand, $item->getFormURL());
}
$paramscomment = array('value' => '__VALUE__', 'table' => "glpi_netpoints");
echo Ajax::updateItemOnSelectEvent($field_id, $comment_id, $CFG_GLPI["root_doc"] . "/ajax/comments.php", $paramscomment, false);
}
return $rand;
}
示例7: displayPasswordSecurityChecks
/**
* Display security checks on password
*
* @param $field string id of the field containing password to check (default 'password')
*
* @since version 0.84
**/
static function displayPasswordSecurityChecks($field = 'password')
{
global $CFG_GLPI;
printf(__('%1$s: %2$s'), __('Password minimum length'), "<span id='password_min_length' class='red'>" . $CFG_GLPI['password_min_length'] . "</span>");
echo "<script type='text/javascript' >\n";
echo "function passwordCheck() {\n";
echo "var pwd = " . Html::jsGetElementbyID($field) . ";";
echo "if (pwd.value.length < " . $CFG_GLPI['password_min_length'] . ") {\n " . Html::jsGetElementByID('password_min_length') . ".addClass('red');\n " . Html::jsGetElementByID('password_min_length') . ".removeClass('green');\n } else {\n " . Html::jsGetElementByID('password_min_length') . ".addClass('green');\n " . Html::jsGetElementByID('password_min_length') . ".removeClass('red');\n }";
$needs = array();
if ($CFG_GLPI["password_need_number"]) {
$needs[] = "<span id='password_need_number' class='red'>" . __('Digit') . "</span>";
echo "var numberRegex = new RegExp('[0-9]', 'g');\n if (false == numberRegex.test(pwd.value)) {\n " . Html::jsGetElementByID('password_need_number') . ".addClass('red');\n " . Html::jsGetElementByID('password_need_number') . ".removeClass('green');\n } else {\n " . Html::jsGetElementByID('password_need_number') . ".addClass('green');\n " . Html::jsGetElementByID('password_need_number') . ".removeClass('red');\n }";
}
if ($CFG_GLPI["password_need_letter"]) {
$needs[] = "<span id='password_need_letter' class='red'>" . __('Lowercase') . "</span>";
echo "var letterRegex = new RegExp('[a-z]', 'g');\n if (false == letterRegex.test(pwd.value)) {\n " . Html::jsGetElementByID('password_need_letter') . ".addClass('red');\n " . Html::jsGetElementByID('password_need_letter') . ".removeClass('green');\n } else {\n " . Html::jsGetElementByID('password_need_letter') . ".addClass('green');\n " . Html::jsGetElementByID('password_need_letter') . ".removeClass('red');\n }";
}
if ($CFG_GLPI["password_need_caps"]) {
$needs[] = "<span id='password_need_caps' class='red'>" . __('Uppercase') . "</span>";
echo "var capsRegex = new RegExp('[A-Z]', 'g');\n if (false == capsRegex.test(pwd.value)) {\n " . Html::jsGetElementByID('password_need_caps') . ".addClass('red');\n " . Html::jsGetElementByID('password_need_caps') . ".removeClass('green');\n } else {\n " . Html::jsGetElementByID('password_need_caps') . ".addClass('green');\n " . Html::jsGetElementByID('password_need_caps') . ".removeClass('red');\n }";
}
if ($CFG_GLPI["password_need_symbol"]) {
$needs[] = "<span id='password_need_symbol' class='red'>" . __('Symbol') . "</span>";
echo "var capsRegex = new RegExp('[^a-zA-Z0-9_]', 'g');\n if (false == capsRegex.test(pwd.value)) {\n " . Html::jsGetElementByID('password_need_symbol') . ".addClass('red');\n " . Html::jsGetElementByID('password_need_symbol') . ".removeClass('green');\n } else {\n " . Html::jsGetElementByID('password_need_symbol') . ".addClass('green');\n " . Html::jsGetElementByID('password_need_symbol') . ".removeClass('red');\n }";
}
echo "}";
echo '</script>';
if (count($needs)) {
echo "<br>";
printf(__('%1$s: %2$s'), __('Password must contains'), implode(', ', $needs));
}
}
示例8: foreach
// Set default field
$options = Search::getCleanedOptions($_POST["itemtype"]);
foreach ($options as $key => $val) {
if (is_array($val)) {
$metacriteria['field'] = $key;
break;
}
}
}
$linked = Search::getMetaItemtypeAvailable($_POST["itemtype"]);
$rand = mt_rand();
$rowid = 'metasearchrow' . $_POST['itemtype'] . $rand;
echo "<tr class='metacriteria' id='{$rowid}'><td class='left' colspan='2'>";
echo "<table class='tab_format'><tr class='left'>";
echo "<td width='30%'>";
echo "<img class='pointer' src=\"" . $CFG_GLPI["root_doc"] . "/pics/meta_moins.png\" alt='-' title=\"" . __s('Delete a global search criterion') . "\" onclick=\"" . Html::jsGetElementbyID($rowid) . ".remove();\">";
echo " ";
// Display link item (not for the first item)
$value = '';
if (isset($metacriteria["link"])) {
$value = $metacriteria["link"];
}
Dropdown::showFromArray("metacriteria[" . $_POST["num"] . "][link]", Search::getLogicalOperators(), array('value' => $value, 'width' => '40%'));
// Display select of the linked item type available
foreach ($linked as $key) {
if (!isset($metanames[$key])) {
if ($linkitem = getItemForItemtype($key)) {
$metanames[$key] = $linkitem->getTypeName();
}
}
}
示例9: showDisplayLink
/**
* Show infocom link to display modal
*
* @param $itemtype integer item type
* @param $device_id integer item ID
*
* @return float
**/
static function showDisplayLink($itemtype, $device_id)
{
global $DB, $CFG_GLPI;
if (!Session::haveRight(self::$rightname, READ) || !($item = getItemForItemtype($itemtype))) {
return false;
}
$query = "SELECT COUNT(*)\n FROM `glpi_infocoms`\n WHERE `items_id` = '{$device_id}'\n AND `itemtype` = '{$itemtype}'";
$add = "add";
$text = __('Add');
$result = $DB->query($query);
if ($DB->result($result, 0, 0) > 0) {
$add = "";
$text = _x('button', 'Show');
} else {
if (!Infocom::canUpdate()) {
return false;
}
}
if ($item->canView()) {
echo "<span onClick=\"" . Html::jsGetElementbyID('infocom' . $itemtype . $device_id) . ".\n dialog('open');\" style='cursor:pointer'>\n <img src=\"" . $CFG_GLPI["root_doc"] . "/pics/dollar{$add}.png\" alt=\"{$text}\" title=\"{$text}\">\n </span>";
Ajax::createIframeModalWindow('infocom' . $itemtype . $device_id, $CFG_GLPI["root_doc"] . "/front/infocom.form.php" . "?itemtype={$itemtype}&items_id={$device_id}", array('height' => 600));
}
}
示例10: showSaveButton
/**
* Display bookmark buttons
*
* @param $type bookmark type to use
* @param $itemtype device type of item where is the bookmark (default 0)
**/
static function showSaveButton($type, $itemtype = 0)
{
global $CFG_GLPI;
echo " <a href='#' onClick=\"" . Html::jsGetElementbyID('bookmarksave') . ".dialog('open');\">";
echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/bookmark_record.png'\n title=\"" . __s('Save as bookmark') . "\" alt=\"" . __s('Save as bookmark') . "\"\n class='calendrier pointer'>";
echo "</a>";
Ajax::createIframeModalWindow('bookmarksave', $CFG_GLPI["root_doc"] . "/front/bookmark.php?type={$type}" . "&action=edit&itemtype={$itemtype}&" . "url=" . rawurlencode($_SERVER["REQUEST_URI"]), array('title' => __('Save as bookmark'), 'reloadonclose' => true));
}
示例11: header
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GLPI is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
* @since version 0.83
*/
// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "planningcheck.php")) {
$AJAX_INCLUDE = 1;
include '../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
Session::checkLoginUser();
if (isset($_POST['users_id']) && $_POST['users_id'] > 0) {
$rand = mt_rand();
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=User&users_id=" . $_POST['users_id'], array('title' => __('Availability')));
}
示例12: show
//.........这里部分代码省略.........
$params['on_change'] = '';
$params['condition'] = '';
$params['rand'] = mt_rand();
$params['displaywith'] = array();
//Parameters about choice 0
//Empty choice's label
$params['emptylabel'] = self::EMPTY_VALUE;
//Display emptychoice ?
$params['display_emptychoice'] = $itemtype != 'Entity';
$params['display'] = true;
$params['permit_select_parent'] = false;
$params['addicon'] = true;
$params['specific_tags'] = array();
$params['url'] = $CFG_GLPI['root_doc'] . "/ajax/getDropdownValue.php";
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
$output = '';
$name = $params['emptylabel'];
$comment = "";
// Check default value for dropdown : need to be a numeric
if (strlen($params['value']) == 0 || !is_numeric($params['value']) && $params['value'] != 'mygroups') {
$params['value'] = 0;
}
if (isset($params['toadd'][$params['value']])) {
$name = $params['toadd'][$params['value']];
} else {
if ($params['value'] > 0 || $itemtype == "Entity" && $params['value'] >= 0) {
$tmpname = self::getDropdownName($table, $params['value'], 1);
if ($tmpname["name"] != " ") {
$name = $tmpname["name"];
$comment = $tmpname["comment"];
}
}
}
// Manage entity_sons
if (!($params['entity'] < 0) && $params['entity_sons']) {
if (is_array($params['entity'])) {
// translation not needed - only for debug
$output .= "entity_sons options is not available with entity option as array";
} else {
$params['entity'] = getSonsOf('glpi_entities', $params['entity']);
}
}
$field_id = Html::cleanId("dropdown_" . $params['name'] . $params['rand']);
// Manage condition
if (!empty($params['condition'])) {
$params['condition'] = static::addNewCondition($params['condition']);
}
if (!$item instanceof CommonTreeDropdown) {
$name = Toolbox::unclean_cross_side_scripting_deep($name);
}
$p = array('value' => $params['value'], 'valuename' => $name, 'width' => $params['width'], 'itemtype' => $itemtype, 'display_emptychoice' => $params['display_emptychoice'], 'displaywith' => $params['displaywith'], 'emptylabel' => $params['emptylabel'], 'condition' => $params['condition'], 'used' => $params['used'], 'toadd' => $params['toadd'], 'entity_restrict' => is_array($params['entity']) ? json_encode(array_values($params['entity'])) : $params['entity'], 'on_change' => $params['on_change'], 'permit_select_parent' => $params['permit_select_parent'], 'specific_tags' => $params['specific_tags']);
$output = "<span class='no-wrap'>";
$output .= Html::jsAjaxDropdown($params['name'], $field_id, $params['url'], $p);
// Display comment
if ($params['comments']) {
$comment_id = Html::cleanId("comment_" . $params['name'] . $params['rand']);
$link_id = Html::cleanId("comment_link_" . $params['name'] . $params['rand']);
$options_tooltip = array('contentid' => $comment_id, 'linkid' => $link_id, 'display' => false);
if ($item->canView()) {
if ($params['value'] && $item->getFromDB($params['value']) && $item->canViewItem()) {
$options_tooltip['link'] = $item->getLinkURL();
} else {
$options_tooltip['link'] = $item->getSearchURL();
}
$options_tooltip['linktarget'] = '_blank';
}
$output .= " " . Html::showToolTip($comment, $options_tooltip);
if ($item instanceof CommonDropdown && $item->canCreate() && !isset($_REQUEST['_in_modal']) && $params['addicon']) {
$output .= "<img alt='' title=\"" . __s('Add') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png' style='cursor:pointer; margin-left:2px;'\n onClick=\"" . Html::jsGetElementbyID('add_dropdown' . $params['rand']) . ".dialog('open');\">";
$output .= Ajax::createIframeModalWindow('add_dropdown' . $params['rand'], $item->getFormURL(), array('display' => false));
}
// Display specific Links
if ($itemtype == "Supplier") {
if ($item->getFromDB($params['value'])) {
$output .= $item->getLinks();
}
}
if ($itemtype == 'ITILCategory' && Session::haveRight('knowbase', READ)) {
if ($params['value'] && $item->getFromDB($params['value'])) {
$output .= ' ' . $item->getLinks();
}
}
$paramscomment = array('value' => '__VALUE__', 'table' => $table);
if ($item->canView()) {
$paramscomment['withlink'] = $link_id;
}
$output .= Ajax::updateItemOnSelectEvent($field_id, $comment_id, $CFG_GLPI["root_doc"] . "/ajax/comments.php", $paramscomment, false);
}
$output .= Ajax::commonDropdownUpdateItem($params, false);
if ($params['display']) {
echo $output;
return $params['rand'];
}
$output .= "</span>";
return $output;
}
示例13: showListRules
//.........这里部分代码省略.........
$rule->dropdownConditions(array('value' => $p['condition'], 'on_change' => 'reloadTab("start=0&inherited=' . $p['inherited'] . '&childrens=' . $p['childrens'] . '&condition="+this.value)'));
echo "</td></tr></table>";
}
$nb = $this->getCollectionSize($p['inherited'], $p['condition']);
$p['start'] = isset($options["start"]) ? $options["start"] : 0;
if ($p['start'] >= $nb) {
$p['start'] = 0;
}
$p['limit'] = $_SESSION['glpilist_limit'];
$this->getCollectionPart($p);
Html::printAjaxPager('', $p['start'], $nb);
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
echo "\n<div class='spaced'>";
if ($canedit && $nb) {
$massiveactionparams = array('num_displayed' => min($p['limit'], $nb), 'container' => 'mass' . __CLASS__ . $rand, 'extraparams' => array('entity' => $this->entity, 'condition' => $p['condition'], 'rule_class_name' => $this->getRuleClassName()));
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov table-striped table-hover'>";
$colspan = 6;
if ($display_entities) {
$colspan++;
}
if ($use_conditions) {
$colspan++;
}
echo "<tr><th colspan='{$colspan}'>" . $this->getTitle() . "</th></tr>\n";
echo "<tr>";
echo "<th>";
if ($canedit) {
Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
}
echo "</th>";
echo "<th>" . __('Name') . "</th>";
echo "<th>" . __('Description') . "</th>";
if ($use_conditions) {
echo "<th>" . __('Use rule for') . "</th>";
}
echo "<th>" . __('Active') . "</th>";
if ($display_entities) {
echo "<th>" . __('Entity') . "</th>\n";
}
if (!$display_entities) {
echo "<th colspan='2'> </th>";
}
echo "</tr>\n";
if (count($this->RuleList->list)) {
$ruletype = $this->RuleList->list[0]->getType();
Session::initNavigateListItems($ruletype);
}
for ($i = $p['start'], $j = 0; isset($this->RuleList->list[$j]); $i++, $j++) {
$this->RuleList->list[$j]->showMinimalForm($target, $i == 0, $i == $nb - 1, $display_entities, $p['condition']);
Session::addToNavigateListItems($ruletype, $this->RuleList->list[$j]->fields['id']);
}
if ($nb) {
echo "<tr>";
echo "<th>";
if ($canedit) {
Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand);
}
echo "</th>";
echo "<th>" . __('Name') . "</th>";
echo "<th>" . __('Description') . "</th>";
if ($use_conditions) {
echo "<th>" . __('Use rule for') . "</th>";
}
echo "<th>" . __('Active') . "</th>";
if ($display_entities) {
echo "<th>" . __('Entity') . "</th>\n";
}
if (!$display_entities) {
echo "<th colspan='2'> </th>";
}
echo "</tr>\n";
}
echo "</table>\n";
if ($canedit && $nb) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
}
echo "</div>";
Html::closeForm();
Html::printAjaxPager('', $p['start'], $nb);
echo "<div class='spaced center'>";
if ($plugin = isPluginItemType($this->getType())) {
$url = $CFG_GLPI["root_doc"] . "/plugins/" . strtolower($plugin['plugin']);
} else {
$url = $CFG_GLPI["root_doc"];
}
echo "<a class='vsubmit' href='#' onClick=\"" . Html::jsGetElementbyID('allruletest' . $rand) . ".dialog('open');\">" . __('Test rules engine') . "</a>";
Ajax::createIframeModalWindow('allruletest' . $rand, $url . "/front/rulesengine.test.php?" . "sub_type=" . $this->getRuleClassName() . "&condition=" . $p['condition'], array('title' => __('Test rules engine')));
echo "</div>";
if ($this->can_replay_rules) {
echo "<div class='spaced center'>";
echo "<a class='vsubmit' href='" . $rule->getSearchURL() . "?replay_rule=replay_rule'>" . __s('Replay the dictionary rules') . "</a>";
echo "</div>";
}
echo "<div class='spaced'>";
$this->showAdditionalInformationsInForm($target);
echo "</div>";
}
示例14: displayItemLogID
/**
* @param $type
* @param $items_id
**/
static function displayItemLogID($type, $items_id)
{
global $CFG_GLPI;
if ($items_id == "-1" || $items_id == "0") {
echo " ";
//$item;
} else {
switch ($type) {
case "rules":
echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/rule.generic.form.php?id=" . $items_id . "\">" . $items_id . "</a>";
break;
case "infocom":
$rand = mt_rand();
echo " <a href='#' onClick=\"" . Html::jsGetElementbyID('infocom' . $rand) . ".\n dialog('open');\">{$items_id}</a>";
Ajax::createIframeModalWindow('infocom' . $rand, $CFG_GLPI["root_doc"] . "/front/infocom.form.php" . "?id=" . $items_id, array('height' => 600));
case "devices":
echo $items_id;
break;
case "reservationitem":
echo "<a href=\"" . $CFG_GLPI["root_doc"] . "/front/reservation.php?reservationitems_id=" . $items_id . "\">" . $items_id . "</a>";
break;
default:
$type = getSingular($type);
$url = '';
if ($item = getItemForItemtype($type)) {
$url = $item->getFormURL();
}
if (!empty($url)) {
echo "<a href=\"" . $url . "?id=" . $items_id . "\">" . $items_id . "</a>";
} else {
echo $items_id;
}
break;
}
}
}
示例15: showForm
function showForm($ID, $options)
{
global $DB, $CFG_GLPI;
if (!Config::canUpdate()) {
return false;
}
$notificationtemplates_id = -1;
if (isset($options['notificationtemplates_id'])) {
$notificationtemplates_id = $options['notificationtemplates_id'];
}
if ($this->getFromDB($ID)) {
$notificationtemplates_id = $this->getField('notificationtemplates_id');
}
$this->initForm($ID, $options);
$template = new NotificationTemplate();
$template->getFromDB($notificationtemplates_id);
Html::initEditorSystem('content_html');
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . NotificationTemplate::getTypeName() . "</td>";
echo "<td colspan='2'><a href='" . Toolbox::getItemTypeFormURL('NotificationTemplate') . "?id=" . $notificationtemplates_id . "'>" . $template->getField('name') . "</a>";
echo "</td><td>";
$rand = mt_rand();
Ajax::createIframeModalWindow("tags" . $rand, $CFG_GLPI['root_doc'] . "/front/notification.tags.php?sub_type=" . $template->getField('itemtype'));
echo "<a class='vsubmit' href='#' onClick=\"" . Html::jsGetElementbyID("tags" . $rand) . ".dialog('open');\">" . __('Show list of available tags') . "</a>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Language') . "</td><td colspan='3'>";
//Get all used languages
$used = self::getAllUsedLanguages($notificationtemplates_id);
if ($ID > 0) {
if (isset($used[$this->getField('language')])) {
unset($used[$this->getField('language')]);
}
}
Dropdown::showLanguages("language", array('display_emptychoice' => true, 'value' => $this->fields['language'], 'used' => $used));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>" . __('Subject') . "</td>";
echo "<td colspan='3'>";
Html::autocompletionTextField($this, 'subject', array('size' => 100));
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td>";
_e('Email text body');
echo "<br>" . __('(leave the field empty for a generation from HTML)');
echo "</td><td colspan='3'>";
echo "<textarea cols='100' rows='15' name='content_text' >" . $this->fields["content_text"];
echo "</textarea></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>";
_e('Email HTML body');
echo "</td><td colspan='3'>";
echo "<textarea cols='100' rows='15' name='content_html'>" . $this->fields["content_html"];
echo "</textarea>";
echo "<input type='hidden' name='notificationtemplates_id' value='" . $template->getField('id') . "'>";
echo "</td></tr>";
$this->showFormButtons($options);
return true;
}