sns_circle.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * 图片空间操作
  4. ***/
  5. defined('InShopNC') or exit('Access Invalid!');
  6. class sns_circleControl extends BaseSNSControl {
  7. public function __construct() {
  8. parent::__construct();
  9. /**
  10. * 读取语言包
  11. */
  12. Language::read('sns_circle,member_sns,sns_home');
  13. Tpl::output('menu_sign', 'circle');
  14. $this->get_visitor(); // 获取访客
  15. define('CIRCLE_TEMPLATES_URL', CIRCLE_SITE_URL.'/templates/'.TPL_NAME);
  16. $where = array();
  17. $where['name'] = !empty($this->master_info['member_truename'])?$this->master_info['member_truename']:$this->master_info['member_name'];
  18. Model('seo')->type('sns')->param($where)->show();
  19. $this->sns_messageboard();
  20. }
  21. /**
  22. * index 默认为话题
  23. */
  24. public function indexOp(){
  25. $this->themeOp();
  26. }
  27. /**
  28. * 话题
  29. */
  30. public function themeOp(){
  31. $model = Model();
  32. $theme_list = $model->table('circle_theme')->where(array('member_id'=>$this->master_id))->page(10)->order('theme_id desc')->select();
  33. Tpl::output('showpage', $model->showpage('2'));
  34. Tpl::output('theme_list', $theme_list);
  35. if(!empty($theme_list)){
  36. $theme_list = array_under_reset($theme_list, 'theme_id');
  37. $themeid_array = array(); $circleid_array = array();
  38. foreach ($theme_list as $val){
  39. $themeid_array[] = $val['theme_id'];
  40. $circleid_array[] = $val['circle_id'];
  41. }
  42. $themeid_array = array_unique($themeid_array);
  43. $circleid_array = array_unique($circleid_array);
  44. // 附件
  45. $affix_list = $model->table('circle_affix')->where(array('affix_type'=>1, 'member_id'=>$this->master_id, 'theme_id'=>array('in', $themeid_array)))->select();
  46. $affix_list = array_under_reset($affix_list, 'theme_id', 2);
  47. Tpl::output('affix_list', $affix_list);
  48. }
  49. $this->profile_menu('theme');
  50. Tpl::showpage('sns_circletheme');
  51. }
  52. /**
  53. * 圈子
  54. */
  55. public function circleOp(){
  56. $model = Model();
  57. $cm_list = $model->table('circle_member')->where(array('member_id'=>$this->master_id))->order('cm_jointime desc')->select();
  58. if(!empty($cm_list)){
  59. $cm_list = array_under_reset($cm_list, 'circle_id'); $circleid_array = array_keys($cm_list);
  60. $circle_list = $model->table('circle')->where(array('circle_id'=>array('in', $circleid_array)))->select();
  61. Tpl::output('circle_list', $circle_list);
  62. }
  63. $this->profile_menu('circle');
  64. Tpl::showpage('sns_circle');
  65. }
  66. /**
  67. * 用户中心右边,小导航
  68. *
  69. * @param string $menu_type 导航类型
  70. * @param string $menu_key 当前导航的menu_key
  71. * @return
  72. */
  73. private function profile_menu($menu_key=''){
  74. $menu_array = array();
  75. $theme_menuname = $this->relation==3?L('sns_my_theme'):L('sns_TA_theme');
  76. $circle_menuname = $this->relation==3?L('sns_my_group'):L('sns_TA_group');
  77. $menu_array = array(
  78. 1=>array('menu_key'=>'theme','menu_name'=>$theme_menuname,'menu_url'=>'index.php?act=sns_circle&op=theme&mid='.$this->master_id),
  79. 2=>array('menu_key'=>'circle','menu_name'=>$circle_menuname,'menu_url'=>'index.php?act=sns_circle&op=circle&mid='.$this->master_id),
  80. );
  81. Tpl::output('member_menu',$menu_array);
  82. Tpl::output('menu_key',$menu_key);
  83. }
  84. }
  85. ?>