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


PHP Model_Category::get_categories方法代码示例

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


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

示例1: action_index

 public function action_index()
 {
     $page = Input::get('page') ? Input::get('page') : 1;
     $query = Input::get('query') ? Input::get('query') : "";
     if (strlen($query)) {
         $data['news'] = DB::select('*')->from('news')->where('news_title', 'LIKE', '%' . $query . '%')->limit(30)->offset(($page - 1) * 30)->order_by('id', 'desc')->execute()->as_array();
     } else {
         $data['news'] = DB::select('*')->from('news')->limit(30)->offset(($page - 1) * 30)->order_by('id', 'desc')->execute()->as_array();
     }
     $total_rec = DB::count_last_query();
     $data['total_page'] = ceil($total_rec / 30);
     $data['page'] = $page;
     $config = array('pagination_url' => "", 'total_items' => $total_rec, 'per_page' => 30, 'uri_segment' => 2, 'current_page' => $page);
     $pagination = Pagination::forge('pagenav', $config);
     $data['pagination'] = $pagination->render();
     $cats = Model_Category::get_categories();
     $this->theme->set_template('index');
     $this->theme->get_template()->set_global('current_menu', "News", false);
     $this->theme->get_template()->set_global('current_menu_desc', "จัดการข่าวทั้งหมดในระบบ", false);
     $this->theme->get_template()->set('breadcrumb', array(array('title' => "Home", 'icon' => "fa-home", 'link' => Uri::create('home'), 'active' => false), array('title' => "News", 'icon' => "eicon-newspaper", 'link' => "", 'active' => true)));
     $this->theme->get_template()->set_global('query', $query, false);
     $this->theme->get_template()->set_global('cats', $cats, false);
     $this->theme->set_partial('sidebar', 'common/sidebar');
     $this->theme->set_partial('content', 'news/index')->set($data);
 }
开发者ID:ksakuntanak,项目名称:buffohero_cms,代码行数:25,代码来源:news.php

示例2: action_edit


//.........这里部分代码省略.........
                     if (Input::post('job_type') == "fulltime") {
                         $job->job_title = Input::post('job_title_fulltime');
                         $job->job_areas = Input::post('job_areas');
                         $job->job_position = Input::post('job_position');
                         $job->job_welfare = Input::post('job_welfare');
                         $job->job_salary = Input::post('job_salary');
                     } else {
                         if (Input::post('job_type') == "project") {
                             $job->job_title = Input::post('job_title_project');
                             $job->job_budget = Input::post('job_budget');
                             $job->job_budget_type = Input::post('job_budget_type');
                             $job->job_budget_unit = Input::post('job_budget_unit');
                         } else {
                             if (Input::post('job_type') == "contest") {
                                 $job->job_title = Input::post('job_title_contest');
                                 $job->job_prize = Input::post('job_prize');
                             }
                         }
                     }
                     if ($job->save()) {
                         /* generate tags */
                         $title = $job->job_title;
                         $title_tags = parent::split_tags($title);
                         if ($job->employer_id) {
                             $employer = Model_Employer::find($job->employer_id);
                             $company_tags = parent::split_tags($employer->employer_name);
                         } else {
                             $company_tags = array();
                         }
                         $tags = array_merge($title_tags, $company_tags);
                         foreach ($tags as $t) {
                             $t = strtolower(trim($t));
                             if (!strlen($t) || $t == " ") {
                                 continue;
                             }
                             $tag = Model_JobTag::get_tag($job->id, $t);
                             if (!$tag) {
                                 $tag = Model_JobTag::forge(array('job_id' => $job->id, 'tag_name' => $t, 'created_at' => time()));
                                 $tag->save();
                             }
                         }
                         /* */
                         /* generate ref. no. */
                         if (!strlen($job->ref_no)) {
                             $job->job_tags = implode(",", Model_JobTag::get_tags_by_job($job->id));
                             $job->ref_no = "J" . str_pad($job->id, 7, "0", STR_PAD_LEFT);
                             $job->save();
                         }
                         $qualifications = explode(",", Input::post('job_qualifications'));
                         foreach ($qualifications as $q) {
                             if (!strlen(trim($q))) {
                                 continue;
                             }
                             $qual = Model_JobQualification::get_qualification($job->id, trim($q));
                             if (!$qual) {
                                 $qual = Model_JobQualification::forge(array('job_id' => $job->id, 'qualification_title' => trim($q), 'created_at' => time()));
                                 $qual->save();
                             }
                         }
                         $skills = explode(",", Input::post('job_skills'));
                         foreach ($skills as $s) {
                             if (!strlen(trim($s))) {
                                 continue;
                             }
                             $skill = Model_JobSkill::get_skill($job->id, trim($s));
                             if (!$skill) {
                                 $skill = Model_JobSkill::forge(array('job_id' => $job->id, 'skill_title' => trim($s), 'created_at' => time()));
                                 $skill->save();
                             }
                         }
                         Session::set_flash('success', 'Updated job #' . $id);
                         Response::redirect('job');
                     } else {
                         Session::set_flash('error', 'Could not update job #' . $id);
                     }
                 }
             } else {
                 $msg = '<ul>';
                 foreach ($val->error() as $field => $error) {
                     $msg .= '<li>' . $error->get_message() . '</li>';
                 }
                 $msg .= '</ul>';
                 Session::set_flash('error', $msg);
             }
         }
         $this->theme->get_template()->set_global('job', $job, false);
         // $this->theme->get_template()->set_global('employer', $employer, false);
         $this->theme->get_template()->set_global('cats', Model_Category::get_categories(), false);
         $this->theme->get_template()->set_global('subcats', json_encode(Model_Subcategory::get_all_subcats()), false);
         $current_subcats = Model_Subcategory::get_subcats_by_category($job->cat_id);
         $this->theme->get_template()->set_global('current_subcats', $current_subcats, false);
         $this->theme->get_template()->set_global('provinces', Model_Province::get_provinces("th"), false);
         $this->theme->get_template()->set_global('employers', Model_Employer::get_employers_for_dropdown(), false);
         $this->theme->get_template()->set_global('page_specific_js', "form_job.js", false);
         $this->theme->set_partial('sidebar', 'common/sidebar');
         $this->theme->set_partial('left', 'job/edit');
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }
开发者ID:ksakuntanak,项目名称:buffohero_cms,代码行数:101,代码来源:job.php


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