本文整理匯總了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;
}