This manual is deprecated. Please visit https://groupoffice.readthedocs.io for the latest documentation.

Extending settings with your own module

From Group-Office Groupware and CRM Documentation
Revision as of 09:36, 27 July 2012 by Wsmits (Talk | contribs) (Created page with "public static function submitSettings(&$settingsController, &$params, &$response, $user) { $settings = GO_Calendar_Model_Settings::model()->getDefault($user); if(!$setting...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

public static function submitSettings(&$settingsController, &$params, &$response, $user) {

$settings = GO_Calendar_Model_Settings::model()->getDefault($user); if(!$settings){ $settings = new GO_Calendar_Model_Settings(); $settings->user_id=$params['id']; }

$settings->background=$params['background']; $settings->reminder=$params['reminder_multiplier'] * $params['reminder_value']; $settings->calendar_id=$params['default_calendar_id'];


$settings->save();

return parent::submitSettings($settingsController, $params, $response, $user); }

public static function loadSettings(&$settingsController, &$params, &$response, $user) {

$settings = GO_Calendar_Model_Settings::model()->getDefault($user); $response['data']=array_merge($response['data'], $settings->getAttributes());

$calendar = GO_Calendar_Model_Calendar::model()->findByPk($settings->calendar_id);

if($calendar){ $response['data']['default_calendar_id']=$calendar->id; $response['remoteComboTexts']['default_calendar_id']=$calendar->name; }

$response = GO_Calendar_Controller_Event::reminderSecondsToForm($response);


return parent::loadSettings($settingsController, $params, $response, $user); }