public function destroy($id) { $evaluation = Evaluation::find($id); $evaluation->delete(); Session::flash('message', 'Successfully deleted the Evaluations!'); return Redirect::to('evaluations'); }
public function assignEvaluationAction() { $id = $this->getSanParam('id'); $this->view->assign('id', $id); $evaluation = new Evaluation(); $rows = $evaluation->find($id); $row = $rows->current(); $this->view->assign('evaluation', $row); // restricted access?? only show trainings we have the ACL to view require_once 'views/helpers/TrainingViewHelper.php'; $orgWhere = ''; $org_allowed_ids = allowed_organizer_access($this); if ($org_allowed_ids) { // doesnt have acl 'training_organizer_option_all' $org_allowed_ids = implode(',', $org_allowed_ids); $orgWhere = " training_organizer_option_id in ({$org_allowed_ids}) "; } // restricted access?? only show organizers that belong to this site if its a multi org site $site_orgs = allowed_organizer_in_this_site($this); // for sites to host multiple training organizers on one domain $allowedWhereClause .= $site_orgs ? " AND training_organizer_option_id in ({$site_orgs}) " : ""; require_once 'models/table/Training.php'; $tableObj = new Training(); $trainings = $tableObj->getTrainings($orgWhere); $assigned = $evaluation->fetchAssignments($id); foreach ($trainings as $k => $r) { $trainings[$k]['input_checkbox'] = '<input type="checkbox" name="training_ids[]" value="' . $r['training_id'] . '" ' . (array_search($r['training_id'], $assigned) !== false ? ' checked="checked" ' : '') . ' >'; } $this->view->assign('trainings', $trainings); $request = $this->getRequest(); if ($request->isPost()) { $status = ValidationContainer::instance(); $training_ids = $this->getSanParam('training_ids'); $adjusted = array(); foreach ($training_ids as $tr) { $adjusted[$tr] = $tr; } require_once 'models/table/MultiOptionList.php'; MultiOptionList::updateOptions('evaluation_to_training', 'training', 'evaluation_id', $id, 'training_id', $adjusted); $_SESSION['status'] = t('The') . ' ' . t('Trainings') . ' ' . t('have been assigned.'); $status->setStatusMessage(t('The') . ' ' . t('Trainings') . ' ' . t('have been assigned.')); $status->setRedirect('/evaluation/browse'); $this->sendData($status); } }
public function edit($id) { $evaluation = Evaluation::find($id); return View::make('evaluations.edit', compact('evaluation')); }