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


PHP MassiveAction::getInput方法代码示例

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


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

示例1: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'add':
             $input = $ma->getInput();
             $ticket = new Ticket();
             if (isset($input['link']) && isset($input['tickets_id_1'])) {
                 if ($item->getFromDB($input['tickets_id_1'])) {
                     foreach ($ids as $id) {
                         $input2 = array();
                         $input2['id'] = $input['tickets_id_1'];
                         $input2['_link']['tickets_id_1'] = $input['tickets_id_1'];
                         $input2['_link']['link'] = $input['link'];
                         $input2['_link']['tickets_id_2'] = $id;
                         if ($item->can($input['tickets_id_1'], UPDATE)) {
                             if ($ticket->update($input2)) {
                                 $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                             } else {
                                 $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                                 $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                             }
                         } else {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                             $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                         }
                     }
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:stweil,项目名称:glpi,代码行数:37,代码来源:ticket_ticket.class.php

示例2: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'delete_for_user':
             $input = $ma->getInput();
             if (isset($input['users_id'])) {
                 $user = new User();
                 $user->getFromDB($input['users_id']);
                 foreach ($ids as $id) {
                     if ($input['users_id'] == Session::getLoginUserID()) {
                         if ($item->deleteByCriteria(array('users_id' => $input['users_id'], 'itemtype' => $id))) {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                         } else {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                             $ma->addMessage($user->getErrorMessage(ERROR_ON_ACTION));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                         $ma->addMessage($user->getErrorMessage(ERROR_RIGHT));
                     }
                 }
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:stweil,项目名称:glpi,代码行数:33,代码来源:displaypreference.class.php

示例3: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case "use_filter_assign_group":
             $escalade_user = new self();
             $input = $ma->getInput();
             foreach ($ids as $id) {
                 if ($escalade_user->getFromDBByQuery("WHERE users_id = {$id}")) {
                     $escalade_user->fields['use_filter_assign_group'] = $input['use_filter_assign_group'];
                     if ($escalade_user->update($escalade_user->fields)) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                     }
                 }
             }
     }
 }
开发者ID:korial29,项目名称:escalade,代码行数:23,代码来源:user.class.php

示例4: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $DB;
     $certif_item = new PluginCertificatesCertificate_Item();
     switch ($ma->getAction()) {
         case "plugin_certificates_add_item":
             $input = $ma->getInput();
             foreach ($ids as $id) {
                 $input = array('plugin_certificates_certificates_id' => $input['plugin_certificates_certificates_id'], 'items_id' => $id, 'itemtype' => $item->getType());
                 if ($certif_item->can(-1, UPDATE, $input)) {
                     if ($certif_item->add($input)) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                     }
                 } else {
                     $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                 }
             }
             return;
         case "transfer":
             $input = $ma->getInput();
             if ($item->getType() == 'PluginCertificatesCertificate') {
                 foreach ($ids as $key) {
                     $item->getFromDB($key);
                     $type = PluginCertificatesCertificateType::transfer($item->fields["plugin_certificates_certificatetypes_id"], $input['entities_id']);
                     if ($type > 0) {
                         $values["id"] = $key;
                         $values["plugin_certificates_certificatetypes_id"] = $type;
                         $item->update($values);
                     }
                     $state = PluginCertificatesCertificateState::transfer($this->fields["plugin_certificates_certificatestates_id"], $input['entities_id']);
                     if ($state > 0) {
                         $values["id"] = $key;
                         $values["plugin_certificates_certificatestates_id"] = $state;
                         $item->update($values);
                     }
                     unset($values);
                     $values["id"] = $key;
                     $values["entities_id"] = $input['entities_id'];
                     if ($item->update($values)) {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                     }
                 }
             }
             return;
         case 'install':
             $input = $ma->getInput();
             foreach ($ids as $key) {
                 if ($item->can($key, UPDATE)) {
                     $values = array('plugin_certificates_certificates_id' => $key, 'items_id' => $input["item_item"], 'itemtype' => $input['typeitem']);
                     if ($certif_item->add($values)) {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                     }
                 } else {
                     $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
         case 'uninstall':
             $input = $ma->getInput();
             foreach ($ids as $key) {
                 if ($val == 1) {
                     if ($certif_item->deleteItemByCertificatesAndItem($key, $input['item_item'], $input['typeitem'])) {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                     }
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:84,代码来源:certificate.class.php

示例5: processMassiveActionsForOneItemtype

 /**
  * @warning this is not valid if $itemtype_1 == $itemtype_2 !
  *
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $DB;
     $action = $ma->getAction();
     $input = $ma->getInput();
     $specificities = static::getRelationMassiveActionsSpecificities();
     // First, get normalized action : add or remove
     if (in_array($action, $specificities['normalized']['add'])) {
         $normalized_action = 'add';
     } else {
         if (in_array($action, $specificities['normalized']['remove'])) {
             $normalized_action = 'remove';
         } else {
             // If we cannot get normalized action, then, its not for this method !
             parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
             return;
         }
     }
     $link = new static();
     // Get the default 'input' entries from the relation
     $input2 = static::getRelationInputForProcessingOfMassiveActions($action, $item, $ids, $input);
     // complete input2 with the right fields from input and define the peer with this information
     foreach (array(static::$itemtype_1, static::$items_id_1) as $field) {
         if (isset($input['peer_' . $field])) {
             $input2[$field] = $input['peer_' . $field];
             $item_number = 2;
         }
     }
     foreach (array(static::$itemtype_2, static::$items_id_2) as $field) {
         if (isset($input['peer_' . $field])) {
             $input2[$field] = $input['peer_' . $field];
             $item_number = 1;
         }
     }
     // If the fields provided by showMassiveActionsSubForm are not valid then quit !
     if (!isset($item_number)) {
         $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
         $ma->addMessage($link->getErrorMessage(ERROR_NOT_FOUND));
         return;
     }
     if ($item_number == 1) {
         $itemtype = static::$itemtype_1;
         $items_id = static::$items_id_1;
         $peertype = static::$itemtype_2;
         $peers_id = static::$items_id_2;
     } else {
         $itemtype = static::$itemtype_2;
         $items_id = static::$items_id_2;
         $peertype = static::$itemtype_1;
         $peers_id = static::$items_id_1;
     }
     if (preg_match('/^itemtype/', $itemtype)) {
         $input2[$itemtype] = $item->getType();
     }
     // Get the peer from the $input2 and the name of its fields
     $peer = static::getItemFromArray($peertype, $peers_id, $input2, true, true, true);
     // $peer not valid => not in DB or try to remove all at once !
     if ($peer === false || $peer->isNewItem()) {
         if (isset($input2[$peers_id]) && $input2[$peers_id] > 0) {
             $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
             if ($peer instanceof CommonDBTM) {
                 $ma->addMessage($peer->getErrorMessage(ERROR_NOT_FOUND));
             } else {
                 $ma->addMessage($link->getErrorMessage(ERROR_NOT_FOUND));
             }
             return;
         }
         if (!$specificities['can_remove_all_at_once'] && !$specificities['only_remove_all_at_once']) {
             return false;
         }
         $peer = false;
     }
     // Make a link between $item_1, $item_2 and $item and $peer. Thus, we will be able to update
     // $item without having to care about the number of the item
     if ($item_number == 1) {
         $item_1 =& $item;
         $item_2 =& $peer;
     } else {
         $item_1 =& $peer;
         $item_2 =& $item;
     }
     switch ($normalized_action) {
         case 'add':
             // remove all at once only available for remove !
             if (!$peer) {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                 $ma->addMessage($link->getErrorMessage(ERROR_ON_ACTION));
                 return;
             }
             foreach ($ids as $key) {
                 if (!$item->getFromDB($key)) {
                     $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                     $ma->addMessage($item->getErrorMessage(ERROR_NOT_FOUND));
//.........这里部分代码省略.........
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:commondbrelation.class.php

示例6: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  * */
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $DB;
     switch ($ma->getAction()) {
         case "transfer":
             $input = $ma->getInput();
             if ($item->getType() == 'PluginTasklistsTask') {
                 foreach ($ids as $key) {
                     $item->getFromDB($key);
                     $type = PluginTasklistsTaskType::transfer($item->fields["plugin_tasklists_tasktypes_id"], $input['entities_id']);
                     if ($type > 0) {
                         $values["id"] = $key;
                         $values["plugin_tasklists_tasktypes_id"] = $type;
                         $item->update($values);
                     }
                     unset($values);
                     $values["id"] = $key;
                     $values["entities_id"] = $input['entities_id'];
                     if ($item->update($values)) {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                     }
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:InfotelGLPI,项目名称:tasklists,代码行数:34,代码来源:task.class.php

示例7: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'add_followup':
             $input = $ma->getInput();
             $fup = new self();
             foreach ($ids as $id) {
                 if ($item->getFromDB($id)) {
                     $input2 = array('tickets_id' => $id, 'is_private' => $input['is_private'], 'requesttypes_id' => $input['requesttypes_id'], 'content' => $input['content']);
                     if ($fup->can(-1, CREATE, $input2)) {
                         if ($fup->add($input2)) {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                         } else {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                             $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                         $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                     $ma->addMessage($item->getErrorMessage(ERROR_NOT_FOUND));
                 }
             }
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:33,代码来源:ticketfollowup.class.php

示例8: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'changegroup':
             $input = $ma->getInput();
             if (isset($input["field"]) && isset($input['groups_id'])) {
                 foreach ($ids as $id) {
                     if ($item->can($id, UPDATE)) {
                         if ($item->update(array('id' => $id, $input["field"] => $input["groups_id"]))) {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                         } else {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                             $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                         $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                     }
                 }
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                 $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $baseitem, $ids);
 }
开发者ID:korial29,项目名称:glpi,代码行数:32,代码来源:group.class.php

示例9: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $CFG_GLPI;
     $input = $ma->getInput();
     switch ($ma->getAction()) {
         case 'import_group':
             $group = new Group();
             if (!Session::haveRight("user", User::UPDATEAUTHENT) || !$group->canGlobal(UPDATE)) {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_NORIGHT);
                 $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 return;
             }
             foreach ($ids as $id) {
                 if (isset($input["dn"][$id])) {
                     $group_dn = $input["dn"][$id];
                     if (isset($input["ldap_import_entities"][$id])) {
                         $entity = $input["ldap_import_entities"][$id];
                     } else {
                         $entity = $_SESSION["glpiactive_entity"];
                     }
                     // Is recursive is in the main form and thus, don't pass through
                     // zero_on_empty mechanism inside massive action form ...
                     $is_recursive = empty($input['ldap_import_recursive'][$id]) ? 0 : 1;
                     $options = array('authldaps_id' => $_SESSION['ldap_server'], 'entities_id' => $entity, 'is_recursive' => $is_recursive, 'type' => $input['ldap_import_type'][$id]);
                     if (AuthLdap::ldapImportGroup($group_dn, $options)) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION, $group_dn));
                     }
                 }
                 // Clean history as id does not correspond to group
                 $_SESSION['glpimassiveactionselected'] = array();
             }
             return;
         case 'import':
         case 'sync':
             if (!Session::haveRight("user", User::IMPORTEXTAUTHUSERS)) {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_NORIGHT);
                 $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 return;
             }
             foreach ($ids as $id) {
                 if (AuthLdap::ldapImportUserByServerId(array('method' => AuthLDAP::IDENTIFIER_LOGIN, 'value' => $id), $_SESSION['ldap_import']['mode'], $_SESSION['ldap_import']['authldaps_id'], true)) {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                     $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION, $id));
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:59,代码来源:authldap.class.php

示例10: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $DB;
     switch ($ma->getAction()) {
         case 'duplicate':
             $rulecollection = new RuleCollection();
             foreach ($ids as $id) {
                 if ($item->getFromDB($id)) {
                     if ($rulecollection->duplicateRule($id)) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                     $ma->addMessage($item->getErrorMessage(ERROR_NOT_FOUND));
                 }
             }
             break;
         case 'export':
             if (count($ids)) {
                 $_SESSION['exportitems'] = $ids;
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_OK);
                 $ma->setRedirect('rule.backup.php?action=download&itemtype=' . $item->getType());
             }
             break;
         case 'move_rule':
             $input = $ma->getInput();
             $collectionname = $input['rule_class_name'] . 'Collection';
             $rulecollection = new $collectionname();
             if ($rulecollection->canUpdate()) {
                 foreach ($ids as $id) {
                     if ($item->getFromDB($id)) {
                         if ($rulecollection->moveRule($id, $input['ranking'], $input['move_type'])) {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                         } else {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                             $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_NOT_FOUND));
                     }
                 }
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_NORIGHT);
                 $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
             }
             break;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:pvasener,项目名称:glpi,代码行数:58,代码来源:rule.class.php

示例11: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'duplicate':
             // For calendar duplicate in another entity
             if (method_exists($item, 'duplicate')) {
                 $input = $ma->getInput();
                 $options = array();
                 if ($item->isEntityAssign()) {
                     $options = array('entities_id' => $input['entities_id']);
                 }
                 foreach ($ids as $id) {
                     if ($item->getFromDB($id)) {
                         if (!$item->isEntityAssign() || $input['entities_id'] != $item->getEntityID()) {
                             if ($item->can(-1, CREATE, $options)) {
                                 if ($item->duplicate($options)) {
                                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                                 } else {
                                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                                     $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                                 }
                             } else {
                                 $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                                 $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                             }
                         } else {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                             $ma->addMessage($item->getErrorMessage(ERROR_COMPAT));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_NOT_FOUND));
                     }
                 }
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:46,代码来源:calendar.class.php

示例12: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  * @param MassiveAction $ma
  * @param CommonDBTM $item
  * @param array $ids
  * @return nothing|void
  */
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case "plugin_ocsinventoryng_update_networkport_type":
             $networkport = new PluginOcsinventoryngNetworkPort();
             $input = $ma->getInput();
             foreach ($ids as $id) {
                 if ($networkport->getFromDBByQuery("WHERE `networkports_id` = '{$id}'")) {
                     if ($networkport->transformAccordingTypes()) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                     }
                 } else {
                     $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:pluginsGLPI,项目名称:ocsinventoryng,代码行数:30,代码来源:networkport.class.php

示例13: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'add_task':
             if (!($task = getItemForItemtype('TicketTask'))) {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                 break;
             }
             $ticket = new Ticket();
             $field = $ticket->getForeignKeyField();
             $input = $ma->getInput();
             foreach ($ids as $id) {
                 if ($item->can($id, READ)) {
                     if ($ticket->getFromDB($item->fields['tickets_id'])) {
                         $input2 = array($field => $item->fields['tickets_id'], 'taskcategories_id' => $input['taskcategories_id'], 'actiontime' => $input['actiontime'], 'content' => $input['content']);
                         if ($task->can(-1, CREATE, $input2)) {
                             if ($task->add($input2)) {
                                 $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                             } else {
                                 $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                                 $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                             }
                         } else {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                             $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                         $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                     }
                 }
             }
             return;
         case 'solveticket':
             $input = $ma->getInput();
             $ticket = new Ticket();
             foreach ($ids as $id) {
                 if ($item->can($id, READ)) {
                     if ($ticket->getFromDB($item->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)) {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                         } else {
                             $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                             $ma->addMessage($ticket->getErrorMessage(ERROR_ON_ACTION));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                         $ma->addMessage($ticket->getErrorMessage(ERROR_RIGHT));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($ticket->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:67,代码来源:problem_ticket.class.php

示例14: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'uninstall':
             foreach ($ids as $key) {
                 if ($item->can($key, UPDATE)) {
                     if ($item->uninstall($key)) {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
         case 'backtostock':
             foreach ($ids as $id) {
                 if ($item->can($id, UPDATE)) {
                     if ($item->backToStock(array("id" => $id))) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
         case 'updatepages':
             $input = $ma->getInput();
             if (isset($input['pages'])) {
                 foreach ($ids as $key) {
                     if ($item->can($key, UPDATE)) {
                         if ($item->update(array('id' => $key, 'pages' => $input['pages']))) {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                         } else {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                             $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                         }
                     } else {
                         $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                         $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                     }
                 }
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:61,代码来源:cartridge.class.php

示例15: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $DB;
     switch ($ma->getAction()) {
         case 'move_bookmark':
             $input = $ma->getInput();
             if ($item->moveBookmark($ids, $input['bookmarks_id_ref'], $input['move_type'])) {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_OK);
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:pvasener,项目名称:glpi,代码行数:20,代码来源:bookmark.class.php


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