'doEdit',
'update' => 'doUpdate',
);
function initAction()
{
if (empty($this->action)) {
if (isset($_REQUEST['action']) && !empty($_REQUEST['action'])) {
$this->action= $_REQUEST['action'];
} else {
$this->action = $this->defaultAction;
}
}
if (key_exists($this->action, $this->actions)){
$this->actionMethod = $this->actions[$this->action];
} else {
$this->action = key($this->actions);
$this->actionMethod = current($this->actions);
}
if ($this->isXmlHttpRequest()) {
$this->actionMethod .= 'Ajax';
}
}
function exec(&$Doc)
{
$this->Doc = &$Doc;
$this->DBObj = SiteMap::getObj('Member/CustomizeHomePage/CustomizeHomePage.php', $this->Doc->MemberAuth->getData('id'));
$this->initAction();
if (method_exists($this, $this->actionMethod)) {
$function = $this->actionMethod;
$this->$function();
} else {
exit;
}
}
function setFormTitle()
{
return false;
}
/**
* @param $form Form
* @return mixed
*/
function _bindFormFields($form)
{
$moreAlias = SiteMap::getAliasByItem('HTMLBlock/Show', 'account/customize-my-mncar-home-page.html/more');
$form->addElement('extended_select', 'auto_login', 'Automatically log me to my MNCAR account in when it is possible?', array('n'=>'No', 'y'=>'Yes'), null, array('after'=>' | more info'));
if ($this->Doc->checkAcces2DocItem('BroadcastEmail/Repository/Show')) {
$form->addElement('extended_select', 'show_repository', 'Show Recent Emails Sent By Exchange Members?', array('n'=>'No', 'y'=>'Yes'), null, array('after'=>' | more info'));
}
return $form;
}
function doEdit()
{
$this->DBObj->initFromDB();
$form = $this->_getEditForm();
$form->setDefaults($this->DBObj->getData());
$form->exec();
$this->setBackUrl(BASE_URL.'/'.SiteMap::getAliasByItemType('Member/MyAccount'));
}
function doUpdate()
{
$form = $this->_getEditForm();
if ($form->validate()){
$this->DBObj->initFromForm($form);
$this->DBObj->update();
Session::setData($this->_getPage4SaveMessage(), 'msg', $this->DBObj->itemName.' customized');
$this->doBack();
}else {
$form->exec();
}
return true;
}
}