public function deleteAction()
 {
     if (!$this->hasACL('edit_people')) {
         $this->doNoAccessError();
     }
     $status = ValidationContainer::instance();
     $id = $this->getSanParam('id');
     if ($id and !Person::isReferenced($id)) {
         $trainer = new Trainer();
         $rows = $trainer->find($id);
         $row = $rows->current();
         if ($row) {
             $trainer->delete('person_id = ' . $row->person_id);
         }
         $person = new Person();
         $rows = $person->find($id);
         $row = $rows->current();
         if ($row) {
             $person->delete('id = ' . $row->id);
         }
         $status->setStatusMessage(t('That person was deleted.'));
     } else {
         if (!$id) {
             $status->setStatusMessage(t('That person could not be found.'));
         } else {
             $status->setStatusMessage(t('That person is an active') . ' ' . t('participant') . ' ' . t('or') . ' ' . t('trainer') . ' ' . t('and could not be deleted.'));
         }
     }
     //validate
     $this->view->assign('status', $status);
 }
Exemplo n.º 2
0
 public function getApproveRequest($rid, $tid, $cid)
 {
     $trainer = Trainer::find($tid);
     $client = Client::find($cid);
     $client->trainer()->associate($trainer);
     $client->save();
     DB::table('requests')->where('id', '=', $rid)->delete();
     return Redirect::to('admin/requests');
 }