/** * grab the schedule for a task in a study */ function smarty_function_schedule($params, &$smarty) { if (!Check::digits($params['study_id'])) { return; } if (!Check::digits($params['task_id'])) { return; } $s = new Schedule(); $smarty->assign('schedule', $s->getone(array('study_id' => $params['study_id'], 'task_id' => $params['task_id']))); }
public function copytask() { try { if (!Check::digits($_REQUEST['study_id'], $empty = false)) { throw new Exception("bad study id!"); } else { $study_id = $_REQUEST['study_id']; } if (!Check::digits($_REQUEST['task_id'])) { throw new Exception("bad task id!"); } else { $task_id = $_REQUEST['task_id']; } $t = new Task(); $s = new Schedule(); $task = $t->getone($task_id); $sched = $s->getone(array('study_id' => $study_id, 'task_id' => $task_id)); unset($task['task_id']); $t->ins($task); $new_task_id = $t->getid(); $title = $task['task_title']; $title = preg_replace('#\\s*\\(\\d+\\)$#', '', $title); $title .= " ({$new_task_id})"; $t->upd($new_task_id, array('task_title' => $title, 'forms_locked' => 0)); $sched['task_id'] = $new_task_id; $s->ins($sched); View::assign('study_id', $study_id); return "study.tpl"; } catch (Exception $e) { $this->err($e); View::assign('error', $this->error); return 'error.tpl'; } }
/** * make the $forms member and output it as xml * this is what gets sent when a phone requests details for a task */ public function forms2xml($task_id, $study_id) { # this will set the forms and task members $s = new Schedule(); $this->sched = $s->getone(array('task_id' => $task_id, 'study_id' => $study_id)); $this->parseforms($task_id); return $this->formstring2xml(); }