mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-03 06:27:02 +03:00
Plugin system enhancements (Custom user's settings tabs)
This commit is contained in:
parent
a3f28b09f6
commit
9a58fd0a66
13 changed files with 398 additions and 16 deletions
57
plugins/custom-settings-tab/index.php
Normal file
57
plugins/custom-settings-tab/index.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
class CustomSettingsTabPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function Init()
|
||||
{
|
||||
$this->UseLangs(true); // start use langs folder
|
||||
|
||||
$this->addJs('js/CustomUserSettings.js'); // add js file
|
||||
|
||||
$this->addAjaxHook('AjaxGetCustomUserData', 'AjaxGetCustomUserData');
|
||||
$this->addAjaxHook('AjaxSaveCustomUserData', 'AjaxSaveCustomUserData');
|
||||
|
||||
$this->addTemplate('templates/PluginCustomSettingsTag.html');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function AjaxGetCustomUserData()
|
||||
{
|
||||
$aSettings = $this->getUserSettings();
|
||||
|
||||
$sUserFacebook = isset($aSettings['UserFacebook']) ? $aSettings['UserFacebook'] : '';
|
||||
$sUserSkype = isset($aSettings['UserSkype']) ? $aSettings['UserSkype'] : '';
|
||||
|
||||
// or get user's data from your custom storage ( DB / LDAP / ... ).
|
||||
|
||||
\sleep(1);
|
||||
return $this->ajaxResponse(__FUNCTION__, array(
|
||||
'UserFacebook' => $sUserFacebook,
|
||||
'UserSkype' => $sUserSkype
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function AjaxSaveCustomUserData()
|
||||
{
|
||||
$sUserFacebook = $this->ajaxParam('UserFacebook');
|
||||
$sUserSkype = $this->ajaxParam('UserSkype');
|
||||
|
||||
// or put user's data to your custom storage ( DB / LDAP / ... ).
|
||||
|
||||
\sleep(1);
|
||||
return $this->ajaxResponse(__FUNCTION__, $this->saveUserSettings(array(
|
||||
'UserFacebook' => $sUserFacebook,
|
||||
'UserSkype' => $sUserSkype
|
||||
)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue