Exemple #1
0
 /**
  * Class constructor
  *
  */
 public function __construct($configs)
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $field = new RadioField('itunes_mode');
     $field->setOptions(array("test" => $language->text("skadateios", "itunes_mode_test"), "live" => $language->text("skadateios", "itunes_mode_live")));
     $field->setValue($configs["itunes_mode"]);
     $this->addElement($field);
     $field = new CheckboxField('billing_enabled');
     $field->setValue($configs["billing_enabled"]);
     $this->addElement($field);
     $field = new TextField('itunes_secret');
     $field->addValidator(new ConfigRequireValidator());
     $field->setValue($configs["itunes_secret"]);
     $this->addElement($field);
     $promoUrl = new TextField('app_url');
     $promoUrl->setRequired();
     $promoUrl->addValidator(new UrlValidator());
     $promoUrl->setLabel($language->text('skadateios', 'app_url_label'));
     $promoUrl->setDescription($language->text('skadateios', 'app_url_desc'));
     $promoUrl->setValue($configs['app_url']);
     $this->addElement($promoUrl);
     $smartBanner = new CheckboxField('smart_banner');
     $smartBanner->setLabel($language->text('skadateios', 'smart_banner_label'));
     $smartBanner->setDescription($language->text('skadateios', 'smart_banner_desc'));
     $smartBanner->setValue($configs['smart_banner']);
     $this->addElement($smartBanner);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $this->addElement($submit);
 }
Exemple #2
0
 public function addRadio(RadioField $radio)
 {
     $this->radios[] = $radio;
     if ($radio->getMappingName()) {
         $this->mapping = $radio->getMappingName();
     }
     $radio->setParent($this);
 }
Exemple #3
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $form = new Form('privacy_settings');
     $userApprove = new CheckboxField('user_approve');
     $userApprove->setLabel($language->text('admin', 'permissions_index_user_approve'));
     $form->addElement($userApprove);
     $whoCanJoin = new RadioField('who_can_join');
     $whoCanJoin->addOptions(array('1' => $language->text('admin', 'permissions_index_anyone_can_join'), '2' => $language->text('admin', 'permissions_index_by_invitation_only_can_join')));
     $whoCanJoin->setLabel($language->text('admin', 'permissions_index_who_can_join'));
     $form->addElement($whoCanJoin);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->addOptions(array('1' => $language->text('admin', 'permissions_index_all_users_can_invate'), '2' => $language->text('admin', 'permissions_index_admin_only_can_invate')));
     $whoCanInvite->setLabel($language->text('admin', 'permissions_index_who_can_invite'));
     $form->addElement($whoCanInvite);
     $guestsCanView = new RadioField('guests_can_view');
     $guestsCanView->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '2' => $language->text('admin', 'permissions_index_no'), '3' => $language->text('admin', 'permissions_index_with_password')));
     $guestsCanView->setLabel($language->text('admin', 'permissions_index_guests_can_view_site'));
     $guestsCanView->setDescription($language->text('admin', 'permissions_idex_if_not_yes_will_override_settings'));
     $form->addElement($guestsCanView);
     $password = new TextField('password');
     $form->addElement($password);
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'permissions_index_save'));
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $config->saveConfig('base', 'who_can_join', (int) $data['who_can_join']);
             $config->saveConfig('base', 'who_can_invite', (int) $data['who_can_invite']);
             $config->saveConfig('base', 'mandatory_user_approve', (bool) $data['user_approve'] ? 1 : 0);
             if ((int) $data['guests_can_view'] === 3 && empty($data['password'])) {
                 OW::getFeedback()->error($language->text('admin', 'permission_global_privacy_empty_pass_error_message'));
             } else {
                 if ((int) $data['guests_can_view'] === 3 && strlen(trim($data['password'])) < 4) {
                     OW::getFeedback()->error($language->text('admin', 'permission_global_privacy_pass_length_error_message'));
                 } else {
                     $config->saveConfig('base', 'guests_can_view', (int) $data['guests_can_view']);
                     $config->saveConfig('base', 'guests_can_view_password', trim($data['password']));
                 }
             }
             OW::getFeedback()->info($language->text('admin', 'permission_global_privacy_settings_success_message'));
             $this->redirect();
         }
     }
     $baseConfigs = $config->getValues('base');
     $form->getElement('who_can_join')->setValue($baseConfigs['who_can_join']);
     $form->getElement('who_can_invite')->setValue($baseConfigs['who_can_invite']);
     $form->getElement('guests_can_view')->setValue($baseConfigs['guests_can_view']);
     $form->getElement('user_approve')->setValue($baseConfigs['mandatory_user_approve']);
     $form->getElement('password')->setValue($baseConfigs['guests_can_view_password']);
 }
 public function source($datas)
 {
     foreach ($datas as $key => $label) {
         $this->radios[] = $radio = new RadioField();
         $radio->push('name', $this->getName());
         $radio->setValue($key);
         foreach ($this->pushSave as $var => $val) {
             $radio->push($var, $val);
         }
         $this->labels[$key] = $label;
     }
 }
 public function value()
 {
     $value = parent::value();
     if (in_array($value, array('yes', 'true', true, 1, 'on'), true)) {
         return 'true';
     } else {
         return 'false';
     }
 }
 public static function getSettingList()
 {
     $language = OW::getLanguage();
     $pluginManager = OW::getPluginManager();
     return array('banners' => array('presentation' => self::PRESENTATION_CUSTOM, 'label' => $language->text('skadate', 'banners_label'), 'render' => function ($uniqName, $name, $value) {
         OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('skadate')->getStaticJsUrl() . 'mobile_experience.js');
         OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString(';window.SKADATE_ME_SETTINGS({$params});', array('params' => array('iosActive' => OW::getPluginManager()->isPluginActive(SKADATE_CMP_MobileExperience::IOS), 'androidActive' => OW::getPluginManager()->isPluginActive(SKADATE_CMP_MobileExperience::ANDROID)))));
         $input = new CheckboxGroup('banners');
         $input->setOptions(array(SKADATE_CMP_MobileExperience::IOS => OW::getLanguage()->text('skadate', 'ios_label'), SKADATE_CMP_MobileExperience::ANDROID => OW::getLanguage()->text('skadate', 'android_label')));
         $input->setColumnCount(2);
         $input->setValue(!empty($value) ? array_keys($value) : null);
         return $input->renderInput();
     }, 'value' => array(self::IOS => $pluginManager->isPluginActive(self::IOS), self::ANDROID => $pluginManager->isPluginActive(self::ANDROID))), 'show_first' => array('presentation' => self::PRESENTATION_CUSTOM, 'label' => $language->text('skadate', 'show_first_label'), 'render' => function ($uniqName, $name, $value) {
         $input = new RadioField('show_first[]');
         $input->setOptions(array(SKADATE_CMP_MobileExperience::IOS => OW::getLanguage()->text('skadate', 'ios_label'), SKADATE_CMP_MobileExperience::ANDROID => OW::getLanguage()->text('skadate', 'android_label')));
         $input->setValue($value);
         $input->setColumnCount(2);
         return $input->renderInput();
     }, 'value' => $pluginManager->isPluginActive(self::IOS) ? self::IOS : self::ANDROID));
 }
