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


PHP Calendar::getYear方法代码示例

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


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

示例1: testGetter

 public function testGetter()
 {
     $calendar = new Calendar(new \DateTime('2014-01-01 12:14:00'), new \DateTimeZone('UTC'));
     $this->assertEquals('2014-01-01 00:00:00', $calendar->getDate()->format('Y-m-d H:i:s'));
     $calendar->setDate(new \DateTime('2014-01-04 12:14:00'));
     $this->assertEquals('2014-01-04 00:00:00', $calendar->getDate()->format('Y-m-d H:i:s'));
     $tz = new \DateTimeZone('Europe/Berlin');
     $calendar->setTimezone($tz);
     $this->assertEquals($tz, $calendar->getTimezone());
     $this->assertEquals('01', $calendar->getWeekNumber());
     $this->assertEquals(4, $calendar->getDay());
     $this->assertEquals(1, $calendar->getMonth());
     $this->assertEquals(2014, $calendar->getYear());
     $this->assertEquals('January', $calendar->getMonthName());
 }
开发者ID:seytar,项目名称:psx,代码行数:15,代码来源:CalendarTest.php

示例2: Calendar

 * This helps ensure that we are able to control the calendar and the way it 
 * operates independently based on each page. We instantiate a different
 * Calendar class depending on a supply of page parameter or not
 */
//Instantiate the Calendar Class
if (!empty($_GET["m"]) && !empty($_GET["y"])) {
    $Calendar = new Calendar($_GET["m"], $_GET["y"]);
} else {
    $Calendar = new Calendar(date('m'), date('Y'));
}
//Variables for the calender
$empty = $Calendar->getEmpty();
//The number of empty boxes at start of the month
$month = $Calendar->getMonth();
//The numeric representation of the month
$year = $Calendar->getYear();
//The numeric representation of the year
$total = $Calendar->getTotal();
//The total number of days for the specified month
$feed = $Feed->getPublicFeed($month, $year);
?>
		
	<div id="calendar-scroller" style="position:absolute;right:0;">
		<div class="calendar-wrapper">
			<div class="top-heading">Public Calendar</div>	
			<div class="date">
				<h2>	
					<!--Decrement the month-->	
					<?php 
$previousDate = Calendar::getPrevious($_GET["m"], $_GET["y"]);
?>
开发者ID:alexkonetchy,项目名称:social-calendar,代码行数:31,代码来源:public_calendar.php

示例3:

      <td class='value'><?php 
echo $cal->getDay();
?>
</td>
   </tr>
   <tr>
      <td class='name'>current month</td>
      <td class='value'><?php 
echo $cal->getMonth();
?>
</td>
   </tr>
   <tr>
      <td class='name'>current year</td>
      <td class='value'><?php 
echo $cal->getYear();
?>
</td>
   </tr>
   <tr>
      <td class='name'>current year is a leap year ?</td>
      <td class='value'><?php 
echo $cal->isLeapYear() ? 'Yes' : 'No';
?>
</td>
   </tr>
   <tr>
      <td class='name'>day of year</td>
      <td class='value'><?php 
echo $cal->getDayOfYear();
?>
开发者ID:alexpagnoni,项目名称:jphp,代码行数:31,代码来源:index.php

示例4: array

        .user-girl{
            color: #F994AB
        }
        .user-boy{
            color: #97BCF0
        }
    </style>
    <div class="row form-group">        
        <div class="col-sm-1 col-xs-1 color-grey">
            <?php 
echo CHtml::link('<span class="icon-double-angle-left"></span>', $preUrl);
?>
        </div>
        <div class="col-sm-3 col-xs-3">
            <?php 
echo CHtml::dropDownList('yueban_year', $yearnow, Calendar::getYear(), array('class' => 'form-control', 'empty' => '--年份--', 'onchange' => "yueRe()"));
?>
        </div>
        <div class="col-sm-3 col-xs-3">
            <?php 
