Пример #1
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     OW::getDocument()->setHeading(OW::getLanguage()->text('admin', 'heading_mobile_settings'));
     OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
     $settingsForm = new Form('mobile_settings');
     $disableMobile = new CheckboxField('disable_mobile');
     $disableMobile->setLabel($language->text('admin', 'mobile_settings_mobile_context_disable_label'));
     $disableMobile->setDescription($language->text('admin', 'mobile_settings_mobile_context_disable_desc'));
     $settingsForm->addElement($disableMobile);
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $settingsForm->addElement($submit);
     $this->addForm($settingsForm);
     if (OW::getRequest()->isPost()) {
         if ($settingsForm->isValid($_POST)) {
             $data = $settingsForm->getValues();
             $config->saveConfig('base', 'disable_mobile_context', (bool) $data['disable_mobile']);
             OW::getFeedback()->info($language->text('admin', 'settings_submit_success_message'));
         } else {
             OW::getFeedback()->error('Error');
         }
         $this->redirect();
     }
     $disableMobile->setValue($config->getValue('base', 'disable_mobile_context'));
 }
Пример #2
0
 public function __construct()
 {
     parent::__construct('questions_add');
     $language = OW::getLanguage();
     $this->setAjax();
     $this->setAjaxResetOnSuccess(false);
     $field = new Textarea('question');
     $field->addAttribute('maxlength', 500);
     $field->setRequired();
     $field->setHasInvitation(true);
     $field->setInvitation($language->text('questions', 'question_add_text_inv'));
     $field->addAttribute("inv", $language->text('questions', 'question_add_text_inv'));
     $this->addElement($field);
     $field = new CheckboxField('allowAddOprions');
     $field->addAttribute('checked');
     $field->setLabel($language->text('questions', 'question_add_allow_add_opt'));
     $this->addElement($field);
     $field = new QUESTIONS_OptionsField('answers');
     $field->setHasInvitation(true);
     $field->setInvitation($language->text('questions', 'question_add_option_inv'));
     $this->addElement($field);
     $submit = new Submit('save');
     $submit->setValue($language->text('questions', 'question_add_save'));
     $this->addElement($submit);
     if (!OW::getRequest()->isAjax()) {
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_empty');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_min_length');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_max_length');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_two_apt_required');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_question_dublicate_option');
         OW::getLanguage()->addKeyForJs('questions', 'feedback_option_max_length');
         $this->initJsResponder();
     }
     $this->setAction(OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlFor('QUESTIONS_CTRL_List', 'addQuestion')));
 }
Пример #3
0
 /**
  * Constructor.
  */
 public function __construct($ajax = false)
 {
     parent::__construct();
     $form = new Form('sign-in');
     $form->setAction("");
     $username = new TextField('identity');
     $username->setRequired(true);
     $username->setHasInvitation(true);
     $username->setInvitation(OW::getLanguage()->text('base', 'component_sign_in_login_invitation'));
     $form->addElement($username);
     $password = new PasswordField('password');
     $password->setHasInvitation(true);
     $password->setInvitation('password');
     $password->setRequired(true);
     $form->addElement($password);
     $remeberMe = new CheckboxField('remember');
     $remeberMe->setValue(true);
     $remeberMe->setLabel(OW::getLanguage()->text('base', 'sign_in_remember_me_label'));
     $form->addElement($remeberMe);
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('base', 'sign_in_submit_label'));
     $form->addElement($submit);
     $this->addForm($form);
     if ($ajax) {
         $form->setAjaxResetOnSuccess(false);
         $form->setAjax();
         $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'ajaxSignIn'));
         $form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){if(data.message){OW.info(data.message);}setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}');
         $this->assign('forgot_url', OW::getRouter()->urlForRoute('base_forgot_password'));
     }
     $this->assign('joinUrl', OW::getRouter()->urlForRoute('base_join'));
 }
Пример #4
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $field = new TextField('public_key');
     $field->addValidator(new ConfigRequireValidator());
     $this->addElement($field);
     $field = new CheckboxField('billing_enabled');
     $this->addElement($field);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $this->addElement($submit);
     $promoUrl = new TextField('app_url');
     $promoUrl->setRequired();
     $promoUrl->addValidator(new UrlValidator());
     $promoUrl->setLabel($language->text('skandroid', 'app_url_label'));
     $promoUrl->setDescription($language->text('skandroid', 'app_url_desc'));
     $promoUrl->setValue(OW::getConfig()->getValue('skandroid', 'app_url'));
     $this->addElement($promoUrl);
     $smartBanner = new CheckboxField('smart_banner');
     $smartBanner->setLabel($language->text('skandroid', 'smart_banner_label'));
     $smartBanner->setDescription($language->text('skandroid', 'smart_banner_desc'));
     $smartBanner->setValue(OW::getConfig()->getValue('skandroid', 'smart_banner'));
     $this->addElement($smartBanner);
 }
Пример #5
0
 /**
  * Class constructor
  */
 public function __construct()
 {
     parent::__construct('update-question-form');
     $this->setAction(OW::getRouter()->urlFor('OCSFAQ_CTRL_Admin', 'editQuestion'));
     $lang = OW::getLanguage();
     $questionId = new HiddenField('questionId');
     $questionId->setRequired(true);
     $this->addElement($questionId);
     $question = new TextField('question');
     $question->setRequired(true);
     $question->setLabel($lang->text('ocsfaq', 'question'));
     $this->addElement($question);
     $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML);
     $answer = new WysiwygTextarea('answer', $btnSet);
     $answer->setRequired(true);
     $answer->setLabel($lang->text('ocsfaq', 'answer'));
     $this->addElement($answer);
     $isFeatured = new CheckboxField('isFeatured');
     $isFeatured->setLabel($lang->text('ocsfaq', 'is_featured'));
     $this->addElement($isFeatured);
     $categories = OCSFAQ_BOL_FaqService::getInstance()->getCategories();
     if ($categories) {
         $category = new Selectbox('category');
         foreach ($categories as $cat) {
             $category->addOption($cat->id, $cat->name);
         }
         $category->setLabel($lang->text('ocsfaq', 'category'));
         $this->addElement($category);
     }
     // submit
     $submit = new Submit('update');
     $submit->setValue($lang->text('ocsfaq', 'btn_save'));
     $this->addElement($submit);
 }
Пример #6
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);
 }