Exemple #7
0
 public function __construct($entityType, $entityId)
 {
     parent::__construct('flag');
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('BASE_CTRL_Flag', 'flag'));
     $element = new HiddenField('entityType');
     $element->setValue($entityType);
     $this->addElement($element);
     $element = new HiddenField('entityId');
     $element->setValue($entityId);
     $this->addElement($element);
     $element = new RadioField('reason');
     $element->setOptions(array('spam' => OW::getLanguage()->text('base', 'flag_spam'), 'offence' => OW::getLanguage()->text('base', 'flag_offence'), 'illegal' => OW::getLanguage()->text('base', 'flag_illegal')));
     $flagDto = BOL_FlagService::getInstance()->findFlag($entityType, $entityId, OW::getUser()->getId());
     if ($flagDto !== null) {
         $element->setValue($flagDto->reason);
     }
     $this->addElement($element);
     OW::getDocument()->addOnloadScript("owForms['{$this->getName()}'].bind('success', function(json){\n\t\t\tswitch( json['result'] ){\n\t\t\t\tcase 'success':\n\t\t\t\t\tOW.registry['flag-panel-fb'].close();\n\t\t\t\t\tOW.addScript(json.js);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t})");
 }
Exemple #8
0
 public function __construct($type, $id, $title, $url, $langKey, $ownerId)
 {
     parent::__construct('flag');
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('BASE_CTRL_Flag', 'flag'));
     $hiddenType = new HiddenField('type');
     $hiddenId = new HiddenField('id');
     $hiddenTitle = new HiddenField('title');
     $hiddenUrl = new HiddenField('url');
     $hiddenOwnerId = new HiddenField('ownerId');
     $hiddenLangKey = new HiddenField('langKey');
     $this->addElement($hiddenType->setValue($type))->addElement($hiddenId->setValue($id))->addElement($hiddenTitle->setValue(htmlspecialchars($title)))->addElement($hiddenUrl->setValue($url))->addElement($hiddenLangKey->setValue($langKey))->addElement($hiddenOwnerId->setValue($ownerId));
     $reasonField = new RadioField('reason');
     $reasonField->setOptions(array('spam' => OW::getLanguage()->text('base', 'flag_spam'), 'offence' => OW::getLanguage()->text('base', 'flag_offence'), 'illegal' => OW::getLanguage()->text('base', 'flag_illegal')));
     $flagDto = BOL_FlagService::getInstance()->findFlag($type, $id, OW::getUser()->getId());
     if ($flagDto !== null) {
         $reasonField->setValue($flagDto->reason);
     }
     $this->addElement($reasonField);
     OW::getDocument()->addOnloadScript("owForms['{$this->getName()}'].bind('success', function(json){\n\t\t\tswitch( json['result'] ){\n\t\t\t\tcase 'success':\n\t\t\t\t\tOW.registry['flag-panel-fb'].close();\n\t\t\t\t\teval(json.js);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t})");
 }
Exemple #9
0
 public function __construct()
 {
     parent::__construct('buy-credits-form');
     $packs = USERCREDITS_BOL_CreditsService::getInstance()->getPackList();
     $packField = new RadioField('pack');
     $packField->setRequired();
     $value = 0;
     foreach ($packs as $p) {
         $packField->addOption($p['id'], $p['title']);
         if ($value == 0) {
             $value = $p['id'];
         }
     }
     $packField->setValue($value);
     $this->addElement($packField);
     $gatewaysField = new BillingGatewaySelectionField('gateway');
     $gatewaysField->setRequired(true);
     $this->addElement($gatewaysField);
     $submit = new Submit('buy');
     $submit->setValue(OW::getLanguage()->text('base', 'checkout'));
     $this->addElement($submit);
 }
 /**
  * @see FormElement::renderInput()
  *
  * @param array $params
  * @return string
  */
 public function renderInput($params = null)
 {
     parent::renderInput($params);
     if (isset($params['checked'])) {
         $this->addAttribute(FormElement::ATTR_CHECKED, 'checked');
     }
     $label = isset($params['label']) ? $params['label'] : '';
     $this->addAttribute('value', $params['value']);
     $this->setId(UTIL_HtmlTag::generateAutoId('input'));
     $renderedString = '<label>' . UTIL_HtmlTag::generateTag('input', $this->attributes) . $label . '</label>';
     $this->removeAttribute(FormElement::ATTR_CHECKED);
     return $renderedString;
 }
Exemple #11
0
 public function __toString()
 {
     $languages = c::get('languages');
     $lang = $currentLang = strtoupper(site()->language()->code());
     foreach ($languages as $l) {
         if (isset($l['default']) && $l['default']) {
             $lang = strtoupper($l['code']);
         }
     }
     if ($currentLang == $lang) {
         return parent::__toString();
     }
     return "";
     //return '<div class="field field-grid-item"><p>Die Einstellung kann nur in ' . $lang .' bearbeitet werden.</p></div>';
 }
