コード例 #1
0
ファイル: ApiController.php プロジェクト: AxelPanda/ibos
 public function actionLoadMoreDiggUser()
 {
     $feedId = intval(EnvUtil::getRequest("feedid"));
     $offset = intval(EnvUtil::getRequest("offset"));
     $result = FeedDigg::model()->fetchUserList($feedId, 5, $offset);
     $uids = ConvertUtil::getSubByKey($result, "uid");
     $followStates = Follow::model()->getFollowStateByFids(Ibos::app()->user->uid, $uids);
     $data["data"] = $this->renderPartial("application.modules.message.views.feed.digglistmore", array("list" => $result, "followstates" => $followStates), true);
     $data["isSuccess"] = true;
     $this->ajaxReturn($data);
 }
コード例 #2
0
ファイル: MentionController.php プロジェクト: AxelPanda/ibos
 public function actionIndex()
 {
     $uid = Ibos::app()->user->uid;
     $unreadAtMe = UserData::model()->countUnreadAtMeByUid($uid);
     $pageCount = Atme::model()->countByAttributes(array("uid" => $uid));
     $pages = PageUtil::create($pageCount);
     $atList = Atme::model()->fetchAllAtmeListByUid($uid, $pages->getLimit(), $pages->getOffset());
     $feedIds = ConvertUtil::getSubByKey($atList, "feedid");
     $diggArr = FeedDigg::model()->checkIsDigg($feedIds, $uid);
     $data = array("unreadAtmeCount" => $unreadAtMe, "list" => $atList, "pages" => $pages, "digg" => $diggArr);
     $this->setPageTitle(Ibos::lang("Mention me"));
     $this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Message center"), "url" => $this->createUrl("mention/index")), array("name" => Ibos::lang("Mention me"))));
     $this->render("index", $data);
 }
コード例 #3
0
ファイル: FeedController.php プロジェクト: AxelPanda/ibos
 public function actionSetDigg()
 {
     $uid = Ibos::app()->user->uid;
     $feedId = intval(EnvUtil::getRequest("feedid"));
     $alreadyDigg = FeedDigg::model()->getIsExists($feedId, $uid);
     if ($alreadyDigg) {
         $result = FeedDigg::model()->delDigg($feedId, $uid);
         if ($result) {
             $feed = Feed::model()->get($feedId);
             $res["isSuccess"] = true;
             $res["count"] = intval($feed["diggcount"]);
             $res["digg"] = 0;
         } else {
             $res["isSuccess"] = false;
             $res["msg"] = FeedDigg::model()->getError("delDigg");
         }
     } else {
         $result = FeedDigg::model()->addDigg($feedId, $uid);
         if ($result) {
             $user = User::model()->fetchByUid($uid);
             $feed = Feed::model()->get($feedId);
             $res["isSuccess"] = true;
             $res["count"] = intval($feed["diggcount"]);
             $res["data"] = $this->renderPartial("digg", array("user" => $user), true);
             $res["digg"] = 1;
         } else {
             $res["isSuccess"] = false;
             $res["msg"] = FeedDigg::model()->getError("addDigg");
         }
     }
     $this->ajaxReturn($res);
 }
コード例 #4
0
ファイル: PersonalController.php プロジェクト: AxelPanda/ibos
 protected function getData($var)
 {
     $data = array();
     $type = isset($var["new"]) ? "new" . $var["type"] : $var["type"];
     $where = "isdel = 0 AND uid = " . $this->getUid() . ($this->getIsMe() ? "" : " AND " . WbfeedUtil::getViewCondition(Ibos::app()->user->uid));
     switch ($type) {
         case "all":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $loadId = isset($var["loadId"]) ? $var["loadId"] : 0;
                 $list = Feed::model()->searchFeed($var["feedkey"], "all", $loadId, $var["nums"], $pages->getOffset(), "", $this->getUid());
                 $count = Feed::model()->countSearchAll($var["feedkey"], $loadId);
             } else {
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND type = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
                 $count = Feed::model()->count($where);
             }
             break;
         case "movement":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $loadId = isset($var["loadId"]) ? $var["loadId"] : 0;
                 $list = Feed::model()->searchFeed($var["feedkey"], "movement", $loadId, $var["nums"], $pages->getOffset(), "", $this->getUid());
                 $count = Feed::model()->countSearchMovement($var["feedkey"], $loadId);
             } else {
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND module = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 } else {
                     $where .= " AND module != 'weibo'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
                 $count = Feed::model()->count($where);
             }
             break;
         case "newmovement":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d AND uid = %d", WbfeedUtil::getViewCondition(Ibos::app()->user->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $count = Feed::model()->count($where);
                 $data["count"] = count($list);
             }
             break;
         case "newall":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 %s AND feedid > %d AND uid = %d", $this->getIsMe() ? "" : " AND " . WbfeedUtil::getViewCondition(Ibos::app()->user->uid), intval($var["maxId"]), $this->getUid());
                 $list = Feed::model()->getList($where);
                 $count = Feed::model()->countFollowingFeed($where);
                 $data["count"] = count($list);
             }
             break;
         default:
             break;
     }
     $count = isset($count) ? $count : WbConst::MAX_VIEW_FEED_NUMS;
     $pages = PageUtil::create($count, WbConst::DEF_LIST_FEED_NUMS);
     if (!isset($var["new"])) {
         $pages->route = "personal/index";
         $currentUrl = (string) Ibos::app()->getRequest()->getUrl();
         $replaceUrl = str_replace("weibo/personal/loadmore", "weibo/personal/index", $currentUrl);
         $data["pageData"] = $this->widget("IWPage", array("pages" => $pages, "currentUrl" => $replaceUrl), true);
     }
     if (!empty($list)) {
         $data["firstId"] = $list[0]["feedid"];
         $data["lastId"] = $list[count($list) - 1]["feedid"];
         $feedids = ConvertUtil::getSubByKey($list, "feedid");
         $diggArr = FeedDigg::model()->checkIsDigg($feedids, $this->getUid());
         foreach ($list as &$v) {
             switch ($v["module"]) {
                 case "mobile":
                     break;
                 default:
                     $v["from"] = EnvUtil::getFromClient($v["from"], $v["module"]);
                     break;
             }
         }
         $data["html"] = $this->renderPartial("application.modules.message.views.feed.feedlist", array("list" => $list, "diggArr" => $diggArr), true);
     } else {
         $data["html"] = "";
         $data["firstId"] = $data["lastId"] = 0;
     }
     return $data;
 }
