コード例 #1
0
 /**
  *  run this action
  *  @param:  NULL
  *  @return: NULL
  *  @access: public
  */
 public function run()
 {
     $smarty = $this->getSmarty();
     //取得传入的版块的id
     $layout_id = $this->getParameterFromGET('id');
     $smarty->assign('id', $layout_id);
     //检查版块时候存在
     $sql = 'select count(*) as num from bbs_layout where id=?';
     $sth = $this->db->prepare($sql);
     $res = $this->db->Execute($sth, array($layout_id));
     $rows = $res->FetchRow();
     if (!$rows['num']) {
         $this->AlertAndBack(LAYOUT_IS_NOT_EXISTS);
         return;
     }
     $sql = 'select parent_id from bbs_layout where id=?';
     $sth = $this->db->Prepare($sql);
     $res = $this->db->Execute($sth, array($layout_id));
     $rows = $res->FetchRow();
     $parent_id = $rows['parent_id'];
     $smarty->assign('parent_id', $parent_id);
     //求现有的版主列表
     $manager_list_array = LayoutUtil::getManagerList($this->db, $layout_id);
     $manager_str = "";
     foreach ($manager_list_array as $temp_rows) {
         $manager_str .= "<input type=\"checkbox\" name=\"user_id[]\" value=" . $temp_rows['user_id'] . ">";
         $manager_str .= $temp_rows['user_name'] . "<br>\n";
     }
     $smarty->assign('manager_list', $manager_str);
     $smarty->display('adminshowdelmanager.tmpl');
     return;
 }
コード例 #2
0
ファイル: ShowLayout.class.php プロジェクト: hylinux/ltebbs
 /**
  *  run this action
  *  @param:  NULL
  *  @return: NULL
  *  @access: public
  */
 public function run()
 {
     $parent_id = $this->getParameter('parent');
     if (!$parent_id) {
         $parent_id = 0;
     }
     $smarty = $this->getSmarty();
     $sql = 'select id, title, description, status from bbs_layout where parent_id=? order by id asc';
     $sth = $this->db->Prepare($sql);
     $res = $this->db->Execute($sth, array($parent_id));
     $temp = array();
     while ($rows = $res->FetchRow()) {
         $status = SL_OPEN_STATUS;
         if ($rows['status'] == 0) {
             $status = SL_OPEN_STATUS;
         } else {
             if ($rows['status'] == 1) {
                 $status = SL_NEED_LOGIN;
             } else {
                 if ($rows['status'] == 2) {
                     $status = SL_CLOSE;
                 } else {
                     if ($rows['status'] == 3) {
                         $status = SL_ONLY_SPLIT_CATEGORY;
                     } else {
                         $status = SL_OPEN_STATUS;
                     }
                 }
             }
         }
         //求现有的版主列表
         $manager_list_array = LayoutUtil::getManagerList($this->db, $rows['id']);
         $manager_str = "";
         foreach ($manager_list_array as $temp_rows) {
             $manager_str .= "<option value=" . $temp_rows['user_id'] . ">";
             $manager_str .= $temp_rows['user_name'] . "</option>\n";
         }
         $temp[] = array('name' => $rows['title'], 'desc' => $rows['description'], 'status' => $status, 'id' => $rows['id'], 'ma' => $manager_str);
     }
     //返回论坛上面的导行栏。
     $nav_array = LayoutUtil::getParentLayoutInfo($this->db, $parent_id);
     //导航栏
     $smarty->assign('menu', $nav_array);
     $smarty->assign('parent_id', $parent_id);
     $smarty->assign('layout', $temp);
     $smarty->display('adminlayout.tmpl');
     return;
 }
コード例 #3
0
ファイル: LayoutUtil.class.php プロジェクト: hylinux/ltebbs
 /**
  * 返回子论坛的信息
  * @param:  $id, 论坛ID
  * @param:  $db, 数据库的连接
  * @reurn:  Array
  * @access; public
  */
 public static function &getSubBBS(&$db, $id)
 {
     /*{{{*/
     //查询所有下级子论坛
     $sub_bbs_layout_id = LayoutUtil::getLayoutInfoByParentId($db, $id);
     $sub_array = array();
     foreach ($sub_bbs_layout_id as $sub_rows) {
         $sub_id = $sub_rows['id'];
         //注意:$sub_bbs_id是一个数组
         $sub_bbs_id = array();
         LayoutUtil::getChildId($db, $sub_id, $sub_bbs_id);
         array_push($sub_bbs_id, $sub_id);
         /**
          * 如果已经将论坛锁住,则不判断是否有新帖
          */
         /**
          *  $layout_status == 0 || $layout_status is null 则为开放
          *  $layout_status == 1 则需要验证
          *  $layout_status == 2 则为关闭
          */
         $layout_status = LayoutUtil::getLayoutStatus($db, $sub_id);
         /**
          * 判断是否有新帖子
          * 判断有新帖子的流程是:
          * 如果用户已经登录,则找出用户的作后动作的时间
          * 如果用户没有登录,则显示没有新帖子
          */
         $image = 'nonewtopic.gif';
         if ($layout_status == 2) {
             $image = 'lock.gif';
         } else {
             if (isset($_SESSION['user'])) {
                 if (LayoutUtil::haveNewTopic($db, $_SESSION['user']['name'], $sub_bbs_id)) {
                     /**
                      * 求出最后时间后,需要我们找出当前子论坛下各个子论坛的id
                      */
                     $image = 'havenewtopic.gif';
                 }
             }
         }
         //求出论坛及子论坛下面的查看的人数
         $view_number = LayoutUtil::getViewNumber($db, $sub_bbs_id);
         //求出论坛和子论坛下的所有的主题
         $topic_number = LayoutUtil::getTopicNumber($db, $sub_bbs_id);
         //求出论坛下所有的回复数
         $reply_number = LayoutUtil::getReplyNumber($db, $sub_bbs_id);
         //求论坛里最后发表的帖子
         $temp_rows = LayoutUtil::getLastPostTopic($db, $sub_id);
         $last_id = $temp_rows['id'];
         $last_title = $temp_rows['title'];
         $last_time = $temp_rows['last_access_date'];
         $last_time = set_locale_time($last_time);
         $short_title = utf8_substr($last_title, 0, 10);
         //求版主列表的字符串
         $manager_list_array = LayoutUtil::getManagerList($db, $sub_id);
         $manager_str = "";
         foreach ($manager_list_array as $temp_rows) {
             $manager_str .= "<option value=" . $temp_rows['user_id'] . ">";
             $manager_str .= $temp_rows['user_name'] . "</option>\n";
         }
         $sub_array[] = array('id' => $sub_rows['id'], 'title' => $sub_rows['title'], 'content' => ConvertString(stripslashes($sub_rows['description']), ROOT_URL, IMAGE_URL . 'express/'), 'image' => $image, 'viewnumber' => $view_number, 'topic_number' => $topic_number, 'reply_number' => $reply_number, 'topicid' => $last_id, 'topic_title' => $last_title, 'short_title' => $short_title, 'last_time' => $last_time, 'managerlist' => $manager_str);
     }
     return $sub_array;
 }