Exemple #12
0
 public function __construct($formName)
 {
     parent::__construct($formName);
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $language = OW::getLanguage();
     $field = new TextField('title');
     $field->setRequired(true);
     $field->setLabel($language->text('groups', 'create_field_title_label'));
     $this->addElement($field);
     $field = new WysiwygTextarea('description');
     $field->setLabel($language->text('groups', 'create_field_description_label'));
     $field->setRequired(true);
     $this->addElement($field);
     $field = new GROUPS_Image('image');
     $field->setLabel($language->text('groups', 'create_field_image_label'));
     $field->addValidator(new GROUPS_ImageValidator());
     $this->addElement($field);
     $whoCanView = new RadioField('whoCanView');
     $whoCanView->setRequired();
     $whoCanView->addOptions(array(GROUPS_BOL_Service::WCV_ANYONE => $language->text('groups', 'form_who_can_view_anybody'), GROUPS_BOL_Service::WCV_INVITE => $language->text('groups', 'form_who_can_view_invite')));
     $whoCanView->setLabel($language->text('groups', 'form_who_can_view_label'));
     $this->addElement($whoCanView);
     $whoCanInvite = new RadioField('whoCanInvite');
     $whoCanInvite->setRequired();
     $whoCanInvite->addOptions(array(GROUPS_BOL_Service::WCI_PARTICIPANT => $language->text('groups', 'form_who_can_invite_participants'), GROUPS_BOL_Service::WCI_CREATOR => $language->text('groups', 'form_who_can_invite_creator')));
     $whoCanInvite->setLabel($language->text('groups', 'form_who_can_invite_label'));
     $this->addElement($whoCanInvite);
 }
Exemple #13
0
 /**
  * Class constructor
  *
  */
 public function __construct($configs)
 {
     parent::__construct('YNSOCIALSTREAM_FrontSettingsForm');
     $language = OW::getLanguage();
     $user_id = OW::getUser()->getId();
     $field = new RadioField('cron_job_user');
     $field->setLabel($language->text('ynsocialstream', 'cron_job_user_label'));
     $field->setValue($configs['cron_job_user_' . $user_id]);
     $field->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '0' => $language->text('admin', 'permissions_index_no')));
     $this->addElement($field);
     $field = new RadioField('enable_facebook');
     $field->setLabel($language->text('ynsocialstream', 'enable_facebook_label'));
     $field->setValue($configs['enable_facebook_' . $user_id]);
     $field->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '0' => $language->text('admin', 'permissions_index_no')));
     $this->addElement($field);
     $field = new RadioField('auth_fb');
     $field->setLabel($language->text('ynsocialstream', 'auth_fb_label'));
     $field->setValue($configs['auth_fb_' . $user_id]);
     $field->addOptions(array('everybody' => $language->text('ynsocialstream', 'everybody'), 'friends_only' => $language->text('ynsocialstream', 'friends_only'), 'only_for_me' => $language->text('ynsocialstream', 'only_for_me')));
     $this->addElement($field);
     $field = new RadioField('enable_twitter');
     $field->setLabel($language->text('ynsocialstream', 'enable_twitter_label'));
     $field->setValue($configs['enable_twitter_' . $user_id]);
     $field->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '0' => $language->text('admin', 'permissions_index_no')));
     $this->addElement($field);
     $field = new RadioField('auth_tw');
     $field->setLabel($language->text('ynsocialstream', 'auth_tw_label'));
     $field->setValue($configs['auth_tw_' . $user_id]);
     $field->addOptions(array('everybody' => $language->text('ynsocialstream', 'everybody'), 'friends_only' => $language->text('ynsocialstream', 'friends_only'), 'only_for_me' => $language->text('ynsocialstream', 'only_for_me')));
     $this->addElement($field);
     $field = new RadioField('enable_linkedin');
     $field->setLabel($language->text('ynsocialstream', 'enable_linkedin_label'));
     $field->setValue($configs['enable_linkedin_' . $user_id]);
     $field->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '0' => $language->text('admin', 'permissions_index_no')));
     $this->addElement($field);
     $field = new RadioField('auth_li');
     $field->setLabel($language->text('ynsocialstream', 'auth_li_label'));
     $field->setValue($configs['auth_li_' . $user_id]);
     $field->addOptions(array('everybody' => $language->text('ynsocialstream', 'everybody'), 'friends_only' => $language->text('ynsocialstream', 'friends_only'), 'only_for_me' => $language->text('ynsocialstream', 'only_for_me')));
     $this->addElement($field);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('ynsocialstream', 'admin_save_btn'));
     $this->addElement($submit);
 }
