Example #1
0
 /**
  * Teacher can publish notification for the assignment which will be sent
  * to all the students of the classroom
  * @before _secure, _teacher
  */
 public function assignment($assignment_id)
 {
     $redirect = $_SERVER['HTTP_REFERER'];
     $assignment = Assignment::first(array("id = ?" => $assignment_id));
     if (!$assignment) {
         self::redirect($redirect);
     }
     $this->JSONView();
     $view = $this->getActionView();
     $template = new Framework\View(array("file" => APP_PATH . "/application/views/notification/templates/newAssignment.html"));
     $template->set("title", $assignment->title);
     $content = $template->render();
     $classroom = TeacherService::$_classes[$assignment->classroom_id];
     $service = new Shared\Services\Classroom();
     $users = $service->enrollments($classroom, array('only_user' => true));
     $this->_save(array('type' => 'assignment', 'type_id' => $assignment->id, 'url' => '/student/assignments/' . $assignment->course_id), $content, $users);
     Registry::get("session")->set('$redirectMessage', "Notification sent to students");
     self::redirect($_SERVER['HTTP_REFERER']);
 }
Example #2
0
 /**
  * @before _secure, _student
  */
 public function submitAssignment($assgmt_id)
 {
     $assignment = \Assignment::first(array("id = ?" => $assgmt_id));
     if (!$assignment || $assignment->organization_id != $this->organization->id) {
         self::redirect("/404");
     }
     $this->setSEO(array("title" => "Submit Assignment"));
     $view = $this->getActionView();
     $service = new \Shared\Services\Assignment();
     $params = $service->submit();
     $view->set($params);
 }
Example #3
0
 /**
  * @before _secure, _teacher
  */
 public function gradeIt($assignment_id)
 {
     $this->setSEO(array("title" => "Grade assignments | Teacher"));
     $view = $this->getActionView();
     $assignment = Assignment::first(array("id = ?" => $assignment_id));
     if (!$assignment || $assignment->user_id != $this->user->id) {
         self::redirect("/404");
     }
     $classroom = TeacherService::$_classes[$assignment->classroom_id];
     $service = new Shared\Services\Classroom();
     $return = $this->_grade($assignment);
     $students = $service->enrollments($classroom, array('table' => 'submission', 'assignment_id' => $assignment->id));
     $view->set($return)->set("class", $classroom)->set("assignment", $assignment)->set('scale', array(0, 1, 2, 3, 4, 5))->set("students", $students);
 }