Пример #7
0
    public function __construct()
    {
        parent::__construct('hint-form');
        $this->setAjax(TRUE);
        $this->setAction(OW::getRouter()->urlForRoute('profileprogressbar.admin_hint'));
        $this->setAjaxResetOnSuccess(FALSE);
        $this->bindJsFunction('success', 'function(data)
        {
            $("#profile-progressbar").tipTip({content: data.content});

            OW.info("Settings successfully saved");
        }');
        $checkBox = new CheckboxField('show-hint');
        if ((bool) OW::getConfig()->getValue('profileprogressbar', 'show_hint')) {
            $checkBox->addAttribute('checked', 'checked');
        }
        $checkBox->setLabel(OW::getLanguage()->text('profileprogressbar', 'show_hint_label'));
        $checkBox->setDescription(OW::getLanguage()->text('profileprogressbar', 'show_hint_desc'));
        $this->addElement($checkBox);
        $hintText = new WysiwygTextarea('hint-text');
        $hintText->setRequired();
        $hintText->setSize(WysiwygTextarea::SIZE_L);
        $hintText->setValue(OW::getLanguage()->text('profileprogressbar', 'hint_text'));
        $hintText->setLabel(OW::getLanguage()->text('profileprogressbar', 'hint_label'));
        $hintText->setDescription(OW::getLanguage()->text('profileprogressbar', 'hint_desc'));
        $this->addElement($hintText);
        $submit = new Submit('save');
        $submit->setValue('Save');
        $this->addElement($submit);
    }
Пример #8
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']);
 }
Пример #9
0
 public function __construct()
 {
     parent::__construct('settings-form');
     $lang = OW::getLanguage();
     $canView = new CheckboxField('canView');
     $canView->setLabel($lang->text('ocsfavorites', 'can_view_favorites'));
     $this->addElement($canView);
     // submit
     $submit = new Submit('save');
     $submit->setValue($lang->text('ocsfavorites', 'btn_save'));
     $this->addElement($submit);
 }
Пример #10
0
 public function __construct()
 {
     parent::__construct('EQUESTIONS_SetupForm');
     $language = OW::getLanguage();
     $field = new CheckboxField('copyData');
     $field->setValue(true);
     $field->setLabel($language->text('equestions', 'admin_setup_copy_data_label'));
     $this->addElement($field);
     $button = new Submit('upgrade');
     $button->setValue($language->text('equestions', 'admin_setup_upgrade_label'));
     $this->addElement($button);
 }
Пример #11
0
 public function __construct($name)
 {
     parent::__construct($name);
     $lang = OW::getLanguage();
     $period = new TextField('period');
     $period->setRequired(true);
     $period->setLabel($lang->text('ocsaffiliates', 'settings_timeout'));
     $this->addElement($period);
     $status = new Selectbox('status');
     $status->setRequired(true);
     $status->setHasInvitation(false);
     $options = array('active' => $lang->text('ocsaffiliates', 'status_active'), 'unverified' => $lang->text('ocsaffiliates', 'status_unverified'));
     $status->addOptions($options);
     $status->setLabel($lang->text('ocsaffiliates', 'settings_status'));
     $this->addElement($status);
     $clickAmount = new TextField('clickAmount');
     $clickAmount->setRequired(true);
     $clickAmount->setLabel($lang->text('ocsaffiliates', 'settings_click_amount'));
     $clickAmount->addValidator(new FloatValidator());
     $this->addElement($clickAmount);
     $regAmount = new TextField('regAmount');
     $regAmount->setRequired(true);
     $regAmount->setLabel($lang->text('ocsaffiliates', 'settings_reg_amount'));
     $regAmount->addValidator(new FloatValidator());
     $this->addElement($regAmount);
     $saleCommission = new Selectbox('saleCommission');
     $saleCommission->setRequired(true);
     $options = array('amount' => $lang->text('ocsaffiliates', 'commission_amount'), 'percent' => $lang->text('ocsaffiliates', 'commission_percent'));
     $saleCommission->addOptions($options);
     $saleCommission->setLabel($lang->text('ocsaffiliates', 'settings_sale_commission'));
     $this->addElement($saleCommission);
     $saleAmount = new TextField('saleAmount');
     $saleAmount->setLabel($lang->text('ocsaffiliates', 'settings_sale_amount'));
     $saleAmount->addValidator(new FloatValidator());
     $this->addElement($saleAmount);
     $salePercent = new TextField('salePercent');
     $salePercent->setLabel($lang->text('ocsaffiliates', 'settings_sale_percent'));
     $salePercent->addValidator(new FloatValidator());
     $this->addElement($salePercent);
     $showRates = new CheckboxField('showRates');
     $showRates->setLabel($lang->text('ocsaffiliates', 'show_rates'));
     $this->addElement($showRates);
     $allowBanners = new CheckboxField('allowBanners');
     $allowBanners->setLabel($lang->text('ocsaffiliates', 'allow_banners'));
     $this->addElement($allowBanners);
     $terms = new CheckboxField('terms');
     $terms->setLabel($lang->text('ocsaffiliates', 'enable_terms'));
     $this->addElement($terms);
     $submit = new Submit('save');
     $submit->setLabel($lang->text('ocsaffiliates', 'save'));
     $this->addElement($submit);
 }
Пример #12
0
 public function __construct($configs)
 {
     parent::__construct('EQUESTIONS_ConfigSaveForm');
     $this->configs = $configs;
     $language = OW::getLanguage();
     $field = new CheckboxField('allow_comments');
     $field->setLabel($language->text('equestions', 'admin_allow_comments_label'));
     $field->setValue($configs['allow_comments']);
     $this->addElement($field);
     $field = new CheckboxField('ask_friends');
     $field->setLabel($language->text('equestions', 'admin_enable_ask_friends_label'));
     $field->setValue($configs['ask_friends']);
     $this->addElement($field);
     $field = new Selectbox('list_order');
     foreach (array(EQUESTIONS_CMP_Feed::ORDER_LATEST, EQUESTIONS_CMP_Feed::ORDER_POPULAR) as $v) {
         $field->addOption($v, $language->text('equestions', 'feed_order_' . $v));
     }
     $field->setHasInvitation(false);
     $field->setLabel($language->text('equestions', 'admin_list_order_label'));
     $field->setValue($configs['list_order']);
     $this->addElement($field);
     $field = new CheckboxField('enable_follow');
     $field->setLabel($language->text('equestions', 'admin_enable_follow_label'));
     $field->setValue($configs['enable_follow']);
     $this->addElement($field);
     $field = new CheckboxField('allow_popups');
     $field->setLabel($language->text('equestions', 'admin_allow_popups_label'));
     $field->setValue($configs['allow_popups']);
     $this->addElement($field);
     $field = new CheckboxField('attachments');
     $field->setLabel($language->text('equestions', 'admin_enable_attachments_label'));
     $field->setValue($configs['attachments']);
     $this->addElement($field);
     $field = new CheckboxField('attachments_video');
     $field->setLabel($language->text('equestions', 'admin_attachments_video_enable_label'));
     $field->setValue($configs['attachments_video']);
     $this->addElement($field);
     $field = new CheckboxField('attachments_image');
     $field->setLabel($language->text('equestions', 'admin_attachments_image_enable_label'));
     $field->setValue($configs['attachments_image']);
     $this->addElement($field);
     $field = new CheckboxField('attachments_link');
     $field->setLabel($language->text('equestions', 'admin_attachments_link_enable_label'));
     $field->setValue($configs['attachments_link']);
     $this->addElement($field);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('equestions', 'admin_save_btn'));
     $this->addElement($submit);
 }
