当前位置: 首页>>代码示例>>PHP>>正文


PHP Supplier::can方法代码示例

本文整理汇总了PHP中Supplier::can方法的典型用法代码示例。如果您正苦于以下问题:PHP Supplier::can方法的具体用法?PHP Supplier::can怎么用?PHP Supplier::can使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Supplier的用法示例。


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

示例1: showForm

 public function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $DB;
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     $rand = mt_rand();
     $config = PluginOrderConfig::getConfig();
     $user = new User();
     if (isset($options['withtemplate']) && $options['withtemplate'] == 2) {
         $template = "newcomp";
         $datestring = sprintf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } elseif (isset($options['withtemplate']) && $options['withtemplate'] == 1) {
         $template = "newtemplate";
         $datestring = sprintf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         $template = false;
         $datestring = sprintf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
     }
     $canedit = $this->canUpdateOrder() && $this->canUpdate() && !$this->isCanceled();
     $cancancel = self::canCancel() && $this->can($ID, UPDATE) && $this->isCanceled();
     $options['canedit'] = $canedit;
     $options['candel'] = $cancancel;
     if ($template) {
         $this->fields['order_date'] = NULL;
     }
     // Displaying OVER BUDGET ALERT
     if ($this->fields['budgets_id'] > 0) {
         self::displayAlertOverBudget(self::isOverBudget($ID));
     }
     //Display without inside table
     /* title */
     echo "<tr class='tab_bg_1'><td>" . __("Order name", "order") . "*: </td>";
     echo "<td>";
     if ($canedit) {
         $objectName = autoName($this->fields["name"], "name", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
         Html::autocompletionTextField($this, "name", array('value' => $objectName));
     } else {
         echo $this->fields["name"];
     }
     echo "</td>";
     /* date of order */
     echo "<td>" . __("Date of order", "order") . ":</td><td>";
     if ($canedit) {
         if ($this->fields["order_date"] == NULL) {
             Html::showDateFormItem("order_date", date("Y-m-d"), true, true);
         } else {
             Html::showDateFormItem("order_date", $this->fields["order_date"], true, true);
         }
     } else {
         echo Html::convDate($this->fields["order_date"]);
     }
     echo "</td></tr>";
     /* num order */
     echo "<tr class='tab_bg_1'><td>" . __("Order number", "order");
     if ($ID > 0) {
         echo "*";
     } else {
         echo " <span class='red'>*</span>";
     }
     echo ": </td>";
     echo "<td>";
     if ($canedit) {
         $objectOrder = autoName($this->fields["num_order"], "num_order", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
         Html::autocompletionTextField($this, "num_order", array('value' => $objectOrder));
     } else {
         echo $this->fields["num_order"];
     }
     echo "</td>";
     /* type order */
     echo "<td>" . __("Type") . ": </td><td>";
     if ($canedit) {
         PluginOrderOrderType::Dropdown(array('name' => "plugin_order_ordertypes_id", 'value' => $this->fields["plugin_order_ordertypes_id"]));
     } else {
         echo Dropdown::getDropdownName("glpi_plugin_order_ordertypes", $this->fields["plugin_order_ordertypes_id"]);
     }
     echo "</td></tr>";
     /* state */
     echo "<tr class='tab_bg_1'><td>" . __("Order status", "order") . ": </td>";
     echo "<td>";
     if (!$this->getID()) {
         $state = $config->getDraftState();
     } else {
         $state = $this->fields["plugin_order_orderstates_id"];
     }
     if ($canedit) {
         PluginOrderOrderState::Dropdown(array('name' => "plugin_order_orderstates_id", 'value' => $state));
     } else {
         echo Dropdown::getDropdownName("glpi_plugin_order_orderstates", $this->getState());
     }
     echo "</td>";
     /* budget */
     echo "<td>" . __("Budget") . ": </td>";
     echo "<td>";
     if ($canedit) {
         if ($config->canHideInactiveBudgets()) {
             $restrict = " (`end_date` IS NULL) OR (`end_date`> '" . date("Y-m-d") . "')";
         } else {
             $restrict = "";
         }
         Budget::Dropdown(array('name' => "budgets_id", 'value' => $this->fields["budgets_id"], 'entity' => $this->fields["entities_id"], 'comments' => true, 'condition' => $restrict, 'width' => '150px'));
//.........这里部分代码省略.........
开发者ID:pluginsGLPI,项目名称:order,代码行数:101,代码来源:order.class.php

示例2: showForSupplier

 /**
  * Print an HTML array with contracts associated to the enterprise
  *
  * @since version 0.84
  *
  * @param $supplier   Supplier object
  *
  * @return Nothing (display)
  **/
 static function showForSupplier(Supplier $supplier)
 {
     global $DB, $CFG_GLPI;
     $ID = $supplier->fields['id'];
     if (!Session::haveRight("contract", "r") || !$supplier->can($ID, 'r')) {
         return false;
     }
     $canedit = $supplier->can($ID, 'w');
     $rand = mt_rand();
     $query = "SELECT `glpi_contracts`.*,\n                       `glpi_contracts_suppliers`.`id` AS assocID,\n                       `glpi_entities`.`id` AS entity\n                FROM `glpi_contracts_suppliers`, `glpi_contracts`\n                LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id`=`glpi_contracts`.`entities_id`)\n                WHERE `glpi_contracts_suppliers`.`suppliers_id` = '{$ID}'\n                      AND `glpi_contracts_suppliers`.`contracts_id`=`glpi_contracts`.`id`" . getEntitiesRestrictRequest(" AND", "glpi_contracts", '', '', true) . "\n                ORDER BY `glpi_entities`.`completename`,\n                         `glpi_contracts`.`name`";
     $result = $DB->query($query);
     $contracts = array();
     $used = array();
     if ($number = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
             $contracts[$data['assocID']] = $data;
             $used[$data['id']] = $data['id'];
         }
     }
     if ($canedit) {
         echo "<div class='firstbloc'>";
         echo "<form name='contractsupplier_form{$rand}' id='contractsupplier_form{$rand}' method='post'\n                action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
         echo "<input type='hidden' name='suppliers_id' value='{$ID}'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_2'><th colspan='2'>" . __('Add a contract') . "</th></tr>";
         echo "<tr class='tab_bg_1'><td class='right'>";
         Contract::dropdown(array('used' => $used, 'entity' => $supplier->fields["entities_id"], 'entity_sons' => $supplier->fields["is_recursive"], 'nochecklimit' => true));
         echo "</td><td class='center'>";
         echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($canedit && $number) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('num_displayed' => $number);
         Html::showMassiveActions(__CLASS__, $massiveactionparams);
     }
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr>";
     if ($canedit && $number) {
         echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
     }
     echo "<th>" . __('Name') . "</th>";
     echo "<th>" . __('Entity') . "</th>";
     echo "<th>" . _x('phone', 'Number') . "</th>";
     echo "<th>" . __('Contract type') . "</th>";
     echo "<th>" . __('Start date') . "</th>";
     echo "<th>" . __('Initial contract period') . "</th>";
     echo "</tr>";
     $used = array();
     foreach ($contracts as $data) {
         $cID = $data["id"];
         $used[$cID] = $cID;
         $assocID = $data["assocID"];
         echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
         if ($canedit) {
             echo "<td>";
             Html::showMassiveActionCheckBox(__CLASS__, $data["assocID"]);
             echo "</td>";
         }
         $name = $data["name"];
         if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) {
             $name = sprintf(__('%1$s (%2$s)'), $name, $data["id"]);
         }
         echo "<td class='center b'>\n               <a href='" . $CFG_GLPI["root_doc"] . "/front/contract.form.php?id={$cID}'>" . $name . "</a>";
         echo "</td>";
         echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data["entity"]);
         echo "</td><td class='center'>" . $data["num"] . "</td>";
         echo "<td class='center'>" . Dropdown::getDropdownName("glpi_contracttypes", $data["contracttypes_id"]) . "</td>";
         echo "<td class='center'>" . Html::convDate($data["begin_date"]) . "</td>";
         echo "<td class='center'>";
         sprintf(_n('%d month', '%d months', $data["duration"]), $data["duration"]);
         if ($data["begin_date"] != '' && !empty($data["begin_date"])) {
             echo " -> " . Infocom::getWarrantyExpir($data["begin_date"], $data["duration"], 0, true);
         }
         echo "</td>";
         echo "</tr>";
     }
     echo "</table>";
     if ($canedit && $number) {
         $paramsma['ontop'] = false;
         Html::showMassiveActions(__CLASS__, $paramsma);
         Html::closeForm();
     }
     echo "</div>";
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:98,代码来源:contract_supplier.class.php

示例3: showForSupplier

 /**
  * Show webapplications associated to an item
  *
  * @since version 0.84
  *
  * @param $item            Supplier object for which associated webapplications must be displayed
  * @param $withtemplate    (default '')
  **/
 static function showForSupplier(Supplier $item, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $ID = $item->getField('id');
     if ($item->isNewID($ID)) {
         return false;
     }
     if (!Session::haveRight("plugin_webapplications", READ)) {
         return false;
     }
     if (!$item->can($item->fields['id'], READ)) {
         return false;
     }
     if (empty($withtemplate)) {
         $withtemplate = 0;
     }
     $rand = mt_rand();
     $is_recursive = $item->isRecursive();
     $query = "SELECT `glpi_entities`.`id` AS entity,\n                        `glpi_plugin_webapplications_webapplications`.`id` AS assocID,\n                       `glpi_plugin_webapplications_webapplications`.`name` AS assocName,\n                       `glpi_plugin_webapplications_webapplications`.*\n                FROM `glpi_plugin_webapplications_webapplications`\n                LEFT JOIN `glpi_entities` ON (`glpi_plugin_webapplications_webapplications`.`entities_id`=`glpi_entities`.`id`)\n                WHERE `glpi_plugin_webapplications_webapplications`.`suppliers_id` = '{$ID}' ";
     $query .= getEntitiesRestrictRequest(" AND", "glpi_plugin_webapplications_webapplications", '', '', true);
     $query .= " ORDER BY `assocName`";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     $i = 0;
     $webs = array();
     if ($numrows = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
             $webs[$data['assocID']] = $data;
         }
     }
     echo "<div class='spaced'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr>";
     echo "<th>" . __('Name') . "</th>";
     if (Session::isMultiEntitiesMode()) {
         echo "<th>" . __('Entity') . "</th>";
     }
     echo "<th>" . PluginWebapplicationsWebapplicationType::getTypeName(1) . "</th>";
     echo "<th>" . __('URL') . "</th>";
     echo "<th>" . __('Server') . "</th>";
     echo "<th>" . __('Language') . "</th>";
     echo "<th>" . __('Version') . "</th>";
     echo "<th>" . __('Comments') . "</th>";
     echo "</tr>";
     $used = array();
     if ($number) {
         Session::initNavigateListItems('PluginWebapplicationsWebapplication', sprintf(__('%1$s = %2$s'), $item->getTypeName(1), $item->getName()));
         $web = new PluginWebapplicationsWebapplication();
         foreach ($webs as $data) {
             $webID = $data["id"];
             $link = NOT_AVAILABLE;
             if ($web->getFromDB($webID)) {
                 $link = $web->getLink();
             }
             Session::addToNavigateListItems('PluginWebapplicationsWebapplication', $webID);
             $assocID = $data["assocID"];
             echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
             echo "<td class='center'>{$link}</td>";
             if (Session::isMultiEntitiesMode()) {
                 echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data['entities_id']) . "</td>";
             }
             echo "<td>" . Dropdown::getDropdownName("glpi_plugin_webapplications_webapplicationtypes", $data["plugin_webapplications_webapplicationtypes_id"]) . "</td>";
             $link = Toolbox::substr($data["address"], 0, 30) . "...";
             echo "<td class='center'>" . "<a href=\"" . str_replace("&", "&amp;", $data["address"]) . "\" target=\"_blank\">" . "<u>" . $link . "</u></a></td>";
             echo "<td>" . Dropdown::getDropdownName("glpi_plugin_webapplications_webapplicationservertypes", $data["plugin_webapplications_webapplicationservertypes_id"]) . "</td>";
             echo "<td>" . Dropdown::getDropdownName("glpi_plugin_webapplications_webapplicationtechnics", $data["plugin_webapplications_webapplicationtechnics_id"]) . "</td>";
             echo "<td>" . $data["version"] . "</td>";
             echo "<td>" . $data["comment"] . "</td>";
             echo "</tr>";
             $i++;
         }
     }
     echo "</table>";
     echo "</div>";
 }
