Esempio n. 1
1
 public function post($news_id, $p = 0)
 {
     $category = $this->db->query("SELECT * FROM td_news WHERE news_id = '" . $news_id . "'")->result_array();
     $category['p_c_name'] = $this->db->query("SELECT * FROM td_category WHERE id = '" . $category[0]['category'] . "'")->result_array();
     $category['menus'] = $this->db->query('SELECT * FROM td_category LIMIT 7')->result_array();
     $category['top_banner'] = $this->db->query('SELECT * FROM td_sponsor WHERE sp_pos = "top"')->result_array();
     $category['current_news'] = $this->db->query('SELECT * FROM td_news LIMIT 20')->result_array();
     $category['breking_news'] = $this->db->query('SELECT * FROM td_news WHERE slider = 1')->result_array();
     $category['previous'] = $this->db->query('select * from td_news where news_id = (select max(news_id) from td_news where news_id < "' . $news_id . '")')->result_array();
     $category['next'] = $this->db->query('select * from td_news where news_id = (select min(news_id) from td_news where news_id > "' . $news_id . '")')->result_array();
     $limit = 6;
     //how many items to show per page
     $page = $p;
     if ($page) {
         $start = ($page - 1) * $limit;
     } else {
         $start = 0;
     }
     $category['post_data'] = $this->db->query("select * from td_news where news_id = '" . $news_id . "' LIMIT {$start}, {$limit} ")->result_array();
     $total_pages = $this->db->query("select * from td_news where news_id = '" . $news_id . "'")->num_rows();
     require_once APPPATH . "libraries/pagination.php";
     $category['res'] = create_pagination('td_news', base_url() . 'index.php/gallery/galleryImages/' . $news_id, $limit, $page, $total_pages);
     //$this->load->view('table',$result);
     $category['total_item'] = $total_pages;
     $this->load->view('post', $category);
 }
 public function index($type = 'na', $value = 'na', $start = 0)
 {
     // Check for btnAction
     if ($action = $this->input->post('btnAction')) {
         $this->{$action}();
     }
     // Get filter if set
     if ($type != 'na' and $value != 'na') {
         $filter = array($type => $value);
         $products = $this->products_m->get_products($filter, $start, $this->perpage);
         $this->data->{$type} = $value;
     } else {
         $products = $this->products_m->get_products(array(), $start, $this->perpage);
     }
     // Build product data
     foreach ($products as &$product) {
         $product = $this->products_m->get_product($product['id']);
     }
     // Assign variables
     $this->data->products = $products;
     $this->data->count = $this->products_m->get_products(isset($filter) ? $filter : array(), 0, 0);
     $this->data->count = $this->data->count ? count($this->data->count) : 0;
     $this->data->pagination = create_pagination('/admin/firesale/products/' . ($type != 'na' ? $type : 'na') . '/' . ($value != 'na' ? $value : 'na') . '/', $this->data->count, $this->perpage, 6);
     $this->data->categories = array(0 => lang('firesale:label_filtersel')) + $this->categories_m->dropdown_values();
     // Add page data
     $this->template->title(lang('firesale:title') . ' ' . lang('firesale:sections:products'))->set($this->data);
     // Fire events
     Events::trigger('page_build', $this->template);
     // Build page
     $this->template->build('admin/products/index');
 }
Esempio n. 3
0
 /**
  * View
  *
  * Loads the topic and displays it with all replies.
  *
  * @param	int	$topic_id	Id of the topic to display
  * @param	int	$offset		The offset used for pagination
  * @access	public
  * @return	void
  */
 public function view($topic_id, $offset = 0)
 {
     // Update view counter
     $this->forum_posts_m->add_topic_view($topic_id);
     // Pagination junk
     $per_page = '10';
     $pagination = create_pagination('forums/topics/view/' . $topic_id, $this->forum_posts_m->count_posts_in_topic($topic_id), $per_page, 5);
     if ($offset < $per_page) {
         $offset = 0;
     }
     $pagination['offset'] = $offset;
     // End Pagination
     // If topic or forum do not exist then 404
     $topic = $this->forum_posts_m->get($topic_id) or show_404();
     $forum = $this->forums_m->get($topic->forum_id) or show_404();
     // Get a list of posts which have no parents (topics) in this forum
     $topic->posts = $this->forum_posts_m->get_posts_by_topic($topic_id, $offset, $per_page);
     foreach ($topic->posts as &$post) {
         $post->author = $this->forum_posts_m->author_info($post->author_id);
         $post->author->post_count = $this->forum_posts_m->count_user_posts($post->author_id);
     }
     $this->data->topic =& $topic;
     $this->data->forum =& $forum;
     $this->data->pagination =& $pagination;
     // Create page
     $this->template->title($topic->title);
     $this->template->set_breadcrumb($forum->title, 'forums/view/' . $forum->id);
     $this->template->set_breadcrumb($topic->title);
     $this->template->build('posts/view', $this->data);
 }
