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


PHP CommonDBTM::doSpecificMassiveActions方法代码示例

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


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

示例1: doSpecificMassiveActions

 /**
  * @since version 0.84
  *
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "delete_for_user":
             if (isset($input['users_id'])) {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         //Get software name and manufacturer
                         if ($input['users_id'] == Session::getLoginUserID()) {
                             //Process rules
                             if ($this->deleteByCriteria(array('users_id' => $input['users_id'], 'itemtype' => $key))) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:35,代码来源:displaypreference.class.php

示例2: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case 'merge':
             $fk = $this->getForeignKeyField();
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if ($this->can($key, 'w')) {
                         if ($this->getEntityID() == $_SESSION['glpiactive_entity']) {
                             if ($this->update(array('id' => $key, 'is_recursive' => 1))) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $input2 = $this->fields;
                             // Remove keys (and name, tree dropdown will use completename)
                             if ($this instanceof CommonTreeDropdown) {
                                 unset($input2['id'], $input2['name'], $input2[$fk]);
                             } else {
                                 unset($input2['id']);
                             }
                             // Change entity
                             $input2['entities_id'] = $_SESSION['glpiactive_entity'];
                             $input2['is_recursive'] = 1;
                             $input2 = Toolbox::addslashes_deep($input2);
                             // Import new
                             if ($newid = $this->import($input2)) {
                                 // Delete old
                                 if ($newid > 0) {
                                     // delete with purge for dropdown with dustbin (Budget)
                                     $this->delete(array('id' => $key, '_replace_by' => $newid), 1);
                                 }
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:53,代码来源:commondropdown.class.php

示例3: 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();
             return $contactsupplier->doSpecificMassiveActions($input);
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return false;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:15,代码来源:supplier.class.php

示例4: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "mergesoftware":
             if (isset($input["id"]) && isset($input["item"]) && is_array($input["item"]) && count($input["item"])) {
                 if ($this->can($_POST["id"], 'w')) {
                     if ($this->merge($_POST["item"])) {
                         $res['ok']++;
                     } else {
                         $res['ko']++;
                     }
                 } else {
                     $res['noright']++;
                 }
             } else {
                 $res['ko']++;
             }
             break;
         case "compute_software_category":
             $softcatrule = new RuleSoftwareCategoryCollection();
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     $params = array();
                     //Get software name and manufacturer
                     if ($this->can($key, 'w')) {
                         $params["name"] = $this->fields["name"];
                         $params["manufacturers_id"] = $this->fields["manufacturers_id"];
                         $params["comment"] = $this->fields["comment"];
                         $output = array();
                         $output = $softcatrule->processAllRules(null, $output, $params);
                         //Process rules
                         if (isset($output['softwarecategories_id']) && $this->update(array('id' => $key, 'softwarecategories_id' => $output['softwarecategories_id']))) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         case "replay_dictionnary":
             $softdictionnayrule = new RuleDictionnarySoftwareCollection();
             $ids = array();
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if ($this->can($key, 'w')) {
                         $ids[] = $key;
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             if ($softdictionnayrule->replayRulesOnExistingDB(0, 0, $ids) > 0) {
                 $res['ok'] += count($ids);
             } else {
                 $res['ko'] += count($ids);
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:69,代码来源:software.class.php

示例5: doSpecificMassiveActions

 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     $projet_item = new PluginProjetProjet_Item();
     switch ($input['action']) {
         case "Transfert":
             if ($input['itemtype'] == 'PluginProjetTask') {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         $this->getFromDB($key);
                         $tasktype = PluginProjetTaskType::transfer($this->fields["plugin_projet_tasktypes_id"], $input['entities_id']);
                         if ($tasktype > 0) {
                             $values["id"] = $key;
                             $values["plugin_projet_tasktypes_id"] = $tasktype;
                             $this->update($values);
                         }
                         unset($values);
                         $values["id"] = $key;
                         $values["entities_id"] = $input['entities_id'];
                         if ($this->update($values)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     }
                 }
             }
             break;
         case "Duplicate":
             if ($input['itemtype'] == 'PluginProjetTask') {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         $this->getFromDB($key);
                         unset($this->fields["id"]);
                         $this->fields["name"] = addslashes($this->fields["name"]);
                         $this->fields["comment"] = addslashes($this->fields["comment"]);
                         $this->fields["sub"] = addslashes($this->fields["sub"]);
                         $this->fields["others"] = addslashes($this->fields["others"]);
                         $this->fields["affect"] = addslashes($this->fields["affect"]);
                         if ($this->add($this->fields)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
             break;
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:54,代码来源:task.class.php

示例6: doSpecificMassiveActions

 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     $resource_item = new PluginResourcesResource_Item();
     switch ($input['action']) {
         case "Send":
             if ($this->sendEmail($data)) {
                 $res['ok']++;
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
             break;
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:18,代码来源:directory.class.php

示例7: 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)
  **/
 public function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     $route_item = new PluginRoutetablesRoutetable_Item();
     switch ($input['action']) {
         case 'Duplicate':
             if ($input['itemtype'] == 'PluginRoutetablesRoutetable') {
                 foreach ($input['item'] as $key => $val) {
                     if ($val == 1) {
                         if ($this->getFromDB($key)) {
                             unset($this->fields["id"]);
                             $this->fields["entities_id"] = $input["entities_id"];
                             if ($newID = $this->add($this->fields)) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['ko']++;
                         }
                     }
                 }
             }
             break;
         case "Install":
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     $values = array('plugin_routetables_routetables_id' => $key, 'items_id' => $input["item_item"], 'itemtype' => $input['typeitem']);
                     if ($route_item->can(-1, 'w', $input)) {
                         if ($route_item->add($values)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         case "Desinstall":
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     if ($route_item->deleteItemByRoutetablesAndItem($key, $input['item_item'], $input['typeitem'])) {
                         $res['ok']++;
                     } else {
                         $res['ko']++;
                     }
                 }
             }
             break;
         case "Transfert":
             if ($input['itemtype'] == 'PluginRoutetablesRoutetable') {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         $values["id"] = $key;
                         $values["entities_id"] = $input['entities_id'];
                         if ($this->update($values)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
             break;
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:81,代码来源:routetable.class.php

示例8: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "add_actor":
             $item = new $input['itemtype']();
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     $input2 = array('id' => $key);
                     if (isset($input['_itil_requester'])) {
                         $input2['_itil_requester'] = $input['_itil_requester'];
                     }
                     if (isset($input['_itil_observer'])) {
                         $input2['_itil_observer'] = $input['_itil_observer'];
                     }
                     if (isset($input['_itil_assign'])) {
                         $input2['_itil_assign'] = $input['_itil_assign'];
                     }
                     if ($item->can($key, 'w')) {
                         if ($item->update($input2)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         case "add_task":
             $taskitemtype = $_POST['itemtype'] . 'Task';
             if (!($task = getItemForItemtype($taskitemtype))) {
                 return false;
             }
             $field = $this->getForeignKeyField();
             foreach ($input["item"] as $key => $val) {
                 if ($val == 1) {
                     $input2 = array($field => $key, 'taskcategories_id' => $input['taskcategories_id'], 'content' => $input['content']);
                     if ($task->can(-1, 'w', $input2)) {
                         if ($task->add($input2)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['noright']++;
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:59,代码来源:commonitilobject.class.php

示例9: doSpecificMassiveActions

 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "Transfert":
             if ($input['itemtype'] == 'PluginBadgesBadge') {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         $badge = new PluginBadgesBadge();
                         $badge->getFromDB($key);
                         $type = PluginBadgesBadgeType::transfer($badge->fields["plugin_badges_badgetypes_id"], $input['entities_id']);
                         if ($type > 0) {
                             $values["id"] = $key;
                             $values["plugin_badges_badgetypes_id"] = $type;
                             if ($badge->update($values)) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         }
                         unset($values);
                         $values["id"] = $key;
                         $values["entities_id"] = $input['entities_id'];
                         if ($badge->update($values)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:37,代码来源:badge.class.php

示例10: doSpecificMassiveActions

 /**
  * @since version 0.84
  *
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     //             print_r($input);exit();
     switch ($input['action']) {
         case "give":
             if ($input["give_items_id"] > 0 && !empty($input['give_itemtype'])) {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         if ($this->can($key, 'w')) {
                             if ($this->out($key, $input['give_itemtype'], $input["give_items_id"])) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
                 if ($item = getItemForItemtype($input['give_itemtype'])) {
                     Event::log($input["consumableitems_id"], "consumables", 5, "inventory", sprintf(__('%s gives a consumable'), $_SESSION["glpiname"]));
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:37,代码来源:consumable.class.php

示例11: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "add_document":
         case "add_document_item":
             $documentitem = new Document_Item();
             foreach ($input["item"] as $key => $val) {
                 if (isset($input['items_id'])) {
                     // Add items to documents
                     $input2 = array('itemtype' => $input["item_itemtype"], 'items_id' => $input["items_id"], 'documents_id' => $key);
                 } else {
                     if (isset($input['documents_id'])) {
                         // Add document to item
                         $input2 = array('itemtype' => $input["itemtype"], 'items_id' => $key, 'documents_id' => $input['documents_id']);
                     } else {
                         return false;
                     }
                 }
                 if ($documentitem->can(-1, 'w', $input2)) {
                     if ($documentitem->add($input2)) {
                         $res['ok']++;
                     } else {
                         $res['ko']++;
                     }
                 } else {
                     $res['noright']++;
                 }
             }
             break;
         case "remove_document":
         case "remove_document_item":
             foreach ($input["item"] as $key => $val) {
                 if (isset($input['items_id'])) {
                     // Remove item to documents
                     $input2 = array('itemtype' => $input["item_itemtype"], 'items_id' => $input["items_id"], 'documents_id' => $key);
                 } else {
                     if (isset($input['documents_id'])) {
                         // Remove contract to items
                         $input2 = array('itemtype' => $input["itemtype"], 'items_id' => $key, 'documents_id' => $input['documents_id']);
                     } else {
                         return false;
                     }
                 }
                 $docitem = new Document_Item();
                 if ($docitem->can(-1, 'w', $input2)) {
                     if ($item = getItemForItemtype($input2["itemtype"])) {
                         if ($item->getFromDB($input2['items_id'])) {
                             $doc = new self();
                             if ($doc->getFromDB($input2['documents_id'])) {
                                 if ($docitem->getFromDBForItems($doc, $item)) {
                                     if ($docitem->delete(array('id' => $docitem->getID()))) {
                                         $res['ok']++;
                                     } else {
                                         $res['ko']++;
                                     }
                                 } else {
                                     $res['ko']++;
                                 }
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['ko']++;
                         }
                     } else {
                         $res['ko']++;
                     }
                 } else {
                     $res['noright']++;
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:81,代码来源:document.class.php

示例12: doSpecificMassiveActions

 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "connect":
             $ci = new Computer_Item();
             return $ci->doSpecificMassiveActions($input);
         case "install":
             if (isset($input['softwareversions_id']) && $input['softwareversions_id'] > 0) {
                 $inst = new Computer_SoftwareVersion();
                 foreach ($input['item'] as $key => $val) {
                     if ($val == 1) {
                         $input2 = array('computers_id' => $key, 'softwareversions_id' => $input['softwareversions_id']);
                         if ($inst->can(-1, 'w', $input2)) {
                             if ($inst->add($input2)) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         } else {
                             $res['noright']++;
                         }
                     }
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:36,代码来源:computer.class.php

示例13: 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);
     $criteria = new PluginTypologyTypologyCriteria();
     switch ($input['action']) {
         case "deleteAll":
             if ($input['itemtype'] == 'PluginTypologyTypologyCriteria') {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         if ($criteria->can($key, 'w')) {
                             if ($criteria->delete(array('id' => $key))) {
                                 $res['ok']++;
                             } else {
                                 $res['ko']++;
                             }
                         }
                     }
                 }
             }
             break;
         case "updateAll":
             if ($input['itemtype'] == 'PluginTypologyTypologyCriteria') {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         $values = array('id' => $key, 'is_active' => $input['is_active']);
                         if ($criteria->update($values)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:48,代码来源:typologycriteria.class.php

示例14: 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);
     $criteria = new PluginTypologyTypologyCriteria();
     $definition = new PluginTypologyTypologyCriteriaDefinition();
     switch ($input['action']) {
         case "Transfert":
             if ($input['itemtype'] == 'PluginTypologyTypology') {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         $this->getFromDB($key);
                         $restrict = "`plugin_typology_typologies_id` = '" . $key . "'";
                         $crits = getAllDatasFromTable("glpi_plugin_typology_typologycriterias", $restrict);
                         if (!empty($crits)) {
                             foreach ($crits as $crit) {
                                 $criteria->getFromDB($crit["id"]);
                                 $condition = "`plugin_typology_typologycriterias_id` = '" . $crit["id"] . "'";
                                 $defs = getAllDatasFromTable("glpi_plugin_typology_typologycriteriadefinitions", $condition);
                                 if (!empty($defs)) {
                                     foreach ($defs as $def) {
                                         $definition->getFromDB($def["id"]);
                                         unset($values);
                                         $values["id"] = $def["id"];
                                         $values["entities_id"] = $input['entities_id'];
                                         $definition->update($values);
                                     }
                                 }
                                 unset($values);
                                 $values["id"] = $crit["id"];
                                 $values["entities_id"] = $input['entities_id'];
                                 $criteria->update($values);
                             }
                         }
                         unset($values);
                         $values["id"] = $key;
                         $values["entities_id"] = $input['entities_id'];
                         if ($this->update($values)) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                     }
                 }
             }
             break;
         case "Duplicate":
             if ($input['itemtype'] == 'PluginTypologyTypology') {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         $this->getFromDB($key);
                         $restrict = "`plugin_typology_typologies_id` = '" . $key . "'";
                         $crits = getAllDatasFromTable("glpi_plugin_typology_typologycriterias", $restrict);
                         unset($this->fields["id"]);
                         $this->fields["name"] = addslashes($this->fields["name"] . " Copy");
                         $this->fields["comment"] = addslashes($this->fields["comment"]);
                         $this->fields["notepad"] = addslashes($this->fields["notepad"]);
                         $newIDtypo = $this->add($this->fields);
                         if ($newIDtypo) {
                             $res['ok']++;
                         } else {
                             $res['ko']++;
                         }
                         if (!empty($crits)) {
                             foreach ($crits as $crit) {
                                 $criteria->getFromDB($crit["id"]);
                                 $condition = "`plugin_typology_typologycriterias_id` = '" . $crit["id"] . "'";
                                 $defs = getAllDatasFromTable("glpi_plugin_typology_typologycriteriadefinitions", $condition);
                                 unset($criteria->fields["id"]);
                                 $criteria->fields["name"] = addslashes($criteria->fields["name"]);
                                 $criteria->fields["plugin_typology_typologies_id"] = $newIDtypo;
                                 $criteria->fields["itemtype"] = addslashes($criteria->fields["itemtype"]);
                                 $newIDcrit = $criteria->add($criteria->fields);
                                 if (!empty($defs)) {
                                     foreach ($defs as $def) {
                                         $definition->getFromDB($def["id"]);
                                         unset($definition->fields["id"]);
                                         $definition->fields["plugin_typology_typologycriterias_id"] = $newIDcrit;
                                         $definition->fields["field"] = addslashes($definition->fields["field"]);
                                         $definition->fields["action_type"] = addslashes($definition->fields["action_type"]);
                                         $definition->fields["value"] = addslashes($definition->fields["value"]);
                                         $definition->add($definition->fields);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:typology.class.php

示例15: doSpecificMassiveActions

 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     $resource_item = new PluginResourcesResource_Item();
     switch ($input['action']) {
         case "Transfert":
             if ($input['itemtype'] == 'PluginResourcesResource') {
                 foreach ($input["item"] as $key => $val) {
                     if ($val == 1) {
                         $this->getFromDB($key);
                         $contracttype = PluginResourcesContractType::transfer($PluginResourcesResource->fields["plugin_resources_contracttypes_id"], $input['entities_id']);
                         if ($contracttype > 0) {
                             $values["id"] = $key;
                             $values["plugin_resources_contracttypes_id"] = $contracttype;
                             $this->update($values);
                         }
                         unset($values);
                         $resourcestate = PluginResourcesResourceState::transfer($PluginResourcesResource->fields["plugin_resources_resourcestates_id"], $input['entities_id']);
                         if ($resourcestate > 0) {
                             $values["id"] = $key;
                             $values["plugin_resources_resourcestates_id"] = $resourcestate;
                             $this->update($values);
                         }
                         unset($values);
                         $department = PluginResourcesDepartment::transfer($PluginResourcesResource->fields["plugin_resources_departments_id"], $input['entities_id']);
                         if ($department > 0) {
                             $values["id"] = $key;
                             $values["plugin_resources_departments_id"] = $department;
                             $this->update($values);
                         }
                         unset($values);
                         $situation = PluginResourcesResourceSituation::transfer($PluginResourcesResource->fields["plugin_resources_resourcesituations_id"], $input['entities_id']);
                         if ($situation > 0) {
                             $values["id"] = $key;
                             $values["plugin_resources_resourcesituations_id"] = $situation;
                             $this->update($values);
                         }
                         unset($values);
                         $contractnature = PluginResourcesContractNature::transfer($PluginResourcesResource->fields["plugin_resources_contractnatures_id"], $input['entities_id']);
                         if ($contractnature > 0) {
                             $values["id"] = $key;
                             $values["plugin_resources_contractnatures_id"] = $contractnature;
                             $this->update($values);
                         }
                         unset($values);
                         $rank = PluginResourcesRank::transfer($PluginResourcesResource->fields["plugin_resources_ranks_id"], $input['entities_id']);
                         if ($rank > 0) {
                             $values["id"] = $key;
                             $values["plugin_resources_ranks_id"] = $rank;
                             $this->update($values);
                         }
                         unset($values);
                         $speciality = PluginResourcesResourceSpeciality::transfer($PluginResourcesResource->fields["plugin_resources_resourcespecialities_id"], $input['entities_id']);
                         if ($speciality > 0) {
                             $values["id"] = $key;
                             $values["plugin_resources_resourcespecialities_id"] = $speciality;
                             $this->update($values);
                         }
                         unset($values);
                         $PluginResourcesTask = new PluginResourcesTask();
                         $restrict = "`plugin_resources_resources_id` = '" . $key . "'";
                         $tasks = getAllDatasFromTable("glpi_plugin_resources_tasks", $restrict);
                         if (!empty($tasks)) {
                             foreach ($tasks as $task) {
                                 $PluginResourcesTask->getFromDB($task["id"]);
                                 $tasktype = PluginResourcesTaskType::transfer($PluginResourcesTask->fields["plugin_resources_tasktypes_id"], $input['entities_id']);
                                 if ($tasktype > 0) {
                                     $values["id"] = $task["id"];
                                     $values["plugin_resources_tasktypes_id"] = $tasktype;
                                     $PluginResourcesTask->update($values);
                                 }
                                 $values["id"] = $task["id"];
                                 $values["entities_id"] = $input['entities_id'];
                                 $PluginResourcesTask->update($values);
                             }
                         }
                         unset($values);
                         $PluginResourcesEmployment = new PluginResourcesEmployment();
                         $restrict = "`plugin_resources_resources_id` = '" . $key . "'";
                         $employments = getAllDatasFromTable("glpi_plugin_resources_employments", $restrict);
                         if (!empty($employments)) {
                             foreach ($employments as $employment) {
                                 $PluginResourcesEmployment->getFromDB($employment["id"]);
                                 $rank = PluginResourcesRank::transfer($PluginResourcesEmployment->fields["plugin_resources_ranks_id"], $input['entities_id']);
                                 if ($rank > 0) {
                                     $values["id"] = $employment["id"];
                                     $values["plugin_resources_ranks_id"] = $rank;
                                     $PluginResourcesEmployment->update($values);
                                 }
                                 $PluginResourcesEmployment->getFromDB($employment["id"]);
                                 $profession = PluginResourcesProfession::transfer($PluginResourcesEmployment->fields["plugin_resources_professions_id"], $input['entities_id']);
                                 if ($profession > 0) {
                                     $values["id"] = $employment["id"];
                                     $values["plugin_resources_professions_id"] = $profession;
                                     $PluginResourcesEmployment->update($values);
                                 }
                                 $values["id"] = $employment["id"];
                                 $values["entities_id"] = $input['entities_id'];
                                 $PluginResourcesEmployment->update($values);
                             }
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:resource.class.php


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