예제 #1
0
 public function changepartstatus()
 {
     try {
         if (Check::digits($_POST['study_id'], $empty = false)) {
             $study_id = $_POST['study_id'];
         } else {
             throw new Exception("bad study id!");
         }
         if (Check::digits($_POST['participant_id'])) {
             $part_id = $_POST['participant_id'];
         } else {
             throw new Exception("bad participant id!");
         }
         $active = $_POST['active'] ? 1 : 0;
         $e = new Enrollment();
         if ($e->upd(array('participant_id' => $part_id, 'study_id' => $study_id), array('active' => $active)) === false) {
             throw new Exception($e->err());
         }
         View::assign('study_id', $study_id);
         return 'participants.tpl';
     } catch (Exception $e) {
         $this->err($e);
         View::assign('error', $this->error);
         return 'error.tpl';
     }
 }