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

Public Member Functions

 tableName ()
 rules ()
 relations ()
 getLikes ()
 setLikes ($value)
 getLikesQty ()
 setLikesQty ($value)

Static Public Member Functions

static model ($className=__CLASS__)

Public Attributes

 $userId
 $lastLikesQty
 $topLikesQty

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.

Like class

Definition at line 13 of file Like.php.

Member Function Documentation

Like::getLikes ( )

Returns quantity of likes fot current content

Returns
integer

Definition at line 94 of file Like.php.

References $topLikesQty, and model().

{
if ($this->_likes === null) {
$criteria = new CDbCriteria;
$criteria->compare('content_id', $this->content_id);
$criteria->order = 'createdate DESC';
$criteria->limit = ($this->lastLikesQty + $this->topLikesQty);
$likes = self::model()->with('profile')->findAll($criteria);
$this->_likes = $likes;
}
return $this->_likes;
}
Like::getLikesQty ( )

Calculates and returns quantity of likes fot current content

Returns
array

Definition at line 128 of file Like.php.

References model().

{
if ($this->_likesQty === null) {
$criteria = new CDbCriteria;
$criteria->compare('content_id', $this->content_id);
$qty = self::model()->count($criteria);
$this->_likesQty = $qty;
}
return $this->_likesQty;
}
static Like::model (   $className = __CLASS__)
static

Returns a model

Parameters
string$className- Class name
Returns
array|CActiveRecord

Definition at line 45 of file Like.php.

Referenced by BulkController\actionClear(), LikeController\actionIndex(), BulkController\actionIndex(), getLikes(), and getLikesQty().

{
return parent::model($className);
}
Like::relations ( )

Defines model relations

Returns
array

Definition at line 81 of file Like.php.

{
return array(
'profile' => array(self::BELONGS_TO, 'Profile', 'user_id'),
'user' => array(self::BELONGS_TO, 'User', 'user_id')
);
}
Like::rules ( )

Returns the validation rules for attributes.

Returns
array

Definition at line 66 of file Like.php.

{
return array(
array('user_id, content_id', 'required'),
array('user_id', 'numerical', 'integerOnly' => true),
array('content_id, createdate', 'length', 'max' => 255)
);
}
Like::setLikes (   $value)

Set quantity of likes fot current content

Parameters
array$valuevalue
Returns
void

Definition at line 117 of file Like.php.

{
$this->_likes = $value;
}
Like::setLikesQty (   $value)

Set the quantity of likes fot current content

Parameters
int$valueqty
Returns
void

Definition at line 148 of file Like.php.

{
$this->_likesQty = $value;
}
Like::tableName ( )

Defines a table name

Returns
string

Definition at line 56 of file Like.php.

{
return '{{likes}}';
}

Member Data Documentation

Like::$topLikesQty

Quantity of users to be shown at the front

Definition at line 31 of file Like.php.

Referenced by getLikes().


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