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


PHP Date::floorToMinute方法代码示例

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


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

示例1: findFirstPublishedRootByHostAndLanguage

 /**
  * Find the first published root page by its host name and language
  *
  * @param string $strHost     The host name
  * @param mixed  $varLanguage An ISO language code or an array of ISO language codes
  * @param array  $arrOptions  An optional options array
  *
  * @return static The model or null if there is no matching root page
  */
 public static function findFirstPublishedRootByHostAndLanguage($strHost, $varLanguage, array $arrOptions = array())
 {
     $t = static::$strTable;
     $objDatabase = \Database::getInstance();
     $strWhereFindHostInDns = $objDatabase->findInSet('\'' . $strHost . '\'', "{$t}.dns", true);
     if (is_array($varLanguage)) {
         $arrColumns = array("{$t}.type='root' AND ({$strWhereFindHostInDns} OR {$t}.dns='')");
         if (!empty($varLanguage)) {
             $arrColumns[] = "({$t}.language IN('" . implode("','", $varLanguage) . "') OR {$t}.fallback='1')";
         } else {
             $arrColumns[] = "{$t}.fallback='1'";
         }
         //@todo this needs a rework as it is equal with the parent's code
         if (!isset($arrOptions['order'])) {
             $arrOptions['order'] = "{$t}.dns DESC" . (!empty($varLanguage) ? ", " . $objDatabase->findInSet("{$t}.language", array_reverse($varLanguage)) . " DESC" : "") . ", {$t}.sorting";
         }
         if (!BE_USER_LOGGED_IN) {
             $time = \Date::floorToMinute();
             $arrColumns[] = "({$t}.start='' OR {$t}.start<='{$time}') AND ({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "') AND {$t}.published='1'";
         }
         return static::findOneBy($arrColumns, array(), $arrOptions);
     } else {
         $arrColumns = array("{$t}.type='root' AND ({$strWhereFindHostInDns} OR {$t}.dns='') AND ({$t}.language=? OR {$t}.fallback='1')");
         $arrValues = array($varLanguage);
         //@todo this needs a rework as it is equal with the parent's code
         if (!isset($arrOptions['order'])) {
             $arrOptions['order'] = "{$t}.dns DESC, {$t}.fallback";
         }
         if (!BE_USER_LOGGED_IN) {
             $time = \Date::floorToMinute();
             $arrColumns[] = "({$t}.start='' OR {$t}.start<='{$time}') AND ({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "') AND {$t}.published='1'";
         }
         return static::findOneBy($arrColumns, $arrValues, $arrOptions);
     }
 }
开发者ID:richardhj,项目名称:contao-multidns,代码行数:44,代码来源:PageModel.php

示例2: compile

 protected function compile()
 {
     $time = \Date::floorToMinute();
     $intStart = null;
     $intStop = null;
     // overwrite start from related entity, but only if selected entity period is between
     if ($this->objRelation !== null && $this->objRelation->limitSubmissionPeriod) {
         $intStart = $this->objRelation->submissionStart;
         $intStop = $this->objRelation->submissionStop;
     }
     if ($this->limitSubmissionPeriod) {
         if ($this->submissionStart != '') {
             $intStart = $intStart != '' && $intStart >= $this->submissionStart ? $intStart : $this->submissionStart;
         }
         if ($this->submissionStop != '') {
             $intStop = $intStop != '' && $intStop <= $this->submissionStop ? $intStop : $this->submissionStop;
         }
     }
     $blnInPeriod = false;
     if (($intStart == '' || $intStart <= $time) && ($intStop == '' || $time + 60 <= $intStop)) {
         $blnInPeriod = true;
     }
     // render submission form only within period
     if ($blnInPeriod) {
         return parent::compile();
     }
 }
开发者ID:heimrichhannot,项目名称:contao-submissions_creator,代码行数:27,代码来源:ModuleSubmissionReader.php

