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


PHP DateUtil::getDateTime方法代码示例

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


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

示例1: save

 /**
  * Save combined pagevars.
  *
  * @param array  $files     Files.
  * @param string $ext       Extention.
  * @param string $cache_dir Cache directory.
  *
  * @return array Array of file with combined pagevars file and remote files
  */
 private static function save($files, $ext, $cache_dir)
 {
     $themevars = ModUtil::getVar('ZikulaThemeModule');
     $lifetime = $themevars['cssjscombine_lifetime'];
     $hash = md5(serialize($files) . UserUtil::getTheme());
     $cachedFile = "{$cache_dir}/{$hash}_{$ext}.php";
     $cachedFileUri = "{$hash}_{$ext}.php";
     if (is_readable($cachedFile) && ($lifetime == -1 || filemtime($cachedFile) + $lifetime > time())) {
         return System::getBaseUri() . '/jcss.php?f=' . $cachedFileUri;
     }
     switch ($ext) {
         case 'css':
             $ctype = 'text/css';
             break;
         case 'js':
             $ctype = 'text/javascript';
             break;
         default:
             $ctype = 'text/plain';
             break;
     }
     $includedFiles = array();
     $outputFiles = array();
     $contents = array();
     $dest = fopen($cachedFile, 'w');
     foreach ($files as $file) {
         if (!empty($file)) {
             // skip remote files from combining
             if (is_file($file)) {
                 self::readfile($contents, $file, $ext);
                 $includedFiles[] = $file;
             } else {
                 $outputFiles[] = $file;
             }
         }
     }
     array_unshift($contents, "/* --- Combined file written: " . DateUtil::getDateTime() . " */\n\n");
     array_unshift($contents, "/* --- Combined files:\n" . implode("\n", $includedFiles) . "\n*/\n\n");
     $contents = implode('', $contents);
     // optional minify
     if ($themevars['cssjsminify'] && $ext == 'css') {
         // Remove comments.
         $contents = trim(preg_replace('/\\/\\*.*?\\*\\//s', '', $contents));
         // Compress whitespace.
         $contents = preg_replace('/\\s+/', ' ', $contents);
         // Additional whitespace optimisation -- spaces around certain tokens is not required by CSS
         $contents = preg_replace('/\\s*(;|\\{|\\}|:|,)\\s*/', '\\1', $contents);
     }
     global $ZConfig;
     $signingKey = md5(serialize($ZConfig['DBInfo']['databases']['default']));
     $signature = md5($contents . $ctype . $lifetime . $themevars['cssjscompress'] . $signingKey);
     $data = array('contents' => $contents, 'ctype' => $ctype, 'lifetime' => $lifetime, 'gz' => $themevars['cssjscompress'], 'signature' => $signature);
     fwrite($dest, serialize($data));
     fclose($dest);
     $combined = System::getBaseUri() . '/jcss.php?f=' . $cachedFileUri;
     array_unshift($outputFiles, $combined);
     return $outputFiles;
 }
开发者ID:Silwereth,项目名称:core,代码行数:67,代码来源:JCSSUtil.php

示例2: createObject

 /**
  * Create an object of the reuqested type and set the cr_date and cr_uid fields.
  *
  * @param string $type The type of the object to create.
  *
  * @return The newly created object
  */
 public static function createObject($type)
 {
     $dbtable = DBUtil::getTables();
     if (!$dbtable[$type]) {
         throw new \Exception(__f('%1$s: Unable to reference object type [%2$s]', array('ObjectUtil::createObject', $type)));
     }
     $obj = array();
     $obj['__TYPE__'] = $type;
     $obj['cr_date'] = DateUtil::getDateTime();
     $obj['cr_uid'] = UserUtil::getVar('uid');
     return $obj;
 }
开发者ID:Silwereth,项目名称:core,代码行数:19,代码来源:ObjectUtil.php