Пример #13
0
 /**
  * Constructor.
  * 
  * @param array $itemsList
  */
 public function __construct($langId)
 {
     parent::__construct();
     $this->service = BOL_LanguageService::getInstance();
     if (empty($langId)) {
         $this->setVisible(false);
         return;
     }
     $languageDto = $this->service->findById($langId);
     if ($languageDto === null) {
         $this->setVisible(false);
         return;
     }
     $language = OW::getLanguage();
     $form = new Form('lang_edit');
     $form->setAjax();
     $form->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'langEditFormResponder'));
     $form->setAjaxResetOnSuccess(false);
     $labelTextField = new TextField('label');
     $labelTextField->setLabel($language->text('admin', 'clone_form_lbl_label'));
     $labelTextField->setDescription($language->text('admin', 'clone_form_descr_label'));
     $labelTextField->setRequired();
     $labelTextField->setValue($languageDto->getLabel());
     $form->addElement($labelTextField);
     $tagTextField = new TextField('tag');
     $tagTextField->setLabel($language->text('admin', 'clone_form_lbl_tag'));
     $tagTextField->setDescription($language->text('admin', 'clone_form_descr_tag'));
     $tagTextField->setRequired();
     $tagTextField->setValue($languageDto->getTag());
     if ($languageDto->getTag() == 'en') {
         $tagTextField->addAttribute('disabled', 'disabled');
     }
     $form->addElement($tagTextField);
     $rtl = new CheckboxField('rtl');
     $rtl->setLabel($language->text('admin', 'lang_edit_form_rtl_label'));
     $rtl->setDescription($language->text('admin', 'lang_edit_form_rtl_desc'));
     $rtl->setValue((bool) $languageDto->getRtl());
     $form->addElement($rtl);
     $hiddenField = new HiddenField('langId');
     $hiddenField->setValue($languageDto->getId());
     $form->addElement($hiddenField);
     $submit = new Submit('submit');
     $submit->setValue($language->text('admin', 'btn_label_edit'));
     $form->addElement($submit);
     $form->bindJsFunction(Form::BIND_SUCCESS, "function(data){if(data.result){OW.info(data.message);setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}");
     $this->addForm($form);
 }
Пример #14
0
 public function __construct($name, $mode)
 {
     parent::__construct($name);
     $this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_edit'));
     $this->setAjax();
     $lang = OW::getLanguage();
     $idField = new HiddenField('affiliateId');
     $this->addElement($idField);
     $modeField = new HiddenField('mode');
     $modeField->setValue($mode);
     $this->addElement($modeField);
     if ($mode == 'admin') {
         $emailVerified = new CheckboxField('emailVerified');
         $emailVerified->setLabel($lang->text('ocsaffiliates', 'email_verified'));
         $this->addElement($emailVerified);
         $status = new Selectbox('status');
         $status->setLabel($lang->text('ocsaffiliates', 'status'));
         $status->setHasInvitation(false);
         $status->setRequired(true);
         $options = array('active' => $lang->text('ocsaffiliates', 'status_active'), 'unverified' => $lang->text('ocsaffiliates', 'status_unverified'));
         $status->setOptions($options);
         $this->addElement($status);
     }
     $affName = new TextField('name');
     $affName->setRequired(true);
     $affName->setLabel($lang->text('ocsaffiliates', 'affiliate_name'));
     $this->addElement($affName);
     $email = new TextField('email');
     $email->setRequired(true);
     $email->setLabel($lang->text('ocsaffiliates', 'email'));
     $email->addValidator(new EmailValidator());
     $this->addElement($email);
     $password = new PasswordField('password');
     $password->setLabel($lang->text('ocsaffiliates', 'password'));
     $this->addElement($password);
     $payment = new Textarea('payment');
     $payment->setRequired(true);
     $payment->setLabel($lang->text('ocsaffiliates', 'payment_details'));
     $this->addElement($payment);
     $submit = new Submit('save');
     $submit->setValue($lang->text('ocsaffiliates', 'edit'));
     $this->addElement($submit);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n            if ( !data.result ) {\n                OW.error(data.error);\n            }\n            else {\n                document.location.reload();\n            }\n        }");
 }
Пример #15
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $adminForm = new Form('adminForm');
     $element = new Selectbox('actionMember');
     $element->setLabel($language->text('grouprss', 'action_member_label'));
     $element->setDescription($language->text('grouprss', 'action_member_desc'));
     $element->setValue($config->getValue('grouprss', 'actionMember'));
     $element->setRequired();
     $element->addOption('admin', $language->text('grouprss', 'site_admin'));
     $element->addOption('owner', $language->text('grouprss', 'group_owner'));
     $element->addOption('both', $language->text('grouprss', 'both_admin_owner'));
     $adminForm->addElement($element);
     $element = new Selectbox('postLocation');
     $element->setLabel($language->text('grouprss', 'post_location_label'));
     $element->setDescription($language->text('grouprss', 'post_location_desc'));
     $element->setValue($config->getValue('grouprss', 'postLocation'));
     $element->setRequired();
     $element->addOption('wall', $language->text('grouprss', 'wall_location'));
     $element->addOption('newsfeed', $language->text('grouprss', 'newsfeed_location'));
     $adminForm->addElement($element);
     $element = new CheckboxField('disablePosting');
     $element->setLabel($language->text('grouprss', 'disable_posting_label'));
     $element->setDescription($language->text('grouprss', 'disable_posting_desc'));
     $element->setValue($config->getValue('grouprss', 'disablePosting'));
     $adminForm->addElement($element);
     $element = new Submit('saveSettings');
     $element->setValue(OW::getLanguage()->text('grouprss', 'admin_save_settings'));
     $adminForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($adminForm->isValid($_POST)) {
             $values = $adminForm->getValues();
             $config->saveConfig('grouprss', 'actionMember', $values['actionMember']);
             $config->saveConfig('grouprss', 'postLocation', $values['postLocation']);
             $config->saveConfig('grouprss', 'disablePosting', $values['disablePosting']);
             GROUPRSS_BOL_FeedService::getInstance()->addAllGroupFeed();
             //OW::getFeedback()->info($language->text('grouprss', 'user_save_success'));
         }
     }
     $this->addForm($adminForm);
 }
