All pastes #766633 Raw Edit

Untitled

public php v1 · immutable
·published 2007-11-09 00:27 UTC
rendered paste body
<?phpclass SettingsController extends AppController {	var $name = 'Settings';	var $helpers = array('Html', 'Form', 'Javascript', 'Fck');	var $uses = array("Setting");	function admin_index() {		$settings = $this->Setting->findAll();		$this->data = $settings;		$this->set("settings", $this->data);	}	function admin_update() {		if(!empty($this->data)) {			if($this->isCancelled()) {				$this->doCancel();				} else {					foreach($this->data['Setting'] as $fName => $fValue) {						//echo $fName;						$this->Setting->updateSetting($fName, $fValue);					}					//$this->redirect("/admin/settings");				}				} else {					$this->Session->setFlash("Direct access to that page is not allowed");				}				//$this->redirect("/admin/settings");			}		}		?><?class Setting extends AppModel {	var $name = "Setting";	var $primaryKey = "name";	function getSettings($name) {		//$this->id = $name;		return $this->find(array('label'=>$name));	}		function updateSetting($page, $values) {		$settingID = $this->find(array('label'=>$page));		$this->data['Setting']['id'] = $settingID['Setting']['id'];		$this->id = $this->data['Setting']['id'];				$this->data['Setting']['meta_title'] = $values['meta_title'];		$this->data['Setting']['meta_keywords'] = $values['meta_keywords'];		$this->data['Setting']['meta_desc'] = $values['meta_desc'];				pr($this->data);		die();		$this->save($this->data);	}	/*	function updateSetting($name, $value) {	$this->id = $name;	$this->name = $name;	$this->saveField("value", $value);	}	*/}?>