當前位置: 首頁>>代碼示例>>PHP>>正文


PHP plgFabrik_Element::preFormatFormJoins方法代碼示例

本文整理匯總了PHP中plgFabrik_Element::preFormatFormJoins方法的典型用法代碼示例。如果您正苦於以下問題:PHP plgFabrik_Element::preFormatFormJoins方法的具體用法?PHP plgFabrik_Element::preFormatFormJoins怎麽用?PHP plgFabrik_Element::preFormatFormJoins使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在plgFabrik_Element的用法示例。


在下文中一共展示了plgFabrik_Element::preFormatFormJoins方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: preFormatFormJoins

 /**
  * Allows the element to pre-process a rows data before and join mergeing of rows
  * occurs. Used in calc element to do cals on actual row rather than merged row
  *
  * @param   string  $element_data  elements data for the current row
  * @param   object  $row           current row's data
  *
  * @since	3.0.5
  *
  * @return  string	formatted value
  */
 public function preFormatFormJoins($element_data, $row)
 {
     $params = $this->getParams();
     $format = trim($params->get('calc_format_string'));
     /**
      * $$$ hugh - the 'calculated value' bit is for legacy data that was created
      * before we started storing a value when row is saved
      */
     if ($params->get('calc_on_save_only', 0)) {
         if ($format != '') {
             $element_data = sprintf($format, $element_data);
         }
         return parent::preFormatFormJoins($element_data, $row);
     } else {
         $element = $this->getElement();
         $cal = $params->get('calc_calculation', '');
         $listModel = $this->getlistModel();
         $formModel = $this->getFormModel();
         $data = JArrayHelper::fromObject($row);
         $data['rowid'] = $data['__pk_val'];
         $data['fabrik'] = $formModel->getId();
         /**
          *  $$$ hugh - trying to standardize on $data so scripts know where data is,
          *  need $d here for backward compat
          */
         $d = $data;
         $res = $listModel->parseMessageForRowHolder($cal, $data, true);
         $res = @eval($res);
         FabrikWorker::logEval($res, 'Caught exception on eval in ' . $element->name . '::renderListData() : %s');
         if ($format != '') {
             $res = sprintf($format, $res);
         }
         // $$$ hugh - need to set _raw, might be needed if (say) calc is being used as 'use_as_row_class'
         // See comments in formatData() in table model, we might could move this to a renderRawListData() method.
         $raw_name = $this->getFullName(false, true, false) . '_raw';
         $row->{$raw_name} = str_replace(GROUPSPLITTER, ',', $res);
         return parent::preFormatFormJoins($res, $row);
     }
 }
開發者ID:rogeriocc,項目名稱:fabrik,代碼行數:50,代碼來源:calc.php


注:本文中的plgFabrik_Element::preFormatFormJoins方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。