Esempio n. 4
0
 /**
  * Show all created alert posts
  */
 public function index()
 {
     //set the base/default where clause
     $base_where = array('show_future' => true, 'status' => 'all');
     //add post values to base_where if f_module is posted
     /*if ($this->input->post('f_category'))
     		{
     			$base_where['category'] = $this->input->post('f_category');
     		}*/
     if ($this->input->post('f_status')) {
         $base_where['status'] = $this->input->post('f_status');
     }
     if ($this->input->post('f_keywords')) {
         $base_where['keywords'] = $this->input->post('f_keywords');
     }
     // Create pagination links
     $total_rows = $this->alert_m->count_by($base_where);
     $pagination = create_pagination('admin/alert/index', $total_rows);
     // Using this data, get the relevant results
     $alert = $this->alert_m->limit($pagination['limit'], $pagination['offset'])->get_many_by($base_where);
     //do we need to unset the layout because the request is ajax?
     $this->input->is_ajax_request() and $this->template->set_layout(false);
     $this->template->title($this->module_details['name'])->append_js('admin/filter.js')->set_partial('filters', 'admin/partials/filters')->set('pagination', $pagination)->set('alert', $alert);
     $this->input->is_ajax_request() ? $this->template->build('admin/tables/posts') : $this->template->build('admin/index');
 }
Esempio n. 5
0
 /**
  * Entries Index
  *
  * @access	private
  * @return	void
  */
 public function index()
 {
     $offset_uri = 6;
     $pagination_uri = 'admin/streams/entries/index/' . $this->data->stream->id;
     // -------------------------------------
     // Get fields for headers and add specials
     // -------------------------------------
     $this->data->stream_fields = $this->streams_m->get_stream_fields($this->data->stream_id);
     $this->data->stream_fields->id->field_name = lang('streams.id');
     $this->data->stream_fields->created->field_name = lang('streams.created_date');
     $this->data->stream_fields->updated->field_name = lang('streams.updated_date');
     $this->data->stream_fields->created_by->field_name = lang('streams.created_by');
     $offset = $this->uri->segment($offset_uri, 0);
     if ($this->data->stream->sorting == 'custom') {
         // We need some variables to use in the sort. I guess.
         $this->template->append_metadata('<script type="text/javascript" language="javascript">var stream_id=' . $this->data->stream->id . ';var stream_offset=' . $offset . ';</script>');
         // We want to sort this shit
         $this->template->append_metadata(js('entry_sorting.js', 'streams'));
         // Comeon' Livequery! You're goin' in!
         $this->template->append_metadata(js('jquery.livequery.js', 'streams'));
     }
     // -------------------------------------
     // Get data
     // -------------------------------------
     $this->db->limit($this->settings->item('records_per_page'), $offset);
     $this->data->data = $this->streams_m->get_stream_data($this->data->stream, $this->data->stream_fields, $this->settings->item('records_per_page'), $this->uri->segment($offset_uri));
     // -------------------------------------
     // Pagination
     // -------------------------------------
     $this->data->pagination = create_pagination($pagination_uri, $this->db->count_all(STR_PRE . $this->data->stream->stream_slug), $this->settings->item('records_per_page'), 6);
     // -------------------------------------
     // Build Pages
     // -------------------------------------
     $this->template->build('admin/entries/index', $this->data);
 }
Esempio n. 6
0
 /**
  * Show all inactive users
  * @access public
  * @return voud
  */
 public function inactive()
 {
     $this->data->pagination = create_pagination('admin/users/inactive', $this->data->inactive_user_count);
     $this->data->users = $this->users_m->limit($this->data->pagination['limit'])->order_by('users.id', 'desc')->get_many_by('active', 0);
     // Render the view
     $this->template->title($this->module_details['name'], lang('user_inactive_title'))->build('admin/index', $this->data);
 }
