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


PHP I2CE_FormStorage::lookupDisplayField方法代码示例

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


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

示例1: getFormData

 /**
  * Get the forms that satisfy a relationship for the given primary form id
  * @param string $id the id of the primary form
  * @param array $fields keys are relationship formnames, values are array of fields we wan returned
  * @param array $ordering keys are relationship formnames, values are array of fields we want ordered by
  * @returns array of mixed.  The array may be empty if the $form_id  does not satisfy the relationship.  It is indexed by the named form and the form objects
  * are already populated.  If there was no matching form for a given named form, then the value of the array elemet will be false
  */
 public function getFormData($form, $id, $fields = array(), $ordering = array(), $as_iterator = true)
 {
     if ($this->use_cache) {
         $cforms = $this->getRequiredForms();
         I2CE::raiseError("Attempting to cache the required forms for the relationhip " . implode(",", $cforms));
         $failures = array();
         foreach ($cforms as $cform) {
             try {
                 $cachedForm = new I2CE_CachedForm($cform);
             } catch (Exception $e) {
                 if (array_key_exists('HTTP_HOST', $_SERVER)) {
                     //we don't need to check here, b/c it won't error out.  we are doing it to keep the log file clean
                     $msgs = array('not_cached' => 'Unable to setup cached form');
                     foreach ($msgs as $k => &$v) {
                         I2CE::getConfig()->setIfIsSet($v, "/modules/CustomReports/text/user_messages/{$k}");
                     }
                 }
                 $failures[] = $cform;
                 continue;
             }
             if (!$cachedForm->generateCachedTable()) {
                 $failures[] = $cform;
                 continue;
             }
         }
         if (count($failures) > 0) {
             I2CE::raiseError("Warning data may be out of date for relationsjip -- could not cache forms:\n\t" . implode(',', $failures));
         } else {
             I2CE::raiseError("Cached all forms");
         }
     }
     $results = array();
     if ($form != $this->getPrimaryForm()) {
         I2CE::raiseError("The given form ({$form}) does not match the primary form: " . $this->getPrimaryForm());
         return $results;
     }
     if (strlen($id) == 0 || $id == '0') {
         I2CE::raiseError("Passed empty id");
         return $results;
     }
     $this->_walkSatisfyingForms('primary_form', $form, $id, $fields, $ordering, $results);
     if (!array_key_exists($form, $fields) || !is_array($fields[$form])) {
         $fields[$form] = array();
     }
     if (!array_key_exists($form, $ordering)) {
         $ordering[$form] = array();
     }
     if ($this->use_disp_fields) {
         $data = I2CE_FormStorage::lookupDisplayField($form, $id, $fields['primary_form'], false);
     } else {
         $data = I2CE_FormStorage::lookupField($form, $id, $fields['primary_form'], false);
     }
     $data = array('primary_form' => array("{$form}|{$id}" => array('fields' => $data, 'joins' => $results)));
     if ($as_iterator) {
         return new I2CE_RelationshipData($this, $data);
     } else {
         return $data;
     }
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:67,代码来源:I2CE_FormRelationship.php

示例2: lookup

 /**
  * Looks up the description of the item based on the code.
  * 
  * This is the default method that most implementations of {@link lookup()} use.  It finds the description of
  * the object based on the code and saves it in the {@link cache} and returns it.
  * @param integer $id The code of the entry to lookup.
  * @param string $form_name The name of the form in the database.
  * @return string
  */
 public static function lookup($id, $form_name)
 {
     if (!$id || $id == "") {
         return "";
     }
     if (!self::isCached($form_name, $id)) {
         $value_arr = I2CE_FormStorage::lookupDisplayField($form_name, $id, self::getDisplayFields($form_name), false);
         if (count($value_arr) > 0) {
             $value = @vsprintf(self::getDisplayString($form_name), $value_arr);
         } else {
             $value = false;
         }
         if ($value) {
             self::addCache($form_name, $id, $value);
             return $value;
         }
     }
     return self::getCache($form_name, $id);
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:28,代码来源:I2CE_List.php

示例3: getFormData

 /**
  * Get the forms that satisfy a relationship for the given primary form id
  * @param string $id the id of the primary form
  * @param array $fields keys are relationship formnames, values are array of fields we wan returned
  * @param array $ordering keys are relationship formnames, values are array of fields we want ordered by
  * @returns array of mixed.  The array may be empty if the $form_id  does not satisfy the relationship.  It is indexed by the named form and the form objects
  * are already populated.  If there was no matching form for a given named form, then the value of the array elemet will be false
  */
 public function getFormData($form, $id, $fields = array(), $ordering = array(), $as_iterator = true)
 {
     if ($this->use_cache && !$this->already_cached) {
         $this->already_cached = true;
         $cforms = $this->getRequiredForms();
         I2CE::raiseError("Attempting to cache the required forms for the relationhip " . implode(",", $cforms));
         $failures = array();
         foreach ($cforms as $cform) {
             try {
                 $cachedForm = new I2CE_CachedForm($cform);
             } catch (Exception $e) {
                 if (array_key_exists('HTTP_HOST', $_SERVER)) {
                     //we don't need to check here, b/c it won't error out.  we are doing it to keep the log file clean
                     $msgs = array('not_cached' => 'Unable to setup cached form');
                     foreach ($msgs as $k => &$v) {
                         I2CE::getConfig()->setIfIsSet($v, "/modules/CustomReports/text/user_messages/{$k}");
                     }
                 }
                 $failures[] = $cform;
                 continue;
             }
             if (!$cachedForm->generateCachedTable()) {
                 $failures[] = $cform;
                 continue;
             }
         }
         if (count($failures) > 0) {
             I2CE::raiseError("Warning data may be out of date for relationsjip -- could not cache forms:\n\t" . implode(',', $failures));
         } else {
             I2CE::raiseError("Cached all forms");
         }
     }
     $results = array();
     if ($form != $this->getPrimaryForm()) {
         I2CE::raiseError("The given form ({$form}) does not match the primary form: " . $this->getPrimaryForm());
         if ($as_iterator instanceof DOMElement) {
             return false;
         } else {
             return $results;
         }
     }
     if (strlen($id) == 0 || $id == '0') {
         I2CE::raiseError("Passed empty id");
         if ($as_iterator instanceof DOMElement) {
             return false;
         } else {
             return $results;
         }
     }
     if ($as_iterator instanceof DOMElement) {
         if (!array_key_exists('primary_form', $fields) || !is_array($fields['primary_form'])) {
             $fields['primary_form'] = array();
         }
         if (!array_key_exists('primary_form', $this->object_cache)) {
             if (!($this->object_cache['primary_form'] = $this->getContainer($form)) instanceof I2CE_Form) {
                 return false;
             }
         }
         $this->object_cache['primary_form']->resetDefaultValues();
         $this->object_cache['primary_form']->setID($id);
         $data = I2CE_FormStorage::lookupField($form, $id, $fields['primary_form'], false);
         foreach ($fields['primary_form'] as $field) {
             if (!($fieldObj = $this->object_cache['primary_form']->getField($field)) instanceof I2CE_FormField || !array_key_exists($field, $data) || !is_scalar($data[$field])) {
                 continue;
             }
             $fieldObj->setFromDB($data[$field]);
         }
         //            I2CE::raiseError(print_r($fields,true));
         if (!($primary_node = $this->object_cache['primary_form']->getXMLRepresentation(true, $as_iterator, $fields['primary_form'])) instanceof DOMElement) {
             I2CE::raiseError("Couldn't get XML representation of primary form");
             return false;
         }
         $as_iterator->setAttribute('form', $form);
         $as_iterator->setAttribute('name', $this->relationship);
         $as_iterator->setAttribute('id', $id);
         //            $joined_forms = $as_iterator->ownerDocument->createElement('joinedForms');
         //            $as_iterator->appendChild($joined_forms);
         //            $this->_walkSatisfyingForms('primary_form',$form,$id,$fields,$ordering,$joined_forms);
         $this->_walkSatisfyingForms('primary_form', $form, $id, $fields, $ordering, $as_iterator);
         return true;
     } else {
         if (!array_key_exists($form, $fields) || !is_array($fields[$form])) {
             $fields[$form] = array();
         }
         if (!array_key_exists($form, $ordering)) {
             $ordering[$form] = array();
         }
         $this->_walkSatisfyingForms('primary_form', $form, $id, $fields, $ordering, $results);
         if ($this->use_disp_fields) {
             $data = I2CE_FormStorage::lookupDisplayField($form, $id, $fields['primary_form'], false);
         } else {
             $data = I2CE_FormStorage::lookupField($form, $id, $fields['primary_form'], false);
//.........这里部分代码省略.........
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:101,代码来源:I2CE_FormRelationship.php


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