Пример #1
0
 public function __construct($phpa)
 {
     require_once 'Calendar/Util/Textual.php';
     $this->phpa = $phpa;
     $this->DB = $phpa->DB;
     $this->tpl = $phpa->tpl;
     $this->d = isset($_GET['d']) ? intval($_GET['d']) : date('d');
     $this->m = isset($_GET['m']) ? intval($_GET['m']) : date('m');
     $this->y = isset($_GET['y']) ? intval($_GET['y']) : date('Y');
     if (FALSE === checkdate($this->m, $this->d, $this->y)) {
         $this->d = date('d');
         $this->m = date('m');
         $this->y = date('Y');
     }
     $this->ts = mktime(0, 0, 0, $this->m, $this->d, $this->y);
     $this->tpl->assign('ts', $this->ts);
     // unix timestamp
     $this->tpl->assignRef('d', $this->d);
     $this->tpl->assignRef('m', $this->m);
     $this->tpl->assignRef('y', $this->y);
     // dropdown boxes data
     // crange() is just like range() except works with strings. see libs/functions.lib.php
     $this->tpl->assign('month_select', array_combine(crange('01', '12'), Calendar_Util_Textual::monthNames('short')));
     $this->tpl->assign('year_select', range($this->y - 1, $this->y + 5));
 }
Пример #2
0
 function testMonthNamesOne()
 {
     $monthNames = array(1 => 'J', 2 => 'F', 3 => 'M', 4 => 'A', 5 => 'M', 6 => 'J', 7 => 'J', 8 => 'A', 9 => 'S', 10 => 'O', 11 => 'N', 12 => 'D');
     $this->assertEqual($monthNames, Calendar_Util_Textual::monthNames('one'));
 }
Пример #3
0
 /**
  * Returns textual representation of the next month of the decorated calendar object
  * @param object subclass of Calendar e.g. Calendar_Month
  * @param string (optional) format of returned months (one,two,short or long)
  * @return string
  * @access public
  * @static
  */
 function nextMonthName($Calendar, $format = 'long')
 {
     $months = Calendar_Util_Textual::monthNames($format);
     return $months[$Calendar->nextMonth()];
 }
Пример #4
0
 /**
  * Returns an array of 12 month names (first index = 1)
  * @param string (optional) format of returned months (one,two,short or long)
  * @return array
  * @access public
  * @static
  */
 function monthNames($format = 'long')
 {
     return Calendar_Util_Textual::monthNames($format);
 }
Пример #5
0
<?php

/**
* Description: demonstrates using the Textual util
*/
if (!@(include 'Calendar' . DIRECTORY_SEPARATOR . 'Calendar.php')) {
    define('CALENDAR_ROOT', '../../');
}
require_once CALENDAR_ROOT . 'Day.php';
require_once CALENDAR_ROOT . 'Month' . DIRECTORY_SEPARATOR . 'Weekdays.php';
require_once CALENDAR_ROOT . 'Util' . DIRECTORY_SEPARATOR . 'Textual.php';
// Could change language like this
// setlocale (LC_TIME, "de_DE"); // Unix based (probably)
// setlocale (LC_TIME, "ge"); // Windows
echo "<hr>Calling: Calendar_Util_Textual::monthNames('long');<pre>";
print_r(Calendar_Util_Textual::monthNames('long'));
echo '</pre>';
echo "<hr>Calling: Calendar_Util_Textual::weekdayNames('two');<pre>";
print_r(Calendar_Util_Textual::weekdayNames('two'));
echo '</pre>';
echo "<hr>Creating: new Calendar_Day(date('Y'), date('n'), date('d'));<br />";
$Calendar = new Calendar_Day(date('Y'), date('n'), date('d'));
echo '<hr>Previous month is: ' . Calendar_Util_Textual::prevMonthName($Calendar, 'two') . '<br />';
echo 'This month is: ' . Calendar_Util_Textual::thisMonthName($Calendar, 'short') . '<br />';
echo 'Next month is: ' . Calendar_Util_Textual::nextMonthName($Calendar) . '<br /><hr />';
echo 'Previous day is: ' . Calendar_Util_Textual::prevDayName($Calendar) . '<br />';
echo 'This day is: ' . Calendar_Util_Textual::thisDayName($Calendar, 'short') . '<br />';
echo 'Next day is: ' . Calendar_Util_Textual::nextDayName($Calendar, 'one') . '<br /><hr />';
echo "Creating: new Calendar_Month_Weekdays(date('Y'), date('n'), 6); - Saturday is first day of week<br />";
$Calendar = new Calendar_Month_Weekdays(date('Y'), date('n'), 6);
?>
Пример #6
0
        $cellId++;
    }
    $cellId = 0;
    $rowId++;
}
// Assigning events to the template
$xoopsTpl->assign('tableRows', $tableRows);
// Retriving categories
$cats = $catHandler->objectToArray($catHandler->getAllCat($xoopsUser));
// Assigning categories to the template
$xoopsTpl->assign('cats', $cats);
// Retriving weekdayNames
$weekdayNames = Calendar_Util_Textual::weekdayNames();
for ($i = 0; $i < $xoopsModuleConfig['week_start_day']; $i++) {
    $weekdayName = array_shift($weekdayNames);
    $weekdayNames[] = $weekdayName;
}
// Assigning weekdayNames to the template
$xoopsTpl->assign('weekdayNames', $weekdayNames);
// Retriving monthNames
$monthNames = Calendar_Util_Textual::monthNames();
// Making navig data
$navig = array('prev' => array('uri' => 'year=' . $pMonthCalObj->thisYear() . '&amp;month=' . $pMonthCalObj->thisMonth(), 'name' => $extcalTimeHandler->getFormatedDate($xoopsModuleConfig['nav_date_month'], $pMonthCalObj->getTimestamp())), 'this' => array('uri' => 'year=' . $monthCalObj->thisYear() . '&amp;month=' . $monthCalObj->thisMonth(), 'name' => $extcalTimeHandler->getFormatedDate($xoopsModuleConfig['nav_date_month'], $monthCalObj->getTimestamp())), 'next' => array('uri' => 'year=' . $nMonthCalObj->thisYear() . '&amp;month=' . $nMonthCalObj->thisMonth(), 'name' => $extcalTimeHandler->getFormatedDate($xoopsModuleConfig['nav_date_month'], $nMonthCalObj->getTimestamp())));
// Assigning navig data to the template
$xoopsTpl->assign('navig', $navig);
// Assigning current form navig data to the template
$xoopsTpl->assign('selectedCat', $cat);
$xoopsTpl->assign('year', $year);
$xoopsTpl->assign('month', $month);
$xoopsTpl->assign('view', "calmonth");
include XOOPS_ROOT_PATH . '/footer.php';