/** * list more items * will be executed on clicking on more * * @return void */ public function listmoreAction() { // load current settings $settingsModel = new application_models_settings(); $currentSettings = array(); foreach ($settingsModel->fetchAll() as $setting) { $currentSettings[$setting->name] = $setting->value; } // read settings $settings = $this->getRequest()->getParams(); $settings = array_merge($currentSettings, $settings); // get items $result = $this->listItems($settings); // show items $this->_helper->json($result); }
/** * reads settings from database * * @return value for this setting * @param name the name of the setting * @param default the default value of this setting */ protected function initializeSessionValue($name, $default) { // get database settings object $settings = new application_models_settings(); // get value from database $result = $settings->fetchAll($settings->select()->where('name=?', $name)); // value found? if ($result->count() > 0) { return $result->current()->value; // value not found } else { // save default value in database $settings->insert(array('name' => $name, 'value' => $default)); // return default value return $default; } }