开发者ID:wittwerch,项目名称:webapplications,代码行数:83,代码来源:webapplication_item.class.php

示例4: showForSupplier

 /**
  * Show contacts asociated to an enterprise
  **/
 static function showForSupplier(Supplier $supplier)
 {
     global $DB, $CFG_GLPI;
     $instID = $supplier->fields['id'];
     if (!$supplier->can($instID, READ)) {
         return false;
     }
     $canedit = $supplier->can($instID, UPDATE);
     $rand = mt_rand();
     $query = "SELECT `glpi_contacts`.*,\n                       `glpi_contacts_suppliers`.`id` AS ID_ent,\n                       `glpi_entities`.`id` AS entity\n                FROM `glpi_contacts_suppliers`, `glpi_contacts`\n                LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id`=`glpi_contacts`.`entities_id`)\n                WHERE `glpi_contacts_suppliers`.`contacts_id`=`glpi_contacts`.`id`\n                      AND `glpi_contacts_suppliers`.`suppliers_id` = '{$instID}'" . getEntitiesRestrictRequest(" AND", "glpi_contacts", '', '', true) . "\n                ORDER BY `glpi_entities`.`completename`, `glpi_contacts`.`name`";
     $result = $DB->query($query);
     $contacts = array();
     $used = array();
     if ($number = $DB->numrows($result)) {
         while ($data = $DB->fetch_assoc($result)) {
             $contacts[$data['ID_ent']] = $data;
             $used[$data['id']] = $data['id'];
         }
     }
     if ($canedit) {
         echo "<div class='firstbloc'>";
         echo "<form name='contactsupplier_form{$rand}' id='contactsupplier_form{$rand}'\n                method='post' action='";
         echo Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><th colspan='2'>" . __('Add a contact') . "</tr>";
         echo "<tr class='tab_bg_2'><td class='center'>";
         echo "<input type='hidden' name='suppliers_id' value='{$instID}'>";
         Contact::dropdown(array('used' => $used, 'entity' => $supplier->fields["entities_id"], 'entity_sons' => $supplier->fields["is_recursive"]));
         echo "</td><td class='center'>";
         echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         echo "</div>";
     }
     echo "<div class='spaced'>";
     if ($canedit && $number) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('num_displayed' => $number, 'container' => 'mass' . __CLASS__ . $rand);
         Html::showMassiveActions($massiveactionparams);
     }
     echo "<table class='tab_cadre_fixehov'>";
     $header_begin = "<tr>";
     $header_top = '';
     $header_bottom = '';
     $header_end = '';
     if ($canedit && $number) {
         $header_top .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_top .= "</th>";
         $header_bottom .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
         $header_bottom .= "</th>";
     }
     $header_end .= "<th>" . __('Name') . "</th>";
     $header_end .= "<th>" . __('Entity') . "</th>";
     $header_end .= "<th>" . __('Phone') . "</th>";
     $header_end .= "<th>" . __('Phone 2') . "</th>";
     $header_end .= "<th>" . __('Mobile phone') . "</th>";
     $header_end .= "<th>" . __('Fax') . "</th>";
     $header_end .= "<th>" . _n('Email', 'Emails', 1) . "</th>";
     $header_end .= "<th>" . __('Type') . "</th>";
     $header_end .= "</tr>";
     echo $header_begin . $header_top . $header_end;
     $used = array();
     if ($number) {
         Session::initNavigateListItems('Contact', sprintf(__('%1$s = %2$s'), Supplier::getTypeName(1), $supplier->getName()));
         foreach ($contacts as $data) {
             $ID = $data["ID_ent"];
             $used[$data["id"]] = $data["id"];
             Session::addToNavigateListItems('Contact', $data["id"]);
             echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
             if ($canedit) {
                 echo "<td>" . Html::getMassiveActionCheckBox(__CLASS__, $data["ID_ent"]) . "</td>";
             }
             echo "<td class='center'>";
             echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/contact.form.php?id=" . $data["id"] . "'>" . sprintf(__('%1$s %2$s'), $data["name"], $data["firstname"]) . "</a></td>";
             echo "<td class='center' width='100'>" . Dropdown::getDropdownName("glpi_entities", $data["entity"]);
             echo "</td>";
             echo "<td class='center' width='100'>" . $data["phone"] . "</td>";
             echo "<td class='center' width='100'>" . $data["phone2"] . "</td>";
             echo "<td class='center' width='100'>" . $data["mobile"] . "</td>";
             echo "<td class='center' width='100'>" . $data["fax"] . "</td>";
             echo "<td class='center'>";
             echo "<a href='mailto:" . $data["email"] . "'>" . $data["email"] . "</a></td>";
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_contacttypes", $data["contacttypes_id"]) . "</td>";
             echo "</tr>";
         }
         echo $header_begin . $header_bottom . $header_end;
     }
     echo "</table>";
     if ($canedit && $number) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions($massiveactionparams);
         Html::closeForm();
     }
     echo "</div>";
 }
