• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP isPluginItemType函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中isPluginItemType函数的典型用法代码示例。如果您正苦于以下问题:PHP isPluginItemType函数的具体用法?PHP isPluginItemType怎么用?PHP isPluginItemType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了isPluginItemType函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: plugin_fields_uninstall

function plugin_fields_uninstall()
{
    global $DB;
    $_SESSION['uninstall_fields'] = true;
    $classesToUninstall = array('PluginFieldsDropdown', 'PluginFieldsContainer', 'PluginFieldsContainer_Field', 'PluginFieldsField', 'PluginFieldsValue', 'PluginFieldsProfile', 'PluginFieldsMigration');
    echo "<center>";
    echo "<table class='tab_cadre_fixe'>";
    echo "<tr><th>" . __("MySQL tables uninstallation", "fields") . "<th></tr>";
    echo "<tr class='tab_bg_1'>";
    echo "<td align='center'>";
    foreach ($classesToUninstall as $class) {
        if ($plug = isPluginItemType($class)) {
            $dir = GLPI_ROOT . "/plugins/fields/inc/";
            $item = strtolower($plug['class']);
            if (file_exists("{$dir}{$item}.class.php")) {
                include_once "{$dir}{$item}.class.php";
                if (!call_user_func(array($class, 'uninstall'))) {
                    return false;
                }
            }
        }
    }
    echo "</td>";
    echo "</tr>";
    echo "</table></center>";
    unset($_SESSION['uninstall_fields']);
    // clean display preferences
    $DB->query("DELETE FROM glpi_displaypreferences WHERE itemtype LIKE 'PluginFields%'");
    return true;
}
开发者ID:publik1974,项目名称:fields,代码行数:30,代码来源:hook.php


示例2: plugin_order_install

function plugin_order_install()
{
    foreach (glob(GLPI_ROOT . '/plugins/order/inc/*.php') as $file) {
        //Do not load datainjection files (not needed and avoid missing class error message)
        if (!preg_match('/injection.class.php/', $file)) {
            include_once $file;
        }
    }
    echo "<center>";
    echo "<table class='tab_cadre_fixe'>";
    echo "<tr><th>" . __("Plugin installation or upgrade", "order") . "<th></tr>";
    echo "<tr class='tab_bg_1'>";
    echo "<td align='center'>";
    $migration = new Migration("1.5.2");
    $classes = array('PluginOrderConfig', 'PluginOrderBillState', 'PluginOrderBillType', 'PluginOrderOrderState', 'PluginOrderOrder', 'PluginOrderOrder_Item', 'PluginOrderReference', 'PluginOrderDeliveryState', 'PluginOrderNotificationTargetOrder', 'PluginOrderOrder_Supplier', 'PluginOrderBill', 'PluginOrderOrderPayment', 'PluginOrderOrderType', 'PluginOrderOther', 'PluginOrderOtherType', 'PluginOrderPreference', 'PluginOrderProfile', 'PluginOrderReference_Supplier', 'PluginOrderSurveySupplier', 'PluginOrderOrderTax', 'PluginOrderDocumentCategory');
    foreach ($classes as $class) {
        if ($plug = isPluginItemType($class)) {
            $plugname = strtolower($plug['plugin']);
            $dir = GLPI_ROOT . "/plugins/{$plugname}/inc/";
            $item = strtolower($plug['class']);
            if (file_exists("{$dir}{$item}.class.php")) {
                include_once "{$dir}{$item}.class.php";
                call_user_func(array($class, 'install'), $migration);
            }
        }
    }
    echo "</td>";
    echo "</tr>";
    echo "</table></center>";
    return true;
}
开发者ID:equinoxefr,项目名称:order,代码行数:31,代码来源:hook.php