示例3: formulari_assigna

    /**
     * Show the form for make new bookings
     * @author	Albert Pérez Monfort (aperezm@xtec.cat)
     * @author	Josep Ferràndiz Farré (jferran6@xtec.cat)
     * @return	The booking form
     */
    public function formulari_assigna($args) {
        $sid = FormUtil::getPassedValue('sid', isset($args['sid']) ? $args['sid'] : null, 'GET');
        $dow = FormUtil::getPassedValue('dow', isset($args['dow']) ? $args['dow'] : 0, 'GET');
        $fh = FormUtil::getPassedValue('fh', isset($args['fh']) ? $args['fh'] : 0, 'GET');
        $sot = FormUtil::getPassedValue('sot', isset($args['sot']) ? $args['sot'] : 0, 'GET'); // sot = 1 shows form over books table
        $bookingDate = FormUtil::getPassedValue('d', isset($args['d']) ? $args['d'] : null, 'GET');

        $currentDate = date('Y-m-d', strtotime($args['cdate']));

        // Security check
        if (!SecurityUtil::checkPermission('IWbookings::', "::", ACCESS_ADD)) {
            throw new Zikula_Exception_Forbidden();
        }

        $espai = ModUtil::apiFunc('IWbookings', 'user', 'get', array('sid' => $sid));

        if ($espai['mdid'] != 0) {
            //Busquem les franges hor�ries i les tornem en forma de matriu per un MultiSelect
            $franges = ModUtil::apiFunc('IWbookings', 'user', 'getall_hores_MS', array('mdid' => $espai['mdid']));
            $period = $franges[$fh]['id'];
        }

        //$period = (isset($period) && $period >= 0) ? $franges[$fh]['id'] : null;
        //echo "<pre>"; var_dump($franges); echo "</pre>";
        //Construim l'array dels dies per el formulari
        (ModUtil::getVar('IWbookings', 'weekends')) ?
                        $dia = array(array('id' => '1', 'name' => $this->__('Monday')),
                    array('id' => '2', 'name' => $this->__('Tuesday')),
                    array('id' => '3', 'name' => $this->__('Wednesday')),
                    array('id' => '4', 'name' => $this->__('Thursday')),
                    array('id' => '5', 'name' => $this->__('Friday')),
                    array('id' => '6', 'name' => $this->__('Saturday')),
                    array('id' => '7', 'name' => $this->__('Sunday'))) :
                        $dia = array(array('id' => '1', 'name' => $this->__('Monday')),
                    array('id' => '2', 'name' => $this->__('Tuesday')),
                    array('id' => '3', 'name' => $this->__('Wednesday')),
                    array('id' => '4', 'name' => $this->__('Thursday')),
                    array('id' => '5', 'name' => $this->__('Friday')));

        $week = ModUtil::apiFunc('IWbookings', 'user', 'getWeek', array('date' => $currentDate,
                    'format' => 'ymd'));
        $startDate = $week['start'];
        $fields = explode('-', $startDate);
        $dies_dates = array();

        if ($currentDate == DateUtil::getDateTime('', "%Y-%m-%d")) {
            $j = date("w", DateUtil::makeTimestamp($currentDate));
            ($j == 0) ? $j = 7 : "";
        } else {
            $j = 1;
        }

        for ($i = $j; $i <= count($dia); ++$i) {
            $dies_dates[$i - $j] = DateUtil::buildDatetime($fields[0], $fields[1], $fields[2] + $i - 1, 0, 0, 0, '%d-%m-%Y');
        }

        $showDays = array();
        for ($i = $j; $i <= (count($dia)); ++$i) {
            $showDays[$i - $j] = array('id' => $dia[$i - 1]['id'],
                'name' => $dia[$i - 1]['name']);
        }

        $hora = array(array('id' => '0', 'name' => '08'),
            array('id' => '1', 'name' => '09'),
            array('id' => '2', 'name' => '10'),
            array('id' => '3', 'name' => '11'),
            array('id' => '4', 'name' => '12'),
            array('id' => '5', 'name' => '13'),
            array('id' => '6', 'name' => '14'),
            array('id' => '7', 'name' => '15'),
            array('id' => '8', 'name' => '16'),
            array('id' => '9', 'name' => '17'),
            array('id' => '10', 'name' => '18'),
            array('id' => '11', 'name' => '19'),
            array('id' => '12', 'name' => '20'),
            array('id' => '13', 'name' => '21'),
            array('id' => '14', 'name' => '22'));

        $minut = array(array('id' => '0', 'name' => '00'),
            array('id' => '1', 'name' => '05'),
            array('id' => '2', 'name' => '10'),
            array('id' => '3', 'name' => '15'),
            array('id' => '4', 'name' => '20'),
            array('id' => '5', 'name' => '25'),
            array('id' => '6', 'name' => '30'),
            array('id' => '7', 'name' => '35'),
            array('id' => '8', 'name' => '40'),
            array('id' => '9', 'name' => '45'),
            array('id' => '10', 'name' => '50'),
            array('id' => '11', 'name' => '55'));

        // If the user is admin can make books in name of other users
        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
        $professorat = '';
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:User.php


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