Пример #16
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $adminForm = new Form('adminForm');
     $element = new TextField('logsPerPage');
     $element->setRequired(true);
     $element->setValue($config->getValue('credits', 'logsPerPage'));
     $element->setLabel($language->text('credits', 'logs_per_page'));
     $element->addValidator(new IntValidator(1));
     $adminForm->addElement($element);
     $element = new CheckboxField('enableEmail');
     $element->setLabel(OW::getLanguage()->text('credits', 'admin_enable_email'));
     $element->setDescription(OW::getLanguage()->text('credits', 'admin_enable_email_desc'));
     $element->setValue($config->getValue('credits', 'enableEmail'));
     $adminForm->addElement($element);
     $element = new CheckboxField('enablePM');
     $element->setLabel(OW::getLanguage()->text('credits', 'admin_enable_pm'));
     $element->setDescription(OW::getLanguage()->text('credits', 'admin_enable_pm_desc'));
     $element->setValue($config->getValue('credits', 'enablePM'));
     $adminForm->addElement($element);
     $element = new CheckboxField('enableNotification');
     $element->setLabel(OW::getLanguage()->text('credits', 'admin_enable_notification'));
     $element->setDescription(OW::getLanguage()->text('credits', 'admin_enable_notification_desc'));
     $element->setValue($config->getValue('credits', 'enableNotification'));
     $adminForm->addElement($element);
     $element = new Submit('saveSettings');
     $element->setValue(OW::getLanguage()->text('credits', 'admin_save_settings'));
     $adminForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($adminForm->isValid($_POST)) {
             $values = $adminForm->getValues();
             $config->saveConfig('credits', 'logsPerPage', $values['logsPerPage']);
             $config->saveConfig('credits', 'enableEmail', $values['enableEmail']);
             $config->saveConfig('credits', 'enablePM', $values['enablePM']);
             $config->saveConfig('credits', 'enableNotification', $values['enableNotification']);
             OW::getFeedback()->info($language->text('credits', 'save_sucess_msg'));
         }
     }
     $this->addForm($adminForm);
 }
Пример #17
0
 public function __construct($name, $affiliateId = null)
 {
     parent::__construct($name);
     $this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_register_payout'));
     $this->setAjax(true);
     $lang = OW::getLanguage();
     $amount = new TextField('amount');
     $amount->setLabel($lang->text('ocsaffiliates', 'amount_paid'));
     $amount->setRequired(true);
     $this->addElement($amount);
     $affiliate = new HiddenField('affiliateId');
     $affiliate->setRequired(true);
     $this->addElement($affiliate);
     $byCredits = new CheckboxField('byCredits');
     $byCredits->setLabel($lang->text('ocsaffiliates', 'deposit_credits'));
     $this->addElement($byCredits);
     $submit = new Submit('add');
     $submit->setValue($lang->text('ocsaffiliates', 'register_btn'));
     $this->addElement($submit);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n            if ( !data.result ) {\n                OW.error(data.error);\n            }\n            else {\n                document.location.reload();\n            }\n        }");
 }
Пример #18
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct('configSaveForm');
     $language = OW::getLanguage();
     $slideshowTime = new TextField('slideshowTime');
     $frValidator = new IntValidator();
     $frValidator->setMinValue(1);
     $slideshowTime->addValidator($frValidator);
     $slideshowTime->setLabel($language->text('gphotoviewer', 'slideshow_time_per_a_photo'));
     $this->addElement($slideshowTime);
     $enablePhotoviewer = new CheckboxField('enablePhotoviewer');
     $enablePhotoviewer->setLabel($language->text('gphotoviewer', 'enable_photo_viewer'));
     $this->addElement($enablePhotoviewer);
     $downloadable = new CheckboxField('downloadable');
     $downloadable->setLabel($language->text('gphotoviewer', 'can_users_to_download_photos'));
     $this->addElement($downloadable);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('photo', 'btn_edit'));
     $this->addElement($submit);
 }
Пример #19
0
 public function __construct()
 {
     parent::__construct('moneybookers-config-form');
     $language = OW::getLanguage();
     $billingService = BOL_BillingService::getInstance();
     $gwKey = OCSBILLINGMONEYBOOKERS_CLASS_MoneybookersAdapter::GATEWAY_KEY;
     $merchantId = new TextField('merchantId');
     $merchantId->setValue($billingService->getGatewayConfigValue($gwKey, 'merchantId'));
     $merchantId->setRequired(true);
     $merchantId->setLabel($language->text('ocsbillingmoneybookers', 'merchant_id'));
     $this->addElement($merchantId);
     $merchantEmail = new TextField('merchantEmail');
     $merchantEmail->setValue($billingService->getGatewayConfigValue($gwKey, 'merchantEmail'));
     $merchantEmail->setRequired(true);
     $merchantEmail->setLabel($language->text('ocsbillingmoneybookers', 'merchant_email'));
     $this->addElement($merchantEmail);
     $secret = new TextField('secret');
     $secret->setValue($billingService->getGatewayConfigValue($gwKey, 'secret'));
     $secret->setRequired(true);
     $secret->setLabel($language->text('ocsbillingmoneybookers', 'secret'));
     $this->addElement($secret);
     $sandboxMode = new CheckboxField('sandboxMode');
     $sandboxMode->setValue($billingService->getGatewayConfigValue($gwKey, 'sandboxMode'));
     $sandboxMode->setLabel($language->text('ocsbillingmoneybookers', 'sandbox_mode'));
     $this->addElement($sandboxMode);
     $desc = new TextField('recipientDescription');
     $desc->setValue($billingService->getGatewayConfigValue($gwKey, 'recipientDescription'));
     $desc->setLabel($language->text('ocsbillingmoneybookers', 'recipient_description'));
     $this->addElement($desc);
     $lang = new Selectbox('language');
     $lang->setLabel($language->text('ocsbillingmoneybookers', 'language'));
     $lang->addOptions(array('EN' => 'EN', 'DE' => 'DE', 'ES' => 'ES', 'FR' => 'FR', 'IT' => 'IT', 'PL' => 'PL', 'GR' => 'GR', 'RO' => 'PO', 'RU' => 'RU', 'TR' => 'TR', 'CN' => 'CN', 'CZ' => 'CZ', 'NL' => 'NL', 'DA' => 'DA', 'SV' => 'SV', 'FI' => 'FI'));
     $lang->setRequired(true);
     $lang->setValue($billingService->getGatewayConfigValue($gwKey, 'language'));
     $this->addElement($lang);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('ocsbillingmoneybookers', 'btn_save'));
     $this->addElement($submit);
 }
