本文整理汇总了PHP中isPluginItemType函数的典型用法代码示例。如果您正苦于以下问题:PHP isPluginItemType函数的具体用法?PHP isPluginItemType怎么用?PHP isPluginItemType使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isPluginItemType函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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}";
}
示例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;
}
}
}
}
示例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'];
}
}
}
示例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'];
}
}
}
示例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;
}
}
示例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";
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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";
}
示例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>';