示例3: getItem_DeviceType

 /**
  * Get the assiociated item_device associated with this device
  * This method can be override, for instance by the plugin
  *
  * @since version 0.85
  *
  * @return array of the types of CommonDevice available
  **/
 static function getItem_DeviceType()
 {
     $devicetype = get_called_class();
     if ($plug = isPluginItemType($devicetype)) {
         return 'Plugin' . $plug['plugin'] . 'Item_' . $plug['class'];
     }
     return "Item_{$devicetype}";
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:16,代码来源:commondevice.class.php


示例4: glpiautoload

 function glpiautoload($classname)
 {
     global $DEBUG_AUTOLOAD, $CFG_GLPI;
     static $notfound = array();
     // empty classname or non concerted plugin
     if (empty($classname) || is_numeric($classname)) {
         return FALSE;
     }
     $dir = GLPI_ROOT . "/inc/";
     //$classname="PluginExampleProfile";
     if ($plug = isPluginItemType($classname)) {
         $plugname = strtolower($plug['plugin']);
         $dir = GLPI_ROOT . "/plugins/{$plugname}/inc/";
         $item = strtolower($plug['class']);
         // Is the plugin activate ?
         // Command line usage of GLPI : need to do a real check plugin activation
         if (isCommandLine()) {
             $plugin = new Plugin();
             if (count($plugin->find("directory='{$plugname}' AND state=" . Plugin::ACTIVATED)) == 0) {
                 // Plugin does not exists or not activated
                 return FALSE;
             }
         } else {
             // Standard use of GLPI
             if (!in_array($plugname, $_SESSION['glpi_plugins'])) {
                 // Plugin not activated
                 return FALSE;
             }
         }
     } else {
         // Is ezComponent class ?
         $matches = array();
         if (preg_match('/^ezc([A-Z][a-z]+)/', $classname, $matches)) {
             include_once GLPI_EZC_BASE;
             ezcBase::autoload($classname);
             return TRUE;
         } else {
             $item = strtolower($classname);
         }
     }
     // No errors for missing classes due to implementation
     if (!isset($CFG_GLPI['missingclasses']) or !in_array($item, $CFG_GLPI['missingclasses'])) {
         if (file_exists("{$dir}{$item}.class.php")) {
             include_once "{$dir}{$item}.class.php";
             if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
                 $DEBUG_AUTOLOAD[] = $classname;
             }
         } else {
             if (!isset($notfound["{$classname}"])) {
                 // trigger an error to get a backtrace, but only once (use prefix 'x' to handle empty case)
                 //Toolbox::logInFile('debug', "file $dir$item.class.php not founded trying to load class $classname\n");
                 trigger_error("GLPI autoload : file {$dir}{$item}.class.php not founded trying to load class '{$classname}'");
                 $notfound["{$classname}"] = TRUE;
             }
         }
     }
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:57,代码来源:AllTests.php


示例5: getDatasForTemplate

 /**
  * Get all data needed for template processing
  *
  * @param $event
  * @param $options   array
  **/
 function getDatasForTemplate($event, $options = array())
 {
     $events = $this->getAllEvents();
     $this->datas['##crontask.action##'] = $events[$event];
     $cron = new Crontask();
     foreach ($options['items'] as $id => $crontask) {
         $tmp = array();
         $tmp['##crontask.name##'] = '';
         if ($isplug = isPluginItemType($crontask["itemtype"])) {
             $tmp['##crontask.name##'] = $isplug["plugin"] . " - ";
         }
         $tmp['##crontask.name##'] .= $crontask['name'];
         $tmp['##crontask.description##'] = $cron->getDescription($id);
         $tmp['##crontask.url##'] = $this->formatURL($options['additionnaloption']['usertype'], "Crontask_" . $id);
         $this->datas['crontasks'][] = $tmp;
     }
     $this->getTags();
     foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
         if (!isset($this->datas[$tag])) {
             $this->datas[$tag] = $values['label'];
         }
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:29,代码来源:notificationtargetcrontask.class.php


示例6: getDatasForTemplate

 /**
  * Get all data needed for template processing
  *
  * @param $event
  * @param $options   array
  **/
 function getDatasForTemplate($event, $options = array())
 {
     global $CFG_GLPI;
     $events = $this->getAllEvents();
     $this->datas['##crontask.action##'] = $events[$event];
     $cron = new Crontask();
     foreach ($options['items'] as $id => $crontask) {
         $tmp = array();
         $tmp['##crontask.name##'] = '';
         if ($isplug = isPluginItemType($crontask["itemtype"])) {
             $tmp['##crontask.name##'] = $isplug["plugin"] . " - ";
         }
         $tmp['##crontask.name##'] .= $crontask['name'];
         $tmp['##crontask.description##'] = $cron->getDescription($id);
         $tmp['##crontask.url##'] = urldecode($CFG_GLPI["url_base"] . "/index.php?redirect=crontask_" . $id);
         $this->datas['crontasks'][] = $tmp;
     }
     $this->getTags();
     foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) {
         if (!isset($this->datas[$tag])) {
             $this->datas[$tag] = $values['label'];
         }
     }
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:30,代码来源:notificationtargetcrontask.class.php


示例7: getClassByType

 /**
  * Get rulecollection classname by giving his itemtype
  *
  * @param $itemtype itemtype
  * @param $check_dictionnary_type check if the itemtype is a dictionnary or not
  *
  * @return the rulecollection class or null
  */
 static function getClassByType($itemtype, $check_dictionnary_type = false)
 {
     global $CFG_GLPI;
     if ($plug = isPluginItemType($itemtype)) {
         $typeclass = 'Plugin' . $plug['plugin'] . $plug['class'] . 'Collection';
     } else {
         if (in_array($itemtype, $CFG_GLPI["dictionnary_types"])) {
             $typeclass = 'RuleDictionnary' . $itemtype . "Collection";
         } else {
             $typeclass = $itemtype . "Collection";
         }
     }
     if ($check_dictionnary_type && in_array($itemtype, $CFG_GLPI["dictionnary_types"]) || !$check_dictionnary_type) {
         if (class_exists($typeclass)) {
             return new $typeclass();
         }
         return NULL;
     }
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:27,代码来源:rulecollection.class.php


示例8: header

along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief List of device for tracking.
* @since version 0.85
*/
include '../inc/includes.php';
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
Session::checkLoginUser();
// Security
if (!TableExists($_POST['table'])) {
    exit;
}
$itemtypeisplugin = isPluginItemType($_POST['itemtype']);
if (!($item = getItemForItemtype($_POST['itemtype']))) {
    exit;
}
if ($item->isEntityAssign()) {
    if (isset($_POST["entity_restrict"]) && $_POST["entity_restrict"] >= 0) {
        $entity = $_POST["entity_restrict"];
    } else {
        $entity = '';
    }
    // allow opening ticket on recursive object (printer, software, ...)
    $recursive = $item->maybeRecursive();
    $where = getEntitiesRestrictRequest("WHERE", $_POST['table'], '', $entity, $recursive);
} else {
    $where = "WHERE 1";
}
开发者ID:glpi-project,项目名称:glpi,代码行数:31,代码来源:getDropdownFindNum.php


示例9: registerClass

 /**
  * Define a new class managed by a plugin
  *
  * @param $itemtype        class name
  * @param $attrib    array of attributes, a hashtable with index in
  *                         (classname, typename, reservation_types)
  *
  * @return bool
  **/
 static function registerClass($itemtype, $attrib = array())
 {
     global $CFG_GLPI;
     $plug = isPluginItemType($itemtype);
     if (!$plug) {
         return false;
     }
     $plugin = strtolower($plug['plugin']);
     if (isset($attrib['doc_types'])) {
         $attrib['document_types'] = $attrib['doc_types'];
         unset($attrib['doc_types']);
     }
     if (isset($attrib['helpdesk_types'])) {
         $attrib['ticket_types'] = $attrib['helpdesk_types'];
         unset($attrib['helpdesk_types']);
     }
     if (isset($attrib['netport_types'])) {
         $attrib['networkport_types'] = $attrib['netport_types'];
         unset($attrib['netport_types']);
     }
     foreach (array('contract_types', 'directconnect_types', 'document_types', 'helpdesk_visible_types', 'infocom_types', 'linkgroup_tech_types', 'linkgroup_types', 'linkuser_tech_types', 'linkuser_types', 'location_types', 'networkport_instantiations', 'networkport_types', 'notificationtemplates_types', 'planning_types', 'reservation_types', 'rulecollections_types', 'systeminformations_types', 'ticket_types', 'unicity_types', 'link_types') as $att) {
         if (isset($attrib[$att]) && $attrib[$att]) {
             array_push($CFG_GLPI[$att], $itemtype);
             unset($attrib[$att]);
         }
     }
     if (isset($attrib['device_types']) && $attrib['device_types'] && method_exists($itemtype, 'getItem_DeviceType')) {
         if (class_exists($itemtype::getItem_DeviceType())) {
             array_push($CFG_GLPI['device_types'], $itemtype);
         }
         unset($attrib[$att]);
     }
     if (isset($attrib['addtabon'])) {
         if (!is_array($attrib['addtabon'])) {
             $attrib['addtabon'] = array($attrib['addtabon']);
         }
         foreach ($attrib['addtabon'] as $form) {
             CommonGLPI::registerStandardTab($form, $itemtype);
         }
     }
     //Manage entity forward from a source itemtype to this itemtype
     if (isset($attrib['forwardentityfrom'])) {
         CommonDBTM::addForwardEntity($attrib['forwardentityfrom'], $itemtype);
     }
     // Use it for plugin debug
     //       if (count($attrib)) {
     //          foreach ($attrib as $key => $val) {
     //             Toolbox::logInFile('debug',"Attribut $key used by $itemtype no more used for plugins\n");
     //          }
     //}
     return true;
 }
开发者ID:pvasener,项目名称:glpi,代码行数:61,代码来源:plugin.class.php


示例10: getTemplateByLanguage

 /**
  * @param $target             NotificationTarget object
  * @param $user_infos   array
  * @param $event
  * @param $options      array
  *
  * @return id of the template in templates_by_languages / false if computation failed
  **/
 function getTemplateByLanguage(NotificationTarget $target, $user_infos = array(), $event, $options = array())
 {
     $lang = array();
     $language = $user_infos['language'];
     if (isset($user_infos['additionnaloption'])) {
         $additionnaloption = $user_infos['additionnaloption'];
     } else {
         $additionnaloption = array();
     }
     $tid = $language;
     $tid .= serialize($additionnaloption);
     $tid = sha1($tid);
     if (!isset($this->templates_by_languages[$tid])) {
         //Switch to the desired language
         $bak_dropdowntranslations = $_SESSION['glpi_dropdowntranslations'];
         $_SESSION['glpi_dropdowntranslations'] = DropdownTranslation::getAvailableTranslations($language);
         Session::loadLanguage($language);
         $bak_language = $_SESSION["glpilanguage"];
         $_SESSION["glpilanguage"] = $language;
         //If event is raised by a plugin, load it in order to get the language file available
         if ($plug = isPluginItemType(get_class($target->obj))) {
             Plugin::loadLang(strtolower($plug['plugin']), $language);
         }
         //Get template's language data for in this language
         $options['additionnaloption'] = $additionnaloption;
         $data =& $target->getForTemplate($event, $options);
         $footer_string = Html::entity_decode_deep(sprintf(__('Automatically generated by GLPI %s'), GLPI_VERSION));
         $add_header = Html::entity_decode_deep($target->getContentHeader());
         $add_footer = Html::entity_decode_deep($target->getContentFooter());
         //Restore default language
         $_SESSION["glpilanguage"] = $bak_language;
         Session::loadLanguage();
         $_SESSION['glpi_dropdowntranslations'] = $bak_dropdowntranslations;
         if ($plug = isPluginItemType(get_class($target->obj))) {
             Plugin::loadLang(strtolower($plug['plugin']));
         }
         if ($template_datas = $this->getByLanguage($language)) {
             //Template processing
             // Decode html chars to have clean text
             $template_datas['content_text'] = Html::entity_decode_deep($template_datas['content_text']);
             $save_data = $data;
             $data = Html::entity_decode_deep($data);
             $template_datas['subject'] = Html::entity_decode_deep($template_datas['subject']);
             $this->signature = Html::entity_decode_deep($this->signature);
             $lang['subject'] = $target->getSubjectPrefix($event) . self::process($template_datas['subject'], $data);
             $lang['content_html'] = '';
             //If no html content, then send only in text
             if (!empty($template_datas['content_html'])) {
                 // Encode in HTML all chars
                 $data_html = Html::entities_deep($data);
                 $data_html = Html::nl2br_deep($data_html);
                 // Restore HTML tags
                 if (count($target->html_tags)) {
                     foreach ($target->html_tags as $tag) {
                         if (isset($save_data[$tag])) {
                             $data_html[$tag] = $save_data[$tag];
                         }
                     }
                 }
                 $signature_html = Html::entities_deep($this->signature);
                 $signature_html = Html::nl2br_deep($signature_html);
                 $template_datas['content_html'] = self::process($template_datas['content_html'], $data_html);
                 $lang['content_html'] = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n                        'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>" . "<html>\n                        <head>\n                         <META http-equiv='Content-Type' content='text/html; charset=utf-8'>\n                         <title>" . Html::entities_deep($lang['subject']) . "</title>\n                         <style type='text/css'>\n                           " . $this->fields['css'] . "\n                         </style>\n                        </head>\n                        <body>\n" . (!empty($add_header) ? $add_header . "\n<br><br>" : '') . $template_datas['content_html'] . "<br><br>-- \n<br>" . $signature_html . "<br>{$footer_string}" . "<br><br>\n" . (!empty($add_footer) ? $add_footer . "\n<br><br>" : '') . "\n</body></html>";
             }
             $lang['content_text'] = (!empty($add_header) ? $add_header . "\n\n" : '') . Html::clean(self::process($template_datas['content_text'], $data) . "\n\n-- \n" . $this->signature . "\n" . Html::entity_decode_deep(sprintf(__('Automatically generated by GLPI %s'), GLPI_VERSION))) . "\n\n" . $add_footer;
             $this->templates_by_languages[$tid] = $lang;
         }
     }
     if (isset($this->templates_by_languages[$tid])) {
         return $tid;
     }
     return false;
 }
开发者ID:btry,项目名称:glpi,代码行数:81,代码来源:notificationtemplate.class.php


示例11: checkAlreadyPlanned

 /**
  * Check already planned user for a period
  *
  * @param $users_id        user id
  * @param $begin           begin date
  * @param $end             end date
  * @param $except    array of items which not be into account array
  *                         ('Reminder'=>array(1,2,id_of_items))
  **/
 static function checkAlreadyPlanned($users_id, $begin, $end, $except = array())
 {
     global $CFG_GLPI;
     $planned = false;
     $message = '';
     foreach ($CFG_GLPI['planning_types'] as $itemtype) {
         $data = call_user_func(array($itemtype, 'populatePlanning'), array('who' => $users_id, 'who_group' => 0, 'begin' => $begin, 'end' => $end));
         if (isPluginItemType($itemtype)) {
             if (isset($data['items'])) {
                 $data = $data['items'];
             } else {
                 $data = array();
             }
         }
         if (count($data) && method_exists($itemtype, 'getAlreadyPlannedInformation')) {
             foreach ($data as $key => $val) {
                 if (!isset($except[$itemtype]) || is_array($except[$itemtype]) && !in_array($val['id'], $except[$itemtype])) {
                     $planned = true;
                     $message .= '- ' . call_user_func(array($itemtype, 'getAlreadyPlannedInformation'), $val) . '<br>';
                 }
             }
         }
     }
     if ($planned) {
         Session::addMessageAfterRedirect(__('The user is busy at the selected timeframe.') . '<br>' . $message, false, ERROR);
     }
     return $planned;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:37,代码来源:planning.class.php


示例12: getDeviceType

 /**
  * Get associated device to the current item_device
  *
  * @since version 0.85
  *
  * @return string containing the device
  **/
 static function getDeviceType()
 {
     $devicetype = get_called_class();
     if ($plug = isPluginItemType($devicetype)) {
         return 'Plugin' . $plug['plugin'] . str_replace('Item_', '', $plug['class']);
     }
     return str_replace('Item_', '', $devicetype);
 }
开发者ID:pvasener,项目名称:glpi,代码行数:15,代码来源:item_devices.class.php


示例13: getAllTypesForHelpdesk

 /**
  * Get all available types to which an ITIL object can be assigned
  **/
 static function getAllTypesForHelpdesk()
 {
     global $PLUGIN_HOOKS, $CFG_GLPI;
     /// TODO ticket_types -> itil_types
     $types = array();
     $ptypes = array();
     //Types of the plugins (keep the plugin hook for right check)
     if (isset($PLUGIN_HOOKS['assign_to_ticket'])) {
         foreach ($PLUGIN_HOOKS['assign_to_ticket'] as $plugin => $value) {
             $ptypes = Plugin::doOneHook($plugin, 'AssignToTicket', $ptypes);
         }
     }
     asort($ptypes);
     //Types of the core (after the plugin for robustness)
     foreach ($CFG_GLPI["ticket_types"] as $itemtype) {
         if ($item = getItemForItemtype($itemtype)) {
             if (!isPluginItemType($itemtype) && in_array($itemtype, $_SESSION["glpiactiveprofile"]["helpdesk_item_type"])) {
                 $types[$itemtype] = $item->getTypeName(1);
             }
         }
     }
     asort($types);
     // core type first... asort could be better ?
     // Drop not available plugins
     foreach ($ptypes as $itemtype => $itemtype_name) {
         if (!in_array($itemtype, $_SESSION["glpiactiveprofile"]["helpdesk_item_type"])) {
             unset($ptypes[$itemtype]);
         }
     }
     $types = array_merge($types, $ptypes);
     return $types;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:35,代码来源:commonitilobject.class.php


示例14: getItemTypeSearchURL

 /**
  * Get search URL for itemtype
  *
  * @param $itemtype  string   item type
  * @param $full               path or relative one (true by default)
  *
  * return string itemtype search URL
  **/
 static function getItemTypeSearchURL($itemtype, $full = true)
 {
     global $CFG_GLPI;
     $dir = $full ? $CFG_GLPI['root_doc'] : '';
     if ($plug = isPluginItemType($itemtype)) {
         $dir .= "/plugins/" . strtolower($plug['plugin']);
         $item = strtolower($plug['class']);
     } else {
         // Standard case
         if ($itemtype == 'Cartridge') {
             $itemtype = 'CartridgeItem';
         }
         if ($itemtype == 'Consumable') {
             $itemtype = 'ConsumableItem';
         }
         $item = strtolower($itemtype);
     }
     return "{$dir}/front/{$item}.php";
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:27,代码来源:toolbox.class.php


示例15: array

Html::header_nocache();
if (!($item = getItemForItemtype($_POST['itemtype']))) {
    exit;
}
$item->checkGlobal(READ);
$group = "";
$values = array();
$searchopt = Search::getCleanedOptions($_POST["itemtype"], READ, false);
echo "<table width='100%'><tr><td width='40%'>";
foreach ($searchopt as $key => $val) {
    // print groups
    $str_limit = 28;
    if (!is_array($val)) {
        $group = $val;
    } else {
        // No search on plugins
        if (!isPluginItemType($key) && !isset($val["nometa"])) {
            $values[$group][$key] = $val["name"];
        }
    }
}
$rand = Dropdown::showFromArray("metacriteria[" . $_POST["num"] . "][field]", $values, array('value' => $_POST["field"]));
$field_id = Html::cleanId("dropdown_metacriteria[" . $_POST["num"] . "][field]" . $rand);
echo "</td><td class='left'>";
echo "<span id='Search2Span" . $_POST["itemtype"] . $_POST["num"] . "'>\n";
$_POST['meta'] = 1;
include GLPI_ROOT . "/ajax/searchoption.php";
echo "</span>\n";
$params = array('field' => '__VALUE__', 'itemtype' => $_POST["itemtype"], 'num' => $_POST["num"], 'value' => $_POST["value"], 'searchtype' => $_POST["searchtype"], 'meta' => 1);
Ajax::updateItemOnSelectEvent($field_id, "Search2Span" . $_POST["itemtype"] . $_POST["num"], $CFG_GLPI["root_doc"] . "/ajax/searchoption.php", $params);
echo '</td></tr></table>';
开发者ID:jose-martins,项目名称:glpi,代码行数:31,代码来源:updateMetaSearch.php


示例16: processMassiveActionsForOneItemtype

 /**
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $CFG_GLPI;
     $action = $ma->getAction();
     switch ($action) {
         case 'delete':
             foreach ($ids as $id) {
                 if ($item->can($id, DELETE)) {
                     if ($item->delete(array("id" => $id))) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             break;
         case 'restore':
             foreach ($ids as $id) {
                 if ($item->can($id, PURGE)) {
                     if ($item->restore(array("id" => $id))) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             break;
         case 'purge_item_but_devices':
         case 'purge_but_item_linked':
         case 'purge':
             foreach ($ids as $id) {
                 if ($item->can($id, PURGE)) {
                     $force = 1;
                     // Only mark deletion for
                     if ($item->maybeDeleted() && $item->useDeletedToLockIfDynamic() && $item->isDynamic()) {
                         $force = 0;
                     }
                     $delete_array = array('id' => $id);
                     if ($action == 'purge_item_but_devices') {
                         $delete_array['keep_devices'] = true;
                     }
                     if ($item instanceof CommonDropdown) {
                         if ($item->haveChildren()) {
                             if ($action != 'purge_but_item_linked') {
                                 $force = 0;
                                 $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                                 $ma->addMessage(__("You can't delete that item by massive actions, because it has sub-items"));
                                 $ma->addMessage(__("but you can do it by the form of the item"));
                                 continue;
                             }
                         }
                         if ($item->isUsed()) {
                             if ($action != 'purge_but_item_linked') {
                                 $force = 0;
                                 $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                                 $ma->addMessage(__("You can't delete that item, because it is used for one or more items"));
                                 $ma->addMessage(__("but you can do it by the form of the item"));
                                 continue;
                             }
                         }
                     }
                     if ($item->delete($delete_array, $force)) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             break;
         case 'update':
             if (!isset($ma->POST['search_options']) || !isset($ma->POST['search_options'][$item->getType()])) {
                 return false;
             }
             $index = $ma->POST['search_options'][$item->getType()];
             $searchopt = Search::getCleanedOptions($item->getType(), UPDATE);
             $input = $ma->POST;
             if (isset($searchopt[$index])) {
                 /// Infocoms case
                 if (!isPluginItemType($item->getType()) && Search::isInfocomOption($item->getType(), $index)) {
                     $ic = new Infocom();
                     $link_entity_type = -1;
                     /// Specific entity item
                     if ($searchopt[$index]["table"] == "glpi_suppliers") {
                         $ent = new Supplier();
                         if ($ent->getFromDB($input[$input["field"]])) {
//.........这里部分代码省略.........
开发者ID:kipman,项目名称:glpi,代码行数:101,代码来源:massiveaction.class.php


示例17: _sx

$submitname = _sx('button', 'Post');
if (isset($_POST['submitname']) && $_POST['submitname']) {
    $submitname = stripslashes($_POST['submitname']);
}
if (isset($_POST["itemtype"]) && isset($_POST["id_field"]) && $_POST["id_field"]) {
    $search = Search::getOptions($_POST["itemtype"]);
    if (!isset($search[$_POST["id_field"]])) {
        exit;
    }
    $search = $search[$_POST["id_field"]];
    $FIELDNAME_PRINTED = false;
    $USE_TABLE = false;
    echo "<table class='tab_glpi' width='100%'><tr><td>";
    $plugdisplay = false;
    // Specific plugin Type case
    if (($plug = isPluginItemType($_POST["itemtype"])) || ($plug = isPluginItemType(getItemTypeForTable($search['table'])))) {
        $plugdisplay = Plugin::doOneHook($plug['plugin'], 'MassiveActionsFieldsDisplay', array('itemtype' => $_POST["itemtype"], 'options' => $search));
    }
    $fieldname = '';
    if (empty($search["linkfield"]) || $search['table'] == 'glpi_infocoms') {
        $fieldname = $search["field"];
    } else {
        $fieldname = $search["linkfield"];
    }
    if (!$plugdisplay) {
        $options = array();
        $values = array();
        // For ticket template or aditional options of massive actions
        if (isset($_POST['options'])) {
            $options = $_POST['options'];
        }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:dropdownMassiveActionField.php


示例18: showMethods

 function showMethods()
 {
     global $WEBSERVICES_METHOD, $CFG_GLPI;
     echo "<div class='center'><br><table class='tab_cadre_fixehov'>";
     echo "<tr><th colspan='4'>" . __('Method list - defined and allowed by this rule', 'webservices') . "</th></tr>";
     echo "<tr><th>" . __('Method name', 'webservices') . "</th>" . "<th>" . __('Provider plugin', 'webservices') . "</th>" . "<th>" . __('Internal function name', 'webservices') . "</th>" . "<th>" . __('Function is available', 'webservices') . "</th></tr>";
     // Allow all plugins to register their methods
     $WEBSERVICES_METHOD = array();
     Plugin::doHook("webservices");
     foreach ($WEBSERVICES_METHOD as $method => $function) {
         // Display if MySQL REGEXP match
         if (countElementsInTable($this->getTable(), "ID='" . $this->fields['id'] . "' AND '" . addslashes($method) . "' REGEXP pattern") > 0) {
             $result = $function;
             if (is_array($function)) {
                 if ($tmp = isPluginItemType($function[0])) {
                     $plugin = $tmp['plugin'];
                 } else {
                     $plugin = "&nbsp;";
                 }
                 $result = implode('::', $function);
             } else {
                 if (preg_match('/^plugin_(.*)_method/', $function, $res)) {
                     $plugin = $res[1];
                 } else {
                     $plugin = "&nbsp;";
                 }
             }
             $call = is_callable($function) ? __('Yes') : __('No');
             $color = is_callable($function) ? "greenbutton" : "redbutton";
             echo "<tr class='tab_bg_1'><td class='b'>{$method}</td><td>{$plugin}</td>" . "<td>{$result}</td><td class='center'>" . "<img src=\"" . $CFG_GLPI['root_doc'] . "/pics/{$color}.png\" alt='ok'>&nbsp;{$call}</td></tr>";
         }
     }
     echo "</table></div>";
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:34,代码来源:client.class.php


示例19: Register

 /**
  * Register new task for plugin (called by plugin during install)
  *
  * @param $itemtype        itemtype of the plugin object
  * @param $name            of the task
  * @param $frequency       of execution
  * @param $options   array of optional options
  *       (state, mode, allowmode, hourmin, hourmax, logs_lifetime, param, comment)
  *
  * @return bool for success
  **/
 public static function Register($itemtype, $name, $frequency, $options = array())
 {
     // Check that hook exists
     if (!isPluginItemType($itemtype)) {
         return false;
     }
     $temp = new self();
     // Avoid duplicate entry
     if ($temp->getFromDBbyName($itemtype, $name)) {
         return false;
     }
     $input = array('itemtype' => $itemtype, 'name' => $name, 'frequency' => $frequency);
     foreach (array('allowmode', 'comment', 'hourmax', 'hourmin', 'logs_lifetime', 'mode', 'param', 'state') as $key) {
         if (isset($options[$key])) {
             $input[$key] = $options[$key];
         }
     }
     return $temp->add($input);
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:30,代码来源:crontask.class.php


示例20: showForm

 /**
  * Show the rule
  *
  * @param $ID              ID of the rule
  * @param $options   array of possible options:
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  * @return nothing
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     if (!$this->isNewID($ID)) {
         $this->check($ID, READ);
     } else {
         // Create item
         $this->checkGlobal(UPDATE);
     }
     $canedit = $this->canEdit(static::$rightname);
     $rand = mt_rand();
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Description') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "description");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Logical operator') . "</td>";
     echo "<td>";
     $this->dropdownRulesMatch(array('value' => $this->fields["match"]));
     echo "</td>";
     echo "<td>" . __('Active') . "</td>";
     echo "<td>";
     Dropdown::showYes 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP isPost函数代码示例发布时间:2022-05-15
下一篇:
PHP isPingable函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap