本文整理汇总了PHP中Calendar::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Calendar::__construct方法的具体用法?PHP Calendar::__construct怎么用?PHP Calendar::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Calendar
的用法示例。
在下文中一共展示了Calendar::__construct方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($month = null, $year = null, &$Database)
{
$this->Database = $Database;
//Instantiate the PDO Object
parent::__construct($month, $year);
//Call the parent constructor
}
示例2: foreach
/**
* Constructor
*
* @param Backend\BackendInterface $caldavBackend
* @param array $calendarInfo
*/
function __construct(Backend\BackendInterface $caldavBackend, $calendarInfo)
{
$required = ['{http://calendarserver.org/ns/}shared-url', '{http://sabredav.org/ns}owner-principal', '{http://sabredav.org/ns}read-only'];
foreach ($required as $r) {
if (!isset($calendarInfo[$r])) {
throw new \InvalidArgumentException('The ' . $r . ' property must be specified for SharedCalendar(s)');
}
}
parent::__construct($caldavBackend, $calendarInfo);
}
示例3: __construct
/**
* Constructor
*
* @access public
* @return null
*/
public function __construct()
{
parent::__construct();
// -------------------------------------
// Grab cached data
// -------------------------------------
if (isset($this->cache['CDT'])) {
foreach ($this->cache['CDT']['default'] as $k => $v) {
$this->{$k} = $v;
}
} else {
$this->change_date($this->year(), $this->month(), $this->day());
$this->change_time($this->hour(), $this->minute());
// -------------------------------------
// Cache
// -------------------------------------
$this->cache['CDT']['default'] = $this->datetime_array();
}
}
示例4: __construct
/**
* Конструктор класса
*
* @param string $name
* @param string $module
* @param array $params
* @access public
*/
public function __construct($name, array $params = null)
{
parent::__construct($name, $params);
$this->setCalendar(new CalendarObject($this->getParam('month'), $this->getParam('year')));
//Отмечаем использованные даты календаря
$range = $this->calendar->getRange();
$dateFormat = '"Y-m-d"';
// Если диапазон календаря заканчивается в будущем - отсекаем до текущего момента
if ($range->end->getTimestamp() > time()) {
$endRange = date($dateFormat);
} else {
$endRange = $range->end->format($dateFormat);
}
$conditions = array_merge(array('post_created>=' . $range->start->format($dateFormat) . ' AND post_created<=' . $endRange), $this->getParam('filter'));
if ($blogId = (int) $this->getParam('blog_id')) {
$conditions['blog_id'] = $blogId;
}
$existingDates = simplifyDBResult($this->dbh->select('SELECT DISTINCT DATE_FORMAT(post_created, "%Y-%c-%e") as post_date FROM blog_post' . $this->dbh->buildWhereCondition($conditions)), 'post_date');
if (is_array($existingDates)) {
foreach ($existingDates as $date) {
$this->calendar->getItemByDate(\DateTime::createFromFormat('Y-m-d', $date))->setProperty('selected', 'selected');
}
}
}
示例5:
function __construct()
{
parent::__construct('http://www.lkp.pingst.se/kalender');
}
示例6: __construct
/**
* Constructor
*
* @access public
* @param array $data Array of event data
* @param array $start Start date info [optional]
* @param array $end End date info [optional]
* @param int $limit Limit the number of occurrences to calculate [optional]
* @return null
*/
public function __construct($data, $start = array(), $end = array(), $limit = 0)
{
parent::__construct();
parent::load_calendar_datetime();
// -------------------------------------
// Collect the default data
// -------------------------------------
$this->default_data = $data;
$this->rules = isset($this->default_data['rules']) ? $this->default_data['rules'] : array();
$this->occurrences = isset($this->default_data['occurrences']) ? $this->default_data['occurrences'] : array();
$this->exceptions = isset($this->default_data['exceptions']) ? $this->default_data['exceptions'] : array();
unset($data, $this->default_data['rules'], $this->default_data['occurrences'], $this->default_data['exceptions']);
$this->limit = $limit == 0 ? $this->limit : $limit;
// -------------------------------------
// If we're only given dates, add the other keys we need
// -------------------------------------
if (!isset($data['start_year'])) {
$dates = $this->CDT->ymd_to_array($this->default_data['start_date']);
foreach ($dates as $k => $v) {
$this->default_data['start_' . $k] = $v;
}
}
if (!isset($this->default_data['end_year'])) {
$dates = $this->CDT->ymd_to_array($this->default_data['end_date']);
foreach ($dates as $k => $v) {
$this->default_data['end_' . $k] = $v;
}
}
// -------------------------------------
// Make sure we have a start time
// -------------------------------------
if (!isset($this->default_data['start_time'])) {
$this->default_data['start_time'] = '0000';
} else {
$this->default_data['start_time'] = str_pad($this->default_data['start_time'], 4, 0, STR_PAD_LEFT);
}
// -------------------------------------
// Make sure we have an end time
// -------------------------------------
if (!isset($this->default_data['end_time'])) {
$this->default_data['end_time'] = '2359';
} else {
$this->default_data['end_time'] = str_pad($this->default_data['end_time'], 4, 0, STR_PAD_LEFT);
}
if (isset($this->default_data['start_year'])) {
$this->event_start = array('year' => $this->default_data['start_year'], 'month' => $this->default_data['start_month'], 'day' => $this->default_data['start_day'], 'ymd' => isset($this->default_data['start_ymd']) ? $this->default_data['start_ymd'] : $this->CDT->make_ymd($this->default_data['start_year'], $this->default_data['start_month'], $this->default_data['start_day']));
} else {
$this->event_start = $this->CDT->ymd_to_array($this->default_data['start_date']);
}
// -------------------------------------
// Use the start data if the equivalent
// end data doesn't exist and the event
// doesn't recur
// -------------------------------------
if (isset($this->default_data['recurs']) and $this->default_data['recurs'] == 'n' and $this->default_data['end_year'] == 0) {
$this->event_end = array('year' => $this->default_data['start_year'], 'month' => $this->default_data['start_month'], 'day' => $this->default_data['start_day'], 'ymd' => $this->default_data['start_ymd']);
} else {
$this->event_end = array('year' => $this->default_data['end_year'], 'month' => $this->default_data['end_month'], 'day' => $this->default_data['end_day'], 'ymd' => isset($this->default_data['end_ymd']) ? $this->default_data['end_ymd'] : $this->CDT->make_ymd($this->default_data['end_year'], $this->default_data['end_month'], $this->default_data['end_day']));
}
// -------------------------------------
// If $start/$end were given as YMD, convert them
// -------------------------------------
if (!is_array($start)) {
$start = $this->CDT->ymd_to_array($start);
}
if (!is_array($end)) {
$end = $this->CDT->ymd_to_array($end);
}
// -------------------------------------
// Set the date range
// -------------------------------------
if (empty($start) or isset($start['ymd']) and $start['ymd'] == '') {
$this->range_start = array('year' => $this->event_start['year'], 'month' => $this->event_start['month'], 'day' => $this->event_start['day'], 'ymd' => $this->event_start['ymd'], 'time' => '0000', 'hour' => '00', 'minute' => '00');
} else {
$this->range_start = array('year' => $start['year'], 'month' => $start['month'], 'day' => $start['day'], 'ymd' => array_key_exists('ymd', $start) ? $start['ymd'] : $this->CDT->make_ymd($start['year'], $start['month'], $start['day']), 'time' => isset($start['time']) ? $start['time'] : '0000', 'hour' => isset($start['hour']) ? $start['hour'] : '00', 'minute' => isset($start['minute']) ? $start['minute'] : '00');
}
//default to event end
if (empty($end)) {
$this->range_end = array('year' => $this->event_end['year'], 'month' => $this->event_end['month'], 'day' => $this->event_end['day'], 'ymd' => $this->event_end['ymd'], 'time' => '2359', 'hour' => '23', 'minute' => '59');
} elseif ($end['year'] == 0) {
$this->range_end = array('year' => 9999, 'month' => 12, 'day' => 31, 'ymd' => 99991231, 'time' => '2359', 'hour' => '23', 'minute' => '59');
} else {
$this->range_end = array('year' => $end['year'], 'month' => $end['month'], 'day' => $end['day'], 'ymd' => array_key_exists('ymd', $end) ? $end['ymd'] : $this->CDT->make_ymd($end['year'], $end['month'], $end['day']), 'time' => isset($end['time']) ? $end['time'] : '2359', 'hour' => isset($end['hour']) ? $end['hour'] : '23', 'minute' => isset($end['minute']) ? $end['minute'] : '59');
}
// -------------------------------------
// Flip-flop if end is smaller than start
// -------------------------------------
if ($this->range_end < $this->range_start) {
$temp = $this->range_end;
$this->range_end = $this->range_start;
//.........这里部分代码省略.........
示例7:
function __construct(&$mod)
{
parent::__construct($mod);
}