Пример #20
0
 public function __construct()
 {
     parent::__construct('settings-form');
     $lang = OW::getLanguage();
     $disMaleToMaleProfile = new CheckboxField('disMaleToMaleProfile');
     $disMaleToMaleProfile->setLabel($lang->text('selectgender', 'dis_male_to_male_profile'));
     $this->addElement($disMaleToMaleProfile);
     $disMaleToFemaleProfile = new CheckboxField('disMaleToFemaleProfile');
     $disMaleToFemaleProfile->setLabel($lang->text('selectgender', 'dis_male_to_female_profile'));
     $this->addElement($disMaleToFemaleProfile);
     $disMaleToMaleProfile = new CheckboxField('disFemaleToFemaleProfile');
     $disMaleToMaleProfile->setLabel($lang->text('selectgender', 'dis_female_to_female_profile'));
     $this->addElement($disMaleToMaleProfile);
     $onlyDifferentSexCanSeePhoto = new CheckboxField('oppositeSexPhotoView');
     $onlyDifferentSexCanSeePhoto->setLabel($lang->text('selectgender', 'opposite_sex_photo_view'));
     $this->addElement($onlyDifferentSexCanSeePhoto);
     $onlySameSexCanSeePhoto = new CheckboxField('sameSexPhotoView');
     $onlySameSexCanSeePhoto->setLabel($lang->text('selectgender', 'same_sex_photo_view'));
     $this->addElement($onlySameSexCanSeePhoto);
     $opositeMatchSexJoin = new CheckboxField('opositeMatchSexJoin');
     $opositeMatchSexJoin->setLabel($lang->text('selectgender', 'oposite_match_sex_join'));
     $this->addElement($opositeMatchSexJoin);
     $sameMatchSexJoin = new CheckboxField('sameMatchSexJoin');
     $sameMatchSexJoin->setLabel($lang->text('selectgender', 'same_match_sex_join'));
     $this->addElement($sameMatchSexJoin);
     $opositeMatchSexSearch = new CheckboxField('opositeMatchSexSearch');
     $opositeMatchSexSearch->setLabel($lang->text('selectgender', 'oposite_match_sex_search'));
     $this->addElement($opositeMatchSexSearch);
     $sameMatchSexSearch = new CheckboxField('sameMatchSexSearch');
     $sameMatchSexSearch->setLabel($lang->text('selectgender', 'same_match_sex_search'));
     $this->addElement($sameMatchSexSearch);
     $guestRedirectToJoin = new CheckboxField('guestRedirectToJoin');
     $guestRedirectToJoin->setLabel($lang->text('selectgender', 'guest_redirect_to_join'));
     $this->addElement($guestRedirectToJoin);
     // submit
     $submit = new Submit('save');
     $submit->setValue($lang->text('selectgender', 'btn_save'));
     $this->addElement($submit);
 }
Пример #21
0
 /**
  * @param integer $userId
  */
 public function __construct($userId)
 {
     parent::__construct();
     $user = BOL_UserService::getInstance()->findUserById((int) $userId);
     if (!OW::getUser()->isAuthorized('base') || $user === null) {
         $this->setVisible(false);
         return;
     }
     $aService = BOL_AuthorizationService::getInstance();
     $roleList = $aService->findNonGuestRoleList();
     $form = new Form('give-role');
     $form->setAjax(true);
     $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'updateUserRoles'));
     $hidden = new HiddenField('userId');
     $form->addElement($hidden->setValue($userId));
     $userRoles = $aService->findUserRoleList($user->getId());
     $userRolesIdList = array();
     foreach ($userRoles as $role) {
         $userRolesIdList[] = $role->getId();
     }
     $tplRoleList = array();
     /* @var $role BOL_AuthorizationRole */
     foreach ($roleList as $role) {
         $field = new CheckboxField('roles[' . $role->getId() . ']');
         $field->setLabel(OW::getLanguage()->text('base', 'authorization_role_' . $role->getName()));
         $field->setValue(in_array($role->getId(), $userRolesIdList));
         if (in_array($role->getId(), $userRolesIdList) && $role->getSortOrder() == 1) {
             $field->addAttribute('disabled', 'disabled');
         }
         $form->addElement($field);
         $tplRoleList[$role->sortOrder] = $role;
     }
     ksort($tplRoleList);
     $form->addElement(new Submit('submit'));
     OW::getDocument()->addOnloadScript("owForms['{$form->getName()}'].bind('success', function(data){\n                if( data.result ){\n                    if( data.result == 'success' ){\n                         window.baseChangeUserRoleFB.close();\n                         window.location.reload();\n                         //OW.info(data.message);\n                    }\n                    else if( data.result == 'error'){\n                        OW.error(data.message);\n                    }\n                }\n\t\t})");
     $this->addForm($form);
     $this->assign('list', $tplRoleList);
 }
Пример #22
0
 public function __construct(OW_ActionController $controller)
 {
     parent::__construct('settings-form');
     $lang = OW::getLanguage();
     $newLogin = new CheckboxField('newLogin');
     $newLogin->setLabel($lang->text('femaleregonlymen', 'login_as_user'));
     $this->addElement($newLogin);
     $questionNameList = array('username', 'email', 'password', 'sex');
     $questionDtoList = BOL_QuestionService::getInstance()->findQuestionByNameList($questionNameList);
     $orderedQuestionList = array();
     $questionService = BOL_QuestionService::getInstance();
     $questionValueList = $questionService->findQuestionsValuesByQuestionNameList($questionNameList);
     foreach ($questionNameList as $questionName) {
         if (!empty($questionDtoList[$questionName])) {
             $orderedQuestionList[] = get_object_vars($questionDtoList[$questionName]);
         }
     }
     $this->addQuestions($orderedQuestionList, $questionValueList);
     $controller->assign('questions', $orderedQuestionList);
     $submit = new Submit('reg_fake');
     $submit->setValue($lang->text('femaleregonlymen', 'reg_fake'));
     $this->addElement($submit);
 }
Пример #23
0
 /**
  * @param string $formName
  * @param string $submitDecorator
  * @return Form
  */
 public function getSignInForm($formName = 'sign-in', $submitDecorator = 'button')
 {
     $form = new Form($formName);
     $username = new TextField('identity');
     $username->setRequired(true);
     $username->setHasInvitation(true);
     $username->setInvitation(OW::getLanguage()->text('base', 'component_sign_in_login_invitation'));
     $form->addElement($username);
     $password = new PasswordField('password');
     $password->setHasInvitation(true);
     $password->setInvitation('password');
     $password->setRequired(true);
     $form->addElement($password);
     $remeberMe = new CheckboxField('remember');
     $remeberMe->setLabel(OW::getLanguage()->text('base', 'sign_in_remember_me_label'));
     $remeberMe->setValue(true);
     $form->addElement($remeberMe);
     $submit = new Submit('submit', $submitDecorator);
     $submit->setValue(OW::getLanguage()->text('base', 'sign_in_submit_label'));
     $form->addElement($submit);
     return $form;
 }
