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

PHP getForeignKeyFieldForItemType函数代码示例

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

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



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

示例1: generateIcal

 /**
  *  Generate ical file content
  *
  * @param $who             user ID
  * @param $who_group       group ID
  * @param $limititemtype   itemtype only display this itemtype (default '')
  *
  * @return icalendar string
  **/
 static function generateIcal($who, $who_group, $limititemtype = '')
 {
     global $CFG_GLPI;
     if ($who === 0 && $who_group === 0) {
         return false;
     }
     include_once GLPI_ROOT . "/lib/icalcreator/iCalcreator.class.php";
     $v = new vcalendar();
     if (!empty($CFG_GLPI["version"])) {
         $v->setConfig('unique_id', "GLPI-Planning-" . trim($CFG_GLPI["version"]));
     } else {
         $v->setConfig('unique_id', "GLPI-Planning-UnknownVersion");
     }
     $tz = date_default_timezone_get();
     $v->setConfig('TZID', $tz);
     $v->setProperty("method", "PUBLISH");
     $v->setProperty("version", "2.0");
     $v->setProperty("X-WR-TIMEZONE", $tz);
     $xprops = array("X-LIC-LOCATION" => $tz);
     iCalUtilityFunctions::createTimezone($v, $tz, $xprops);
     $v->setProperty("x-wr-calname", "GLPI-" . $who . "-" . $who_group);
     $v->setProperty("calscale", "GREGORIAN");
     $interv = array();
     $begin = time() - MONTH_TIMESTAMP * 12;
     $end = time() + MONTH_TIMESTAMP * 12;
     $begin = date("Y-m-d H:i:s", $begin);
     $end = date("Y-m-d H:i:s", $end);
     $params = array('who' => $who, 'who_group' => $who_group, 'begin' => $begin, 'end' => $end);
     $interv = array();
     if (empty($limititemtype)) {
         foreach ($CFG_GLPI['planning_types'] as $itemtype) {
             $interv = array_merge($interv, $itemtype::populatePlanning($params));
         }
     } else {
         $interv = $limititemtype::populatePlanning($params);
     }
     if (count($interv) > 0) {
         foreach ($interv as $key => $val) {
             $vevent = new vevent();
             //initiate EVENT
             if (isset($val['itemtype'])) {
                 if (isset($val[getForeignKeyFieldForItemType($val['itemtype'])])) {
                     $vevent->setProperty("uid", $val['itemtype'] . "#" . $val[getForeignKeyFieldForItemType($val['itemtype'])]);
                 } else {
                     $vevent->setProperty("uid", "Other#" . $key);
                 }
             } else {
                 $vevent->setProperty("uid", "Other#" . $key);
             }
             $vevent->setProperty("dstamp", $val["begin"]);
             $vevent->setProperty("dtstart", $val["begin"]);
             $vevent->setProperty("dtend", $val["end"]);
             if (isset($val["tickets_id"])) {
                 $vevent->setProperty("summary", sprintf(__('Ticket #%1$s %2$s'), $val["tickets_id"], $val["name"]));
             } else {
                 if (isset($val["name"])) {
                     $vevent->setProperty("summary", $val["name"]);
                 }
             }
             if (isset($val["content"])) {
                 $text = $val["content"];
                 // be sure to replace nl by \r\n
                 $text = preg_replace("/<br( [^>]*)?" . ">/i", "\r\n", $text);
                 $text = Html::clean($text);
                 $vevent->setProperty("description", $text);
             } else {
                 if (isset($val["name"])) {
                     $text = $val["name"];
                     // be sure to replace nl by \r\n
                     $text = preg_replace("/<br( [^>]*)?" . ">/i", "\r\n", $text);
                     $text = Html::clean($text);
                     $vevent->setProperty("description", $text);
                 }
             }
             if (isset($val["url"])) {
                 $vevent->setProperty("url", $val["url"]);
             }
             $v->setComponent($vevent);
         }
     }
     $v->sort();
     //       $v->parse();
     return $v->returnCalendar();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:93,代码来源:planning.class.php


示例2: addItemClassFile

 /**
  * Write on the the _Item class file for the new object type
  * @param name the name of the object type
  * @param classname the name of the new object
  * @param itemtype the object device type
  * @return nothing
  */
 public static function addItemClassFile($name, $classname)
 {
     $class = self::getClassByName($name) . "_Item";
     self::addFileFromTemplate(array('CLASSNAME' => $class, 'FOREIGNKEY' => getForeignKeyFieldForItemType($classname), 'SOURCEOBJECT' => $classname), self::OBJECTITEM_TEMPLATE, GENERICOBJECT_CLASS_PATH, $name . "_item.class");
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:12,代码来源:type.class.php


示例3: showDebug

 /**
  * Display debug information for current object
  * NotificationTemplateTranslation => translation preview
  *
  * @since version 0.84
  **/
 function showDebug()
 {
     $template = new NotificationTemplate();
     if (!$template->getFromDB($this->fields['notificationtemplates_id'])) {
         return;
     }
     $itemtype = $template->getField('itemtype');
     if (!($item = getItemForItemtype($itemtype))) {
         return;
     }
     echo "<div class='spaced'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>" . __('Preview') . "</th></tr>";
     $oktypes = array('CartridgeItem', 'Change', 'ConsumableItem', 'Contract', 'Crontask', 'Problem', 'Project', 'Ticket', 'User');
     if (!in_array($itemtype, $oktypes)) {
         // this itemtype doesn't work, need to be fixed
         echo "<tr class='tab_bg_2 center'><td>" . NOT_AVAILABLE . "</td>";
         echo "</table></div>";
         return;
     }
     // Criteria Form
     $key = getForeignKeyFieldForItemType($item->getType());
     $id = Session::getSavedOption(__CLASS__, $key, 0);
     $event = Session::getSavedOption(__CLASS__, $key . '_event', '');
     echo "<tr class='tab_bg_2'><td>" . $item->getTypeName(1) . "&nbsp;";
     $item->dropdown(array('value' => $id, 'on_change' => 'reloadTab("' . $key . '="+this.value)'));
     echo "</td><td>" . NotificationEvent::getTypeName(1) . "&nbsp;";
     NotificationEvent::dropdownEvents($item->getType(), array('value' => $event, 'on_change' => 'reloadTab("' . $key . '_event="+this.value)'));
     echo "</td>";
     // Preview
     if ($event && $item->getFromDB($id)) {
         $options = array('_debug' => true);
         // TODO Awfull Hack waiting for https://forge.indepnet.net/issues/3439
         $multi = array('alert', 'alertnotclosed', 'end', 'notice', 'periodicity', 'periodicitynotice');
         if (in_array($event, $multi)) {
             // Won't work for Cardridge and Consumable
             $options['entities_id'] = $item->getEntityID();
             $options['items'] = array($item->getID() => $item->fields);
         }
         $target = NotificationTarget::getInstance($item, $event, $options);
         $infos = array('language' => $_SESSION['glpilanguage'], 'additionnaloption' => array('usertype' => NotificationTarget::GLPI_USER));
         $template->resetComputedTemplates();
         $template->setSignature(Notification::getMailingSignature($_SESSION['glpiactive_entity']));
         if ($tid = $template->getTemplateByLanguage($target, $infos, $event, $options)) {
             $data = $template->templates_by_languages[$tid];
             echo "<tr><th colspan='2'>" . __('Subject') . "</th></tr>";
             echo "<tr class='tab_bg_2 b'><td colspan='2'>" . $data['subject'] . "</td></tr>";
             echo "<tr><th>" . __('Email text body') . "</th>";
             echo "<th>" . __('Email HTML body') . "</th></tr>";
             echo "<tr class='tab_bg_2'><td>" . nl2br($data['content_text']) . "</td>";
             echo "<td>" . $data['content_html'] . "</td></tr>";
         }
     }
     echo "</table></div>";
 }
开发者ID:stweil,项目名称:glpi,代码行数:61,代码来源:notificationtemplatetranslation.class.php


示例4: die

/** @file
* @brief
*/
// autoload include in objecttask.form (tickettask, problemtask,...)
if (!defined('GLPI_ROOT')) {
    die("Sorry. You can't access this file directly");
}
Session::checkCentralAccess();
if (!$task instanceof CommonITILTask) {
    Html::displayErrorAndDie('');
}
if (!$task->canView()) {
    Html::displayRightError();
}
$itemtype = $task->getItilObjectItemType();
$fk = getForeignKeyFieldForItemType($itemtype);
if (isset($_POST["add"])) {
    $task->check(-1, CREATE, $_POST);
    $task->add($_POST);
    Event::log($task->getField($fk), strtolower($itemtype), 4, "tracking", sprintf(__('%s adds a task'), $_SESSION["glpiname"]));
    Html::redirect(Toolbox::getItemTypeFormURL($itemtype) . "?id=" . $task->getField($fk));
} else {
    if (isset($_POST["purge"])) {
        $task->check($_POST['id'], PURGE);
        $task->delete($_POST, 1);
        Event::log($task->getField($fk), strtolower($itemtype), 4, "tracking", sprintf(__('%s purges a task'), $_SESSION["glpiname"]));
        Html::redirect(Toolbox::getItemTypeFormURL($itemtype) . "?id=" . $task->getField($fk));
    } else {
        if (isset($_POST["update"])) {
            $task->check($_POST["id"], UPDATE);
            $task->update($_POST);
开发者ID:stweil,项目名称:glpi,代码行数:31,代码来源:commonitiltask.form.php


示例5: genericDisplayPlanningItem

 /**
  * Display a Planning Item
  *
  * @param $itemtype  itemtype
  * @param $val       Array of the item to display
  * @param $who             ID of the user (0 if all)
  * @param $type            position of the item in the time block (in, through, begin or end)
  *                         (default '')
  * @param $complete        complete display (more details) (default 0)
  *
  * @return Nothing (display function)
  **/
 static function genericDisplayPlanningItem($itemtype, array $val, $who, $type = "", $complete = 0)
 {
     global $CFG_GLPI;
     $rand = mt_rand();
     $styleText = "";
     if (isset($val["state"])) {
         switch ($val["state"]) {
             case 2:
                 // Done
                 $styleText = "color:#747474;";
                 break;
         }
     }
     $parenttype = str_replace('Task', '', $itemtype);
     if ($parent = getItemForItemtype($parenttype)) {
         $parenttype_fk = $parent->getForeignKeyField();
     } else {
         return;
     }
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/rdv_interv.png' alt='' title=\"" . Html::entities_deep($parent->getTypeName(1)) . "\">&nbsp;&nbsp;";
     echo "<img src='" . $parent->getStatusIconURL($val["status"]) . "' alt='" . Html::entities_deep($parent->getStatus($val["status"])) . "' title=\"" . Html::entities_deep($parent->getStatus($val["status"])) . "\">";
     echo "&nbsp;<a id='content_tracking_" . $val["id"] . $rand . "'\n                   href='" . Toolbox::getItemTypeFormURL($parenttype) . "?id=" . $val[$parenttype_fk] . "'\n                   style='{$styleText}'>";
     switch ($type) {
         case "in":
             //TRANS: %1$s is the start time of a planned item, %2$s is the end
             printf(__('From %1$s to %2$s :'), date("H:i", strtotime($val["begin"])), date("H:i", strtotime($val["end"])));
             break;
         case "through":
             break;
         case "begin":
             //TRANS: %s is the start time of a planned item
             printf(__('Start at %s:'), date("H:i", strtotime($val["begin"])));
             break;
         case "end":
             //TRANS: %s is the end time of a planned item
             printf(__('End at %s:'), date("H:i", strtotime($val["end"])));
             break;
     }
     echo "<br>";
     //TRANS: %1$s is name of the item, %2$d is its ID
     printf(__('%1$s (#%2$d)'), Html::resume_text($val["name"], 80), $val[$parenttype_fk]);
     if (!empty($val["device"])) {
         echo "<br>" . $val["device"];
     }
     if ($who <= 0) {
         // show tech for "show all and show group"
         echo "<br>";
         //TRANS: %s is user name
         printf(__('By %s'), getUserName($val["users_id_tech"]));
     }
     echo "</a>";
     $recall = '';
     if (isset($val[getForeignKeyFieldForItemType($itemtype)]) && PlanningRecall::isAvailable()) {
         $pr = new PlanningRecall();
         if ($pr->getFromDBForItemAndUser($val['itemtype'], $val[getForeignKeyFieldForItemType($itemtype)], Session::getLoginUserID())) {
             $recall = "<br><span class='b'>" . sprintf(__('Recall on %s'), Html::convDateTime($pr->fields['when'])) . "<span>";
         }
     }
     if ($complete) {
         echo "<br><span class='b'>";
         if (isset($val["state"])) {
             echo Planning::getState($val["state"]) . "<br>";
         }
         echo sprintf(__('%1$s: %2$s'), __('Priority'), $parent->getPriorityName($val["priority"]));
         echo "<br>" . __('Description') . "</span><br>" . $val["content"];
         echo $recall;
     } else {
         $content = "<span class='b'>";
         if (isset($val["state"])) {
             $content .= Planning::getState($val["state"]) . "<br>";
         }
         $content .= sprintf(__('%1$s: %2$s'), __('Priority'), $parent->getPriorityName($val["priority"])) . "<br>" . __('Description') . "</span><br>" . $val["content"] . $recall;
         Html::showToolTip($content, array('applyto' => "content_tracking_" . $val["id"] . $rand));
     }
 }
开发者ID:OlivierLM,项目名称:glpi,代码行数:87,代码来源:commonitiltask.class.php


示例6: genericDisplayPlanningItem

 /**
  * Display a Planning Item
  *
  * @param $itemtype  itemtype
  * @param $val       Array of the item to display
  * @param $who             ID of the user (0 if all)
  * @param $type            position of the item in the time block (in, through, begin or end)
  *                         (default '')
  * @param $complete        complete display (more details) (default 0)
  *
  * @return Nothing (display function)
  **/
 static function genericDisplayPlanningItem($itemtype, array $val, $who, $type = "", $complete = 0)
 {
     global $CFG_GLPI;
     $html = "";
     $rand = mt_rand();
     $styleText = "";
     if (isset($val["state"])) {
         switch ($val["state"]) {
             case 2:
                 // Done
                 $styleText = "color:#747474;";
                 break;
         }
     }
     $parenttype = str_replace('Task', '', $itemtype);
     if ($parent = getItemForItemtype($parenttype)) {
         $parenttype_fk = $parent->getForeignKeyField();
     } else {
         return;
     }
     $html .= "<img src='" . $CFG_GLPI["root_doc"] . "/pics/rdv_interv.png' alt='' title=\"" . Html::entities_deep($parent->getTypeName(1)) . "\">&nbsp;&nbsp;";
     $html .= "<img src='" . $parent->getStatusIconURL($val["status"]) . "' alt='" . Html::entities_deep($parent->getStatus($val["status"])) . "' title=\"" . Html::entities_deep($parent->getStatus($val["status"])) . "\">";
     $html .= "&nbsp;<a id='content_tracking_" . $val["id"] . $rand . "'\n                   href='" . Toolbox::getItemTypeFormURL($parenttype) . "?id=" . $val[$parenttype_fk] . "'\n                   style='{$styleText}'>";
     if (!empty($val["device"])) {
         $html .= "<br>" . $val["device"];
     }
     if ($who <= 0) {
         // show tech for "show all and show group"
         $html .= "<br>";
         //TRANS: %s is user name
         $html .= sprintf(__('By %s'), getUserName($val["users_id_tech"]));
     }
     $html .= "</a>";
     $recall = '';
     if (isset($val[getForeignKeyFieldForItemType($itemtype)]) && PlanningRecall::isAvailable()) {
         $pr = new PlanningRecall();
         if ($pr->getFromDBForItemAndUser($val['itemtype'], $val[getForeignKeyFieldForItemType($itemtype)], Session::getLoginUserID())) {
             $recall = "<span class='b'>" . sprintf(__('Recall on %s'), Html::convDateTime($pr->fields['when'])) . "<span>";
         }
     }
     if (isset($val["state"])) {
         $html .= "<span>";
         $html .= Planning::getState($val["state"]);
         $html .= "</span>";
     }
     $html .= "<div>";
     $html .= sprintf(__('%1$s: %2$s'), __('Priority'), $parent->getPriorityName($val["priority"]));
     $html .= "</div>";
     $html .= "<div class='event-description'>" . html_entity_decode($val["content"]) . "</div>";
     $html .= $recall;
     return $html;
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:64,代码来源:commonitiltask.class.php


示例7: pre_deleteItem

 function pre_deleteItem()
 {
     global $DB;
     //remove field in container table
     if ($this->fields['type'] !== "header" && !isset($_SESSION['uninstall_fields']) && !isset($_SESSION['delete_container'])) {
         if ($this->fields['type'] === "dropdown") {
             $oldname = $this->fields['name'];
             $this->fields['name'] = getForeignKeyFieldForItemType(PluginFieldsDropdown::getClassname($this->fields['name']));
         }
         $container_obj = new PluginFieldsContainer();
         $container_obj->getFromDB($this->fields['plugin_fields_containers_id']);
         $classname = "PluginFields" . ucfirst(strtolower($container_obj->fields['itemtype'] . preg_replace('/s$/', '', $container_obj->fields['name'])));
         $classname::removeField($this->fields['name']);
     }
     if (isset($oldname)) {
         $this->fields['name'] = $oldname;
     }
     if ($this->fields['type'] === "dropdown") {
         return PluginFieldsDropdown::destroy($this->fields['name']);
     }
     return true;
 }
开发者ID:publik1974,项目名称:fields,代码行数:22,代码来源:field.class.php


示例8: parseDropdowns

 /**
  * transform array of fields passed in parameter :
  * change value from  integer id to string name of foreign key
  * You can pass an array of array, this method is recursive.
  *
  * @param $fields     array    to check and transform
  * @param $expand     bool     array of option to enable, could be :
  *                                 - expand_dropdowns (default false)
  *                                 - get_hateoas      (default true)
  *
  * @return     array  altered $fields
  **/
 protected static function parseDropdowns($fields, $params = array())
 {
     // default params
     $default = array('expand_dropdowns' => false, 'get_hateoas' => true);
     $params = array_merge($default, $params);
     // parse fields recursively
     foreach ($fields as $key => &$value) {
         if (is_array($value)) {
             $value = self::parseDropdowns($value);
         }
         if (is_integer($key)) {
             continue;
         }
         if (isForeignKeyField($key)) {
             // specific key transformations
             if ($key == "items_id" && isset($fields['itemtype'])) {
                 $key = getForeignKeyFieldForItemType($fields['itemtype']);
             }
             if ($key == "auths_id" && isset($fields['authtype']) && $fields['authtype'] == Auth::LDAP) {
                 $key = "authldaps_id";
             }
             if ($key == "default_requesttypes_id") {
                 $key = "requesttypes_id";
             }
             if (!empty($value) || $key == 'entities_id' && $value >= 0) {
                 $tablename = getTableNameForForeignKeyField($key);
                 $itemtype = getItemTypeForTable($tablename);
                 // get hateoas
                 if ($params['get_hateoas']) {
                     $fields['links'][] = array('rel' => $itemtype, 'href' => self::$api_url . "/{$itemtype}/" . $value);
                 }
                 // expand dropdown
                 if ($params['expand_dropdowns']) {
                     $value = Dropdown::getDropdownName($tablename, $value);
                     // fix value for inexistent items
                     if ($value == "&nbsp;") {
                         $value = "";
                     }
                 }
             }
         }
     }
     return $fields;
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:56,代码来源:api.class.php


示例9: getSerialized_InventoryArray

 function getSerialized_InventoryArray($itemtype, $items_id)
 {
     $item_extend = new PluginFusioninventoryLock();
     if ($itemtype == 'Computer') {
         $item_extend = new PluginFusioninventoryInventoryComputerComputer();
     } else {
         if ($itemtype == 'NetworkEquipment') {
             $item_extend = new PluginFusioninventoryNetworkEquipment();
         } else {
             if ($itemtype == 'Printer') {
                 $item_extend = new PluginFusioninventoryPrinter();
             }
         }
     }
     if ($item_extend->getType() != 'PluginFusioninventoryLock') {
         // Get device info + field 'serialized_inventory'
         $a_lists = $item_extend->find("`" . getForeignKeyFieldForItemType($itemtype) . "`='" . $items_id . "'", "", 1);
         if (count($a_lists) == 1) {
             $a_list = current($a_lists);
             if (!empty($a_list['serialized_inventory'])) {
                 $serialized = unserialize(gzuncompress($a_list['serialized_inventory']));
                 return $serialized[$itemtype];
             }
         }
     }
     return array();
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:27,代码来源:lock.class.php


示例10: generateIcal

 /**
  *  Generate ical file content
  *
  * @param $who             user ID
  * @param $who_group       group ID
  * @param $limititemtype   itemtype only display this itemtype (default '')
  *
  * @return icalendar string
  **/
 static function generateIcal($who, $who_group, $limititemtype = '')
 {
     global $CFG_GLPI;
     if ($who === 0 && $who_group === 0) {
         return false;
     }
     if (!empty($CFG_GLPI["version"])) {
         $unique_id = "GLPI-Planning-" . trim($CFG_GLPI["version"]);
     } else {
         $unique_id = "GLPI-Planning-UnknownVersion";
     }
     // create vcalendar
     $vcalendar = new VObject\Component\VCalendar();
     // $xprops = array( "X-LIC-LOCATION" => $tz );
     // iCalUtilityFunctions::createTimezone( $v, $tz, $xprops );
     $interv = array();
     $begin = time() - MONTH_TIMESTAMP * 12;
     $end = time() + MONTH_TIMESTAMP * 12;
     $begin = date("Y-m-d H:i:s", $begin);
     $end = date("Y-m-d H:i:s", $end);
     $params = array('genical' => true, 'who' => $who, 'who_group' => $who_group, 'whogroup' => $who_group, 'begin' => $begin, 'end' => $end);
     $interv = array();
     if (empty($limititemtype)) {
         foreach ($CFG_GLPI['planning_types'] as $itemtype) {
             $interv = array_merge($interv, $itemtype::populatePlanning($params));
         }
     } else {
         $interv = $limititemtype::populatePlanning($params);
     }
     if (count($interv) > 0) {
         foreach ($interv as $key => $val) {
             if (isset($val['itemtype'])) {
                 if (isset($val[getForeignKeyFieldForItemType($val['itemtype'])])) {
                     $uid = $val['itemtype'] . "#" . $val[getForeignKeyFieldForItemType($val['itemtype'])];
                 } else {
                     $uid = "Other#" . $key;
                 }
             } else {
                 $uid = "Other#" . $key;
             }
             $vevent['UID'] = $uid;
             $vevent['DTSTART'] = new \DateTime($val["begin"]);
             $vevent['DTEND'] = new \DateTime($val["end"]);
             if (isset($val["tickets_id"])) {
                 $summary = sprintf(__('Ticket #%1$s %2$s'), $val["tickets_id"], $val["name"]);
             } else {
                 if (isset($val["name"])) {
                     $summary = $val["name"];
                 }
             }
             $vevent['SUMMARY'] = $summary;
             if (isset($val["content"])) {
                 $description = $val["content"];
                 // be sure to replace nl by \r\n
                 $description = preg_replace("/<br( [^>]*)?" . ">/i", "\r\n", $description);
                 $description = Html::clean($description);
             } else {
                 if (isset($val["name"])) {
                     $description = $val["name"];
                     // be sure to replace nl by \r\n
                     $description = preg_replace("/<br( [^>]*)?" . ">/i", "\r\n", $description);
                     $description = Html::clean($description);
                 }
             }
             $vevent['DESCRIPTION'] = $description;
             if (isset($val["url"])) {
                 $vevent['URL'] = $val["url"];
             }
             $vcalendar->add('VEVENT', $vevent);
         }
     }
     $output = $vcalendar->serialize();
     $filename = date('YmdHis') . '.ics';
     @Header("Content-Disposition: attachment; filename=\"{$filename}\"");
     @Header("Content-Length: " . Toolbox::strlen($output));
     @Header("Connection: close");
     @Header("content-type: text/calendar; charset=utf-8");
     echo $output;
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:88,代码来源:planning.class.php


示例11: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     $itemtype = $item->getType();
     switch ($ma->getAction()) {
         case "assign_auth":
             switch ($itemtype) {
                 case 'NetworkEquipment':
                     $equipement = new PluginFusioninventoryNetworkEquipment();
                     break;
                 case 'Printer':
                     $equipement = new PluginFusioninventoryPrinter();
                     break;
                 case 'PluginFusioninventoryUnmanaged':
                     $equipement = new PluginFusinvsnmpUnmanaged();
                     break;
             }
             $fk = getForeignKeyFieldForItemType($itemtype);
             foreach ($ids as $key) {
                 $found = $equipement->find("`{$fk}`='" . $key . "'");
                 $input = array();
                 if (count($found) > 0) {
                     $current = current($found);
                     $equipement->getFromDB($current['id']);
                     $input['id'] = $equipement->fields['id'];
                     $input['plugin_fusioninventory_configsecurities_id'] = $_POST['plugin_fusioninventory_configsecurities_id'];
                     $return = $equipement->update($input);
                 } else {
                     $input[$fk] = $key;
                     $input['plugin_fusioninventory_configsecurities_id'] = $_POST['plugin_fusioninventory_configsecurities_id'];
                     $return = $equipement->add($input);
                 }
                 if ($return) {
                     //set action massive ok for this item
                     $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                 } else {
                     // KO
                     $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                 }
             }
             break;
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:47,代码来源:configsecurity.class.php


示例12: populatePlanning

 static function populatePlanning($parm)
 {
     // Add items in the output array
     // Items need to have an unique index beginning by the begin date of the item to display
     // needed to be correcly displayed
     $output = array();
     $key = $parm["begin"] . "\$\$\$" . "plugin_example1";
     $output[$key]["begin"] = date("Y-m-d 17:00:00");
     $output[$key]["end"] = date("Y-m-d 18:00:00");
     $output[$key]["name"] = __("test planning example 1", 'example');
     // Specify the itemtype to be able to use specific display system
     $output[$key]["itemtype"] = "PluginExampleExample";
     // Set the ID using the ID of the item in the database to have unique ID
     $output[$key][getForeignKeyFieldForItemType('PluginExampleExample')] = 1;
     return $output;
 }
开发者ID:pluginsGLPI,项目名称:example,代码行数:16,代码来源:example.class.php


示例13: pre_deleteItem

 function pre_deleteItem()
 {
     global $DB;
     //TODO: remove labels translations
     //remove field in container table
     if ($this->fields['type'] !== "header" && !isset($_SESSION['uninstall_fields']) && !isset($_SESSION['delete_container'])) {
         if ($this->fields['type'] === "dropdown") {
             $oldname = $this->fields['name'];
             $this->fields['name'] = getForeignKeyFieldForItemType(PluginFieldsDropdown::getClassname($this->fields['name']));
         }
         $container_obj = new PluginFieldsContainer();
         $container_obj->getFromDB($this->fields['plugin_fields_containers_id']);
         foreach (json_decode($container_obj->fields['itemtypes']) as $itemtype) {
             $classname = "PluginFields" . ucfirst(strtolower($itemtype . preg_replace('/s$/', '', $container_obj->fields['name'])));
             $classname::removeField($this->fields['name']);
         }
         $classname::removeField($this->fields['name']);
     }
     //delete label translations
     $translation_obj = new PluginFieldsLabelTranslation();
     $translations = $translation_obj->find("plugin_fields_itemtype = '" . self::getType() . "' AND plugin_fields_items_id = " . $this->fields['id']);
     foreach ($translations as $translation_id => $translation) {
         $translation_obj->delete(['id' => $translation_id]);
     }
     if (isset($oldname)) {
         $this->fields['name'] = $oldname;
     }
     if ($this->fields['type'] === "dropdown") {
         return PluginFieldsDropdown::destroy($this->fields['name']);
     }
     return true;
 }
开发者ID:pluginsGLPI,项目名称:fields,代码行数:32,代码来源:field.class.php



注:本文中的getForeignKeyFieldForItemType函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP getForeignKeyFieldForTable函数代码示例发布时间:2022-05-15
下一篇:
PHP getFooter函数代码示例发布时间: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