コード例 #5
0
ファイル: WeiboController.php プロジェクト: AxelPanda/ibos
 protected function getData($var)
 {
     $data = array();
     $type = isset($var["new"]) ? "new" . $var["type"] : $var["type"];
     switch ($type) {
         case "following":
             $pages = PageUtil::create(1000, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "following", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "a.isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid, "a.");
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND a.feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND a.type = '" . $var["feedtype"] . "'";
                 }
                 $list = Feed::model()->getFollowingFeed($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "all":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "all", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid);
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND type = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "movement":
             $pages = PageUtil::create(WbConst::MAX_VIEW_FEED_NUMS, WbConst::DEF_LIST_FEED_NUMS);
             if (!empty($var["feedkey"])) {
                 $list = Feed::model()->searchFeed($var["feedkey"], "movement", $var["loadId"], $var["nums"], $pages->getOffset());
             } else {
                 $where = "isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid);
                 if (isset($var["loadId"]) && 0 < $var["loadId"]) {
                     $where .= " AND feedid < '" . intval($var["loadId"]) . "'";
                 }
                 if (!empty($var["feedtype"]) && $var["feedtype"] !== "all") {
                     $where .= " AND module = '" . StringUtil::filterCleanHtml($var["feedtype"]) . "'";
                 } else {
                     $where .= " AND module != 'weibo'";
                 }
                 $list = Feed::model()->getList($where, $var["nums"], $pages->getOffset());
             }
             break;
         case "newmovement":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d", WbfeedUtil::getViewCondition($this->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $data["count"] = count($list);
             }
             break;
         case "newfollowing":
             $where = "a.isdel = 0 AND " . WbfeedUtil::getViewCondition($this->uid, "a.");
             if (0 < $var["maxId"]) {
                 $where .= " AND a.feedid > '" . intval($var["maxId"]) . "'";
                 $list = Feed::model()->getFollowingFeed($where);
                 $data["count"] = count($list);
             }
             break;
         case "newall":
             if (0 < $var["maxId"]) {
                 $where = sprintf("isdel = 0 AND %s AND feedid > %d AND uid <> %d", WbfeedUtil::getViewCondition($this->uid), intval($var["maxId"]), $this->uid);
                 $list = Feed::model()->getList($where);
                 $data["count"] = count($list);
             }
             break;
         default:
             break;
     }
     if (!isset($var["new"])) {
         $pages->route = "home/index";
     }
     if (!empty($list)) {
         $data["firstId"] = $list[0]["feedid"];
         $data["lastId"] = $list[count($list) - 1]["feedid"];
         $feedids = ConvertUtil::getSubByKey($list, "feedid");
         $diggArr = FeedDigg::model()->checkIsDigg($feedids, $this->uid);
         foreach ($list as &$v) {
             switch ($v["module"]) {
                 case "mobile":
                     break;
                 default:
                     $v["from"] = EnvUtil::getFromClient($v["from"], $v["module"]);
                     break;
             }
             if (isset($v["attach_id"][0])) {
                 $_tmp = AttachUtil::getAttachData($v["attach_id"][0]);
                 $v["attach_url"] = FileUtil::getAttachUrl() . "/" . $_tmp[$v["attach_id"][0]]["attachment"];
             }
             if (isset($v["api_source"]["attach"][0]["attach_url"])) {
                 $v["api_source"]["attach_url"] = $v["api_source"]["attach"][0]["attach_url"];
                 unset($v["api_source"]["attach"]);
                 unset($v["api_source"]["source_body"]);
             }
             unset($v["user_info"]);
             unset($v["body"]);
             unset($v["sourceInfo"]);
             unset($v["api_source"]["source_user_info"]);
             unset($v["api_source"]["avatar_big"]);
             unset($v["api_source"]["avatar_middle"]);
             unset($v["api_source"]["avatar_small"]);
             unset($v["api_source"]["source_url"]);
             unset($v["feeddata"]);
         }
         $data["list"] = $list;
         $data["diggArr"] = $diggArr;
     } else {
         $data["list"] = array();
         $data["firstId"] = $data["lastId"] = 0;
     }
     return $data;
 }