コード例 #1
0
ファイル: action.php プロジェクト: nemein/openpsa
 /**
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  */
 public function _handler_action($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_valid_user();
     // Check if we get the group
     $data['group'] = new org_openpsa_contacts_group_dba($args[0]);
     // Check if the action is a valid one
     $data['action'] = $args[1];
     switch ($args[1]) {
         case "update_member_title":
             // Ajax save handler
             $update_succeeded = false;
             $errstr = null;
             if (array_key_exists('member_title', $_POST) && is_array($_POST['member_title'])) {
                 foreach ($_POST['member_title'] as $id => $title) {
                     $update_succeeded = false;
                     try {
                         $member = new midcom_db_member($id);
                         $member->require_do('midgard:update');
                         $member->extra = $title;
                         $update_succeeded = $member->update();
                     } catch (midcom_error $e) {
                         $e->log();
                     }
                     $errstr = midcom_connection::get_error_string();
                 }
             }
             $response = new midcom_response_xml();
             $response->result = $update_succeeded;
             $response->status = $errstr;
             return $response;
         case "members":
             // Group person listing, always work even if there are none
             $this->_view = "area_group_members";
             break;
         case "subgroups":
             // Group person listing, always work even if there are none
             $this->_view = "area_group_subgroups";
             break;
         default:
             throw new midcom_error('Unknown action ' . $args[1]);
     }
 }