Exemple #14
0
 public function __construct($name)
 {
     parent::__construct($name);
     $militaryTime = Ow::getConfig()->getValue('base', 'military_time');
     $language = OW::getLanguage();
     $currentYear = date('Y', time());
     $title = new TextField('title');
     $title->setRequired();
     $title->setLabel($language->text('eventx', 'add_form_title_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'title'), $title);
     OW::getEventManager()->trigger($event);
     $title = $event->getData();
     $this->addElement($title);
     $startDate = new DateField('start_date');
     $startDate->setMinYear($currentYear);
     $startDate->setMaxYear($currentYear + 5);
     $startDate->setRequired();
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'start_date'), $startDate);
     OW::getEventManager()->trigger($event);
     $startDate = $event->getData();
     $this->addElement($startDate);
     $startTime = new EventTimeField('start_time');
     $startTime->setMilitaryTime($militaryTime);
     if (!empty($_POST['endDateFlag'])) {
         $startTime->setRequired();
     }
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'start_time'), $startTime);
     OW::getEventManager()->trigger($event);
     $startTime = $event->getData();
     $this->addElement($startTime);
     $endDate = new DateField('end_date');
     $endDate->setMinYear($currentYear);
     $endDate->setMaxYear($currentYear + 5);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'end_date'), $endDate);
     OW::getEventManager()->trigger($event);
     $endDate = $event->getData();
     $this->addElement($endDate);
     $endTime = new EventTimeField('end_time');
     $endTime->setMilitaryTime($militaryTime);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'end_time'), $endTime);
     OW::getEventManager()->trigger($event);
     $endTime = $event->getData();
     $this->addElement($endTime);
     if (OW::getConfig()->getValue('eventx', 'enableCategoryList') == '1') {
         if (OW::getConfig()->getValue('eventx', 'enableMultiCategories') == 1) {
             $element = new CheckboxGroup('event_category');
             $element->setColumnCount(3);
         } else {
             $element = new SelectBox('event_category');
         }
         $element->setRequired(true);
         $element->setLabel($language->text('eventx', 'event_category_label'));
         foreach (EVENTX_BOL_EventService::getInstance()->getCategoriesList() as $category) {
             $element->addOption($category->id, $category->name);
         }
         $this->addElement($element);
     }
     $maxInvites = new TextField('max_invites');
     $maxInvites->setRequired();
     $validator = new IntValidator(0);
     $validator->setErrorMessage($language->text('eventx', 'invalid_integer_value'));
     $maxInvites->addValidator($validator);
     $maxInvites->setLabel($language->text('eventx', 'add_form_maxinvites_label'));
     $this->addElement($maxInvites);
     $location = new TextField('location');
     $location->setRequired();
     $location->setId('location');
     $location->setLabel($language->text('eventx', 'add_form_location_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'location'), $location);
     OW::getEventManager()->trigger($event);
     $location = $event->getData();
     $this->addElement($location);
     $whoCanView = new RadioField('who_can_view');
     $whoCanView->setRequired();
     $whoCanView->addOptions(array('1' => $language->text('eventx', 'add_form_who_can_view_option_anybody'), '2' => $language->text('eventx', 'add_form_who_can_view_option_invit_only')));
     $whoCanView->setLabel($language->text('eventx', 'add_form_who_can_view_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'who_can_view'), $whoCanView);
     OW::getEventManager()->trigger($event);
     $whoCanView = $event->getData();
     $this->addElement($whoCanView);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->setRequired();
     $whoCanInvite->addOptions(array(EVENTX_BOL_EventService::CAN_INVITE_PARTICIPANT => $language->text('eventx', 'add_form_who_can_invite_option_participants'), EVENTX_BOL_EventService::CAN_INVITE_CREATOR => $language->text('eventx', 'add_form_who_can_invite_option_creator')));
     $whoCanInvite->setLabel($language->text('eventx', 'add_form_who_can_invite_label'));
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'who_can_invite'), $whoCanInvite);
     OW::getEventManager()->trigger($event);
     $whoCanInvite = $event->getData();
     $this->addElement($whoCanInvite);
     $desc = new WysiwygTextarea('desc');
     $desc->setLabel($language->text('eventx', 'add_form_desc_label'));
     $desc->setRequired();
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'desc'), $desc);
     OW::getEventManager()->trigger($event);
     $desc = $event->getData();
     $this->addElement($desc);
     $imageField = new FileField('image');
     $imageField->setLabel($language->text('eventx', 'add_form_image_label'));
     $this->addElement($imageField);
     if (OW::getConfig()->getValue('eventx', 'enableTagsList') == '1') {
         $tags = new TagsInputField('tags');
         $tags->setId('tags');
         $tags->setLabel($language->text('base', 'tags_cloud_cap_label'));
         $this->addElement($tags);
     }
     $submit = new Submit('submit');
     $submit->setValue($language->text('eventx', 'add_form_submit_label'));
     $this->addElement($submit);
     $event = new OW_Event(self::EVENTX_NAME, array('name' => 'image'), $imageField);
     OW::getEventManager()->trigger($event);
     $imageField = $event->getData();
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
 }
Exemple #15
0
 public function __construct($pluginKey, $entityType, $entityId)
 {
     // remove newfeeds cookie if has
     setcookie('ynsocialpublisher_feed_data_' . $entityId, '', -1, '/');
     parent::__construct();
     $userId = OW::getUser()->getId();
     $language = OW::getLanguage();
     $service = YNSOCIALPUBLISHER_BOL_Service::getInstance();
     $core = YNSOCIALPUBLISHER_CLASS_Core::getInstance();
     // user setting
     $userSetting = $service->getUsersetting($userId, $pluginKey);
     $this->assign('userSetting', $userSetting);
     // avatar
     $avatar = BOL_AvatarService::getInstance()->getAvatarUrl($userId);
     if (empty($avatar)) {
         $avatar = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     }
     $this->assign('avatar', $avatar);
     // default status
     $defaultStatus = $core->getDefaultStatus($pluginKey, $entityType, $entityId);
     $this->assign('defaultStatus', $defaultStatus);
     // entity url
     $url = $core->getUrl($pluginKey, $entityType, $entityId);
     $this->assign('url', $url);
     // title
     $title = $core->getTitle($pluginKey, $entityType, $entityId);
     $this->assign('title', $title);
     // -- connect each provider to get data
     // callbackUrl
     $callbackUrl = OW::getRouter()->urlForRoute('ynsocialbridge-connects');
     $coreBridge = new YNSOCIALBRIDGE_CLASS_Core();
     $arrObjServices = array();
     foreach (array('facebook', 'twitter', 'linkedin') as $serviceName) {
         $profile = null;
         $connect_url = "";
         $access_token = "";
         $scope = '';
         $objService = array();
         //check enable API
         $clientConfig = YNSOCIALBRIDGE_BOL_ApisettingService::getInstance()->getConfig($serviceName);
         if ($clientConfig) {
             $obj = $coreBridge->getInstance($serviceName);
             $values = array('service' => $serviceName, 'userId' => OW::getUser()->getId());
             //$tokenDto = $obj -> getToken($values);
             //print_r($_SESSION['socialbridge_session'][$serviceName]);die;
             $disconnect_url = OW::getRouter()->urlForRoute('ynsocialbridge-disconnect') . "?service=" . $serviceName;
             if (!empty($_SESSION['socialbridge_session'][$serviceName]['access_token'])) {
                 if ($serviceName == 'facebook') {
                     $access_token = $_SESSION['socialbridge_session'][$serviceName]['access_token'];
                     //check permission
                     $me = $obj->getOwnerInfo(array('access_token' => $access_token));
                     $uid = $me['id'];
                     $permissions = $obj->hasPermission(array('uid' => $uid, 'access_token' => $access_token));
                     if ($permissions) {
                         if (empty($permissions[0]['publish_stream']) || empty($permissions[0]['status_update'])) {
                             $scope = 'publish_stream,status_update';
                             //$scope = "email,user_about_me,user_birthday,user_hometown,user_interests,user_location,user_photos,user_website,publish_stream,status_update";
                         } else {
                             try {
                                 $profile = $obj->getOwnerInfo($_SESSION['socialbridge_session'][$serviceName]);
                             } catch (Exception $e) {
                                 $profile = null;
                             }
                         }
                     }
                 } else {
                     $profile = $obj->getOwnerInfo($_SESSION['socialbridge_session'][$serviceName]);
                 }
             } else {
                 $scope = "";
                 switch ($serviceName) {
                     case 'facebook':
                         //$scope = "email,user_about_me,user_birthday,user_hometown,user_interests,user_location,user_photos,user_website";
                         $scope = 'publish_stream,status_update';
                         break;
                     case 'twitter':
                         $scope = "";
                         break;
                     case 'linkedin':
                         $scope = "r_basicprofile,rw_nus,r_network,w_messages";
                         break;
                 }
             }
             $connect_url = $obj->getConnectUrl() . "?scope=" . $scope . "&" . http_build_query(array('callbackUrl' => $callbackUrl, 'isFromSocialPublisher' => 1, 'pluginKey' => $pluginKey, 'entityType' => $entityType, 'entityId' => $entityId));
             $objService['has_config'] = 1;
         } else {
             $objService['has_config'] = 0;
         }
         $objService['serviceName'] = $serviceName;
         $objService['connectUrl'] = $connect_url;
         $objService['disconnectUrl'] = $disconnect_url;
         $objService['profile'] = $profile;
         $objService['logo'] = OW::getPluginManager()->getPlugin('ynsocialpublisher')->getStaticUrl() . "img/" . $serviceName . ".png";
         $arrObjServices[$serviceName] = $objService;
     }
     //print_r($userSetting);
     //print_r($arrObjServices);
     $this->assign('arrObjServices', $arrObjServices);
     // create form
     $formUrl = OW::getRouter()->urlFor('YNSOCIALPUBLISHER_CTRL_Ynsocialpublisher', 'ajaxPublish');
     $form = new Form('ynsocialpubisher_share');
     $form->setAction($formUrl);
     $form->setAjax();
     // -- hidden fields
     // for plugin key
     $pluginKeyHiddenField = new HiddenField('ynsocialpublisher_pluginKey');
     $pluginKeyHiddenField->setValue($pluginKey);
     $form->addElement($pluginKeyHiddenField);
     // for entity id
     $entityIdHiddenField = new HiddenField('ynsocialpublisher_entityId');
     $entityIdHiddenField->setValue($entityId);
     $form->addElement($entityIdHiddenField);
     // for entity type
     $entityTypeHiddenField = new HiddenField('ynsocialpublisher_entityType');
     $entityTypeHiddenField->setValue($entityType);
     $form->addElement($entityTypeHiddenField);
     // Status - textarea
     $status = new Textarea('ynsocialpublisher_status');
     $status->setValue($defaultStatus);
     $form->addElement($status);
     // Options - radio buttons
     $options = new RadioField('ynsocialpublisher_options');
     $options->setRequired();
     $options->addOptions(array('0' => $language->text('ynsocialpublisher', 'ask'), '1' => $language->text('ynsocialpublisher', 'auto'), '2' => $language->text('ynsocialpublisher', 'not_ask')));
     $options->setValue($userSetting['option']);
     $form->addElement($options);
     // Providers - checkboxes
     foreach (array('facebook', 'twitter', 'linkedin') as $provider) {
         if (in_array($provider, $userSetting['adminProviders']) && $arrObjServices[$provider]['has_config']) {
             $providerField = new CheckboxField('ynsocialpublisher_' . $provider);
             $form->addElement($providerField);
         }
     }
     // add js action to form
     $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){OW.info(data.message);OWActiveFloatBox.close();}else{OW.error(data.message);}}');
     // submit button
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('ynsocialpublisher', 'submit_label'));
     $form->addElement($submit);
     $this->addForm($form);
     // assign to view
     $this->assign('formUrl', $formUrl);
 }
