operatorData = $this->getUser (); $this->objDPlatformBulletin = new PlatformBulletin(); } /** * 默认 */ public function doDefault() { } /** * 页面: 公告列表 & 创建公告 * 地址:http://cas.lishuy.com/?c=Admin_Platform_Bulletin&a=PageList */ public function doPageList(){ $page = Request::varGetInt ( 'page', 1 ); $size = 20; $offset = ($page - 1) * $size; $limit = "{$offset},{$size}"; $condition = array(); $total_num = $this->objDPlatformBulletin->totals ( $condition ); $url_tpl = Request::schemeDomain () . "?c=Admin_Platform_Bulletin&a=PageList"; $url_tpl .= "&page={page}"; $objPage = new Page ( $total_num, $url_tpl, $page, $size ); $page_html = $objPage->html (); $order = 'id desc'; $ids = $this->objDPlatformBulletin -> findIdsBy($condition , $limit, $order ); $bulletinsData = $this->objDPlatformBulletin->gets($ids); $uids = array(); foreach($bulletinsData as $key=>$data){ $uids[$data['operator_uid']] = $data['operator_uid']; } $objDUserInfo = new UserInfo(); $thisPageUserData = $objDUserInfo -> gets($ids); $this->tpl = 'admin/platform/blletin_list'; $title = '公告设置'; $this->setOutput('title', $title); $this->setOutput('menu_active', array('name' => 'bulletin', 'item' => '')); //激活菜单 $this->addNavMenu($title); $this->addNavMenu('平台设置'); $this->setOutput ( 'page_html', $page_html ); // 分页Html $this->setOutput ( 'bulletinsData', $bulletinsData ); // 当前公告列表数据 $this->setOutput ( 'thisPageUserData', $thisPageUserData );//当前页面用户ID $this->setOutput ('pagePublicData', $this->getPagePublicData()); // 后台管理相关数据 $this->setOutput('isSuperadmin', $this->isSuperadmin()); } /** * 页面: 查看&修改 公告 * 地址:http://cas.lishuy.com/?c=Admin_Platform_Bulletin&a=PageShow&bulletin_id=nn * 参数:bulletin_id 公告id */ public function doPageShow(){ $objBackUser = new BackUser(); $objUser = new User(); $bulletin_id = Request::g('bulletin_id'); $bulletinData = $this->objDPlatformBulletin->get($bulletin_id); $bulletinData['userData'] = $objBackUser->get($bulletinData['operator_uid']); $this->tpl = 'admin/platform/blletin_show'; $title = '公告内容'; $this->setOutput('title', $title); $this->setOutput('menu_active', array('name' => 'bulletin', 'item' => '')); //激活菜单 $this->addNavMenu($title); $this->addNavMenu('平台设置'); $this->setOutput ( 'bulletinData', $bulletinData ); // 当前公告内容 $this->setOutput ('pagePublicData', $this->getPagePublicData()); // 后台管理相关数据 } /** * 页面: 修改 公告 * 地址:http://cas.lishuy.com/?c=Admin_Platform_Bulletin&a=PageUp&bulletin_id=nn * 参数:bulletin_id 公告id */ public function doPageUp(){ $bulletin_id = Request::g('bulletin_id'); $bulletinData = $this->objDPlatformBulletin->get($bulletin_id); $this->tpl = 'admin/platform/blletin_up'; $title = '公告设置'; $this->setOutput('title', $title); $this->setOutput('menu_active', array('name' => 'platformset', 'item' => 'bulletin')); //激活菜单 $this->addNavMenu($title); $this->addNavMenu('平台设置'); $this->setOutput ( 'bulletinData', $bulletinData ); // 当前公告内容 $this->setOutput ('pagePublicData', $this->getPagePublicData()); // 后台管理相关数据 } /** * 事件:创建公告 * 地址:http://cas.lishuy.com/index.php?c=Admin_Platform_Bulletin&a=ReqCreate * 参数:见方法内 */ public function doReqCreate(){ $title = Request::p('title'); $content = Request::p('content', null); $operator_uid = $this->operatorData['uid']; $info = array( 'title' => $title, 'content' => $content, 'operator_uid' => $operator_uid ); $this->objDPlatformBulletin->add($info); $this->ajax_success_exit('添加成功'); } /** * 事件: 修改公告 * 地址:http://cas.lishuy.com/index.php?c=Admin_Platform_Bulletin&a=ReqUp * 参数:见方法内 */ public function doReqUp(){ $bulletin_id = Request::p('bulletin_id'); $title = Request::p('title'); $content = Request::p('content', null); $operator_uid = $this->operatorData['uid']; $info = array( 'title' => $title, 'content' => $content, 'operator_uid' => $operator_uid ); $this->objDPlatformBulletin->modify($info, array('id' =>$bulletin_id )); $this->ajax_success_exit('修改成功'); } /** * 事件: 删除公告 * 地址:http://cas.lishuy.com/index.php?c=Admin_Platform_Bulletin&a=ReqDel * 参数:见方法内 */ public function doReqDel(){ $bulletin_id = Request::p('bulletin_id'); $this->objDPlatformBulletin->delete(array('id' =>$bulletin_id )); # TODO 根据前端自定义返回结果或跳转 header ( "Location: " . Request::schemeDomain () . "/?c=Admin_Platform_Bulletin&a=PageList" ); exit(); } public function display() { return $this->render (); } }