Location: PHPKode > projects > Anahita Social Engine > dependencies/plg_system_socialengine/socialengine/model/setting/setting.php
<?php
/**
 * @version		1.0.0
 * @category	Anahita Social Engine™
 * @copyright	Copyright (C) 2008 - 2010 rmdStudio Inc. and Peerglobe Technology Inc. All rights reserved.
 * @license		GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
 * @link     	http://www.anahitapolis.com
 */

class AnModelSetting extends AnDomainModelAbstract
{
	static function describe($setting)
	{
		$setting->setTable('socialengine_actor_application_relations');
		$setting->property('id',	array('field'=>'socialengine_actor_application_relation_id', 'unique'=>true));
		$setting->belongsTo('application',	    array('model'=>'lib.anahita.model.application', 'child_key'=>'application_id'));
		$setting->belongsTo('actor',		    array('model'=>'lib.anahita.model.actor',	    'child_key'=>'actor_node_id'));
		$setting->property('addedToProfile',    array('field'=>'added_to_profile'));
		$setting->property('params',			array('field'=>'params'));
		$setting->setRepository('lib.anahita.model.setting.repository');
	}
		
	protected $_jparam = null;
		
	public function setParams($params)
	{
		if ( is_array($params) ) {
			$param  = new JParameter('');
			$param->bind($params);
			$params = $param->toString();
		}
		
		$this->_set('params', (string) $params);
		$this->_jparam = null;
	}
			
	public function getParam($name, $default = null)
	{
		if ( !$this->_jparam  ) {
			$params = $this->_get('params');
			$this->_jparam  = new JParameter($params);
		}	
		return $this->_jparam->get($name, $default);
	}
		
	public function validateForInsert()
	{	
		return $this->actor->getAcl()->canSaveApplicationSetting($this->application);
	}
	
	public function validateForUpdate()
	{
		return $this->actor->getAcl()->canSaveApplicationSetting($this->application);
	}	
}
Return current item: Anahita Social Engine