/** * @param PageBuilder $pagebuilder * @return SettingsAccount */ function SettingsAccount(&$pagebuilder) { $this->_pagebuilder =& $pagebuilder; $this->_proc =& $pagebuilder->_proc; $screen = $this->_proc->sArray[SCREEN]; if ($this->_proc->sArray[EDIT_ACCOUNT_ID] != $this->_proc->account->Id) { if (array_key_exists($this->_proc->sArray[EDIT_ACCOUNT_ID], $this->_proc->accounts)) { $this->_editAccount =& Account::LoadFromDb($this->_proc->sArray[EDIT_ACCOUNT_ID]); $this->_editProccessor =& new MailProcessor($this->_editAccount); $this->_editFolders =& $this->_editProccessor->GetFolders(); } else { $this->_editAccount =& $this->_proc->account; $this->_editProccessor =& $this->_proc->processor; $this->_editFolders =& $this->_proc->GetFolders(); } } else { $this->_editAccount =& $this->_proc->account; $this->_editProccessor =& $this->_proc->processor; $this->_editFolders =& $this->_proc->GetFolders(); } $this->data['allowNewAccount'] = !$this->_proc->settings->AllowUsersAddNewAccounts || !$this->_editAccount->AllowChangeSettings ? '' : ' <input type="button" value="' . JS_LANG_AddNewAccount . '" onclick="document.location=\'' . BASEFILE . '?' . SCREEN . '=' . SET_ACCOUNT_ADDACC . '\';" class="wm_button" ID="Button4" NAME="Button2"/>'; $this->data['accountsTable'] = ''; $accounts =& $this->_proc->GetAccounts(); foreach ($accounts as $keyid => $value) { $isCurrent = $keyid == $this->_editAccount->Id; $class = $isCurrent ? ' class="wm_settings_list_select"' : ' class="wm_control"'; $name = $isCurrent ? '<b>' . $value[4] . '</b>' : $value[4]; //$name .= ($value[6]) ? ' (default)' : ''; $onclick = $isCurrent ? '' : ' onclick="document.location=\'' . BASEFILE . '?' . EDIT_ACCOUNT_ID . '=' . $keyid . '\';"'; $deleteHref = $this->_proc->account->IsDemo ? '<a href="#" onclick="return DoAlert();">' . JS_LANG_Delete . '</a>' : '<a href="' . ACTIONFILE . '?action=delete&req=account&acctid=' . $keyid . '" onclick="return confirm(\'' . ConfirmDeleteAccount . '\');">' . JS_LANG_Delete . '</a>'; $deleteHref = $this->_editAccount->AllowChangeSettings ? $deleteHref : ''; $this->data['accountsTable'] .= ' <tr' . $class . '> <td' . $onclick . '>' . $name . '</td> <td style="width: 10px;">' . $deleteHref . '</td> </tr>'; } if ($screen == SET_ACCOUNT_ADDACC && !$this->_proc->settings->AllowUsersAddNewAccounts) { $screen = SET_ACCOUNT_PROF; } $this->_main =& new SettingsAccountForms($screen, $this); $this->data['tabSwitcher'] = ''; if ($screen != SET_ACCOUNT_ADDACC) { $this->data['tabSwitcher'] .= ' <div class="wm_settings_accounts_info"> <div class="wm_settings_switcher_indent"></div>'; $this->data['tabSwitcher'] .= $screen == SET_ACCOUNT_MFOLDERS ? '<div class="wm_settings_switcher_select_item">' . JS_LANG_ManageFolders . '</div>' : '<div class="wm_settings_switcher_item"><a href="' . BASEFILE . '?' . SCREEN . '=' . SET_ACCOUNT_MFOLDERS . '">' . JS_LANG_ManageFolders . '</a></div>'; $this->data['tabSwitcher'] .= $screen == SET_ACCOUNT_SIGNATURE ? '<div class="wm_settings_switcher_select_item">' . JS_LANG_Signature . '</div>' : '<div class="wm_settings_switcher_item"><a href="' . BASEFILE . '?' . SCREEN . '=' . SET_ACCOUNT_SIGNATURE . '">' . JS_LANG_Signature . '</a></div>'; $this->data['tabSwitcher'] .= $screen == SET_ACCOUNT_FILTERS ? '<div class="wm_settings_switcher_select_item"> ' . JS_LANG_Filters . ' </div>' : '<div class="wm_settings_switcher_item"> <a href="' . BASEFILE . '?' . SCREEN . '=' . SET_ACCOUNT_FILTERS . '">' . JS_LANG_Filters . '</a> </div>'; if ($this->_editAccount->AllowChangeSettings) { $this->data['tabSwitcher'] .= $screen == SET_ACCOUNT_PROF ? '<div class="wm_settings_switcher_select_item">' . JS_LANG_Properties . '</div>' : '<div class="wm_settings_switcher_item"><a href="' . BASEFILE . '?' . SCREEN . '=' . SET_ACCOUNT_PROF . '">' . JS_LANG_Properties . '</a></div>'; } $this->data['tabSwitcher'] .= '</div>'; } }