public function groups() { $this->check_login(); $this->userControl(); $num_per_page = 10; $ptx_group = spClass("ptx_group"); $category_id = $this->spArgs("category_id"); $args = array(); if ($category_id) { $conditions['category_id'] = $category_id; $args['category_id'] = $category_id; } $conditions['user_id'] = $this->current_user['user_id']; $groups = $ptx_group->search($conditions, $this->page, $num_per_page); $this->pages = createTPages($ptx_group->spPager()->getPager(), $this->current_controller, $this->current_action, $args); $ptx_share = spClass('ptx_share'); foreach ($groups as $key => $group) { $share_conditions['keyword'] = 'group' . $group['group_id'] . 'g'; $shares = $ptx_share->count($share_conditions); $groups[$key]['total_share'] = $shares; } $this->groups = $groups; $this->output("user/groups"); }
private function output_pin($action, $order, $conditions = array()) { $num_per_page = $this->settings['ui_layout']['pin_pagenum']; $num_per_page = $num_per_page ? $num_per_page : 15; $ptx_share = spClass('ptx_share'); $wf = $this->spArgs("wf"); if ($this->page == 1) { $guide['show'] = true; if ($this->category_id) { $ptx_tag = spClass('ptx_tag'); $guide['tag_group'] = $ptx_tag->get_tag_group(" ptx_tag.category_id = '" . $this->category_id . "'"); } $this->guide = $guide; } $args = array(); if ($conditions['color']) { $args['idx'] = $conditions['color']; } $args['page'] = '2'; $args['wf'] = '1'; if ($this->category_id) { $conditions['category_id'] = $this->category_id; $args['cat'] = $this->category_id; } if ($this->settings['ui_layout']['orgin_post']) { $conditions['orgin_post'] = 1; } $this->nextpage_url = spUrl("pin", $action, $args); $shares = $ptx_share->search($conditions, $this->page, $num_per_page, null, $order); $this->pages = createTPages($ptx_share->spPager()->getPager(), 'pin', $action, $conditions); $shares = $this->add_ads($shares); $this->waterfallView($shares, 'pin'); $need_header_footer = $wf == '1' ? false : true; $this->output("pin/index", $need_header_footer); }
protected function favorite_topic($user_id) { $num_per_page = 15; $ptx_favorite_topic = spClass("ptx_favorite_topic"); $args = array("page" => "2"); if ($user_id) { $conditions['user_id'] = $user_id; $args['uid'] = $user_id; } if ($this->sname) { $args['sname'] = $this->sname; } $topics = $ptx_favorite_topic->search($conditions, $this->page, $num_per_page); $this->pages = createTPages($ptx_favorite_topic->spPager()->getPager(), $this->current_controller, $this->current_action, $args); $ptx_share = spClass('ptx_share'); foreach ($topics as $key => $topic) { $share_conditions['keyword'] = 'topic' . $topic['topic_id'] . 't'; $shares = $ptx_share->search($share_conditions, 1, 5); $topics[$key]['shares'] = $shares; } $this->topics = $topics; $this->output("user/topics"); }
public function goodshop_list() { if ($this->check_admin()) { $act = $this->spArgs("act"); $shopid = $this->spArgs("shopid"); $ptx_goodshop = spClass('ptx_goodshop'); $ptx_user = spClass('ptx_user'); if ($shopid) { $find_data['shop_id'] = $shopid; $this->shop = $ptx_goodshop->find_one($find_data); } if ($act == 'delete' && $this->shop) { $ptx_goodshop->del_one($find_data); $ptx_goodshop->update_goodshop_cache(); $ptx_user->update_shopuser($this->shop['user_id'], 0); admin_show_message(T('save_success'), $this, spUrl('admin', 'goodshop_list')); return; } else { if ($act == 'search') { $page = $this->spArgs("page", 1); if ($search_txt = $this->spArgs("keyword")) { $conditions['keyword'] = $search_txt; } $this->goodshops = $ptx_goodshop->search($conditions, $page, 15); $conditions['act'] = 'search'; $this->pages = createTPages($ptx_goodshop->spPager()->getPager(), 'admin', 'goodshop_list', $conditions); $this->display("/admin/goodshop_list.php"); } else { if ($act == 'edit' && $this->shop) { if ($this->spArgs('hash')) { $data['shop_desc'] = $this->spArgs("shop_desc"); $data['category_id'] = $this->spArgs("category_id"); $data['display_order'] = $this->spArgs("display_order"); $ptx_goodshop->update($find_data, $data); admin_show_message(T('save_success'), $this, spUrl('admin', 'goodshop_list')); return; } else { $this->display("/admin/goodshop_edit.php"); return; } } else { $page = $this->spArgs("page", 1); $this->goodshops = $ptx_goodshop->search($conditions, $page, 15); $this->pages = createTPages($ptx_goodshop->spPager()->getPager(), 'admin', 'goodshop_list', $conditions); $this->display("/admin/goodshop_list.php"); } } } } }