示例3: languageFallback

 /**
  * Show a warning if there is no language fallback page
  *
  * @return string
  */
 public function languageFallback()
 {
     $arrRoots = array();
     $time = \Date::floorToMinute();
     $objRoots = $this->Database->execute("SELECT fallback, dns FROM tl_page WHERE type='root' AND (start='' OR start<='{$time}') AND (stop='' OR stop>'" . ($time + 60) . "') AND published='1' ORDER BY dns");
     while ($objRoots->next()) {
         $strDns = $objRoots->dns ?: '*';
         if (isset($arrRoots[$strDns]) && $arrRoots[$strDns] == 1) {
             continue;
         }
         $arrRoots[$strDns] = $objRoots->fallback;
     }
     $arrReturn = array();
     foreach ($arrRoots as $k => $v) {
         if ($v != '') {
             continue;
         }
         if ($k == '*') {
             $arrReturn[] = '<p class="tl_error">' . $GLOBALS['TL_LANG']['ERR']['noFallbackEmpty'] . '</p>';
         } else {
             $arrReturn[] = '<p class="tl_error">' . sprintf($GLOBALS['TL_LANG']['ERR']['noFallbackDns'], $k) . '</p>';
         }
     }
     return implode("\n", $arrReturn);
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:30,代码来源:Messages.php

示例4: findActiveById

 /**
  * Find active user by id
  *
  * @param int   $intId
  * @param array $arrOptions
  *
  * @return \UserModel|\UserModel[]|\Model\Collection|null
  */
 public static function findActiveById($intId, array $arrOptions = array())
 {
     $t = static::$strTable;
     $time = \Date::floorToMinute();
     $arrColumns = array("({$t}.start='' OR {$t}.start<='{$time}') AND ({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "') AND {$t}.disable=''");
     $arrColumns[] = "{$t}.id = ?";
     return static::findOneBy($arrColumns, $intId, $arrOptions);
 }
开发者ID:heimrichhannot,项目名称:contao-haste_plus,代码行数:16,代码来源:UserModel.php

示例5: getSearchablePages

 /**
  * Add FAQs to the indexer
  *
  * @param array   $arrPages
  * @param integer $intRoot
  * @param boolean $blnIsSitemap
  *
  * @return array
  */
 public function getSearchablePages($arrPages, $intRoot = 0, $blnIsSitemap = false)
 {
     $arrRoot = array();
     if ($intRoot > 0) {
         $arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
     }
     $arrProcessed = array();
     $time = \Date::floorToMinute();
     // Get all categories
     $objFaq = \FaqCategoryModel::findAll();
     // Walk through each category
     if ($objFaq !== null) {
         while ($objFaq->next()) {
             // Skip FAQs without target page
             if (!$objFaq->jumpTo) {
                 continue;
             }
             // Skip FAQs outside the root nodes
             if (!empty($arrRoot) && !in_array($objFaq->jumpTo, $arrRoot)) {
                 continue;
             }
             // Get the URL of the jumpTo page
             if (!isset($arrProcessed[$objFaq->jumpTo])) {
                 $objParent = \PageModel::findWithDetails($objFaq->jumpTo);
                 // The target page does not exist
                 if ($objParent === null) {
                     continue;
                 }
                 // The target page has not been published (see #5520)
                 if (!$objParent->published || $objParent->start != '' && $objParent->start > $time || $objParent->stop != '' && $objParent->stop <= $time + 60) {
                     continue;
                 }
                 if ($blnIsSitemap) {
                     // The target page is protected (see #8416)
                     if ($objParent->protected) {
                         continue;
                     }
                     // The target page is exempt from the sitemap (see #6418)
                     if ($objParent->sitemap == 'map_never') {
                         continue;
                     }
                 }
                 // Generate the URL
                 $arrProcessed[$objFaq->jumpTo] = $objParent->getAbsoluteUrl(\Config::get('useAutoItem') ? '/%s' : '/items/%s');
             }
             $strUrl = $arrProcessed[$objFaq->jumpTo];
             // Get the items
             $objItems = \FaqModel::findPublishedByPid($objFaq->id);
             if ($objItems !== null) {
                 while ($objItems->next()) {
                     $arrPages[] = sprintf($strUrl, $objItems->alias ?: $objItems->id);
                 }
             }
         }
     }
     return $arrPages;
 }
开发者ID:contao,项目名称:faq-bundle,代码行数:66,代码来源:ModuleFaq.php

示例6: findByPublished

 public static function findByPublished(array $arrOptions = array())
 {
     $t = static::$strTable;
     if (!BE_USER_LOGGED_IN) {
         $time = \Date::floorToMinute();
         $arrColumns[] = "({$t}.start='' OR {$t}.start<='{$time}') AND ({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "') AND {$t}.published='1'";
     }
     return static::findBy($arrColumns, array(), $arrOptions);
 }
开发者ID:heimrichhannot,项目名称:contao-filecredits,代码行数:9,代码来源:FileCreditModel.php

示例7: findPublishedByPids

 public static function findPublishedByPids(array $arrPids, array $arrOptions = array())
 {
     $t = static::$strTable;
     $arrColumns = array("{$t}.pid IN(" . implode(',', array_map('intval', $arrPids)) . ")");
     if (!BE_USER_LOGGED_IN) {
         $time = \Date::floorToMinute();
         $arrColumns[] = "({$t}.start='' OR {$t}.start<='{$time}') AND ({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "') AND {$t}.published='1'";
     }
     return static::findBy($arrColumns, array(), $arrOptions);
 }
开发者ID:heimrichhannot,项目名称:contao-filecredits,代码行数:10,代码来源:FileCreditPageModel.php

示例8: addIcon

 /**
  * Add an image to each record
  *
  * @param array  $row
  * @param string $label
  *
  * @return string
  */
 public function addIcon($row, $label)
 {
     $image = 'mgroup';
     $time = \Date::floorToMinute();
     $disabled = $row['start'] !== '' && $row['start'] > $time || $row['stop'] !== '' && $row['stop'] < $time;
     if ($row['disable'] || $disabled) {
         $image .= '_';
     }
     return sprintf('<div class="list_icon" style="background-image:url(\'%ssystem/themes/%s/icons/%s.svg\')" data-icon="%s.svg" data-icon-disabled="%s.svg">%s</div>', TL_ASSETS_URL, Backend::getTheme(), $image, $disabled ? $image : rtrim($image, '_'), rtrim($image, '_') . '_', $label);
 }
开发者ID:contao,项目名称:core-bundle,代码行数:18,代码来源:tl_member_group.php

示例9: findByPidForPublishedPages

 /**
  * Find categories by product id if the respective page is published
  *
  * @param int   $intProduct
  * @param array $arrOptions
  *
  * @return \Model\Collection|null
  */
 public static function findByPidForPublishedPages($intProduct, array $arrOptions = array())
 {
     $arrOptions['eager'] = true;
     $arrOptions['having'] = "page_id__type!='error_403' AND page_id__type!='error_404'";
     if (!BE_USER_LOGGED_IN) {
         $time = \Date::floorToMinute();
         $arrOptions['having'] .= " AND (page_id__start='' OR page_id__start<'{$time}') AND (page_id__stop='' OR page_id__stop>'" . ($time + 60) . "') AND page_id__published='1'";
     }
     return parent::findBy('pid', $intProduct, $arrOptions);
 }
开发者ID:bytehead,项目名称:core,代码行数:18,代码来源:ProductCategory.php

示例10: findPublishedArticle

 /**
  * Find a published article with additional conditions.
  *
  * @param array $columns
  * @param array $values
  * @param array $options
  *
  * @return \ArticleModel|null
  */
 private function findPublishedArticle(array $columns, array $values = array(), array $options = array())
 {
     if (true !== BE_USER_LOGGED_IN) {
         $time = \Date::floorToMinute();
         $columns[] = "(tl_article.start='' OR tl_article.start<='{$time}')";
         $columns[] = "(tl_article.stop='' OR tl_article.stop>'" . ($time + 60) . "')";
         $columns[] = "tl_article.published='1'";
     }
     return ArticleModel::findOneBy($columns, $values, $options);
 }
开发者ID:terminal42,项目名称:contao-changelanguage,代码行数:19,代码来源:ArticleNavigationListener.php

示例11: findPublishedByIdOrAlias

 /**
  * Find published modal items by their ID or alias
  *
  * @param mixed $varId      The numeric ID or alias name
  * @param array $arrOptions An optional options array
  *
  * @return static The ModalModel or null if there are no modals
  */
 public static function findPublishedByIdOrAlias($varId, array $arrOptions = array())
 {
     $t = static::$strTable;
     $arrColumns = array("({$t}.id=? OR {$t}.alias=?)");
     if (!BE_USER_LOGGED_IN) {
         $time = \Date::floorToMinute();
         $arrColumns[] = "({$t}.start='' OR {$t}.start<='{$time}') AND ({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "') AND {$t}.published='1'";
     }
     return static::findBy($arrColumns, array(is_numeric($varId) ? $varId : 0, $varId), $arrOptions);
 }
开发者ID:heimrichhannot,项目名称:contao-modal,代码行数:18,代码来源:ModalModel.php

示例12: getSearchablePages

 /**
  * Add FAQs to the indexer
  *
  * @param array   $arrPages
  * @param integer $intRoot
  * @param boolean $blnIsSitemap
  *
  * @return array
  */
 public function getSearchablePages($arrPages, $intRoot = 0, $blnIsSitemap = false)
 {
     $arrRoot = array();
     if ($intRoot > 0) {
         $arrRoot = $this->Database->getChildRecords($intRoot, 'tl_page');
     }
     $arrProcessed = array();
     $time = \Date::floorToMinute();
     // Get all categories
     $objFaq = \FaqCategoryModel::findAll();
     // Walk through each category
     if ($objFaq !== null) {
         while ($objFaq->next()) {
             // Skip FAQs without target page
             if (!$objFaq->jumpTo) {
                 continue;
             }
             // Skip FAQs outside the root nodes
             if (!empty($arrRoot) && !in_array($objFaq->jumpTo, $arrRoot)) {
                 continue;
             }
             // Get the URL of the jumpTo page
             if (!isset($arrProcessed[$objFaq->jumpTo])) {
                 $objParent = \PageModel::findWithDetails($objFaq->jumpTo);
                 // The target page does not exist
                 if ($objParent === null) {
                     continue;
                 }
                 // The target page has not been published (see #5520)
                 if (!$objParent->published || $objParent->start != '' && $objParent->start > $time || $objParent->stop != '' && $objParent->stop <= $time + 60) {
                     continue;
                 }
                 // The target page is exempt from the sitemap (see #6418)
                 if ($blnIsSitemap && $objParent->sitemap == 'map_never') {
                     continue;
                 }
                 // Generate the URL
                 $feUrl = $objParent->getFrontendUrl(\Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/%s' : '/items/%s');
                 if (strncmp($feUrl, 'http://', 7) !== 0 && strncmp($feUrl, 'https://', 8) !== 0) {
                     $feUrl = ($objParent->rootUseSSL ? 'https://' : 'http://') . ($objParent->domain ?: \Environment::get('host')) . TL_PATH . '/' . $feUrl;
                 }
                 $arrProcessed[$objFaq->jumpTo] = $feUrl;
             }
             $strUrl = $arrProcessed[$objFaq->jumpTo];
             // Get the items
             $objItems = \FaqModel::findPublishedByPid($objFaq->id);
             if ($objItems !== null) {
                 while ($objItems->next()) {
                     $arrPages[] = sprintf($strUrl, $objItems->alias != '' && !\Config::get('disableAlias') ? $objItems->alias : $objItems->id);
                 }
             }
         }
     }
     return $arrPages;
 }
开发者ID:bytehead,项目名称:contao-core,代码行数:64,代码来源:ModuleFaq.php

示例13: getFindByPidForPublishedPagesOptions

 /**
  * Gets the options for the query for the "findByPidForPublishedPages" method.
  *
  * @param       $intProduct
  * @param array $arrOptions
  *
  * @return array
  */
 public static function getFindByPidForPublishedPagesOptions($intProduct, array $arrOptions = array())
 {
     $t = static::getTable();
     $having = "page_id__type!='error_403' AND page_id__type!='error_404'";
     if (!BE_USER_LOGGED_IN) {
         $time = \Date::floorToMinute();
         $having .= " AND (page_id__start='' OR page_id__start<'{$time}') AND (page_id__stop='' OR page_id__stop>'" . ($time + 60) . "') AND page_id__published='1'";
     }
     $arrOptions = array_merge(array('column' => array("{$t}.pid=?"), 'value' => array($intProduct), 'eager' => true, 'having' => $having, 'return' => 'Collection'), $arrOptions);
     return $arrOptions;
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:19,代码来源:ProductCategory.php

示例14: findAllPublishedLinkedWithModal

 /**
  * Find pages linked with modal
  *
  * @param array $arrOptions An optional options array
  *
  * @return \Model\Collection|\PageModel[]|\PageModel|null A collection of models or null if there is no matching pages
  */
 public static function findAllPublishedLinkedWithModal(array $arrOptions = array())
 {
     $t = static::$strTable;
     $arrColumns = array("{$t}.linkModal = 1 AND {$t}.modal > 0");
     // Check the publication status (see #4652)
     if (!BE_USER_LOGGED_IN) {
         $time = \Date::floorToMinute();
         $arrColumns[] = "({$t}.start='' OR {$t}.start<='{$time}') AND ({$t}.stop='' OR {$t}.stop>'" . ($time + 60) . "') AND {$t}.published='1'";
     }
     return static::findBy($arrColumns, null, $arrOptions);
 }
开发者ID:heimrichhannot,项目名称:contao-modal,代码行数:18,代码来源:PageModel.php

示例15: addIcon

 /**
  * Add an image to each record
  *
  * @param array         $row
  * @param string        $label
  * @param DataContainer $dc
  * @param array         $args
  *
  * @return string
  */
 public function addIcon($row, $label, DataContainer $dc, $args)
 {
     $image = $row['admin'] ? 'admin' : 'user';
     $time = \Date::floorToMinute();
     $disabled = $row['start'] !== '' && $row['start'] > $time || $row['stop'] !== '' && $row['stop'] < $time;
     if ($row['disable'] || $disabled) {
         $image .= '_';
     }
     $args[0] = sprintf('<div class="list_icon_new" style="background-image:url(\'%ssystem/themes/%s/images/%s.gif\')" data-icon="%s.gif" data-icon-disabled="%s.gif">&nbsp;</div>', TL_ASSETS_URL, Backend::getTheme(), $image, $disabled ? $image : rtrim($image, '_'), rtrim($image, '_') . '_');
     return $args;
 }
开发者ID:eknoes,项目名称:core,代码行数:21,代码来源:tl_user.php


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