Application =& KernelApplication::Instance(); $this->id_field = 'name'; $this->table_name = 'config'; $this->CreateField('name','',1,1); $this->CreateField('value','',1,1); $this->CreateField('config_description','', 0, 0); $this->DisplayErrors = 0; $this->DisplayQueries = 0; parent::DBItem($Id); } function Update() { $ret = parent::Update(); // echo " update ".$this->GetDBField('name')."
"; if ( $ret AND ereg("(per_page)",$this->GetDBField('name'))) { $this->Application->StoreVar( $this->GetDBField('name'), $this->GetDBField('value') ); } return $ret; } } class ConfigList extends kDBList { function ConfigList($sql, $query_now=0, $owner=null) { parent::kDBList($sql, $query_now, $owner); $this->Special = $owner->Params['special']; switch ($this->Special) { default: $this->sql = " SELECT * FROM config "; }; $this->DisplayQueries = 0; } function &NewItem () { $new_item = new ConfigItem(NULL); return $new_item; } function GetOption($name) { if ($this->Find('name', $name)) return $this->GetCurrentFieldValue('value'); else return false; } function SetOption($name, $value) { if ($this->Find('name', $name)) {; $this->SetCurrentFieldValue('value', $value); $tmp =& $this->GetCurrentRec(); $tmp->Update(); } else { $push_hash = Array('name'=>$name, 'value'=>$value); $id = array_push($this->Records, $push_hash); if (count($this->IndexFields) > 0) { foreach ($this->IndexFields as $key) { if (is_string($push_hash[$key])) $store_key = strtolower($push_hash[$key]); else $store_key = $push_hash[$key]; $this->Indexes[$key][$store_key] = $id-1; } } $this->last_rec++; } } } ?>