static function academicYearId($academic_year) { $where = array("operator" => "FIELD_LIMIT", "field" => "name", "style" => "equals", "data" => array("value" => $academic_year)); $academic_year_array = I2CE_FormStorage::Search("academic_year", false, $where); foreach ($academic_year_array as $academic_year_id) { return $academic_year_id; } }
protected function showCourses() { if (!($listNode = $this->template->getElementByID("existing_course_list")) instanceof DOMNode) { return; } if ($this->getUser()->role == "registrar" || $this->getUser()->role == "lecturer" || $this->getUser()->role == "hod" || $this->getUser()->role == "principal" || $this->getUser()->role == "deputy_principal") { ######getting id of the currently logged in lecturer###### $username = $this->getUser()->username; $where = array("operator" => "FIELD_LIMIT", "field" => "identification_number", "style" => "equals", "data" => array("value" => $username)); $lecturer = I2CE_FormStorage::search("lecturer", false, $where); foreach ($lecturer as $id) { $lecturer_id = "lecturer|" . $id; } ######Getting the current academic year###### $academic_year = iHRIS_AcademicYear::currentAcademicYear(); $where = array("operator" => "FIELD_LIMIT", "field" => "name", "style" => "equals", "data" => array("value" => $academic_year)); $academic_year_id = I2CE_FormStorage::Search("academic_year", false, $where); $academic_year_id = "academic_year|" . $academic_year_id[0]; ######Getting a list of courses assigned to this lecturer###### $where_assign_course = array("operator" => "AND", "operand" => array(0 => array("operator" => "FIELD_LIMIT", "field" => "lecturer", "style" => "equals", "data" => array("value" => $lecturer_id)), 1 => array("operator" => "FIELD_LIMIT", "field" => "academic_year", "style" => "equals", "data" => array("value" => $academic_year_id)))); $assigned_courses = I2CE_FormStorage::listFields("assign_course_trainer", array("training"), false, $where_assign_course); } else { $this->userMessage("Login as a training provider to add results"); $this->redirect("manage?action=provider"); return false; } ######Displaying courses assigned to this lecturer###### if (count($assigned_courses) == 0) { $this->userMessage("No courses assigned to you,contact the Registrar for further assistance"); $this->redirect("manage?action=provider"); return false; } foreach ($assigned_courses as $id => $course) { $course_id = explode("|", $course["training"]); $course_id = $course_id[1]; $where = array("operator" => "FIELD_LIMIT", "field" => "id", "style" => "equals", "data" => array("value" => $course_id)); $training_courses = I2CE_FormStorage::ListFields("training", array("name", "code"), false, $where); foreach ($training_courses as $id => $training_course) { $course_name = $training_course["name"]; $course_code = $training_course["code"]; $course = $course_code . "-" . $course_name; $id = "training|" . $id; $aNode = $this->template->createElement("a", array(href => "add_results?id=" . $id), $course); $liNode = $this->template->createElement("li"); $this->template->appendNode($aNode, $liNode); $this->template->appendNode($liNode, $listNode); } } }
protected function action() { $role = $this->getUser()->role; if ($role != "student") { $this->userMessage("Only A Student Can Enroll Into Courses"); $this->setRedirect("view?id=" . $this->Get("parent")); return false; } iHRIS_AcademicYear::ensureAcademicYear(); $this->person_id = $this->Get("parent"); $this->getProgramAndSemester(); ############Deny Course Registration For A Student Dropped Out Of Semester################### $persObj = I2CE_FormFactory::instance()->createContainer($this->person_id); $persObj->populateChildren("drop_semester"); foreach ($persObj->getChildren("drop_semester") as $dropSemObj) { //check to insure that this drop semester is the one that belongs to the current registration if ($dropSemObj->getField("registration")->getDBValue() != $this->student_registration["id"]) { continue; } $dropSemObj->populateChildren("resume_semester"); $resSemObj = $dropSemObj->getChildren("resume_semester"); if (count($resSemObj) == 0) { $this->userMessage("You Are Currently Dropped From A Semester,Course Enrollment Not Allowed"); $this->setRedirect("view?id=" . $this->person_id); return; } } ############End Of Denying Course Registration For A Student Dropped Out Of Semester################### ############checking if course enrollment closed################# $username = $this->getUser()->username; $this->training_institution = iHRIS_PageFormLecturer::fetch_institution($username); $where = array("operator" => "FIELD_LIMIT", "field" => "training_institution", "style" => "equals", "data" => array("value" => $this->training_institution)); $fields = I2CE_FormStorage::listFields("schedule_course_enrollment", array("start_date", "end_date"), false, $where); foreach ($fields as $id => $field) { $start_date = $field["start_date"]; $end_date = $field["end_date"]; } if (count($fields) == 0) { $this->userMessage("Course Registration Closed"); $this->setRedirect("view?id=" . self::$person_id); return false; } else { $start_date = strtotime($start_date); $end_date = strtotime($end_date); $today = strtotime(date("Y-m-d")); if ($today > $end_date) { $this->userMessage("Course Registration Closed"); $this->setRedirect("view?id=" . self::$person_id); return false; } } ########### End checking of course enrollment deadline ##################### ########### Check if this student is not discontinued ##################### if ($this->check_discontinue($this->person_id)) { $this->userMessage("You have discontinued from this program!!!"); $this->setRedirect("view?id=" . $this->person_id); return false; } ########### End of checking if a student has discontinued ################# ########### If its a new semester then increment the semester and level ################ ######get total number of semesters###### list($prog_form, $prog_id) = array_pad(explode("|", $this->program, 2), 2, ""); $total_sems = I2CE_FormStorage::lookupField("training_program", $prog_id, array("total_semesters"), false); $total_semesters = $total_sems["total_semesters"]; ######end of getting total number of semesters###### ######get passing score###### list($inst_form, $inst_id) = array_pad(explode("|", $this->training_institution, 2), 2, ""); $pass_score = I2CE_FormStorage::lookupField("training_institution", $inst_id, array("passing_score"), false); $this->passing_score = $pass_score["passing_score"]; ######end of getting passing score###### $semester_name = self::getSemesterName($this->curr_semester); $where_GPA = array("operator" => "AND", "operand" => array(0 => array("operator" => "FIELD_LIMIT", "field" => "parent", "style" => "equals", "data" => array("value" => $this->person_id)), 1 => array("operator" => "FIELD_LIMIT", "field" => "semester", "style" => "equals", "data" => array("value" => $this->curr_semester))), 2 => array("operator" => "FIELD_LIMIT", "field" => "registration", "style" => "equals", "data" => array("value" => $this->student_registration["id"]))); ######if GPA for current semester available then increment the semester###### $sem_GPA = I2CE_FormStorage::Search("semester_GPA", false, $where_GPA); if (count($sem_GPA) > 0 and $semester_name < $total_semesters) { $regObj = $this->factory->createContainer($this->student_registration["id"]); list($form, $level) = array_pad(explode("|", $this->curr_level, 2), 2, ""); $semester_name = ++$semester_name; if ($semester_name % 2 != 0) { $new_level = ++$level; } $new_semester = "semester|" . $semester_name; $user = new I2CE_User(); $regObj->populate(); $regObj->getField("semester")->setFromDB($new_semester); if ($semester_name % 2 != 0) { $regObj->getField("academic_level")->setFromDB("academic_level|" . $new_level); } $regObj->save($user); } ########### End of incrementing the semester and level ############ $this->getProgramCourses($this->curr_semester); $this->getElectiveCourses($this->curr_semester); $this->getPreviousSemesterCourses($this->curr_semester); if (count($this->subject_courses) == 0 and count($this->elective_courses) == 0) { $this->userMessage("No courses defined into the system,try later on!!!"); $this->setRedirect("view?id=" . $this->person_id); } $this->displayCourses($this->subject_courses, "subject", "Subject Courses"); if (count($this->elective_courses) > 0) { $this->displayCourses($this->elective_courses, "elective", "Elective Courses"); } //append hidden values to be used on the onload if (!($hidden = $this->template->getElementByID("hidden_values")) instanceof DOMNode) { return; } $input = $this->template->createElement("input", array("type" => "hidden", "name" => "person_id", "value" => $this->person_id)); $this->template->appendNode($input, $hidden); $input = $this->template->createElement("input", array("type" => "hidden", "name" => "curr_semester", "value" => $this->curr_semester)); $this->template->appendNode($input, $hidden); if (!($div = $this->template->getElementByID("button")) instanceof DOMNode) { return; } $input = $this->template->createElement("input", array("type" => "submit", "value" => "Save")); $this->template->appendNode($input, $div); }
protected function checkResults($exam_type, $person_id, $training_courses, $enroll_academic_year, $enroll_id) { $where = array("operator" => "AND", "operand" => array(0 => array("operator" => "FIELD_LIMIT", "field" => "parent", "style" => "equals", "data" => array("value" => $person_id)), 1 => array("operator" => "FIELD_LIMIT", "field" => "training", "style" => "equals", "data" => array("value" => $training_courses)), 2 => array("operator" => "FIELD_LIMIT", "field" => "enroll_course", "style" => "equals", "data" => array("value" => "enroll_course|" . $enroll_id)))); $id = I2CE_FormStorage::Search("students_results_grade", false, $where); $id = $id[0]; $resultsObj = $this->ff->createContainer("students_results_grade|" . $id); $resultsObj->populateChildren("students_results"); $result = array(); foreach ($resultsObj->getChildren("students_results") as $results) { $assessment = $results->getFIeld("training_course_exam_type")->getDBValue(); if ($assessment == $exam_type) { $mark = $results->getFIeld("score")->getDBValue(); $results_id = $results->getFIeld("id")->getDBValue(); $result[$id] = $mark; } } return $result; }
protected function getDiscoForm() { $where = array("operator" => "AND", "operand" => array(0 => array("operator" => "FIELD_LIMIT", "field" => "parent", "style" => "equals", "data" => array("value" => $this->person_id)), 1 => array("operator" => "FIELD_LIMIT", "field" => "registration", "style" => "equals", "data" => array("value" => $this->student_registration["id"])))); $disco = I2CE_FormStorage::Search("discontinued", false, $where); if (count($disco) > 0) { return "discontinued|" . $disco[0]; } else { return "discontinued"; } }