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


PHP DateUtil::transformInternalDate方法代码示例

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


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

示例1: insertPreProcess

 public function insertPreProcess($data = null)
 {
     $data =& $this->_objData;
     // sort column
     $data['sortname'] = $data['fname'] . ' ' . $data['lname'];
     $data['sortcompany'] = $data['company'];
     // same
     $data['date'] = time();
     // convert custom date type and numeric values
     // get the custom fields
     $cus_where = "";
     $cus_sort = "cus_pos ASC";
     $cus_Array = new AddressBook_DBObject_CustomfieldArray();
     $customfields = $cus_Array->get($cus_where, $cus_sort);
     foreach ($customfields as $cus) {
         $cusfield = "custom_" . $cus['id'];
         if (!empty($data[$cusfield])) {
             if ($cus['type'] == 'date default NULL') {
                 $data[$cusfield] = DateUtil::parseUIDate($data[$cusfield]);
                 $data[$cusfield] = DateUtil::transformInternalDate($data[$cusfield]);
             }
             if ($cus['type'] == 'decimal(10,2) default NULL') {
                 $check_format = ereg_replace(",", ".", $data[$cusfield]);
                 $split_format = explode(".", $check_format);
                 $count_array = count($split_format);
                 // example 1000
                 if ($count_array == 1) {
                     if (ereg("^[+|-]{0,1}[0-9]{1,}\$", $check_format)) {
                         $num = "{$split_format['0']}";
                     }
                 }
                 // example 1000,20 or 1.000
                 if ($count_array == 2) {
                     if (ereg("^[+|-]{0,1}[0-9]{1,}.[0-9]{0,2}\$", $check_format)) {
                         $num = "{$split_format['0']}.{$split_format['1']}";
                     }
                 }
                 // example 1,000.20 or 1.000,20
                 if ($count_array == 3) {
                     if (ereg("^[+|-]{0,1}[0-9]{1,}.[0-9]{3}.[0-9]{0,2}\$", $check_format)) {
                         $num = "{$split_format['0']}{$split_format['1']}.{$split_format['2']}";
                     }
                 }
                 $data[$cusfield] = $num;
             }
         }
     }
     return $data;
 }
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:49,代码来源:Address.php

