当前位置: 首页>>代码示例>>PHP>>正文


PHP Num::pad方法代码示例

本文整理汇总了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;
 }
开发者ID:anqh,项目名称:anqh,代码行数:76,代码来源:events.php


注:本文中的Num::pad方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。