echo CHtml::dropDownList('yueban_month', $monthnow, Calendar::getMonth(), array('class' => 'form-control', 'empty' => '--月份--', 'onchange' => "yueRe()"));
?>
        </div>        
        <div class="col-sm-1 col-xs-1 color-grey">
            <?php 
echo CHtml::link('<span class="icon-double-angle-right"></span>', $nextUrl);
?>
        </div>
        <div class="col-sm-4 col-xs-4">
            <?php 
echo CHtml::link('我要约伴', array('yueban/create'), array('class' => 'btn btn-default pull-right'));
开发者ID:ph7pal,项目名称:wedding,代码行数:31,代码来源:index.php

示例5: birthdaysCalendar

 private function birthdaysCalendar()
 {
     // require the class
     require_once FRAMEWORK_PATH . 'lib/calendar/calendar.class.php';
     // set the default month and year, i.e. the current month and year
     $m = date('m');
     $y = date('Y');
     // check for a different Month / Year (i.e. user has moved to another month)
     if (isset($_GET['month'])) {
         $m = intval($_GET['month']);
         if ($m > 0 && $m < 13) {
         } else {
             $m = date('m');
         }
     }
     if (isset($_GET['year'])) {
         $y = intval($_GET['year']);
     }
     // Instantiate the calendar object
     $calendar = new Calendar('', $m, $y);
     // Get next and previous month / year
     $nm = $calendar->getNextMonth()->getMonth();
     $ny = $calendar->getNextMonth()->getYear();
     $pm = $calendar->getPreviousMonth()->getMonth();
     $py = $calendar->getPreviousMonth()->getYear();
     // send next / previous month data to the template
     $this->registry->getObject('template')->getPage()->addTag('nm', $nm);
     $this->registry->getObject('template')->getPage()->addTag('pm', $pm);
     $this->registry->getObject('template')->getPage()->addTag('ny', $ny);
     $this->registry->getObject('template')->getPage()->addTag('py', $py);
     // send the current month name and year to the template
     $this->registry->getObject('template')->getPage()->addTag('month_name', $calendar->getMonthName());
     $this->registry->getObject('template')->getPage()->addTag('the_year', $calendar->getYear());
     // Set the start day of the week
     $calendar->setStartDay(0);
     require_once FRAMEWORK_PATH . 'models/relationships.php';
     $relationships = new Relationships($this->registry);
     $idsSQL = $relationships->getIDsByUser($this->registry->getObject('authenticate')->getUser()->getUserID());
     $sql = "SELECT DATE_FORMAT(pr.user_dob, '%d' ) as profile_dob, pr.name as profile_name, pr.user_id as profile_id, ( ( YEAR( CURDATE() ) ) - ( DATE_FORMAT(pr.user_dob, '%Y' ) ) ) as profile_new_age FROM profile pr WHERE pr.user_id IN (" . $idsSQL . ") AND pr.user_dob LIKE '%-{$m}-%'";
     $this->registry->getObject('db')->executeQuery($sql);
     $dates = array();
     $data = array();
     if ($this->registry->getObject('db')->numRows() > 0) {
         while ($row = $this->registry->getObject('db')->getRows()) {
             $dates[] = $row['profile_dob'];
             $data[intval($row['profile_dob'])] = "<br />" . $row['profile_name'] . " (" . $row['profile_new_age'] . ")<br />";
         }
     }
     $calendar->setData($data);
     // tell the calendar which days should be highlighted
     $calendar->setDaysWithEvents($dates);
     $calendar->buildMonth();
     // days
     $this->registry->getObject('template')->dataToTags($calendar->getDaysInOrder(), 'cal_0_day_');
     // dates
     $this->registry->getObject('template')->dataToTags($calendar->getDates(), 'cal_0_dates_');
     // styles
     $this->registry->getObject('template')->dataToTags($calendar->getDateStyles(), 'cal_0_dates_style_');
     // data
     $this->registry->getObject('template')->dataToTags($calendar->getDateData(), 'cal_0_dates_data_');
     $this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'bd-calendar.tpl.php', 'footer.tpl.php');
 }
开发者ID:simontakite,项目名称:cookbooks,代码行数:62,代码来源:controller.php


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