コード例 #1
0
ファイル: calendar.php プロジェクト: plusjade/plusjade
 public function day($tool_id, $date)
 {
     if (empty($date)) {
         Event::run('system.404');
     }
     $date = explode('-', $date);
     # strictly need the formated date, else throw page not found.
     if (3 != count($date)) {
         Event::run('system.404');
     }
     list($year, $month, $day) = $date;
     valid::year($year);
     valid::month($month);
     valid::day($day);
     $events = ORM::factory('calendar_item')->where(array('fk_site' => $this->site_id, 'calendar_id' => $tool_id, 'year' => $year, 'month' => $month, 'day' => $day))->find_all();
     $primary = new View('public_calendar/small/day');
     $primary->events = $events;
     $primary->date = "{$year} {$month} {$day}";
     $primary->logged_in = $this->client->can_edit($this->site_id) ? TRUE : FALSE;
     return $primary;
 }
コード例 #2
0
ファイル: blog.php プロジェクト: plusjade/plusjade
 private function show_archive($tool_id, $value, $value2)
 {
     $view = new View("public_blog/blogs/archive");
     $date_search = false;
     # year search
     if (!empty($value) and empty($value2)) {
         valid::year($value);
         $start = $value;
         (int) ($end = $value + 1);
         $date_search = "AND created >= '{$start}' AND created < '{$end}'";
     } elseif (!empty($value) and !empty($value2)) {
         valid::year($value);
         valid::month($value2);
         $month = $value2 + 1;
         if (10 > $month) {
             $month = "0{$month}";
         }
         $start = "{$value}-{$value2}";
         $end = "{$value}-{$month}";
         $date_search = "AND created >= '{$start}' AND created < '{$end}'";
     }
     $blog_posts = $this->db->query("\n      SELECT blog_posts.*, \n      DATE_FORMAT(created, '%Y') as year,\n      DATE_FORMAT(created, '%M') as month,\n      DATE_FORMAT(created, '%e') as day\n      FROM blog_posts \n      WHERE blog_posts.blog_id = '{$tool_id}' \n      AND blog_posts.fk_site = '{$this->site_id}'\n      {$date_search}\n      ORDER BY created\n      LIMIT 0, 10\n    ");
     $view->blog_posts = $blog_posts;
     return $view;
 }
コード例 #3
0
ファイル: events.php プロジェクト: anqqa/Anqh
 /**
  * Week view
  *
  * @param  int  $year
  * @param  int  $week
  */
 public function week($year, $week)
 {
     $this->tab_id = 'browse';
     if (valid::year($year) && valid::week($week)) {
         $this->type = 'week';
         $this->date->setISODate($year, $week);
         // check for new years fix
         if ($week == 1) {
             $saturday = new DateTime();
             $saturday->setISODate($year, $week, 6);
             $this->date = $saturday;
         }
         $this->page_title = text::title(__('Week') . ' ' . $this->date->format('W/Y'));
         $this->breadcrumb[] = html::anchor(Router::$routed_uri, html::specialchars($this->page_title));
         $this->_build_calendar();
     }
 }