当前位置: 首页>>代码示例>>PHP>>正文


PHP Feed::model方法代码示例

本文整理汇总了PHP中Feed::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Feed::model方法的具体用法?PHP Feed::model怎么用?PHP Feed::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Feed的用法示例。


在下文中一共展示了Feed::model方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: hasView

 public static function hasView($feedid, $uid)
 {
     $feed = Feed::model()->get($feedid);
     $feedUser = User::model()->fetchByUid($feed["uid"]);
     $user = User::model()->fetchByUid($uid);
     if ($feed && $feed["view"] !== WbConst::SELF_VIEW_SCOPE) {
         $fuDeptIds = StringUtil::filterStr($feedUser["alldeptid"] . "," . $feedUser["alldowndeptid"]);
         $deptIds = StringUtil::filterStr($user["alldeptid"] . "," . $user["allupdeptid"]);
         if ($feed["view"] == WbConst::ALL_VIEW_SCOPE) {
             return true;
         } elseif ($feed["view"] == WbConst::SELFDEPT_VIEW_SCOPE) {
             if (StringUtil::findIn($fuDeptIds, $deptIds)) {
                 return true;
             }
         } else {
             if (StringUtil::findIn($feed["userid"], $uid)) {
                 return true;
             }
             if (StringUtil::findIn($feed["positionid"], $user["allposid"])) {
                 return true;
             }
             if (StringUtil::findIn($fuDeptIds, $deptIds)) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:28,代码来源:WbfeedUtil.php

示例2: loadModel

 public function loadModel($id)
 {
     $model = Feed::model()->findByPk($id);
     if (null === $model) {
         throw new CHttpException(404, Yii::t('app', 'The requested page does not exist.'));
     }
     return $model;
 }
开发者ID:mjrouser,项目名称:cityapi,代码行数:8,代码来源:FeedController.php

示例3: getInfoFromFeed

 private static function getInfoFromFeed($table, $rowId, $forApi)
 {
     $info = Feed::model()->getFeedInfo($rowId, $forApi);
     $info["source_user_info"] = User::model()->fetchByUid($info["uid"]);
     $info["source_user"] = $info["uid"] == Ibos::app()->user->uid ? Ibos::lang("Me", "message.default") : "<a href=\"" . $info["source_user_info"]["space_url"] . "\" class=\"anchor\" target=\"_blank\">" . $info["source_user_info"]["realname"] . "</a>";
     $info["source_type"] = "微博";
     $info["source_title"] = "";
     $info["source_url"] = Ibos::app()->urlManager->createUrl("weibo/personal/feed", array("feedid" => $rowId, "uid" => $info["uid"]));
     $info["source_content"] = $info["content"];
     $info["ctime"] = $info["ctime"];
     return $info;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:12,代码来源:Source.php

示例4: actionIndex

 public function actionIndex()
 {
     $userId = Yii::app()->user->id;
     $sql = "(select f.* from dxd_course_learn cl inner join dxd_course_feed cf on cl.courseId=cf.courseId inner join dxd_feed f on cf.feedid=f.id where cl.userId={$userId})" . "union (select f2.* from dxd_user_follow uf inner join dxd_user_feed ufd on uf.followed_userId=ufd.userId inner join dxd_feed f2 on ufd.feedid=f2.id where uf.follow_userId={$userId})" . ' order by addTime desc';
     $feeds = Feed::model()->findAllBySql($sql);
     //		$count=Yii::app()->db->createCommand($sql)->queryScalar();
     /*		$dataProvider =new  CSqlDataProvider($sql,array('keyField'=>'id',
     				'totalItemCount'=>$count,
     			    'pagination'=>array(
     			        'pageSize'=>30,
     			    )));*/
     $dataProvider = new CArrayDataProvider($feeds);
     $this->render('index', array('dataProvider' => $dataProvider));
 }
开发者ID:stan5621,项目名称:jp_edu_online,代码行数:14,代码来源:FeedController.php

示例5: actionManage

 public function actionManage()
 {
     $op = EnvUtil::getRequest("op");
     if (EnvUtil::submitCheck("formhash")) {
         if (!in_array($op, array("delFeed", "deleteFeed", "feedRecover"))) {
             exit;
         }
         $ids = EnvUtil::getRequest("ids");
         foreach (explode(",", $ids) as $id) {
             Feed::model()->doEditFeed($id, $op);
         }
         $this->ajaxReturn(array("isSuccess" => true));
     } else {
         if (!in_array($op, array("list", "recycle"))) {
             $op = "list";
         }
         $map = "";
         if ($op == "list") {
             $map = "isdel = 0";
         } else {
             $map = "isdel = 1";
         }
         if (EnvUtil::getRequest("search")) {
             $key = StringUtil::filterCleanHtml(EnvUtil::getRequest("search"));
             $count = Feed::model()->countSearchFeeds($key);
             $inSearch = true;
         } else {
             $count = Feed::model()->count($map);
             $inSearch = false;
         }
         $pages = PageUtil::create($count);
         if ($inSearch) {
             $list = Feed::model()->searchFeeds($key, null, $pages->getLimit(), $pages->getOffset());
         } else {
             $list = Feed::model()->getList($map, $pages->getLimit(), $pages->getOffset());
         }
         $data = array("op" => $op, "list" => $list, "pages" => $pages, "moduleAssetUrl" => Ibos::app()->assetManager->getAssetsUrl("weibo"));
         $this->render("manage", $data);
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:40,代码来源:DashboardController.php

示例6: actionAllowedlist

 public function actionAllowedlist()
 {
     $feedId = intval(EnvUtil::getRequest("feedid"));
     $feed = Feed::model()->getFeedInfo($feedId);
     if (!$feed) {
         exit("该条动态不存在");
     }
     $list = array();
     if ($feed["view"] == "1") {
         $list["users"] = Ibos::lang("My self");
     } elseif (!empty($feed["userid"])) {
         $list["users"] = User::model()->fetchRealnamesByUids($feed["userid"]);
     }
     if (!empty($feed["deptid"])) {
         if ($feed["deptid"] == "alldept" || $feed["view"] == "0") {
             $list["dept"] = Ibos::lang("All dept");
         } else {
             if ($feed["view"] == "2") {
                 $deptIds = StringUtil::filterStr(Ibos::app()->user->alldeptid . "," . Ibos::app()->user->alldowndeptid);
             } else {
                 $deptIds = $feed["deptid"];
             }
             if (!empty($deptIds)) {
                 $list["dept"] = Department::model()->fetchDeptNameByDeptId($deptIds);
             } else {
                 $list["dept"] = "";
             }
         }
     }
     if (!empty($feed["positionid"])) {
         $list["pos"] = Position::model()->fetchPosNameByPosId($feed["positionid"]);
     }
     $this->renderPartial("allowedlist", $list);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:34,代码来源:FeedController.php

示例7: delDigg

 public function delDigg($feedId, $uid)
 {
     $data["feedid"] = $feedId;
     $data["uid"] = $uid;
     $data["uid"] = !$data["uid"] ? Ibos::app()->user->uid : $data["uid"];
     if (!$data["uid"]) {
         $this->addError("delDigg", "未登录不能取消赞");
         return false;
     }
     $isExit = $this->getIsExists($feedId, $uid);
     if (!$isExit) {
         $this->addError("delDigg", "取消赞失败,您可能已取消过赞信息");
         return false;
     }
     $res = $this->deleteAllByAttributes($data);
     if ($res) {
         Feed::model()->updateCounters(array("diggcount" => -1), "feedid=" . $feedId);
         Feed::model()->cleanCache($feedId);
     }
     return $res;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:21,代码来源:FeedDigg.php

示例8: getData

 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;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:90,代码来源:PersonalController.php

示例9: getData

 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"]);
//.........这里部分代码省略.........
开发者ID:AxelPanda,项目名称:ibos,代码行数:101,代码来源:WeiboController.php

示例10: commentRecover

 public function commentRecover($id)
 {
     if (empty($id)) {
         return false;
     }
     $con = "cid = " . $id;
     $criteria = array("select" => "cid,module,`table`,rowid,moduleuid,uid", "condition" => $con);
     $comment = $this->fetch($criteria);
     $save["isdel"] = 0;
     if ($this->updateAll($save, $con)) {
         $model = ucfirst($comment["table"]);
         $model::model()->updateCounters(array("commentcount" => 1), "`" . $comment["table"] . "id`=" . $comment["rowid"]);
         switch ($comment["table"]) {
             case "feed":
                 $feedIds = $this->fetch(array("select" => "rowid", "condition" => $con));
                 $feedId = array($feedIds["rowid"]);
                 Feed::model()->cleanCache($feedId);
                 break;
         }
         return true;
     }
     return false;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:23,代码来源:Comment.php

示例11: updateToWeibo

 private function updateToWeibo($data, $sourceInfo, $lessUids)
 {
     $commentInfo = Source::getSourceInfo($data["table"], $data["rowid"], false, $data["module"]);
     $oldInfo = isset($commentInfo["sourceInfo"]) ? $commentInfo["sourceInfo"] : $commentInfo;
     $arr = array("post", "postimage");
     $scream = "";
     if (!in_array($sourceInfo["type"], $arr)) {
         $scream = "//@" . $commentInfo["source_user_info"]["realname"] . ":" . $commentInfo["source_content"];
     }
     if (!empty($data["tocid"])) {
         $replyInfo = Comment::model()->getCommentInfo($data["tocid"], false);
         $replyScream = "//@" . $replyInfo["user_info"]["realname"] . " :";
         $data["content"] .= $replyScream . $replyInfo["content"];
     }
     $s["body"] = $data["content"] . $scream;
     $s["curid"] = null;
     $s["sid"] = $oldInfo["source_id"];
     $s["module"] = $oldInfo["module"];
     $s["type"] = $oldInfo["source_table"];
     $s["comment"] = 1;
     $s["comment_touid"] = $data["moduleuid"];
     if ($sourceInfo["type"] == "post" && empty($data["touid"])) {
         $lessUids[] = Ibos::app()->user->uid;
     }
     Feed::model()->shareFeed($s, "comment", $lessUids);
     UserUtil::updateCreditByAction("forwardedweibo", Ibos::app()->user->uid);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:27,代码来源:IWWeiboComment.php


注:本文中的Feed::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。