Пример #24
0
 protected function initForm($controller)
 {
     $this->controller = $controller;
     $controller->assign('section_prefix', self::SECTION_TR_PREFIX);
     $controller->assign('question_prefix', self::QUESTION_TR_PREFIX);
     $questionService = BOL_QuestionService::getInstance();
     $this->setId('MainSearchForm');
     $submit = new Submit(self::SUBMIT_NAME);
     $submit->setValue(OW::getLanguage()->text('base', 'user_search_submit_button_label'));
     $this->addElement($submit);
     // get default question values
     $questionData = $this->getQuestionData();
     // prepare account types list
     $accountList = $this->getAccountTypes();
     $keys = array_keys($accountList);
     // get default account type
     $accountType = $keys[0];
     $matchSexValue = USEARCH_BOL_Service::getInstance()->getGenderByAccounType($accountType);
     if (isset($questionData['match_sex'])) {
         $aType = USEARCH_BOL_Service::getInstance()->getAccounTypeByGender($questionData['match_sex']);
         if (!empty($aType)) {
             $accountType = $aType;
             $matchSexValue = $questionData['match_sex'];
         }
     }
     //-- end --
     // get search question list
     $questions = $questionService->findSearchQuestionsForAccountType('all');
     // prepare questions list
     $this->mainSearchQuestionList = array();
     $questionNameList = array('sex' => 'sex', 'match_sex' => 'match_sex');
     $accounTypeToQuestionList = array();
     foreach ($questions as $key => $question) {
         $sectionName = $question['sectionName'];
         $questionNameList[] = $question['name'];
         $isRequired = in_array($question['name'], array('googlemap_location', 'match_sex')) ? 1 : 0;
         $questions[$key]['required'] = $isRequired;
         if ($question['name'] == 'sex' || $question['name'] == 'match_sex') {
             unset($questions[$key]);
         } else {
             $this->mainSearchQuestionList[$sectionName][] = $question;
         }
     }
     // -- end --
     $visibilityList = $this->getVisibilityList($accountType, $this->mainSearchQuestionList);
     $controller->assign('visibilityList', $visibilityList);
     // get question values list
     $questionValueList = $questionService->findQuestionsValuesByQuestionNameList($questionNameList);
     // prepare add sex and match sex questions
     $this->addGenderQuestions($controller, $accountList, $questionValueList, $questionData);
     $this->addQuestions($questions, $questionValueList, $questionData);
     $locationField = $this->getElement('googlemap_location');
     if ($locationField) {
         $value = $locationField->getValue();
         if (empty($value['json'])) {
             $locationField->setDistance(50);
         }
     }
     $controller->assign('questionList', $this->mainSearchQuestionList);
     // add 'online' field
     $onlineField = new CheckboxField('online');
     if (!empty($questionData) && is_array($questionData) && array_key_exists('online', $questionData)) {
         $onlineField->setValue($questionData['online']);
     }
     $onlineField->setLabel(OW::getLanguage()->text('usearch', 'online_only'));
     $this->addElement($onlineField);
     // add with photo field
     $withPhoto = new CheckboxField('with_photo');
     if (!empty($questionData) && is_array($questionData) && array_key_exists('with_photo', $questionData)) {
         $withPhoto->setValue($questionData['with_photo']);
     }
     $withPhoto->setLabel(OW::getLanguage()->text('usearch', 'with_photo'));
     $this->addElement($withPhoto);
     $this->addOnloadJs($matchSexValue, $visibilityList['sections']);
 }
Пример #25
0
 /**
  * Generates Add Topic Form.
  *
  * @param array $groupSelect
  * @param int $groupId
  * @return Form
  */
 private function generateForm($groupSelect, $groupId, $isHidden)
 {
     $form = new Form('add-topic-form');
     $form->setEnctype("multipart/form-data");
     $lang = OW::getLanguage();
     $title = new TextField('title');
     $title->setRequired(true);
     $sValidator = new StringValidator(1, 255);
     $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 255)));
     $title->addValidator($sValidator);
     $form->addElement($title);
     if ($isHidden) {
         $group = new HiddenField('group');
         $group->setValue($groupId);
     } else {
         $group = new ForumSelectBox('group');
         $group->setOptions($groupSelect);
         if ($groupId) {
             $group->setValue($groupId);
         }
         $group->setRequired(true);
         $group->addValidator(new IntValidator());
     }
     $form->addElement($group);
     $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML);
     $text = new WysiwygTextarea('text', $btnSet);
     $text->setRequired(true);
     $sValidator = new StringValidator(1, 50000);
     $sValidator->setErrorMessage($lang->text('forum', 'chars_limit_exceeded', array('limit' => 50000)));
     $text->addValidator($sValidator);
     $form->addElement($text);
     $subscribe = new CheckboxField('subscribe');
     $subscribe->setLabel($lang->text('forum', 'subscribe'));
     $subscribe->setValue(true);
     $form->addElement($subscribe);
     $post = new Submit('post');
     $post->setValue($lang->text('forum', 'add_post_btn'));
     $form->addElement($post);
     $attachmentField = new MultiFileField('attachments', 5);
     $form->addElement($attachmentField);
     $this->addForm($form);
     return $form;
 }
Пример #26
0
 public function photoCollectExtendedSettings(BASE_CLASS_EventCollector $event)
 {
     $input = new CheckboxField('matching_only');
     $input->setLabel(OW::getLanguage()->text('skadate', 'photo_setting_matching_label'));
     $input->setDescription(OW::getLanguage()->text('skadate', 'photo_setting_matching_desc'));
     $input->setValue((bool) OW::getConfig()->getValue('skadate', 'photo_filter_setting_matching'));
     $event->add(array('section' => 'filter_settings', 'section_lang' => 'skadate+photo_filter_section_label', 'settings' => array('matching_only' => $input)));
 }
Пример #27
0
 public function onPreferenceAddFormElement(BASE_CLASS_EventCollector $event)
 {
     $language = OW::getLanguage();
     $params = $event->getParams();
     $values = $params['values'];
     $fromElementList = array();
     $fromElement = new CheckboxField('mass_mailing_subscribe');
     $fromElement->setLabel($language->text('base', 'preference_mass_mailing_subscribe_label'));
     $fromElement->setDescription($language->text('base', 'preference_mass_mailing_subscribe_description'));
     if (isset($values['mass_mailing_subscribe'])) {
         $fromElement->setValue($values['mass_mailing_subscribe']);
     }
     $timeZoneSelect = new Selectbox("timeZoneSelect");
     $timeZoneSelect->setLabel($language->text('admin', 'timezone'));
     $timeZoneSelect->addOptions(UTIL_DateTime::getTimezones());
     $timeZoneSelect->setValue($values['timeZoneSelect']);
     $fromElementList[] = $timeZoneSelect;
     $fromElementList[] = $fromElement;
     $event->add($fromElementList);
 }