Esempio n. 7
0
 /**
  * List all users
  */
 public function index()
 {
     $base_where = array('active' => 0);
     // ---------------------------
     // User Filters
     // ---------------------------
     // Determine active param
     $base_where['active'] = $this->input->post('f_module') ? (int) $this->input->post('f_active') : $base_where['active'];
     // Determine group param
     $base_where = $this->input->post('f_group') ? $base_where + array('group_id' => (int) $this->input->post('f_group')) : $base_where;
     // Keyphrase param
     $base_where = $this->input->post('f_keywords') ? $base_where + array('name' => $this->input->post('f_keywords')) : $base_where;
     // Create pagination links
     $pagination = create_pagination('admin/users/index', $this->user_m->count_by($base_where));
     //Skip admin
     $skip_admin = $this->current_user->group != 'admin' ? 'admin' : '';
     // Using this data, get the relevant results
     $users = $this->user_m->order_by('active', 'desc')->where_not_in('name', $skip_admin)->limit($pagination['limit'])->get_many_by($base_where);
     // Unset the layout if we have an ajax request
     if ($this->input->is_ajax_request()) {
         $this->template->set_layout(FALSE);
     }
     // Render the view
     $this->template->title($this->module_details['name'])->set('pagination', $pagination)->set('users', $users)->set_partial('filters', 'admin/partials/filters')->append_js('admin/filter.js');
     $this->input->is_ajax_request() ? $this->template->build('admin/tables/users') : $this->template->build('admin/index');
 }
Esempio n. 8
0
 public function index()
 {
     $total_rows = $this->admin_m->getData('users')->num_rows();
     $pagination = create_pagination(ADMIN_URL . '/user/', $total_rows, '', 3);
     $data = $this->admin_m->getData('users', array(), $pagination)->result_array();
     $this->template->title('Mexious Photography', 'User')->set('data', $data)->set('pagination', $pagination)->build('admin/user_index');
 }
Esempio n. 9
0
 public function index()
 {
     $rows = $this->portfolio_m->count_all();
     $pagination = create_pagination('admin/portfolio/index', $rows);
     $projects = $this->portfolio_m->list_projects();
     $this->template->title($this->module_details['name'])->set('pagination', $pagination)->set('projects', $projects)->build('admin/index');
 }
Esempio n. 10
0
 public function index()
 {
     $total_rows = $this->blog_m->getDataPost()->num_rows();
     $pagination = create_pagination(ADMIN_URL . '/blog/', $total_rows, '', 3);
     $data = $this->blog_m->getDataPost(array(), $pagination)->result_array();
     $this->template->title('Mexious Photography', 'Blog')->set('data', $data)->set('pagination', $pagination)->build('admin/blog_index');
 }
Esempio n. 11
0
 function view($forum_id = 0, $offset = 0)
 {
     // Check if forum exists, if not 404
     ($forum = $this->forums_m->get($forum_id)) || show_404();
     // Pagination junk
     $per_page = '25';
     $pagination = create_pagination('forums/view/' . $forum_id, $this->forum_posts_m->count_topics_in_forum($forum_id), $per_page, 4);
     if ($offset < $per_page) {
         $offset = 0;
     }
     $pagination['offset'] = $offset;
     // End Pagination
     // Get all topics for this forum
     $forum->topics = $this->forum_posts_m->get_topics_by_forum($forum_id, $offset, $per_page);
     // Get a list of posts which have no parents (topics) in this forum
     foreach ($forum->topics as &$topic) {
         $topic->post_count = $this->forum_posts_m->count_posts_in_topic($topic->id);
         $topic->last_post = $this->forum_posts_m->last_topic_post($topic->id);
         if (!empty($topic->last_post)) {
             $topic->last_post->author = $this->forum_posts_m->author_info($topic->last_post->author_id);
         }
     }
     $this->data->forum =& $forum;
     $this->data->pagination = $pagination;
     $this->template->set_breadcrumb('Forums', 'forums');
     $this->template->set_breadcrumb($forum->title);
     $this->template->build('forum/view', $this->data);
 }
Esempio n. 12
0
 function inactive()
 {
     $total_rows = $this->users_m->countUsers(array('active' => 1));
     $this->data->pagination = create_pagination('admin/users/inactive', $total_rows);
     $inactive_criteria = array('active' => 0, 'limit' => $this->data->pagination['limit'], 'order' => 'id desc');
     $this->data->users = $this->users_m->getUsers($inactive_criteria);
     $this->layout->create('admin/inactive', $this->data);
 }
