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


PHP MUtil_Model_ModelAbstract::setMeta方法代码示例

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


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

示例1: apply

 /**
  *
  * @param string $trackingField The field that stores the tracking value
  * @param string $trackedField   The field whose changing is tracked
  * @param string $oldValueField Optional, the field to store a copy of the original value in
  */
 public function apply($trackingField, $trackedField, $oldValueField = null)
 {
     if (null === $oldValueField) {
         // Defautl name
         $oldValueField = self::OLD_FIELD_PREFIX . $trackedField;
         // Check if a fields already existed
         if (method_exists($this->_model, 'getKeyCopyName')) {
             $copyName = $this->_model->getKeyCopyName($trackedField);
             if ($this->_model->has($copyName)) {
                 $oldValueField = $copyName;
             }
         }
     }
     if (!$this->_model->has($oldValueField)) {
         $this->_model->set($oldValueField, 'elementClass', 'Hidden', __CLASS__, $trackedField);
         $this->_model->setOnLoad($oldValueField, array($this, 'loadOldValue'));
     }
     if (!$this->_model->has($trackingField)) {
         // Only load the original value and ste the original result when it was not already in the model
         $this->_model->setAutoSave($trackingField);
         // $this->_model->setOnLoad($trackingField, $this->_unchangedValue);
     }
     $this->_model->set($trackingField, __CLASS__, array($trackedField, $oldValueField));
     $this->_model->setOnSave($trackingField, array($this, 'saveValue'));
     // Store the extra hidden fields needed
     $hiddenFields = $this->_model->getMeta(self::HIDDEN_FIELDS, array());
     $hiddenFields[] = $oldValueField;
     $this->_model->setMeta(self::HIDDEN_FIELDS, $hiddenFields);
     // Make sure the fields are in the result set
     $this->_model->get($trackedField);
     $this->_model->get($trackingField);
     $this->_model->get($oldValueField);
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:39,代码来源:ChangeTracker.php

示例2: hasHtmlOutput

 /**
  * The place to check if the data set in the snippet is valid
  * to generate the snippet.
  *
  * When invalid data should result in an error, you can throw it
  * here but you can also perform the check in the
  * checkRegistryRequestsAnswers() function from the
  * {@see \MUtil_Registry_TargetInterface}.
  *
  * @return boolean
  */
 public function hasHtmlOutput()
 {
     $reqFilter = $this->request->getParam('filter');
     switch ($reqFilter) {
         case 'todo':
             //Only actions valid now that are not already done
             $filter[] = 'gto_completion_time IS NULL';
             $filter[] = 'gto_valid_from <= CURRENT_TIMESTAMP';
             $filter[] = '(gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP)';
             break;
         case 'done':
             //Only completed actions
             $filter[] = 'gto_completion_time IS NOT NULL';
             break;
         case 'missed':
             //Only missed actions (not filled in, valid until < today)
             $filter[] = 'gto_completion_time IS NULL';
             $filter[] = 'gto_valid_until < CURRENT_TIMESTAMP';
             break;
         case 'all':
             $filter[] = 'gto_valid_from IS NOT NULL';
             break;
         default:
             //2 weeks look ahead, valid from date is set
             $filter[] = 'gto_valid_from IS NOT NULL';
             $filter[] = 'DATEDIFF(gto_valid_from, CURRENT_TIMESTAMP) < 15';
             $filter[] = '(gto_valid_until IS NULL OR gto_valid_until >= CURRENT_TIMESTAMP)';
     }
     $this->model->setMeta('tab_filter', $filter);
     return parent::hasHtmlOutput();
 }
开发者ID:harmslijper,项目名称:gemstracker-library,代码行数:42,代码来源:TokenTabsSnippet.php

示例3: hasHtmlOutput

 /**
  * The place to check if the data set in the snippet is valid
  * to generate the snippet.
  *
  * When invalid data should result in an error, you can throw it
  * here but you can also perform the check in the
  * checkRegistryRequestsAnswers() function from the
  * {@see \MUtil_Registry_TargetInterface}.
  *
  * @return boolean
  */
 public function hasHtmlOutput()
 {
     $sql = "SELECT COALESCE(gto_round_description, '') AS label,\n                        SUM(\n                            CASE\n                            WHEN gto_completion_time IS NOT NULL\n                            THEN 1\n                            ELSE 0\n                            END\n                        ) AS completed,\n                        SUM(\n                            CASE\n                            WHEN gto_completion_time IS NULL AND\n                                gto_valid_from < CURRENT_TIMESTAMP AND\n                                (gto_valid_until > CURRENT_TIMESTAMP OR gto_valid_until IS NULL)\n                            THEN 1\n                            ELSE 0\n                            END\n                        ) AS waiting,\n                        COUNT(*) AS any\n                    FROM gems__tokens INNER JOIN\n                        gems__surveys ON gto_id_survey = gsu_id_survey INNER JOIN\n                        gems__rounds ON gto_id_round = gro_id_round INNER JOIN\n                        gems__respondent2track ON gto_id_respondent_track = gr2t_id_respondent_track INNER JOIN\n                        gems__reception_codes AS rcto ON gto_reception_code = rcto.grc_id_reception_code INNER JOIN\n                        gems__reception_codes AS rctr ON gr2t_reception_code = rctr.grc_id_reception_code\n                    WHERE gto_id_respondent = ? AND\n                        gro_active = 1 AND\n                        gsu_active = 1 AND\n                        rcto.grc_success = 1 AND\n                        rctr.grc_success = 1\n                    GROUP BY COALESCE(gto_round_description, '')\n                    ORDER BY MIN(COALESCE(gto_round_order, 100000)), gto_round_description";
     // \MUtil_Echo::track($this->respondentId);
     $tabLabels = $this->db->fetchAll($sql, $this->respondentId);
     if ($tabLabels) {
         $default = null;
         $filters = array();
         $noOpen = true;
         $tabs = array();
         foreach ($tabLabels as $row) {
             $name = '_' . \MUtil_Form::normalizeName($row['label']);
             $label = $row['label'] ? $row['label'] : $this->_('empty');
             if ($row['waiting']) {
                 $label = sprintf($this->_('%s (%d open)'), $label, $row['waiting']);
             } else {
                 $label = $label;
             }
             if (!$row['label']) {
                 $label = \MUtil_Html::create('em', $label);
             }
             $filters[$name] = $row['label'];
             $tabs[$name] = $label;
             if ($noOpen && $row['completed'] > 0) {
                 $default = $name;
             }
             if ($row['waiting'] > 0) {
                 $default = $name;
                 $noOpen = false;
             }
         }
         if (null === $default) {
             reset($filters);
             $default = key($filters);
         }
         // Set the model
         $reqFilter = $this->request->getParam($this->getParameterKey());
         if (!isset($filters[$reqFilter])) {
             $reqFilter = $default;
         }
         if ('' === $filters[$reqFilter]) {
             $this->model->setMeta('tab_filter', array("(gto_round_description IS NULL OR gto_round_description = '')"));
         } else {
             $this->model->setMeta('tab_filter', array('gto_round_description' => $filters[$reqFilter]));
         }
         // \MUtil_Echo::track($tabs, $reqFilter, $default, $tabLabels);
         $this->defaultTab = $default;
         $this->_tabs = $tabs;
     }
     return $this->_tabs && parent::hasHtmlOutput();
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:62,代码来源:RoundsTabsSnippet.php

示例4: getFieldInfo

 /**
  * If the transformer add's fields, these should be returned here.
  * Called in $model->AddTransformer(), so the transformer MUST
  * know which fields to add by then (optionally using the model
  * for that).
  *
  * @param \MUtil_Model_ModelAbstract $model The parent model
  * @return array Of filedname => set() values
  */
 public function getFieldInfo(\MUtil_Model_ModelAbstract $model)
 {
     // Many definitions use load transformers
     $model->setMeta(\MUtil_Model_ModelAbstract::LOAD_TRANSFORMER, true);
     return $this->fieldsDefinition->getDataModelSettings();
 }
开发者ID:GemsTracker,项目名称:gemstracker-library,代码行数:15,代码来源:AddTrackFieldsTransformer.php


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