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


PHP FabrikWorker::inFormProcess方法代码示例

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


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

示例1: getValue

 /**
  * Get the GMT Date time - tz offset applied in render() if needed
  *
  * @param   array $data          Form data date will be GMT if store as local OFF, otherwise as local time
  * @param   int   $repeatCounter When repeating joined groups we need to know what part of the array to access
  * @param   array $opts          Options
  *
  * @return  string    value  Date as GMT time
  */
 public function getValue($data, $repeatCounter = 0, $opts = array())
 {
     $params = $this->getParams();
     $alwaysToday = $params->get('date_alwaystoday', false);
     $defaultToday = $params->get('date_defaulttotoday', false);
     $formModel = $this->getFormModel();
     $value = parent::getValue($data, $repeatCounter, $opts);
     $db = FabrikWorker::getDbo();
     if (is_array($value)) {
         // Submission posted as array but date & time in date key. Can be keyed to 0 if parent class casts string to array.
         $value = FArrayHelper::getValue($value, 'date', FArrayHelper::getValue($value, 0));
     }
     // in some corner cases, date will be db name quoted, like in CSV export after an advanced search!
     $value = trim($value, "'");
     //if ($input->get('task') == 'form.process' || ($app->isAdmin() && $input->get('task') == 'process'))
     if (FabrikWorker::inFormProcess()) {
         // Don't mess with posted value - can cause double offsets - instead do in _indStoareDBFormat();
         return $value;
     }
     // Element could be a date element (in which case no time stored) - check for both datetime and date null dates.
     $nullDate = $db->getNullDate();
     $shortNullDate = explode(' ', $nullDate);
     $shortNullDate = FArrayHelper::getValue($shortNullDate, 0);
     $isNullDate = $nullDate == $value || $shortNullDate == $value;
     if (!(($formModel->isNewRecord() || $this->newGroup) && $defaultToday) && $value == '') {
         if (($value == '' || $isNullDate) && !$alwaysToday) {
             return $value;
         }
         if ($alwaysToday && $formModel->isEditable()) {
             $value = '';
         }
     }
     // Don't offset if null date.
     if ($isNullDate) {
         return $value;
     }
     $timeZone = new DateTimeZone($this->config->get('offset'));
     $date = JFactory::getDate($value, $timeZone);
     // Querystring value passed into new record
     if ($formModel->isNewRecord() && $value !== '') {
         // OK for : Default to current  = no Local time = yes
         if (!$defaultToday) {
             $date = new DateTime($date, $timeZone);
             return $date->format('Y-m-d H:i:s');
         }
         // Ok for : Default to current = yes, Local time = yes OR no
         $date = new DateTime($date, $timeZone);
         $date->setTimeZone(new DateTimeZone('UTC'));
         return $date->format('Y-m-d H:i:s');
     }
     // If value = '' don't offset it (not sure what the logic is but testing seems to indicate this to be true)
     $local = $formModel->hasErrors() || $value == '' || $params->get('date_store_as_local', 0) == 1 ? false : true;
     $value = $date->toSQL($local);
     return $value;
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:64,代码来源:date.php


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