Exemple #16
0
 public function __construct($name)
 {
     parent::__construct($name);
     $militaryTime = Ow::getConfig()->getValue('base', 'military_time');
     $language = OW::getLanguage();
     $currentYear = date('Y', time());
     $title = new TextField('title');
     $title->setRequired();
     $title->setLabel($language->text('event', 'add_form_title_label'));
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'title'), $title);
     OW::getEventManager()->trigger($event);
     $title = $event->getData();
     $this->addElement($title);
     $startDate = new DateField('start_date');
     $startDate->setMinYear($currentYear);
     $startDate->setMaxYear($currentYear + 5);
     $startDate->setRequired();
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'start_date'), $startDate);
     OW::getEventManager()->trigger($event);
     $startDate = $event->getData();
     $this->addElement($startDate);
     $startTime = new EventTimeField('start_time');
     $startTime->setMilitaryTime($militaryTime);
     if (!empty($_POST['endDateFlag'])) {
         $startTime->setRequired();
     }
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'start_time'), $startTime);
     OW::getEventManager()->trigger($event);
     $startTime = $event->getData();
     $this->addElement($startTime);
     $endDate = new DateField('end_date');
     $endDate->setMinYear($currentYear);
     $endDate->setMaxYear($currentYear + 5);
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'end_date'), $endDate);
     OW::getEventManager()->trigger($event);
     $endDate = $event->getData();
     $this->addElement($endDate);
     $endTime = new EventTimeField('end_time');
     $endTime->setMilitaryTime($militaryTime);
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'end_time'), $endTime);
     OW::getEventManager()->trigger($event);
     $endTime = $event->getData();
     $this->addElement($endTime);
     $location = new TextField('location');
     $location->setRequired();
     $location->setLabel($language->text('event', 'add_form_location_label'));
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'location'), $location);
     OW::getEventManager()->trigger($event);
     $location = $event->getData();
     $this->addElement($location);
     $whoCanView = new RadioField('who_can_view');
     $whoCanView->setRequired();
     $whoCanView->addOptions(array('1' => $language->text('event', 'add_form_who_can_view_option_anybody'), '2' => $language->text('event', 'add_form_who_can_view_option_invit_only')));
     $whoCanView->setLabel($language->text('event', 'add_form_who_can_view_label'));
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'who_can_view'), $whoCanView);
     OW::getEventManager()->trigger($event);
     $whoCanView = $event->getData();
     $this->addElement($whoCanView);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->setRequired();
     $whoCanInvite->addOptions(array(EVENT_BOL_EventService::CAN_INVITE_PARTICIPANT => $language->text('event', 'add_form_who_can_invite_option_participants'), EVENT_BOL_EventService::CAN_INVITE_CREATOR => $language->text('event', 'add_form_who_can_invite_option_creator')));
     $whoCanInvite->setLabel($language->text('event', 'add_form_who_can_invite_label'));
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'who_can_invite'), $whoCanInvite);
     OW::getEventManager()->trigger($event);
     $whoCanInvite = $event->getData();
     $this->addElement($whoCanInvite);
     $submit = new Submit('submit');
     $submit->setValue($language->text('event', 'add_form_submit_label'));
     $this->addElement($submit);
     $desc = new WysiwygTextarea('desc');
     $desc->setLabel($language->text('event', 'add_form_desc_label'));
     $desc->setRequired();
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'desc'), $desc);
     OW::getEventManager()->trigger($event);
     $desc = $event->getData();
     $this->addElement($desc);
     $imageField = new FileField('image');
     $imageField->setLabel($language->text('event', 'add_form_image_label'));
     $this->addElement($imageField);
     $event = new OW_Event(self::EVENT_NAME, array('name' => 'image'), $imageField);
     OW::getEventManager()->trigger($event);
     $imageField = $event->getData();
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
 }
