本文整理汇总了PHP中DateUtil::getDatetime_NextDay方法的典型用法代码示例。如果您正苦于以下问题:PHP DateUtil::getDatetime_NextDay方法的具体用法?PHP DateUtil::getDatetime_NextDay怎么用?PHP DateUtil::getDatetime_NextDay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateUtil
的用法示例。
在下文中一共展示了DateUtil::getDatetime_NextDay方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* display block
*
* @param array $blockinfo a blockinfo structure
* @return output the rendered bock
*/
public function display($blockinfo)
{
// Security check
if (!SecurityUtil::checkPermission('EZComments:EZCommentsblock:', "{$blockinfo['bid']}::", ACCESS_READ)) {
return false;
}
if (!ModUtil::load('EZComments')) {
return false;
}
// Get variables from content block
$vars = BlockUtil::varsFromContent($blockinfo['content']);
// Defaults
if (!isset($vars['numentries'])) {
$vars['numentries'] = 5;
}
if (!isset($vars['numdays'])) {
$vars['numdays'] = 0;
}
if (!isset($vars['showdate'])) {
$vars['showdate'] = 0;
}
if (!isset($vars['showusername'])) {
$vars['showusername'] = 0;
}
if (!isset($vars['linkusername'])) {
$vars['linkusername'] = 0;
}
$options = array('numitems' => $vars['numentries']);
if (isset($vars['mod']) && $vars['mod'] != '*') {
$options['mod'] = $vars['mod'];
}
if (!isset($vars['showpending']) || $vars['showpending'] == 0) {
// don't show pending comments
$options['status'] = 0;
}
// filter comments posted in last number of days
if ($vars['numdays'] > 0) {
// date for filtering in format: yyyy-mm-dd hh:mm:ss
$options['addwhere'] = "date>='" . DateUtil::getDatetime_NextDay(-$vars['numdays']) . "'";
}
// get the comments
$items = ModUtil::apiFunc('EZComments', 'user', 'getall', $options);
// augment the info
$comments = ModUtil::apiFunc('EZComments', 'user', 'prepareCommentsForDisplay', $items);
$this->view->assign($vars);
$this->view->assign('comments', $comments);
// Populate block info and pass to theme
$blockinfo['content'] = $this->view->fetch('ezcomments_block_ezcomments.tpl');
return BlockUtil::themesideblock($blockinfo);
}
示例2: display
/**
* Display the data to the containing Content page
*/
public function display()
{
// Parameters for category related items properties like topicimage
$lang = ZLanguage::getLanguageCode();
$topicProperty = ModUtil::getVar('News', 'topicproperty');
$topicField = empty($topicProperty) ? 'Main' : $topicProperty;
// work out the parameters for the News api call
$apiargs = array();
switch ($this->show)
{
case 3: // non index page articles
$apiargs['displayonindex'] = 0;
break;
case 2: // index page articles
$apiargs['displayonindex'] = 1;
break;
// all - doesn't need displayonindex
}
$apiargs['numitems'] = $this->limit; // Nr of articles to obtain
$apiargs['status'] = (int) $this->status; // Published status
// Handle the sorting order
switch ($this->orderoptions)
{
case 2:
$apiargs['order'] = 'weight';
break;
case 3:
$apiargs['order'] = 'random';
break;
case 1:
$apiargs['order'] = 'counter';
break;
case 0:
default:
// Use News module setting, so don't set apiargs[order]
}
$enablecategorization = ModUtil::getVar('News', 'enablecategorization');
// Make a category filter only if categorization is enabled in News module
if ($enablecategorization && $this->categories != null) {
// Get the registrered categories for the News module
$catregistry = CategoryRegistryUtil::getRegisteredModuleCategories('News', 'news');
$apiargs['catregistry'] = $catregistry;
$apiargs['category'] = $this->categories;
}
// Limit the shown articles in days using DateUtil
if ((int) $this->dayslimit > 0 && $vars['order'] == 0) {
$apiargs['from'] = DateUtil::getDatetime_NextDay(-$this->dayslimit);
$apiargs['to'] = DateUtil::getDatetime();
}
// Apply datefiltering
$apiargs['filterbydate'] = true;
// call the News api and get the requested articles with the above arguments
$items = ModUtil::apiFunc('News', 'user', 'getall', $apiargs);
// UserUtil is not automatically loaded, so load it now if needed and set anonymous
if ($this->dispuname) {
$anonymous = System::getVar('anonymous');
}
// check for an empty return
if (!empty($items)) {
// loop through the items and prepare for display
foreach (array_keys($items) as $k)
{
// Get specific information from the article. It was a choice not to use the pnuserapi functions
// GetArticleInfo, GetArticleLinks and getArticlesPreformat because of speed etc.
// --- Check for Topic related properties like topicimage, topicsearchurl etc.
if ($enablecategorization && !empty($items[$k]['__CATEGORIES__']) && isset($items[$k]['__CATEGORIES__'][$topicField])) {
$items[$k]['topicid'] = $items[$k]['__CATEGORIES__'][$topicField]['id'];
$items[$k]['topicname'] = isset($items[$k]['__CATEGORIES__'][$topicField]['display_name'][$lang]) ? $items[$k]['__CATEGORIES__'][$topicField]['display_name'][$lang] : $items[$k]['__CATEGORIES__'][$topicField]['name'];
// set the topic image if topic_image category property exists
$items[$k]['topicimage'] = (isset($items[$k]['__CATEGORIES__'][$topicField]['__ATTRIBUTES__']) && isset($items[$k]['__CATEGORIES__'][$topicField]['__ATTRIBUTES__']['topic_image'])) ? $items[$k]['__CATEGORIES__'][$topicField]['__ATTRIBUTES__']['topic_image'] : '';
// set the topic description if exists
$items[$k]['topictext'] = isset($items[$k]['__CATEGORIES__'][$topicField]['display_desc'][$lang]) ? $items[$k]['__CATEGORIES__'][$topicField]['display_desc'][$lang] : '';
// set the path of the topic
$items[$k]['topicpath'] = isset($items[$k]['__CATEGORIES__'][$topicField]['path_relative']) ? $items[$k]['__CATEGORIES__'][$topicField]['path_relative'] : '';
// set the url to search for this topic
if (System::getVar('shorturls', false)) {
$items[$k]['topicsearchurl'] = DataUtil::formatForDisplay(ModUtil::url('News', 'user', 'view', array('prop' => $topicField, 'cat' => $items[$k]['topicpath'])));
} else {
$items[$k]['topicsearchurl'] = DataUtil::formatForDisplay(ModUtil::url('News', 'user', 'view', array('prop' => $topicField, 'cat' => $items[$k]['topicid'])));
}
} else {
$items[$k]['topicid'] = null;
$items[$k]['topicname'] = '';
$items[$k]['topicimage'] = '';
$items[$k]['topictext'] = '';
$items[$k]['topicpath'] = '';
$items[$k]['topicsearchurl'] = '';
}
//.........这里部分代码省略.........
示例3: taula
/**
* Get bookings depending on date periods
* @author Albert Pérez Monfort (aperezm@xtec.cat)
* @author Josep Ferràndiz Farré (jferran6@xtec.cat)
* @return List or table with the bookings
*/
public function taula($args) {
// Security check
if (!SecurityUtil::checkPermission('IWbookings::', "::", ACCESS_READ)) {
throw new Zikula_Exception_Forbidden();
}
$sid = FormUtil::getPassedValue('sid', isset($args['sid']) ? $args['sid'] : null, 'GETPOST');
$mensual = FormUtil::getPassedValue('mensual', isset($args['mensual']) ? $args['mensual'] : null, 'GET');
$currentDate = FormUtil::getPassedValue('currentDate', isset($args['currentDate']) ? $args['currentDate'] : null, 'GET');
$canbook = FormUtil::getPassedValue('canbook', isset($args['canbook']) ? $args['canbook'] : false, 'GET');
//Array amb els noms dels dies de la setmana
$dies = array($this->__('Monday'),
$this->__('Tuesday'),
$this->__('Wednesday'),
$this->__('Thursday'),
$this->__('Friday'),
$this->__('Saturday'),
$this->__('Sunday'));
//D'entrada farem que les taules es mostrin de forma horitzontal. Despr�s, si
//hi ha un marc horari definit canviarem al que correspongui
$vertical = 0;
//(ModUtil::getVar('IWbookings', 'eraseold')==1)?
//$actualitza=ModUtil::apiFunc('IWbookings','user','esborra_antigues', array('sid'=> $sid, 'mensual'=> $mensual)):"";
// Get space info
$espai = ModUtil::apiFunc('IWbookings', 'user', 'get', array('sid' => $sid));
//Per si falla la c�rrega de les dades
if ($espai == false) {
return LogUtil::registerError($this->__('The room or equipment was not found'));
}
$nom_espai = $espai['space_name'];
//Comprovem si la taula est� lligada a un marc horari i si aquest marc horari
//no ha estat esborrat
if ($espai['mdid'] != 0) {
//Busquem les franges hor�ries
$franges = ModUtil::apiFunc('IWbookings', 'user', 'getall_hores', array('mdid' => $espai['mdid']));
if (!empty($franges)) {
$vertical = $espai['vertical'];
}
}
// Obtenim la data inicial i final de la setmana seleccionada
$week = ModUtil::apiFunc('IWbookings', 'user', 'getWeek', array('date' => $currentDate,
'format' => 'ymd'));
$startDate = $week['start'];
$endDate = $week['end'];
//Generem la taula amb el format corresponent
if ($vertical != 1) {
//Taula en format horitzontal
$taula = array();
$d = 0;
$fields1 = explode('-', $startDate);
$i = 0;
foreach ($dies as $dia) {
$i++;
$today = DateUtil::getDatetime_NextDay(($i - 1), '%Y-%m-%d', $fields1[0], // Year
$fields1[1], // Month
$fields1[2]); // Day;
$tomorrow = DateUtil::getDatetime_NextDay(($i), '%Y-%m-%d %H:%M:%S', $fields1[0], // Year
$fields1[1], // Month
$fields1[2], 23, 59, 59); // Day;
$reserves = ModUtil::apiFunc('IWbookings', 'user', 'getall_reserves', array('sid' => $sid,
'from' => $today,
'to' => $tomorrow));
$registres = array();
//Afegim les reserves temporals a la matriu registres fent la correcci� de la data
foreach ($reserves as $reserva) {
//Mirem que coincideixi el dia de la setmana
if ($reserva['dayofweek'] == $i) {
if (($reserva['usuari'] == UserUtil::getVar('uid'))
or (SecurityUtil::checkPermission('IWbookings::', "::", ACCESS_ADMIN))) {
$candelete = true;
} else {
$candelete = false;
}
$registres[] = array('inici' => $reserva['inici'],
'final' => $reserva['final'],
'bid' => $reserva['bid'],
'usuari' => $reserva['usuari'],
'dow' => $dies[$i - 1],
'grup' => $reserva['grup'],
'motiu' => $reserva['motiu'],
'candelete' => $candelete,
'temp' => $reserva['temp']);
}
}
if (!empty($registres)) {
//.........这里部分代码省略.........
示例4: display
//.........这里部分代码省略.........
if (!isset($vars['scrolldelay'])) {
$vars['scrolldelay'] = 3000;
}
if (!isset($vars['scrollmspeed'])) {
$vars['scrollmspeed'] = 2;
}
$scrollfilterduration = 1.0;
// --- Work out the parameters for the News api call, fill the apiargs array with the necessary fields
$apiargs = array();
switch ($vars['show'])
{
case 3: // non index page articles
$apiargs['displayonindex'] = 0;
break;
case 2: // index page articles
$apiargs['displayonindex'] = 1;
break;
// all - doesn't need displayonindex
}
$apiargs['numitems'] = $vars['limit']; // Nr of articles to obtain
$apiargs['status'] = $vars['status']; // Published status
// Make a category filter only if categorization is enabled in News module
if ($enablecategorization) {
// Get the registrered categories for the News module
$catregistry = CategoryRegistryUtil::getRegisteredModuleCategories('News', 'news');
$apiargs['catregistry'] = $catregistry;
$apiargs['category'] = $vars['category'];
}
// Limit the shown articles in days using DateUtil
if ((int)$vars['dayslimit'] > 0 && $vars['order'] == 0) {
$apiargs['from'] = DateUtil::getDatetime_NextDay(-$vars['dayslimit']);
$apiargs['to'] = DateUtil::getDatetime();
}
// Handle the sorting order
switch ($vars['order'])
{
case 2:
$apiargs['order'] = 'weight';
break;
case 3:
$apiargs['order'] = 'random';
break;
case 1:
$apiargs['order'] = 'counter';
break;
case 0:
default:
// Use News module setting, so don't set apiargs[order]
}
// Make sure datefiltering is done. Solves #12
$apiargs['filterbydate'] = true;
// Call the News api and get the requested articles with the above arguments
$items = ModUtil::apiFunc('News', 'user', 'getall', $apiargs);
// check for an empty return
if (empty($items)) {
if ($vars['showemptyresult']) {
// Show empty result message instead of empty block if variable is set
$blockinfo['content'] = $this->__('No articles.');
return BlockUtil::themeBlock($blockinfo);
示例5: getWeek
/**
* Calcula la data inicial de la setmana a la qual pertany una determinada data
* @author Josep Ferr�ndiz Farr� (jferran6@xtec.cat)
* @args The date (a MySQL timestamp or a string)
* @return the start date of the week
*/
public function getWeek($args) {
$TheDate = FormUtil::getPassedValue('date', isset($args['date']) ? $args['date'] : null, 'GET');
$format = FormUtil::getPassedValue('format', isset($args['format']) ? $args['format'] : null, 'GET');
$week = array();
if (!SecurityUtil::checkPermission('IWbookings::', '::', ACCESS_READ)) {
return $week;
}
$avui = DateUtil::makeTimestamp($TheDate);
$dow = date("w", $avui);
($dow == 0) ? $dow = 7 : ""; // If sunday
$fields = explode('-', $TheDate);
if ($format == 'ymd') {
$week['start'] = DateUtil::getDatetime_NextDay((1 - $dow), '%Y-%m-%d', $fields[0], $fields[1], $fields[2]);
$week['end'] = DateUtil::getDatetime_NextDay((7 - $dow), "%Y-%m-%d %H:%M:%S", $fields[0], $fields[1], $fields[2], 23, 59, 59);
} else {
$week['start'] = DateUtil::getDatetime_NextDay((1 - $dow), '%d-%m-%y', $fields[0], $fields[1], $fields[2]);
$week['end'] = DateUtil::getDatetime_NextDay((7 - $dow), "%d-%m-%y", $fields[0], $fields[1], $fields[2]);
}
return $week;
}