开发者ID:jose-martins,项目名称:glpi,代码行数:99,代码来源:contact_supplier.class.php

示例5: showPluginFromSupplier

 function showPluginFromSupplier($ID, $withtemplate = '')
 {
     global $DB, $CFG_GLPI;
     $item = new Supplier();
     $canread = $item->can($ID, 'r');
     $canedit = $item->can($ID, 'w');
     $query = "SELECT `glpi_plugin_databases_databases`.* " . "FROM `glpi_plugin_databases_databases` " . " LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id` = `glpi_plugin_databases_databases`.`entities_id`) " . " WHERE `suppliers_id` = '{$ID}' " . getEntitiesRestrictRequest(" AND ", "glpi_plugin_databases_databases", '', '', $this->maybeRecursive());
     $query .= " ORDER BY `glpi_plugin_databases_databases`.`name` ";
     $result = $DB->query($query);
     $number = $DB->numrows($result);
     if (Session::isMultiEntitiesMode()) {
         $colsup = 1;
     } else {
         $colsup = 0;
     }
     if ($withtemplate != 2) {
         echo "<form method='post' action=\"" . $CFG_GLPI["root_doc"] . "/plugins/databases/front/database.form.php\">";
     }
     echo "<div align='center'><table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='" . (4 + $colsup) . "'>" . _n('Database associated', 'Databases associated', 2, 'databases') . "</th></tr>";
     echo "<tr><th>" . __('Name') . "</th>";
     if (Session::isMultiEntitiesMode()) {
         echo "<th>" . __('Entity') . "</th>";
     }
     echo "<th>" . PluginDatabasesDatabaseCategory::getTypeName(1) . "</th>";
     echo "<th>" . __('Type') . "</th>";
     echo "<th>" . __('Comments') . "</th>";
     echo "</tr>";
     while ($data = $DB->fetch_array($result)) {
         echo "<tr class='tab_bg_1" . ($data["is_deleted"] == '1' ? "_2" : "") . "'>";
         if ($withtemplate != 3 && $canread && (in_array($data['entities_id'], $_SESSION['glpiactiveentities']) || $data["is_recursive"])) {
             echo "<td class='center'><a href='" . $CFG_GLPI["root_doc"] . "/plugins/databases/front/database.form.php?id=" . $data["id"] . "'>" . $data["name"];
             if ($_SESSION["glpiis_ids_visible"]) {
                 echo " (" . $data["id"] . ")";
             }
             echo "</a></td>";
         } else {
             echo "<td class='center'>" . $data["name"];
             if ($_SESSION["glpiis_ids_visible"]) {
                 echo " (" . $data["id"] . ")";
             }
             echo "</td>";
         }
         echo "</a></td>";
         if (Session::isMultiEntitiesMode()) {
             echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data['entities_id']) . "</td>";
         }
         echo "<td>" . Dropdown::getDropdownName("glpi_plugin_databases_databasetypes", $data["plugin_databases_databasetypes_id"]) . "</td>";
         echo "<td>" . Dropdown::getDropdownName("glpi_plugin_databases_servertypes", $data["plugin_databases_servertypes_id"]) . "</td>";
         echo "<td>" . $data["comment"] . "</td></tr>";
     }
     echo "</table></div>";
     Html::closeForm();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:54,代码来源:database.class.php