Exemple #17
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $baseConfigs = $config->getValues('base');
     $form = new Form('privacy_settings');
     $userApprove = new CheckboxField('user_approve');
     $userApprove->setLabel($language->text('admin', 'permissions_index_user_approve'));
     $form->addElement($userApprove);
     $whoCanJoin = new RadioField('who_can_join');
     $whoCanJoin->addOptions(array('1' => $language->text('admin', 'permissions_index_anyone_can_join'), '2' => $language->text('admin', 'permissions_index_by_invitation_only_can_join')));
     $whoCanJoin->setLabel($language->text('admin', 'permissions_index_who_can_join'));
     $form->addElement($whoCanJoin);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->addOptions(array('1' => $language->text('admin', 'permissions_index_all_users_can_invate'), '2' => $language->text('admin', 'permissions_index_admin_only_can_invate')));
     $whoCanInvite->setLabel($language->text('admin', 'permissions_index_who_can_invite'));
     $form->addElement($whoCanInvite);
     $guestsCanView = new RadioField('guests_can_view');
     $guestsCanView->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '2' => $language->text('admin', 'permissions_index_no'), '3' => $language->text('admin', 'permissions_index_with_password')));
     $guestsCanView->setLabel($language->text('admin', 'permissions_index_guests_can_view_site'));
     $guestsCanView->setDescription($language->text('admin', 'permissions_idex_if_not_yes_will_override_settings'));
     $form->addElement($guestsCanView);
     $password = new TextField('password');
     $password->setHasInvitation(true);
     if ($baseConfigs['guests_can_view'] == 3) {
         $password->setInvitation($language->text('admin', 'change_password'));
     } else {
         $password->setInvitation($language->text('admin', 'add_password'));
     }
     $form->addElement($password);
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'permissions_index_save'));
     $form->addElement($submit);
     $this->addForm($form);
     if (OW::getRequest()->isPost()) {
         if ($form->isValid($_POST)) {
             $data = $form->getValues();
             $config->saveConfig('base', 'who_can_join', (int) $data['who_can_join']);
             $config->saveConfig('base', 'who_can_invite', (int) $data['who_can_invite']);
             $config->saveConfig('base', 'mandatory_user_approve', (bool) $data['user_approve'] ? 1 : 0);
             if ((int) $data['guests_can_view'] === 3 && empty($data['password'])) {
                 OW::getFeedback()->error($language->text('admin', 'permission_global_privacy_empty_pass_error_message'));
                 return;
             } else {
                 if ((int) $data['guests_can_view'] === 3 && strlen(trim($data['password'])) < 4) {
                     OW::getFeedback()->error($language->text('admin', 'permission_global_privacy_pass_length_error_message'));
                     return;
                 } else {
                     $adminEmail = OW::getUser()->getEmail();
                     $senderMail = $config->getValue('base', 'site_email');
                     $mail = OW::getMailer()->createMail();
                     $mail->addRecipientEmail($adminEmail);
                     $mail->setSender($senderMail);
                     $mail->setSenderSuffix(false);
                     $mail->setSubject(OW::getLanguage()->text('admin', 'site_password'));
                     $mail->setTextContent(OW::getLanguage()->text('admin', 'admin_password', array('password' => $data['password'])));
                     try {
                         OW::getMailer()->send($mail);
                     } catch (Exception $e) {
                         $logger = OW::getLogger('admin.send_password_message');
                         $logger->addEntry($e->getMessage());
                         $logger->writeLog();
                     }
                     $data['password'] = crypt($data['password'], OW_PASSWORD_SALT);
                     $config->saveConfig('base', 'guests_can_view', (int) $data['guests_can_view']);
                     $config->saveConfig('base', 'guests_can_view_password', $data['password']);
                 }
             }
             OW::getFeedback()->info($language->text('admin', 'permission_global_privacy_settings_success_message'));
             $this->redirect();
         }
     }
     $baseConfigs = $config->getValues('base');
     $form->getElement('who_can_join')->setValue($baseConfigs['who_can_join']);
     $form->getElement('who_can_invite')->setValue($baseConfigs['who_can_invite']);
     $form->getElement('guests_can_view')->setValue($baseConfigs['guests_can_view']);
     $form->getElement('user_approve')->setValue($baseConfigs['mandatory_user_approve']);
 }
 public function __construct()
 {
     parent::__construct('notificationSettingForm');
     $language = OW::getLanguage();
     $field = new RadioField('schedule');
     $field->addOption(NOTIFICATIONS_BOL_Service::SCHEDULE_IMMEDIATELY, $language->text('notifications', 'schedule_immediately'));
     $field->addOption(NOTIFICATIONS_BOL_Service::SCHEDULE_AUTO, $language->text('notifications', 'schedule_automatic'));
     $field->addOption(NOTIFICATIONS_BOL_Service::SCHEDULE_NEVER, $language->text('notifications', 'schedule_never'));
     $schedule = NOTIFICATIONS_BOL_Service::getInstance()->getSchedule(OW::getUser()->getId());
     $field->setValue($schedule);
     $this->addElement($field);
     $btn = new Submit('save');
     $btn->setValue($language->text('notifications', 'save_setting_btn_label'));
     $this->addElement($btn);
 }
Exemple #19
0
 public function __construct($configs)
 {
     parent::__construct('YNSOCIALSTREAM_LevelSettingsForm');
     $language = OW::getLanguage();
     $field = new CheckboxGroup('level_id');
     $field->setLabel($language->text('ynsocialstream', 'admin_level_id_label'));
     $field->setValue($configs['get_feed']);
     $field->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '0' => $language->text('admin', 'permissions_index_no')));
     $this->addElement($field);
     $field = new RadioField('get_feed');
     $field->setLabel($language->text('ynsocialstream', 'admin_get_feed_label'));
     $field->setValue($configs['get_feed']);
     $field->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '0' => $language->text('admin', 'permissions_index_no')));
     $this->addElement($field);
     $btn = new Submit('save');
     $btn->setValue($language->text('ynsocialstream', 'save_customization_btn_label'));
     $this->addElement($btn);
 }
 public function item($value, $text)
 {
     $item = parent::item($value, $text);
     $item->replaceClass('input-with-radio', 'input-with-checkbox');
     return $item;
 }
