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 __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); }
/** * 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); }
/** * 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); }
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); }
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']); }
/** * 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($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 __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); }
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); }