public function getFocus() { return Focus::isFocus($this->t_user_id, 0, 'no'); }
public function actionInfo($id) { $model = $this->loadModel($id); $isFocus = Focus::isFocus($id, 0, 'no'); $html = '<div class="media media-user"><div class="media-left">'; $html .= '<a href="' . $model->url . '">'; $html .= '<img src="' . Profile::avatarByUserId($id) . '" alt="' . $model->username . '"/></a></div>'; $html .= '<div class="media-body"><h2 class="media-heading"><span class="fa fa-mars"></span> '; $html .= '<a href="' . $model->url . '">' . User::getNameById($model->id) . '</a>'; $html .= '<div class="time">最后登录:' . date('Y-m-d H:i:s', $model->profile->last_visit_time) . '<br>'; $html .= '粉丝:' . Focus::countTfocus($id) . ' (排名:' . Focus::fansRank($id) . ')</div></div>'; $html .= '<div class="media-footer"><a class="btn btn-xs ' . ($isFocus ? "btn-danger" : "btn-success") . ' btn-follow" href="' . Yii::app()->createUrl('/set/FocusEasy/', array('id' => $id)) . '">'; $html .= '<span class="glyphicon glyphicon-plus"></span>' . ($isFocus ? "已關注" : "關注") . '</a></div>'; echo $html; }