本文整理汇总了PHP中I2CE_FormStorage::migrateField方法的典型用法代码示例。如果您正苦于以下问题:PHP I2CE_FormStorage::migrateField方法的具体用法?PHP I2CE_FormStorage::migrateField怎么用?PHP I2CE_FormStorage::migrateField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类I2CE_FormStorage
的用法示例。
在下文中一共展示了I2CE_FormStorage::migrateField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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::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);
}
示例3: 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;
}
示例4: migrate
/**
* Perform the migrate actions for this module.
* @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::migrateForm("id_type", "entry", $user, $migrate_path, false, array("type"))) {
return false;
}
if (!I2CE_FormStorage::migrateField("person_id", array("id_type" => "id_type"), $migrate_path, $user)) {
return false;
}
return true;
}
示例5: 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::migrateForm("competency_evaluation", "entry", $user, $migrate_path, "name", array("type"), array(), true)) {
return false;
}
if (!I2CE_FormStorage::migrateField("person_competency", array("competency_evaluation" => "competency_evaluation", "competency" => "competency"), $migrate_path, $user)) {
return false;
}
unset($class_config->iHRIS_PersonCompetency->fields->competency_type);
return true;
}
示例6: migrate
/**
* Perform the migrate actions for this module.
* @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/4.1.8";
if (!I2CE_FormStorage::migrateForm("training_classification", "entry", $user, $migrate_path)) {
return false;
}
if (I2CE_ModuleFactory::instance()->isEnabled("CachedForms")) {
$cachedForm = new I2CE_CachedForm("training_classification");
$cachedForm->dropTable();
}
if (!I2CE_FormStorage::migrateField("training", array("training_classification" => "training_classification"), $migrate_path, $user)) {
return false;
}
return true;
}
示例7: migrate
/**
* Perform the migrate actions for this module.
* @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::migrateForm("edu_type", "entry", $user, $migrate_path, false, array("type"))) {
return false;
}
if (!I2CE_FormStorage::migrateForm("degree", "entry", $user, $migrate_path, false, array("type"), array("edu_type" => "edu_type"))) {
return false;
}
if (!I2CE_FormStorage::migrateField("education", array("degree" => "degree"), $migrate_path, $user)) {
return false;
}
unset($class_config->iHRIS_Degree->fields->type);
unset($class_config->iHRIS_Education->fields->edu_type);
return true;
}
示例8: 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";
$migrate_node = I2CE::getConfig()->traverse($migrate_path, true, false);
$constant_prof = array(1 => 'language_proficiency|elementary', 2 => 'language_proficiency|limited', 3 => 'language_proficiency|professional', 4 => 'language_proficiency|full_professional', 5 => 'language_proficiency|fluent');
foreach ($constant_prof as $old_id => $new_id) {
$migrate_node->forms->language_proficiency->{$old_id} = $new_id;
}
if (!I2CE_FormStorage::migrateForm("language", "entry", $user, $migrate_path, false, array("type"))) {
return false;
}
if (!I2CE_FormStorage::migrateField("person_language", array("language" => "language", "speaking" => "language_proficiency", "reading" => "language_proficiency", "writing" => "language_proficiency"), $migrate_path, $user)) {
return false;
}
return true;
}
示例9: migrate
/**
* Perform the migrate actions for this module.
* @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";
$migrate_node = I2CE::getConfig()->traverse($migrate_path, true, false);
$constant_gender = array(1 => 'gender|F', 2 => 'gender|M');
foreach ($constant_gender as $old_id => $new_id) {
$migrate_node->forms->gender->{$old_id} = $new_id;
}
if (!I2CE_FormStorage::migrateForm("marital_status", "entry", $user, $migrate_path, false, array("type"))) {
return false;
}
if (!I2CE_FormStorage::migrateField("demographic", array("gender" => "gender", "marital_status" => "marital_status"), $migrate_path, $user)) {
return false;
}
return true;
}
示例10: 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";
$migrate_node = I2CE::getConfig()->traverse($migrate_path, true, false);
foreach (self::$constant_migrate as $old_id => $new_id) {
$migrate_node->forms->contact_type->{$old_id} = $new_id;
}
if (!I2CE_FormStorage::migrateField("contact", array("contact_type" => "contact_type"), $migrate_path, $user)) {
return false;
}
}
return true;
}
示例11: upgrade
/**
* Run the upgrade function 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.22')) {
I2CE::getConfig()->__unset("/I2CE/page/position");
}
if (!$this->do_migrate && I2CE_Validate::checkVersion($old_vers, '<', '3.2.24')) {
$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("position", array("facility" => "facility"), $migrate_path, $user)) {
return false;
}
}
return parent::upgrade($old_vers, $new_vers);
}
示例12: postUpdateAccidentTypeFields
protected function postUpdateAccidentTypeFields()
{
$migrate_path = "/I2CE/formsData/migrate_data/4.0";
$user = new I2CE_User(1, false, false, false);
$class_config = I2CE::getConfig()->modules->forms->formClasses;
if (!I2CE_FormStorage::migrateField("accident", array("accident_type" => "accident_type"), $migrate_path, $user)) {
return false;
}
return true;
}
示例13: upgrade
/**
* Upgrade this module if necessary based on the previous and new
* versions of the 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.0.1000')) {
if (!$this->updateContactTypes()) {
return false;
}
if (!$this->ensureFormsAndPages()) {
return false;
}
}
if (I2CE_Validate::checkVersion($old_vers, "<", "3.3.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("home" => array("home_county" => "county", "home_district" => "district", "home_country" => "country")), $migrate_path, $user)) {
return false;
}
unset($class_config->iHRIS_PersonQualify->fields->home_country);
unset($class_config->iHRIS_PersonQualify->fields->home_district);
unset($class_config->iHRIS_PersonQualify->fields->home_county);
}
if (I2CE_Validate::checkVersion($old_vers, "<", "3.3.5")) {
$user = new I2CE_User(1, false, false, false);
$class_config = I2CE::getConfig()->modules->forms->formClasses;
$migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
$facilityObj = I2CE_FormFactory::instance()->createContainer("health_facility");
if (!$facilityObj instanceof iHRIS_HealthFacility) {
I2CE::raiseError("Bad health facility form");
return false;
}
$childForms = $facilityObj->getChildForms();
if (in_array("contact", $childForms)) {
I2CE::raiseError("Changing contact child forms of health facility to facility_contact");
if (!iHRIS_Module_Contact::changeContactForm("health_facility", "contact_type|facility", "facility_contact", true)) {
return false;
}
}
if (!I2CE_FormStorage::migrateField("health_facility", array("location" => array("county" => "county", "district" => "district", "country" => "country"), "facility_type" => "facility_type", "facility_agent" => "facility_agent", "facility_status" => "facility_status"), $migrate_path, $user)) {
return false;
}
unset($class_config->iHRIS_HealthFacility->fields->country);
unset($class_config->iHRIS_HealthFacility->fields->district);
unset($class_config->iHRIS_HealthFacility->fields->county);
unset($class_config->iHRIS_HealthFacility->fields->type);
}
if (I2CE_Validate::checkVersion($old_vers, "<", "3.3.6")) {
$user = new I2CE_User(1, false, false, false);
$class_config = I2CE::getConfig()->modules->forms->formClasses;
$migrate_path = "/I2CE/formsData/migrate_data/3.2.3";
$migrate_node = I2CE::getConfig()->traverse($migrate_path, true, false);
$constant_try = array(1 => 'exam_try|first', 2 => 'exam_try|retry', 3 => 'exam_try|final');
foreach ($constant_try as $old_id => $new_id) {
$migrate_node->forms->exam_try->{$old_id} = $new_id;
}
$constant_result = array(1 => 'exam_result|pass', 2 => 'exam_result|fail', 3 => 'exam_result|notake');
foreach ($constant_result as $old_id => $new_id) {
$migrate_node->forms->exam_result->{$old_id} = $new_id;
}
$constant_reg_type = array(1 => 'registration_type|permanent', 2 => 'registration_type|temporary');
foreach ($constant_reg_type as $old_id => $new_id) {
$migrate_node->forms->registration_type->{$old_id} = $new_id;
}
if (!I2CE_FormStorage::migrateField("cadre", array("qualification" => "qualification"), $migrate_path, $user)) {
return false;
}
if (!I2CE_FormStorage::migrateField("certificate", array("academic_level" => "academic_level"), $migrate_path, $user)) {
return false;
}
if (!I2CE_FormStorage::migrateField("deployment", array("health_facility" => "health_facility"), $migrate_path, $user)) {
return false;
}
if (!I2CE_FormStorage::migrateField("training_disruption_reason", array("training_disruption_category" => "training_disruption_category"), $migrate_path, $user)) {
return false;
}
if (!I2CE_FormStorage::migrateField("training_disrupt", array("disruption_reason" => "training_disruption_reason"), $migrate_path, $user)) {
return false;
}
if (!I2CE_FormStorage::migrateField("disciplinary_action_reason", array("disciplinary_action_category" => "disciplinary_action_category"), $migrate_path, $user)) {
return false;
}
if (!I2CE_FormStorage::migrateField("disciplinary_action", array("disciplinary_action_reason" => "disciplinary_action_reason"), $migrate_path, $user)) {
return false;
}
$traininstObj = I2CE_FormFactory::instance()->createContainer("training_institution");
if (!$traininstObj instanceof iHRIS_QualifyTrainingInstitution) {
I2CE::raiseError("Bad training institution form");
return false;
}
$childForms = $traininstObj->getChildForms();
if (in_array("contact", $childForms)) {
I2CE::raiseError("Changing contact child forms of training institution to facility_contact");
if (!iHRIS_Module_Contact::changeContactForm("training_institution", "contact_type|facility", "facility_contact", true)) {
return false;
//.........这里部分代码省略.........
示例14: 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("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);
}
示例15: 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::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);
}