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


PHP I2CE_FormStorage::lookupField方法代码示例

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


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

示例1: 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

示例2: loadPrimary

 protected function loadPrimary()
 {
     if ($this->request_exists('student_id') && in_array('person', $this->formRelationship->getFormNames()) && ($student_id = $this->request('student_id')) && ($pos = strpos($student_id, '|')) !== false && ($id = substr($student_id, $pos + 1)) != '' && ($stc_id = I2CE_FormStorage::lookupField('person_scheduled_training_course', $id, array('scheduled_training_course'), '')) != '' && ($person_id = I2CE_FormStorage::lookupField('person_scheduled_training_course', $id, array('parent'), '')) != '') {
         $formFactory = I2CE_FormFactory::instance();
         if (!($this->primObj = $formFactory->createContainer($stc_id)) instanceof I2CE_Form || $this->formRelationship->getPrimaryForm() != $this->primObj->getName()) {
             I2CE::raiseError("invalid form id :" . print_r($this->request(), true) . "\ndoes not match " . $this->formRelationship->getPrimaryForm());
             return false;
         }
         $this->primObj->populate();
         $this->person_id = $person_id;
     } else {
         return parent::loadPrimary();
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:14,代码来源:iHRIS_PageActionStudentCertificates.php

示例3: init_data

 /**
  * Init form storage options
  * @param string $form 
  */
 protected function init_data($form)
 {
     if (in_array($form, $this->init_status)) {
         //already done
         return true;
     }
     if (!parent::init_data($form)) {
         return false;
     }
     $options = $this->getStorageOptions($form);
     if (!$options instanceof I2CE_MagicDataNode) {
         I2CE::raiseError("Invalid storage options for {$form}");
         return false;
     }
     $options = $this->getStorageOptions($form);
     if (!$options instanceof I2CE_MagicDataNode) {
         I2CE::raiseError("Invalid storage options for {$form}");
         return false;
     }
     $directory = false;
     if (!$options->setIfIsSet($directory, 'csd_directory') || !in_array($directory, array('provider', 'service', 'facility', 'organization'))) {
         I2CE::raiseError("No valid defined for {$form}");
         return false;
     }
     if (!is_array($remote_services = I2CE::getConfig()->getAsArray("/modules/forms/storage_options/CSD/remote_services")) || !array_key_exists($directory, $remote_services) || !is_scalar($selected = $remote_services[$directory])) {
         I2CE::raiseError("No remote service directory selected in global CSD  options");
         return false;
     }
     list($t_form, $id) = array_pad(explode('|', $selected, 2), 2, '');
     if ($t_form != 'csd_info_manager' || $id == '0' || !is_array($urls = I2CE_FormStorage::lookupField('csd_info_manager', $id, array('url'), false)) || !array_key_exists('url', $urls) || !$urls['url']) {
         I2CE::raiseError("Invalid connection details from selected service: {$selected}");
     }
     if (!array_key_exists('csd', $this->namespaces[$form])) {
         $this->namespaces[$form]['csd'] = "urn:ihe:iti:csd:2013";
     }
     $cache_time = 0;
     if (is_array($this->global_options) && array_key_exists('cache_time', $this->global_options) && is_scalar($this->global_options['cache_time'])) {
         $cache_time = (int) $this->global_options['cache_time'];
     }
     $options->setIfIsSet($cache_time, "cache_time");
     $cache_time = (int) $cache_time;
     if (!array_key_exists('populate', $this->services[$form])) {
         $this->services[$form]['populate'] = array();
     }
     $populate = array('url' => $urls['url'], 'curl_opts' => array('HEADER' => 0, 'POST' => 1, 'HTTPHEADER' => array('content-type' => 'content-type: text/xml')), 'cache_time' => $cache_time);
     I2CE_Util::merge_recursive($this->services[$form]['populate'], $populate);
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:52,代码来源:I2CE_FormStorage_CSDSearch.php

示例4: generate

 public function generate($node)
 {
     if ($this->options['task'] && I2CE_PermissionParser::taskExists($this->options['task']) && !$this->page->hasPermission("task(" . $this->options['task'] . ")", $node) || !($linkedNode = $this->template->appendFileByNode($this->options['template'], 'div', $node)) instanceof DOMNode || !($pageDispNode = $this->template->getElementByName('pager_display', 0, $linkedNode)) instanceof DOMNode || !($pageResultsNode = $this->template->getElementByName('pager_results', 0, $linkedNode)) instanceof DOMNode || !($tbodyNode = $this->template->getElementByName('link_fields', 0, $node)) instanceof DOMNode) {
         return;
     }
     $arg_walker = array();
     $printf_args = $this->options['printf_args'];
     foreach ($printf_args as $i => &$arg) {
         $t_arg = explode(":", $arg);
         if (count($t_arg) > 1) {
             $arg_walker[$i] = $t_arg;
             $arg = $t_arg[0];
         }
     }
     unset($arg);
     $dispData = I2CE_FormStorage::listDisplayFields($this->options['form'], $printf_args, false, $this->options['where'], $this->options['orders'], $this->options['limit']);
     if (count($dispData) == 0) {
         return;
     }
     $pageDispNode->setAttribute('id', 'linked_' . $this->options['form'] . '_pager_display');
     $pageResultsNode->setAttribute('id', 'linked_' . $this->options['form'] . '_results');
     $dispData = $this->paginateList($dispData, array('form' => $this->options['form']), 'linked_' . $this->options['form']);
     $this->template->setDisplayDataImmediate('link_title', $this->options['title']);
     foreach ($dispData as $id => $r_dispData) {
         $dispData = array();
         foreach ($printf_args as $i => $arg) {
             $dispData[$i] = $r_dispData[$arg];
         }
         foreach ($arg_walker as $i => $fields) {
             $val = $dispData[$i];
             $count = 0;
             foreach ($fields as $field) {
                 $count++;
                 if ($count == 1) {
                     continue;
                 }
                 list($wform, $wid) = array_pad(explode('|', $val, 2), 2, '');
                 $val = I2CE_FormStorage::lookupField($wform, $wid, array($field), '');
             }
             $dispData[$i] = $val;
         }
         $text = @vsprintf($this->options['printf'], $dispData);
         //form = person_position
         $linkid = $this->options['form'] . '|' . $id;
         foreach ($this->options['link_field'] as $lfield) {
             list($lform, $lid) = array_pad(explode('|', $linkid, 2), 2, '');
             $linkid = I2CE_FormStorage::lookupField($lform, $lid, array($lfield), '');
         }
         $attrs = array('href' => $this->options['link'] . $linkid);
         $tbodyNode->appendChild($trNode = $this->template->createElement('tr', array('colspan' => 2)));
         $trNode->appendChild($tdNode = $this->template->createElement('td', array('colspan' => 2)));
         $tdNode->appendChild($this->template->createElement('a', $attrs, $text));
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:54,代码来源:I2CE_Gizmo_LinkedLists.php

示例5: displayResults

 protected function displayResults($semester, $academic_year, $courses, $semester_node)
 {
     $display_GPA = true;
     $accObj = $this->ff->createContainer($academic_year);
     $accObj->populate();
     $acc_year_name = $accObj->getField("name")->getDBValue();
     $this->template->setDisplayDataImmediate("student_results_header", "{$acc_year_name} Semester " . $this->getSemesterName($semester) . " Results", $semester_node);
     $counter = 1;
     $courses = explode(",", $courses);
     foreach ($courses as $course) {
         $row_node = $this->template->appendFileByName("student_view_results_row.html", "tr", "student_results_rows", 0, $semester_node);
         $mark = 0;
         $status = "";
         $grade = "";
         $this->template->setDisplayDataImmediate("results_row_counter", $counter, $row_node);
         list($course_form, $course_id) = array_pad(explode("|", $course, 2), 2, '');
         $field_data = I2CE_FormStorage::lookupField($course_form, $course_id, array('name', 'code', 'training_course_exam_type'), false);
         $this->template->setDisplayDataImmediate("results_row_code", $field_data["code"], $row_node);
         $this->template->setDisplayDataImmediate("results_row_name", $field_data["name"], $row_node);
         $exam_types_array = explode(",", $field_data["training_course_exam_type"]);
         $has_final_exam = $this->has_final_exam($course);
         //if course has final exam,check if is approved,otherwise it is approved
         if ($has_final_exam) {
             $is_approved = $this->is_approved($academic_year, $course);
             if (!$is_approved) {
                 $display_GPA = false;
             }
         } else {
             $is_approved = true;
         }
         foreach ($exam_types_array as $exam_type) {
             $total_marks = "";
             $this->persObj->populateChildren("students_results_grade");
             foreach ($this->persObj->getChildren("students_results_grade") as $resultsObj) {
                 $training = $resultsObj->getField("training")->getDBValue();
                 $results_acc_year = $resultsObj->getField("academic_year")->getDBValue();
                 if ($resultsObj->getField("enroll_course")->getDBValue() != $enroll_id or $training != $course) {
                     continue;
                 }
                 $status = $resultsObj->getField("status")->getDBValue();
                 $grade = $resultsObj->getField("grade")->getDBValue();
                 $total_marks = $resultsObj->getField("total_marks")->getDBValue();
                 $id = $resultsObj->getField("id")->getDBValue();
                 $assessparentObj = $this->ff->createContainer($id);
                 $assessparentObj->populateChildren("students_results");
                 foreach ($assessparentObj->getChildren("students_results") as $assessObj) {
                     $mark = $assessObj->getField("score")->getDBValue();
                     $assessment = $assessObj->getField("training_course_exam_type")->getDBValue();
                     if ($assessment != $exam_type) {
                         continue;
                     }
                     if ($mark == "") {
                         $mark = "-";
                     }
                     $examtypeObj = $this->ff->createContainer($exam_type);
                     $examtypeObj->populate();
                     $exam_type_name = $examtypeObj->getField("name")->getDBValue();
                     $type_node = $this->template->appendFileByName("student_view_results_row_exam_types.html", "div", "results_row_exam_types", 0, $row_node);
                     if ($exam_type == "training_course_exam_type|final" and !$is_approved) {
                         $mark = "-";
                     }
                     $this->template->setDisplayDataImmediate("exam_types_name", $exam_type_name . ": " . $mark, $type_node);
                 }
             }
         }
         if ($status == "") {
             $status = "-";
         }
         if ($grade == "") {
             $grade = "-";
         }
         if ($total_marks == "") {
             $total_marks = "-";
         }
         if (!$is_approved) {
             $status = "-";
             $grade = "-";
             $total_marks = "Waiting Approval";
         }
         $this->template->setDisplayDataImmediate("results_row_total", $total_marks, $row_node);
         $this->template->setDisplayDataImmediate("results_row_grade", $grade, $row_node);
         $this->template->setDisplayDataImmediate("results_row_status", $status, $row_node);
         $counter++;
     }
     $this->persObj->populateChildren("semester_GPA");
     foreach ($this->persObj->getChildren("semester_GPA") as $semGPAObj) {
         if ($semGPAObj->getFIeld("semester")->getDBValue() == $semester and $semGPAObj->getField("registration")->getDBValue() == $this->student_registration["id"]) {
             $GPA = $semGPAObj->getField("GPA")->getDBValue();
         }
     }
     if ($GPA == "") {
         $GPA = "-";
     }
     if (!$display_GPA) {
         $GPA = "-";
     }
     $this->template->setDisplayDataImmediate("semester_gpa", "Semester " . $this->getSemesterName($semester) . " GPA " . $GPA, $semester_node);
     return $counter;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:99,代码来源:iHRIS_Module_StudentsViewResults.php

示例6: init_data

 /**
  * Init form storage options
  * @param string $form 
  */
 protected function init_data($form)
 {
     if (in_array($form, $this->init_status)) {
         //already done
         return true;
     }
     if (!parent::init_data($form)) {
         return false;
     }
     if (!array_key_exists('csd', $this->namespaces[$form])) {
         $this->namespaces[$form]['csd'] = "urn:ihe:iti:csd:2013";
     }
     $options = $this->getStorageOptions($form);
     if (!$options instanceof I2CE_MagicDataNode) {
         I2CE::raiseError("Invalid storage options for {$form}");
         return false;
     }
     $directory = false;
     if (!$options->setIfIsSet($directory, 'csd_directory') || !in_array($directory, array('provider', 'service', 'facility', 'organization'))) {
         I2CE::raiseError("No valid defined for {$form}");
         return false;
     }
     if (!is_array($this->global_options) || !array_key_exists('remote_services', $this->global_options) || !is_array($remote_services = $this->global_options['remote_services']) || !array_key_exists($directory, $remote_services) || !is_scalar($selected = $remote_services[$directory])) {
         I2CE::raiseError("No remote service directory selected in global CSD  options");
         return false;
     }
     list($t_form, $id) = array_pad(explode('|', $selected, 2), 2, '');
     if ($t_form != 'csd_info_manager' || $id == '0' || !is_array($urls = I2CE_FormStorage::lookupField('csd_info_manager', $id, array('url', 'url_updating'), false)) || !array_key_exists('url', $urls) || !$urls['url'] || !array_key_exists('url_updating', $urls)) {
         I2CE::raiseError("Invalid connection details from selected service: {$selected}");
     }
     $curl_opts = array('HEADER' => 0, 'POST' => 1, 'HTTPHEADER' => array('content-type' => 'content-type: text/xml'));
     if (is_array($auth = I2CE_FormStorage::lookupField('csd_info_manager', $id, array('user', 'password'), false)) && array_key_exists('user', $auth) && $auth['user']) {
         $curl_opts['USERPWD'] = $auth['password'];
         $curl_opts['USERAGENT'] = $auth['user'];
     }
     if (is_array($ssl = I2CE_FormStorage::lookupField('csd_info_manager', $id, array('ssl_version'), false)) && array_key_exists('ssl_version', $ssl) && $ssl['ssl_version']) {
         $curl_opts['SSLVERSION'] = $ssl['ssl_version'];
         $curl_opts['SSL_VERIFYPEER'] = false;
         $curl_opts['SSL_VERIFYHOST'] = false;
         //or 2?
     }
     $cache_time = 0;
     if (is_array($this->global_options) && array_key_exists('cache_time', $this->global_options) && is_scalar($this->global_options['cache_time'])) {
         $cache_time = (int) $this->global_options['cache_time'];
     }
     $options->setIfIsSet($cache_time, "cache_time");
     $cache_time = (int) $cache_time;
     $updating = array('delete', 'create', 'update');
     $reading = array('getRecords', 'populate');
     foreach ($reading as $endpoint) {
         if (!array_key_exists($endpoint, $this->services[$form])) {
             $this->services[$form][$endpoint] = array();
         }
     }
     if ($urls['url_updating']) {
         foreach ($updating as $endpoint) {
             if (!array_key_exists($endpoint, $this->services[$form])) {
                 $this->services[$form][$endpoint] = array();
             }
         }
     }
     foreach ($this->services[$form] as $endpoint => &$data) {
         if (in_array($endpoint, $updating)) {
             if ($urls['url_updating']) {
                 $data['url'] = $urls['url_updating'];
             }
         } else {
             if ($urls['url']) {
                 $data['url'] = $urls['url'];
             }
         }
         I2CE_Util::merge_recursive($data['curl_opts'], $curl_opts);
         if ($cache_time && in_array($endpoint, $reading) && !array_key_exists('cache_time', $data)) {
             $data['cache_time'] = $cache_time;
         }
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:82,代码来源:I2CE_FormStorage_CSD.php

示例7: generate

 public function generate($node)
 {
     if (!$node instanceof DOMNode || !$this->primaryObject instanceof I2CE_Form || I2CE_PermissionParser::taskExists($this->options['task']) && !$this->page->hasPermission("task(" . $this->options['task'] . ")", $node) || !($linkedNode = $this->template->appendFileByNode($this->options['template'], 'div', $node)) instanceof DOMNode || !($tbodyNode = $this->template->getElementByName('child_fields', 0, $node)) instanceof DOMNode) {
         return false;
     }
     $added = 0;
     if (count($this->options['action_links']) > 0 && ($ulNode = $this->template->getElementByName('child_links', 0, $linkedNode)) instanceof DOMNode) {
         $added = $this->addLinks('li', $this->options['action_links'], $ulNode);
     }
     if ($added == 0 && ($containerNode = $this->template->getElementByName('child_actions', 0, $linkedNode)) instanceof DOMNode) {
         $this->template->removeNode($containerNode);
     }
     $this->template->setDisplayDataImmediate('child_title', $this->options['title'], $linkedNode);
     $dispDatas = array();
     $arg_walker = array();
     if ($this->options['printf'] && is_array($this->options['printf_args'])) {
         foreach ($this->options['printf_args'] as $i => &$arg) {
             $t_arg = explode(":", $arg);
             if (count($t_arg) > 1) {
                 $arg_walker[$i] = $t_arg;
                 $arg = $t_arg[0];
             }
         }
         unset($arg);
         $dispDatas = I2CE_FormStorage::listDisplayFields($this->options['form'], $this->options['printf_args'], $this->primaryObject->getNameId(), $this->options['where'], $this->options['orders'], $this->options['limit']);
         $ids = array_keys($dispDatas);
     } else {
         $ids = I2CE_FormStorage::search($this->options['form'], $this->primaryObject->getNameId(), $this->options['where'], $this->options['orders'], $this->options['limit']);
     }
     if (count($ids) == 0) {
         return false;
     }
     foreach ($ids as $id) {
         $text = $this->options['title'];
         //default text for child in case printf wasn't set.
         if (array_key_exists($id, $dispDatas) && is_array($dispDatas)) {
             $dispFields = $dispDatas[$id];
             foreach ($this->options['printf_args'] as $i => $arg) {
                 $dispData[$i] = $dispFields[$arg];
             }
             foreach ($arg_walker as $i => $fields) {
                 $val = $dispData[$i];
                 $count = 0;
                 foreach ($fields as $field) {
                     $count++;
                     if ($count == 1) {
                         continue;
                     }
                     list($wform, $wid) = array_pad(explode('|', $val, 2), 2, '');
                     $val = I2CE_FormStorage::lookupField($wform, $wid, array($field), '');
                 }
                 $dispData[$i] = $val;
             }
             $text = @vsprintf($this->options['printf'], $dispData);
         }
         $this->generateAjaxLink($id, $text, $tbodyNode);
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:58,代码来源:I2CE_Gizmo_FormAjaxChildView.php

示例8: generateRegistrationNumber

 static function generateRegistrationNumber($program, $inst_id)
 {
     list($form, $prog_id) = array_pad(explode("|", $program, 2), 2, "");
     $program_name = I2CE_FormStorage::lookupField($form, $prog_id, array("name"), false);
     $program_name = $program_name["name"];
     list($institution_form, $institution_id) = array_pad(explode("|", $inst_id), 2, "");
     $where = array("operator" => "FIELD_LIMIT", "field" => "id", "style" => "equals", "data" => array("value" => $institution_id));
     $last_reg_num = I2CE_FormStorage::lookupField($institution_form, $institution_id, array("last_reg_num", "code"), false);
     $inst_code = $last_reg_num["code"];
     $last_reg_num = $last_reg_num["last_reg_num"];
     $reg_num = ++$last_reg_num;
     $year = date("Y");
     $st_reg_num = $year . "-" . $inst_code . "-" . $reg_num;
     return $st_reg_num;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:15,代码来源:STS_PageFormPerson.php

示例9: getAllowedConfirmations

 /**
  * Gets the list (in the format of {I2CE_FormStorage::listFields()} of allowed confirmations for the indicated person
  * @param iHRIS_Person $person
  * @param boolean $only_new.  Defaults to false.  it true, we only check for confirmations that this person does not already have
  * @returns array
  */
 public function getAllowedConfirmations($person, $only_new = false)
 {
     if (!$person instanceof iHRIS_Person) {
         return array();
     }
     $allowed = array();
     $conf_type_fields = array('name', 'job', 'probation_period');
     $confirmations = I2CE_FormStorage::listFields('confirmation_type', $conf_type_fields);
     if (count($confirmations) == 0) {
         return array();
     }
     foreach ($confirmations as $id => $vals) {
         $job = false;
         if (array_key_exists('job', $vals) && $vals['job']) {
             $job = $vals['job'];
         }
         //there is no job associted to this confirmation, all positions are valid.
         $where = array('operator' => 'FIELD_LIMIT', 'field' => 'start_date', 'style' => 'not_null');
         if ($job) {
             $pers_positions = I2CE_FormStorage::listFields('person_position', array('start_date', 'position'), $person->getNameId(), $where, 'start_date');
             if (!is_array($pers_positions) || count($pers_positions) == 0) {
                 continue;
             }
             $position = false;
             foreach ($pers_positions as $pp_id => $pp_data) {
                 //we need to check if this posiiton has the correct job
                 $pos_id = substr($pp_data['position'], 9);
                 if (!$pos_id || !($pos_job = I2CE_FormStorage::lookupField('position', $pos_id, 'job'))) {
                     continue;
                 }
                 if ($pos_job != $job) {
                     continue;
                 }
                 $position = $pp_data;
                 break;
             }
             if (!$position) {
                 //no mathching posiiton
                 continue;
             }
         } else {
             $positions = I2CE_FormStorage::listFields('person_position', array('start_date'), $person->getNameId(), $where, 'start_date', 1);
             if (!is_array($positions) || count($positions) == 0) {
                 //person has no valid positions
                 continue;
             }
             reset($positions);
             $position = current($positions);
         }
         if (array_key_exists('probation_period', $vals) && $vals['probation_period'] > 0) {
             if (!array_key_exists('start_date', $position) || !$position['start_date']) {
                 //there was never a position for which can consider this person valid
                 continue;
             }
             //now we need to check the probationary period
             $pos_start_date = I2CE_Date::fromDB($position['start_date']);
             if (!$pos_start_date->isValid()) {
                 continue;
             }
             //probation period is measure in months.  this is an approximation.  we really need to use the php 5.3 date time class.
             $prob_valid_month = mktime(0, 0, 0, date("m") - (int) $vals['probation_period'], date("d"), date("Y"));
             if ($prob_valid_month === false) {
                 I2CE::raiseError("Difficulty in calculating date offest");
                 continue;
             }
             $prob_valid = I2CE_Date::now(I2CE_Date::DATE, $prob_valid_month);
             if (!$prob_valid->isValid() || $prob_valid->before($pos_start_date)) {
                 //comprare returns -1 if  $prob_valid is before $pos_start_data
                 continue;
             }
             //we have a position which is  valid for this confirmation type
         }
         if ($only_new) {
             $confirm_where = array('operator' => 'FIELD_LIMIT', 'field' => 'confirmation_type', 'style' => 'equals', 'data' => array('value' => 'confirmation_type|' . $id));
             if (count(I2CE_FormStorage::search('confirmation', $person->getNameId(), $confirm_where)) > 0) {
                 continue;
             }
         }
         //we made it to here, then the confirmation type is allowed
         $allowed[$id] = $vals;
     }
     return $allowed;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:89,代码来源:iHRIS_Module_Confirmation.php

示例10: walkupFieldPath

 /**
  * Walk up a form/linked  field path until. Return the id of the top form.
  * $param mixed. Either an array of string or a colon-sepearted string.  (imploded) values is a string of the form:
  *    form1(+field1):...:formM(+fieldM):..:fieldN     
  *    there needs to be at least one colon/array needs to be at least two in length
  * @param string $formid  string of the form "$form|$id".  the starting value.  $form should be one of formX above (e.g. the dbvalue of a map field)
  * @returns mixed. False on failure, string of the form "$form|$id" on success
  */
 public static function walkupFieldPath($field_path, $formid)
 {
     if (is_string($field_path)) {
         $field_path = explode(':', $field_path);
     }
     if (!is_array($field_path) || count($field_path) < 2) {
         return false;
     }
     list($form, $form_id) = array_pad(explode('|', $formid, 2), 2, '');
     if (strlen($form_id) == 0 || strlen($form_id) == 0) {
         return false;
     }
     $form_path = array();
     $link_field_path = array();
     $len = count($field_path);
     for ($i = $len - 1; $i >= 0; $i--) {
         $data = explode('+', $field_path[$i], 2);
         if (count($data) == 2) {
             list($form, $link_field) = $data;
         } else {
             $link_field = $form;
             $form = $field_path[$i];
         }
         $form_path[$i] = $form;
         $link_field_path[$i] = $link_field;
     }
     //ksort($form_path);
     //ksort($link_field_path);
     //now we need to see if we can find the form.
     if (($form_index = array_search($form, $form_path)) === false) {
         //the resitrcted form is not among the forms in the form path.
         return false;
     }
     //now we need to walk up the form path until we get to the id of the top most form (e.g. country) for the resitrcted field
     //example:  formid = country|10.  stop this is the top
     //example:  formid = region|10
     //          get dbvalue country field in region|10.  this is the top
     //example:  formid = distrct|10
     //          get dbvalue region field in district|10.  suppose it is refgion|10
     //          get dbvalue country field in region|10.  this is the top
     for ($i = $form_index; $i < $len - 1; $i++) {
         //if (($form_id = I2CE_FormStorage::search($form_path[$i],false,$where,array(),1)) === false) {
         if (($formid = I2CE_FormStorage::lookupField($form_path[$i], $form_id, $link_field_path[$i])) === false) {
             //could not walk up the path.
             return false;
         }
         list($form, $form_id) = array_pad(explode('|', $formid, 2), 2, '');
         if ($form != $link_field_path[$i] || strlen($form_id) == 0 || strlen($form_id) == 0) {
             //be extra sutre that no invalid id received
             return false;
         }
     }
     //$formid is now the id of the top form.
     return $formid;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:63,代码来源:I2CE_List.php

示例11: getFormDataJoiningByID_fields

 /**
  * Get the forms ids for joining on a given field of  a named child form's with the named parent form on a given field
  * @param string $childFormName the name of the child form in the relationship
  * @param string $parentForm
  * @param string $parentId
  * @param array $joinData The array containg the join data
  * @param array $where
  * @param array $limit
  * @param array $fields keys are relationship formnames, values are array of fields we want returned
  * @param array $ordering keys are relationship formnames, values are array of fields we want ordered by
  * @return mixed. An array of form ids
  */
 public function getFormDataJoiningByID_fields($childFormName, $parentForm, $parentId, $joinData, $where, $limit, $fields, $ordering)
 {
     if (!is_array($joinData)) {
         I2CE::raiseError("Join data  specified for parent_form/{$childFormName}");
         return array();
     }
     foreach (array('parent', 'child') as $field) {
         if (!array_key_exists($field, $joinData) || !is_string($joinData[$field]) || strlen($joinData[$field]) == 0) {
             I2CE::raiseError("Join {$field} field not specified for parent_form/{$childFormName}");
             return array();
         }
     }
     $form = $this->getForm($childFormName);
     $pfield = $joinData['parent'];
     $cfield = $joinData['child'];
     $pData = I2CE_FormStorage::lookupField($parentForm, $parentId, array($pField), '');
     list($pForm, $pId) = array_pad(explode("|", $pData, 2), 2, '');
     //this will give the linked form and id
     if (!array_key_exists($childFormName, $fields) || !is_array($fields[$childFormName])) {
         $fields[$childFormName] = array();
     }
     if (!array_key_exists($childFormName, $ordering)) {
         $ordering[$childFormName] = array();
     }
     $sub_where = array('operator' => 'FIELD_LIMIT', 'field' => $cfield, 'style' => 'equals', 'data' => array('value' => $pForm . '|' . $pId));
     if (count($where) > 0) {
         $where = array('operator' => 'AND', 'operand' => array($sub_where, $where));
     } else {
         $where = $sub_where;
     }
     if ($this->use_disp_fields) {
         return I2CE_FormStorage::listFields($form, $fields[$childFormName], false, $where, $ordering[$childFormName], $limit, -1, $this->use_cache);
     } else {
         return I2CE_FormStorage::listDisplayFields($form, $fields[$childFormName], false, $where, $ordering[$childFormName], $limit, -1, $this->use_cache);
     }
     //return " JOIN $refChildForm AS `$childFormName` ON `$childFormName`.`{$joinData['child']}` = `parent_form`.`{$joinData['parent']}` " ;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:49,代码来源:I2CE_FormRelationship.php

示例12: actionDisplayList_row

 protected function actionDisplayList_row($list, $listConfig)
 {
     $odd = false;
     if ($listConfig['type']) {
         $link = 'auto_list?type=' . $listConfig['type'];
     } else {
         $link = 'auto_list?form=' . $listConfig['form'];
     }
     $imported = $this->template->loadFile("lists_type_row.html", "tr", "lists_body");
     if (!$imported instanceof DOMNode) {
         I2CE::raiseError("Could not find lists_type_row.html");
         return false;
     }
     $remaped = $this->template->loadFile("lists_type_row_remapped.html", "tr", "lists_body");
     if (!$remaped instanceof DOMNode) {
         $remaped = $imported;
     }
     $append = $this->template->getElementById('lists_body');
     if (!$append instanceof DOMNode) {
         I2CE::raiseError("Don't know where to append list rows");
         return false;
     }
     foreach ($list as $data) {
         $id = substr($data['value'], strlen($listConfig['form']) + 1);
         if (in_array($id, $this->remap_ids) && ($remap = I2CE_FormStorage::lookupField($listConfig['form'], $id, 'remap', ''))) {
             $imported_row = $remaped->cloneNode(true);
             if ($listConfig['type']) {
                 $url = 'index.php/auto_list?type=' . $listConfig['type'];
             } else {
                 $url = 'index.php/auto_list?form=' . $listConfig['type'];
             }
             $url .= '&id=' . $listConfig['form'] . '|' . $id;
             $this->template->setDisplayDataImmediate('remapped_link', $url, $imported_row);
             list($rform, $rid) = array_pad(explode('|', $remap, 2), 2, '');
             $this->template->setDisplayDataImmediate('remapped_value', I2CE_List::lookup($rid, $rform), $imported_row);
         } else {
             $imported_row = $imported->cloneNode(true);
         }
         $this->template->appendNode($imported_row, $append);
         if ($odd) {
             $this->template->setNodeAttribute("class", "even", $imported_row);
         }
         $odd = !$odd;
         $this->template->setDisplayDataImmediate("lists_row_link", $link . '&id=' . $data['value'], $imported_row);
         $this->template->setDisplayDataImmediate("lists_row_name", $data['display'], $imported_row);
     }
     return true;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:48,代码来源:I2CE_PageAutoList.php

示例13: showStudents

 protected function showStudents()
 {
     if (!($listNode = $this->template->getElementByID("existing_student_list")) instanceof DOMNode) {
         return;
     }
     foreach ($this->students as $formid => $data) {
         list($form, $id) = array_pad(explode("|", $formid, 2), 2, "");
         if ($form != "person" || !$id) {
             continue;
         }
         $student_name = I2CE_FormStorage::lookupField("person", $id, array('firstname', 'surname'), " ");
         $aNode = $this->template->createElement("a", array(href => "view?id=" . $formid), $student_name);
         $liNode = $this->template->createElement("li");
         $this->template->appendNode($aNode, $liNode);
         $this->template->appendNode($liNode, $listNode);
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:17,代码来源:iHRIS_PageEditStudents.php

示例14: getEnrolledStudents

 public function getEnrolledStudents()
 {
     if ($this->id == 0) {
         return array();
     }
     $where = array('operator' => 'AND', 'operand' => array(0 => array('operator' => 'FIELD_LIMIT', 'field' => 'scheduled_training_course', 'style' => 'equals', 'data' => array('value' => $this->getNameId())), 1 => array('operator' => 'OR', 'operand' => array(0 => array('operator' => 'FIELD_LIMIT', 'field' => 'attending', 'style' => 'equals', 'data' => array('value' => 1)), 1 => array('operator' => 'FIELD_LIMIT', 'field' => 'attending', 'style' => 'null', 'data' => array())))));
     $pstcs = I2CE_FormStorage::listFields('person_scheduled_training_course', array(), true, $where);
     $list = array();
     foreach ($pstcs as $pstc_id => $pstc) {
         if (strpos($pstc['parent'], '|') === false) {
             continue;
         }
         list($parent, $id) = explode('|', $pstc['parent'], 2);
         if ($parent != 'person') {
             continue;
         }
         $list[$pstc['parent']] = I2CE_FormStorage::lookupField('person', $id, array('surname', 'firstname'), false);
         $list[$pstc['parent']]['person_scheduled_training_course'] = 'person_scheduled_training_course|' . $pstc_id;
     }
     uasort($list, array($this, 'surnameSort'));
     return $list;
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:22,代码来源:iHRIS_Scheduled_Training_Course.php

示例15: appendExamTypesHeaders

 protected function appendExamTypesHeaders($tr)
 {
     list($form, $id) = array_pad(explode("|", $this->course_id, 2), 2, '');
     $field_data = I2CE_FormStorage::lookupField($form, $id, array('training_course_exam_type'), false);
     $this->exam_types = explode(",", $field_data["training_course_exam_type"]);
     foreach ($this->exam_types as $exam_type) {
         list($form, $id) = array_pad(explode("|", $exam_type, 2), 2, '');
         $field_data = I2CE_FormStorage::lookupField($form, $id, array('name'), false);
         $th = $this->template->createElement("th", array("width" => "10", "align" => "center"), $field_data["name"]);
         $this->template->appendNode($th, $tr);
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:12,代码来源:iHRIS_PageFormAddResults.php


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