/** * Retrieve user preferences * * @access private */ private function get_prefs() { try { $to_read['table'] = 'setting'; $to_read['columns'] = array('SETTING_ID'); $to_read['condition_columns'][':t'] = 'setting_type'; $to_read['condition_select_types'][':t'] = '='; $to_read['condition_values'][':t'] = 'user_' . VSession::user_id(); $to_read['value_types'][':t'] = 'str'; $pref = $this->_db->read($to_read); $this->_prefs = new Setting($pref[0]['SETTING_ID']); $this->_prefs->_data = json_decode($this->_prefs->_data, true); } catch (Exception $e) { $this->_action_msg = ActionMessages::custom_wrong($e->getMessage()); } }
/** * Retrieve user preferences * * @access private */ private function get_prefs() { try { $to_read['table'] = 'setting'; $to_read['columns'] = array('SETTING_ID'); $to_read['condition_columns'][':t'] = 'setting_type'; $to_read['condition_select_types'][':t'] = '='; $to_read['condition_values'][':t'] = 'user_' . VSession::user_id(); $to_read['value_types'][':t'] = 'str'; $pref = $this->_db->read($to_read); if (empty($pref)) { $this->_prefs = new Setting(); $this->_prefs->_name = 'User preferences for "' . VSession::username() . '"'; $this->_prefs->_type = 'user_' . VSession::user_id(); $this->_prefs->_data = json_encode(array('last_visit' => date('Y-m-d H:i:s'), 'timeline' => array(array('title' => 'Lynxpress Demo', 'url' => 'http://demo.lynxpress.org/')))); $this->_prefs->create(); } else { $this->_prefs = new Setting($pref[0]['SETTING_ID']); } $this->_prefs->_data = json_decode($this->_prefs->_data, true); } catch (Exception $e) { $this->_action_msg = ActionMessages::custom_wrong($e->getMessage()); } }
/** * Log an action into database, logs are viewed by administrator in the dashboard * * @static * @access public * @param string [$msg] Action message to log */ public static function monitor_activity($msg) { $db =& Database::load(); $to_create['table'] = 'activity'; $to_create['columns'] = array(':id' => 'USER_ID', ':data' => 'data', ':date' => 'date'); $to_create['values'] = array(':id' => VSession::user_id(), ':data' => $msg, ':date' => date('Y-m-d H:i:s')); $to_create['types'] = array(':id' => 'int', ':data' => 'str', ':date' => 'str'); $db->create($to_create); }