示例6: showForm

 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $config = PluginOrderConfig::getConfig();
     $user = new User();
     if (!self::canView()) {
         return false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
         $this->getEmpty();
     }
     if (isset($options['withtemplate']) && $options['withtemplate'] == 2) {
         $template = "newcomp";
         $datestring = sprintf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
     } else {
         if (isset($options['withtemplate']) && $options['withtemplate'] == 1) {
             $template = "newtemplate";
             $datestring = sprintf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"]));
         } else {
             $datestring = sprintf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"]));
             $template = false;
         }
     }
     $canedit = $this->canUpdateOrder() && $this->can($ID, 'w') && !$this->isCanceled();
     $cancancel = self::canCancel() && $this->can($ID, 'w') && $this->isCanceled();
     $options['canedit'] = $canedit;
     $options['candel'] = $cancancel;
     if ($template) {
         $this->fields['order_date'] = NULL;
     }
     // Displaying OVER BUDGET ALERT
     if ($this->fields['budgets_id'] > 0) {
         self::displayAlertOverBudget(self::isOverBudget($ID));
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     //Display without inside table
     /* title */
     echo "<tr class='tab_bg_1'><td>" . __("Order name", "order") . "*: </td>";
     echo "<td>";
     if ($canedit) {
         $objectName = autoName($this->fields["name"], "name", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
         Html::autocompletionTextField($this, "name", array('value' => $objectName));
     } else {
         echo $this->fields["name"];
     }
     echo "</td>";
     /* date of order */
     echo "<td>" . __("Date of order", "order") . ":</td><td>";
     if ($canedit) {
         if ($this->fields["order_date"] == NULL) {
             Html::showDateFormItem("order_date", date("Y-m-d"), true, true);
         } else {
             Html::showDateFormItem("order_date", $this->fields["order_date"], true, true);
         }
     } else {
         echo Html::convDate($this->fields["order_date"]);
     }
     echo "</td></tr>";
     /* num order */
     echo "<tr class='tab_bg_1'><td>" . __("Order number", "order") . "*: </td>";
     echo "<td>";
     if ($canedit) {
         $objectOrder = autoName($this->fields["num_order"], "num_order", $template === "newcomp", $this->getType(), $this->fields["entities_id"]);
         Html::autocompletionTextField($this, "num_order", array('value' => $objectOrder));
     } else {
         echo $this->fields["num_order"];
     }
     echo "</td>";
     /* type order */
     echo "<td>" . __("Type") . ": </td><td>";
     if ($canedit) {
         PluginOrderOrderType::Dropdown(array('name' => "plugin_order_ordertypes_id", 'value' => $this->fields["plugin_order_ordertypes_id"]));
     } else {
         echo Dropdown::getDropdownName("glpi_plugin_order_ordertypes", $this->fields["plugin_order_ordertypes_id"]);
     }
     echo "</td></tr>";
     /* state */
     echo "<tr class='tab_bg_1'><td>" . __("Order status", "order") . ": </td>";
     echo "<td>";
     if (!$this->getID()) {
         $state = $config->getDraftState();
     } else {
         $state = $this->fields["plugin_order_orderstates_id"];
     }
     if ($canedit) {
         PluginOrderOrderState::Dropdown(array('name' => "plugin_order_orderstates_id", 'value' => $state));
     } else {
         echo Dropdown::getDropdownName("glpi_plugin_order_orderstates", $this->getState());
     }
     echo "</td>";
     /* budget */
     echo "<td>" . __("Budget") . ": </td><td>";
     if ($canedit) {
         Budget::Dropdown(array('name' => "budgets_id", 'value' => $this->fields["budgets_id"], 'entity' => $this->fields["entities_id"], 'comments' => true));
     } else {
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:order.class.php

示例7: Supplier

    exit;
}
if (!isset($_REQUEST['glpi_tab'])) {
    exit;
}
if (!isset($_POST["start"])) {
    $_POST["start"] = 0;
}
if (!isset($_POST["sort"])) {
    $_POST["sort"] = "";
}
if (!isset($_POST["order"])) {
    $_POST["order"] = "";
}
$supplier = new Supplier();
if ($_POST["id"] > 0 && $supplier->can($_POST["id"], 'r')) {
    switch ($_REQUEST['glpi_tab']) {
        case -1:
            $supplier->showContacts();
            $supplier->showContracts();
            Document::showAssociated($supplier);
            Ticket::showListForSupplier($_POST["id"]);
            Link::showForItem('Supplier', $_POST["id"]);
            Plugin::displayAction($supplier, $_REQUEST['glpi_tab']);
            break;
        case 4:
            $supplier->showContracts();
            break;
        case 5:
            Document::showAssociated($supplier);
            break;
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:supplier.tabs.php


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