當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。