public function run()
 {
     list($page, $perpage, $username, $starttime, $endtime, $keyword) = $this->getInput(array('page', 'perpage', 'username', 'starttime', 'endtime', 'keyword'));
     $starttime && ($pwStartTime = Pw::str2time($starttime));
     $endtime && ($pwEndTime = Pw::str2time($endtime));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     if ($username) {
         $userinfo = $this->_getUserDs()->getUserByName($username);
         $fromUid = $userinfo['uid'] ? $userinfo['uid'] : 0;
     }
     Wind::import('WINDID:service.message.srv.vo.WindidMessageSo');
     $vo = new WindidMessageSo();
     $endtime && $vo->setEndTime($endtime);
     $fromUid && $vo->setFromUid($fromUid);
     $keyword && $vo->setKeyword($keyword);
     $starttime && $vo->setStarttime($starttime);
     $messages = $this->_getMessageDs()->searchMessage($vo, $start, $limit);
     $count = $this->_getMessageDs()->countMessage($vo);
     foreach ($messages as $k => $v) {
         $uids[] = $v['from_uid'];
     }
     $users = $this->_getUserDs()->fetchUserByUid($uids);
     foreach ($messages as $k => $v) {
         $messages[$k]['username'] = $users[$v['from_uid']]['username'];
     }
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput(array('keyword' => $keyword, 'username' => $username, 'starttime' => $starttime, 'endtime' => $endtime), 'args');
     $this->setOutput($messages, 'messages');
 }
 public function run()
 {
     $page = intval($this->getInput('page'));
     $page < 1 && ($page = 1);
     $logSo = new PwLogSo();
     $logSo->setEndTime($this->getInput('end_time'))->setStartTime($this->getInput('start_time'))->setCreatedUsername($this->getInput('created_user'))->setTypeid($this->getInput('typeid'))->setIp($this->getInput('ip'));
     /* @var $logDs PwLogLogin */
     $logDs = Wekit::load('log.PwLogLogin');
     $count = $logDs->coutSearch($logSo);
     $list = array();
     if ($count > 0) {
         $page > $count && ($page = $count);
         $totalPage = ceil($count / $this->perpage);
         list($offset, $limit) = Pw::page2limit($page, $this->perpage);
         $list = $logDs->search($logSo, $limit, $offset);
     }
     $this->setOutput($this->perpage, 'perpage');
     $this->setOutput($list, 'list');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($logSo->getSearchData(), 'searchData');
     $this->setOutput($this->isFounder($this->adminUser->getUsername()), 'canClear');
     $this->setOutput($this->_getLoginType(), 'types');
     $this->setTemplate('manage_login');
 }
