• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP MassiveAction类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: displayDatas

 /**
  * Display datas extracted from DB
  *
  * @param $data array of search datas prepared to get datas
  *
  * @return nothing
  **/
 static function displayDatas(array &$data)
 {
     global $CFG_GLPI;
     $item = null;
     if (class_exists($data['itemtype'])) {
         $item = new $data['itemtype']();
     }
     $rand = mt_rand();
     if (!isset($data['data']) || !isset($data['data']['totalcount'])) {
         return false;
     }
     // Contruct Pager parameters
     $globallinkto = Toolbox::append_params(array('criteria' => Toolbox::stripslashes_deep($data['search']['criteria']), 'metacriteria' => Toolbox::stripslashes_deep($data['search']['metacriteria'])), '&');
     $parameters = "sort=" . $data['search']['sort'] . "&order=" . $data['search']['order'] . '&' . $globallinkto;
     if (isset($_GET['_in_modal'])) {
         $parameters .= "&_in_modal=1";
     }
     // Global search header
     if ($data['display_type'] == self::GLOBAL_SEARCH) {
         if ($data['item']) {
             echo "<div class='center'><h2>" . $data['item']->getTypeName();
             // More items
             if ($data['data']['totalcount'] > $data['search']['start'] + self::GLOBAL_DISPLAY_COUNT) {
                 echo " <a href='" . $data['search']['target'] . "?{$parameters}'>" . __('All') . "</a>";
             }
             echo "</h2></div>\n";
         } else {
             return false;
         }
     }
     // If the begin of the view is before the number of items
     if ($data['data']['count'] > 0) {
         // Display pager only for HTML
         if ($data['display_type'] == self::HTML_OUTPUT) {
             // For plugin add new parameter if available
             if ($plug = isPluginItemType($data['itemtype'])) {
                 $function = 'plugin_' . $plug['plugin'] . '_addParamFordynamicReport';
                 if (function_exists($function)) {
                     $out = $function($data['itemtype']);
                     if (is_array($out) && count($out)) {
                         $parameters .= Toolbox::append_params($out, '&amp;');
                     }
                 }
             }
             $search_config_top = "";
             $search_config_bottom = "";
             if (!isset($_GET['_in_modal']) && Session::haveRightsOr('search_config', array(DisplayPreference::PERSONAL, DisplayPreference::GENERAL))) {
                 $search_config_top = $search_config_bottom = "<div class='pager_controls'><img alt=\"" . __s('Select default items to show') . "\" title=\"" . __s('Select default items to show') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/options_search.png' ";
                 $search_config_top .= " class='pointer' onClick=\"";
                 $search_config_top .= Html::jsGetElementbyID('search_config_top') . ".dialog('open');\">";
                 $search_config_bottom .= " class='pointer' onClick=\"";
                 $search_config_bottom .= Html::jsGetElementbyID('search_config_bottom') . ".dialog('open');\">";
                 $search_config_top .= Ajax::createIframeModalWindow('search_config_top', $CFG_GLPI["root_doc"] . "/front/displaypreference.form.php?itemtype=" . $data['itemtype'], array('title' => __('Select default items to show'), 'reloadonclose' => true, 'display' => false));
                 $search_config_bottom .= Ajax::createIframeModalWindow('search_config_bottom', $CFG_GLPI["root_doc"] . "/front/displaypreference.form.php?itemtype=" . $data['itemtype'], array('title' => __('Select default items to show'), 'reloadonclose' => true, 'display' => false));
             }
             if ($item !== null && $item->maybeDeleted()) {
                 $delete_ctrl = self::isDeletedSwitch($data['search']['is_deleted']);
                 $search_config_top .= $delete_ctrl;
             }
             Html::printPager($data['search']['start'], $data['data']['totalcount'], $data['search']['target'], $parameters, $data['itemtype'], 0, $search_config_top);
             $search_config_top .= "</div>";
             $search_config_bottom .= "</div>";
         }
         // Define begin and end var for loop
         // Search case
         $begin_display = $data['data']['begin'];
         $end_display = $data['data']['end'];
         // Form to massive actions
         $isadmin = $data['item'] && $data['item']->canUpdate();
         if (!$isadmin && InfoCom::canApplyOn($data['itemtype'])) {
             $isadmin = Infocom::canUpdate() || Infocom::canCreate();
         }
         if ($data['itemtype'] != 'AllAssets') {
             $showmassiveactions = count(MassiveAction::getAllMassiveActions($data['item'], $data['search']['is_deleted']));
         } else {
             $showmassiveactions = true;
         }
         $massformid = 'massform' . $data['itemtype'];
         if ($showmassiveactions && $data['display_type'] == self::HTML_OUTPUT) {
             Html::openMassiveActionsForm($massformid);
             $massiveactionparams = $data['search']['massiveactionparams'];
             $massiveactionparams['num_displayed'] = $end_display - $begin_display;
             $massiveactionparams['fixed'] = false;
             $massiveactionparams['is_deleted'] = $data['search']['is_deleted'];
             $massiveactionparams['container'] = $massformid;
             Html::showMassiveActions($massiveactionparams);
         }
         // Compute number of columns to display
         // Add toview elements
         $nbcols = count($data['data']['cols']);
         if ($data['display_type'] == self::HTML_OUTPUT && $showmassiveactions) {
             // HTML display - massive modif
             $nbcols++;
//.........这里部分代码省略.........
开发者ID:jose-martins,项目名称:glpi,代码行数:101,代码来源:search.class.php


示例2: 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


示例3: 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:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:33,代码来源:displaypreference.class.php


示例4: processMassiveActionsForOneItemtype

 /**
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  * @param MassiveAction $ma
  * @param CommonDBTM $item
  * @param array $ids
  * @return void
  */
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'deleteSelected':
             if (isset($_POST['items']['PluginFpsoftwareCommon']) && is_array($_POST['items']['PluginFpsoftwareCommon'])) {
                 foreach ($_POST['items']['PluginFpsoftwareCommon'] as $id => $val) {
                     self::deleteItem($id);
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                 }
             }
             break;
     }
 }
开发者ID:dawidplocki,项目名称:glpi-fpsoftware,代码行数:20,代码来源:common.class.php


示例5: 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


示例6: processMassiveActionsForOneItemtype

 /**
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'sendmail':
             foreach ($ids as $id) {
                 if ($item->canEdit($id)) {
                     if ($item->sendMailById($id)) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:simaostephanie,项目名称:glpi,代码行数:22,代码来源:queuedmail.class.php


示例7: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $CFG_GLPI;
     switch ($ma->getAction()) {
         case "uninstall":
             $itemtype = $ma->getItemtype(false);
             foreach ($ids as $id) {
                 if ($item->getFromDB($id)) {
                     //Session::addMessageAfterRedirect(sprintf(__('Form duplicated: %s', 'formcreator'), $item->getName()));
                     $_SESSION['glpi_uninstalllist'][$itemtype][$id] = $id;
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                 }
             }
             Html::redirect($CFG_GLPI["root_doc"] . '/plugins/uninstall/front/action.php?device_type=' . $itemtype . "&model_id=" . $_POST["model_id"]);
             return;
             break;
     }
     return;
 }
开发者ID:pluginsGLPI,项目名称:uninstall,代码行数:24,代码来源:uninstall.class.php


示例8: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $DB;
     switch ($ma->getAction()) {
         case 'force_user_ldap_update':
             foreach ($ids as $id) {
                 if ($item->can($id, UPDATE)) {
                     if ($item->fields["authtype"] == Auth::LDAP || $item->fields["authtype"] == Auth::EXTERNAL) {
                         if (AuthLdap::ldapImportUserByServerId(array('method' => AuthLDAP::IDENTIFIER_LOGIN, 'value' => $item->fields["name"]), 1, $item->fields["auths_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_ON_ACTION));
                     }
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
         case 'change_authtype':
             $input = $ma->getInput();
             if (!isset($input["authtype"]) || !isset($input["auths_id"])) {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                 $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                 return;
             }
             if (Session::haveRight(self::$rightname, self::UPDATEAUTHENT)) {
                 if (User::changeAuthMethod($ids, $input["authtype"], $input["auths_id"])) {
                     $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_OK);
                 } else {
                     $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                 }
             } else {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_NORIGHT);
                 $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:pvasener,项目名称:glpi,代码行数:50,代码来源:user.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: getSpecificMassiveActions

 /**
  * @see CommonDBTM::getSpecificMassiveActions()
  **/
 function getSpecificMassiveActions($checkitem = NULL)
 {
     $actions = parent::getSpecificMassiveActions($checkitem);
     $isadmin = static::canUpdate();
     if ($this->canAdminActors()) {
         $actions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'add_actor'] = __('Add an actor');
         $actions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'update_notif'] = __('Set notifications for all actors');
     }
     if ($isadmin) {
         MassiveAction::getAddTransferList($actions);
     }
     return $actions;
 }
