if($value == "4")
		$field_ordering->field4 = str_replace("_"," ",$key);
	if($value == "5")
		$field_ordering->field5 = str_replace("_"," ",$key);
	if($value == "6")
		$field_ordering->field6 = str_replace("_"," ",$key);
	if($value == "7")
		$field_ordering->field7 = str_replace("_"," ",$key);
	if($value == "8")
		$field_ordering->field8 = str_replace("_"," ",$key);
	if($value == "9")
		$field_ordering->field9 = str_replace("_"," ",$key);
	if($value == "10")
		$field_ordering->field10 = str_replace("_"," ",$key);
	if($value == "11")
		$field_ordering->field11 = str_replace("_"," ",$key);
	if($value == "12")
		$field_ordering->field12 = str_replace("_"," ",$key);
	if($value == "13")
		$field_ordering->field13 = str_replace("_"," ",$key);
	if($value == "14")
		$field_ordering->field14 = str_replace("_"," ",$key);
	if($value == "15")
		$field_ordering->field15 = str_replace("_"," ",$key);
	if($value == "16")
		$field_ordering->field16 = str_replace("_"," ",$key);
}
 */
FieldOrdering::deleteFieldOrderEntry($field_ordering->id, $field_ordering->form_id);
FieldOrdering::add_fieldOrdering($field_ordering);
Exemple #2
0
 public static function install_first_order($lab_config, $formId)
 {
     $field_ordering_for_curent_lab = FieldOrdering::getByFormId($_SESSION['lab_config_id'], $formId);
     if ($field_ordering_for_curent_lab == null) {
         // insert the order for the first time
         // 1. Get the current lab config info from the LabConfig Class
         //$lab_config = LabConfig::getById($_SESSION['lab_config_id']);
         //$custom_field_list_patients = get_lab_config_patient_custom_fields($lab_config->id);
         // 2. Parse the object and populate the new fieldOrder Object
         //$fieldOrdering_new = new FieldOrdering();
         $field_ordering = new FieldOrdering();
         // default values
         $field_ordering->form_id = $formId;
         $field_ordering->id = $_SESSION['lab_config_id'];
         $count = 1;
         $field_order = "";
         if ($formId == 1) {
             // pid
             if (isset($lab_config->pid) && $lab_config->pid > 0) {
                 //$field_ordering->{field.$count} = "Patient ID";
                 $field_order = "Patient ID";
                 $count++;
             }
             //p_addl
             if (isset($lab_config->patientAddl) && $lab_config->patientAddl > 0) {
                 //$field_ordering->{field.$count} = "Patient Addl ID";
                 $field_order = $field_order . "," . "Patient Addl ID";
                 $count++;
             }
             //dnum
             if (isset($lab_config->dailyNum) && $lab_config->dailyNum > 0) {
                 $field_ordering->{field . $count} = "Daily Number";
                 $field_order = $field_order . "," . "Daily Number";
                 $count++;
             }
             //pname
             if (isset($lab_config->pname) && $lab_config->pname > 0) {
                 //$field_ordering->{field.$count} = "Patient Name";
                 $field_order = $field_order . "," . "Patient Name";
                 $count++;
             }
             //sex
             if (isset($lab_config->sex) && $lab_config->sex > 0) {
                 //$field_ordering->{field.$count} = "Sex";
                 $field_order = $field_order . "," . "Sex";
                 $count++;
             }
             //age
             if (isset($lab_config->age) && $lab_config->age > 0) {
                 //$field_ordering->{field.$count} = "Age";
                 $field_order = $field_order . "," . "Age";
                 $count++;
             }
             //dob
             if (isset($lab_config->dob) && $lab_config->dob > 0) {
                 //$field_ordering->{field.$count} = "Date of Birth";
                 $field_order = $field_order . "," . "Date of Birth";
                 $count++;
             }
             $custom_field_list_patients = get_lab_config_patient_custom_fields($lab_config->id);
             foreach ($custom_field_list_patients as $value) {
                 //$field_ordering->{field.$count} = $value->fieldName;
                 $field_order = $field_order . "," . $value->fieldName;
                 $count++;
             }
         } else {
             if ($formId == 2) {
                 // specimen field
                 $field_order = "Specimen ID";
                 //s_addl
                 if (isset($lab_config->specimenAddl) && $lab_config->specimenAddl > 0) {
                     $field_order = $field_order . "," . "Specimen Additional ID";
                     $count++;
                 }
                 //COMM
                 if (isset($lab_config->comm) && $lab_config->comm > 0) {
                     $field_order = $field_order . "," . "Comments";
                     $count++;
                 }
                 //rdate
                 if (isset($lab_config->rdate) && $lab_config->rdate > 0) {
                     $field_order = $field_order . "," . "Lab Reciept Date";
                     $count++;
                 }
                 //refout
                 if (isset($lab_config->refout) && $lab_config->refout > 0) {
                     $field_order = $field_order . "," . "Referred Out";
                     $count++;
                 }
                 //doctor
                 if (isset($lab_config->doctor) && $lab_config->doctor > 0) {
                     $field_order = $field_order . "," . "Physician";
                     $count++;
                 }
                 $custom_field_list_specimen = get_lab_config_specimen_custom_fields($lab_config->id);
                 foreach ($custom_field_list_specimen as $value) {
                     //$field_ordering->{field.$count} = $value->fieldName;
                     $field_order = $field_order . "," . $value->fieldName;
                     $count++;
                 }
             }
         }
         /* //agelimit
         		if(isset($lab_config->agelimit) && $lab_config->agelimit > 0){
         		    $field_ordering->{field.$count} = "Age Limit";
         			$count++;
         		} */
         // 3. Insert the newly created order
         $field_ordering->form_field_inOrder = $field_order;
         FieldOrdering::add_fieldOrdering($field_ordering);
         $field_ordering_for_curent_lab = $field_ordering;
     }
     return $field_ordering_for_curent_lab;
 }