Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
VoteModule Class Reference

Public Member Functions

 getLoginUrl ()
 init ()
 getUserId ()
 isUserVoted ($questionId, $userId=null)
 setUserVoted ($questionId, $userId=null)
 setUserUnvoted ($questionId, $userId=null)
 isAdmin ()
 getAssetsUrl ()

Static Public Member Functions

static t ($str= '', $params=array(), $dic= 'core')

Public Attributes

 $debug = false
 $_assetsUrl

Detailed Description

Gentics Portal.Node PHP Author & Copyright (c) by Gentics Software GmbH sales.nosp@m.@gen.nosp@m.tics..nosp@m.com http://www.gentics.com Licenses can be found in the LICENSE.txt file in the root-folder of this installation You must not use this software without a valid license agreement.

VoteModule This module represent voting system which manage by questions and answers and return statistics of answers

Definition at line 16 of file VoteModule.php.

Member Function Documentation

VoteModule::getAssetsUrl ( )

Publish module assets and return url

Returns
string

Definition at line 106 of file VoteModule.php.

{
if (!$this->_assetsUrl) {
$this->_assetsUrl = Yii::app()->assetManager->publish(Yii::getPathOfAlias('vote.assets'), true, -1, $this->debug);
}
return $this->_assetsUrl;
}
VoteModule::getUserId ( )

Get current user id

Returns
string

Definition at line 52 of file VoteModule.php.

Referenced by isUserVoted(), setUserUnvoted(), and setUserVoted().

{
return Yii::app()->user->isGuest ? Yii::app()->session->getSessionId() : Yii::app()->user->id;
}
VoteModule::isUserVoted (   $questionId,
  $userId = null 
)

Checks if user already answered for question

Returns
boolean

Definition at line 62 of file VoteModule.php.

References getUserId().

{
if($userId == null) {
$userId = $this->getUserId();
}
return Yii::app()->user->getState('vote-voted-'.$questionId) === true;
}
VoteModule::setUserUnvoted (   $questionId,
  $userId = null 
)

Unset status of question as answered

Returns
void

Definition at line 88 of file VoteModule.php.

References getUserId().

{
if($userId == null) {
$userId = $this->getUserId();
}
Yii::app()->user->setState('vote-voted-'.$questionId, false);
}
VoteModule::setUserVoted (   $questionId,
  $userId = null 
)

Set status of question as answered

Returns
void

Definition at line 75 of file VoteModule.php.

References getUserId().

{
if($userId == null) {
$userId = $this->getUserId();
}
Yii::app()->user->setState('vote-voted-'.$questionId, true);
}
static VoteModule::t (   $str = '',
  $params = array(),
  $dic = 'core' 
)
static

Translates a message to the specified language.

Parameters
string$strmessage
array$paramsparams
string$dicdictionary
Returns
string

Definition at line 42 of file VoteModule.php.

{
return Yii::t("VoteModule." . $dic, $str, $params);
}

The documentation for this class was generated from the following file: