本文整理匯總了PHP中Model_Users::FollowUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model_Users::FollowUser方法的具體用法?PHP Model_Users::FollowUser怎麽用?PHP Model_Users::FollowUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model_Users
的用法示例。
在下文中一共展示了Model_Users::FollowUser方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: indexAction
public function indexAction()
{
/*
$request = $this->getRequest();
if($request->isPost()) {
if( !$request->getPost('category_id') || count($request->getPost('category_id')) < 1 ) {
$this->view->error = true;
} else {
JO_Session::set('category_id', $request->getPost('category_id'));
$this->redirect( WM_Router::create($request->getBaseUrl() . '?controller=welcome&action=second') );
}
}
$this->helpas();
//////////// Categories ////////////
$this->view->categories = array();
$categories = Model_Categories::getCategories(array(
'filter_status' => 1
));
$model_images = new Helper_Images();
foreach($categories AS $category) {
if($category['image']) {
$category['thumb'] = $model_images->resize($category['image'], 113, 113, true);
} else {
$category['thumb'] = $model_images->resize(JO_Registry::get('no_avatar'), 113, 113);
}
$this->view->categories[] = $category;
}
}
function secondAction() {
*/
$request = $this->getRequest();
$this->helpas();
//$categories = JO_Session::get('category_id');
$userSports = Model_Users::getUserSports(JO_Session::get('user[user_id]'));
$categories = array();
foreach ($userSports as $userSport) {
$categories[] = $userSport["sport_category"];
}
$users = "";
if (!$categories || count($categories) < 1) {
$this->view->error = true;
Model_Users::edit(JO_Session::get('user[user_id]'), array('first_login' => '0'));
} else {
JO_Session::set('category_id', $categories);
$users = Model_Users::getUsers(array('filter_welcome' => $categories, 'start' => 0, 'limit' => 20));
}
/*if(!$users) {
JO_Session::clear('category_id');
$this->redirect( WM_Router::create($request->getBaseUrl() . '?controller=welcome') );
}
*/
$this->view->boards = '';
if ($users) {
$view = JO_View::getInstance();
$view->loged = JO_Session::get('user[user_id]');
$model_images = new Helper_Images();
foreach ($users as $key => $user) {
$user['thumbs'] = array();
for ($i = 0; $i < min(8, count($user['pins_array'])); $i++) {
$image = isset($user['pins_array'][$i]) ? $user['pins_array'][$i]['image'] : false;
if (isset($user['pins_array'][$i])) {
$image = Helper_Uploadimages::pin($user['pins_array'][$i], '_A');
if ($image) {
$user['thumbs'][] = array('thumb' => $image['image'], 'href' => WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $user['pins_array'][$i]['pin_id']), 'title' => $user['pins_array'][$i]['title']);
}
}
}
$avatar = Helper_Uploadimages::avatar($user, '_B');
$user['avatar'] = $avatar['image'];
$user['userLikeIgnore'] = true;
if (JO_Session::get('user[user_id]') == $user['user_id']) {
$user['userIsFollow'] = 1;
$user['userFollowIgnore'] = true;
} else {
$user['userIsFollow'] = Model_Users::isFollowUser($user['user_id']);
if (!$user['userIsFollow']) {
$user['userIsFollow'] = Model_Users::FollowUser($user['user_id']);
}
$user['userFollowIgnore'] = false;
}
$user['href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']);
$user['pins_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $user['user_id']);
$user['follow'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $user['user_id']);
$view->key = $key % 2 == 0;
$view->user = $user;
$this->view->boards .= $view->render('box', 'users');
}
}
$this->view->pinmarklet_href = WM_Router::create($request->getBaseUrl() . '?controller=pages&action=read&page_id=' . JO_Registry::get('page_pinmarklet'));
//$this->view->direct_path = WM_Router::create( $request->getBaseUrl() . '?direct_path=true' );
if (JO_Registry::get('isMobile')) {
//.........這裏部分代碼省略.........
示例2: followAction
public function followAction()
{
$this->noViewRenderer(true);
$request = $this->getRequest();
if ((int) JO_Session::get('user[user_id]')) {
$user_id = $request->getRequest('user_id');
$board_info = Model_Users::getUser($user_id);
if ($board_info) {
if ($user_id) {
if (Model_Users::isFollowUser($user_id)) {
$result = Model_Users::UnFollowUser($user_id);
if ($result) {
$this->view->ok = $this->translate('Follow');
$this->view->classs = 'add';
Model_History::addHistory($user_id, Model_History::UNFOLLOW_USER);
} else {
$this->view->error = true;
}
} else {
$result = Model_Users::FollowUser($user_id);
if ($result) {
$this->view->ok = $this->translate('Unfollow');
$this->view->classs = 'remove';
Model_History::addHistory($user_id, Model_History::FOLLOW_USER);
if ($board_info['email_interval'] == 1 && $board_info['follows_email']) {
$this->view->user_info = $board_info;
$this->view->profile_href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . JO_Session::get('user[user_id]'));
$this->view->full_name = JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]');
$this->view->text_email = $this->translate('now follow you');
Model_Email::send($board_info['email'], JO_Registry::get('noreply_mail'), JO_Session::get('user[firstname]') . ' ' . JO_Session::get('user[lastname]') . ' ' . $this->translate('follow your'), $this->view->render('follow_user', 'mail'));
}
} else {
$this->view->error = true;
}
}
} else {
$this->view->error = true;
}
} else {
$this->view->error = true;
}
} else {
$this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=landing');
}
if ($request->isXmlHttpRequest()) {
echo $this->renderScript('json');
} else {
$this->redirect($request->getServer('HTTP_REFERER'));
}
}