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


PHP Model_Category::query方法代码示例

本文整理汇总了PHP中Model_Category::query方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Category::query方法的具体用法?PHP Model_Category::query怎么用?PHP Model_Category::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model_Category的用法示例。


在下文中一共展示了Model_Category::query方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_Department

 public function action_Department($Kid)
 {
     //CSRF対策
     $this->data['token_key'] = Config::get('security.csrf_token_key');
     $this->data['token'] = Security::fetch_token();
     //カテゴリごとの投稿件数を取得
     $count = Model_Post::query()->where('Kid', '=', $Kid)->count();
     //ページネーションの設定(カテゴリごとの投稿表示仕様)
     $config = array('pagination_url' => 'noteshare/list/' . $Kid, 'uri_segment' => 3, 'num_links' => 3, 'per_page' => $this->per_page, 'total_items' => $count, 'show_first' => true, 'show_last' => true);
     $pagination = Pagination::forge('post_pagination', $config);
     $this->data['posts'] = Model_Post::query()->where('Kid', '=', $Kid)->order_by('Ptime', 'desc')->limit($this->per_page)->offset($pagination->offset)->get();
     $this->data['department'] = Model_Category::query()->where('Kid', '=', $Kid)->get();
     $this->action_categorize();
     //homeのビューオブジェクトを生成
     if (!$count) {
         $this->data['error'] = true;
         $view = View::forge('list/DepartmentList', $this->data);
         $view->set_safe('pagination', $pagination);
         //メッセージの定義
     } else {
         $view = View::forge('list/DepartmentList', $this->data);
         $view->set_safe('pagination', $pagination);
     }
     return $view;
 }
开发者ID:nihonLoomba,项目名称:noteshare-,代码行数:25,代码来源:list.php

示例2: action_Edit

 public function action_Edit($Kid = 0)
 {
     //ドロップダウンリストの生成
     $select = Model_College::get_list();
     $Kid and $this->data['category'] = Model_Category::query()->where('Kid', '=', $Kid)->get();
     if (Input::post()) {
         $val = Model_Category::validate();
         if ($val->run()) {
             $query = DB::update('Category')->set(array('Cid' => Input::post('college'), 'Kname' => Input::post('Kname'), 'Kkana' => Input::post('Kkana'), 'luID' => Auth::get_screen_name()))->where('Kid', '=', $Kid)->execute();
             Response::redirect('category');
         } else {
             $this->message = $val->error();
             $view = View::forge('categorymanagement/CategoryEdit', $this->data);
             $view->set_global('message', $this->message, false);
             //ドロップダウン箇所のセット
             $view->set_global('select', $select, false);
         }
     } else {
         $view = View::forge('categorymanagement/CategoryEdit', $this->data);
         $view->set_global('message', $this->message, false);
         //ドロップダウン箇所のセット
         $view->set_global('select', $select, false);
     }
     return $view;
 }
开发者ID:nihonLoomba,项目名称:noteshare-,代码行数:25,代码来源:categorymanagement.php

