当前位置: 首页>>代码示例>>PHP>>正文


PHP I2CE_FormStorage类代码示例

本文整理汇总了PHP中I2CE_FormStorage的典型用法代码示例。如果您正苦于以下问题:PHP I2CE_FormStorage类的具体用法?PHP I2CE_FormStorage怎么用?PHP I2CE_FormStorage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了I2CE_FormStorage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action

 /**
  * Perform the actions of this page.
  * @return boolean
  */
 protected function action()
 {
     if (parent::action()) {
         $next_month = getdate(mktime(0, 0, 0, $this->month + 1, 1, $this->year));
         $db_start = sprintf('%04d-%02d-%02d', $this->year, $this->month, 1);
         $db_end = sprintf('%04d-%02d-%02d', $next_month['year'], $next_month['mon'], $next_month['mday']);
         $find_instances = array('operator' => 'OR', 'operand' => array(0 => array('operator' => 'AND', 'operand' => array(0 => array('operator' => 'FIELD_LIMIT', 'style' => 'greaterthan_equals', 'field' => 'start_date', 'data' => array('value' => $db_start)), 1 => array('operator' => 'FIELD_LIMIT', 'style' => 'lessthan', 'field' => 'start_date', 'data' => array('value' => $db_end)))), 1 => array('operator' => 'AND', 'operand' => array(0 => array('operator' => 'FIELD_LIMIT', 'style' => 'greaterthan_equals', 'field' => 'end_date', 'data' => array('value' => $db_start)), 1 => array('operator' => 'FIELD_LIMIT', 'style' => 'lessthan', 'field' => 'end_date', 'data' => array('value' => $db_end))))));
         $instances = I2CE_FormStorage::search("scheduled_training_course", false, $find_instances);
         $factory = I2CE_FormFactory::instance();
         $month_end = new DateTime($db_end);
         $deviation = 35;
         $base = array(70, 116, 149);
         foreach ($instances as $instance) {
             $rgb = array();
             foreach ($base as $idx => $num) {
                 $rgb[$idx] = rand($num - $deviation, $num + $deviation);
             }
             $inst = $factory->createContainer("scheduled_training_course|{$instance}");
             $inst->populate();
             $this->addForm($inst, $inst->start_date->getDateTimeObj(), $inst->end_date->getDateTimeObj(), 'calendar_training_course_day.html', $rgb);
         }
     } else {
         return false;
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:30,代码来源:iHRIS_PageCalendarTraining.php

示例2: save

 /**
  * Check for duplicates and save the user alert
  * @param I2CE_User $user
  * @param boolean $transact
  * @return boolean
  */
 public function save($user, $transact = true)
 {
     if ($this->getId() === '0') {
         $find_duplicates = array('operator' => 'AND', 'operand' => array(array('operator' => 'FIELD_LIMIT', 'field' => 'message', 'style' => 'lowerequals', 'data' => array('value' => strtolower($this->message))), array('operator' => 'FIELD_LIMIT', 'field' => 'time_ack', 'style' => 'null'), array('operator' => 'FIELD_LIMIT', 'field' => 'alert_type', 'style' => 'equals', 'data' => array('value' => $this->alert_type))));
         if ($this->link == '') {
             $find_duplicates['operand'][] = array('operator' => 'FIELD_LIMIT', 'field' => 'link', 'style' => 'null');
         } else {
             $find_duplicates['operand'][] = array('operator' => 'FIELD_LIMIT', 'field' => 'link', 'style' => 'equals', 'data' => array('value' => $this->link));
         }
         if ($this->link_text == '') {
             $find_duplicates['operand'][] = array('operator' => 'FIELD_LIMIT', 'field' => 'link_text', 'style' => 'null');
         } else {
             $find_duplicates['operand'][] = array('operator' => 'FIELD_LIMIT', 'field' => 'link_text', 'style' => 'lowerequals', 'data' => array('value' => strtolower($this->link_text)));
         }
         $found = I2CE_FormStorage::search('user_alert', $this->getParent(), $find_duplicates, array("-time_sent"), 1);
         if ($found) {
             I2CE::raiseMessage("found duplicates so increasing repeats. {$found}");
             $duplicate = I2CE_FormFactory::instance()->createContainer("user_alert|" . $found);
             $duplicate->populate();
             $duplicate->repeated++;
             return $duplicate->save($user, $transact);
         }
     }
     return parent::save($user, $transact);
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:31,代码来源:iHRIS_UserAlert.php

示例3: loadObjects

 protected function loadObjects()
 {
     if (!$this->hasPermission("task(can_schedule_students_course_enrollment)") or $this->getUser()->role == "admin") {
         $this->setRedirect("noaccess");
     }
     $factory = I2CE_FormFactory::instance();
     $username = $this->getUser()->username;
     $training_institution = IHS_PageFormLecturer::fetch_institution($username);
     $where = array("operator" => "FIELD_LIMIT", "field" => "training_institution", "style" => "equals", "data" => array("value" => $training_institution));
     $fields = I2CE_FormStorage::search("schedule_course_enrollment", false, $where);
     foreach ($fields as $id) {
         //do nothing
     }
     if ($id) {
         $form = "schedule_course_enrollment|" . $id;
     } else {
         $form = "schedule_course_enrollment";
     }
     $courseEnrObj = $factory->createContainer($form);
     $courseEnrObj->populate();
     if ($this->isPost()) {
         $courseEnrObj->load($this->post);
     }
     $courseEnrObj->getField("training_institution")->setFromDB($training_institution);
     $this->setObject($courseEnrObj);
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:26,代码来源:iHRIS_PageForm_ScheduleCourseEnrollment.php

示例4: upgrade

 /**
  * Upgrades the modules
  * @param string $old_vers
  * @param string $new_vers
  * @returns boolean
  */
 public function upgrade($old_vers, $new_vers)
 {
     if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.12')) {
         I2CE::raiseError("Changing contact child forms of training_institution to training_institution_contact");
         if (!iHRIS_Module_Contact::changeContactForm('training_institution', 'contact_type|facility', 'training_institution_contact', true)) {
             I2CE::raiseError("Could not upgrade training instituion contacts");
             return false;
         }
     }
     if (I2CE_Validate::checkVersion($old_vers, '=', '3.2.12')) {
         //the changeContactForm did not remvoe the contact form before
         if (!iHRIS_Module_Contact::removeContactForm('training_institution')) {
             return false;
         }
     }
     if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.19')) {
         I2CE::raiseError("Changing contact child forms of training_funder to training_funder_contact");
         if (!iHRIS_Module_Contact::changeContactForm('training_funder', 'contact_type|facility', 'training_funder_contact', true)) {
             I2CE::raiseError("Could not upgrade training funder contacts");
             return false;
         }
     }
     if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.20')) {
         $user = new I2CE_User(1, false, false, false);
         $class_config = I2CE::getConfig()->modules->forms->formClasses;
         $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
         if (!I2CE_FormStorage::migrateField("training_institution", array("location" => array("county" => "county", "district" => "district", "country" => "country")), $migrate_path, $user)) {
             return false;
         }
         if (!I2CE_FormStorage::migrateField("training_funder", array("location" => array("county" => "county", "district" => "district", "country" => "country")), $migrate_path, $user)) {
             return false;
         }
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:41,代码来源:iHRIS_Module_TrainingInstitution.php

示例5: displayValues

 public function displayValues($content_node, $transient_options, $action)
 {
     $mainNode = $this->template->appendFileByNode('service_directory_selector.html', 'div', $content_node);
     if (!$mainNode instanceof DOMNode) {
         return false;
     }
     $directories = array('provider', 'service', 'facility', 'organization');
     foreach ($directories as $directory) {
         $where = array('operator' => 'FIELD_LIMIT', 'field' => 'is_' . $directory, 'style' => 'true');
         if (!($selectNode = $this->template->getElementByName($directory, 0, $mainNode)) instanceof DOMElement) {
             continue;
         }
         $avail_dirs = I2CE_FormStorage::listDisplayFields('csd_info_manager', array('name'), false, $where);
         $selected = $this->getField($directory);
         foreach ($avail_dirs as $id => $data) {
             if (!is_array($data) || !array_key_exists('name', $data)) {
                 continue;
             }
             $id = 'csd_info_manager|' . $id;
             if ($id != $selected) {
                 $selectNode->appendChild($this->template->createElement('option', array('value' => $id), $data['name']));
             } else {
                 $selectNode->appendChild($this->template->createElement('option', array('value' => $id, 'selected' => 'selected'), $data['name']));
             }
         }
     }
     $this->renameInputs($directories, $mainNode);
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:29,代码来源:I2CE_Swiss_ServiceDirectorySelector.php

示例6: validate_form_reschedule_course

 public function validate_form_reschedule_course($form)
 {
     $semester = implode("|", $form->new_semester);
     $course = implode("|", $form->training);
     $academic_year = implode("|", $form->academic_year);
     $username = $this->getUser()->username;
     $training_institution = iHRIS_PageFormLecturer::fetch_institution($username);
     $where = array("operator" => "AND", "operand" => array(0 => array("operator" => "FIELD_LIMIT", "field" => "academic_year", "style" => "equals", "data" => array("value" => $academic_year)), 1 => array("operator" => "FIELD_LIMIT", "field" => "training", "style" => "equals", "data" => array("value" => $course)), 2 => array("operator" => "FIELD_LIMIT", "field" => "training_institution", "style" => "equals", "data" => array("value" => $training_institution))));
     $is_rescheduled = I2CE_FormStorage::search("reschedule_course", false, $where);
     if (count($is_rescheduled) > 0) {
         $form->setInvalidMessage("training", "This Course Already Rescheduled For This Semester In This Academic Year");
     }
     $ff = I2CE_FormFactory::instance();
     if (!($courseObj = $ff->createContainer($course)) instanceof iHRIS_Training) {
         return;
     }
     $courseObj->populate();
     $crs_semester = $courseObj->getField("semester")->getDBValue();
     if ($crs_semester == $semester) {
         $form->setInvalidMessage("new_semester", "This Course Is Currently Offered In This Semester");
         return;
     }
     $sem = $form->new_semester[1];
     $crs_semester = explode("|", $crs_semester);
     $crs_semester = $crs_semester[1];
     if ($crs_semester > $sem or $sem - $crs_semester != 1) {
         $form->setInvalidMessage("new_semester", "A Course Must Be Rescheduled To A Next Semester");
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:29,代码来源:iHRIS_Module_RescheduleCourse.php

示例7: upgrade

 /**
  * Upgrade this module if necessary
  * @param string $old_vers
  * @param string $new_vers
  * @return boolean
  */
 public function upgrade($old_vers, $new_vers)
 {
     /*
      * In 3.2.3 we moved some lists from entry to magicdata storage so we need to get the
      * old data from entry and save them to the new form storage.
      */
     if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.3')) {
         $user = new I2CE_User(1, false, false, false);
         $class_config = I2CE::getConfig()->modules->forms->formClasses;
         $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
         if (!I2CE_FormStorage::migrateForm("facility_type", "entry", $user, $migrate_path, false, array("type"))) {
             return false;
         }
         if (I2CE_FormStorage::migrateForm("facility", "entry", $user, $migrate_path, false, array("type"), array("facility_type" => "facility_type", "location" => array("county" => "county", "district" => "district", "country" => "country")))) {
             unset($class_config->iHRIS_Facility->fields->country);
             unset($class_config->iHRIS_Facility->fields->district);
             unset($class_config->iHRIS_Facility->fields->county);
             unset($class_config->iHRIS_Facility->fields->type);
         } else {
             return false;
         }
     } elseif (I2CE_Validate::checkVersion($old_vers, '<', '3.2.4')) {
         $user = new I2CE_User(1, false, false, false);
         $class_config = I2CE::getConfig()->modules->forms->formClasses;
         $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
         if (!I2CE_FormStorage::migrateForm("facility", "entry", $user, $migrate_path, false, array("type"))) {
             return false;
         }
         unset($class_config->iHRIS_Facility->fields->type);
     }
     return parent::upgrade($old_vers, $new_vers);
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:38,代码来源:iHRIS_Module_Facility.php

示例8: getAvailableCourses

 public static function getAvailableCourses()
 {
     $status = I2CE_FormStorage::listFields('training_course_status', 'name');
     foreach ($status as $i => &$s) {
         if (!array_key_exists('name', $s)) {
             unset($status[$i]);
             continue;
         }
         $s = $s['name'];
     }
     $t_filters = array();
     I2CE::getConfig()->setIfIsSet($t_filters, '/modules/training-course/filters/availableCourses', true);
     //this should be moved to magic data form storage!
     $filters = array();
     foreach ($t_filters as $val) {
         if (($key = array_search($val, $status)) !== false) {
             $filters[] = $key;
         }
     }
     $where = array();
     if (count($filters) > 0) {
         $where = array('operator' => 'FIELD_LIMIT', 'field' => 'training_course_status', 'style' => 'in', 'data' => array('value' => $filters));
     }
     $courses = I2CE_FormStorage::listFields('training_course', 'name', false, $where);
     foreach ($courses as $i => &$c) {
         if (!array_key_exists('name', $c)) {
             unset($courses[$i]);
             continue;
         }
         $c = $c['name'];
     }
     return $courses;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:33,代码来源:iHRIS_Training_Course.php

示例9: loadObjects

 protected function loadObjects()
 {
     parent::loadObjects();
     if (($this->isPost() || $this->hasData()) && ($searchObj = $this->getPrimary()) instanceof CSD_Search && I2CE_FormStorage::getStorageMechanism($searchObj->getName()) instanceof I2CE_FormStorage_CSDSearch) {
         //this will populate "result" field
         $searchObj->setID("1");
         //so it will populate
         if (($maxField = $searchObj->getField('max')) instanceof I2CE_FormField_INT) {
             if ($maxField->getValue() > 200) {
                 $maxField->setValue(200);
             }
         }
         if (($entityIDField = $searchObj->getField('entityID')) instanceof I2CE_FormField_STRING_LINE) {
             list($form, $id) = array_pad(explode('|', $entityIDField->getValue(), 2), 2, '');
             if ($id) {
                 $entityIDField->setValue($id);
             }
         }
         $searchObj->populate(true);
         if (($matches = $searchObj->getField('matches')) instanceof I2CE_FormField_ASSOC_MAP_RESULTS && count($matches->getValue()) > 200) {
             $this->userMessage("To Many Results To Display.  Please refine your search");
             I2CE::raiseError("Too many results");
             $this->bad_result = true;
             $matches->setValue(array());
             if (($resultField = $searchObj->getField('result')) instanceof I2CE_FormField) {
                 $resultField->setValue('');
             }
         }
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:31,代码来源:CSD_PageSearch.php

示例10: getArchiveIds

 public static function getArchiveIds($reportView, $date = null)
 {
     $where = array('operator' => 'FIELD_LIMIT', 'field' => 'report_view', 'style' => 'equals', 'data' => array('value' => $reportView));
     if ($date) {
         $where = array('operator' => 'AND', 'operand' => array($where, array('operator' => 'FIELD_LIMIT', 'field' => 'date', 'style' => 'equals', 'data' => array('value' => $date))));
     }
     return I2CE_FormStorage::search('archived_report', false, $where);
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:8,代码来源:I2CE_Module_ReportArchiver.php

示例11: academicYearId

 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;
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:8,代码来源:iHRIS_AcademicYear.php

示例12: loadObjects

 /**
  * 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;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:61,代码来源:iHRIS_PageFormEnrollcourseProcess.php

示例13: migrate

 /**
  * Migrate the facility contact data from entry to the current storage (magicdata)
  */
 public function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
     if (!I2CE_FormStorage::migrateForm("facility_contact", "entry", $user, $migrate_path)) {
         return false;
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:12,代码来源:iHRIS_Module_FacilityContact.php

示例14: getRoleNameFromShortName

 /**
  * Get the display name associated to a role's shortname
  * @param string $name the shortname of the role
  * @returns string
  */
 static function getRoleNameFromShortName($name)
 {
     $disp = I2CE_FormStorage::lookupField('role', $name);
     if ($disp === false) {
         I2CE::raiseError("Invalid shortname  for getRoleNameFromShortName: {$name}.");
         return null;
     }
     return $disp;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:14,代码来源:I2CE_User_Form.php

示例15: migrate

 /** 
  * Perform the migrate actions for this module
  * This is for going from pre 3.2 versions where benefit data has
  * been saved to the database.
  * @return boolean
  */
 protected function migrate()
 {
     $user = new I2CE_User(1, false, false, false);
     $class_config = I2CE::getConfig()->modules->forms->formClasses;
     $migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
     if (!I2CE_FormStorage::migrateField("employment", array("start_wage" => "currency", "end_wage" => "currency"), $migrate_path, $user)) {
         return false;
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:16,代码来源:iHRIS_Module_PersonEmployment.php


注:本文中的I2CE_FormStorage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。