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

Difference between revisions of "Extending settings with your own module"

From Group-Office Groupware and CRM Documentation
Jump to: navigation, search
Line 1: Line 1:
 
 
<pre>
 
<pre>
 
public static function submitSettings(&$settingsController, &$params, &$response, $user) {
 
public static function submitSettings(&$settingsController, &$params, &$response, $user) {
+
$settings = GO_Calendar_Model_Settings::model()->getDefault($user);
+
return parent::submitSettings($settingsController, $params, $response, $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);
+
}
+
 
</pre>
 
</pre>
 
<pre>
 
<pre>
public static function loadSettings(&$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);
+
return parent::loadSettings($settingsController, $params, $response, $user);
}
+
}
 
</pre>
 
</pre>

Revision as of 10:15, 27 July 2012

public static function submitSettings(&$settingsController, &$params, &$response, $user) {
				
 return parent::submitSettings($settingsController, $params, $response, $user);
}
	
public static function loadSettings(&$settingsController, &$params, &$response, $user) {
		
 return parent::loadSettings($settingsController, $params, $response, $user);
}