Пример #28
0
 public function __construct($entityType, $actions, $features, $info)
 {
     parent::__construct("HINT_ConfigurationForm");
     $language = OW::getLanguage();
     $this->actions = $actions;
     $this->entityType = $entityType;
     // Actions
     foreach ($actions as $action) {
         $field = new CheckboxField("action-" . $action["key"]);
         $field->setId("action-" . $action["key"]);
         $field->addAttribute("data-key", $action["key"]);
         $field->setValue($action["active"]);
         $field->setLabel($action["label"]);
         $field->addAttribute("class", "h-refresher");
         $this->addElement($field);
     }
     // Additional Features
     $field = new CheckboxField("uheader_enabled");
     $field->setId("feature_uheader");
     $field->setValue($features["cover"]);
     $field->addAttribute("class", "h-refresher");
     $field->addAttribute("data-key", "cover");
     $this->addElement($field);
     // User Information
     $line0Options = HINT_BOL_Service::getInstance()->getInfoLineSettings($entityType, HINT_BOL_Service::INFO_LINE0);
     $field = new Selectbox("info_" . HINT_BOL_Service::INFO_LINE0);
     $field->setId("info0");
     foreach ($line0Options as $lineOption) {
         $field->addOption($lineOption["key"], $lineOption["label"]);
     }
     if (!empty($info[HINT_BOL_Service::INFO_LINE0]["key"])) {
         $field->setValue($info[HINT_BOL_Service::INFO_LINE0]["key"]);
     }
     $this->addElement($field);
     $questions = $this->findQuestions();
     $questionOptions = array();
     foreach ($questions as $question) {
         $questionOptions[$question->name] = BOL_QuestionService::getInstance()->getQuestionLang($question->name);
     }
     $field = new Selectbox("info_" . HINT_BOL_Service::INFO_LINE0 . "_question");
     $field->setId("info0_q");
     $field->setOptions($questionOptions);
     if (!empty($info[HINT_BOL_Service::INFO_LINE0]["question"])) {
         $field->setValue($info[HINT_BOL_Service::INFO_LINE0]["question"]);
     }
     $this->addElement($field);
     $line1Options = HINT_BOL_Service::getInstance()->getInfoLineSettings($entityType, HINT_BOL_Service::INFO_LINE1);
     $field = new Selectbox("info_" . HINT_BOL_Service::INFO_LINE1);
     $field->setId("info1");
     foreach ($line1Options as $lineOption) {
         $field->addOption($lineOption["key"], $lineOption["label"]);
     }
     if (!empty($info[HINT_BOL_Service::INFO_LINE1]["key"])) {
         $field->setValue($info[HINT_BOL_Service::INFO_LINE1]["key"]);
     }
     $this->addElement($field);
     $field = new Selectbox("info_" . HINT_BOL_Service::INFO_LINE1 . "_question");
     $field->setId("info1_q");
     $field->setOptions($questionOptions);
     if (!empty($info[HINT_BOL_Service::INFO_LINE1]["question"])) {
         $field->setValue($info[HINT_BOL_Service::INFO_LINE1]["question"]);
     }
     $this->addElement($field);
     $line2Options = HINT_BOL_Service::getInstance()->getInfoLineSettings($entityType, HINT_BOL_Service::INFO_LINE2);
     $field = new Selectbox("info_" . HINT_BOL_Service::INFO_LINE2);
     $field->setId("info2");
     foreach ($line2Options as $lineOption) {
         $field->addOption($lineOption["key"], $lineOption["label"]);
     }
     if (!empty($info[HINT_BOL_Service::INFO_LINE2]["key"])) {
         $field->setValue($info[HINT_BOL_Service::INFO_LINE2]["key"]);
     }
     $this->addElement($field);
     $field = new Selectbox("info_" . HINT_BOL_Service::INFO_LINE2 . "_question");
     $field->setId("info2_q");
     $field->setOptions($questionOptions);
     if (!empty($info[HINT_BOL_Service::INFO_LINE2]["question"])) {
         $field->setValue($info[HINT_BOL_Service::INFO_LINE2]["question"]);
     }
     $this->addElement($field);
     // submit
     $submit = new Submit('save');
     $submit->setValue($language->text('hint', 'admin_save_btn'));
     $this->addElement($submit);
 }
