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


PHP TikiLib::date_format方法代码示例

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


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

示例1: emailBody

 public function emailBody($user_data, $report_preferences, $report_cache)
 {
     global $prefs;
     include_once 'lib/smarty_tiki/modifier.username.php';
     if (isset($report_cache[0])) {
         $base_url = $report_cache[0]['data']['base_url'];
     } else {
         $base_url = "http://" . $prefs['cookie_domain'] . "/";
         // TODO: better handling for https and such
     }
     $smarty = TikiLib::lib('smarty');
     $smarty->assign('report_preferences', $report_preferences);
     $smarty->assign('report_user', ucfirst(smarty_modifier_username($user_data['login'])));
     $smarty->assign('report_interval', ucfirst($report_preferences['interval']));
     $smarty->assign('report_date', date("l d.m.Y"));
     $smarty->assign('report_site', $this->tikilib->get_preference('browsertitle'));
     if ($report_preferences['last_report'] != '0000-00-00 00:00:00') {
         $smarty->assign('report_last_report_date', TikiLib::date_format($this->tikilib->get_preference('long_date_format'), strtotime($report_preferences['last_report'])));
     }
     $smarty->assign('report_total_changes', count($report_cache));
     $smarty->assign('report_body', $this->makeEmailBody($report_cache, $report_preferences));
     $userWatchesUrl = $base_url . 'tiki-user_watches.php';
     if ($report_preferences['type'] == 'html') {
         $userWatchesUrl = "<a href=\"{$userWatchesUrl}\">{$userWatchesUrl}</a>";
     }
     $smarty->assign('userWatchesUrl', $userWatchesUrl);
     $mail_data = $smarty->fetch("mail/report.tpl");
     return $mail_data;
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:29,代码来源:EmailBuilder.php

示例2: wikiplugin_bloglist

function wikiplugin_bloglist($data, $params)
{
    global $tikilib;
    extract($params, EXTR_SKIP);
    if (!isset($Id)) {
        $text = "<b>missing blog Id for BLOGLIST plugins</b><br />";
        $text .= wikiplugin_bloglist_help();
        return $text;
    }
    //	if (!isset($Field)) {
    //		$Field = 'heading';
    //	}
    $text = "<div class=\"blogtools\"><table><tr><th>" . tra("Date") . "</th><th>" . tra("Title") . "</th><th>" . tra("Author") . "</th></tr>\n";
    $query = "select `postId`, `title`, `user`, `created`  from `tiki_blog_posts` where `blogId`=? order by `created` desc";
    $result = $tikilib->query($query, array($Id));
    $i = 0;
    while (($res = $result->fetchRow()) && $i < $Items) {
        $text .= "<tr><td>" . TikiLib::date_format("%d/%M/%Y %H:%M", $res["created"]) . "</td>";
        $text .= "<td><a href=\"tiki-view_blog_post.php?blogId=" . $Id . "&postId=" . $res["postId"] . "\">" . $res["title"] . "</a></td>";
        $text .= "<td>" . $res["user"] . "</td></tr>\n";
        $i++;
    }
    $text .= "</table></div>\n";
    return $text;
}
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:25,代码来源:wikiplugin_bloglist.php

示例3: testNext

 function testNext()
 {
     $calendarlib = TikiLib::lib('calendar');
     $date = TikiLib::make_time(0, 0, 0, 8, 31, 2010);
     $previous = $calendarlib->focusNext($calendarlib->infoDate($date), 'month');
     $this->assertEquals('2010-09-30', TikiLib::date_format('%Y-%m-%d', $previous['date']));
 }
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:7,代码来源:DateTest.php

示例4: setSubject

 protected function setSubject($reportCache)
 {
     $subject = tr('Report on %0 from %1 ', $this->tikiPrefs['browsertitle'], TikiLib::date_format($this->tikiPrefs['short_date_format'], $this->dt->format('U')));
     if (!is_array($reportCache)) {
         $subject .= tr('(no changes)');
     } elseif (count($reportCache) == 1) {
         $subject .= tr('(1 change)');
     } else {
         $subject .= tr('(%0 changes)', count($reportCache));
     }
     $this->mail->setSubject($subject);
 }
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:12,代码来源:Send.php

示例5: smarty_modifier_tiki_short_date

function smarty_modifier_tiki_short_date($string)
{
    global $prefs;
    $smarty = TikiLib::lib('smarty');
    $smarty->loadPlugin('smarty_modifier_tiki_date_format');
    $date = smarty_modifier_tiki_date_format($string, $prefs['short_date_format']);
    if ($prefs['jquery_timeago'] === 'y') {
        TikiLib::lib('header')->add_jq_onready('$("time.timeago").timeago();');
        return '<time class="timeago" datetime="' . TikiLib::date_format('c', $string, false, 5, false) . '">' . $date . '</time>';
    } else {
        return $date;
    }
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:13,代码来源:modifier.tiki_short_date.php

示例6: setSubject

 protected function setSubject($reportCache)
 {
     if (is_array($reportCache) && count($reportCache) >= 1) {
         if (count($reportCache) == 1) {
             $subject = tr('Report from %0 (1 change)', TikiLib::date_format($this->tikiPrefs['short_date_format'], $this->dt->format('U')));
         } else {
             $subject = tr('Report from %0 (%1 changes)', TikiLib::date_format($this->tikiPrefs['short_date_format'], $this->dt->format('U')), count($reportCache));
         }
     } else {
         $subject = tr('Report from %0 (no changes)', TikiLib::date_format($this->tikiPrefs['short_date_format'], $this->dt->format('U')));
     }
     $this->mail->setSubject($subject);
 }
开发者ID:railfuture,项目名称:tiki-website,代码行数:13,代码来源:Send.php

示例7: wikiplugin_now

function wikiplugin_now($data, $params)
{
    global $prefs;
    $default = TikiLib::date_format($prefs['long_date_format'] . ' ' . $prefs['long_time_format']);
    if (!empty($params['format'])) {
        $ret = TikiLib::date_format($params['format']);
        //see if the user format setting results in a valid date, return default format if not
        try {
            $dateObj = new DateTime($ret);
        } catch (Exception $e) {
            return $default;
        }
        return $ret;
    } else {
        return $default;
    }
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:17,代码来源:wikiplugin_now.php

示例8: emailBody

 public function emailBody($user_data, $report_preferences, $report_cache)
 {
     $base_url = $report_cache[0]['data']['base_url'];
     $smarty = TikiLib::lib('smarty');
     $smarty->assign('report_preferences', $report_preferences);
     $smarty->assign('report_user', ucfirst($user_data['login']));
     $smarty->assign('report_interval', ucfirst($report_preferences['interval']));
     $smarty->assign('report_date', date("l d.m.Y"));
     if ($report_preferences['last_report'] != '0000-00-00 00:00:00') {
         $smarty->assign('report_last_report_date', TikiLib::date_format($this->tikilib->get_preference('long_date_format'), strtotime($report_preferences['last_report'])));
     }
     $smarty->assign('report_total_changes', count($report_cache));
     $smarty->assign('report_body', $this->makeEmailBody($report_cache, $report_preferences));
     $userWatchesUrl = $base_url . 'tiki-user_watches.php';
     if ($report_preferences['type'] == 'html') {
         $userWatchesUrl = "<a href=\"{$userWatchesUrl}\">{$userWatchesUrl}</a>";
     }
     $smarty->assign('userWatchesUrl', $userWatchesUrl);
     $mail_data = $smarty->fetch("mail/report.tpl");
     return $mail_data;
 }
开发者ID:hurcane,项目名称:tiki-azure,代码行数:21,代码来源:EmailBuilder.php

示例9: smarty_modifier_tiki_short_datetime

function smarty_modifier_tiki_short_datetime($string, $intro = '', $same = 'y')
{
    global $prefs;
    $smarty = TikiLib::lib('smarty');
    $smarty->loadPlugin('smarty_modifier_tiki_date_format');
    $date = smarty_modifier_tiki_date_format($string, $prefs['short_date_format']);
    $time = smarty_modifier_tiki_date_format($string, $prefs['short_time_format']);
    $intro = !empty($intro) ?: tra($intro) . ' ';
    if ($prefs['jquery_timeago'] === 'y' && $same === 'y') {
        TikiLib::lib('header')->add_jq_onready('$("time.timeago").timeago();');
        return '<time class="timeago" datetime="' . TikiLib::date_format('c', $string, false, 5, false) . '">' . $date . ' ' . $time . '</time>';
    } else {
        if ($same != 'n' && $prefs['tiki_same_day_time_only'] == 'y' && $date == smarty_modifier_tiki_date_format(time(), $prefs['short_date_format'])) {
            //tra('on') tra('on:') tra('at') tra('at:')
            return str_replace(array('on', 'On'), array('at', 'At'), $intro) . $time;
        } else {
            // if you change the separator do not forget to change the translation instruction in lib/prefs/short.php
            $time = $date . ' ' . $time;
            return $intro . ' ' . $time;
        }
    }
}
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:22,代码来源:modifier.tiki_short_datetime.php

示例10: list_tiki_items

 /**
  * @param $tikiobj
  * @param $user
  * @param $tstart
  * @param $tstop
  * @param $offset
  * @param $maxRecords
  * @param string $sort_mode
  * @param string $find
  * @return array
  */
 function list_tiki_items($tikiobj, $user, $tstart, $tstop, $offset, $maxRecords, $sort_mode = 'name_desc', $find = '')
 {
     global $user;
     $ret = array();
     if (!is_array($tikiobj)) {
         return $ret;
     }
     $tikiobj = array_unique($tikiobj);
     if (in_array('wiki', $tikiobj)) {
         $tikiobj[] = 'wiki page';
         $tikiobj[] = 'wiki comment';
     }
     foreach ($tikiobj as $type) {
         if ($type != '' && $type != 'wiki') {
             $objectType = $type == 'wiki comment' ? 'wiki page' : $type;
             $result = $this->get_object_cal_infos($type, array($tstart, $tstop, $objectType));
             if (is_object($result)) {
                 while ($res = $result->fetchRow()) {
                     if ($res['start'] > 0) {
                         $res['show_description'] = 'y';
                         $res['visible'] = 'y';
                         $res['type'] = $type;
                         $dstart = TikiLib::make_time(0, 0, 0, TikiLib::date_format('%m', $res['start']), TikiLib::date_format('%d', $res['start']), TikiLib::date_format('%Y', $res['start']));
                         $res['time'] = TikiLib::date_format('%H%M', $res['start']);
                         $res['when'] = TikiLib::date_format('%H:%M', $res['start']);
                         $when = '<b>' . $res['when'] . '</b>';
                         $url_vars = array($res['id'], $res['id2']);
                         switch ($res['type']) {
                             case 'art':
                                 $res['description'] = $this->parse_data($res['description']);
                                 break;
                             case 'blog':
                                 $res['name'] = $res['parent'] . ' :: ' . $res['name'];
                                 break;
                             case 'dir':
                                 $res['description'] = addslashes($res['dir_url']) . '<br />' . $res['description'];
                                 break;
                             case 'forum':
                                 if ($res['fid'] > 0) {
                                     $url_vars = array($res['fid'], $res['id2'], 'threadId' . $res['id']);
                                 }
                                 break;
                             case 'gal':
                                 $res['description'] = tra('New Image Uploaded by') . ' %s';
                                 break;
                             case 'nl':
                                 $res['description'] = tra('New Subscriptions');
                                 $res['head'] = ' ... ' . $res['head'];
                                 break;
                             case 'track':
                                 $res['description'] = tra('New Item in Tracker');
                                 $res['parent'] = tra('tracker');
                                 break;
                             case 'wiki page':
                                 $res['parent'] = 'wiki';
                                 break;
                         }
                         $res['url'] = $this->get_object_url($res['type'], $url_vars);
                         if ($res['user'] != '') {
                             include_once 'lib/smarty_tiki/modifier.username.php';
                             $res['user'] = smarty_modifier_username($res['user']);
                             if (!strpos($res['description'], '%s')) {
                                 $br = $res['description'] == '' ? '' : '<br />';
                                 $res['description'] = '<i>' . tra('by') . ' %s</i>' . $br . $res['description'];
                             }
                             $res['description'] = sprintf($res['description'], $res['user']);
                         }
                         $res['description'] = str_replace(array('"', "\n|\r"), array("'", ''), $res['description']);
                         if ($res['name'] == '') {
                             $res['name'] = $res['id'];
                         }
                         $res['where'] = str_replace("\n|\r", '', addslashes($res['parent']));
                         if ((!isset($where) || $where == '') && $res['parent'] != '') {
                             $where = ' ' . tra('in') . ' <b>' . $res['where'] . '</b>';
                         }
                         if ($res['head'] == '') {
                             $res['head'] = $when . $where;
                         }
                         $res['group_description'] = $res['name'];
                         $ret[$dstart][] = $res;
                         unset($where);
                         unset($when);
                     }
                 }
             }
         }
     }
     return $ret;
 }
开发者ID:rjsmelo,项目名称:tiki,代码行数:100,代码来源:tikicalendarlib.php

示例11: min

				$smarty->assign('currMonth', $dday);
				$cell[$i][$w]['firstDay'] = true;
			} else
				$cell[$i][$w]['firstDay'] = false;
			$cell[$i][$w]['focus'] = true;
		} else {
			$cell[$i][$w]['firstDay'] = false;
			$cell[$i][$w]['focus'] = false;
		}
		if (isset($listevents["$dday"])) {
			$e = 0;

			foreach ($listevents["$dday"] as $le) {
				$nbDaysLeftThisWeek = min(ceil(($le['endTimeStamp'] - $dday)/86400), (7-$w));
				if ($calendarViewMode['casedefault'] == 'month') {
					$endOfCurrentMonth = $tikilib->make_time(23, 59, 59, TikiLib::date_format('m', $dday) + 1, 0, TikiLib::date_format2('Y', $dday));
					$nbDaysLeftThisWeek = min(ceil(($endOfCurrentMonth - $dday)/86400), $nbDaysLeftThisWeek);
				} elseif ($calendarViewMode['casedefault'] == 'year') {
					$endOfCurrentYear = $tikilib->make_time(23, 59, 59, 12, 31, TikiLib::date_format2('Y', $dday));
					$nbDaysLeftThisWeek = min(ceil(($endOfCurrentYear - $dday)/86400), $nbDaysLeftThisWeek);
				}
				if (!array_key_exists('nbDaysLeftThisWeek', $le)) {
					$le['nbDaysLeftThisWeek'] = $nbDaysLeftThisWeek;
				}
				$le['modifiable'] = in_array($le['calendarId'], $modifiable)? "y": "n";
				$le['visible'] = in_array($le['calendarId'], $visible)? "y": "n";
				$lec = $infocals['data']["{$le['calendarId']}"];
				$leday["{$le['time']}$e"] = $le;
				$smarty->assign('allday', $le["result"]["allday"]);
				$smarty->assign('cellcalendarId', $le["calendarId"]);
				$smarty->assign('cellhead', $le["head"]);
开发者ID:railfuture,项目名称:tiki-website,代码行数:31,代码来源:tiki-calendar.php

示例12: in_array

            $sort_mode = "start_asc";
        }
        $listevents = $calendarlib->list_raw_items($_SESSION['CalendarViewGroups'], $user, $viewstart, $viewend, 0, -1, $sort_mode);
        for ($i = count($listevents) - 1; $i >= 0; --$i) {
            $listevents[$i]['modifiable'] = in_array($listevents[$i]['calendarId'], $modifiable) ? "y" : "n";
        }
    } else {
        $listevents = $calendarlib->list_items($_SESSION['CalendarViewGroups'], $user, $viewstart, $viewend, 0, -1);
    }
    $smarty->assign_by_ref('listevents', $listevents);
} else {
    $listevents = array();
}
$mloop = TikiLib::date_format("%m", $viewstart);
$dloop = TikiLib::date_format("%d", $viewstart);
$yloop = TikiLib::date_format("%Y", $viewstart);
$curtikidate = new TikiDate();
$display_tz = $tikilib->get_display_timezone();
if ($display_tz == '') {
    $display_tz = 'UTC';
}
$curtikidate->setTZbyID($display_tz);
$curtikidate->setLocalTime($dloop, $mloop, $yloop, 0, 0, 0, 0);
$smarty->assign('display_tz', $display_tz);
for ($i = 0; $i <= $numberofweeks; $i++) {
    $weeks[] = $curtikidate->getWeekOfYear();
    foreach ($weekdays as $w) {
        $leday = array();
        if ($calendarViewMode == 'day') {
            $dday = $daystart;
        } else {
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:31,代码来源:tiki-calendar.php

示例13: smarty_function_html_select_time

/**
 * Smarty {html_select_time} function plugin
 *
 * Type:     function<br>
 * Name:     html_select_time<br>
 * Purpose:  Prints the dropdowns for time selection
 * @link http://smarty.php.net/manual/en/language.function.html.select.time.php {html_select_time}
 *          (Smarty online manual)
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_make_timestamp()
 */
function smarty_function_html_select_time($params, $smarty)
{
    global $tikilib;
    $smarty->loadPlugin('smarty_shared_make_timestamp');
    $smarty->loadPlugin('smarty_function_html_options');
    /* Default values. */
    $prefix = "Time_";
    $time = time();
    $display_hours = true;
    $display_minutes = true;
    $display_seconds = true;
    $display_meridian = true;
    $use_24_hours = true;
    $minute_interval = 1;
    $second_interval = 1;
    $hour_minmax = '0-23';
    /* Should the select boxes be part of an array when returned from PHP?
       e.g. setting it to "birthday", would create "birthday[Hour]",
       "birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]".
       Can be combined with prefix. */
    $field_array = null;
    $all_extra = null;
    $hour_extra = null;
    $minute_extra = null;
    $second_extra = null;
    $meridian_extra = null;
    $hour_empty = null;
    $minute_empty = null;
    $second_empty = null;
    $all_empty = null;
    extract($params);
    if (!empty($all_empty)) {
        $hour_empty = $minute_empty = $second_empty = $all_empty;
    }
    if (!isset($time) or !$time) {
        $time = $tikilib->now;
    } else {
        if (is_string($time) && strpos($time, ':') !== false) {
            $e = explode(':', $time, 3);
            $time = $tikilib->make_time(isset($e[0]) ? $e[0] : 0, isset($e[1]) ? $e[1] : 0, isset($e[2]) ? $e[2] : 0, $tikilib->date_format('%m'), $tikilib->date_format('%d'), $tikilib->date_format('%Y'));
        }
    }
    if (empty($hour_minmax) || !preg_match('/^[0-2]?[0-9]-[0-2]?[0-9]$/', $hour_minmax)) {
        $hour_minmax = '0-23';
    }
    //only needed for end_ and the static variable in the date_format functions seem to cause problems without the if
    if ($prefix == 'end_') {
        $time_hr24 = TikiLib::date_format('%H%M%s', $time);
    }
    $html_result = '';
    if ($display_hours) {
        if ($use_24_hours) {
            list($hour_min, $hour_max) = explode('-', $hour_minmax);
            $hours = range($hour_min == 24 ? 0 : $hour_min, $hour_max == 0 || $hour_max == 24 ? 23 : $hour_max);
            $hour_fmt = '%H';
            $latest = 23;
            //12-hour clock
        } else {
            $hours = range(1, 12);
            $hour_fmt = '%I';
            $latest = 11;
        }
        for ($i = 0, $for_max = count($hours); $i < $for_max; $i++) {
            $hours[$i] = sprintf('%02d', $hours[$i]);
        }
        if ($prefix == 'end_' && $time_hr24 == '000000') {
            $selected = $latest;
        } elseif ($prefix == 'duration_' || $prefix == 'startday_' || $prefix == 'endday_') {
            if ($use_24_hours) {
                $selected = floor($time / (60 * 60));
            } else {
                $selected = date('h', strtotime(floor($time / (60 * 60)) . ':00 '));
            }
        } else {
            $selected = $time == '--' ? $hour_empty : TikiLib::date_format($hour_fmt, $time);
        }
        $html_result .= '<select class="form-control date" name=';
        if (null !== $field_array) {
            $html_result .= '"' . $field_array . '[' . $prefix . 'Hour]"';
        } else {
            $html_result .= '"' . $prefix . 'Hour"';
        }
        if (null !== $hour_extra) {
            $html_result .= ' ' . $hour_extra;
        }
        if (null !== $all_extra) {
            $html_result .= ' ' . $all_extra;
//.........这里部分代码省略.........
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:101,代码来源:function.html_select_time.php

示例14: getCalendar

 /**
  * Get calendar and its events
  *
  * @param $calIds
  * @param $viewstart
  * @param $viewend
  * @param $group_by
  * @param $item_name
  * @param bool $listmode if set to true populate listevents key of the returned array
  * @return array
  */
 function getCalendar($calIds, &$viewstart, &$viewend, $group_by = '', $item_name = 'events', $listmode = false)
 {
     global $user, $prefs;
     // Global vars used by tiki-calendar_setup.php (this has to be changed)
     global $calendarViewMode, $request_day, $request_month;
     global $request_year, $dayend, $myurl;
     global $weekdays, $daysnames, $daysnames_abr;
     include 'tiki-calendar_setup.php';
     $smarty = TikiLib::lib('smarty');
     $tikilib = TikiLib::lib('tiki');
     //FIXME : maxrecords = 50
     $listtikievents = $this->list_items_by_day($calIds, $user, $viewstart, $viewend, 0, 50);
     $mloop = TikiLib::date_format('%m', $viewstart);
     $dloop = TikiLib::date_format('%d', $viewstart);
     $yloop = TikiLib::date_format('%Y', $viewstart);
     $curtikidate = new TikiDate();
     $display_tz = $tikilib->get_display_timezone();
     if ($display_tz == '') {
         $display_tz = 'UTC';
     }
     $curtikidate->setTZbyID($display_tz);
     $curtikidate->setLocalTime($dloop, $mloop, $yloop, 0, 0, 0, 0);
     $listevents = array();
     // note that number of weeks starts at ZERO (i.e., zero = 1 week to display).
     for ($i = 0; $i <= $numberofweeks; $i++) {
         $weeks[] = $curtikidate->getWeekOfYear();
         foreach ($weekdays as $w) {
             $leday = array();
             if ($group_by == 'day') {
                 $key = 0;
             }
             if ($calendarViewMode['casedefault'] == 'day') {
                 $dday = $daystart;
             } else {
                 $dday = $curtikidate->getTime();
                 $curtikidate->addDays(1);
             }
             $cell[$i][$w]['day'] = $dday;
             if ($calendarViewMode['casedefault'] == 'day' or $dday >= $daystart && $dday <= $dayend) {
                 $cell[$i][$w]['focus'] = true;
             } else {
                 $cell[$i][$w]['focus'] = false;
             }
             if (isset($listtikievents["{$dday}"])) {
                 $e = -1;
                 foreach ($listtikievents["{$dday}"] as $lte) {
                     $lte['desc_name'] = $lte['name'];
                     if ($group_by_item != 'n') {
                         if ($group_by != 'day') {
                             $key = $lte['id'] . '|' . $lte['type'];
                         }
                         if (!isset($leday[$key])) {
                             $leday[$key] = $lte;
                             if ($group_by == 'day') {
                                 $leday[$key]['description'] = array($lte['where'] => array($lte['group_description']));
                                 $leday[$key]['head'] = TikiLib::date_format($prefs['short_date_format'], $cell[$i][$w]['day']);
                             } else {
                                 $leday[$key]['description'] = ' - <b>' . $lte['when'] . '</b> : ' . tra($lte['action']) . ' ' . $lte['description'];
                                 $leday[$key]['head'] = $lte['name'] . ', <i>' . tra('in') . ' ' . $lte['where'] . '</i>';
                             }
                             $leday[$key]['desc_name'] = '';
                         } else {
                             $leday_item =& $leday[$key];
                             $leday_item['user'] .= ', ' . $lte['user'];
                             if (!isset($leday_item['action']) || !is_integer($leday_item['action'])) {
                                 $leday_item['action'] = 1;
                             }
                             $leday_item['action']++;
                             if ($group_by == 'day') {
                                 $leday_item['name'] .= '<br />' . $lte['name'];
                                 $leday_item['desc_name'] = $leday_item['action'] . ' ' . tra($item_name) . ': ';
                                 $leday_item['description'][$lte['where']][] = $lte['group_description'];
                             } else {
                                 $leday_item['name'] = $lte['name'] . ' (x<b>' . $leday_item['action'] . '</b>)';
                                 $leday_item['desc_name'] = $leday_item['action'] . ' ' . tra($item_name);
                                 if ($lte['show_description'] == 'y' && !empty($lte['description'])) {
                                     $leday_item['description'] .= ",\n<br /> - <b>" . $lte['when'] . '</b> : ' . tra($lte['action']) . ' ' . $lte['description'];
                                     $leday_item['show_description'] = 'y';
                                 }
                             }
                         }
                     } else {
                         $e++;
                         $key = "{$lte['time']}{$e}";
                         $leday[$key] = $lte;
                         $lte['desc_name'] .= tra($lte['action']);
                     }
                 }
                 foreach ($leday as $key => $lte) {
//.........这里部分代码省略.........
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:101,代码来源:calendarlib.php

示例15: period2dates

 /**
  * Transform a last period to a 2 dates
  *
  */
 public function period2dates($when)
 {
     global $prefs;
     $tikilib = TikiLib::lib('tiki');
     $now = $tikilib->now;
     $sec = TikiLib::date_format("%s", $now);
     $min = TikiLib::date_format("%i", $now);
     $hour = TikiLib::date_format("%H", $now);
     $day = TikiLib::date_format("%d", $now);
     $month = TikiLib::date_format("%m", $now);
     $year = TikiLib::date_format("%Y", $now);
     switch ($when) {
         case 'lasthour':
             $begin = $now - 60 * 60;
             break;
         case 'day':
             $begin = TikiLib::make_time(0, 0, 0, $month, $day, $year);
             break;
         case 'lastday':
             $begin = Tikilib::make_time($hour - 24, $min, $sec, $month, $day, $year);
             break;
         case 'week':
             $iweek = TikiLib::date_format("%w", $now);
             // 0 for Sunday...
             $calendarlib = TikiLib::lib('calendar');
             $firstDayofWeek = $calendarlib->firstDayofWeek();
             $iweek -= $firstDayofWeek;
             if ($iweek < 0) {
                 $iweek += 7;
             }
             $begin = TikiLib::make_time(0, 0, 0, $month, $day - $iweek, $year);
             break;
         case 'lastweek':
             $begin = Tikilib::make_time($hour, $min, $sec, $month, $day - 7, $year);
             break;
         case 'month':
             $begin = TikiLib::make_time(0, 0, 0, $month, 1, $year);
             break;
         case 'lastmonth':
             $begin = TikiLib::make_time($hour, $min, $sec, $month - 1, $day, $year);
             break;
         case 'year':
             $begin = TikiLib::make_time(0, 0, 0, 1, 1, $year);
             break;
         case 'lastyear':
             $begin = TikiLib::make_time($hour, $min, $sec, $month, $day, $year - 1);
             break;
         default:
             $begin = $now;
             break;
     }
     return array((int) $begin, (int) $now);
 }
开发者ID:linuxwhy,项目名称:tiki-1,代码行数:57,代码来源:statslib.php


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