コード例 #1
0
ファイル: group.class.php プロジェクト: geldarr/hack-space
 /**
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "add_user_group":
         case "add_supervisor_group":
         case "add_delegatee_group":
             $gu = new Group_User();
             return $gu->doSpecificMassiveActions($input);
         case "changegroup":
             if (isset($input["field"]) && isset($input['groups_id'])) {
                 foreach ($input['item'] as $type => $ids) {
                     if ($item = getItemForItemtype($type)) {
                         foreach ($ids as $id => $val) {
                             if ($val && $item->can($id, 'w')) {
                                 if ($item->update(array('id' => $id, $input["field"] => $input["groups_id"]))) {
                                     $res['ok']++;
                                 } else {
                                     $res['ko']++;
                                 }
                             } else {
                                 $res['noright']++;
                             }
                         }
                     } else {
                         $res['ko']++;
                     }
                 }
             } else {
                 $res['ko']++;
             }
             break;
         default:
             return parent::doSpecificMassiveActions($input);
     }
     return $res;
 }