示例3: action_index

 public function action_index()
 {
     $this->dataGlobal['pageTitle'] = __('backend.category.manage');
     $per_page = floor(Model_Category::count() / 2);
     // Pagination
     $config = array('pagination_url' => \Uri::current(), 'total_items' => Model_Category::count(), 'per_page' => $per_page, 'uri_segment' => 'page');
     $this->data['pagination'] = $pagination = \Pagination::forge('category_pagination', $config);
     // Get categories
     $this->data['categories'] = Model_Category::query()->offset($pagination->offset)->limit($pagination->per_page)->order_by('created_at', 'DESC')->get();
     return \Response::forge(\View::forge('backend/category/index')->set($this->data, null, false));
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:11,代码来源:category.php

示例4: action_show_by_author

 /**
  * Get all categorys from author
  * @param  string $author username
  */
 public function action_show_by_author($author = false)
 {
     $author = $this->data['author'] = \Model_User::query()->where('username', $author)->get_one();
     if (!$author) {
         \Messages::error(__('frontend.author.not-found'));
         \Response::redirect_back(\Router::get('homepage'));
     } else {
         // Pagination
         $config = array('pagination_url' => \Uri::current(), 'total_items' => count($author->posts), 'per_page' => \Config::get('application.pagination.per_page'), 'uri_segment' => 'page');
         $this->data['pagination'] = $pagination = \Pagination::forge('category_pagination', $config);
         // Get categorys
         $this->data['categories'] = Model_Category::query()->where('user_id', $author->id)->order_by('created_at', 'DESC')->offset($pagination->offset)->limit($pagination->per_page)->get();
         return \Response::forge(\View::forge('frontend/category/author')->set($this->data, null, false));
     }
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:19,代码来源:category.php

示例5: action_show_by_category

 public function action_show_by_category($category = false)
 {
     $category = $this->data['category'] = Model_Category::query()->where('slug', $category)->get_one();
     if (!$category) {
         \Messages::error(__('frontend.category.not-found'));
         \Response::redirect_back(\Router::get('homepage'));
     } else {
         // Pagination
         $config = array('pagination_url' => \Uri::current(), 'total_items' => $category->post_count, 'per_page' => \Config::get('application.pagination.per_page'), 'uri_segment' => 'page');
         $this->data['pagination'] = $pagination = \Pagination::forge('category_pagination', $config);
         // Get posts
         $this->data['posts'] = Model_Post::query()->where('category_id', $category->id)->order_by('created_at', 'DESC')->get();
         return \Response::forge(\View::forge('frontend/post/category')->set($this->data, null, false));
     }
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:15,代码来源:post.php

示例6: get_navSubCategories

 public function get_navSubCategories()
 {
     /*
      * Initially get sub categories by post slug and default to world category
      * On subsequent requests get sub categories by category slug
      */
     $slug = \Input::get('slug');
     $slugType = \Input::get('slugType');
     /* [ post | category ] */
     $category = false;
     if ($slugType === 'post') {
         $post = Model_Post::query()->where('slug', $slug)->get_one();
         if ($post) {
             $category = Model_Category::query()->where('id', $post->category_id)->get_one();
             $category = Model_Category::query()->where('id', $category->parent_id)->get_one();
             if (!$category) {
                 $category = Model_Category::query()->where('id', $post->category_id)->get_one();
             }
         } else {
             $cat_id = 1;
             $cat_name = 'world';
         }
     } elseif ($slugType == 'category') {
         $category = Model_Category::query()->where('slug', $slug)->get_one();
     }
     if (!$category) {
         $cat_id = 1;
         $cat_name = 'world';
     } else {
         $cat_id = $category->id;
         $cat_name = $category->name;
     }
     $subCategories = Model_Category::query()->where('parent_id', $cat_id)->get();
     $posts = array();
     $subSections = array();
     $gallery = array();
     $data = array();
     foreach ($subCategories as $key => $cat) {
         $subCategories[$key]['posts'] = Model_Post::query()->where('category_id', $cat->id)->related('galleries')->limit(3)->get();
         foreach ($subCategories[$key]['posts'] as $k => $post) {
             $gallery[$key][$k] = \Model_Gallery::query()->where('post_id', $post->id)->related('asset')->get_one();
         }
     }
     $subCategories['section'] = $cat_name;
     return $this->response = $subCategories;
 }
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:46,代码来源:navigation.php

示例7: action_index

 public function action_index()
 {
     $data = array();
     $message = '';
     $username = Auth::get_screen_name();
     $class = Auth::get('classID');
     $data['posts'] = Model_Post::query()->where('username', '=', $username)->order_by('Ptime', 'desc')->get();
     $data['users'] = Model_Users::query()->where('username', '=', $username)->get();
     //同じクラスのユーザを取得
     $data['classname'] = Model_Class::query()->where('classID', '=', $class)->get();
     $data['classuser'] = Model_Users::query()->where('classID', '=', $class)->get();
     $data['categorize'] = Model_Category::query()->where('df', '=', '0')->get();
     $view = View::forge('mypage/mypage', $data);
     $view->username = $username;
     $view->set_global('message', $message, false);
     return $view;
 }
开发者ID:nihonLoomba,项目名称:noteshare-,代码行数:17,代码来源:mypage.php

示例8: action_send

 public function action_send($Pid = 0)
 {
     $this->action_csrf();
     $val = Validation::forge();
     $val->add('sentence', '通報内容')->add_rule('required');
     $username = Auth::get_screen_name();
     $address = Auth::get_email();
     $problem = Input::post('problem');
     $email = Email::forge();
     $email->from('yuichi465@gmail.com');
     $email->to($address);
     $email->subject('投稿ID ' . $Pid . '番に対する「' . $problem . '」の通報がありました。');
     $body = Input::post('sentence');
     $email->body($body);
     if ($val->run()) {
         if (Security::check_token()) {
             try {
                 $email->send();
                 $view = View::forge('problemreport/success');
                 return $view;
             } catch (\EmailValidationFailedException $e) {
                 $view = View::forge('welcome/404');
                 return $view;
             } catch (\EmailSendingFailedException $e) {
             }
         } else {
             $this->error['csrf'] = '「CSRFエラー」です。<br>もう一度最初からアクセスし直してください。。';
             $this->action_csrf();
             $this->action_post($Pid);
             $this->data['categorize'] = Model_Category::query()->where('df', '=', '0')->get();
             $view = View::forge('problemreport/ProblemReport', $this->data);
             $view->set_global('error', $this->error, false);
             return $view;
         }
     } else {
         $this->error = $val->error();
         $this->action_csrf();
         $this->action_post($Pid);
         $this->data['categorize'] = Model_Category::query()->where('df', '=', '0')->get();
         $view = View::forge('problemreport/ProblemReport', $this->data);
         $view->set_global('error', $this->error, false);
         return $view;
     }
 }
开发者ID:nihonLoomba,项目名称:noteshare-,代码行数:44,代码来源:problemreport.php

示例9: valid_by

 public static function valid_by($where = array())
 {
     $result = Model_Category::query()->where($where);
     return $result->count() > 0;
 }
开发者ID:khoapld,项目名称:wjshop,代码行数:5,代码来源:category.php

示例10: action_categorise

 public function action_categorise()
 {
     $this->data['categorize'] = Model_Category::query()->where('df', '=', '0')->get();
     return $this->data;
 }
开发者ID:nihonLoomba,项目名称:noteshare-,代码行数:5,代码来源:changeregistration.php

示例11: action_SerchResultUser

 public function action_SerchResultUser()
 {
     if (Input::get('keywords2')) {
         $search = Input::get('keywords2');
         //検索文字を空白(全角又は半角)で区切って配列に代入
         $keywords = preg_split('/ |\\s/', $search);
         foreach ($keywords as $key => $keyword) {
             $keywords[$key] = ' (Title LIKE "%' . $keyword . '%"';
             $keywords[$key] .= 'OR Pcontent LIKE "%' . $keyword . '%")';
         }
         $where = implode('OR', $keywords);
         $sql = sprintf("SELECT * FROM Post JOIN users ON Post.username = users.username WHERE %s ORDER BY `Pid` DESC", $where);
         $data['posts'] = DB::query($sql)->execute()->as_array();
         if (empty($data['posts'])) {
             //該当する投稿がなかった時
             $error = '該当する投稿はありませんでした。';
             $data['categorize'] = Model_Category::query()->where('df', '=', '0')->get();
             $view = View::forge('search/SearchResultUser', $data);
             $view->set_global('error', $error, false);
         } else {
             //該当する投稿があった時
             $error = '';
             $data['categorize'] = Model_Category::query()->where('df', '=', '0')->get();
             $data['coment'] = Model_Post::find('all');
             $view = View::forge('search/SearchResultUser', $data);
             $view->set_global('error', $error, false);
         }
     } else {
         //検索バーに値が入力されていなかった時
         $error = '検索する値が入力されていません。';
         $data['categorize'] = Model_Category::query()->where('df', '=', '0')->get();
         $view = View::forge('search/SearchResultUser', $data);
         $view->set_global('error', $error, false);
     }
     return $view;
 }
开发者ID:nihonLoomba,项目名称:noteshare-,代码行数:36,代码来源:search.php


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