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

Public Member Functions

 tableName ()
 rules ()
 relations ()
 get ($name)
 set ($name, $value)
 unsetValue ($name)
 attributeLabels ()

Static Public Member Functions

static model ($className=__CLASS__)
static instance ()
static reload ()

Protected Member Functions

 beforeSave ()
 afterSave ()
 afterFind ()

Detailed Description

Definition at line 10 of file Settings.php.

Member Function Documentation

Settings::afterFind ( )
protected

Performes some action before model is found

Returns
mixed

Definition at line 164 of file Settings.php.

{
$this->settings = unserialize($this->settings);
}
Settings::afterSave ( )
protected

Performes some action after model is saved

Returns
mixed

Definition at line 153 of file Settings.php.

{
$this->settings = unserialize($this->settings);
}
Settings::attributeLabels ( )

Returns customized attribute labels (name=>label)

Returns
array

Definition at line 175 of file Settings.php.

{
return array(
'id' => 'ID',
'settings' => 'Settings',
);
}
Settings::beforeSave ( )
protected

Performes some action before model is saved

Returns
mixed

Definition at line 142 of file Settings.php.

{
$this->settings = serialize($this->settings);
}
Settings::get (   $name)

Returns setting by given name

Parameters
stringname settings parameter name
Returns
mixed

Definition at line 103 of file Settings.php.

{
return isset($this->settings[$name]) ? $this->settings[$name] : false;
}
static Settings::instance ( )
static

Singleton method

Returns
Settings.

Definition at line 71 of file Settings.php.

References model().

Referenced by ManageController\actionIndex(), SettingsModule\get(), reload(), SettingsModule\set(), SettingsTest\testGet(), SettingsTest\testSet(), and SettingsTest\testUnset().

{
if (!self::$_instance) {
$settings = Settings::model()->find();
if (is_null($settings)) {
$settings = new Settings();
$settings->settings = array();
$settings->save();
}
self::$_instance = $settings;
}
return self::$_instance;
}
static Settings::model (   $className = __CLASS__)
static

Returns the static model of the specified AR class.

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

Definition at line 21 of file Settings.php.

Referenced by instance().

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

Allows model relations definition

Returns
array relational rules.

Definition at line 58 of file Settings.php.

{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
);
}
static Settings::reload ( )
static

resets model instance

Returns
void

Definition at line 90 of file Settings.php.

References instance().

{
self::$_instance = null;
return self::instance();
}
Settings::rules ( )

Sets some rules

Returns
array validation rules for model attributes.

Definition at line 41 of file Settings.php.

{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('settings', 'required'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, settings', 'safe', 'on' => 'search'),
);
}
Settings::set (   $name,
  $value 
)

Settings setter

Parameters
string$namename
mixed$valuevalue
Returns
void

Definition at line 116 of file Settings.php.

{
$this->settings = array_merge($this->settings, array($name => $value));
$this->save();
}
Settings::tableName ( )

Returns model table name

Returns
string the associated database table name

Definition at line 31 of file Settings.php.

{
return '{{settings}}';
}
Settings::unsetValue (   $name)

Deletes parameter by name

Parameters
string$namename
Returns
void

Definition at line 129 of file Settings.php.

{
$s = $this->settings;
unset($s[$name]);
$this->settings = $s;
$this->save();
}

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