當前位置: 首頁>>代碼示例>>PHP>>正文


PHP header::mybook方法代碼示例

本文整理匯總了PHP中header::mybook方法的典型用法代碼示例。如果您正苦於以下問題:PHP header::mybook方法的具體用法?PHP header::mybook怎麽用?PHP header::mybook使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在header的用法示例。


在下文中一共展示了header::mybook方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: mybook

 function mybook($sort_by = 'NAME', $sort_order = 'asc', $offset = 0)
 {
     if (!isset($_REQUEST['user_id'])) {
         $this->is_logged_in();
     }
     //new model instance
     $this->load->model('mybook_model');
     $this->load->model('log_model');
     $id_user_login = $this->log_model->getId();
     $per_page = 8;
     $offset = $this->uri->segment(2) == '' ? 0 : $this->uri->segment(2);
     $results = $this->mybook_model->SelectAll($per_page, $offset, $sort_by, $sort_order, $id_user_login);
     //load database
     $db_init = $this->load->database('admin_education', TRUE);
     //pagination
     $this->load->library('pagination');
     $config['total_rows'] = $results['num_rows'];
     $config['per_page'] = $per_page;
     $config['next_link'] = 'Trang tiếp »';
     $config['prev_link'] = '« Trang sau';
     $config['num_tag_open'] = '';
     $config['num_tag_close'] = '';
     $config['num_links'] = 10;
     $config['cur_tag_open'] = '<a class="currentpage">';
     $config['cur_tag_close'] = '</a>';
     $config['first_link'] = 'Trang đầu';
     $config['last_link'] = 'Trang cuối';
     $config['base_url'] = "http://myweb.pro.vn/my-book/";
     $config['uri_segment'] = 2;
     $this->pagination->initialize($config);
     $pagination = $this->pagination->create_links();
     if (isset($_REQUEST['category'])) {
         foreach ($db_init->select('*')->from('user_ebook_category')->where('id_u', $id_user_login)->where('name', $_REQUEST['category'])->get()->result_array() as $key) {
         }
         redirect('/book/mybook?id_category=' . $key['id']);
     }
     $user = $this->db->select('*')->from('qtht_users')->where('ID_U', $id_user_login)->get()->result_array();
     foreach ($user as $u) {
     }
     //render view
     $data['book_last_row'] = array();
     $data['book_top_row'] = array();
     if (isset($_REQUEST['id_category'])) {
         $data['id_category'] = $_REQUEST['id_category'];
         $query_result = $db_init->select('*')->from('user_ebook_category')->where('id', $_REQUEST['id_category'])->get()->result_array();
         $data['cate'] = $query_result[0]['name'];
     }
     if (!isset($_REQUEST['id_category'])) {
         $data['id_category'] = '0';
         $data['cate'] = '';
     }
     $data['user_name'] = $u['NAME'];
     $data['user_id'] = $id_user_login;
     $data['elib'] = $results['rows'];
     $data['count_elib'] = $results['num_rows'];
     $data['pagination'] = $pagination;
     $data['category_names'] = $db_init->select('*')->from('user_ebook_category')->where('id_u', $id_user_login)->get()->result_array();
     $data['csrf_test_name'] = $this->security->get_csrf_hash();
     $header = new header();
     $header->mybook('Tủ sách của	' . $u['NAME']);
     $this->load->view('book/user', $data);
 }
開發者ID:quantm,項目名稱:mywebprovn,代碼行數:62,代碼來源:book.php


注:本文中的header::mybook方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。