本文整理汇总了PHP中Plugin::doHook方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::doHook方法的具体用法?PHP Plugin::doHook怎么用?PHP Plugin::doHook使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::doHook方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForm
//.........这里部分代码省略.........
Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<td>" . __('Network') . "</td>";
echo "<td>";
Network::dropdown(array('value' => $this->fields["networks_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . "</td>";
echo "<td>";
Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
echo "</td>";
// Display auto inventory informations
$rowspan = 7;
$inventory_show = false;
if (!empty($ID) && Plugin::haveImport() && $this->fields["is_dynamic"]) {
$inventory_show = true;
$rowspan -= 5;
}
echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
echo "<td rowspan='{$rowspan}' class='middle'>";
echo "<textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
echo "</textarea></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Domain') . "</td>";
echo "<td >";
Domain::dropdown(array('value' => $this->fields["domains_id"], 'entity' => $this->fields["entities_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Operating system') . "</td>";
echo "<td>";
OperatingSystem::dropdown(array('value' => $this->fields["operatingsystems_id"]));
echo "<br /><a href='#' id='toggle_os_information'>" . __("More information") . "</a>";
echo "</td>";
if ($inventory_show) {
echo "<td rowspan='4' colspan='2'>";
Plugin::doHook("autoinventory_information", $this);
echo "</td>";
}
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Version of the operating system') . "</td>";
echo "<td >";
OperatingSystemVersion::dropdown(array('value' => $this->fields["operatingsystemversions_id"]));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'><td colspan='2'>";
echo Html::scriptBlock("\n \$(document).ready(function(){\n \$('#os_information').hide();\n\n \$('#toggle_os_information').on('click',function() {\n \$('#os_information').dialog({\n width:'auto',\n resizable: false,\n appendTo: '#os_information_parent',\n position: {\n my : 'left top',\n at : 'left bottom',\n of: \$('#toggle_os_information')\n }\n })\n })\n });");
// group os advanced information in a single bloc (who can be toggled)
echo "<div id='os_information_parent'>";
echo "<div id='os_information' title=\"" . __('Operating system') . "\">";
echo "<table>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Service pack') . "</td>";
echo "<td >";
OperatingSystemServicePack::dropdown(array('value' => $this->fields["operatingsystemservicepacks_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Operating system architecture') . "</td>";
echo "<td >";
OperatingSystemArchitecture::dropdown(array('value' => $this->fields["operatingsystemarchitectures_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Kernel version of the operating system') . "</td>";
echo "<td >";
Html::autocompletionTextField($this, 'os_kernel_version');
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Product ID of the operating system') . "</td>";
echo "<td >";
Html::autocompletionTextField($this, 'os_licenseid');
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Serial of the operating system') . "</td>";
echo "<td >";
Html::autocompletionTextField($this, 'os_license_number');
echo "</td>";
echo "</table>";
echo "</div>";
echo "</div>";
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('UUID') . "</td>";
echo "<td >";
Html::autocompletionTextField($this, 'uuid');
echo "</td>";
echo "</tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Update Source') . "</td>";
echo "<td >";
AutoUpdateSystem::dropdown(array('value' => $this->fields["autoupdatesystems_id"]));
echo "</td></tr>";
$this->showFormButtons($options);
return true;
}
示例2: showTimeline
/**
* @since version 0.90
*
* @param $rand
**/
function showTimeline($rand)
{
global $CFG_GLPI, $DB, $autolink_options;
//get ticket actors
$ticket_users_keys = $this->getTicketActors();
$user = new User();
$group = new Group();
$followup_obj = new TicketFollowup();
$pics_url = $CFG_GLPI['root_doc'] . "/pics/timeline";
$timeline = $this->getTimelineItems();
$autolink_options['strip_protocols'] = false;
//display timeline
echo "<div class='timeline_history'>";
$tmp = array_values($timeline);
$first_item = array_shift($tmp);
// show approbation form on top when ticket is solved
if ($this->fields["status"] == CommonITILObject::SOLVED) {
echo "<div class='approbation_form' id='approbation_form{$rand}'>";
$followup_obj->showApprobationForm($this);
echo "</div>";
}
// show title for timeline
self::showTimelineHeader();
$timeline_index = 0;
foreach ($timeline as $item) {
$options = array('parent' => $this, 'rand' => $rand);
if ($obj = getItemForItemtype($item['type'])) {
$obj->fields = $item['item'];
} else {
$obj = $item;
}
Plugin::doHook('pre_show_item', array('item' => &$obj, 'options' => &$options));
if (is_array($obj)) {
$item_i = $obj['item'];
} else {
$item_i = $obj->fields;
}
$date = "";
if (isset($item_i['date'])) {
$date = $item_i['date'];
}
if (isset($item_i['date_mod'])) {
$date = $item_i['date_mod'];
}
// check if curent item user is assignee or requester
$user_position = 'left';
if (isset($ticket_users_keys[$item_i['users_id']]) && $ticket_users_keys[$item_i['users_id']] == CommonItilActor::ASSIGN || $item['type'] == 'Assign') {
$user_position = 'right';
}
//display solution in middle
if ($timeline_index == 0 && $item['type'] == "Solution" && $this->fields["status"] == CommonITILObject::SOLVED) {
$user_position .= ' middle';
}
echo "<div class='h_item {$user_position}'>";
echo "<div class='h_info'>";
echo "<div class='h_date'>" . Html::convDateTime($date) . "</div>";
if ($item_i['users_id'] !== false) {
echo "<div class='h_user'>";
if (isset($item_i['users_id']) && $item_i['users_id'] != 0) {
$user->getFromDB($item_i['users_id']);
echo "<div class='tooltip_picture_border'>";
echo "<img class='user_picture' alt=\"" . __s('Picture') . "\" src='" . User::getThumbnailURLForPicture($user->fields['picture']) . "'>";
echo "</div>";
echo "<span class='h_user_name'>";
$userdata = getUserName($item_i['users_id'], 2);
echo $user->getLink() . " ";
echo Html::showToolTip($userdata["comment"], array('link' => $userdata['link']));
echo "</span>";
} else {
_e("Requester");
}
echo "</div>";
// h_user
}
echo "</div>";
//h_date
echo "<div class='h_content " . $item['type'] . (isset($item_i['status']) ? " " . $item_i['status'] : "") . "'" . "id='viewitem" . $item['type'] . $item_i['id'] . $rand . "'>";
if (isset($item_i['can_edit']) && $item_i['can_edit']) {
echo "<div class='edit_item_content'></div>";
echo "<span class='cancel_edit_item_content'></span>";
}
echo "<div class='displayed_content'>";
if (!in_array($item['type'], array('Document_Item', 'Assign')) && $item_i['can_edit']) {
echo "<span class='edit_item' ";
echo "onclick='javascript:viewEditSubitem" . $this->fields['id'] . "{$rand}(event, \"" . $item['type'] . "\", " . $item_i['id'] . ", this, \"viewitem" . $item['type'] . $item_i['id'] . $rand . "\")'";
echo "></span>";
}
if (isset($item_i['requesttypes_id']) && file_exists("{$pics_url}/" . $item_i['requesttypes_id'] . ".png")) {
echo "<img src='{$pics_url}/" . $item_i['requesttypes_id'] . ".png' title='' class='h_requesttype' />";
}
if (isset($item_i['content'])) {
$content = $item_i['content'];
$content = autolink($content, 40);
//$content = nl2br($content);
$long_text = "";
//.........这里部分代码省略.........
示例3: showForm
/**
* Print the version form
*
* @param $ID integer ID of the item
* @param $options array
* - target for the Form
* - computers_id ID of the computer for add process
*
* @return true if displayed false if item not found or not right to display
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
if (!Session::haveRight("computer", "w")) {
return false;
}
$comp = new Computer();
if ($ID > 0) {
$this->check($ID, 'r');
$comp->getFromDB($this->fields['computers_id']);
} else {
// Create item
$this->check(-1, 'w', $options);
$comp->getFromDB($options['computers_id']);
}
$this->showTabs($options);
$this->showFormHeader($options);
if ($this->isNewID($ID)) {
echo "<input type='hidden' name='computers_id' value='" . $options['computers_id'] . "'>";
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Computer') . "</td>";
echo "<td>" . $comp->getLink() . "</td>";
if (Plugin::haveImport()) {
echo "<td>" . __('Automatic inventory') . "</td>";
echo "<td>";
if ($ID && $this->fields['is_dynamic']) {
Plugin::doHook("autoinventory_information", $this);
} else {
_e('No');
}
echo "</td>";
} else {
echo "<td colspan='2'></td>";
}
echo "</tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "name");
echo "</td><td>" . __('Virtualization system') . "</td>";
echo "<td>";
VirtualMachineType::dropdown(array('value' => $this->fields['virtualmachinetypes_id']));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Virtualization model') . "</td>";
echo "<td>";
VirtualMachineSystem::dropdown(array('value' => $this->fields['virtualmachinesystems_id']));
echo "</td><td>" . __('State of the virtual machine') . "</td>";
echo "<td>";
VirtualMachineState::dropdown(array('value' => $this->fields['virtualmachinestates_id']));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('UUID') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "uuid");
echo "</td>";
echo "<td>" . _x('quantity', 'Processors number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "vcpu");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . sprintf(__('%1$s (%2$s)'), __('Memory'), __('Mio')) . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "ram");
echo "</td>";
echo "<td>" . __('Machine') . "</td>";
echo "<td>";
if ($link_computer = self::findVirtualMachine($this->fields)) {
$computer = new Computer();
if ($computer->getFromDB($link_computer)) {
echo $computer->getLink(array('comments' => true));
} else {
echo NOT_AVAILABLE;
}
}
echo "</td>";
echo "</tr>";
$this->showFormButtons($options);
$this->addDivForTabs();
return true;
}
示例4: array
// PLugin already included
$PLUGINS_INCLUDED = 1;
$LOADED_PLUGINS = array();
$plugin = new Plugin();
if (!isset($_SESSION["glpi_plugins"])) {
$plugin->init();
}
if (isset($_SESSION["glpi_plugins"]) && is_array($_SESSION["glpi_plugins"])) {
//Plugin::doHook("config");
if (count($_SESSION["glpi_plugins"])) {
foreach ($_SESSION["glpi_plugins"] as $name) {
Plugin::load($name);
}
}
// For plugins which require action after all plugin init
Plugin::doHook("post_init");
}
}
if (!isset($_SESSION["MESSAGE_AFTER_REDIRECT"])) {
$_SESSION["MESSAGE_AFTER_REDIRECT"] = "";
}
// Manage force tab
if (isset($_REQUEST['forcetab'])) {
if (preg_match('/([a-zA-Z]+).form.php/', $_SERVER['PHP_SELF'], $matches)) {
$itemtype = $matches[1];
Session::setActiveTab($matches[1], $_REQUEST['forcetab']);
}
}
// Manage tabs
if (isset($_REQUEST['glpi_tab']) && isset($_REQUEST['itemtype'])) {
Session::setActiveTab($_REQUEST['itemtype'], $_REQUEST['glpi_tab']);
示例5: uninstall
static function uninstall($type, $model_id, $tab_ids, $location)
{
global $UNINSTALL_DIRECT_CONNECTIONS_TYPE;
//Get the model
$model = new PluginUninstallModel();
$model->getConfig($model_id);
//Then destroy all the connexions
$transfer = new Transfer();
$transfer->getFromDB($model->fields["transfers_id"]);
echo "<div class='center'>";
echo "<table class='tab_cadre_fixe'><tr><th>" . __('Uninstall', 'uninstall') . "</th></tr>";
echo "<tr class='tab_bg_2'><td>";
$count = 0;
$tot = count($tab_ids[$type]);
Html::createProgressBar(__('Please wait, uninstallation is running...', 'uninstall'));
foreach ($tab_ids[$type] as $id => $value) {
$count++;
$item = new $type();
$item->getFromDB($id);
//First clean object and change location and status if needed
$entity = $item->fields["entities_id"];
$input = array();
$input["id"] = $id;
$input["entities_id"] = $entity;
$fields = array();
//Hook to perform actions before item is being uninstalled
$item->fields['_uninstall_event'] = $model->getID();
$item->fields['_action'] = 'uninstall';
Plugin::doHook("plugin_uninstall_before", $item);
//--------------------//
//Direct connections //
//------------------//
if (in_array($type, $UNINSTALL_DIRECT_CONNECTIONS_TYPE)) {
$conn = new Computer_Item();
$conn->deleteByCriteria(array('computers_id' => $id), true);
}
//--------------------//
//-- Common fields --//
//------------------//
//RAZ contact and contactnumber
if ($item->isField('contact') && $model->fields["raz_contact"] == 1) {
$fields["contact"] = '';
if ($item->isField('contact_num')) {
$fields["contact_num"] = '';
}
}
//RAZ user
if ($model->fields["raz_user"] == 1 && $item->isField('users_id')) {
$fields["users_id"] = 0;
}
//RAZ status
if ($model->fields["states_id"] > 0 && $item->isField('states_id')) {
$fields["states_id"] = $model->fields["states_id"];
}
//RAZ machine's name
if ($item->isField('name') && $model->fields["raz_name"] == 1) {
$fields["name"] = '';
}
if ($item->isField('locations_id')) {
if ($location == '') {
$location = 0;
}
switch ($location) {
case -1:
break;
default:
$fields["locations_id"] = $location;
break;
}
}
if ($item->isField('groups_id')) {
$nbgroup = countElementsInTableForEntity("glpi_groups", $entity, "`id`='" . $item->fields['groups_id'] . "'");
if ($model->fields["groups_id"] > -1 && $nbgroup == 1) {
// If a new group is defined and if the group is accessible in the object's entity
$fields["groups_id"] = $model->fields["groups_id"];
}
}
//------------------------------//
//-- Computer specific fields --//
//------------------------------//
if ($type == 'Computer') {
//RAZ all OS related informations
if ($model->fields["raz_os"] == 1) {
$fields["operatingsystems_id"] = 0;
$fields["operatingsystemversions_id"] = 0;
$fields["operatingsystemservicepacks_id"] = 0;
$fields["os_licenseid"] = '';
$fields["os_license_number"] = '';
$fields["autoupdatesystems_id"] = 0;
}
$plug = new Plugin();
if ($plug->isActivated('ocsinventoryng')) {
if ($item->fields["is_dynamic"] && ($model->fields["remove_from_ocs"] || $model->fields["delete_ocs_link"])) {
$input["is_dynamic"] = 0;
}
}
if ($item->isField('domains_id') && $model->fields["raz_domain"]) {
$fields["domains_id"] = 0;
}
//RAZ network
//.........这里部分代码省略.........
示例6: replace
/**
* @param $type
* @param $model_id
* @param $tab_ids
* @param $location
**/
static function replace($type, $model_id, $tab_ids, $location)
{
global $DB, $CFG_GLPI, $PLUGIN_HOOKS;
$model = new PluginUninstallModel();
$model->getConfig($model_id);
$overwrite = $model->fields["overwrite"];
echo "<div class='center'>";
echo "<table class='tab_cadre_fixe'><tr><th>" . __('Replacement', 'uninstall') . "</th></tr>";
echo "<tr class='tab_bg_2'><td>";
$count = 0;
$tot = count($tab_ids);
Html::createProgressBar(__('Please wait, replacement is running...', 'uninstall'));
foreach ($tab_ids as $olditem_id => $newitem_id) {
$count++;
$olditem = new $type();
$olditem->getFromDB($olditem_id);
$newitem = new $type();
$newitem->getFromDB($newitem_id);
//Hook to perform actions before item is being replaced
$olditem->fields['_newid'] = $newitem_id;
$olditem->fields['_uninstall_event'] = $model_id;
$olditem->fields['_action'] = 'replace';
Plugin::doHook("plugin_uninstall_replace_before", $olditem);
// Retrieve informations
//States
if ($model->fields['states_id'] != 0) {
$olditem->update(array('id' => $olditem_id, 'states_id' => $model->fields['states_id']), false);
}
// METHOD REPLACEMENT 1 : Archive
if ($model->fields['replace_method'] == self::METHOD_PURGE) {
$name_out = str_shuffle(Toolbox::getRandomString(5) . time());
$plugin = new Plugin();
if ($plugin->isActivated('PDF')) {
// USE PDF EXPORT
$plugin->load('pdf', true);
include_once GLPI_ROOT . "/lib/ezpdf/class.ezpdf.php";
//Get all item's tabs
$tab = array_keys($olditem->defineTabs());
//Tell PDF to also export item's main tab, and in first position
array_unshift($tab, "_main_");
$itempdf = new $PLUGIN_HOOKS['plugin_pdf'][$type]($olditem);
$out = $itempdf->generatePDF(array($olditem_id), $tab, 1, false);
$name_out .= ".pdf";
} else {
//TODO Which datas ? Add Defaults...
$out = __('Replacement', 'uninstall') . "\r\n";
$datas = $olditem->fields;
unset($datas['comment']);
foreach ($datas as $k => $v) {
$out .= $k . ";";
}
$out .= "\r\n";
foreach ($datas as $k => $v) {
$out .= $v . ";";
}
// USE CSV EXPORT
$name_out .= ".csv";
}
// Write document
$out_file = GLPI_DOC_DIR . "/_uploads/" . $name_out;
$open_file = fopen($out_file, 'a');
fwrite($open_file, $out);
fclose($open_file);
// Compute comment text
$comment = __('This document is the archive of this replaced item', 'uninstall') . " " . self::getCommentsForReplacement($olditem, false, false);
// Create & Attach new document to current item
$doc = new Document();
$input = array('name' => addslashes(__('Archive of old material', 'uninstall')), 'upload_file' => $name_out, 'comment' => addslashes($comment), 'add' => __('Add'), 'entities_id' => $newitem->getEntityID(), 'is_recursive' => $newitem->isRecursive(), 'link' => "", 'documentcategories_id' => 0, 'items_id' => $olditem_id, 'itemtype' => $type);
//Attached the document to the old item, to generate an accurate name
$document_added = $doc->add($input);
//Attach the document to the new item, once the document's name is correct
$docItem = new Document_Item();
$docItemId = $docItem->add(array('documents_id' => $document_added, 'itemtype' => $type, 'items_id' => (int) $newitem_id));
}
// General Informations - NAME
if ($model->fields["replace_name"]) {
if ($overwrite || empty($newitem->fields['name'])) {
$newitem->update(array('id' => $newitem_id, 'name' => $olditem->getField('name')), false);
}
}
$data['id'] = $newitem->getID();
// General Informations - SERIAL
if ($model->fields["replace_serial"]) {
if ($overwrite || empty($newitem->fields['serial'])) {
$newitem->update(array('id' => $newitem_id, 'serial' => $olditem->getField('serial')), false);
}
}
// General Informations - OTHERSERIAL
if ($model->fields["replace_otherserial"]) {
if ($overwrite || empty($newitem->fields['otherserial'])) {
$newitem->update(array('id' => $newitem_id, 'otherserial' => $olditem->getField('otherserial')), false);
}
}
// Documents
//.........这里部分代码省略.........
示例7: MailCollector
$mailcol = new MailCollector();
foreach ($mailcollectors as $mc) {
echo " " . $mc['name'];
if ($mailcol->getFromDB($mc['id'])) {
$mailcol->connect();
if ($mailcol->marubox) {
echo "_OK";
} else {
echo "_PROBLEM";
$ok = false;
}
echo "\n";
$mailcol->close_mailbox();
}
}
} else {
echo "No mail collector\n";
}
// hook for plugin
$param = array('ok' => $ok);
Plugin::doHook("status", $param);
if (isset($param['ok'])) {
$ok = $param['ok'];
}
}
echo "\n";
if ($ok) {
echo "GLPI_OK\n";
} else {
echo "GLPI_PROBLEM\n";
}
示例8: restore
/**
* Restore an item put in the dustbin in the database.
*
* @param $input array the _POST vars returned by the item form when press restore
* @param $history boolean do history log ? (default 1)
*
* @return boolean : true on success
**/
function restore(array $input, $history = 1)
{
if (!$this->getFromDB($input[static::getIndexName()])) {
return false;
}
if (isset($input['restore'])) {
$input['_restore'] = $input['restore'];
unset($input['restore']);
}
// Store input in the object to be available in all sub-method / hook
$this->input = $input;
Plugin::doHook("pre_item_restore", $this);
if ($this->restoreInDB()) {
$this->addMessageOnRestoreAction();
if ($this->dohistory && $history) {
$changes[0] = 0;
$changes[1] = $changes[2] = "";
$logaction = Log::HISTORY_RESTORE_ITEM;
if ($this->useDeletedToLockIfDynamic() && $this->isDynamic()) {
$logaction = Log::HISTORY_UNLOCK_ITEM;
}
Log::history($this->input["id"], $this->getType(), $changes, 0, $logaction);
}
$this->post_restoreItem();
Plugin::doHook("item_restore", $this);
if ($this->mailqueueonaction) {
QueuedMail::forceSendFor($this->getType(), $this->fields['id']);
}
return true;
}
return false;
}
示例9: showForm
//.........这里部分代码省略.........
$withtemplate = $this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
//TRANS: %1$s is a string, %2$s a second one without spaces between them : to change for RTL
echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "");
echo "</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "name", array('value' => $objectName));
echo "</td>\n";
echo "<td>" . __('Status') . "</td>\n";
echo "<td>";
State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_peripheral`"));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Location') . "</td>\n";
echo "<td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>\n";
echo "<td>" . __('Type') . "</td>\n";
echo "<td>";
PeripheralType::dropdown(array('value' => $this->fields["peripheraltypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . "</td>\n";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Manufacturer') . "</td>\n";
echo "<td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Model') . "</td>\n";
echo "<td>";
PeripheralModel::dropdown(array('value' => $this->fields["peripheralmodels_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username number') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "contact_num");
echo "</td>";
echo "<td>" . __('Serial number') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "serial");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "contact");
echo "</td>\n";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>\n";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "otherserial", array('value' => $objectName));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>\n";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>\n";
echo "<td>" . __('Management type') . "</td>\n";
echo "<td>";
Dropdown::showGlobalSwitch($this->fields["id"], array('withtemplate' => $withtemplate, 'value' => $this->fields["is_global"], 'management_restrict' => $CFG_GLPI["peripherals_management_restrict"], 'target' => $target));
echo "</td></tr>\n";
// Display auto inventory informations
$rowspan = 2;
$inventory_show = false;
if (!empty($ID) && $this->fields["is_dynamic"]) {
$inventory_show = true;
$rowspan -= 1;
}
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . "</td>\n";
echo "<td>";
Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
echo "</td>\n";
echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>\n";
echo "<td rowspan='{$rowspan}'>\n <textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
echo "</textarea></td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Brand') . "</td>\n";
echo "<td>";
Html::autocompletionTextField($this, "brand");
echo "</td></tr>\n";
if ($inventory_show) {
echo "<tr class='tab_bg_1'>";
echo "<td rowspan='1'>" . __('Automatic inventory') . "</td>";
echo "<td rowspan='1'>";
Plugin::doHook("autoinventory_information", $this);
echo "</td>";
echo "</tr>\n";
}
$this->showFormButtons($options);
return true;
}
示例10: showMyView
/**
* Show the central personal view
**/
static function showMyView()
{
global $DB, $CFG_GLPI;
$showticket = Session::haveRightsOr("ticket", array(Ticket::READMY, Ticket::READALL, Ticket::READASSIGN));
$showproblem = Session::haveRightsOr('problem', array(Problem::READALL, Problem::READMY));
echo "<table class='tab_cadre_central'>";
Plugin::doHook('display_central');
if (Session::haveRight("config", UPDATE)) {
$logins = User::checkDefaultPasswords();
$user = new User();
if (!empty($logins)) {
$accouts = array();
foreach ($logins as $login) {
$user->getFromDBbyName($login);
$accounts[] = $user->getLink();
}
$message = sprintf(__('For security reasons, please change the password for the default users: %s'), implode(" ", $accounts));
echo "<tr><th colspan='2'>";
Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", $message, $message);
echo "</th></tr>";
}
if (file_exists(GLPI_ROOT . "/install/install.php")) {
echo "<tr><th colspan='2'>";
$message = sprintf(__('For security reasons, please remove file: %s'), "install/install.php");
Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", $message, $message);
echo "</th></tr>";
}
}
if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
if (!DBMysql::isMySQLStrictMode()) {
echo "<tr><th colspan='2'>";
$message = __('MySQL strict mode is not enabled');
Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", $message, $message);
echo "</th></tr>";
}
}
if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
$crashedtables = DBMysql::checkForCrashedTables();
if (!empty($crashedtables)) {
$tables = array();
foreach ($crashedtables as $crashedtable) {
$tables[] = $crashtable['table'];
}
echo "<tr><th colspan='2'>";
$message = __('The following MySQL tables are marked as crashed:');
$message .= implode(',', $tables);
Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", $message, $message);
echo "</th></tr>";
}
}
if ($DB->isSlave() && !$DB->first_connection) {
echo "<tr><th colspan='2'>";
Html::displayTitle($CFG_GLPI['root_doc'] . "/pics/warning.png", __('MySQL replica: read only'), __('MySQL replica: read only'));
echo "</th></tr>";
}
echo "<tr class='noHover'><td class='top' width='50%'><table class='central'>";
echo "<tr class='noHover'><td>";
if (Session::haveRightsOr('ticketvalidation', TicketValidation::getValidateRights())) {
Ticket::showCentralList(0, "tovalidate", false);
}
if ($showticket) {
if (Ticket::isAllowedStatus(Ticket::SOLVED, Ticket::CLOSED)) {
Ticket::showCentralList(0, "toapprove", false);
}
Ticket::showCentralList(0, "survey", false);
Ticket::showCentralList(0, "rejected", false);
Ticket::showCentralList(0, "requestbyself", false);
Ticket::showCentralList(0, "observed", false);
Ticket::showCentralList(0, "process", false);
Ticket::showCentralList(0, "waiting", false);
}
if ($showproblem) {
Problem::showCentralList(0, "process", false);
}
echo "</td></tr>";
echo "</table></td>";
echo "<td class='top' width='50%'><table class='central'>";
echo "<tr class='noHover'><td>";
Planning::showCentral(Session::getLoginUserID());
Reminder::showListForCentral();
if (Session::haveRight("reminder_public", READ)) {
Reminder::showListForCentral(false);
}
echo "</td></tr>";
echo "</table></td></tr></table>";
}
示例11: showForm
//.........这里部分代码省略.........
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
echo "<td>" . __('Status') . "</td>";
echo "<td>";
State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_computer`"));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Location') . "</td>";
echo "<td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Type') . "</td>";
echo "<td>";
ComputerType::dropdown(array('value' => $this->fields["computertypes_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . "</td>";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Manufacturer') . "</td>";
echo "<td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Model') . "</td>";
echo "<td>";
ComputerModel::dropdown(array('value' => $this->fields["computermodels_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
//TRANS: Number of the alternate username
echo "<td>" . __('Alternate username number') . "</td>";
echo "<td >";
Html::autocompletionTextField($this, 'contact_num');
echo "</td>";
echo "<td>" . __('Serial number') . "</td>";
echo "<td >";
Html::autocompletionTextField($this, 'serial');
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, 'contact');
echo "</td>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<td>" . __('Network') . "</td>";
echo "<td>";
Network::dropdown(array('value' => $this->fields["networks_id"]));
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . "</td>";
echo "<td>";
Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
echo "</td>";
// Display auto inventory informations
$rowspan = 4;
echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
echo "<td rowspan='{$rowspan}' class='middle'>";
echo "<textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
echo "</textarea></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Domain') . "</td>";
echo "<td >";
Domain::dropdown(array('value' => $this->fields["domains_id"], 'entity' => $this->fields["entities_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('UUID') . "</td>";
echo "<td >";
Html::autocompletionTextField($this, 'uuid');
echo "</td>";
echo "</tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Update Source') . "</td>";
echo "<td >";
AutoUpdateSystem::dropdown(array('value' => $this->fields["autoupdatesystems_id"]));
echo "</td></tr>";
// Display auto inventory informations
if (!empty($ID) && Plugin::haveImport() && $this->fields["is_dynamic"]) {
echo "<tr class='tab_bg_1'><td colspan='4'>";
Plugin::doHook("autoinventory_information", $this);
echo "</td></tr>";
}
$this->showFormButtons($options);
return true;
}
示例12: showForm
//.........这里部分代码省略.........
echo "<td>";
$objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "name", array('value' => $objectName));
echo "</td>";
echo "<td>" . __('Status') . "</td>";
echo "<td>";
State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_networkequipment`"));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Location') . "</td>";
echo "<td>";
Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Type') . "</td>";
echo "<td>";
NetworkEquipmentType::dropdown(array('value' => $this->fields["networkequipmenttypes_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . "</td>";
echo "<td>";
User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Manufacturer') . "</td>";
echo "<td>";
Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group in charge of the hardware') . "</td>";
echo "<td>";
Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
echo "</td>";
echo "<td>" . __('Model') . "</td>";
echo "<td>";
NetworkEquipmentModel::dropdown(array('value' => $this->fields["networkequipmentmodels_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "contact_num");
echo "</td>";
echo "<td>" . __('Serial number') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "serial");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Alternate username') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "contact");
echo "</td>";
echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
echo "<td>";
$objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField($this, "otherserial", array('value' => $objectName));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('User') . "</td>";
echo "<td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<td>" . __('Network') . "</td>";
echo "<td>";
Network::dropdown(array('value' => $this->fields["networks_id"]));
echo "</td></tr>";
$rowspan = 5;
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . "</td>";
echo "<td>";
Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
echo "</td>";
echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
echo "<td rowspan='{$rowspan}'>\n <textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
echo "</textarea></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Domain') . "</td>";
echo "<td>";
Domain::dropdown(array('value' => $this->fields["domains_id"], 'entity' => $this->fields["entities_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td colspan=2>" . __('The MAC address and the IP of the equipment are included in an aggregated network port') . "</td>";
echo "</tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . _n('Firmware', 'Firmwares', 1) . "</td>";
echo "<td>";
NetworkEquipmentFirmware::dropdown(array('value' => $this->fields["networkequipmentfirmwares_id"]));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . sprintf(__('%1$s (%2$s)'), __('Memory'), __('Mio')) . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "ram");
echo "</td></tr>";
// Display auto inventory informations
if (!empty($ID) && $this->fields["is_dynamic"]) {
echo "<tr class='tab_bg_1'><td colspan='4'>";
Plugin::doHook("autoinventory_information", $this);
echo "</td></tr>";
}
$this->showFormButtons($options);
return true;
}
示例13: _e
_e('Checking write permissions for session files');
echo "<br>" . GLPI_SESSION_DIR;
break;
case 3:
_e('Invalid use of session ID');
break;
}
}
echo "</div>";
// Display FAQ is enable
if ($CFG_GLPI["use_public_faq"]) {
echo '<div id="box-faq">' . '<a href="front/helpdesk.faq.php">[ ' . __('Access to the Frequently Asked Questions') . ' ]';
echo '</a></div>';
}
echo "<div id='display-login'>";
Plugin::doHook('display_login');
echo "</div>";
echo "</div>";
// end contenu login
if (GLPI_DEMO_MODE) {
echo "<div class='center'>";
Event::getCountLogin();
echo "</div>";
}
echo "<div id='footer-login'>";
echo "<a href='http://glpi-project.org/' title='Powered By Teclib'>";
echo "GLPI version " . (isset($CFG_GLPI["version"]) ? $CFG_GLPI["version"] : "") . " Copyright (C) " . "2015" . " By Teclib'. <br />" . "Copyright (C) 2003-2015 INDEPNET Development Team";
echo "</a></div>";
}
// call cron
if (!GLPI_DEMO_MODE) {
示例14: showSummary
/**
* Show the current ticketfollowup summary
*
* @param $ticket Ticket object
**/
function showSummary($ticket)
{
global $DB, $CFG_GLPI;
if (!Session::haveRightsOr(self::$rightname, array(self::SEEPUBLIC, self::SEEPRIVATE, self::ADDMYTICKET))) {
return false;
}
$tID = $ticket->fields['id'];
// Display existing Followups
$showprivate = Session::haveRight(self::$rightname, self::SEEPRIVATE);
$caneditall = Session::haveRight(self::$rightname, self::UPDATEALL);
$tmp = array('tickets_id' => $tID);
$canadd = $this->can(-1, CREATE, $tmp);
$showuserlink = 0;
if (User::canView()) {
$showuserlink = 1;
}
$techs = $ticket->getAllUsers(CommonITILActor::ASSIGN);
$reopen_case = false;
if (in_array($ticket->fields["status"], $ticket->getClosedStatusArray()) && $ticket->isAllowedStatus($ticket->fields['status'], Ticket::INCOMING)) {
$reopen_case = true;
}
$tech = Session::haveRight(self::$rightname, self::ADDALLTICKET) || $ticket->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']);
$RESTRICT = "";
if (!$showprivate) {
$RESTRICT = " AND (`is_private` = '0'\n OR `users_id` ='" . Session::getLoginUserID() . "') ";
}
$query = "SELECT `glpi_ticketfollowups`.*, `glpi_users`.`picture`\n FROM `glpi_ticketfollowups`\n LEFT JOIN `glpi_users` ON (`glpi_ticketfollowups`.`users_id` = `glpi_users`.`id`)\n WHERE `tickets_id` = '{$tID}'\n {$RESTRICT}\n ORDER BY `date` DESC";
$result = $DB->query($query);
$rand = mt_rand();
if ($caneditall || $canadd) {
echo "<div id='viewfollowup" . $tID . "{$rand}'></div>\n";
}
if ($canadd) {
echo "<script type='text/javascript' >\n";
echo "function viewAddFollowup" . $ticket->fields['id'] . "{$rand}() {\n";
$params = array('type' => __CLASS__, 'parenttype' => 'Ticket', 'tickets_id' => $ticket->fields['id'], 'id' => -1);
Ajax::updateItemJsCode("viewfollowup" . $ticket->fields['id'] . "{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
echo Html::jsHide('addbutton' . $ticket->fields['id'] . "{$rand}");
echo "};";
echo "</script>\n";
// Not closed ticket or closed
if (!in_array($ticket->fields["status"], array_merge($ticket->getSolvedStatusArray(), $ticket->getClosedStatusArray())) || $reopen_case) {
if (isset($_GET['_openfollowup']) && $_GET['_openfollowup']) {
echo Html::scriptBlock("viewAddFollowup" . $ticket->fields['id'] . "{$rand}()");
} else {
echo "<div id='addbutton" . $ticket->fields['id'] . "{$rand}' class='center firstbloc'>" . "<a class='vsubmit' href='javascript:viewAddFollowup" . $ticket->fields['id'] . "{$rand}();'>";
if ($reopen_case) {
_e('Reopen the ticket');
} 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']);
$options = array('parent' => $ticket, 'rand' => $rand);
Plugin::doHook('pre_show_item', array('item' => $this, 'options' => &$options));
$data = array_merge($data, $this->fields);
$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";
}
//.........这里部分代码省略.........
示例15: transferItem
//.........这里部分代码省略.........
function transferItem($itemtype, $ID, $newID)
{
global $CFG_GLPI, $DB;
if (!($item = getItemForItemtype($itemtype))) {
return;
}
// Is already transfer ?
if (!isset($this->already_transfer[$itemtype][$ID])) {
// Check computer exists ?
if ($item->getFromDB($newID)) {
// Network connection ? keep connected / keep_disconnected / delete
if (in_array($itemtype, array('Computer', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer'))) {
$this->transferNetworkLink($itemtype, $ID, $newID);
}
// Device : keep / delete : network case : delete if net connection delete in import case
if (in_array($itemtype, array('Computer'))) {
$this->transferDevices($itemtype, $ID);
}
// Reservation : keep / delete
if (in_array($itemtype, $CFG_GLPI["reservation_types"])) {
$this->transferReservations($itemtype, $ID, $newID);
}
// History : keep / delete
$this->transferHistory($itemtype, $ID, $newID);
// Ticket : delete / keep and clean ref / keep and move
$this->transferTickets($itemtype, $ID, $newID);
// Infocoms : keep / delete
if (in_array($itemtype, $CFG_GLPI["infocom_types"])) {
$this->transferInfocoms($itemtype, $ID, $newID);
}
if ($itemtype == 'Software') {
$this->transferSoftwareLicensesAndVersions($ID);
}
// Connected item is transfered
if (in_array($itemtype, $CFG_GLPI["directconnect_types"])) {
$this->manageConnectionComputer($itemtype, $ID);
}
// Computer Direct Connect : delete link if it is the initial transfer item (no recursion)
if ($this->inittype == $itemtype && in_array($itemtype, array('Monitor', 'Phone', 'Peripheral', 'Printer'))) {
$this->deleteDirectConnection($itemtype, $ID);
}
// Contract : keep / delete + clean unused / keep unused
if (in_array($itemtype, $CFG_GLPI["contract_types"])) {
$this->transferContracts($itemtype, $ID, $newID);
}
// Contact / Supplier : keep / delete + clean unused / keep unused
if ($itemtype == 'Supplier') {
$this->transferSupplierContacts($ID, $newID);
}
// Document : keep / delete + clean unused / keep unused
if (in_array($itemtype, $CFG_GLPI["document_types"])) {
$this->transferDocuments($itemtype, $ID, $newID);
}
// Transfer compatible printers
if ($itemtype == 'CartridgeItem') {
$this->transferCompatiblePrinters($ID, $newID);
}
// Cartridges and cartridges items linked to printer
if ($itemtype == 'Printer') {
$this->transferPrinterCartridges($ID, $newID);
}
// Transfer Item
$input = array('id' => $newID, 'entities_id' => $this->to);
// Manage Location dropdown
if (isset($item->fields['locations_id'])) {
$input['locations_id'] = $this->transferDropdownLocation($item->fields['locations_id']);
}
if ($itemtype == 'Ticket') {
$input2 = $this->transferTicketAdditionalInformations($item->fields);
$input = array_merge($input, $input2);
$this->transferTaskCategory($itemtype, $ID, $newID);
$this->transferLinkedSuppliers($itemtype, $ID, $newID);
}
if ($itemtype == 'Problem') {
$input2 = $this->transferTicketAdditionalInformations($item->fields);
$input = array_merge($input, $input2);
$this->transferTaskCategory($itemtype, $ID, $newID);
$this->transferLinkedSuppliers($itemtype, $ID, $newID);
}
$item->update($input);
$this->addToAlreadyTransfer($itemtype, $ID, $newID);
// Do it after item transfer for entity checks
if ($itemtype == 'Computer') {
// Monitor Direct Connect : keep / delete + clean unused / keep unused
$this->transferDirectConnection($itemtype, $ID, 'Monitor');
// Peripheral Direct Connect : keep / delete + clean unused / keep unused
$this->transferDirectConnection($itemtype, $ID, 'Peripheral');
// Phone Direct Connect : keep / delete + clean unused / keep unused
$this->transferDirectConnection($itemtype, $ID, 'Phone');
// Printer Direct Connect : keep / delete + clean unused / keep unused
$this->transferDirectConnection($itemtype, $ID, 'Printer');
// License / Software : keep / delete + clean unused / keep unused
$this->transferComputerSoftwares($ID);
// Computer Disks : delete them or not ?
$this->transferComputerDisks($ID);
}
Plugin::doHook("item_transfer", array('type' => $itemtype, 'id' => $ID, 'newID' => $newID, 'entities_id' => $this->to));
}
}
}