public function my($page = 1) { if ($this->session->userdata("auth_type") != "user") { show_404(); return; } $params["where"]["user_id"] = $this->session->userdata("user_id"); $cnt_banners = $this->Banners_model->cnt_banners($params); $items_on_page = $this->pg_module->get_module_config('banners', 'items_per_page'); $this->load->helper('sort_order'); $page = get_exists_page_number($page, $cnt_banners, $items_on_page); $banners = $this->Banners_model->get_banners($page, $items_on_page, array("id" => "DESC"), $params); // get place objects for banner if ($banners) { $this->load->model('banners/models/Banner_place_model'); foreach ($banners as $key => $banner) { $banners[$key]['banner_place_obj'] = $banner['banner_place_id'] ? $this->Banner_place_model->get($banner['banner_place_id']) : null; } } $this->template_lite->assign('banners', $banners); $this->load->helper("navigation"); $page_data = get_user_pages_data(site_url() . "banners/my/", $cnt_banners, $items_on_page, $page, 'briefPage'); $page_data['date_format'] = $this->pg_date->get_format('date_literal', 'st'); $this->template_lite->assign('page_data', $page_data); $this->Menu_model->breadcrumbs_set_active(l('header_my_banners', 'banners'), site_url() . 'users/account/banners'); $this->template_lite->view('my_list'); }
private function _list_block($type = 'accept', $action = 'view', $page = 1) { $list = array(); $user_id = $this->session->userdata('user_id'); $action = trim(strip_tags($action)); $is_search = $this->input->post('search', true) !== false; $search = $this->input->post('search', true); if ($is_search) { $action = 'search'; $this->session->set_userdata('friendlist_search', $search); } if ($action == 'search') { $search = $this->session->userdata('friendlist_search'); } $order_by['date_update'] = 'DESC'; $items_count = $this->Friendlist_model->get_list_count($user_id, $type, $search); $items_on_page = $this->pg_module->get_module_config('users', 'items_per_page'); $this->load->helper('sort_order'); $page = intval($page) < 1 ? 1 : get_exists_page_number(intval($page), $items_count, $items_on_page); if ($items_count) { $list = $this->Friendlist_model->get_list($user_id, $type, $page, $items_on_page, $order_by, $search); } $url = site_url() . "friendlist/{$this->list_methods[$type]}/{$action}/"; $this->load->helper('navigation'); $page_data = get_user_pages_data($url, $items_count, $items_on_page, $page, 'briefPage'); $page_data['date_format'] = $this->pg_date->get_format('date_literal', 'st'); $page_data['date_time_format'] = $this->pg_date->get_format('date_time_literal', 'st'); $this->template_lite->assign('counts', $this->_get_counts()); $this->template_lite->assign('search', $search); $this->template_lite->assign('page_data', $page_data); $this->template_lite->assign('list', $list); $this->template_lite->assign('type', $type); $this->template_lite->assign('method', $this->list_methods[$type]); $this->template_lite->view('friendlist'); }
public function index($action = 'view', $page = 1) { $list = array(); $user_id = $this->session->userdata('user_id'); $action = trim(strip_tags($action)); $is_search = $this->input->post('search', true) !== false; $search = $this->input->post('search', true); if ($is_search) { $action = 'search'; $this->session->set_userdata('blacklist_search', $search); } if ($action == 'search') { $search = $this->session->userdata('blacklist_search'); } $order_by['date_add'] = 'DESC'; $items_count = $this->Blacklist_model->get_list_count($user_id, $search); $items_on_page = $this->pg_module->get_module_config('users', 'items_per_page'); $this->load->helper('sort_order'); $page = get_exists_page_number(intval($page), $items_count, $items_on_page); if ($items_count) { $list = $this->Blacklist_model->get_list($user_id, $page, $items_on_page, $order_by, $search); } $url = site_url() . "blacklist/index/{$action}"; $this->load->helper('navigation'); $page_data = get_user_pages_data($url, $items_count, $items_on_page, $page, 'briefPage'); $page_data['date_format'] = $this->pg_date->get_format('date_literal', 'st'); $page_data['date_time_format'] = $this->pg_date->get_format('date_time_literal', 'st'); $this->Menu_model->breadcrumbs_set_active(l('blacklist', 'blacklist')); $this->template_lite->assign('count', $this->Blacklist_model->get_list_count($user_id)); $this->template_lite->assign('search', $search); $this->template_lite->assign('page_data', $page_data); $this->template_lite->assign('list', $list); $this->template_lite->view('list'); }
/** * News list * * @param integer $page page of results * @return void */ public function index($page = 1) { $attrs = array(); //$attrs["where"]["id_lang"] = $this->pg_language->current_lang_id; $attrs["where"]["status"] = "1"; $news_count = $this->News_model->get_news_count($attrs); $items_on_page = $this->pg_module->get_module_config('news', 'userside_items_per_page'); $this->load->helper('sort_order'); $page = get_exists_page_number($page, $news_count, $items_on_page); if ($news_count > 0) { $news = $this->News_model->get_news_list($page, $items_on_page, array('date_add' => "DESC"), $attrs); $this->template_lite->assign('news', $news); } $this->load->helper("navigation"); $url = rewrite_link('news', 'index') . "/"; $page_data = get_user_pages_data($url, $news_count, $items_on_page, $page, 'briefPage'); $page_data["date_format"] = $this->pg_date->get_format('date_time_literal', 'st'); $this->template_lite->assign('page_data', $page_data); $this->template_lite->view('list'); }
public function index($page = 1) { $params = array('where' => array('id_to' => $this->_user_id, 'type !=' => 'ignored')); $winks_count = $this->Winks_model->get_count($params); if ($winks_count) { $this->load->helper('sort_order'); $this->load->helper('navigation'); $items_on_page = $this->pg_module->get_module_config('winks', 'items_per_page'); $page = get_exists_page_number($page, $winks_count, $items_on_page); $winks = $this->Winks_model->format($this->Winks_model->get($params, $page, $items_on_page, array('date' => 'DESC'))); $this->config->load('date_formats', TRUE); $page_data = get_user_pages_data(site_url() . 'winks/index/', $winks_count, $items_on_page, $page, 'briefPage'); $page_data['date_time_format'] = $this->pg_date->get_format('date_time_literal', 'st'); $this->template_lite->assign('page_data', $page_data); $this->template_lite->assign('winks', $winks); } $this->Menu_model->breadcrumbs_set_active(l('winks', 'winks')); $this->template_lite->assign('user_id', $this->_user_id); $this->template_lite->view('list'); }
private function _view($tab = 'my_favs', $page = 1) { if (!in_array($tab, $this->_tabs)) { show_404(); } $list = array(); $user_id = $this->session->userdata('user_id'); $search = $this->input->post('search', true); $incoming = $tab === 'i_am_their_fav'; if ($search) { $this->session->set_userdata('favourites_search', $search); } else { $search = $this->session->set_userdata('favourites_search', $search); } $order_by['date_add'] = 'DESC'; $items_count = $this->Favourites_model->get_list_count($user_id, $search, $incoming); $items_on_page = $this->pg_module->get_module_config('users', 'items_per_page'); $this->load->helper('sort_order'); $page = get_exists_page_number(intval($page), $items_count, $items_on_page); if ($items_count) { $list = $this->Favourites_model->get_list($user_id, $page, $items_on_page, $order_by, $search, true, $incoming); } $url = site_url() . 'favourites/' . $tab . '/'; $this->load->helper('navigation'); $page_data = get_user_pages_data($url, $items_count, $items_on_page, $page, 'briefPage'); $page_data['date_format'] = $this->pg_date->get_format('date_literal', 'st'); $page_data['date_time_format'] = $this->pg_date->get_format('date_time_literal', 'st'); if ($search) { $items_count = $this->Favourites_model->get_list_count($user_id, '', $incoming); } $this->Menu_model->breadcrumbs_set_active(l('favourites', 'favourites')); $this->template_lite->assign('count', $items_count); $this->template_lite->assign('search', $search); $this->template_lite->assign('tab', $tab); $this->template_lite->assign('page_data', $page_data); $this->template_lite->assign('list', $list); $this->template_lite->view('list'); }
public function statistic($page = 1) { if ($this->session->userdata('auth_type') != 'user') { show_404(); return; } $user_id = $this->session->userdata('user_id'); $this->load->model("Payments_model"); $params["where"]["id_user"] = $user_id; $payments_count = $this->Payments_model->get_payment_count($params); $items_on_page = $this->pg_module->get_module_config('payments', 'items_per_page'); $this->load->helper('sort_order'); $page = get_exists_page_number($page, $payments_count, $items_on_page); $payments = $this->Payments_model->get_payment_list($page, $items_on_page, array("date_add" => "DESC"), $params); $this->template_lite->assign('payments', $payments); $this->load->helper("navigation"); $page_data = get_user_pages_data(site_url() . "payments/statistic/", $payments_count, $items_on_page, $page, 'briefPage'); $page_data["date_format"] = $this->pg_date->get_format('date_time_literal', 'st'); $this->template_lite->assign('page_data', $page_data); $this->load->model('Menu_model'); $this->Menu_model->breadcrumbs_set_active(l('header_my_payments_statistic', 'payments')); $this->template_lite->view('statistic'); }
function user_payments_history($params = array()) { $CI =& get_instance(); $CI->load->model('payments/models/Payment_currency_model'); if ($CI->session->userdata('auth_type') != 'user') { return false; } $page = !empty($params['page']) ? $params['page'] : 1; $base_url = !empty($params['base_url']) ? $params['base_url'] : ''; $user_id = $CI->session->userdata('user_id'); $CI->load->model('Payments_model'); $params['where']['id_user'] = $user_id; $payments_count = $CI->Payments_model->get_payment_count($params); $items_on_page = $CI->pg_module->get_module_config('payments', 'items_per_page'); $CI->load->helper('sort_order'); $page = get_exists_page_number($page, $payments_count, $items_on_page); $payments = $CI->Payments_model->get_payment_list($page, $items_on_page, array('date_add' => 'DESC'), $params); $CI->template_lite->assign('payments_helper_payments', $payments); $CI->load->helper('navigation'); $page_data = get_user_pages_data($base_url, $payments_count, $items_on_page, $page, 'briefPage'); $page_data['date_format'] = $CI->pg_date->get_format('date_time_literal', 'st'); $CI->template_lite->assign('payments_helper_page_data', $page_data); return $CI->template_lite->fetch('helper_statistic', 'user', 'payments'); }
private function _views($period = 'all', $type = 'my_guests', $page = 1) { if (!in_array($period, array('today', 'week', 'month', 'all'))) { $period = 'all'; } $this->load->model('users/models/Users_views_model'); $data = array(); $criteria = $this->get_advanced_search_criteria($data); $order_by['view_date'] = 'DESC'; if ($type == 'my_guests') { $all_viewers = $this->Users_views_model->get_viewers_daily_unique($this->user_id, null, null, $order_by, array(), $period); } else { $all_viewers = $this->Users_views_model->get_views_daily_unique($this->user_id, null, null, $order_by, array(), $period); } $need_ids = $view_dates = array(); $key = $type == 'my_guests' ? 'id_viewer' : 'id_user'; foreach ($all_viewers as $viewer) { $need_ids[] = $viewer[$key]; $view_dates[$viewer[$key]] = $viewer['view_date']; } $items_count = $need_ids ? $this->Users_model->get_users_count($criteria, $need_ids) : 0; $items_on_page = $this->pg_module->get_module_config('users', 'items_per_page'); $this->load->helper('sort_order'); $this->load->helper("navigation"); $page = get_exists_page_number($page, $items_count, $items_on_page); $url = site_url() . "users/{$type}/{$period}/"; $page_data = get_user_pages_data($url, $items_count, $items_on_page, $page, 'briefPage'); if ($items_count) { $users_list = $this->Users_model->get_users_list_by_key($page, $items_on_page, $order_by, $criteria, $need_ids, true, true); $users = array(); foreach ($need_ids as $uid) { if (isset($users_list[$uid])) { $users[$uid] = $users_list[$uid]; } } $api_data['users'] = $users; $api_data['view_dates'] = $view_dates; } $api_data['views_type'] = $type; $api_data['period'] = $period; $page_data['date_format'] = $this->pg_date->get_format('date_literal', 'st'); $page_data["date_time_format"] = $this->pg_date->get_format('date_time_literal', 'st'); $api_data['page_data'] = $page_data; $this->set_api_content('data', $api_data); }
/** * Return folder content * @param string $folder folder name * @param string $keyword search keyword * @param integer $page page of results */ public function _folder_content($folder, $page) { $current_session = isset($_SESSION['mailbox']) ? $_SESSION['mailbox'] : array(); $where = array(); $where['where']['id_user'] = $this->session->userdata('user_id'); $where['where']['folder'] = $folder; if (isset($current_session['keywords'])) { $keywords = $current_session['keywords']; } else { $keywords = ''; } if (!empty($keywords)) { $fulltext = $this->Mailbox_model->return_fulltext_criteria($keywords . '*', 'BOOLEAN MODE'); $where = array_merge($where, $fulltext); } $this->template_lite->assign('keywords', $keywords); $this->load->helper('sort_order'); $items_on_page = $this->pg_module->get_module_config('mailbox', 'items_per_page'); $mailbox_count = $this->Mailbox_model->get_messages_count($where); $page = get_exists_page_number($page, $mailbox_count, $items_on_page); $order_by = array('date_add' => 'DESC'); $this->Mailbox_model->set_format_settings(array('get_sender' => true, 'get_recipient' => true)); $messages = $this->Mailbox_model->get_messages($where, $page, $items_on_page, $order_by); $this->Mailbox_model->set_format_settings(array('get_sender' => false, 'get_recipient' => false)); $this->template_lite->assign('messages', $messages); $this->load->helper("navigation"); $url = site_url() . 'mailbox/' . $folder . '/'; $page_data = get_user_pages_data($url, $mailbox_count, $items_on_page, $page, 'briefPage'); $this->config->load('date_formats', TRUE); $page_data["date_format"] = $this->pg_date->get_format('date_literal', 'st'); $page_data["date_time_format"] = $this->pg_date->get_format('date_time_literal', 'st'); $page_data["time_format"] = $this->pg_date->get_format('time_literal', 'st'); $this->template_lite->assign('page_data', $page_data); $this->template_lite->assign('folder', $folder); $this->template_lite->assign('page', $page); $user_id = $this->session->userdata('user_id'); $inbox_new_message = $this->Mailbox_model->get_new_messages_count($user_id, 'inbox'); $this->template_lite->assign('inbox_new_message', $inbox_new_message); $spam_new_message = $this->Mailbox_model->get_new_messages_count($user_id, 'spam'); $this->template_lite->assign('spam_new_message', $spam_new_message); $trash_new_message = $this->Mailbox_model->get_new_messages_count($user_id, 'trash'); $this->template_lite->assign('trash_new_message', $trash_new_message); return $this->template_lite->fetch('mailbox_content', 'user', 'mailbox'); }
/** * Return page with list kisses * @param string $folder type page * @param integer $page number page * @return string */ private function _view($folder, $page = 1) { $user_id = $this->session->userdata('user_id'); $this->template_lite->assign('user_id', $user_id); /// breadcrumbs $this->Menu_model->breadcrumbs_set_parent('kisses_item'); $this->Menu_model->breadcrumbs_set_active(l($folder, 'kisses')); switch ($folder) { case 'inbox': $params['where']['user_to'] = $user_id; break; case 'outbox': $params['where']['user_from'] = $user_id; break; } if (!$this->pg_module->get_module_config('kisses', 'system_settings_page')) { $items_on_page = $this->pg_module->get_module_config('kisses', 'items_per_page'); } else { $items_on_page = $this->pg_module->get_module_config('start', 'index_items_per_page'); } $order_by = array('date_created' => 'DESC'); $kisses = $this->Kisses_model->get_list_user_kisses($params, $page, $items_on_page, $order_by); foreach ($kisses as $key => $media) { $kisses[$key]['images'] = $this->Uploads_model->format_upload($this->Kisses_model->image_upload_gid, $media['user_from'], $media['image']); } $upload_config_id = $this->Users_model->upload_config_id; $i = 0; foreach ($kisses as $row) { switch ($folder) { case 'inbox': $user = $row["user_from"]; $kisses[$i]['user_id'] = $user; $kisses[$i]['img_path'] = $user; break; case 'outbox': $user = $row["user_to"]; $kisses[$i]['user_id'] = $user; $kisses[$i]['img_path'] = $user_id; break; } $userinfo = $this->Users_model->get_user_by_id($user); if (!empty($userinfo["user_logo"])) { $userinfo["user_logo"] = $this->Uploads_model->format_upload($upload_config_id, $user, $userinfo["user_logo"]); $kisses[$i]["user_logo"] = $userinfo["user_logo"]['thumbs']; } else { $userinfo["user_logo"] = $this->Uploads_model->format_default_upload($upload_config_id); $kisses[$i]["user_logo"] = $userinfo["user_logo"]['thumbs']; } $kisses[$i]["image"] = "kisses-" . $kisses[$i]["image"]; if (!$row['mark'] && $folder == 'inbox') { $this->Kisses_model->_mark_as_read($row['id'], array('mark' => 1)); } $i++; } $kisses_count = $this->Kisses_model->get_count_kisses_users($params); $this->load->helper("navigation"); $url = site_url() . 'kisses/' . $folder . '/'; $page_data = get_user_pages_data($url, $kisses_count, $items_on_page, $page, 'briefPage'); $this->config->load('date_formats', TRUE); $page_data["date_format"] = $this->pg_date->get_format('date_literal', 'st'); $this->template_lite->assign('page_data', $page_data); $this->template_lite->assign('kiss_section', $folder); $this->template_lite->assign('kisses', $kisses); $this->template_lite->view('index'); }
function my_banners($params) { $CI =& get_instance(); $auth_type = $CI->session->userdata("auth_type"); if ($auth_type != "user") { return ''; } $CI->load->model('Banners_model'); if (isset($params['page'])) { $page = intval($params['page']); } $page = max($page, 1); $params["where"]["user_id"] = $CI->session->userdata("user_id"); $cnt_banners = $CI->Banners_model->cnt_banners($params); $items_on_page = $CI->pg_module->get_module_config('banners', 'items_per_page'); $CI->load->helper('sort_order'); $page = get_exists_page_number($page, $cnt_banners, $items_on_page); $banners = $CI->Banners_model->get_banners($page, $items_on_page, array("id" => "DESC"), $params); // get place objects for banner if ($banners) { $CI->load->model('banners/models/Banner_place_model'); foreach ($banners as $key => $banner) { $banners[$key]['banner_place_obj'] = $banner['banner_place_id'] ? $CI->Banner_place_model->get($banner['banner_place_id']) : null; } } $CI->template_lite->assign('banners', $banners); $CI->load->helper("navigation"); $page_data = get_user_pages_data(site_url() . "users/account/banners/", $cnt_banners, $items_on_page, $page, 'briefPage'); $page_data['date_format'] = $CI->pg_date->get_format('date_literal', 'st'); $CI->template_lite->assign('page_data', $page_data); $CI->Menu_model->breadcrumbs_set_parent('my_banners_item'); $CI->template_lite->view('my_list_block', 'user', 'banners'); }
public function my($page = 1) { $id_user = $this->session->userdata('user_id'); $this->load->model('packages/models/Packages_users_model'); $params['where']['id_user'] = $id_user; $user_packages_count = $this->Packages_users_model->get_user_packages_count($params); $items_on_page = 20; $this->load->helper('sort_order'); $page = get_exists_page_number($page, $user_packages_count, $items_on_page); $user_packages = $this->Packages_users_model->get_user_packages_list(null, $params); $this->template_lite->assign('user_packages', $user_packages); $this->load->helper("navigation"); $page_data = get_user_pages_data(site_url() . 'packages/my/', $user_packages_count, $items_on_page, $page, 'briefPage'); $this->template_lite->assign('page_data', $page_data); $this->load->model('Menu_model'); $this->Menu_model->breadcrumbs_set_parent('my_packages_item'); $this->template_lite->view('my_packages'); }
/** * My memberships * * @param integer $page page of results * @return void */ public function my($page = 1) { $id_user = $this->session->userdata('user_id'); $params['where']['id_user'] = $id_user; $this->load->model('memberships/models/Memberships_users_model'); $user_memberships_count = $this->Memberships_users_model->getUserMembershipsCount($params); $items_on_page = 20; $this->load->helper('sort_order'); $page = get_exists_page_number($page, $user_memberships_count, $items_on_page); $user_memberships = $this->Memberships_users_model->getUserMembershipsList(null, $params); $this->pg_output->setOutputData('user_memberships', $user_memberships); $this->load->helper("navigation"); $page_data = get_user_pages_data(site_url() . 'memberships/my/', $user_memberships_count, $items_on_page, $page, 'briefPage'); $this->pg_output->setOutputData('page_data', $page_data); $this->load->model('Menu_model'); $this->Menu_model->breadcrumbs_set_parent('my_mmeberships_item'); }