本文整理汇总了PHP中Num::pad方法的典型用法代码示例。如果您正苦于以下问题:PHP Num::pad方法的具体用法?PHP Num::pad怎么用?PHP Num::pad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Num
的用法示例。
在下文中一共展示了Num::pad方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_index
/**
* Controller default action
*/
public function action_index()
{
$year = (int) $this->request->param('year');
$month = (int) $this->request->param('month');
$day = (int) $this->request->param('day');
$week = (int) $this->request->param('week');
// Initial view shows todays events and current week
if (!$day && !$month && !$week) {
// Create todays events
$this->stamp_begin = strtotime('today');
$this->stamp_end = strtotime('tomorrow -1 second');
if ($events = $this->_events()) {
$section_today = $this->sections_events($events);
}
$week = date('W');
}
$year = $year ? $year : date('Y');
$month = $month ? $month : date('n');
if ($week) {
// Show week
$this->stamp_begin = strtotime($year . '-W' . Num::pad($week));
$this->stamp_end = strtotime('next week', $this->stamp_begin);
$this->stamp_next = $this->stamp_end;
$this->stamp_previous = strtotime('last week', $this->stamp_begin);
$section_pagination = $this->section_pagination('week');
$this->view->title = __('Events') . ' ' . Date::format(Date::DM_SHORT, $this->stamp_begin) . ' - ' . Date::format(Date::DMY_SHORT, $this->stamp_end);
} else {
if ($day) {
// Show day
$this->stamp_begin = mktime(0, 0, 0, $month, $day, $year);
$this->stamp_end = strtotime('tomorrow -1 second', $this->stamp_begin);
$this->stamp_next = $this->stamp_end;
$this->stamp_previous = strtotime('yesterday', $this->stamp_begin);
$section_pagination = $this->section_pagination('day');
$this->view->title = __('Events') . ' ' . Date::format(Date::DMY_SHORT, $this->stamp_begin);
} else {
// Show month
$this->stamp_begin = mktime(0, 0, 0, $month, 1, $year);
$this->stamp_end = strtotime('next month', $this->stamp_begin);
$this->stamp_next = $this->stamp_end;
$this->stamp_previous = strtotime('last month', $this->stamp_begin);
$section_pagination = $this->section_pagination('month');
$this->view->title = __('Events') . ' ' . Date::format(Date::MY_LONG, $this->stamp_begin);
}
}
$events = $this->_events();
// Today
if (isset($section_today)) {
$this->view->add(View_Page::COLUMN_CENTER, $section_today);
}
// Filters
$this->view->add(View_Page::COLUMN_CENTER, $this->section_filters($events));
// Pagination
$this->view->add(View_Page::COLUMN_CENTER, $section_pagination);
// Event list
$this->view->add(View_Page::COLUMN_CENTER, $this->sections_events($events));
// Pagination
$this->view->add(View_Page::COLUMN_CENTER, $section_pagination);
// Calendar
$this->view->add(View_Page::COLUMN_RIGHT, $this->section_calendar());
// Hot events
$this->view->add(View_Page::COLUMN_RIGHT, $this->section_events_hot());
// New events
$this->view->add(View_Page::COLUMN_RIGHT, $this->section_events_new());
// Updated events
$this->view->add(View_Page::COLUMN_RIGHT, $this->section_events_updated());
// Set actions
if (Permission::has(new Model_Event(), Model_Event::PERMISSION_CREATE)) {
$this->view->actions[] = array('link' => Route::get('events')->uri(array('action' => 'add')), 'text' => '<i class="fa fa-plus-circle"></i> ' . __('Create event'), 'class' => 'btn-primary');
}
// Load events
$this->view->stamp = $this->stamp_begin;
}