示例2: validate

 /**
  * Validates the input string.
  *
  * @param Zikula_Form_View $view Reference to Zikula_Form_View object.
  *
  * @return void
  */
 public function validate(Zikula_Form_View $view)
 {
     parent::validate($view);
     if (!$this->isValid) {
         return;
     }
     if (strlen($this->text) > 0) {
         if ($this->includeTime) {
             $dateValue = DateUtil::transformInternalDateTime(DateUtil::parseUIDate($this->text, $this->ifFormat));
         } else {
             $dateValue = DateUtil::transformInternalDate(DateUtil::parseUIDate($this->text, $this->ifFormat));
         }
         if ($dateValue == null) {
             $this->setError(__('Error! Invalid date.'));
         } else {
             // the date validated so we can use the transformed date
             $this->text = $dateValue;
         }
     }
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:27,代码来源:DateInput.php

示例3: savedata

    /**
     * Utility function to save the data of the user.
     *
     * Parameters passed in the $args array:
     * -------------------------------------
     * integer uid      The user id of the user for which the data should be saved; required.
     * array   dynadata The data for the user to be saved, indexed by prop_attribute_name; required.
     * 
     * @param array $args All parameters passed to this function.
     *
     * @return boolean True on success; otherwise false.
     */
    public function savedata($args)
    {
        // Argument check
        if (!isset($args['uid'])) {
            return LogUtil::registerArgsError();
        }

        $fields = $args['dynadata'];

        $duds = ModUtil::apiFunc('Profile', 'user', 'getallactive', array('get' => 'editable', 'uid' => $args['uid']));

        foreach ($duds as $attrname => $dud) {
            // exclude avatar update when Avatar module is present
            if ($attrname == 'avatar' && ModUtil::available('Avatar')) {
                continue;
            }

            $fieldvalue = '';
            if (isset($fields[$attrname])) {
                // Process the Date DUD separately
                if ($dud['prop_displaytype'] == 5 && !empty($fields[$attrname])) {
                    $fieldvalue = $this->parseDate($fields[$attrname]);
                    $fieldvalue = DateUtil::transformInternalDate($fieldvalue);
                } elseif (is_array($fields[$attrname])) {
                    $fieldvalue = serialize(array_values($fields[$attrname]));
                } else {
                    $fieldvalue = $fields[$attrname];
                }
            }
            UserUtil::setVar($attrname, $fieldvalue, $args['uid']);
        }

        // Return the result (true = success, false = failure
        // At this point, the result is true.
        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:48,代码来源:User.php

示例4: smarty_function_duditemmodify


//.........这里部分代码省略.........
            $render->assign('listoptions', array_keys($options));
            $render->assign('listoutput', array_values($options));
            break;

        case 4: // SELECT
            $type = 'select';
            if (DataUtil::is_serialized($uservalue)) {
                $render->assign('value', unserialize($uservalue));
            }

            // multiple flag is the first field
            $options = explode('@@', $item['prop_listoptions'], 2);
            $selectmultiple = $options[0] ? ' multiple="multiple"' : '';
            $render->assign('selectmultiple', $selectmultiple);

            $options = ModUtil::apiFunc('Profile', 'dud', 'getoptions', array('item' => $item));

            $render->assign('listoptions', array_keys($options));
            $render->assign('listoutput', array_values($options));
            break;

        case 5: // DATE
            $type = 'date';

            // gets the format to use
            $format = ModUtil::apiFunc('Profile', 'dud', 'getoptions', array('item' => $item));
            
            switch (trim(strtolower($format)))
            {
                case 'datelong':
                    //! This is from the core domain (datelong)
                    $format = __('%A, %B %d, %Y');
                    break;
                case 'datebrief':
                    //! This is from the core domain (datebrief)
                    $format = __('%b %d, %Y');
                    break;
                case 'datestring':
                    //! This is from the core domain (datestring)
                    $format = __('%A, %B %d @ %H:%M:%S');
                    break;
                case 'datestring2':
                    //! This is from the core domain (datestring2)
                    $format = __('%A, %B %d');
                    break;
                case 'datetimebrief':
                    //! This is from the core domain (datetimebrief)
                    $format = __('%b %d, %Y - %I:%M %p');
                    break;
                case 'datetimelong':
                    //! This is from the core domain (datetimelong)
                    $format = __('%A, %B %d, %Y - %I:%M %p');
                    break;
                case 'timebrief':
                    //! This is from the core domain (timebrief)
                    $format = __('%I:%M %p');
                    break;
                case 'timelong':
                    //! This is from the core domain (timelong)
                    $format = __('%T %p');
                    break;
            }
            //! This is from the core domain (datebrief)
            $format = !empty($format) ? $format : __('%b %d, %Y');

            // process the temporal data if any
            $timestamp = null;
            if (isset($item['temp_propdata'])) {
                $timestamp = DateUtil::parseUIDate($item['temp_propdata']);
                $uservalue = DateUtil::transformInternalDate($timestamp);
            } elseif (!empty($uservalue)) {
                $timestamp = DateUtil::makeTimestamp($uservalue);
            }

            $render->assign('value',     $uservalue);
            $render->assign('timestamp', $timestamp);
            $render->assign('dudformat', $format);
            break;

        case 6: // EXTDATE (deprecated)
            // TODO [deprecate completely]
            $type = 'hidden';
            break;

        case 7: // MULTICHECKBOX
            $type = 'multicheckbox';
            $render->assign('value', (array)unserialize($uservalue));

            $options = ModUtil::apiFunc('Profile', 'dud', 'getoptions', array('item' => $item));

            $render->assign('fields', $options);
            break;

        default: // TEXT
            $type = 'text';
            break;
    }

    return $render->fetch('profile_dudedit_'.$type.'.tpl');
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:function.duditemmodify.php


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