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

Public Member Functions

 getLoginUrl ()
 init ()
 getAssetsUrl ()

Static Public Member Functions

static canDelete (Comment $comment)
static canApprove ($comment)
static isEmailModerator ($email)
static t ($str= '', $params=array(), $dic= 'core')

Public Attributes

 $hashSalt = 'h1ads29ds1a91hgj29jl451'
 $notificationsEmail = 'comments@example.com'
 $cacheTime = 60

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.

Comments module class file.

Definition at line 12 of file CommentsModule.php.

Member Function Documentation

static CommentsModule::canApprove (   $comment)
static

Check if current user have approve permission on comment

Parameters
Comment$commentcomment model
Returns
bool

Definition at line 77 of file CommentsModule.php.

Referenced by CommentController\actionApprove().

{
return $comment->moderator_email == Yii::app()->user->email || Yii::app()->user->checkAccess('manageComments');
}
static CommentsModule::canDelete ( Comment  $comment)
static

Check if current user have delete permission on comment

Parameters
Comment$commentcomment for operation
Returns
bool

Definition at line 62 of file CommentsModule.php.

Referenced by CommentController\actionDelete().

{
return
($comment->user_id != null && $comment->user_id == Yii::app()->user->id) ||
$comment->moderator_email == Yii::app()->user->email ||
Yii::app()->user->checkAccess('manageComments');
}
CommentsModule::getAssetsUrl ( )

Publish module assets and return url

Returns
string

Definition at line 99 of file CommentsModule.php.

{
if (!$this->_assetsUrl) {
$this->_assetsUrl = Yii::app()->assetManager->publish(Yii::getPathOfAlias('comments.assets'), true);
}
return $this->_assetsUrl;
}
CommentsModule::getLoginUrl ( )

page contained UserLoginWidget

Returns
mixed

Definition at line 28 of file CommentsModule.php.

{
return is_array(Yii::app()->getModule('user')->loginUrl) ? Yii::app()->getModule('user')->loginUrl[0] : Yii::app()->getModule('user')->loginUrl;
}
CommentsModule::init ( )

Import dependent classes

Returns
void

Definition at line 43 of file CommentsModule.php.

{
// import the module-level models and components
$this->setImport(
array(
'comments.models.*',
'comments.widgets.*',
)
);
}
static CommentsModule::isEmailModerator (   $email)
static

Check if exists comments with such moderator email

Parameters
string$emailemail
Returns
bool

Definition at line 89 of file CommentsModule.php.

References Comment\model().

{
return !empty($email) ? Comment::model()->countByAttributes(array('moderator_email' => $email)) > 0 : false;
}
static CommentsModule::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 116 of file CommentsModule.php.

Referenced by CommentController\actionApprove(), CommentController\actionCreate(), CommentController\actionDelete(), CommentController\actionRemoteApprove(), CommentController\actionRemoteDelete(), Comment\attributeLabels(), Comment\getStatusText(), CommentController\onCommentCreated(), and CommentController\onCommentDeleted().

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

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