Esempio n. 13
0
 /**
  * List all variables
  */
 public function index()
 {
     // Create pagination links
     $this->template->pagination = create_pagination('admin/variables/index', $this->variables_m->count_all());
     // Using this data, get the relevant results
     $this->template->variables = $this->variables_m->limit($this->template->pagination['limit'])->get_all();
     $this->template->title($this->module_details['name'])->append_js('module::variables.js')->build('admin/index');
 }
Esempio n. 14
0
 /**
  * List all redirects
  * @access public
  * @return void
  */
 public function index()
 {
     // Create pagination links
     $total_rows = $this->redirect_m->count_all();
     $this->data->pagination = create_pagination('admin/redirects/index', $total_rows);
     // Using this data, get the relevant results
     $this->data->redirects = $this->redirect_m->order_by('`from`')->limit($this->data->pagination['limit'])->get_all();
     $this->template->build('admin/index', $this->data);
 }
Esempio n. 15
0
 function index()
 {
     // Create pagination links
     $total_rows = $this->news_m->count_by(array('show_future' => TRUE, 'status' => 'all'));
     $this->data->pagination = create_pagination('admin/news/index', $total_rows);
     // Using this data, get the relevant results
     $this->data->news = $this->news_m->limit($this->data->pagination['limit'])->get_many_by(array('show_future' => TRUE, 'status' => 'all'));
     $this->template->build('admin/index', $this->data);
 }
Esempio n. 16
0
 public function index()
 {
     // Create pagination links
     $total_rows = $this->newsletters_m->count_newsletters();
     $this->data->pagination = create_pagination('admin/newsletters/index', $total_rows);
     // Using this data, get the relevant results
     $this->data->newsletters = $this->newsletters_m->get_newsletters(array('order' => 'created_on DESC', 'limit' => $this->data->pagination['limit']));
     $this->template->title($this->module_details['name'], lang('newsletters.templates'))->set('active_section', 'newsletters')->append_js('module::functions.js')->append_css('module::admin.css')->build('admin/index', $this->data);
 }
Esempio n. 17
0
 function index()
 {
     // Create pagination links
     $total_rows = $this->variables_m->count_all();
     $this->data->pagination = create_pagination('admin/variables/index', $total_rows);
     // Using this data, get the relevant results
     $this->data->variables = $this->variables_m->limit($this->data->pagination['limit'])->get_all();
     $this->template->build('admin/index', $this->data);
 }
Esempio n. 18
0
 function index()
 {
     // Create pagination links
     $total_rows = $this->news_m->countArticles(array('show_future' => TRUE, 'status' => 'all'));
     $this->data->pagination = create_pagination('admin/news/index', $total_rows);
     // Using this data, get the relevant results
     $this->data->news = $this->news_m->getNews(array('show_future' => TRUE, 'status' => 'all', 'order' => 'created_on DESC, status', 'limit' => $this->data->pagination['limit']));
     $this->layout->create('admin/index', $this->data);
 }
Esempio n. 19
0
 /**
  * List all sites
  */
 public function index($offset = 0)
 {
     $limit = 20;
     $data->sites = $this->sites_m->limit($limit, $offset)->get_sites();
     // create pagination
     $data->pagination = create_pagination('sites/index', $this->sites_m->count_all(), $limit);
     // Load the view
     $this->template->title(lang('site.sites'))->set('description', lang('site.edit_site_desc'))->build('sites', $data);
 }
Esempio n. 20
0
 /**
  * Get the list of topics
  * @access public
  * @return void
  */
 public function index()
 {
     // should get by topic alone as we use only one table where comments also saved
     $base_where = array('type' => 'topic');
     // as usual pagination stuff
     $pagination = create_pagination('admin/discussion/index', $this->discussion_m->count_by($base_where));
     $topics = $this->discussion_m->limit($pagination['limit'])->get_many_by();
     $this->template->title($this->module_details['name'])->append_css('module::discussion.css')->set('topics', $topics)->set('pagination', $pagination)->build('admin/list_topics');
 }
Esempio n. 21
0
 function index()
 {
     // Create pagination links
     $total_rows = $this->staff_m->countStaff();
     $this->data->pagination = create_pagination('admin/staff/index', $total_rows);
     // Using this data, get the relevant results
     $this->data->staff = $this->staff_m->getStaff(array('limit' => $this->data->pagination['limit']));
     $this->layout->create('admin/index', $this->data);
 }
Esempio n. 22
0
 /**
  * Displays active comments
  * @access public
  * @return void
  */
 public function approved()
 {
     // Create pagination links
     $total_rows = $this->comments_m->count_by('is_active', 1);
     $pagination = create_pagination('admin/comments/approved', $total_rows);
     // get all comments
     $comments = $this->comments_m->limit($pagination['limit'])->order_by('comments.created_on', 'desc')->get_many_by('comments.is_active', 1);
     $this->template->title($this->module_details['name'])->set('comments', process_comment_items($comments))->set('pagination', $pagination)->build('admin/index');
 }
Esempio n. 23
0
 /**
  * Shows the contact messages list.
  */
 public function index()
 {
     $contact_log = $this->contact_m->order_by('sent_at', 'desc')->get_log();
     // Create pagination links
     // Added by Tony
     $total_rows = $this->contact_m->count_all();
     $pagination = create_pagination('admin/contact/index', $total_rows);
     $this->template->set('contact_log', $contact_log)->set('pagination', $pagination)->build('index');
 }
Esempio n. 24
0
 /**
  * Show all created news articles
  * @access public
  * @return void
  */
 public function index()
 {
     // Create pagination links
     $total_rows = $this->news_m->count_by(array('show_future' => TRUE, 'status' => 'all'));
     $pagination = create_pagination('admin/news/index', $total_rows);
     // Using this data, get the relevant results
     $news = $this->news_m->limit($pagination['limit'])->get_many_by(array('show_future' => TRUE, 'status' => 'all'));
     $this->template->title($this->module_details['name'])->set('pagination', $pagination)->set('news', $news)->build('admin/index', $this->data);
 }
Esempio n. 25
0
 function index()
 {
     // Create pagination links
     $total_rows = $this->newsletters_m->countNewsletters();
     $this->data->pagination = create_pagination('admin/newsletters/index', $total_rows);
     // Using this data, get the relevant results
     $this->data->newsletters = $this->newsletters_m->getNewsletters(array('order' => 'created_on DESC', 'limit' => $this->data->pagination['limit']));
     $this->layout->create('admin/index', $this->data);
 }
Esempio n. 26
0
 function index()
 {
     // Create pagination links
     $total_rows = $this->categories_m->countCategories();
     $this->data->pagination = create_pagination('admin/categories/index', $total_rows);
     // Using this data, get the relevant results
     $this->data->categories = $this->categories_m->getCategories(array('limit' => $this->data->pagination['limit']));
     $this->layout->create('admin/index', $this->data);
     return;
 }
Esempio n. 27
0
 /**
  * Index method, lists all categories
  * @access public
  * @return void
  */
 public function index()
 {
     $this->cache->delete_all('modules_m');
     // Create pagination links
     $total_rows = $this->news_categories_m->count_all();
     $this->data->pagination = create_pagination('admin/news/categories/index', $total_rows);
     // Using this data, get the relevant results
     $this->data->categories = $this->news_categories_m->limit($this->data->pagination['limit'])->get_all();
     $this->template->build('admin/categories/index', $this->data);
 }
Esempio n. 28
0
 /**
  * Index method, lists all categories
  * 
  * @return void
  */
 public function index()
 {
     $this->pyrocache->delete_all('modules_m');
     // Create pagination links
     $total_rows = $this->blog_categories_m->count_all();
     $pagination = create_pagination('admin/blog/categories/index', $total_rows, NULL, 5);
     // Using this data, get the relevant results
     $categories = $this->blog_categories_m->order_by('title')->limit($pagination['limit'])->get_all();
     $this->template->title($this->module_details['name'], lang('cat_list_title'))->set('categories', $categories)->set('pagination', $pagination)->build('admin/categories/index');
 }
Esempio n. 29
0
 function index()
 {
     $this->load->helper('text');
     // Create pagination links
     $total_rows = $this->services_m->countServices();
     $this->data->pagination = create_pagination('admin/suppliers/index', $total_rows);
     // Using this data, get the relevant results
     $this->data->services = $this->services_m->getServices(array('limit' => $this->data->pagination['limit']));
     $this->layout->create('admin/index', $this->data);
 }
Esempio n. 30
0
 public function active()
 {
     $this->load->helper('text');
     // Create pagination links
     $total_rows = $this->comments_m->count_by('is_active', 1);
     $this->data->pagination = create_pagination('admin/comments/active', $total_rows);
     // get all comments
     $this->data->comments = $this->comments_m->limit($this->data->pagination['limit'])->get_many_by('comments.is_active', 1);
     $this->template->build('admin/index', $this->data);
 }