开发者ID:jose-martins,项目名称:glpi,代码行数:16,代码来源:change.class.php


示例11: 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)
 {
     $notimport = new PluginOcsinventoryngNotimportedcomputer();
     switch ($ma->getAction()) {
         case "plugin_ocsinventoryng_import":
             $input = $ma->getInput();
             foreach ($ids as $id) {
                 if (PluginOcsinventoryngNotimportedcomputer::computerImport(array('id' => $id, 'force' => true, 'entity' => $input['entity']))) {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                 } else {
                     $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                 }
             }
             return;
         case "plugin_ocsinventoryng_replayrules":
             foreach ($ids as $id) {
                 if (PluginOcsinventoryngNotimportedcomputer::computerImport(array('id' => $id))) {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                 } else {
                     $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                 }
             }
             return;
         case "plugin_ocsinventoryng_delete":
             foreach ($ids as $id) {
                 if ($notimport->deleteNotImportedComputer($id)) {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                 } else {
                     $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:pluginsGLPI,项目名称:ocsinventoryng,代码行数:44,代码来源:notimportedcomputer.class.php


示例12: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $DB;
     switch ($ma->getAction()) {
         case 'add_actor':
             $input = $ma->getInput();
             foreach ($ids as $id) {
                 $input2 = array('id' => $id);
                 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($id, UPDATE)) {
                     if ($item->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;
         case 'update_notif':
             $input = $ma->getInput();
             foreach ($ids as $id) {
                 if ($item->can($id, UPDATE)) {
                     $linkclass = new $item->userlinkclass();
                     foreach ($linkclass->getActors($id) as $type => $users) {
                         foreach ($users as $data) {
                             $data['use_notification'] = $input['use_notification'];
                             $linkclass->update($data);
                         }
                     }
                     $linkclass = new $this->supplierlinkclass();
                     foreach ($linkclass->getActors($id) as $type => $users) {
                         foreach ($users as $data) {
                             $data['use_notification'] = $input['use_notification'];
                             $linkclass->update($data);
                         }
                     }
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
         case 'add_task':
             if (!($task = getItemForItemtype($item->getType() . 'Task'))) {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_KO);
                 break;
             }
             $field = $item->getForeignKeyField();
             $input = $ma->getInput();
             foreach ($ids as $id) {
                 if ($item->getFromDB($id)) {
                     $input2 = array($field => $id, 'taskcategories_id' => $input['taskcategories_id'], '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_KO);
                     $ma->addMessage($item->getErrorMessage(ERROR_NOT_FOUND));
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:90,代码来源:commonitilobject.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_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


示例14: processMassiveActionsForOneItemtype

 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'export':
             foreach ($ids as $key) {
                 if ($item->can($key, UPDATE)) {
                     $item->exportPackage($key);
                     $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                 }
             }
             break;
         case 'transfert':
             $pfDeployPackage = new PluginFusioninventoryDeployPackage();
             foreach ($ids as $key) {
                 if ($pfDeployPackage->getFromDB($key)) {
                     $input = array();
                     $input['id'] = $key;
                     $input['entities_id'] = $ma->POST['entities_id'];
                     $pfDeployPackage->update($input);
                 }
             }
             break;
         case 'import':
             foreach ($ids as $key) {
                 $item->importPackage($key);
                 $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
             }
             break;
     }
     return;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:deploypackage.class.php


示例15: getSpecificMassiveActions

 /**
  * @see CommonDBTM::getSpecificMassiveActions()
  **/
 function getSpecificMassiveActions($checkitem = NULL)
 {
     $isadmin = static::canUpdate();
     $actions = parent::getSpecificMassiveActions($checkitem);
     if ($_SESSION['glpiactiveprofile']['interface'] == 'central') {
         if (TicketFollowup::canCreate()) {
             $actions['TicketFollowup' . MassiveAction::CLASS_ACTION_SEPARATOR . 'add_followup'] = __('Add a new followup');
         }
         if (TicketTask::canCreate()) {
             $actions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'add_task'] = __('Add a new task');
         }
         if (TicketValidation::canCreate()) {
             $actions['TicketValidation' . MassiveAction::CLASS_ACTION_SEPARATOR . 'submit_validation'] = __('Approval request');
         }
         if (Item_Ticket::canCreate()) {
             $actions['Item_Ticket' . MassiveAction::CLASS_ACTION_SEPARATOR . 'add_item'] = _x('button', 'Add an item');
         }
         if (Item_Ticket::canDelete()) {
             $actions['Item_Ticket' . MassiveAction::CLASS_ACTION_SEPARATOR . 'delete_item'] = _x('button', 'Remove an item');
         }
         if (Session::haveRight(self::$rightname, UPDATE)) {
             $actions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'add_actor'] = __('Add an actor');
             $actions[__CLASS__ . MassiveAction::CLASS_ACTION_SEPARATOR . 'enable_notif'] = __('Set notifications for all actors');
             $actions['Ticket_Ticket' . MassiveAction::CLASS_ACTION_SEPARATOR . 'add'] = _x('button', 'Link tickets');
         }
         if (Session::haveRight(self::$rightname, UPDATE)) {
             MassiveAction::getAddTransferList($actions);
         }
     }
     return $actions;
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:34,代码来源:ticket.class.php


示例16: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'reset':
             if (Config::canUpdate()) {
                 foreach ($ids as $key) {
                     if ($item->getFromDB($key)) {
                         if ($item->resetDate()) {
                             $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_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_NOT_FOUND));
                     }
                 }
             } else {
                 $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                 $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:31,代码来源:crontask.class.php


示例17: 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


示例18: processMassiveActionsForOneItemtype

 /**
  * @since version 0.90
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     switch ($ma->getAction()) {
         case 'merge':
             foreach ($ids as $key) {
                 if ($item->can($key, UPDATE)) {
                     if ($item->getEntityID() == $_SESSION['glpiactive_entity']) {
                         if ($item->update(array('id' => $key, 'is_recursive' => 1))) {
                             $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 {
                         $input2 = $item->fields;
                         // Change entity
                         $input2['entities_id'] = $_SESSION['glpiactive_entity'];
                         $input2['is_recursive'] = 1;
                         $input2 = Toolbox::addslashes_deep($input2);
                         if (!$item->import($input2)) {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO);
                             $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION));
                         } else {
                             $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK);
                         }
                     }
                 } else {
                     $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT);
                     $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:jose-martins,项目名称:glpi,代码行数:40,代码来源:tickettemplate.class.php


示例19: processMassiveActionsForOneItemtype

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP MasterView类代码示例发布时间:2022-05-23
下一篇:
PHP MarketplaceWebService_Model类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap