/** * @before _secure, _school */ public function manage() { $this->setSEO(array("title" => "Manage Teachers")); $view = $this->getActionView(); $teachers = Educator::all(array("organization_id = ?" => $this->organization->id), array("*"), "created", "desc", 30, 1); $view->set("teachers", $teachers); }
/** * @before _secure, _school */ public function edit($classroom_id, $grade_id) { $classroom = \Classroom::first(array("id = ?" => $classroom_id)); $grade = \Grade::first(array("id = ?" => $grade_id), array("id", "title", "organization_id")); if (!$classroom || $classroom->organization_id != $this->organization->id) { self::redirect("/school"); } if (!$grade || $classroom->grade_id != $grade->id || $grade->organization_id != $this->organization->id) { self::redirect("/school"); } $this->setSEO(array("title" => "Edit Section | School")); $view = $this->getActionView(); if (RequestMethods::post("action") == "editClassroom") { $classroom->year = RequestMethods::post("year"); $classroom->section = RequestMethods::post("section"); $classroom->remarks = RequestMethods::post("remarks"); $classroom->educator_id = RequestMethods::post("educator"); $classroom->save(); $view->set("success", "Grade section edited successfully!!"); } $teachers = \Educator::all(array("organization_id = ?" => $this->organization->id), array("user_id", "organization_id", "id")); $view->set("teachers", $teachers); $view->set("grade", $grade); $view->set("classroom", $classroom); }