Exemple #21
0
 /**
  * Class constructor
  *
  */
 public function __construct($maxUploadMaxFilesize)
 {
     parent::__construct('userSettingsForm');
     $this->setEnctype("multipart/form-data");
     $language = OW::getLanguage();
     // avatar size Field
     $avatarSize = new TextField('avatarSize');
     $avatarSize->setRequired(true);
     $validator = new IntValidator(40, 150);
     $validator->setErrorMessage($language->text('admin', 'user_settings_avatar_size_error', array('max' => 150)));
     $avatarSize->addValidator($validator);
     $this->addElement($avatarSize->setLabel($language->text('admin', 'user_settings_avatar_size_label')));
     // big avatar size Field
     $bigAvatarSize = new TextField('bigAvatarSize');
     $bigAvatarSize->setRequired(true);
     $validator = new IntValidator(150, 250);
     $validator->setErrorMessage($language->text('admin', 'user_settings_big_avatar_size_error', array('max' => 250)));
     $bigAvatarSize->addValidator($validator);
     $this->addElement($bigAvatarSize->setLabel($language->text('admin', 'user_settings_big_avatar_size_label')));
     // --- avatar max size
     $maxUploadMaxFilesizeValidator = new FloatValidator(0, $maxUploadMaxFilesize);
     $maxUploadMaxFilesizeValidator->setErrorMessage($language->text('admin', 'settings_max_upload_size_error'));
     $avatarMaxUploadSize = new TextField('avatar_max_upload_size');
     $avatarMaxUploadSize->setLabel($language->text('admin', 'input_settings_avatar_max_upload_size_label'));
     $avatarMaxUploadSize->addValidator($maxUploadMaxFilesizeValidator);
     $this->addElement($avatarMaxUploadSize);
     // --- avatar max size
     if (!defined('OW_PLUGIN_XP')) {
         // confirm Email
         $confirmEmail = new CheckboxField('confirmEmail');
         $confirmEmail->setValue(OW::getConfig()->getValue('base', 'confirm_email'));
         $this->addElement($confirmEmail->setLabel($language->text('admin', 'user_settings_confirm_email')));
     }
     // display name Field
     $displayNameField = new Selectbox('displayName');
     $displayNameField->setRequired(true);
     $questions = array('username' => $language->text('base', 'questions_question_username_label'), 'realname' => $language->text('base', 'questions_question_realname_label'));
     $displayNameField->setHasInvitation(false);
     $displayNameField->setOptions($questions);
     $this->addElement($displayNameField->setLabel($language->text('admin', 'user_settings_display_name')));
     $avatar = new FileField('avatar');
     $this->addElement($avatar);
     $bigAvatar = new FileField('bigAvatar');
     $this->addElement($bigAvatar);
     // --
     $joinConfigField = new Selectbox('join_display_photo_upload');
     $options = array(BOL_UserService::CONFIG_JOIN_DISPLAY_PHOTO_UPLOAD => $language->text('base', 'config_join_display_photo_upload_display_label'), BOL_UserService::CONFIG_JOIN_DISPLAY_AND_SET_REQUIRED_PHOTO_UPLOAD => $language->text('base', 'config_join_display_photo_upload_display_and_require_label'), BOL_UserService::CONFIG_JOIN_NOT_DISPLAY_PHOTO_UPLOAD => $language->text('base', 'config_join_display_photo_upload_not_display_label'));
     $joinConfigField->addOptions($options);
     $joinConfigField->setHasInvitation(false);
     $joinConfigField->setValue(OW::getConfig()->getValue('base', 'join_display_photo_upload'));
     $this->addElement($joinConfigField);
     // --
     $joinConfigField = new CheckboxField('join_display_terms_of_use');
     $joinConfigField->setValue(OW::getConfig()->getValue('base', 'join_display_terms_of_use'));
     $this->addElement($joinConfigField);
     //--- privacy -----///
     $config = OW::getConfig();
     $baseConfigs = $config->getValues('base');
     $userApprove = new CheckboxField('user_approve');
     $userApprove->setLabel($language->text('admin', 'permissions_index_user_approve'));
     $this->addElement($userApprove);
     $whoCanJoin = new RadioField('who_can_join');
     $whoCanJoin->addOptions(array('1' => $language->text('admin', 'permissions_index_anyone_can_join'), '2' => $language->text('admin', 'permissions_index_by_invitation_only_can_join')));
     $whoCanJoin->setLabel($language->text('admin', 'permissions_index_who_can_join'));
     $this->addElement($whoCanJoin);
     $whoCanInvite = new RadioField('who_can_invite');
     $whoCanInvite->addOptions(array('1' => $language->text('admin', 'permissions_index_all_users_can_invate'), '2' => $language->text('admin', 'permissions_index_admin_only_can_invate')));
     $whoCanInvite->setLabel($language->text('admin', 'permissions_index_who_can_invite'));
     $this->addElement($whoCanInvite);
     $guestsCanView = new RadioField('guests_can_view');
     $guestsCanView->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '2' => $language->text('admin', 'permissions_index_no'), '3' => $language->text('admin', 'permissions_index_with_password')));
     $guestsCanView->setLabel($language->text('admin', 'permissions_index_guests_can_view_site'));
     $guestsCanView->setDescription($language->text('admin', 'permissions_idex_if_not_yes_will_override_settings'));
     $this->addElement($guestsCanView);
     $password = new TextField('password');
     $password->setHasInvitation(true);
     if ($baseConfigs['guests_can_view'] == 3) {
         $password->setInvitation($language->text('admin', 'change_password'));
     } else {
         $password->setInvitation($language->text('admin', 'add_password'));
     }
     $this->addElement($password);
     // --- //
     //-- profile questions --//
     $userViewPresentationnew = new CheckboxField("user_view_presentation");
     $userViewPresentationnew->setLabel($language->text('base', 'questions_config_user_view_presentation_label'));
     $userViewPresentationnew->setDescription($language->text('base', 'questions_config_user_view_presentation_description'));
     $this->addElement($userViewPresentationnew);
     // --- //
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $this->addElement($submit);
 }
