protected function save()
 {
     parent::save();
     /*$message = "This record has been saved.";
       I2CE::getConfig()->setIfIsSet( $message, "/modules/forms/page_feedback_messages/person_save" );
       $this->userMessage($message);
       $this->setRedirect(  "view?id=" . $this->getPrimary()->getNameId() );*/
     $this->setRedirect("view_list?type=dataset&id=" . $this->getPrimary()->getNameId());
 }
 protected function save()
 {
     parent::save();
     $fields = $this->post['forms']['dataelement'][0][0]['fields'];
     $dataElementName = $fields['name'];
     $dataElementShortName = $fields['shortname'];
     $dataElementCode = $fields['dataelement_code'];
     $today = date("F d, Y");
     $url = false;
     if (!I2CE::getConfig()->setIfIsSet($url, "/modules/DHIS-Dashboard/urls/data_sync") || !$url) {
         I2CE::raiseError("Bad url for data sync");
         return false;
     }
     $curl_parameters = array('DataElementName' => $dataElementName, 'OrganisationUnitName' => "default", 'AggValue' => "4", 'PeriodStart' => $today, 'PeriodTypeString' => 'Monthly');
     $username = false;
     $password = false;
     if (!I2CE::getConfig()->setIfIsSet($username, "/modules/DHIS-Dashboard/credentials/username") || !$username) {
         I2CE::raiseError("No username set");
         return false;
     }
     if (!I2CE::getConfig()->setIfIsSet($password, "/modules/DHIS-Dashboard/credentials/password") || !$username) {
         I2CE::raiseError("No password set");
         return false;
     }
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_USERPWD, "{$username}:{$password}");
     curl_setopt($ch, CURLOPT_HEADER, 1);
     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($curl_parameters));
     $content = curl_exec($ch);
     $info = curl_getinfo($ch);
     if ($content === false || $info['http_code'] != 200) {
         $output = "\nNo cURL data returned for {$url} [" . $info['http_code'] . "]";
         if (curl_error($ch)) {
             $output .= "\n" . curl_error($ch);
         }
         echo $output;
     }
     curl_close($ch);
     $this->setRedirect("view_list?type=dataelement&id=" . $this->getPrimary()->getNameId());
 }
 protected function save()
 {
     if (!parent::save()) {
         return false;
     }
     $this->setRedirect($this->getReturnLink(true));
 }
 /**
  * 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;
 }
 /**
  * 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());
 }
 /**
  * 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()->getNameId());
 }
 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.
  */
 protected function save()
 {
     if (!$this->hasPermission('task(users_can_edit)')) {
         $this->userMessage('You cannot edit users', 'notice', true);
         $this->setRedirect("home");
         return false;
     }
     if (I2CE_User::hasDetail('creator')) {
         $this->getPrimary()->creator = $this->user->username;
         $this->fields['creator'] = $this->user->username;
     }
     parent::save();
     $this->setRedirect("view_user?username=" . $this->getPrimary()->username);
 }
 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");
 }
 /**
  * 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());
 }
 /**
  * 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());
     }
 }
 /**
  * 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.
  * @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;
 }
 /**
  * Save the objects to the database.
  * 
  * Save the default object being edited and return to the view page.
  */
 protected function save()
 {
     if ($this->creatingNewUser()) {
         if (!$this->userObj instanceof I2CE_User_Form || !($username = $this->userObj->username) || !$this->userMap instanceof I2CE_Form) {
             return false;
         }
         $accessMech = I2CE::getUserAccess();
         if ($accessMech->userExists($username, false)) {
             I2CE::raiseError("Trying to recreate existing user : "******"There was an error submitting your application");
         $this->setRedirect('login');
     } else {
         if ($this->creatingNewUser()) {
             $this->user->login($this->userObj->username, $this->userObj->password);
             $this->setRedirect("view?id=" . $this->getPrimary()->getNameId());
         } else {
             $this->userMessage("Thank you for your application");
             $this->setRedirect('login');
         }
     }
 }
 /**
  * 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());
 }
 /**
  * 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());
 }
 /**
  * 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_training?id=" . $this->getPrimary()->getParent());
 }
 protected function save()
 {
     parent::save();
     $this->userMessage("Semester Results Approved Successfully");
     $this->setRedirect("results_approval");
 }
 /**
  * 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;
 }
 /**
  * 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.
  * @global array
  */
 protected function save()
 {
     parent::save();
     $message = "This record has been saved.";
     I2CE::getConfig()->setIfIsSet($message, "/modules/forms/page_feedback_messages/" . $this->getParentFormName() . "_child_save");
     $this->userMessage($message);
     $this->setRedirect($this->getParentLink(true));
 }
 /**
  * Save the objects to the database.
  * 
  * Save the list object being edited and return to the appropriate admin page.
  */
 protected function save()
 {
     if (parent::save() === false) {
         return false;
     }
     if ($this->post_exists('redirect')) {
         $redirect = $this->post('redirect');
     } else {
         if ($this->post_exists('redirect_byid')) {
             $redirect = $this->post('redirect_byid') . $this->getPrimary()->getNameId();
         } else {
             $use_id = $this->getPrimary()->getNameId();
             $redirect = $this->getViewPage($this->type) . "?type=" . $this->type . "&id=" . $use_id;
         }
     }
     $this->setRedirect($redirect);
     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');
 }
 /**
  * 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/" . $this->getParentFormName() . "_save");
     } else {
         $message = "This record has not been saved.";
         I2CE::getConfig()->setIfIsSet($message, "/modules/forms/page_feedback_messages/" . $this->getParentFormName() . "_not_save");
     }
     $this->userMessage($message);
     $this->setRedirect($this->getParentLink(true));
     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()
 {
     parent::save();
     $this->setRedirect("view_user?username=" . $this->getParent()->username);
 }