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


PHP CommonDBRelation::doSpecificMassiveActions方法代码示例

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


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

示例1: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:korial29,项目名称:tag,代码行数:12,代码来源:tagitem.class.php

示例2: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  *
  * @since version 0.84
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "solveticket":
             $ticket = new Ticket();
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if ($this->can($key, 'r')) {
                         if ($ticket->getFromDB($this->fields['tickets_id']) && $ticket->canSolve()) {
                             $toupdate = array();
                             $toupdate['id'] = $ticket->getID();
                             $toupdate['solutiontypes_id'] = $input['solutiontypes_id'];
                             $toupdate['solution'] = $input['solution'];
                             if ($ticket->update($toupdate)) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:38,代码来源:problem_ticket.class.php

示例3: doSpecificMassiveActions

 /**
  * Do the specific massive actions
  *
  * @since version 0.84
  *
  * @param $input array of input datas
  *
  * @return an array of results (nbok, nbko, nbnoright counts)
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     $typo_item = new PluginTypologyTypology_Item();
     switch ($input['action']) {
         case "delete_item":
             if ($input['itemtype'] == 'PluginTypologyTypology_Item') {
                 foreach ($input["item"] as $key => $val) {
                     if ($val != 0) {
                         $typo_item->getFromDB($key);
                         if ($typo_item->delete(array('id' => $key))) {
                             $values = array('plugin_typology_typologies_id' => $input['plugin_typology_typologies_id'], 'items_id' => $typo_item->fields['items_id'], 'itemtype' => $typo_item->fields['itemtype']);
                             PluginTypologyTypology_Item::addLog($values, PluginTypologyTypology_Item::LOG_DELETE);
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     }
                 }
             }
             break;
         case "update_allitem":
             if ($input['itemtype'] == 'PluginTypologyTypology_Item') {
                 foreach ($input["item"] as $key => $val) {
                     if ($val != 0) {
                         $typo_item->getFromDB($key);
                         $result = PluginTypologyTypology_Item::checkValidated(array('items_id' => $typo_item->fields['items_id'], 'plugin_typology_typologies_id' => $typo_item->fields['plugin_typology_typologies_id'], 'id' => $typo_item->fields['id']));
                         if ($typo_item->update($result)) {
                             $values = array('plugin_typology_typologies_id' => $typo_item->fields['plugin_typology_typologies_id'], 'items_id' => $typo_item->fields['items_id'], 'itemtype' => $typo_item->fields['itemtype']);
                             PluginTypologyTypology_Item::addLog($values, PluginTypologyTypology_Item::LOG_UPDATE);
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:52,代码来源:typology_item.class.php

示例4: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "add_user_group":
         case "add_supervisor_group":
         case "add_delegatee_group":
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if (isset($input['users_id'])) {
                         // Add users to groups
                         $input2 = array('groups_id' => $key, 'users_id' => $input['users_id']);
                     } else {
                         if (isset($input['groups_id'])) {
                             // Add groups to users
                             $input2 = array('groups_id' => $input["groups_id"], 'users_id' => $key);
                         } else {
                             return false;
                         }
                     }
                     $updateifnotfound = false;
                     if ($input["action"] == 'add_supervisor_group') {
                         $input2['is_manager'] = 1;
                         $updateifnotfound = true;
                     }
                     if ($input["action"] == 'add_delegatee_group') {
                         $input2['is_userdelegate'] = 1;
                         $updateifnotfound = true;
                     }
                     $group = new Group();
                     $user = new user();
                     if ($group->getFromDB($input2['groups_id']) && $user->getFromDB($input2['users_id'])) {
                         if ($updateifnotfound && $this->getFromDBForItems($user, $group)) {
                             if ($this->can($this->getID(), 'w')) {
                                 $input2['id'] = $this->getID();
                                 if ($this->update($input2)) {
                                     $res['ok']++;
                                 } else {
                                     $res['ko']++;
                                 }
                             } else {
                                 $res['noright']++;
                             }
                         } else {
                             if ($this->can(-1, 'w', $input2)) {
                                 if ($this->add($input2)) {
                                     $res['ok']++;
                                 } else {
                                     $res['ko']++;
                                 }
                             } else {
                                 $res['noright']++;
                             }
                         }
                     } else {
                         $res['ko']++;
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:68,代码来源:group_user.class.php

示例5: doSpecificMassiveActions

 /**
  * @since version 0.84
  *
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "move_license":
             if (isset($input['softwarelicenses_id'])) {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         //Get software name and manufacturer
                         if ($this->can($key, 'w')) {
                             //Process rules
                             if ($this->update(array('id' => $key, 'softwarelicenses_id' => $input['softwarelicenses_id']))) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
             } else {
                 $res['ko']++;
             }
             break;
         case "install":
             $csl = new self();
             $csv = new Computer_SoftwareVersion();
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if ($csl->getFromDB($key)) {
                         $sl = new SoftwareLicense();
                         if ($sl->getFromDB($csl->fields["softwarelicenses_id"])) {
                             $version = 0;
                             if ($sl->fields["softwareversions_id_use"] > 0) {
                                 $version = $sl->fields["softwareversions_id_use"];
                             } else {
                                 $version = $sl->fields["softwareversions_id_buy"];
                             }
                             if ($version > 0) {
                                 $params = array('computers_id' => $csl->fields['computers_id'], 'softwareversions_id' => $version);
                                 //Get software name and manufacturer
                                 if ($csv->can(-1, 'w', $params)) {
                                     //Process rules
                                     if ($csv->add($params)) {
                                         $res['ok']++;
                                     } else {
                                         $res['ko']++;
                                     }
                                 } else {
                                     $res['noright']++;
                                 }
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['ko']++;
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:74,代码来源:computer_softwarelicense.class.php

示例6: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "add_contact_supplier":
             $contactsupplier = new Contact_Supplier();
             foreach ($input["item"] as $key => $val) {
                 if (isset($input['contacts_id'])) {
                     $input = array('suppliers_id' => $key, 'contacts_id' => $input['contacts_id']);
                 } else {
                     if (isset($input['suppliers_id'])) {
                         $input = array('suppliers_id' => $input['suppliers_id'], 'contacts_id' => $key);
                     } else {
                         return false;
                     }
                 }
                 if ($contactsupplier->can(-1, 'w', $input)) {
                     if ($contactsupplier->add($input)) {
                         $res['ok']++;
                     } else {
                         $res['ko']++;
                     }
                 } else {
                     $res['noright']++;
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:35,代码来源:contact_supplier.class.php

示例7: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "connect":
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if (isset($input["computers_id"])) {
                         $input2 = array('computers_id' => $input["computers_id"], 'itemtype' => $input["itemtype"], 'items_id' => $key);
                     } else {
                         if (isset($input["items_id"])) {
                             $input2 = array('computers_id' => $key, 'itemtype' => $input["item_itemtype"], 'items_id' => $input["items_id"]);
                         } else {
                             return false;
                         }
                     }
                     if ($this->can(-1, 'w', $input2)) {
                         if ($this->add($input2)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         case "disconnect":
             if (!($item = getItemForItemtype($input["itemtype"]))) {
                 return false;
             }
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if ($item->can($key, 'd')) {
                         if ($this->disconnectForItem($item)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:54,代码来源:computer_item.class.php

示例8: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  * @param array $input
  * @return array
  */
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case 'deleteSelected':
             if (isset($_POST['itemtype']) && $_POST['itemtype'] == 'PluginFpsoftwareCommon' && isset($_POST['item']) && is_array($_POST['item'])) {
                 foreach ($_POST['item'] as $id => $val) {
                     self::deleteItem($id);
                     $res['ok']++;
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:dawidplocki,项目名称:glpi-fpsoftware,代码行数:24,代码来源:common.class.php

示例9: doSpecificMassiveActions

 /**
  * @since version 0.84
  *
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "move_version":
             if (isset($input['softwareversions_id'])) {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         //Get software name and manufacturer
                         if ($this->can($key, 'w')) {
                             //Process rules
                             if ($this->update(array('id' => $key, 'softwareversions_id' => $input['softwareversions_id']))) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:35,代码来源:computer_softwareversion.class.php


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