Exemple #22
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $configs = OW::getConfig()->getValues('mailbox');
     //        $element = new CheckboxField('enableAttachments');
     //        $element->setValue($configs['enable_attachments']);
     //        $this->addElement($element);
     $activeModeList = new RadioField('active_mode_list');
     $activeModeList->setLabel($language->text('mailbox', 'settings_label_active_mode_list'));
     $availableModeCollector = new BASE_CLASS_EventCollector('plugin.mailbox.on_available_mode_collect');
     OW::getEventManager()->trigger($availableModeCollector);
     $data = $availableModeCollector->getData();
     if (!empty($data)) {
         foreach ($data as $modeName) {
             $availableModeList[$modeName] = $language->text('mailbox', 'label_btn_' . $modeName);
         }
     } else {
         $availableModeList = array('mail' => $language->text('mailbox', 'label_btn_mail'), 'chat' => $language->text('mailbox', 'label_btn_chat'), 'mailchat' => $language->text('mailbox', 'label_btn_mailchat'));
     }
     $activeModeList->setOptions($availableModeList);
     $activeModes = MAILBOX_BOL_ConversationService::getInstance()->getActiveModeList();
     if (in_array('mail', $activeModes) && in_array('chat', $activeModes)) {
         $activeModeList->setValue('mailchat');
     } else {
         $activeModeList->setValue($activeModes[0]);
     }
     $activeModeList->setRequired();
     $this->addElement($activeModeList);
     if (in_array('mail', $activeModes)) {
         $sendMessageInterval = new TextField('send_message_interval');
         $sendMessageInterval->setValue($configs['send_message_interval']);
         $sendMessageInterval->setLabel($language->text('mailbox', 'settings_label_send_message_interval'));
         $this->addElement($sendMessageInterval);
     }
     $showAllMembers = new CheckboxField('show_all_members');
     $showAllMembers->setLabel($language->text('mailbox', 'settings_label_show_all_members'));
     $showAllMembers->setDescription($language->text('mailbox', 'settings_desc_show_all_members'));
     $showAllMembers->setValue(OW::getConfig()->getValue('mailbox', 'show_all_members'));
     $this->addElement($showAllMembers);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('base', 'edit_button'));
     $this->addElement($submit);
     //        $js = <<<EOT
     //$("input[name='active_mode_list']").click(function(){
     //    if ($(this).val()=='mail')
     //    {
     //        $("input[name='show_all_members']").attr('disabled', 'disabled');
     //        $("#showAllMembersContainer").hide();
     //    }
     //    else
     //    {
     //        $("input[name='show_all_members']").removeAttr('disabled');
     //        $("#showAllMembersContainer").show();
     //    }
     //});
     //EOT;
     //
     //        OW::getDocument()->addOnloadScript($js);
 }
 public function __construct(BOL_MenuItem $menuItem, $custom = false, $addUrlValidator = true)
 {
     parent::__construct("settingForm");
     $this->menuItem = $menuItem;
     $language = OW::getLanguage();
     $this->setAjax();
     $this->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_MobileNavigation", "saveItemSettings"));
     $item = new HiddenField("key");
     $item->setValue($menuItem->prefix . ':' . $menuItem->key);
     $this->addElement($item);
     $settings = BOL_MobileNavigationService::getInstance()->getItemSettings($this->menuItem);
     // Mail Settings
     $item = new TextField(BOL_MobileNavigationService::SETTING_LABEL);
     $item->setLabel($language->text("mobile", "admin_nav_item_label_field"));
     $item->setValue($settings[BOL_MobileNavigationService::SETTING_LABEL]);
     $item->setRequired();
     $this->addElement($item);
     if ($custom) {
         $typeField = new RadioField(BOL_MobileNavigationService::SETTING_TYPE);
         $typeField->setLabel($language->text("mobile", "admin_nav_item_type_field"));
         $typeField->setValue($settings[BOL_MobileNavigationService::SETTING_TYPE]);
         $typeField->addOption("local", $language->text("mobile", "admin_nav_item_type_local"));
         $typeField->addOption("external", $language->text("mobile", "admin_nav_item_type_external"));
         $this->addElement($typeField);
         $item = new TextField(BOL_MobileNavigationService::SETTING_TITLE);
         $item->setLabel($language->text("mobile", "admin_nav_item_title_field"));
         $item->setValue($settings[BOL_MobileNavigationService::SETTING_TITLE]);
         $item->setRequired();
         $this->addElement($item);
         $item = new Textarea(BOL_MobileNavigationService::SETTING_CONTENT);
         $item->setLabel($language->text("mobile", "admin_nav_item_content_field"));
         $item->setValue($settings[BOL_MobileNavigationService::SETTING_CONTENT]);
         $this->addElement($item);
         $item = new TextField(BOL_MobileNavigationService::SETTING_URL);
         if ($addUrlValidator) {
             $item->addValidator(new UrlValidator());
             $item->setRequired();
         }
         $item->setLabel($language->text("mobile", "admin_nav_item_url_field"));
         $item->setValue($settings[BOL_MobileNavigationService::SETTING_URL]);
         $this->addElement($item);
         $item = new CheckboxGroup(BOL_MobileNavigationService::SETTING_VISIBLE_FOR);
         $visibleFor = empty($settings[BOL_MobileNavigationService::SETTING_VISIBLE_FOR]) ? 0 : $settings[BOL_MobileNavigationService::SETTING_VISIBLE_FOR];
         $options = array('1' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_guests'), '2' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_members'));
         $values = array();
         foreach ($options as $value => $option) {
             if (!($value & $visibleFor)) {
                 continue;
             }
             $values[] = $value;
         }
         $this->addElement($item->setOptions($options)->setValue($values)->setLabel(OW::getLanguage()->text('admin', 'pages_edit_local_visible_for')));
         $js = UTIL_JsGenerator::newInstance();
         $js->addScript('var url = owForms[{$name}].elements["url"]; var validators = url.validators; url.validators = []; $("input[name=type]", "#" + {$id}).change(function() { ' . 'if ($(this).val() == "local") { ' . '$("#mp-content").show(); $("#mp-url").hide(); url.validators = []; ' . '} else { ' . '$("#mp-content").hide(); $("#mp-url").show(); url.validators = validators; } ' . '});', array("id" => $this->getId(), "name" => $this->getName()));
         OW::getDocument()->addOnloadScript($js);
     }
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $this->addElement($submit);
 }