本文整理汇总了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);
}