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


PHP Contract_Item::delete方法代码示例

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


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

示例1: foreach

         Event::log($_POST["id"], "contracts", 4, "financial", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
     }
     glpi_header($_SERVER['HTTP_REFERER']);
 } else {
     if (isset($_POST["additem"])) {
         $contractitem->check(-1, 'w', $_POST);
         if ($contractitem->add($_POST)) {
             Event::log($_POST["contracts_id"], "contracts", 4, "financial", $_SESSION["glpiname"] . " " . $LANG['log'][32]);
         }
         glpi_header($_SERVER['HTTP_REFERER']);
     } else {
         if (isset($_POST["deleteitem"])) {
             if (count($_POST["item"])) {
                 foreach ($_POST["item"] as $key => $val) {
                     if ($contractitem->can($key, 'w')) {
                         $contractitem->delete(array('id' => $key));
                     }
                 }
             }
             Event::log($_POST["contracts_id"], "contracts", 4, "financial", $_SESSION["glpiname"] . " " . $LANG['log'][33]);
             glpi_header($_SERVER['HTTP_REFERER']);
         } else {
             if (isset($_GET["deleteitem"])) {
                 $contractitem->check($_GET["id"], 'w');
                 if ($contractitem->delete($_GET)) {
                     Event::log($_GET["contracts_id"], "contracts", 4, "financial", $_SESSION["glpiname"] . " " . $LANG['log'][33]);
                 }
                 glpi_header($_SERVER['HTTP_REFERER']);
             } else {
                 if (isset($_POST["addcontractsupplier"])) {
                     $contractsupplier->check(-1, 'w', $POST);
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:contract.form.php

示例2: doMassiveActions

 /**
  * Do the standard massive actions
  *
  * @since version 0.84
  *
  * This must not be overloaded in Class
  * @param $input array of input datas
  *
  * @return an array of results (ok, ko, noright counts, may include REDIRECT field to set REDIRECT page)
  **/
 function doMassiveActions($input = array())
 {
     global $CFG_GLPI;
     if (!isset($input["item"]) || count($input["item"]) == 0) {
         return false;
     }
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case 'add_document':
         case 'remove_document':
             $doc = new Document();
             return $doc->doSpecificMassiveActions($input);
         case "add_transfer_list":
             if (!isset($_SESSION['glpitransfer_list'])) {
                 $_SESSION['glpitransfer_list'] = array();
             }
             if (!isset($_SESSION['glpitransfer_list'][$input["itemtype"]])) {
                 $_SESSION['glpitransfer_list'][$input["itemtype"]] = array();
             }
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     $_SESSION['glpitransfer_list'][$input["itemtype"]][$key] = $key;
                     $res['ok']++;
                 }
             }
             $res['REDIRECT'] = $CFG_GLPI['root_doc'] . '/front/transfer.action.php';
             break;
         case "delete":
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if ($this->can($key, 'd')) {
                         if ($this->delete(array("id" => $key))) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         case "purge":
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if ($this->can($key, 'd')) {
                         $force = 1;
                         // Only mark deletion for
                         if ($this->maybeDeleted() && $this->useDeletedToLockIfDynamic() && $this->isDynamic()) {
                             $force = 0;
                         }
                         if ($this->delete(array("id" => $key), $force)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         case "restore":
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if ($this->can($key, 'd')) {
                         if ($this->restore(array("id" => $key))) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         case "update":
             $searchopt = Search::getCleanedOptions($input["itemtype"], 'w');
             if (isset($searchopt[$input["id_field"]])) {
                 /// Infocoms case
                 if (!isPluginItemType($input["itemtype"]) && Search::isInfocomOption($input["itemtype"], $input["id_field"])) {
                     $ic = new Infocom();
                     $link_entity_type = -1;
                     /// Specific entity item
                     if ($searchopt[$input["id_field"]]["table"] == "glpi_suppliers") {
                         $ent = new Supplier();
                         if ($ent->getFromDB($input[$input["field"]])) {
                             $link_entity_type = $ent->fields["entities_id"];
                         }
//.........这里部分代码省略.........
开发者ID:gaforeror,项目名称:glpi,代码行数:101,代码来源:commondbtm.class.php


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