Exemple #3
0
 public function run()
 {
     /* @var $groupDs PwUserGroups */
     list($sName, $sUid, $sEmail, $page) = $this->getInput(array('username', 'uid', 'email', 'page'));
     Wind::import('WINDID:service.user.vo.WindidUserSo');
     $vo = new WindidUserSo();
     $sName && $vo->setUsername($sName);
     $sUid && $vo->setUid($sUid);
     $sEmail && $vo->setEmail($sEmail);
     $page = intval($page) == 0 ? 1 : abs(intval($page));
     /* @var $searchDs PwUserSearch */
     $searchDs = Windid::load('user.WindidUser');
     $count = $searchDs->countSearchUser($vo);
     $result = array();
     if (0 < $count) {
         $totalPage = ceil($count / $this->pageNumber);
         $page > $totalPage && ($page = $totalPage);
         list($start, $limit) = Pw::page2limit($page, $this->pageNumber);
         $result = $searchDs->searchUser($vo, $limit, $start);
     }
     $data = $vo->getData();
     $this->setOutput($data, 'args');
     $this->setOutput($page, 'page');
     $this->setOutput($this->pageNumber, 'perPage');
     $this->setOutput($count, 'count');
     $this->setOutput($result, 'list');
 }
 public function run()
 {
     $this->_setNavType('cateweekreport');
     $allSchool = $this->_get4TSchoolDS()->getOpenedSchools();
     $allSchool = array_values($allSchool);
     $cateTypeClass = $this->setCateTypeCommonClass();
     $this->setOutput($allSchool, 'allSchool');
     $this->setOutput($cateTypeClass, 'cateTypeClass');
     $choosenSchoolId = -1;
     $typename = -1;
     $audited = -1;
     $released = -1;
     if ($this->getInput('type', 'post') === 'do') {
         list($choosenSchoolId, $typename, $audited, $released) = $this->getInput(array('choosenSchoolId', 'typename', 'audited', 'released'), 'post');
     }
     $page = $this->getInput('page');
     $searchCondition = array('choosenSchoolId' => $choosenSchoolId, 'typename' => $typename, 'audited' => $audited, 'released' => $released);
     $count = $this->_getCateWeekReportDs()->countCateWeek($searchCondition);
     if (0 < $count) {
         $totalPage = ceil($count / $this->pageNumber);
         $page > $totalPage && ($page = $totalPage);
         list($start, $limit) = Pw::page2limit($page, $this->pageNumber);
         if ($page <= 0) {
             $page = 1;
         }
     }
     $cateWeekReportList = $this->_getCateWeekReportDs()->getSearchCateWeekData($searchCondition, $start, $limit);
     $cateWeekReportList = array_values($cateWeekReportList);
     $this->setOutput($searchCondition, 'searchCondition');
     $this->setOutput($cateWeekReportList, 'cateWeekReportList');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($this->pageNumber, 'perPage');
 }
 public function run()
 {
     $this->_setNavType('shopstatusrecord');
     if ($this->getInput('type', 'post') === 'do') {
         list($shopId) = $this->getInput(array('shopId'), 'post');
     }
     $shopId = $this->getInput("shopId");
     $this->setOutput($shopId, 'shopId');
     $page = $this->getInput('page');
     $searchCondition = array('shopId' => $shopId);
     $count = $this->_getShopstatusrecordDs()->countAllShopStatusRecord($searchCondition);
     if (0 < $count) {
         $totalPage = ceil($count / $this->pageNumber);
         $page > $totalPage && ($page = $totalPage);
         list($start, $limit) = Pw::page2limit($page, $this->pageNumber);
         if ($page <= 0) {
             $page = 1;
         }
     }
     $shopStatusRecordList = $this->_getShopstatusrecordDs()->getAllShopStatusRecord($searchCondition, $start, $limit);
     $shopStatusRecordList = array_values($shopStatusRecordList);
     $shopId = $this->getInput('shopId');
     $args['shopId'] = $shopId;
     $this->setOutput($shopStatusRecordList, 'shopStatusRecordList');
     $this->setOutput($searchCondition, 'searchCondition');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($this->pageNumber, 'perPage');
     $this->setOutput($args, 'args');
 }
 public function run()
 {
     $page = $this->getInput('page');
     $count = $this->_getPwAnnounceDs()->countAnnounce();
     if (0 < $count) {
         $totalPage = ceil($count / $this->pageNumber);
         $page > $totalPage && ($page = $totalPage);
         list($start, $limit) = Pw::page2limit($page, $this->pageNumber);
         if ($page <= 0) {
             $page = 1;
         }
     }
     $announceInfo = array();
     $announceInfos = $this->_getPwAnnounceDs()->getAnnounceOrderByVieworder($schoolid = '', $limit, $start);
     $announceInfos = $this->_getPwAnnounceService()->formatAnnouncesUsername($announceInfos);
     $openSchools = $this->_getSchoolDS()->getOpenedSchools();
     $this->setOutput($openSchools, 'openSchools');
     foreach ($announceInfos as $akey => &$eachInfo) {
         $found = false;
         foreach ($openSchools as $key => $eachSchool) {
             if ($eachInfo['schoolid'] == $eachSchool['schoolid']) {
                 $eachInfo['schoolName'] = $eachSchool['name'];
                 $found = true;
                 break;
             }
         }
         if ($found == false) {
             $eachInfo['schoolName'] = "所有学校";
         }
     }
     $this->setOutput($announceInfos, 'announceInfos');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($this->pageNumber, 'perPage');
 }
 public function manageAction()
 {
     $schoolId = $this->getCurrentSchoolId();
     $userid = $this->loginUser->uid;
     $this->getNoCommentSum($schoolId, $userid);
     $myMenus = $this->_getMyOrderDS()->getMyMenus($schoolId, $userid);
     $this->setOutput($myMenus, 'myMenus');
     $choosenStatus = $this->getInput("choosenStatus");
     $this->setOutput($choosenStatus, "choosenStatus");
     $page = $this->getInput('page');
     $count = $this->_getMessageBoardDS()->countMessages($schoolId, -1, $choosenStatus);
     if (0 < $count) {
         $totalPage = ceil($count / $this->pageNumber);
         $page > $totalPage && ($page = $totalPage);
         list($start, $limit) = Pw::page2limit($page, $this->pageNumber);
         if ($page <= 0) {
             $page = 1;
         }
     }
     $messageList = $this->_getMessageBoardDS()->getMessages($schoolId, -1, $choosenStatus, $limit, $start);
     $this->setOutput($messageList, 'messageList');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($this->pageNumber, 'perPage');
     $args['choosenStatus'] = $choosenStatus;
     $this->setOutput($args, "args");
     //set selected menu
     $this->setOutput('留言管理', 'selectedMenu');
     $this->setOutput('管理网站用户的留言', 'subtitle');
     $this->setOutput($schoolId, 'schoolId');
 }
 public function run()
 {
     $page = (int) $this->getInput('page', 'get');
     $flag = $this->getInput('flag');
     $compid = (int) $this->getInput('compid');
     $compname = $this->getInput('compname');
     $perpage = 10;
     $args = array();
     $page = $page > 1 ? $page : 1;
     list($start, $perpage) = Pw::page2limit($page, $perpage);
     Wind::import('SRV:design.srv.vo.PwDesignComponentSo');
     $vo = new PwDesignComponentSo();
     if ($flag) {
         $vo->setModelFlag($flag);
         $args['flag'] = $flag;
     }
     if ($compid > 0) {
         $vo->setCompid($compid);
         $args['compid'] = $compid;
     }
     if ($compname) {
         $vo->setCompname($compname);
         $args['compname'] = $compname;
     }
     $list = $this->_getDesignComponentDs()->searchComponent($vo, $start, $perpage);
     $count = $this->_getDesignComponentDs()->countComponent($vo);
     $models = $this->_getDesignService()->getModelList();
     $this->setOutput($args, 'args');
     $this->setOutput($flag, 'flag');
     $this->setOutput($list, 'list');
     $this->setOutput($models, 'models');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
 }
 public function run()
 {
     $page = $this->getInput('page');
     $this->page = $page < 1 ? 1 : intval($page);
     list($start, $limit) = Pw::page2limit($this->page, $this->perpage);
     $timestamp = PW::getTime();
     $startTime = $timestamp - 7 * 86400;
     $endTime = $timestamp;
     $total = $this->_getPollDs()->countPollByTime($startTime, $endTime);
     $pollInfo = array();
     if ($total) {
         Wind::import('SRV:poll.srv.dataSource.PwFetchPollByTime');
         $pollDisplay = new PwPollDisplay(new PwFetchPollByTime($startTime, $endTime, $limit, $start, array('voter_num' => 0, 'created_time' => 0)));
         $pollInfo = $this->_buildPoll($pollDisplay->gather());
     }
     $latestPollDisplay = new PwPollDisplay(new PwFetchPollByOrder(10, 0, array('created_time' => '0')));
     $latestPoll = $latestPollDisplay->gather();
     $this->setOutput($total, 'total');
     $this->setOutput($pollInfo, 'pollInfo');
     $this->setOutput($latestPoll, 'latestPoll');
     $this->setOutput($this->page, 'page');
     $this->setOutput($this->perpage, 'perpage');
     $this->setOutput(array('allowview' => $this->loginUser->getPermission('allow_view_vote'), 'allowvote' => $this->loginUser->getPermission('allow_participate_vote')), 'pollGroup');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     if ($this->page > 1) {
         $seoBo->setCustomSeo($lang->getMessage('SEO:vote.hot.run.page.title', array($this->page)), $lang->getMessage('vote.hot.run.description'), '');
     } else {
         $seoBo->setCustomSeo($lang->getMessage('SEO:vote.hot.run.title'), '', $lang->getMessage('SEO:vote.hot.run.description'));
     }
     Wekit::setV('seo', $seoBo);
 }
 public function run()
 {
     list($type, $page) = $this->getInput(array('type', 'page'));
     $page = intval($page);
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $noticeList = $this->_getNoticeDs()->getNotices($this->loginUser->uid, $type, $start, $limit);
     $noticeList = $this->_getNoticeService()->formatNoticeList($noticeList);
     $typeCounts = $this->_getNoticeService()->countNoticesByType($this->loginUser->uid);
     //类型
     $typeid = intval($type);
     //获取未读通知数
     $unreadCount = $this->_getNoticeDs()->getUnreadNoticeCount($this->loginUser->uid);
     $this->_readNoticeList($unreadCount, $noticeList);
     //count
     $count = intval($typeCounts[$typeid]['count']);
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput(ceil($count / $perpage), 'totalpage');
     $this->setOutput(array('type' => $typeid), 'args');
     $this->setOutput($typeid, 'typeid');
     $this->setOutput($typeCounts, 'typeCounts');
     $this->setOutput($noticeList, 'noticeList');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:mess.notice.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
 public function run()
 {
     $conditions = array('page', 'keyword', 'ifhot', 'categoryId', 'minAttention', 'maxAttention', 'minContent', 'maxContent');
     list($page, $keyword, $ifhot, $categoryId, $minAttention, $maxAttention, $minContent, $maxContent) = $this->getInput($conditions);
     $categories = $this->_getTagCateGoryDs()->getAllCategorys();
     $this->setOutput($categories, 'categories');
     //搜索话题
     $page = intval($page);
     $page < 1 && ($page = 1);
     strlen($ifhot) or $ifhot = -1;
     list($start, $limit) = Pw::page2limit($page, $this->perpage);
     list($count, $tags) = $this->_getTagService()->getTagByCondition($start, $limit, $keyword, $ifhot, $categoryId, $minAttention, $maxAttention, $minContent, $maxContent);
     $maxPage = ceil($count / $this->perpage);
     if ($page > $maxPage) {
         $page = $maxPage;
         list($start, $limit) = Pw::page2limit($page, $this->perpage);
         list($count, $tags) = $this->_getTagService()->getTagByCondition($start, $limit, $keyword, $ifhot, $categoryId, $minAttention, $maxAttention, $minContent, $maxContent);
     }
     $tags = $this->_buildTagData($tags, $categories);
     $args = array();
     foreach ($conditions as $v) {
         if ($v == 'page') {
             continue;
         }
         $this->setOutput(${$v}, $v);
         $args[$v] = ${$v};
     }
     $this->setOutput($tags, 'tags');
     //pagination
     $this->setOutput($page, 'page');
     $this->setOutput($count, 'count');
     $this->setOutput($args, 'args');
     $this->setOutput($this->perpage, 'perPage');
     //$this->setOutput(ceil($count/$this->perpage), 'totalpage');
 }
 public function allistAction()
 {
     $page = $this->getInput('page');
     $schoolId = $this->getCurrentSchoolId();
     $schoolName = $this->setAreaFilterWidgetData();
     $count = $this->_getCateWeekReportDs()->countCakeWeekBySchoolId($schoolId);
     if (0 < $count) {
         $totalPage = ceil($count / $this->pageNumber);
         $page > $totalPage && ($page = $totalPage);
         list($start, $limit) = Pw::page2limit($page, $this->pageNumber);
         if ($page <= 0) {
             $page = 1;
         }
     }
     $allCateWeekList = $this->_getCateWeekReportDs()->getCakeWeekBySchoolId($schoolId, $start, $limit);
     foreach ($allCateWeekList as $key => $value) {
         $date = substr($value['releasedate'], 0, 10);
         $allCateWeekList[$key]['date'] = $date;
         $allCateWeekList[$key]['imageurl'] = 'src/extensions/4tschool' . str_replace('\\', '/', $value['breviaryphoto']);
     }
     $this->setOutput($allCateWeekList, "allCateWeekList");
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($this->pageNumber, 'perPage');
     $this->setOutput($schoolId, 'schoolId');
     //SEO Information
     $SEOTitleKeyword = '美食文章 - ' . $schoolName . '美食外卖';
     $this->setOutput($SEOTitleKeyword, 'SEOTitle');
     $this->setOutput($SEOTitleKeyword, 'SEOKeyword');
 }
 public function run()
 {
     $page = (int) $this->getInput('page', 'get');
     $perpage = 10;
     $args = array();
     $page = $page > 1 ? $page : 1;
     list($start, $perpage) = Pw::page2limit($page, $perpage);
     $list = $this->_getPageDs()->getPageList(PwDesignPage::SYSTEM, $start, $perpage);
     $count = $this->_getPageDs()->countPage(PwDesignPage::SYSTEM);
     $sysPage = Wekit::load('design.srv.router.PwDesignRouter')->get();
     foreach ($list as &$v) {
         if (isset($sysPage[$v['page_router']])) {
             list($pagename, $unique) = $sysPage[$v['page_router']];
         }
         list($m, $c, $a, $id) = explode('|', $v['page_router']);
         if ($unique) {
             $v['url'] = WindUrlHelper::createUrl($m . '/' . $c . '/' . $a, array($unique => $v['page_unique']), '', 'pw');
         } else {
             $v['url'] = WindUrlHelper::createUrl($m . '/' . $c . '/' . $a, array(), '', 'pw');
         }
         $sep = strpos($v['url'], '?') === false ? '?' : '&';
         $v['designurl'] = $v['url'] . $sep . 'design=1';
     }
     $this->setOutput($list, 'list');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput(ceil($count / $perpage), 'totalpage');
     $this->setOutput('design/page/run', 'pageurl');
 }
Exemple #14
0
 /**
  * 查看投票参与人员
  *
  * @return void
  */
 public function memberAction()
 {
     if (!$this->loginUser->getPermission('allow_view_vote')) {
         $this->showError('VOTE:group.not.allow.view');
     }
     list($pollid, $optionid) = $this->getInput(array('pollid', 'optionid'), 'get');
     $poll = $this->_getPollService()->getPoll($pollid);
     if (!$poll) {
         $this->showError('VOTE:thread.not.exist');
     }
     //$isVoted = $this->_getPollVoterDs()->isVoted($this->loginUser->uid, $pollid);
     //$allowView = (!$poll['isafter_view'] || $isVoted);
     //if (!$allowView) $this->showError('VOTE:not.allow.view');
     $page = $this->getInput('page');
     $page > 1 && ($this->page = $page);
     list($start, $limit) = Pw::page2limit($this->page, $this->perpage);
     $total = $this->_getPollVoterDs()->countUserByOptionid($optionid);
     $vote = $total ? $this->_getPollVoterDs()->getUserByOptionid($optionid, $limit, $start) : array();
     $uids = $userName = array();
     foreach ($vote as $value) {
         $uids[] = $value['uid'];
     }
     $userList = $uids ? $this->_getUserDs()->fetchUserByUid($uids) : array();
     foreach ($userList as $value) {
         $userName[$value['uid']] = $value['username'];
     }
     $this->_getPollService()->resetOptionVotedNum($optionid);
     $this->setOutput(array('data' => $userName));
     $this->showMessage('success');
 }
 public function run()
 {
     $page = intval($this->getInput('page'));
     $page < 1 && ($page = 1);
     $logSo = new PwLogSo();
     $logSo->setEndTime($this->getInput('end_time'))->setStartTime($this->getInput('start_time'))->setCreatedUsername($this->getInput('created_user'))->setOperatedUsername($this->getInput('operated_user'))->setFid($this->getInput('fid'))->setIp($this->getInput('ip'))->setKeywords($this->getInput('keywords'))->setTypeid($this->getInput('typeid'));
     /* @var $logDs PwLog */
     $logDs = Wekit::load('log.PwLog');
     $count = $logDs->coutSearch($logSo);
     /* @var $logSrv PwLogService */
     $logSrv = Wekit::load('log.srv.PwLogService');
     $list = array();
     if ($count > 0) {
         $page > $count && ($page = $count);
         $totalPage = ceil($count / $this->perpage);
         list($offset, $limit) = Pw::page2limit($page, $this->perpage);
         $list = $logSrv->searchManageLogs($logSo, $limit, $offset);
     }
     $this->setOutput($logSrv->getOperatTypeid(), 'typeids');
     $this->setOutput($logSrv->getOperatTypeTitle(), 'typeTitles');
     $this->setOutput($this->perpage, 'perpage');
     $this->setOutput($list, 'list');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($logSo->getSearchData(), 'searchData');
     $this->_getForumList();
     $this->setOutput($this->isFounder($this->loginUser->username), 'canClear');
 }
 public function run()
 {
     $this->_setNavType('promotionalmanage');
     $choosenSchoolId = -1;
     $promotionalstatus = -1;
     if ($this->getInput('type', 'post') === 'do') {
         list($choosenSchoolId, $promotionalstatus) = $this->getInput(array('choosenSchoolId', 'promotionalstatus'), 'post');
     }
     $page = $this->getInput('page');
     $searchCondition = array('choosenSchoolId' => $choosenSchoolId, 'promotionalstatus' => $promotionalstatus);
     $count = $this->_getPromotionalmanageDs()->countPromotional($searchCondition);
     if (0 < $count) {
         $totalPage = ceil($count / $this->pageNumber);
         $page > $totalPage && ($page = $totalPage);
         list($start, $limit) = Pw::page2limit($page, $this->pageNumber);
         if ($page <= 0) {
             $page = 1;
         }
     }
     $shopPromotionalList = $this->_getPromotionalmanageDs()->getAllShopsPromotional($searchCondition, $start, $limit);
     $shopPromotionalList = array_values($shopPromotionalList);
     $this->getSchoolList();
     $this->setOutput($shopPromotionalList, 'shopPromotionalList');
     $this->setOutput($searchCondition, 'searchCondition');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($this->pageNumber, 'perPage');
 }
 public function run()
 {
     $page = (int) $this->getInput('page', 'get');
     $perpage = 10;
     $args = array();
     $page = $page > 1 ? $page : 1;
     list($start, $perpage) = Pw::page2limit($page, $perpage);
     Wind::import('SRV:design.srv.vo.PwDesignPortalSo');
     $vo = new PwDesignPortalSo();
     $ds = $this->_getPortalDs();
     $count = $ds->countPartal($vo);
     $list = $ds->searchPortal($vo, $start, $perpage);
     $pageList = $this->_getPageDs()->fetchPageByTypeUnique(PwDesignPage::PORTAL, array_keys($list));
     foreach ($pageList as $k => $v) {
         foreach ($list as $_k => $_v) {
             if ($v['page_unique'] == $_k) {
                 $list[$_k]['page_id'] = $k;
             }
         }
     }
     $this->setOutput($list, 'list');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput(ceil($count / $perpage), 'totalpage');
     $this->setOutput('design/portal/run', 'pageurl');
 }
Exemple #18
0
 /**
  * 我关注的人发起的投票
  *
  */
 public function createAction()
 {
     $page = $this->getInput('page');
     $page = $page < 1 ? 1 : intval($page);
     list($start, $limit) = Pw::page2limit($page, $this->perpage);
     $followUids = $this->getFollowUids($this->loginUser->uid);
     $total = $this->_getPwPollDs()->countPollByUids($followUids);
     $pollInfo = array();
     if ($total) {
         Wind::import('SRV:poll.srv.dataSource.PwFetchPollByUids');
         $pollDisplay = new PwPollDisplay(new PwFetchPollByUids($followUids, $limit, $start));
         $pollInfo = $this->_buildPoll($pollDisplay->gather());
     }
     $latestPollDisplay = new PwPollDisplay(new PwFetchPollByOrder(10, 0, array('created_time' => '0')));
     $latestPoll = $latestPollDisplay->gather();
     $this->setOutput($total, 'total');
     $this->setOutput($pollInfo, 'pollInfo');
     $this->setOutput($latestPoll, 'latestPoll');
     $this->setOutput($page, 'page');
     $this->setOutput($this->perpage, 'perpage');
     $this->setOutput(array('allowview' => $this->loginUser->getPermission('allow_view_vote'), 'allowvote' => $this->loginUser->getPermission('allow_participate_vote')), 'pollGroup');
     if (!$total) {
         $num = 20;
         $uids = $this->_getRecommendService()->getRecommendAttention($this->loginUser->uid, $num);
         $recommend = $this->_getRecommendService()->buildUserInfo($this->loginUser->uid, $uids, $num);
         $this->setOutput($recommend, 'recommend');
     }
 }
 /**
  * 回复列表
  */
 public function replyAction()
 {
     list($page, $perpage) = $this->getInput(array('page', 'perpage'));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $count = $this->_getThreadExpandDs()->countDisabledPostByUid($this->loginUser->uid);
     if ($count) {
         $tmpPosts = $this->_getThreadExpandDs()->getDisabledPostByUid($this->loginUser->uid, $limit, $start);
         $posts = $tids = array();
         foreach ($tmpPosts as $v) {
             $tids[] = $v['tid'];
         }
         $threads = $this->_getThreadDs()->fetchThread($tids);
         foreach ($tmpPosts as $v) {
             $v['threadSubject'] = Pw::substrs($threads[$v['tid']]['subject'], 30);
             $v['content'] = Pw::substrs($v['content'], 30);
             $v['created_time'] = PW::time2str($v['created_time'], 'auto');
             $posts[] = $v;
         }
     }
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($posts, 'posts');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:bbs.article.reply.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
 public function run()
 {
     $page = (int) $this->getInput('page', 'get');
     $tagid = (int) $this->getInput('tag', 'get');
     $perpage = 10;
     $page = $page > 1 ? $page : 1;
     $service = $this->_getBuildLikeService();
     $tagLists = $service->getTagsByUid($this->loginUser->uid);
     if ($tagid > 0) {
         $resource = $this->_getLikeService()->allowEditTag($this->loginUser->uid, $tagid);
         if ($resource instanceof PwError) {
             $this->showError($resource->getError());
         }
         $count = $resource['number'];
         $logids = $service->getLogidsByTagid($tagid, $page, $perpage);
         $logLists = $service->getLogLists($logids);
     } else {
         list($start, $perpage) = Pw::page2limit($page, $perpage);
         $count = $this->_getLikeLogDs()->getLikeCount($this->loginUser->uid);
         $logLists = $service->getLogList($this->loginUser->uid, $start, $perpage);
     }
     // start
     $json = array();
     foreach ($logLists as $_log) {
         $_log['tags'] = array_unique((array) $_log['tags']);
         if (!$_log['tags']) {
             continue;
         }
         $tagJson = array();
         foreach ((array) $_log['tags'] as $_tagid) {
             if (!isset($tagLists[$_tagid]['tagname'])) {
                 continue;
             }
             $tagJson[] = array('id' => $_tagid, 'value' => $tagLists[$_tagid]['tagname']);
         }
         $json[] = array('id' => $_log['logid'], 'items' => $tagJson);
     }
     //end
     $likeLists = $service->getLikeList();
     $likeInfos = $service->getLikeInfo();
     $hotBrand = $this->_getLikeService()->getLikeBrand('day1', 0, 10, true);
     $args = $tagid > 0 ? array("tag" => $tagid) : array();
     $this->setOutput($args, 'args');
     $this->setOutput($logLists, 'logLists');
     $this->setOutput($likeLists, 'likeLists');
     $this->setOutput($likeInfos, 'likeInfos');
     $this->setOutput($tagLists, 'tagLists');
     $this->setOutput($hotBrand, 'hotBrand');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($json, 'likeJson');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:like.mylike.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
 /**
  * 关注-首页
  */
 public function run()
 {
     $type = $this->getInput('type');
     $page = intval($this->getInput('page'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $url = $classCurrent = array();
     $typeCounts = $this->_getTypeDs()->countUserType($this->loginUser->uid);
     if ($type) {
         $tmp = $this->_getTypeDs()->getUserByType($this->loginUser->uid, $type, $limit, $start);
         $follows = $this->_getDs()->fetchFollows($this->loginUser->uid, array_keys($tmp));
         $count = $typeCounts[$type] ? $typeCounts[$type]['count'] : 0;
         $url['type'] = $type;
         $classCurrent[$type] = 'current';
     } else {
         $follows = $this->_getDs()->getFollows($this->loginUser->uid, $limit, $start);
         $count = $this->loginUser->info['follows'];
         $classCurrent[0] = 'current';
     }
     $uids = array_keys($follows);
     $fans = $this->_getDs()->fetchFans($this->loginUser->uid, $uids);
     $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN | PwUser::FETCH_DATA | PwUser::FETCH_INFO);
     $service = $this->_getService();
     $typeArr = $service->getAllType($this->loginUser->uid);
     $userType = $service->getUserType($this->loginUser->uid, $uids);
     foreach ($userType as $key => $value) {
         $tmp = array();
         foreach ($value as $k => $v) {
             $tmp[$v] = $typeArr[$v];
         }
         ksort($tmp);
         $userType[$key] = $tmp;
     }
     $follows = WindUtility::mergeArray($follows, $userList);
     if (!$type && !$follows) {
         $num = 30;
         $uids = $this->_getRecommendService()->getOnlneUids($num);
         $uids = array_slice($uids, 0, 24);
         $this->setOutput($this->_getRecommendService()->buildUserInfo($this->loginUser->uid, $uids, $num), 'recommend');
     }
     $this->setOutput($follows, 'follows');
     $this->setOutput($typeArr, 'typeArr');
     $this->setOutput($type, 'type');
     $this->setOutput($userType, 'userType');
     $this->setOutput($typeCounts, 'typeCounts');
     $this->setOutput($fans, 'fans');
     $this->setOutput($classCurrent, 'classCurrent');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($url, 'url');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:bbs.follow.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
 /** 
  * 搜索用户
  */
 public function searchAction()
 {
     list($username, $usertag) = $this->getInput(array('username', 'usertag'));
     $page = intval($this->getInput('page'));
     $username = trim($username);
     $usertag = trim($usertag);
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $usertags = $this->_getUserTagService()->getUserTagList($this->loginUser->uid);
     !$usertags && ($hotTags = $this->_getUserTagDs()->getHotTag(10));
     $args = array();
     if ($username) {
         // 按用户名搜索
         Wind::import('SRV:user.vo.PwUserSo');
         $vo = new PwUserSo();
         $vo->setUsername($username);
         $searchDs = Wekit::load('SRV:user.PwUserSearch');
         $count = $searchDs->countSearchUser($vo);
         if ($count) {
             $users = $searchDs->searchUser($vo, $limit, $start);
             $uids = array_keys($users);
         }
         $args['username'] = $username;
     }
     if ($usertag) {
         // 按用户标签搜索
         $tagInfo = $this->_getUserTagDs()->getTagByName($usertag);
         if ($tagInfo) {
             $count = $this->_getUserTagRelationDs()->countRelationByTagid($tagInfo['tag_id']);
             $tagRelations = $this->_getUserTagRelationDs()->getRelationByTagid($tagInfo['tag_id'], $limit, $start);
             $uids = array();
             foreach ($tagRelations as $v) {
                 $uids[] = $v['uid'];
             }
         }
         $args['usertag'] = $usertag;
     }
     if ($uids) {
         $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN | PwUser::FETCH_DATA | PwUser::FETCH_INFO);
         $follows = $this->_getAttentionDs()->fetchFollows($this->loginUser->uid, $uids);
         $fans = $this->_getAttentionDs()->fetchFans($this->loginUser->uid, $uids);
         $friends = array_intersect_key($fans, $follows);
         $this->setOutput($fans, 'fans');
         $this->setOutput($friends, 'friends');
         $this->setOutput($userList, 'userList');
         $this->setOutput($follows, 'follows');
     }
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($args, 'args');
     $this->setOutput($hotTags, 'hotTags');
     $this->setOutput($usertags, 'usertags');
 }
 /**
 * 查看未读系统通知列表,并将已查看的未读消息设为已读
 * @access public
 * @return string
  <pre>
  /index.php?m=native&c=notice&type=(reply|system)&page=1&_json=1
  type:10 未读通知;0 所有系统消息
  response: html
  </pre>
 */
 public function run()
 {
     list($type, $page) = $this->getInput(array('type', 'page'));
     //                $type = 3;
     if ($type == 'reply') {
         $typeids = array(10);
         //回复提醒
         $exclude = false;
     } else {
         $typeids = array(1, 10);
         //排除私信提醒、回复提醒
         $exclude = true;
     }
     $page = intval($page);
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $notice_list = Wekit::loadDao('native.dao.PwNativeMessageNoticesDao')->getNoticesByTypeIds($this->uid, $typeids, $start, $limit, $exclude);
     $notice_list = $this->_getNoticeService()->formatNoticeList($notice_list);
     //                $noticeList = $this->_getNoticeDs()->getNotices($this->loginUser->uid,$type,$start, $limit);
     //		$noticeList = $this->_getNoticeService()->formatNoticeList($noticeList);
     //                var_dump($noticeList);exit;
     $typeCounts = $this->_getNoticeService()->countNoticesByType($this->uid);
     //获取用户通知总数
     //类型
     $typeid = intval($type);
     //获取所有NOTICE未读通知数
     $unreadCount = $this->_getNoticeDs()->getUnreadNoticeCount($this->uid);
     //                $unread_notice_cnt = Wekit::loadDao('native.dao.PwNativeMessageNoticesDao')->getUnreadCountByTypeIds($this->loginUser->uid,$typeids,$exclude);
     //		$this->_readNoticeList($unreadCount,$noticeList);//将消息设置为已读
     $this->_readNoticeList($unreadCount, $notice_list);
     //将消息设置为已读
     var_dump($notice_list, $unreadCount);
     exit;
     //count
     $count = intval($typeCounts[$typeid]['count']);
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput(ceil($count / $perpage), 'totalpage');
     $this->setOutput(array('type' => $typeid), 'args');
     $this->setOutput($typeid, 'typeid');
     $this->setOutput($typeCounts, 'typeCounts');
     $this->setOutput($noticeList, 'noticeList');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:mess.notice.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
Exemple #24
0
 public function run()
 {
     $aid = $this->getInput('aid', 'get');
     $page = $this->getInput('page');
     $this->page = $page < 1 ? 1 : intval($page);
     list($start, $limit) = Pw::page2limit($this->page, $this->perpage);
     $total = $this->_getPwAnnounceDs()->countAnnounceByTime(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')));
     $list = $total ? $this->_getPwAnnounceService()->formatAnnouncesUsername($this->_getPwAnnounceDs()->getAnnounceByTimeOrderByVieworder(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')), $limit, $start)) : array();
     $this->setOutput($total, 'total');
     $this->setOutput($list, 'list');
     $this->setOutput($aid, 'aid');
     $this->setOutput($this->page, 'page');
     $this->setOutput($this->perpage, 'perpage');
 }
Exemple #25
0
 public function execute(PwThreadDataSource $ds)
 {
     $this->_ds = $ds;
     $this->total = $ds->getTotal();
     $this->maxPage = min(ceil($this->total / $this->perpage), $this->_maxPage);
     $this->page < 1 && ($this->page = 1);
     $this->page > $this->maxPage && ($this->page = $this->maxPage);
     list($start, $limit) = Pw::page2limit($this->page, $this->perpage);
     $threaddb = $ds->getData($limit, $start);
     $this->runDo('initData', $threaddb);
     foreach ($threaddb as $key => $value) {
         $threaddb[$key] = $this->bulidThread($value);
     }
     $this->threaddb = $threaddb;
 }
 public function run()
 {
     $announceInfo = array();
     $page = $this->getInput('page');
     $page < 1 && ($page = 1);
     $perpage = 10;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $pageCount = $this->_getPwAnnounceDs()->countAnnounce();
     $announceInfos = $this->_getPwAnnounceDs()->getAnnounceOrderByVieworder($limit, $start);
     $announceInfos = $this->_getPwAnnounceService()->formatAnnouncesUsername($announceInfos);
     $this->setOutput($announceInfos, 'announceInfos');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($pageCount, 'pageCount');
 }
 /**
  * 整站模板
  *
  * @see WindController::run()
  */
 public function run()
 {
     $type = $this->getInput('type');
     $addons = Wekit::load('APPCENTER:service.srv.PwInstallApplication')->getConfig('style-type');
     $type || ($type = key($addons));
     $count = $this->_styleDs()->countByType($type);
     $results = array();
     if ($count > 0) {
         $page = (int) $this->getInput('page');
         $page < 1 && ($page = 1);
         list($start, $num) = Pw::page2limit($page, $this->perpage);
         $results = $this->_styleDs()->getStyleListByType($type, $num, $start);
     }
     $this->setOutput(array('type' => $type, 'addons' => $addons, 'perpage' => $this->perpage, 'page' => $page, 'count' => $count, 'styles' => $results));
 }
 /**
  * 关注-首页
  */
 public function run()
 {
     $type = $this->getInput('type');
     $page = intval($this->getInput('page'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $args = $classCurrent = array();
     /*		$typeCounts = $this->_getTypeDs()->countUserType($this->space->spaceUid);
     		if ($type) {
     			$tmp = $this->_getTypeDs()->getUserByType($this->space->spaceUid, $type, $limit, $start);
     			$follows = $this->_getDs()->fetchFollows($this->space->spaceUid, array_keys($tmp));
     			$count = $typeCounts[$type] ? $typeCounts[$type]['count'] : 0;
     			$classCurrent[$type] = 'current';
     			$args = array('type' => $type);
     		} else {*/
     $follows = $this->_getDs()->getFollows($this->space->spaceUid, $limit, $start);
     $count = $this->space->spaceUser['follows'];
     $classCurrent[0] = 'current';
     //}
     $uids = array_keys($follows);
     $fans = $this->_getDs()->fetchFans($this->loginUser->uid, $uids);
     $myfollows = $this->_getDs()->fetchFollows($this->loginUser->uid, $uids);
     $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_ALL);
     $service = $this->_getService();
     $args['uid'] = $this->space->spaceUid;
     $follows = WindUtility::mergeArray($follows, $userList);
     if (!$follows && $this->space->tome == PwSpaceBo::MYSELF) {
         $num = 20;
         $uids = $this->_getRecommendService()->getRecommendAttention($this->loginUser->uid, $num);
         $this->setOutput($this->_getRecommendService()->buildUserInfo($this->loginUser->uid, $uids, $num), 'recommend');
     }
     $this->setOutput($fans, 'fans');
     $this->setOutput($follows, 'follows');
     $this->setOutput($myfollows, 'myfollows');
     $this->setOutput($classCurrent, 'classCurrent');
     $this->setOutput($args, 'args');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput('follows', 'src');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:space.follows.run.title', array($this->space->spaceUser['username'], $this->space->space['space_name'])), '', $lang->getMessage('SEO:space.follows.run.description', array($this->space->spaceUser['username'])));
     Wekit::setV('seo', $seoBo);
 }
 public function run()
 {
     $this->_setNavType('merchandise');
     $shopList = $this->_getShopDs()->getAllShops(array('choosenShopid' => '-1', 'isactive' => '-1', 'ispartner' => '-1', 'isaudit' => '-1'));
     $shopList = array_values($shopList);
     $this->setOutput($shopList, 'shopList');
     $choosenShopid = $this->getInput('choosenShopid');
     if (!isset($choosenShopid) || $choosenShopid <= 0) {
         $choosenShopid = $shopList[0]['id'];
     }
     //check if the shop id come from search,
     if ($this->getInput('type', 'post') === 'search') {
         $choosenShopid = $this->getInput('searchShopid', 'post');
     }
     //分页
     $page = $this->getInput('page');
     $selectedFilter = $this->getInput('selectedFilter');
     $count = $this->_getMerchandiseDs()->countGetMerchandiseByShopId($choosenShopid, $schoolId);
     if (!empty($selectedFilter)) {
         $para = explode('_', $selectedFilter);
         $count = $this->_getMerchandiseDs()->CountGetMerchandiseBySpecialFilter($para[0], $para[1]);
     }
     if (0 < $count) {
         $totalPage = ceil($count / $this->pageNumber);
         $page > $totalPage && ($page = $totalPage);
         list($start, $limit) = Pw::page2limit($page, $this->pageNumber);
         if ($page <= 0) {
             $page = 1;
         }
     }
     $merchandiseList = $this->_getMerchandiseDs()->getMerchandiseByShopId($choosenShopid, $schoolId, $start, $limit);
     if (!empty($selectedFilter)) {
         $para = explode('_', $selectedFilter);
         $merchandiseList = $this->_getMerchandiseDs()->getMerchandiseBySpecialFilter($para[0], $para[1], $schoolId, $start, $limit);
         $this->setOutput($para[0], "selectedFilter");
     }
     $args['choosenShopid'] = $choosenShopid;
     $args['selectedFilter'] = $selectedFilter;
     $args['isall'] = 'all';
     $this->setOutput($choosenShopid, "choosenShopid");
     $this->setOutput($merchandiseList, 'merchandiseList');
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($args, 'args');
     $this->setOutput($this->pageNumber, 'perPage');
     $isall = $this->getInput("isall");
     $this->renderSpecialList($isall);
 }
 /**
  * 获取应用中心门户模版
  * 
  */
 public function getDesignAppStyle($page = 1, $perpage = 10)
 {
     $type = 'portal';
     $ds = Wekit::load('APPCENTER:service.PwStyle');
     $addons = Wekit::load('APPCENTER:service.srv.PwInstallApplication')->getConfig('style-type');
     $page < 1 && ($page = 1);
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $list = $ds->getStyleListByType($type, $limit, $start);
     foreach ($list as &$v) {
         if ($v['logo'] && strpos($v['logo'], 'http://') === false) {
             $args = array(Wekit::url()->themes, $addons[$type][1], $v['alias'], $v['logo']);
             $v['logo'] = implode('/', $args);
         }
     }
     return $list;
 }