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

Public Member Functions

 tableName ()
 rules ()
 relations ()
 attributeLabels ()
 search ()
 getItemChecksum ($encrypted=false)

Static Public Member Functions

static model ($className=__CLASS__)
static addCurrency ($price)

Detailed Description

Definition at line 27 of file Item.php.

Member Function Documentation

static Item::addCurrency (   $price)
static

Returns the price with currency in the correct local format

Parameters
string$pricethe price that you want to attach currency
Returns
string price with currency

Definition at line 137 of file Item.php.

{
$currency = Yii::app()->getModule('shoppingcart')->currency;
return Yii::app()->numberFormatter->formatCurrency($price, $currency);
}
Item::attributeLabels ( )
Returns
array customized attribute labels (name=>label)

Definition at line 86 of file Item.php.

References WebCustModule\t().

{
return array(
'id' => ShoppingcartModule::t('ID'),
'price' => ShoppingcartModule::t('Price'),
'admin_email' => ShoppingcartModule::t('Admin Email'),
'page_id' => ShoppingcartModule::t('Page'),
'title' => ShoppingcartModule::t('Title'),
'item_id' => ShoppingcartModule::t('Item'),
'order_id' => ShoppingcartModule::t('Order'),
'quantity' => ShoppingcartModule::t('Quantity'),
'referrer' => ShoppingcartModule::t('Referrer'),
'ip_address' => ShoppingcartModule::t('Ip Address'),
'ordered_at' => ShoppingcartModule::t('Ordered At'),
);
}
Item::getItemChecksum (   $encrypted = false)

Function to get checksum of fields

Parameters
object$modelinstance of Item class
boolean$encryptedflag that shows when fields of instance are encrypted
Returns
checksum of fields

Definition at line 150 of file Item.php.

References EncryptHelper\decrypt().

{
$fields = array('item_id','title','price','page_id','admin_email');
$str= '';
foreach($fields as $field){
$str.= $encrypted? EncryptHelper::decrypt($this->$field):$this->$field;
}
return md5($str);
}
static Item::model (   $className = __CLASS__)
static

Returns the static model of the specified AR class.

Parameters
string$classNameactive record class name.
Returns
Item the static model class

Definition at line 34 of file Item.php.

Referenced by ShoppingCartWidget\init(), ItemListWidget\run(), and ShoppingcartTest\setUp().

{
return parent::model($className);
}
Item::relations ( )
Returns
array relational rules.

Definition at line 74 of file Item.php.

{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'order' => array(self::BELONGS_TO, 'Order', 'order_id'),
);
}
Item::rules ( )
Returns
array validation rules for model attributes.

Definition at line 50 of file Item.php.

{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('admin_email, title, referrer, ip_address, page_id, item_id', 'required'),
array('page_id, item_id','numerical', 'integerOnly' => true),
array('price, quantity', 'numerical'),
array('quantity','compare','operator'=>'>','compareValue'=>(-1)),
array('price','compare','operator'=>'>','compareValue'=>(-1)),
array('admin_email, title, referrer, item_referrer', 'length', 'max'=>255),
array('page_id, item_id, order_id, quantity', 'length', 'max'=>10),
array('ip_address', 'length', 'max'=>16),
array('ordered_at', 'safe'),
array('admin_email','email'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, price, admin_email, page_id, title, item_id, order_id, quantity, referrer, ip_address, ordered_at', 'safe', 'on'=>'search'),
);
}
Item::search ( )

Retrieves a list of models based on the current search/filter conditions.

Returns
CActiveDataProvider the data provider that can return the models based on the search/filter conditions.

Definition at line 107 of file Item.php.

{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id,true);
$criteria->compare('price',$this->price);
$criteria->compare('admin_email',$this->admin_email,true);
$criteria->compare('page_id',$this->page_id,true);
$criteria->compare('title',$this->title,true);
$criteria->compare('item_id',$this->item_id,true);
$criteria->compare('order_id',$this->order_id,true);
$criteria->compare('quantity',$this->quantity,true);
$criteria->compare('referrer',$this->referrer,true);
$criteria->compare('ip_address',$this->ip_adsress,true);
$criteria->compare('ordered_at',$this->ordered_at,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}
Item::tableName ( )
Returns
string the associated database table name

Definition at line 42 of file Item.php.

{
return '{{item}}';
}

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