Пример #29
0
 public function __construct($controller)
 {
     parent::__construct('QuickSearchForm');
     $this->questionService = BOL_QuestionService::getInstance();
     $this->searchService = USEARCH_BOL_Service::getInstance();
     $lang = OW::getLanguage();
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlForRoute('usearch.quick_search_action'));
     $this->setAjaxResetOnSuccess(false);
     $questionNameList = $this->searchService->getQuickSerchQuestionNames();
     $questionValueList = $this->questionService->findQuestionsValuesByQuestionNameList($questionNameList);
     $sessionData = OW::getSession()->get(self::FORM_SESSEION_VAR);
     if ($sessionData === null) {
         $sessionData = array();
         if (OW::getUser()->isAuthenticated()) {
             $data = BOL_QuestionService::getInstance()->getQuestionData(array(OW::getUser()->getId()), array('sex', 'match_sex'));
             if (!empty($data[OW::getUser()->getId()]['sex'])) {
                 $sessionData['sex'] = $data[OW::getUser()->getId()]['sex'];
             }
             if (!empty($data[OW::getUser()->getId()]['match_sex'])) {
                 for ($i = 0; $i < 31; $i++) {
                     if (pow(2, $i) & $data[OW::getUser()->getId()]['match_sex']) {
                         $sessionData['match_sex'] = pow(2, $i);
                         break;
                     }
                 }
             }
             $sessionData['googlemap_location']['distance'] = 50;
             OW::getSession()->set(self::FORM_SESSEION_VAR, $sessionData);
         }
     }
     if (!empty($sessionData['match_sex'])) {
         if (is_array($sessionData['match_sex'])) {
             $sessionData['match_sex'] = array_shift($sessionData['match_sex']);
         } else {
             for ($i = 0; $i < 31; $i++) {
                 if (pow(2, $i) & $sessionData['match_sex']) {
                     $sessionData['match_sex'] = pow(2, $i);
                     break;
                 }
             }
         }
     }
     /* ------------------------- */
     $questionDtoList = BOL_QuestionService::getInstance()->findQuestionByNameList($questionNameList);
     $questions = array();
     $questionList = array();
     $orderedQuestionList = array();
     /* @var $question BOL_Question */
     foreach ($questionDtoList as $key => $question) {
         $dataList = (array) $question;
         $questions[$question->name] = $dataList;
         $isRequired = in_array($question->name, array('googlemap_location', 'match_sex')) ? 1 : 0;
         $questions[$question->name]['required'] = $isRequired;
         if ($question->name == 'sex' || $question->name == 'match_sex') {
             unset($questions[$question->name]);
         } else {
             $questionList[$question->name] = $dataList;
         }
     }
     foreach ($questionNameList as $questionName) {
         if (!empty($questionDtoList[$questionName])) {
             $orderedQuestionList[] = $questionDtoList[$questionName];
         }
     }
     $controller->assign('displayGender', false);
     $accounts = $this->getAccountTypes();
     $this->addQuestions($questions, $questionValueList, array());
     $locationField = $this->getElement('googlemap_location');
     if ($locationField) {
         $value = $locationField->getValue();
         if (empty($value['distance'])) {
             $locationField->setDistance(50);
         }
     }
     if (count($accounts) > 1) {
         $this->displayAccountType = true;
         $controller->assign('displayGender', true);
         $sex = new Selectbox('sex');
         $sex->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('sex'));
         $sex->setHasInvitation(false);
         $sex->setRequired();
         //$accountType->setHasInvitation(false);
         $this->setFieldOptions($sex, 'sex', $questionValueList['sex']);
         if (!empty($sessionData['sex'])) {
             $sex->setValue($sessionData['sex']);
         }
         $this->addElement($sex);
         $matchSex = new Selectbox('match_sex');
         $matchSex->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('match_sex'));
         $matchSex->setRequired();
         $matchSex->setHasInvitation(false);
         //$accountType->setHasInvitation(false);
         $this->setFieldOptions($matchSex, 'match_sex', $questionValueList['sex']);
         if (!empty($sessionData['match_sex']) && !is_array($sessionData['match_sex'])) {
             $matchSex->setValue($sessionData['match_sex']);
         }
         $this->addElement($matchSex);
     }
     $controller->assign('questionList', $orderedQuestionList);
     $controller->assign('displayAccountType', $this->displayAccountType);
     // 'online' field
     $onlineField = new CheckboxField('online');
     if (is_array($sessionData) && array_key_exists('online', $sessionData)) {
         $onlineField->setValue((int) $sessionData['online']);
     }
     $onlineField->setLabel($lang->text('usearch', 'online_only'));
     $this->addElement($onlineField);
     //        if ( OW::getPluginManager()->isPluginActive('photo') )
     //        {
     // with photo
     $withPhoto = new CheckboxField('with_photo');
     if (is_array($sessionData) && array_key_exists('with_photo', $sessionData)) {
         $withPhoto->setValue((int) $sessionData['with_photo']);
     }
     $withPhoto->setLabel($lang->text('usearch', 'with_photo'));
     $this->addElement($withPhoto);
     //        }
     // submit
     $submit = new Submit('search');
     $submit->setValue(OW::getLanguage()->text('base', 'user_search_submit_button_label'));
     $this->addElement($submit);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n            if ( data.result ) {\n                document.location.href = data.url;\n            }\n            else {\n                OW.warning(data.error);\n            }\n        }");
 }
Пример #30
0
 public function slugs()
 {
     $language = OW::getLanguage();
     if (OW::getRequest()->isAjax() && OW::getRequest()->isPost()) {
         if (isset($_POST['plugins']) && is_array($_POST['plugins'])) {
             OW::getConfig()->saveConfig('oaseo', OASEO_BOL_Service::CNF_SLUG_PLUGINS, json_encode($_POST['plugins']));
         }
         if (isset($_POST['redirect'])) {
             OW::getConfig()->saveConfig('oaseo', OASEO_BOL_Service::CNF_SLUG_OLD_URLS_ENABLE, (bool) $_POST['redirect']);
         }
         if (isset($_POST['words'])) {
             OW::getConfig()->saveConfig('oaseo', OASEO_BOL_Service::CNF_SLUG_FILTER_COMMON_WORDS, json_encode(array_map('mb_strtolower', array_map('trim', explode(',', $_POST['words'])))));
         }
         exit(json_encode(array('message' => $language->text('oaseo', 'slugs_submit_message'))));
     }
     $data = $this->service->getSlugData();
     $pluginKeys = array_keys($data);
     $event = new BASE_CLASS_EventCollector('admin.add_auth_labels');
     OW::getEventManager()->trigger($event);
     $labelData = $event->getData();
     $dataLabels = empty($labelData) ? array() : call_user_func_array('array_merge', $labelData);
     $finalData = array();
     foreach ($dataLabels as $pluginKey => $pluginInfo) {
         if (in_array($pluginKey, $pluginKeys)) {
             $finalData[$pluginKey] = $pluginInfo['label'];
         }
     }
     $form = new Form('slugs_form');
     $form->setAjax();
     $form->setAjaxResetOnSuccess(false);
     $form->bindJsFunction(Form::BIND_SUCCESS, "function(data){OW.info(data.message);}");
     $plugins = new CheckboxGroup('plugins');
     $plugins->setLabel($language->text('oaseo', 'slug_plugins_label'));
     $plugins->setDescription($language->text('oaseo', 'slug_plugins_desc'));
     $plugins->setOptions($finalData);
     $plugins->setValue(json_decode(OW::getConfig()->getValue('oaseo', OASEO_BOL_Service::CNF_SLUG_PLUGINS), true));
     $form->addElement($plugins);
     $redirect = new CheckboxField('redirect');
     $redirect->setLabel($language->text('oaseo', 'slug_redirect_label'));
     $redirect->setDescription($language->text('oaseo', 'slug_redirect_desc'));
     $redirect->setValue(OW::getConfig()->getValue('oaseo', OASEO_BOL_Service::CNF_SLUG_OLD_URLS_ENABLE));
     $form->addElement($redirect);
     $words = new Textarea('words');
     $words->setLabel($language->text('oaseo', 'slug_words_label'));
     $words->setDescription($language->text('oaseo', 'slug_words_desc'));
     $wordsList = json_decode(OW::getConfig()->getValue('oaseo', OASEO_BOL_Service::CNF_SLUG_FILTER_COMMON_WORDS));
     if (is_array($wordsList)) {
         $valString = implode(', ', $wordsList);
     } else {
         $valString = '';
     }
     $words->setValue($valString);
     $form->addElement($words);
     $submit = new Submit('submit');
     $submit->setValue(OW::getLanguage()->text('admin', 'save_btn_label'));
     $form->addElement($submit);
     $this->addForm($form);
 }