public function __construct() { parent::__construct(); $this->preferenceService = BOL_PreferenceService::getInstance(); $this->userService = BOL_UserService::getInstance(); $contentMenu = new BASE_CMP_PreferenceContentMenu(); $contentMenu->getElement('preference')->setActive(true); $this->addComponent('contentMenu', $contentMenu); }
public function __construct() { parent::__construct(); if (!OW::getUser()->isAuthenticated()) { throw new AuthenticateException(); } $this->setPageHeading(OW::getLanguage()->text('ynsocialconnect', 'h_account_linking')); $this->setPageHeadingIconClass('ow_ic_gear_wheel'); // Preference menu $contentMenu = new BASE_CMP_PreferenceContentMenu(); $contentMenu->getElement('ynsc_user_linking')->setActive(true); $this->addComponent('contentMenu', $contentMenu); }
public function __construct() { $this->setPageHeading(OW::getLanguage()->text('ynsocialbridge', 'socialbridge_management_page_heading')); $this->setPageHeadingIconClass('ow_yn_socialbridge'); //Preference menu $contentMenu = new BASE_CMP_PreferenceContentMenu(); $contentMenu->getElement('socialbridge')->setActive(true); $this->addComponent('contentMenu', $contentMenu); $core = new YNSOCIALBRIDGE_CLASS_Core(); $this->menu = $core->initMenu(); $this->addComponent('menu', $this->menu); //load css $cssUrl = OW::getPluginManager()->getPlugin('ynsocialbridge')->getStaticCssUrl() . 'ynsocialbridge.css'; OW::getDocument()->addStyleSheet($cssUrl); //put languages to database when chage OW::getLanguage()->importPluginLangs(OW::getPluginManager()->getPlugin('ynsocialbridge')->getRootDir() . 'langs.zip', 'ynsocialbridge'); }
public function __construct() { $this->setPageHeading(OW::getLanguage()->text('ynsocialbridge', 'socialbridge_management_page_heading')); $this->setPageHeadingIconClass('ow_yn_socialbridge'); if (!OW::getUser()->isAuthenticated()) { throw new AuthenticateException(); } //Preference menu $contentMenu = new BASE_CMP_PreferenceContentMenu(); $contentMenu->getElement('socialbridge')->setActive(true); $this->addComponent('contentMenu', $contentMenu); $core = new YNSOCIALBRIDGE_CLASS_Core(); $this->_menu = $core->initMenu(); $this->addComponent('menu', $this->_menu); //load css $cssUrl = OW::getPluginManager()->getPlugin('ynsocialbridge')->getStaticCssUrl() . 'ynsocialbridge.css'; OW::getDocument()->addStyleSheet($cssUrl); }
public function settings() { if (!OW::getUser()->isAuthenticated()) { throw new AuthenticateException(); } $contentMenu = new BASE_CMP_PreferenceContentMenu(); $contentMenu->getElement('email_notifications')->setActive(true); $this->addComponent('contentMenu', $contentMenu); OW::getDocument()->setHeading(OW::getLanguage()->text('notifications', 'setup_page_heading')); OW::getDocument()->setHeadingIconClass('ow_ic_mail'); OW::getDocument()->setTitle(OW::getLanguage()->text('notifications', 'setup_page_title')); $actions = $this->service->collectActionList(); $settings = $this->service->findRuleList($this->userId); $form = new NOTIFICATIONS_SettingForm(); $this->addForm($form); $processActions = array(); foreach ($actions as $action) { $field = new CheckboxField($action['action']); $field->setValue(!empty($action['selected'])); if (isset($settings[$action['action']])) { $field->setValue((bool) $settings[$action['action']]->checked); } $form->addElement($field); $processActions[] = $action['action']; } if (OW::getRequest()->isPost()) { $result = $form->process($_POST, $processActions, $settings); if ($result) { OW::getFeedback()->info(OW::getLanguage()->text('notifications', 'settings_changed')); } else { OW::getFeedback()->warning(OW::getLanguage()->text('notifications', 'settings_not_changed')); } $this->redirect(); } $tplActions = array(); foreach ($actions as $action) { if (empty($tplActions[$action['section']])) { $tplActions[$action['section']] = array('label' => $action['sectionLabel'], 'icon' => empty($action['sectionIcon']) ? '' : $action['sectionIcon'], 'actions' => array()); } $tplActions[$action['section']]['actions'][$action['action']] = $action; } $this->assign('actions', $tplActions); }
public function index($params) { $userId = OW::getUser()->getId(); if (OW::getRequest()->isAjax()) { exit; } if (!OW::getUser()->isAuthenticated() || $userId === null) { throw new AuthenticateException(); } $contentMenu = new BASE_CMP_PreferenceContentMenu(); $contentMenu->getElement('privacy')->setActive(true); $this->addComponent('contentMenu', $contentMenu); $language = OW::getLanguage(); $this->setPageHeading($language->text('privacy', 'privacy_index')); $this->setPageHeadingIconClass('ow_ic_lock'); // -- Action form -- $privacyForm = new Form('privacyForm'); $privacyForm->setId('privacyForm'); $actionSubmit = new Submit('privacySubmit'); $actionSubmit->addAttribute('class', 'ow_button ow_ic_save'); $actionSubmit->setValue($language->text('privacy', 'privacy_submit_button')); $privacyForm->addElement($actionSubmit); // -- $actionList = PRIVACY_BOL_ActionService::getInstance()->findAllAction(); $actionNameList = array(); foreach ($actionList as $action) { $actionNameList[$action->key] = $action->key; } $actionValueList = PRIVACY_BOL_ActionService::getInstance()->getActionValueList($actionNameList, $userId); $actionValuesEvent = new BASE_CLASS_EventCollector(PRIVACY_BOL_ActionService::EVENT_GET_PRIVACY_LIST); OW::getEventManager()->trigger($actionValuesEvent); $data = $actionValuesEvent->getData(); $actionValuesInfo = empty($data) ? array() : $data; $optionsList = array(); $sortOptionsList = array(); $order = array(); // -- sort action values foreach ($actionValuesInfo as $value) { $optionsList[$value['key']] = $value['label']; $order[$value['sortOrder']] = $value['key']; } asort($order); foreach ($order as $key) { $sortOptionsList[$key] = $optionsList[$key]; } // -- $resultList = array(); foreach ($actionList as $action) { /* @var $action PRIVACY_CLASS_Action */ if (!empty($action->label)) { $formElement = new Selectbox($action->key); $formElement->setLabel($action->label); $formElement->setDescription(''); if (!empty($action->description)) { $formElement->setDescription($action->description); } $formElement->setOptions($sortOptionsList); $formElement->setHasInvitation(false); if (!empty($actionValueList[$action->key])) { $formElement->setValue($actionValueList[$action->key]); if (array_key_exists($actionValueList[$action->key], $sortOptionsList)) { $formElement->setValue($actionValueList[$action->key]); } else { if ($actionValueList[$action->key] != 'everybody') { $formElement->setValue('only_for_me'); } } } $privacyForm->addElement($formElement); $resultList[$action->key] = $action->key; } } if (OW::getRequest()->isPost()) { if ($privacyForm->isValid($_POST)) { $values = $privacyForm->getValues(); $restul = PRIVACY_BOL_ActionService::getInstance()->saveActionValues($values, $userId); if ($restul) { OW::getFeedback()->info($language->text('privacy', 'action_action_data_was_saved')); } else { OW::getFeedback()->warning($language->text('privacy', 'action_action_data_not_changed')); } $this->redirect(); } } $this->addForm($privacyForm); $this->assign('actionList', $resultList); }