Example #1
0
 /**
  * Builds Day objects in tabular form, to allow display of calendar month
  * with empty cells if the first day of the week does not fall on the first
  * day of the month.
  * @see Calendar_Day::isEmpty()
  * @see Calendar_Day_Base::isFirst()
  * @see Calendar_Day_Base::isLast()
  * @param array (optional) Calendar_Day objects representing selected dates
  * @return boolean
  * @access public
  */
 function build($sDates = array())
 {
     require_once CALENDAR_ROOT . 'Table/Helper.php';
     $this->tableHelper =& new Calendar_Table_Helper($this, $this->firstDay);
     Calendar_Month::build($sDates);
     $this->buildEmptyDaysBefore();
     $this->shiftDays();
     $this->buildEmptyDaysAfter();
     $this->setWeekMarkers();
     return true;
 }
Example #2
0
<?php 
if (isset($_POST['update'])) {
    $Second =& new Calendar_Second($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i'], $_POST['s']);
    if (!$Second->isValid()) {
        $V =& $Second->getValidator();
        echo '<p>Validation failed:</p>';
        while ($error = $V->fetch()) {
            echo $error->toString() . '<br>';
        }
    } else {
        echo '<p>Validation success.</p>';
        echo '<p>New timestamp is: ' . $Second->getTimeStamp() . ' which could be used to update a database, for example';
    }
} else {
    $Year = new Calendar_Year($_POST['y']);
    $Month = new Calendar_Month($_POST['y'], $_POST['m']);
    $Day = new Calendar_Day($_POST['y'], $_POST['m'], $_POST['d']);
    $Hour = new Calendar_Hour($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h']);
    $Minute = new Calendar_Minute($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i']);
    $Second = new Calendar_Second($_POST['y'], $_POST['m'], $_POST['d'], $_POST['h'], $_POST['i'], $_POST['s']);
    ?>
<p><b>Set the alarm clock</p></p>
<form action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
" method="post">
Year: <input type="text" name="y" value="<?php 
    echo $_POST['y'];
    ?>
" size="4">&nbsp;
Month:<select name="m">
 /**
  * Constructs Calendar_Month_Weeks
  * @param int year e.g. 2003
  * @param int month e.g. 5
  * @param int (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
  * @access public
  */
 function Calendar_Month_Weeks($y, $m, $firstDay = false)
 {
     Calendar_Month::Calendar_Month($y, $m);
     $this->firstDay = $firstDay;
 }
 function testMonth()
 {
     $Unit = new Calendar_Month(2000, 13);
     $Validator =& $Unit->getValidator();
     $this->assertFalse($Validator->isValidMonth());
 }
Example #5
0
 /**
  * Constructs Calendar_Month_Weeks
  * @param int year e.g. 2003
  * @param int month e.g. 5
  * @param int (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)
  * @access public
  */
 function Calendar_Month_Weeks($y, $m, $firstDay = null)
 {
     Calendar_Month::Calendar_Month($y, $m, $firstDay);
 }
Example #6
0
 /**
  * Constructs a Link for a calendar to the given month.
  *
  * @param Calendar_Month $month The calendar month to link to.
  */
 function _get_calendar_monthlink($month)
 {
     $next_month = $month->nextMonth('object');
     return $_MIDCOM->get_context_data(MIDCOM_CONTEXT_ANCHORPREFIX) . 'archive/between/' . $month->thisYear() . '-' . $month->thisMonth() . '-01/' . $next_month->thisYear() . '-' . $next_month->thisMonth() . '-01/';
 }