protected function displayControls($save = false, $show_edit = true) { if ($save) { parent::displayControls($save, $show_edit); } else { $this->template->addFile('button_confirm_notchild.html'); } }
/** * Perform the main actions of the page. */ protected function setDisplayData() { parent::setDisplayData(); $config = I2CE::getConfig(); $ReportViewMagicData = $config->traverse("/modules/CustomReports/reportViews/"); if (!$ReportViewMagicData instanceof I2CE_MagicDataNode) { I2CE::raiseError("Bad Magic node"); return; } $AllReportViews = $ReportViewMagicData->getKeys(); $selectOptions = array(); foreach ($AllReportViews as $ReportView) { $selectOptions[$ReportView] = $ReportView; } $this->template->setDisplayData("ReportViews", $selectOptions); }
/** * Perform the main actions of the page. */ protected function action() { if ($this->get_exists('health_facility') || $this->post('is_health_facility') == "1") { $edit_form = $this->factory->createContainer("facility_institution_edit_fac"); if ($this->get_exists('health_facility')) { $edit_form->getField("health_facility")->setFromDB($this->get('health_facility')); $current = $this->search("health_facility", $edit_form->getField("health_facility")->getDBValue()); $selected = array(); foreach ($current as $id => $obj) { if ($obj->active == 1) { $selected[] = $obj->getField("training_institution")->getDBValue(); } } $edit_form->getField("training_institution")->setFromDB(implode(",", $selected)); } $this->setObject($edit_form); } elseif ($this->get_exists('training_institution') || $this->post('is_training_institution') == "1") { $edit_form = $this->factory->createContainer("facility_institution_edit_inst"); if ($this->get_exists('training_institution')) { $edit_form->getField("training_institution")->setFromDB($this->get('training_institution')); $current = $this->search("training_institution", $edit_form->getField("training_institution")->getDBValue()); $selected = array(); foreach ($current as $id => $obj) { if ($obj->active == 1) { $selected[] = $obj->getField("health_facility")->getDBValue(); } } $edit_form->getField("health_facility")->setFromDB(implode(",", $selected)); } $this->setObject($edit_form); } parent::action(); if ($edit_form->getName() == "facility_institution_edit_fac") { $this->template->addFile("facility_institution_hf.html", "tbody"); $this->template->setDisplayData("add_fac_inst", array("type" => 'health_facility', 'id' => $edit_form->getField("health_facility")->getDBValue())); $this->template->setDisplayData("facility_institution_header", "Associate Training Institutions with: " . $edit_form->getField("health_facility")->getDisplayValue()); } elseif ($edit_form->getName() == "facility_institution_edit_inst") { $this->template->addFile("facility_institution_ti.html", "tbody"); $this->template->setDisplayData("add_fac_inst", array("type" => "training_institution", "id" => $edit_form->getField("training_institution")->getDBValue())); $this->template->setDisplayData("facility_institution_header", "Associate Health Facilities with: " . $edit_form->getField("training_institution")->getDisplayValue()); } }
/** * Create and load data for the objects used for this form. */ protected function loadObjects() { $loaded = false; if ($this->isPost()) { $obj = $this->factory->createContainer("disciplinary_action"); $obj->load($this->post); $this->parent_id = $obj->getParent(); } $parent = $this->factory->createContainer($this->parent_id); $parent->populate(); $parent->populateChildren("disciplinary_action"); foreach ($parent->children as $form => $list) { if ($form != "disciplinary_action") { continue; } foreach ($list as $obj) { if ($obj->suspend) { $this->id = $obj->getId(); $this->setObject($obj); $this->setObject($parent, I2CE_PageForm::EDIT_PARENT); $loaded = true; break; } } } I2CE_PageForm::loadObjects(); if ($loaded && !$this->isPost()) { $this->getPrimary()->reinstate_date = I2CE_Date::now(); } if (!$loaded) { $this->setRedirect("view_training?id=" . $parent->getId()); } /* if ( $this->factory->exists( $this->getForm() ) ) $this->setObject( $this->factory->createContainer( $this->getForm().'|'. $this->id ) ); $parent = $this->factory->createContainer( "training".'|'. $this->parent_id ); $parent->populate(); $this->setObject( $parent, PageForm::EDIT_PARENT ); parent::loadObjects(); */ }
/** * Display the save or confirm buttons as needed. * * If the page is a confirmation view then the save / edit button template will be displayed. * Otherwise the confirm and return buttons will be shown. * @param boolean $save Flag to show the save button. (Defaults to false) * @param boolean $show_edit (defaults to true) * @global array */ protected function displayControls($save = false, $show_edit = true) { parent::displayControls($save, $show_edit); if (($return_node = $this->template->getElementByID('button_return')) instanceof DOMElement) { //$return_node->setAttribute('name','id'); $return_node->setAttribute('href', $this->getReturnLink($this->getPrimary()->getID() != '0')); } }
/** * Display the save or confirm buttons as needed. * * If the page is a confirmation view then the save / edit button template will be displayed. * Otherwise the confirm and return buttons will be shown. * @param boolean $save Flag to show the save button. (Defaults to false) * @param boolean $show_edit (defaults to true) * @global array */ protected function displayControls($save = false, $show_edit = true) { parent::displayControls($save, $show_edit); if (($node = $this->template->getElementByID('button_return')) instanceof DOMElement) { $node->setAttribute('href', $this->getParentLink(false)); } }
/** * Save the objects to the database. * * Save the default object being edited and return to the view page. If the action needs to be * logged then the {@link log} method is also called. Any pages overriding this default save method * will need to include any logging necessary. */ protected function save() { $save = true; if ($this->last instanceof iHRIS_Salary) { if (!$this->hasPermission('task(person_can_edit_child_form_salary)')) { $this->userMessage("You cannot change a person's salary", 'notice', true); $save = false; } $this->last->save($this->user); } else { if (!$this->hasPermission('task(person_can_change_child_form_salary)')) { $this->userMessage("You cannot change a person's existing salary", 'notice', true); $save = false; } } if ($save) { parent::save(); } $this->setRedirect("view?id=person|" . $this->person_id); }
/** * Save the objects to the database. * * Save the default object being edited and return to the view page. If the action needs to be * logged then the {@link log} method is also called. Any pages overriding this default save method * will need to include any logging necessary. */ protected function save() { parent::save(); $this->setRedirect("view?id=" . $this->getParent()->getParent()); }
/** * Perform the actions of the page. * * This handles some special actions because there are three versions of this page: * - The list page of all objects that can be edited. * - The add/update page for each list object. * - The edit form for each list object. * * Only in the third case is the parent object action method called since that is the default setup * for editing objects used in most other {@link PageForm} objects. */ protected function action() { if (empty($this->type)) { return $this->actionAllLists(); } if (!$this->isPost() && (strlen($this->id) == 0 || $this->id == $this->type . '|0') && !$this->get_exists('add')) { if ($this->select_field instanceof I2CE_FormField_MAPPED) { if (!$this->actionSelectMapped()) { return false; } } else { if (!$this->actionSelectList()) { return false; } } $this->setDisplayData(); } else { parent::action(); } return true; }
/** * Save the objects to the database. * * Save the default object being edited b * @global array */ protected function save() { if ($this->evaluate()) { $this->setObject($this->personScheduledTrainingCourse, I2CE_PageForm::EDIT_SECONDARY); } parent::save(); if ($this->request_exists('action') && $this->request('action') == 'updatescore') { } else { $this->setRedirect("view?id=" . $this->person->getNameId()); } return true; }
/** * Save the objects to the database. * * Save the default object being edited and return to the view page. * @global array */ protected function save() { if (!$this->permissionParser->hasTask('person_can_edit_child_form_person_scheduled_training_course')) { $this->userMessage("You do not have permission to add or edit a person's scheduleing of training course", 'notice', true); $this->setRedirect('noaccess'); return false; } parent::save(); $this->setRedirect("view?id=" . $this->getParent()->getNameId()); if (!I2CE_ModuleFactory::instance()->isEnabled('training-simple-competency')) { return; } if (!iHRIS_Module_TrainingSimpleCompetency::assignCompetenciesFromCourseEval($this->getParent(), $this->getPrimary())) { I2CE::raiseError("Could not update person competncies for" . $this->getParent()->getNameId() . " from " . $this->getPrimary()->getNameId()); } }
/** * Perform the actions of the page. */ protected function action() { if (!$this->isPost() && !$this->get_exists('username') && !$this->get_exists('add')) { if ($this->hasPermission('task(users_can_edit_all)')) { $this->template->addFile("user_list.html"); $this->listUsersToEdit('user_list'); } else { if ($this->hasPermission('task(users_can_edit)') && I2CE_User::hasDetail('creator')) { $this->template->addFile("user_list.html"); $this->listUsersToEdit('user_list', $this->user->username); } else { $this->userMessage("You can not edit users", 'notice', false); return false; } } } else { parent::action(); } }
/** * Override the default save method to redirect back the training institution page. */ protected function save() { parent::save(); $this->setRedirect("view_list?type=training_institution&id=" . $this->getParent()->getNameId()); }
/** * Set the data to be displayed for the page. */ protected function setDisplayData() { I2CE_PageForm::setDisplayData(); $this->template->setDisplayData("training_header", $this->getTitle()); $this->template->setDisplayData("training_form", "graduate"); }
protected function save() { parent::save(); $this->userMessage("Course Enrollment Scheduled Successfully"); $this->setRedirect("schedule_course_enrollment"); }
/** * Save the objects to the database. * * Save the default object being edited and return to the view page. * @global array */ protected function save() { parent::save(); $message = "This record has been saved."; I2CE::getConfig()->setIfIsSet($message, "/modules/forms/page_feedback_messages/" . $this->getPrimaryFormName() . "_save"); $this->userMessage($message); $this->setRedirect($this->getViewLink()); }
/** * Save the objects to the database. * * Save the default object being edited and return to the view page. * @global array */ protected function save() { parent::save(); $message = "This record has been saved."; I2CE::getConfig()->setIfIsSet($message, "/modules/forms/page_feedback_messages/person_child_save"); $this->userMessage($message); $this->setRedirect("view?id=" . $this->getPrimary()->getParent()); }
/** * Display the save or confirm buttons as needed. * * If the page is a confirmation view then the save / edit button template will be displayed. * Otherwise the confirm and return buttons will be shown. * @param boolean $save Flag to show the save button. (Defaults to false) * @param boolean $show_edit (defaults to true) * @global array */ protected function displayControls($save = false, $show_edit = true) { if ($save) { parent::displayControls($save, $show_edit); } elseif ($this->getPrimary()->getId() != '0') { $this->template->addFile('button_provider_confirm_notchild.html'); } else { $node = $this->template->addFile('button_provider_confirm_notchild.html'); $return = $this->template->getElementById("button_return", $node); if ($return instanceof DOMElement) { $return->setAttribute("href", "manage?action=provider"); $return->setAttribute("no_value", "true"); } } }
/** * Save the objects to the database. * * Save the default object being edited and return to the view page. * @global array */ protected function save() { parent::save(); $this->setRedirect("viewprovider?id=" . $this->getPrimary()->getParent()); }
/** * Save the objects to the database. * * This method overrides the default save because the object used to edit on this page needs * to be converted to multiple FacilityInstitution objects. */ protected function save() { parent::save(); $factory = I2CE_FormFactory::instance(); $this->redirect("view_list?type=training_institution&id=" . $this->getPrimary()->getField("training_institution")->getDBValue()); }
protected function save() { parent::save(); $this->userMessage("Semester Results Approved Successfully"); $this->setRedirect("results_approval"); }
protected function save() { $lecturer = $this->factory->createContainer("lecturer"); $lecturer->populate(); $lecturer->load($this->post); $id = $lecturer->getField("identification_number")->getDBValue(); $userObj = $this->factory->createContainer("user" . '|' . $id); $userObj->getField("username")->setFromPost($id); $userObj->getField("firstname")->setFromPost($lecturer->getField("first_name")->getDBValue()); $userObj->getField("lastname")->setFromPost($lecturer->getField("surname")->getDBValue()); $userObj->getField("role")->setFromDB($lecturer->getField("role")->getDBValue()); $userObj->getField("password")->setFromPost($lecturer->getField("surname")->getDBValue()); $userObj->save($this->user); parent::save(); $this->userMessage("Lecturer Added Successfully!!!"); $this->setRedirect("add_lecturer"); }
/** * Create and load data for the objects used for this form. */ protected function loadObjects() { $this->ff = I2CE_FormFactory::instance(); //check to ensure that the current academic year is available iHRIS_AcademicYear::ensureAcademicYear(); $selected_courses = $this->post("course"); $person_id = $this->post("person_id"); $curr_semester = $this->post("curr_semester"); $student_registration = STS_PageFormPerson::load_current_registration($person_id); if (count($selected_courses) == 0) { $this->userMessage("No courses Selected!!!"); $this->setRedirect("view?id=" . $this->person_id); } foreach ($selected_courses as $course) { $courseObj = $this->factory->createContainer($course); $courseObj->populate(); $total_credits = $total_credits + $courseObj->getField("course_credits")->getDBValue(); } $selected_courses = implode(",", $selected_courses); $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" => "semester", "style" => "equals", "data" => array("value" => $curr_semester)), 2 => array("operator" => "FIELD_LIMIT", "field" => "registration", "style" => "equals", "data" => array("value" => $student_registration["id"])))); $enrolled_courses = I2CE_FormStorage::search("enroll_course", false, $where); if (count($enrolled_courses) > 0) { foreach ($enrolled_courses as $enrollment) { $course_enrollment_form = "enroll_course|" . $enrollment; } } else { $course_enrollment_form = "enroll_course"; } if (!($enrollcourseObj = $this->ff->createContainer($course_enrollment_form)) instanceof I2CE_Form) { I2CE::raiseError("Invalid Object"); return false; } $trainingCourseField = $enrollcourseObj->getField("training"); $trainingCourseField->setFromPost($selected_courses); $date_enrolled = date("Y-m-d"); $enrollcourseObj->getField("date_enrolled")->setFromDB($date_enrolled); $semesterField = $enrollcourseObj->getField("semester"); $semesterField->setFromPost($curr_semester); $enrollcourseObj->getField("total_credits")->setValue($total_credits); $enrollcourseObj->getField("registration")->setFromDB($student_registration["id"]); $current_academic_year = iHRIS_AcademicYear::currentAcademicYear(); $academic_year_id = iHRIS_AcademicYear::academicYearId($current_academic_year); $academic_year_id = "academic_year|" . $academic_year_id; if (!($academicYearField = $enrollcourseObj->getField("academic_year")) instanceof I2CE_FormField_MAP) { return; } $academicYearField->setFromDB($academic_year_id); $parentObj = $this->ff->createContainer($person_id); if ($parentObj instanceof I2CE_Form) { $parentObj->populate(); } $this->setObject($enrollcourseObj, I2CE_PageForm::EDIT_PRIMARY); $this->setObject($parentObj, I2CE_PageForm::EDIT_PARENT); parent::save(); $this->userMessage("Courses Enrolled Successfully"); $this->setRedirect("view?id=" . $person_id); return true; }
/** * Save the objects to the database. * * Save the default object being edited and return to the view page. */ protected function save() { if (!$this->requested_user) { return false; } parent::save(); if (!$this->sendVerificationEmail()) { $msg = "We had difficulty in sending an e-mail to (%s). Please contact the system administrator"; I2CE::getConfig()->setIfIsSet($msg, "/modules/RequestAccount-VerifyEmail/user_messages/verify_email_fail"); } else { $msg = "Please check your email to confirm your e-mail address (%s) in order to login."; I2CE::getConfig()->setIfIsSet($msg, "/modules/RequestAccount-VerifyEmail/user_messages/verify_email"); } $msg = sprintf($msg, $this->requested_user->email); $this->userMessage($msg); $this->setRedirect('home'); }
/** * Create and load data for the objects used for this form. */ protected function loadObjects() { $loaded = false; if ($this->isPost()) { $obj = $this->factory->createContainer("training_disrupt"); $obj->load($this->post); $this->parent_id = $obj->getParent(); } $parent = $this->factory->createContainer($this->parent_id); $parent->populate(); $parent->populateChildren("training_disrupt"); foreach ($parent->children as $form => $list) { if ($form != "training_disrupt") { continue; } foreach ($list as $obj) { if (!I2CE_Validate::checkDate($obj->resumption_date)) { $this->id = $obj->getId(); $this->setObject($obj); $this->setObject($parent, I2CE_PageForm::EDIT_PARENT); $loaded = true; break; } } } I2CE_PageForm::loadObjects(); if (!$loaded) { $this->setRedirect("view_training?id=" . $parent->getId()); } }
/** * Save the objects to the database. * * Save the default object being edited and return to the view page. * @global array */ protected function save() { $saved = parent::save(); $this->userMessage("Course Rescheduled Successfully"); $this->setRedirect("reschedule_course"); return $saved; }
/** * Save the objects to the database. * * Save the default object being edited and return to the view page. * @global array */ protected function save() { $saved = parent::save(); if ($saved !== false) { $message = "This record has been saved."; I2CE::getConfig()->setIfIsSet($message, "/modules/forms/page_feedback_messages/person_child_save"); } else { $message = "This record has not been saved."; I2CE::getConfig()->setIfIsSet($message, "/modules/forms/page_feedback_messages/person_child_not_save"); } $this->userMessage($message); $this->setRedirect("view?id=" . $this->getPrimary()->getParent()); return $saved; }
protected function save() { if (!parent::save()) { return false; } $this->setRedirect($this->getReturnLink(true)); }
/** * Load the template (HTML or XML) files to the template object. * * */ protected function loadHTMLTemplates() { parent::loadHTMLTemplates(); $evaluationsNode = $this->template->getElementById('list_evaluations'); if (!$evaluationsNode instanceof DOMNode) { I2CE::raiseError("Don't know where to list evaluations"); return false; } $comp_added = false; foreach ($this->node_ids[I2CE_PageForm::EDIT_SECONDARY] as $node) { if ($node instanceof DOMNode) { $comp_added = true; $evaluationsNode->appendChild($node); } } if (!$comp_added) { $this->template->addFile("training_course_evaluation_no_competency.html", "div"); } }
/** * Save the objects to the database. * * Save the default object being edited and return to the view page. * @global array */ protected function save() { /** * Check the number of semesters that have elapsed since this student dropped,if < 10 then a student may proceed,otherwise readmit to sem 1 */ $dropObj = $this->factory->createContainer("drop_semester"); $dropObj->load($this->post); $resObj = $this->factory->createContainer("resume_semester"); $resObj->load($this->post); $drp_sem_ac = $dropObj->getField("academic_year")->getDBValue(); $drp_month = $dropObj->getField("drop_date")->getDBValue(); $res_sem_ac = $resObj->getField("academic_year")->getDBValue(); $drpacObj = $this->factory->createContainer($drp_sem_ac); $drpacObj->populate(); $drp_sem_ac_name = $drpacObj->getField("name")->getDBValue(); $resacObj = $this->factory->createContainer($res_sem_ac); $resacObj->populate(); $res_sem_ac_name = $resacObj->getField("name")->getDBValue(); $ac_year1 = explode("/", $drp_sem_ac_name); $ac_year1 = $ac_year1[0]; $ac_year2 = explode("/", $res_sem_ac_name); $ac_year2 = $ac_year2[0]; if ($drp_sem_ac_name != $res_sem_ac_name) { $res_month = $resObj->getField("resume_date")->getDBValue(); $drp_month = explode("-", $drp_month); $drp_month = $drp_month[1]; $res_month = explode("-", $res_month); $res_month = $res_month[1]; $ac_year_diff = $ac_year2 - $ac_year1; if ($drp_month >= 7 and $drp_month <= 12) { $sem = $sem + 2; } else { if ($drp_month >= 1 and $drp_month <= 5) { $sem = $sem + 1; } } if ($res_month >= 7 and $res_month <= 12) { $sem = $sem + 0; } else { if ($res_month >= 1 and $res_month <= 5) { $sem = $sem + 1; } } $sem = $sem + ($ac_year_diff - 1) * 2; } else { $sem = 1; } //if a student resumes after 10 semesters have elapsed,take him/her to semester one if ($sem > 10) { $student_registration = STS_PageFormPerson::load_current_registration($this->person); //mark the ongoing registration as expired and create the new one $regObj = $this->factory->createContainer($student_registration["id"]); $regObj->populate(); $regObj->getField("registration_status")->setFromDB("registration_status|expired"); $regObj->getField("expire_date")->setFromDB($resObj->getField("resume_date")->getDBValue()); $regObj->save($this->user); $regObj->cleanup(); unset($regObj); //create the new registration $regObj = $this->factory->createContainer("registration"); $regObj->populate(); $regObj->getField("parent")->setFromDB($this->person); $regObj->getField("admission_type")->setFromDB($student_registration["admission_type"]); $regObj->getField("council_reg_num")->setFromDB($student_registration["council_reg_num"]); $regObj->getField("identification_number")->setFromDB($student_registration["identification_number"]); $regObj->getField("identification_type")->setFromDB($student_registration["identification_type"]); $regObj->getField("joined_semester")->setFromDB("semester|1"); $regObj->getField("registration_number")->setFromDB($student_registration["registration_number"]); $regObj->getField("registration_status")->setFromDB("registration_status|ongoing"); $regObj->getField("training_institution")->setFromDB($student_registration["training_institution"]); $regObj->getField("training_program")->setFromDB($student_registration["training_program"]); $reg_date = $resObj->getField("resume_date")->getDBValue(); $reg_date = date("Y-m-d", strtotime($reg_date)); $regObj->getField("registration_date")->setFromPost($reg_date); $regObj->getField("semester")->setFromDB("semester|1"); $regObj->getField("academic_level")->setFromDB("academic_level|1"); $regObj->getField("academic_year")->setFromDB($resObj->getField("academic_year")->getDBValue()); $regObj->save($this->user); //add this student to the rejoin form for tracking info $ac_year_ended = $drp_sem_ac; $ac_year_rejoin = $res_sem_ac; $rejoin_reason = "rejoin_reason|dropped_semester"; $rejoinObj = $this->factory->createContainer("rejoin"); $rejoinObj->getField("academic_year_ended")->setFromDB($dropObj->getField("academic_year")->getDBValue()); $rejoinObj->getField("academic_year_rejoin")->setFromDB($resObj->getField("academic_year")->getDBValue()); $rejoinObj->getField("prev_registration")->setFromDB($student_registration["id"]); $rejoinObj->getField("new_registration")->setFromDB("registration|" . $regObj->getID()); $rejoinObj->getField("rejoin_reason")->setFromDB($rejoin_reason); $rejoinObj->save($this->user); } $saved = parent::save(); if ($saved !== false) { $message = "Student Resumed Successfully."; } else { $message = "This Student Has Not Been Resumed."; } $this->userMessage($message); $this->setRedirect("view?id=" . $this->person->getNameId()); return $saved; }