Example #1
0
 /**
  * Processes all actions
  *
  * @return array errors
  */
 protected function process_submit()
 {
     if (!$this->request->is_set($this->action_name)) {
         return array();
     }
     $action = $this->request->variable($this->action_name, '');
     if (!$this->survey->enabled) {
         return array($this->user->lang('SURVEY_IS_DISABLED'));
     }
     $can_manage = $this->survey->can_manage($this->user->data['user_id']);
     if (!$can_manage && preg_match("/^(config_change|close|reopen|question_addition_or_modification|question_deletion|question_load_modify|delete|disable)\$/", $action)) {
         return array($this->user->lang('NO_AUTH_OPERATION'));
     }
     if ($this->survey->is_closed() && !$can_manage) {
         return array($this->user->lang('SURVEY_IS_CLOSED'));
     }
     if ($action == "config_change") {
         return $this->process_config_change();
     }
     if ($action == "reopen") {
         if (!$this->survey->is_closed()) {
             return array($this->user->lang('SURVEY_IS_NOT_CLOSED'));
         }
         return $this->process_reopen();
     }
     if ($action == "close") {
         if ($this->survey->is_closed()) {
             return array($this->user->lang('SURVEY_IS_CLOSED', $this->user->format_date($this->survey->settings['stop_time'])));
         }
         return $this->process_close();
     }
     if ($action == "entry_deletion") {
         return $this->process_entry_deletion();
     }
     if ($action == "entry_modification") {
         return $this->process_entry_modification();
     }
     if ($action == "question_addition_or_modification") {
         return $this->process_question_addition_or_modification();
     }
     if ($action == "question_deletion") {
         return $this->process_question_deletion();
     }
     if ($action == "question_load_modify") {
         return $this->process_question_load_modify();
     }
     if ($action == "disable") {
         return $this->process_disable();
     }
     if ($action == "delete") {
         return $this->process_delete();
     }
     return array();
 }