/** * getAllPrefs * * @param args json params converted into an array * scope scope of preferences being saved * prefs name value pairs of preferences to update * @throws none * @return array containing result and possible error messages */ public function ajax_getAllPrefs($args) { global $panoptes_current_user; $result = 'success'; $error = ''; try { require_once 'userEntry.php'; require_once 'userPrefs.php'; $user = new userEntry(); $user->db = $this->db; $user->getByName($panoptes_current_user); $userPrefs = new userPrefs($this->db); $userPrefs->db = $this->db; $data = $userPrefs->getAllPrefs($user->id); // load any default prefs that haven't been overriden if (!$userPrefs->getPref($user->id, 'general', 'general_prefs_chart_theme')) { $data[] = array('pref_name' => 'general_prefs_chart_theme', 'pref_scope' => 'general', 'pref_value' => $panoptes->config()->getConfigValue('web.default_chart_theme')); } } catch (Exception $e) { return array('result' => 'failure', 'error' => $e->getMessage()); } return array('result' => $result, 'error' => $error, 'data' => $data); }