/** * Run the upgrade for this module. * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.5')) { I2CE::raiseError("Disabling training module."); I2CE_ModuleFactory::instance()->disable(array("manage-training-simple-competency", "manage-training-institution", "manage-training-course", "training-simple-competency", "training-institution", "training-course")); } return parent::upgrade($old_vers, $new_vers); }
public function __construct() { parent::__construct(); $this->js = ''; if (I2CE_ModuleFactory::instance()->isEnabled('StretchPage')) { $this->js .= 'if ( PageStretch ) { PageStretch.stretchPage(); }'; } $this->js_func = ''; }
/** * 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')) { $class_config = I2CE::getConfig()->modules->forms->formClasses; unset($class_config->iHRIS_ContinuingEducationCourse->fields->type); } return parent::upgrade($old_vers, $new_vers); }
/** * 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 forms to magicdata so we need to get the old data from entry * and save it to the new form storage. */ if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.6')) { if (!$this->migrate()) { return false; } } return parent::upgrade($old_vers, $new_vers); }
/** * Run the pre upgrade for this module. This can use the old config data before it * has been changed from the config. * @param string $old_vers * @param string $new_vers * @param I2CE_MagicDataNode $new_storage * @return boolean */ public function pre_upgrade($old_vers, $new_vers, $new_storage) { if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.3')) { /** * In 3.2.3 some lists were moved to magicdata storage so we need to save * any old record ids for the old lists for later reference before any field * types get changed in magic data. */ $migrate_path = "/I2CE/formsData/migrate_data/3.2.3"; I2CE_FormStorage::storeMigrateData(array("contact" => array("contact_type")), $migrate_path); } return parent::pre_upgrade($old_vers, $new_vers, $new_storage); }
/** * 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("currency", "entry", $user, $migrate_path, false, array("type"), array("country" => "country"))) { unset($class_config->iHRIS_Currency->fields->type); } else { return false; } } return parent::upgrade($old_vers, $new_vers); }
/** * Run the upgrade for this module. * @param string $old_vers * @param string $new_vers * @return boolean */ public function upgrade($old_vers, $new_vers) { if (I2CE_Validate::checkVersion($old_vers, '<', '4.0.3.2')) { I2CE::raiseError("Upgrading sample data for license end_date"); $db = MDB2::singleton(); $updated = $db->exec("UPDATE last_entry SET date = NOW(), date_value = '2015-01-01 00:00:00' WHERE form_field = 75 AND date_value = '2010-01-01 00:00:00'"); if (!I2CE::pearError($updated, "Unable to update license end_date for Qualify Sample Data.")) { I2CE::raiseError("Update {$updated} entries."); $last_mod = $db->exec("UPDATE record SET last_modified = NOW() WHERE form = 16"); if (!I2CE::pearError($last_mod, "Unable to update license end_date for Qualify Sample Data record last modified.")) { I2CE::raiseError("Updated {$last_mod} records."); } else { return false; } } else { return false; } I2CE::getConfig()->modules->CachedForms->dirty->license = time(); } return parent::upgrade($old_vers, $new_vers); }
public function __construct() { parent::__construct(); $this->date_pickers = array(); if (class_exists('IntlDateFormatter')) { $locale = I2CE_Locales::getPreferredLocale(); $config = I2CE::getConfig()->modules->DatePicker; $intl_setup = false; $config->setIfIsSet($intl_setup, "intl_setup/{$locale}"); if (!$intl_setup) { $formatter = array('months' => new IntlDateFormatter($locale, null, null, 'UTC', null, 'MMMM'), 'days' => new IntlDateFormatter($locale, null, null, 'UTC', null, 'EEEE')); foreach (self::$intl_times as $type => $times) { foreach ($times as $idx => $time) { if (!$config->is_translated($locale, "options/{$type}/{$idx}")) { $config->setTranslatable("options/{$type}/{$idx}"); $config->setTranslation($locale, $formatter[$type]->format($time), "options/{$type}/{$idx}"); } } } } $config->intl_setup->{$locale} = 1; } }
/** * Upgrade this module if necessary * @param string $old_vers * @param string $new_vers * @return boolean */ public function post_update($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 ($this->do_migrate) { if (!$this->migrate()) { return false; } } if ($this->do_migrate326) { if (!$this->migrate326()) { return false; } } return parent::post_update($old_vers, $new_vers); }
/** * 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("training_course_status", "entry", $user, $migrate_path, false, array("type"))) { return false; } if (!I2CE_FormStorage::migrateForm("training_course_category", "entry", $user, $migrate_path, false, array("type"))) { return false; } if (!I2CE_FormStorage::migrateForm("training_course_evaluation", "entry", $user, $migrate_path, false, array("type"))) { return false; } if (!I2CE_FormStorage::migrateForm("training_course_requestor", "entry", $user, $migrate_path, false, array("type"))) { return false; } if (!I2CE_FormStorage::migrateField("training_course", array("training_institution" => "training_institution", "training_funder" => "training_funder", "continuing_education_course" => "continuing_education_course", "training_course_status" => "training_course_status", "training_course_category" => "training_course_category"), $migrate_path, $user)) { return false; } if (!I2CE_FormStorage::migrateField("person_scheduled_training_course", array("training_course_evaluation" => "training_course_evaluation", "training_course_requestor" => "training_course_requestor", "scheduled_training_course" => "scheduled_training_course"), $migrate_path, $user)) { return false; } if (!I2CE_FormStorage::migrateField("scheduled_training_course", array("location" => array("county" => "county", "district" => "district", "country" => "country")), $migrate_path, $user)) { return false; } unset($class_config->iHRIS_Person_Scheduled_Training_Course->fields->training_course); unset($class_config->iHRIS_Scheduled_Training_Course->fields->country); unset($class_config->iHRIS_Scheduled_Training_Course->fields->district); unset($class_config->iHRIS_Scheduled_Training_Course->fields->county); } elseif (I2CE_Validate::checkVersion($old_vers, '<', '3.2.35')) { $user = new I2CE_User(1, false, false, false); $migrate_path = "/I2CE/formsData/migrate_data/3.2.3"; if (!I2CE_FormStorage::migrateField("person_scheduled_training_course", array("scheduled_training_course" => "scheduled_training_course"), $migrate_path, $user)) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.18')) { $evals = array('pass' => 'Pass', 'fail' => 'Fail', 'incomplete' => 'Incomplete'); if (!I2CE_Module_Lists::remapFields('training_course_evaluation', $evals, 'person_scheduled_training_course')) { return false; } if (!I2CE_Module_Lists::deleteMappedValues('training_course_evaluation', $evals)) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.30')) { $evals = array('open' => 'Open', 'closed' => 'Closed'); if (!I2CE_Module_Lists::remapFields('training_course_status', $evals, 'training_course')) { return false; } if (!I2CE_Module_Lists::deleteMappedValues('training_course_status', $evals)) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.32')) { $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("scheduled_training_course", array("location" => array("county" => "county", "district" => "district", "country" => "country")), $migrate_path, $user)) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.63')) { if (!$this->moveScheduledTrainingCourseToMap()) { return false; } } return parent::upgrade($old_vers, $new_vers); }
/** * Create this module object to set the current user. */ public function __construct() { parent::__construct(); $this->user = new I2CE_User(); }
public function __construct() { parent::__construct(); $this->isReview = false; }
public function __call($method, $params) { //this is b/c of the laziness above //examples: I2CE_FormField_DB_STRING_DISPLAYFIELDSTYLE_in if (preg_match('/^([0-9a-zA-Z_]+)_([a-zA-Z]+)FIELDSTYLE_([0-9a-zA-Z_]+)$/', $method, $matches)) { //I2CE_FormField_XXX->getLimitMenu_YYY($template,$vals,$reportformfield) //becomes a vall to the method: $this->XXXX_DISPLAYFIELDSTYLE_YYY($fieldObj,$template,$vals) if ($matches[2] !== 'PROCESS' && $matches[2] !== 'DISPLAY') { return parent::__call($method, $params); } $m = $matches[2] . '_generic'; //this is for example DISPLAY_generic array_unshift($params, $matches[3]); //put the style at the begining return call_user_func_array(array($this, $m), $params); } else { if (preg_match('/^DATE_([a-zA-Z]+)_DATE_([a-zA-Z]+)_([a-zA-Z_]+?)$/', $method, $matches)) { if (array_key_exists($matches[1], self::$dateActions) && array_key_exists('DATE_' . $matches[2], self::$dateTypes)) { //we have something like DATE_generateLimit_{$key2}_{$key1} or DATE_getLimitMenu_{$key2}_{$key1} if ($matches[3] == 'between') { $action = 'DATE_between_' . $matches[1]; array_unshift($params, self::$dateTypes['DATE_' . $matches[2]]); //the first argument will be the I2CE_Date type //the third arguement will be the field object, the rest will be the calling arguments in order return call_user_func_array(array($this, $action), $params); } else { if (array_key_exists($matches[3], self::$dateOperatorMaps)) { $action = self::$dateActions[$matches[1]]; array_unshift($params, self::$dateTypes['DATE_' . $matches[2]]); //the second argument will be the I2CE_Date type array_unshift($params, $matches[3]); //the first arguement will be the opertator //the third arguement will be the field object, the rest will be the calling arguments in order return call_user_func_array(array($this, $action), $params); } } } } } return parent::__call($method, $params); }
/** * The constructor */ public function __construct() { parent::__construct(); $this->errors = array(); }
/** * Do any pre upgrade actions if necessary. * @param string $old_vers * @param string $new_vers * @param I2CE_MagicDataNode $new_storage * @return boolean */ public function pre_upgrade($old_vers, $new_vers, $new_storage) { if (I2CE_Validate::checkVersion($old_vers, "<", "3.3.3")) { $migrate_path = "/I2CE/formsData/migrate_data/3.2.3"; I2CE_FormStorage::storeMigrateData(array("person" => array("home_country", "home_district", "home_county")), $migrate_path); } if (I2CE_Validate::checkVersion($old_vers, "<", "3.3.5")) { $migrate_path = "/I2CE/formsData/migrate_data/3.2.3"; I2CE_FormStorage::storeMigrateData(array("health_facility" => array("country", "district", "county", "facility_type", "facility_agent", "facility_status")), $migrate_path); } if (I2CE_Validate::checkVersion($old_vers, "<", "3.3.6")) { $migrate_path = "/I2CE/formsData/migrate_data/3.2.3"; I2CE_FormStorage::storeMigrateData(array("cadre" => array("qualification")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("certificate" => array("academic_level")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("deployment" => array("health_facility")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("training_disruption_reason" => array("training_disruption_category")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("training_disrupt" => array("disruption_reason")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("disciplinary_action_reason" => array("disciplinary_action_category")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("disciplinary_action" => array("disciplinary_action_category", "disciplinary_action_reason")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("training_institution" => array("facility_agent", "facility_status", "country", "district", "county")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("training_program" => array("cadre")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("facility_institution" => array("health_facility", "training_institution")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("demographic" => array("birth_country", "birth_district", "birth_county")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("education" => array("academic_level", "certificate")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("training" => array("training_institution", "cadre", "out_country")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("exam" => array("try", "results")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("registration" => array("practice_type")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("out_migration" => array("country", "out_migration_reason")), $migrate_path); I2CE_FormStorage::storeMigrateData(array("private_practice" => array("health_facility")), $migrate_path); } return parent::pre_upgrade($old_vers, $new_vers, $new_storage); }
/** * 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::migrateField("person", array("nationality" => "country", "residence" => array("residence_county" => "county", "county" => "county", "residence_district" => "district", "district" => "district", "residence_country" => "country", "country" => "country")), $migrate_path, $user)) { return false; } unset($class_config->iHRIS_Person->fields->residence_country); unset($class_config->iHRIS_Person->fields->residence_district); unset($class_config->iHRIS_Person->fields->residence_county); } return parent::upgrade($old_vers, $new_vers); }
/** * Upgrade this module if necessary * @param string $old_vers * @param string $new_vers * @return boolean */ public function post_update($old_vers, $new_vers) { /* * In 4.1.8 the training_classification form was moved to magicdata storage * instead of entry */ if ($this->do_migrate) { if (!$this->migrate()) { return false; } } return parent::post_update($old_vers, $new_vers); }
public function __construct() { parent::__construct(); $this->color_triples = array(); $this->update_colors = array(); }
/** * 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("country", "entry", $user, $migrate_path, "alpha_two", array("type"))) { return false; } if (!I2CE_FormStorage::migrateForm("region", "entry", $user, $migrate_path, false, array("type"), array("country" => "country"))) { return false; } if (!I2CE_FormStorage::migrateForm("district", "entry", $user, $migrate_path, false, array("type", "country"), array("region" => "region"))) { return false; } if (!I2CE_FormStorage::migrateForm("county", "entry", $user, $migrate_path, false, array("type", "region", "country"), array("district" => "district"))) { return false; } // If everything migrated correctly, then remove the unused fields. unset($class_config->iHRIS_Country->fields->type); unset($class_config->iHRIS_Region->fields->type); unset($class_config->iHRIS_District->fields->type); unset($class_config->iHRIS_District->fields->country); unset($class_config->iHRIS_County->fields->type); unset($class_config->iHRIS_County->fields->region); unset($class_config->iHRIS_County->fields->country); unset($class_config->iHRIS_ListByCountry->fields->type); unset($class_config->iHRIS_ListByCountry->fields->county); unset($class_config->iHRIS_ListByCountry->fields->district); unset($class_config->iHRIS_ListByCountry->fields->country); } return parent::upgrade($old_vers, $new_vers); }
public function __construct() { parent::__construct(); }
/** * 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::migrateField("training_course_competency_evaluation", array("competency_evaluation" => "competency_evaluation", "competency" => "competency"), $migrate_path, $user)) { return false; } if (!I2CE_FormStorage::migrateField("training_course", array("competency" => "competency"), $migrate_path, $user)) { return false; } // If everything migrated correctly, then remove the unused fields. unset($class_config->iHRIS_Training_Course_Competency_Evaluation->fields->competency_type); } if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.6')) { $evals = array('not_evaluated' => 'Not Evaluated'); if (!I2CE_Module_Lists::remapFields('competency_evaluation', $evals, 'training_course_competency_evaluation')) { return false; } } if (I2CE_Validate::checkVersion($old_vers, '<', '3.2.7')) { // if (!I2CE_Module_Lists::deleteMappedValues('training_course_evaluation', $evals)) { // return false; // } } return parent::upgrade($old_vers, $new_vers); }
public function __construct() { parent::__construct(); $this->db = MDB2::singleton(); I2CE::pearError($this->db, "Error getting database connection: "); }