コード例 #1
0
ファイル: cli.php プロジェクト: comdan66/zeusdesign
 public function sitmap()
 {
     $this->load->library('Sitemap');
     // 基礎設定
     $domain = 'http://www.zeusdesign.com.tw';
     $sit_map = new Sitemap($domain);
     $sit_map->setPath(FCPATH . 'sitemap' . DIRECTORY_SEPARATOR);
     $sit_map->setDomain($domain);
     // main pages
     $sit_map->addItem('/', '0.5', 'weekly', date('c'));
     $sit_map->addItem('/abouts/', '0.5', 'weekly', date('c'));
     $sit_map->addItem('/contacts/', '0.5', 'weekly', date('c'));
     $sit_map->addItem('/works/', '0.8', 'daily', date('c'));
     $sit_map->addItem('/articles/', '0.8', 'daily', date('c'));
     // all articles
     foreach (Article::find('all', array('select' => 'id, title, updated_at', 'order' => 'id DESC', 'conditions' => array('is_visibled = ? AND destroy_user_id IS NULL', Article::IS_VISIBLED))) as $article) {
         $sit_map->addItem('/article/' . $article->site_show_page_last_uri(), '1', 'daily', $article->updated_at->format('c'));
     }
     // all article tags
     foreach (ArticleTag::all(array('select' => 'id')) as $tag) {
         $sit_map->addItem('/article-tag/' . $tag->id . '/articles/', '0.8', 'daily', date('c'));
     }
     // all works
     foreach (Work::find('all', array('select' => 'id, title, updated_at', 'order' => 'id DESC', 'conditions' => array('is_enabled = ? AND destroy_user_id IS NULL', Work::ENABLE_YES))) as $work) {
         $sit_map->addItem('/work/' . $work->site_show_page_last_uri(), '1', 'daily', $work->updated_at->format('c'));
     }
     // all work tags
     foreach (WorkTag::all(array('select' => 'id')) as $tag) {
         $sit_map->addItem('/work-tag/' . $tag->id . '/works/', '0.8', 'daily', date('c'));
     }
     $sit_map->createSitemapIndex($domain . '/sitemap/', date('c'));
 }
コード例 #2
0
ファイル: works.php プロジェクト: comdan66/zeusdesign
 public function index($offset = 0)
 {
     $columns = array(array('key' => 'user_id', 'title' => '作者', 'sql' => 'user_id = ?', 'select' => array_map(function ($user) {
         return array('value' => $user->id, 'text' => $user->name);
     }, User::all(array('select' => 'id, name')))), array('key' => 'title', 'title' => '標題', 'sql' => 'title LIKE ?'), array('key' => 'tag_id', 'title' => '分類', 'sql' => '(id != 0 OR id = ?)', 'select' => array_map(function ($tag) {
         return array('value' => $tag->id, 'text' => $tag->name);
     }, WorkTag::all(array('select' => 'id, name')))));
     $configs = array('admin', $this->get_class(), '%s');
     $conditions = conditions($columns, $configs);
     Work::addConditions($conditions, 'destroy_user_id IS NULL');
     if (($tag_id = OAInput::get('tag_id')) && ($ids = column_array(WorkTagMapping::find('all', array('select' => 'work_id', 'conditions' => array('work_tag_id = ?', $tag_id))), 'work_id'))) {
         Work::addConditions($conditions, 'id IN (?)', $ids);
     }
     $limit = 25;
     $total = Work::count(array('conditions' => $conditions));
     $offset = $offset < $total ? $offset : 0;
     $this->load->library('pagination');
     $pagination = $this->pagination->initialize(array_merge(array('total_rows' => $total, 'num_links' => 5, 'per_page' => $limit, 'uri_segment' => 0, 'base_url' => '', 'page_query_string' => false, 'first_link' => '第一頁', 'last_link' => '最後頁', 'prev_link' => '上一頁', 'next_link' => '下一頁', 'full_tag_open' => '<ul class="pagination">', 'full_tag_close' => '</ul>', 'first_tag_open' => '<li>', 'first_tag_close' => '</li>', 'prev_tag_open' => '<li>', 'prev_tag_close' => '</li>', 'num_tag_open' => '<li>', 'num_tag_close' => '</li>', 'cur_tag_open' => '<li class="active"><a href="#">', 'cur_tag_close' => '</a></li>', 'next_tag_open' => '<li>', 'next_tag_close' => '</li>', 'last_tag_open' => '<li>', 'last_tag_close' => '</li>'), $configs))->create_links();
     $works = Work::find('all', array('offset' => $offset, 'limit' => $limit, 'order' => 'id DESC', 'include' => array('user', 'pictures'), 'conditions' => $conditions));
     Session::setData('admin_works_index_url', current_url());
     return $this->set_tab_index(1)->set_subtitle('作品列表')->add_hidden(array('id' => 'is_enabled_url', 'value' => base_url('admin', $this->get_class(), 'is_enabled')))->load_view(array('works' => $works, 'pagination' => $pagination, 'columns' => $columns));
 }
コード例 #3
0
 public function tags()
 {
     $tags = WorkTag::all(array('select' => 'id, name', 'order' => 'sort ASC', 'include' => array('tags'), 'conditions' => array('work_tag_id = ?', 0)));
     return $this->setUseCssList(true)->load_view(array('tags' => $tags));
 }