本文整理汇总了PHP中UserData::model方法的典型用法代码示例。如果您正苦于以下问题:PHP UserData::model方法的具体用法?PHP UserData::model怎么用?PHP UserData::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserData
的用法示例。
在下文中一共展示了UserData::model方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUnreadCount
private function getUnreadCount()
{
$unreadCount = UserData::model()->getUnreadCount(Ibos::app()->user->uid);
$sidebarUnreadMap["mention"] = $unreadCount["unread_atme"];
$sidebarUnreadMap["comment"] = $unreadCount["unread_comment"];
$sidebarUnreadMap["notify"] = $unreadCount["unread_notify"];
$sidebarUnreadMap["pm"] = $unreadCount["unread_message"];
return $sidebarUnreadMap;
}
示例2: getHeader
public function getHeader($lang = array())
{
$onlineStatus = UserUtil::getOnlineStatus($this->getUid());
$styleMap = array(-1 => "o-pm-offline", 1 => "o-pm-online");
$data = array("user" => $this->getUser(), "assetUrl" => $this->getAssetUrl("user"), "swfConfig" => AttachUtil::getUploadConfig(), "onlineIcon" => $styleMap[$onlineStatus], "lang" => $lang);
if ($this->getIsWeiboEnabled()) {
$data["userData"] = UserData::model()->getUserData($this->getUid());
!$this->getIsMe() && ($data["states"] = Follow::model()->getFollowState(Ibos::app()->user->uid, $this->getUid()));
}
return $this->renderPartial("application.modules.user.views.header", $data, true);
}
示例3: actionIndex
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);
}
示例4: addComment
public function addComment($data, $forApi = false, $notCount = false, $lessUids = null)
{
$add = $this->escapeData($data);
if ($add["content"] === "") {
$this->addError("comment", Ibos::lang("Required comment content", "message.default"));
return false;
}
$add["isdel"] = 0;
$res = $this->add($add, true);
if ($res) {
isset($data["touid"]) && !empty($data["touid"]) && ($lessUids[] = intval($data["touid"]));
$scream = explode("//", $data["content"]);
Atme::model()->addAtme("message", "comment", trim($scream[0]), $res, null, $lessUids);
$table = ucfirst($add["table"]);
$pk = $table::model()->getTableSchema()->primaryKey;
$table::model()->updateCounters(array("commentcount" => 1), "`{$pk}` = {$add["rowid"]}");
if (Ibos::app()->user->uid != $add["moduleuid"] && $add["moduleuid"] != "") {
!$notCount && UserData::model()->updateKey("unread_comment", 1, true, $add["moduleuid"]);
}
if (!empty($add["touid"]) && $add["touid"] != Ibos::app()->user->uid && $add["touid"] != $add["moduleuid"]) {
!$notCount && UserData::model()->updateKey("unread_comment", 1, true, $add["touid"]);
}
if ($add["table"] == "feed") {
if (Ibos::app()->user->uid != $add["uid"]) {
UserUtil::updateCreditByAction("addcomment", Ibos::app()->user->uid);
UserUtil::updateCreditByAction("getcomment", $data["moduleuid"]);
}
Feed::model()->cleanCache($add["rowid"]);
}
if ($add["touid"] != Ibos::app()->user->uid || $add["moduleuid"] != Ibos::app()->user->uid && $add["moduleuid"] != "") {
$author = User::model()->fetchByUid(Ibos::app()->user->uid);
$config["{name}"] = $author["realname"];
$sourceInfo = Source::getCommentSource($add, $forApi);
$config["{url}"] = $sourceInfo["source_url"];
$config["{sourceContent}"] = StringUtil::parseHtml($sourceInfo["source_content"]);
if (!empty($add["touid"])) {
$config["{commentType}"] = "回复了我的评论:";
Notify::model()->sendNotify($add["touid"], "comment", $config);
} else {
$config["{commentType}"] = "评论了我的微博:";
if (!empty($add["moduleuid"])) {
Notify::model()->sendNotify($add["moduleuid"], "comment", $config);
}
}
}
}
return $res;
}
示例5: actionIndex
public function actionIndex()
{
$data = array();
$data["userData"] = UserData::model()->getUserData($this->uid);
$data["activeUser"] = UserData::model()->fetchActiveUsers();
$data["movements"] = Ibos::app()->setting->get("setting/wbmovement");
$data["enableMovementModule"] = WbCommonUtil::getMovementModules();
$data["uploadConfig"] = AttachUtil::getUploadConfig();
$this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Enterprise weibo")), array("name" => Ibos::lang("Index"), "url" => $this->createUrl("list/index")), array("name" => Ibos::lang("List"))));
$var["type"] = isset($_GET["type"]) ? StringUtil::filterCleanHtml($_GET["type"]) : "all";
$var["feedtype"] = isset($_GET["feedtype"]) ? StringUtil::filterCleanHtml($_GET["feedtype"]) : "all";
$var["feedkey"] = isset($_GET["feedkey"]) ? StringUtil::filterCleanHtml(urldecode($_GET["feedkey"])) : "";
$var["loadNew"] = isset($_GET["page"]) ? 0 : 1;
$var["loadMore"] = isset($_GET["page"]) ? 0 : 1;
$var["loadId"] = 0;
$var["nums"] = isset($_GET["page"]) ? WbConst::DEF_LIST_FEED_NUMS : 10;
$this->render("index", array_merge($data, $var, $this->getData($var)));
}
示例6: actionUserCard
public function actionUserCard()
{
$uid = EnvUtil::getRequest("uid");
$user = User::model()->fetchByUid($uid);
$onlineStatus = UserUtil::getOnlineStatus($uid);
$styleMap = array(-1 => "o-pm-offline", 1 => "o-pm-online");
if (empty($user)) {
$this->error(Ibos::lang("Request tainting", "error"));
} else {
$weiboExists = ModuleUtil::getIsEnabled("weibo");
$data = array("user" => $user, "status" => $styleMap[$onlineStatus], "lang" => Ibos::getLangSources(), "weibo" => $weiboExists);
if ($weiboExists) {
$data["userData"] = UserData::model()->getUserData($user["uid"]);
$data["states"] = Follow::model()->getFollowState(Ibos::app()->user->uid, $user["uid"]);
}
$content = $this->renderPartial("userCard", $data, true);
echo $content;
exit;
}
}
示例7: actionIndex
public function actionIndex()
{
$uid = Ibos::app()->user->uid;
$type = EnvUtil::getRequest("type");
$map = array("and");
if (!in_array($type, array("receive", "sent"))) {
$type = "receive";
}
if ($type == "receive") {
$con = "touid = '{$uid}' AND uid != '{$uid}' AND `isdel` = 0";
} else {
$con = "`uid` = {$uid} AND `isdel` = 0";
}
$map[] = $con;
$count = Comment::model()->count($con . " AND `isdel` = 0");
$pages = PageUtil::create($count);
$list = Comment::model()->getCommentList($map, "cid DESC", $pages->getLimit(), $pages->getOffset(), true);
$data = array("list" => $list, "type" => $type, "pages" => $pages);
UserData::model()->resetUserCount($uid, "unread_comment", 0);
$this->setPageTitle(Ibos::lang("Comment"));
$this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Message center"), "url" => $this->createUrl("mention/index")), array("name" => Ibos::lang("Comment"), "url" => $this->createUrl("comment/index"))));
$this->render("index", $data);
}
示例8: actionFollower
public function actionFollower()
{
$user = $this->getUser();
$count = Follow::model()->getFollowCount(array($user["uid"]));
$list = $this->getFollowData("follower", 0, WbConst::DEF_LIST_FEED_NUMS);
if ($this->getIsMe()) {
UserData::model()->resetUserCount($this->getUid(), "new_folower_count", 0);
}
$data = array("count" => $count[$user["uid"]], "list" => $list, "assetUrl" => Ibos::app()->assetManager->getAssetsUrl("user"), "moduleAssetUrl" => Ibos::app()->assetManager->getAssetsUrl("weibo"), "limit" => WbConst::DEF_LIST_FEED_NUMS);
$this->setPageState("breadCrumbs", array(array("name" => Ibos::lang("Enterprise weibo"), "url" => $this->createUrl("home/index")), array("name" => $user["realname"] . Ibos::lang("sbs fans"), "url" => $this->createUrl("personal/follower", array("uid" => $user["uid"]))), array("name" => Ibos::lang("List"))));
$this->render("follower", $data, false, array("user.default"));
}
示例9: actionLogin
public function actionLogin()
{
if (!Ibos::app()->user->isGuest) {
$return = array("login" => true, "formhash" => FORMHASH, "uid" => Yii::app()->user->uid, "user" => user::model()->fetchByUid(Ibos::app()->user->uid), "APPID" => Ibos::app()->setting->get("setting/iboscloud/appid"));
if (EnvUtil::getRequest("issetuser") != "true") {
$userData = UserUtil::getUserByPy();
$return["userData"] = $userData;
}
if (ModuleUtil::getIsEnabled("weibo")) {
$udata = UserData::model()->getUserData();
}
$return["user"]["following_count"] = isset($udata["following_count"]) ? $udata["following_count"] : 0;
$return["user"]["follower_count"] = isset($udata["follower_count"]) ? $udata["follower_count"] : 0;
$return["user"]["weibo_count"] = isset($udata["weibo_count"]) ? $udata["weibo_count"] : 0;
$this->ajaxReturn($return, "JSONP");
}
$account = Ibos::app()->setting->get("setting/account");
$userName = EnvUtil::getRequest("username");
$passWord = EnvUtil::getRequest("password");
$gps = EnvUtil::getRequest("gps");
$address = EnvUtil::getRequest("address");
$ip = Ibos::app()->setting->get("clientip");
$cookieTime = 0;
if (!$passWord || $passWord != addslashes($passWord)) {
$this->ajaxReturn(array("login" => false, "msg" => Ibos::lang("Passwd illegal", "user.default")), "JSONP");
}
$identity = new ICUserIdentity($userName, $passWord);
$result = $identity->authenticate(false);
if (0 < $result) {
$user = Ibos::app()->user;
if ($account["allowshare"] != 1) {
$user->setStateKeyPrefix(Ibos::app()->setting->get("sid"));
}
MainUtil::setCookie("autologin", 1, $cookieTime);
$user->login($identity, $cookieTime);
if ($user->uid != 1) {
MainUtil::checkLicenseLimit(true);
}
$urlForward = EnvUtil::referer();
$log = array("terminal" => "app", "password" => StringUtil::passwordMask($passWord), "ip" => $ip, "user" => $userName, "loginType" => "username", "address" => $address, "gps" => $gps);
Log::write($log, "login", sprintf("module.user.%d", Ibos::app()->user->uid));
$return = array("login" => true, "formhash" => EnvUtil::formHash(), "uid" => Ibos::app()->user->uid, "user" => user::model()->fetchByUid(Ibos::app()->user->uid), "APPID" => Ibos::app()->setting->get("setting/iboscloud/appid"));
if (ModuleUtil::getIsEnabled("weibo")) {
$udata = UserData::model()->getUserData();
}
$return["user"]["following_count"] = isset($udata["following_count"]) ? $udata["following_count"] : 0;
$return["user"]["follower_count"] = isset($udata["follower_count"]) ? $udata["follower_count"] : 0;
$return["user"]["weibo_count"] = isset($udata["weibo_count"]) ? $udata["weibo_count"] : 0;
if (EnvUtil::getRequest("issetuser") != "true") {
$userData = UserUtil::getUserByPy();
$return["userData"] = $userData;
}
$this->ajaxReturn($return, "JSONP");
} elseif ($result === 0) {
$this->ajaxReturn(array("login" => false, "msg" => Ibos::lang("User not fount", "user.default", array("{username}" => $userName))), "JSONP");
} elseif ($result === -1) {
$this->ajaxReturn(array("login" => false, "msg" => Ibos::lang("User lock", "user.default", array("{username}" => $userName))), "JSONP");
} elseif ($result === -2) {
$this->ajaxReturn(array("login" => false, "msg" => Ibos::lang("User disabled", "", array("{username}" => $userName))), "JSONP");
} elseif ($result === -3) {
$log = array("user" => $userName, "password" => StringUtil::passwordMask($passWord), "ip" => $ip);
Log::write($log, "illegal", "module.user.login");
$this->ajaxReturn(array("login" => false, "msg" => Ibos::lang("User name or password is not correct", "user.default")), "JSONP");
}
}
示例10: _updateFollowCount
private function _updateFollowCount($uid, $fids, $inc = true)
{
!is_array($fids) && ($fids = explode(",", $fids));
UserData::model()->updateKey("following_count", count($fids), $inc, $uid);
foreach ($fids as $fid) {
UserData::model()->updateKey("follower_count", 1, $inc, $fid);
UserData::model()->updateKey("new_folower_count", 1, $inc, $fid);
}
}
示例11: saveAtme
private function saveAtme($module, $table, $uids, $rowId)
{
$self = Ibos::app()->user->uid;
foreach ($uids as $uid) {
if ($uid == $self) {
continue;
}
$data[] = array("module" => $module, "table" => $table, "rowid" => $rowId, "uid" => $uid);
UserData::model()->updateUserCount($uid, "unread_atme", 1);
}
$res = array();
if (!empty($data)) {
foreach ($data as $value) {
$res[] = $this->add($value, true);
}
}
return !empty($res) ? implode(",", $res) : "";
}
示例12: actionSearchAt
public function actionSearchAt()
{
$users = UserData::model()->fetchRecentAt(Ibos::app()->user->uid);
$this->ajaxReturn(!empty($users) ? $users : array());
}
示例13: doEditFeed
public function doEditFeed($feedid, $type, $uid = null)
{
$return = array("isSuccess" => false);
if (empty($feedid)) {
} else {
$feedid = is_array($feedid) ? implode(",", $feedid) : intval($feedid);
$con = sprintf("feedid = %d", $feedid);
$isdel = $type == "delFeed" ? 1 : 0;
if ($type == "deleteFeed") {
$msg = array("user" => Ibos::app()->user->username, "ip" => EnvUtil::getClientIp(), "id" => $feedid, "value" => $this->get($feedid));
Log::write($msg, "db", "module.weibo.deleteFeed");
$res = $this->deleteAll($con);
$res && $this->_deleteFeedAttach($feedid);
} else {
$ids = explode(",", $feedid);
$feedList = $this->getFeeds($ids);
$res = $this->updateAll(array("isdel" => $isdel), $con);
if ($type == "feedRecover") {
foreach ($feedList as $v) {
UserData::model()->updateKey("feed_count", 1, true, $v["user_info"]["uid"]);
UserData::model()->updateKey("weibo_count", 1, true, $v["user_info"]["uid"]);
}
} else {
foreach ($feedList as $v) {
UserData::model()->updateKey("feed_count", -1, false, $v["user_info"]["uid"]);
UserData::model()->updateKey("weibo_count", -1, false, $v["user_info"]["uid"]);
}
}
$this->cleanCache($ids);
$query = $this->fetchAll(array("select" => "feedid", "condition" => sprintf("rowid = %d", $feedid)));
$sids = ConvertUtil::getSubByKey($query, "feedid");
$sids && $this->cleanCache($sids);
}
$commentQuery = $this->getDbConnection()->createCommand()->select("cid")->from("{{comment}}")->where(sprintf("`module` = 'weibo' AND `table` = 'feed' AND `rowid` = %d", $feedid))->queryAll();
$commentIds = ConvertUtil::getSubByKey($commentQuery, "cid");
$commentIds && Comment::model()->deleteComment($commentIds, null, "weibo");
FeedTopic::model()->deleteWeiboJoinTopic($feedid);
Atme::model()->deleteAtme("feed", null, $feedid);
$topics = FeedTopicLink::model()->fetchAll(array("select" => "topicid", "condition" => "feedid=" . $feedid));
$topicId = ConvertUtil::getSubByKey($topics, "topicid");
$topicId && FeedTopic::model()->updateCounters(array("count" => -1), sprintf("FIND_IN_SET(topicid,'%s')", implode(",", $topicId)));
FeedTopicLink::model()->deleteAll("feedid=" . $feedid);
if ($res) {
$return = array("isSuccess" => true);
$uid && UserUtil::updateCreditByAction("deleteweibo", $uid);
}
}
return $return;
}