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


PHP Calendar::days方法代码示例

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


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

示例1: strftime

<?php

// Get the day names
$days = Calendar::days(TRUE);
// Previous and next month timestamps
$next = mktime(0, 0, 0, $month + 1, 1, $year);
$prev = mktime(0, 0, 0, $month - 1, 1, $year);
// Import the GET query array locally and remove the day
$qs = $_GET;
unset($qs['day']);
// Previous and next month query URIs
$prev = Router::$current_uri . '?' . http_build_query(array_merge($qs, array('month' => date('n', $prev), 'year' => date('Y', $prev))));
$next = Router::$current_uri . '?' . http_build_query(array_merge($qs, array('month' => date('n', $next), 'year' => date('Y', $next))));
?>
<table class="calendar">
<tr class="controls">
<td class="prev"><?php 
echo html::anchor($prev, '&laquo;');
?>
</td>
<td class="title" colspan="5"><?php 
echo strftime('%B %Y', mktime(0, 0, 0, $month, 1, $year));
?>
</td>
<td class="next"><?php 
echo html::anchor($next, '&raquo;');
?>
</td>
</tr>
<tr>
<?php 
开发者ID:Toushi,项目名称:flow,代码行数:31,代码来源:kohana_calendar.php

示例2: defined

<?php

defined('SYSPATH') or die('No direct access allowed.');
// Get the day names
$days = Calendar::days(2);
// Previous and next month timestamps
$next = mktime(0, 0, 0, $month + 1, 1, $year);
$prev = mktime(0, 0, 0, $month - 1, 1, $year);
// Import the GET query array locally and remove the day
$qs = $_GET;
unset($qs['day']);
// Previous and next month query URIs
$prev = Router::$current_uri . '?' . http_build_query(array_merge($qs, array('month' => date('n', $prev), 'year' => date('Y', $prev))));
$next = Router::$current_uri . '?' . http_build_query(array_merge($qs, array('month' => date('n', $next), 'year' => date('Y', $next))));
?>
<table class="calendar">
<tr class="controls">
<td class="title" colspan="7" align="center">
<a href="<? print url::site("calendarview/month/" . $year . "/" . $calendar_user . "/" . $month ) ?>"><?php 
print t(strftime('%B', mktime(0, 0, 0, $month, 1, $year))) . " " . t(strftime('%Y', mktime(0, 0, 0, $month, 1, $year)));
?>
</a>
</td>
</tr>
<tr>
<?php 
foreach ($days as $day) {
    ?>
<th><?php 
    echo t($day);
    ?>
开发者ID:patxo,项目名称:gallery3-contrib,代码行数:31,代码来源:kohana_calendar.php

示例3: month

 public function month($date, $event_assocs = NULL, $may_edit = false)
 {
     $calendar_url = $this->calendar_url;
     $self_url = $this->self_url;
     $range = Calendar::range($date, 'month');
     $days = Calendar::days($range, $event_assocs);
     $today_ts = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
     $thism_ts = $days[0]['date_ts'];
     // find on which day this month starts
     $first_week_day = date('w', $thism_ts);
     // header with Month and Year
     $html = "<ul class=\"calendar\">\n";
     // calendar|list
     $html .= "<li class=\"calendarcell header\">\n";
     $prevm_ts = mktime(0, 0, 0, date("m", $thism_ts) - 1, 1, date("Y", $thism_ts));
     $nextm_ts = mktime(0, 0, 0, date("m", $thism_ts) + 1, 1, date("Y", $thism_ts));
     $html .= "<a class=\"month-prev\" href=\"{$self_url}&date=" . date("Y-m-d", $prevm_ts) . "\" title=\"" . date("F Y", $prevm_ts) . "\">&lt;</a>";
     $html .= "<a class=\"month-next\" href=\"{$self_url}&date=" . date("Y-m-d", $nextm_ts) . "\" title=\"" . date("F Y", $nextm_ts) . "\">&gt;</a>";
     $html .= date("F Y", $thism_ts);
     $html .= "</li>\n";
     // render dayheaders
     $fd = $this->first_day_of_week;
     $ld = $fd + 7;
     for ($i = $fd; $i < $ld; $i++) {
         if ($i > 6) {
             $d = $i - 7;
         } else {
             $d = $i;
         }
         $html .= "<li class=\"calendarcell dayheader\">\n";
         $html .= $this->week_days[$d];
         $html .= "</li>\n";
     }
     $grid_count = 0;
     // render empty days at start of month if required
     if ($first_week_day < $fd) {
         $ed = 7 - $first_week_day;
     } else {
         $ed = $first_week_day;
     }
     for ($i = $fd; $i < $ed; $i++) {
         $html .= "<li class=\"calendarcell\">&nbsp;</li>\n";
         $grid_count++;
     }
     // render actual days
     $cnt = count($days);
     $last_week_day = 0;
     for ($i = 0; $i < $cnt; $i++) {
         $events = $days[$i]['events'];
         $event_cnt = count($events);
         $html .= "<li class=\"calendarcell";
         // mark today as special
         if ($days[$i]['date_ts'] == $today_ts) {
             $html .= " today";
         }
         if ($event_cnt) {
             $html .= " hasevents";
         } else {
             $html .= " noevents";
         }
         $html .= "\">\n";
         $html .= "<span class=\"daynumber\">";
         $html .= date("d", $days[$i]['date_ts']);
         $html .= "</span>";
         $html .= "<div class=\"hovertip\">";
         // . "$event_cnt Events for "
         // . date("D jS", $days[$i]['date_ts'])
         if ($event_cnt) {
             $html .= "<ul class=\"eventlist\">\n";
             foreach ($events as $n => $assoc) {
                 $html .= "<li>";
                 if ($may_edit) {
                     $html .= "<a href=\"{$calendar_url}&display_event=" . $assoc->event_id . "\">";
                 }
                 $html .= "<b>" . _out($assoc->event_title);
                 $html .= "</b> on ";
                 $html .= $assoc->start_time;
                 if ($may_edit) {
                     $html .= "</a>";
                 }
                 $html .= "</li>\n";
             }
             $html .= "</ul>\n";
         }
         if ($may_edit) {
             // create link
             $html .= "<a class=\"create-event\" href=\"{$calendar_url}&date=" . date("Y-m-d", $days[$i]['date_ts']) . "\">New</a>";
         }
         $html .= "</div>";
         $html .= "</li>\n";
         $grid_count++;
     }
     // render empty days at end of month if required
     for ($i = $grid_count; $i < 42; $i++) {
         $html .= "<li class=\"calendarcell\">&nbsp;</li>\n";
     }
     $html .= "<li class=\"calendarcell header\">";
     if ($may_edit) {
         // edit link
         $html .= "<b><a class=\"goto-edit\" href=\"{$calendar_url}\">Edit</a></b>&nbsp;&nbsp;&nbsp;";
//.........这里部分代码省略.........
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:101,代码来源:RenderCalendar.php


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