public function index() { $language = OW::getLanguage(); $billingService = BOL_BillingService::getInstance(); $adminForm = new Form('adminForm'); $element = new TextField('creditValue'); $element->setRequired(true); $element->setLabel($language->text('billingcredits', 'admin_usd_credit_value')); $element->setDescription($language->text('billingcredits', 'admin_usd_credit_value_desc')); $element->setValue($billingService->getGatewayConfigValue('billingcredits', 'creditValue')); $validator = new FloatValidator(0.1); $validator->setErrorMessage($language->text('billingcredits', 'invalid_numeric_format')); $element->addValidator($validator); $adminForm->addElement($element); $element = new Submit('saveSettings'); $element->setValue($language->text('billingcredits', 'admin_save_settings')); $adminForm->addElement($element); if (OW::getRequest()->isPost()) { if ($adminForm->isValid($_POST)) { $values = $adminForm->getValues(); $billingService->setGatewayConfigValue('billingcredits', 'creditValue', $values['creditValue']); OW::getFeedback()->info($language->text('billingcredits', 'user_save_success')); } } $this->addForm($adminForm); $this->setPageHeading(OW::getLanguage()->text('billingcredits', 'config_page_heading')); $this->setPageTitle(OW::getLanguage()->text('billingcredits', 'config_page_heading')); $this->setPageHeadingIconClass('ow_ic_app'); }
public function settings() { $adminForm = new Form('adminForm'); $language = OW::getLanguage(); $config = OW::getConfig(); $element = new TextField('autoclick'); $element->setRequired(true); $validator = new IntValidator(1); $validator->setErrorMessage($language->text('autoviewmore', 'admin_invalid_number_error')); $element->addValidator($validator); $element->setLabel($language->text('autoviewmore', 'admin_auto_click')); $element->setValue($config->getValue('autoviewmore', 'autoclick')); $adminForm->addElement($element); $element = new Submit('saveSettings'); $element->setValue($language->text('autoviewmore', 'admin_save_settings')); $adminForm->addElement($element); if (OW::getRequest()->isPost()) { if ($adminForm->isValid($_POST)) { $values = $adminForm->getValues(); $config = OW::getConfig(); $config->saveConfig('autoviewmore', 'autoclick', $values['autoclick']); OW::getFeedback()->info($language->text('autoviewmore', 'user_save_success')); } } $this->addForm($adminForm); }
public function __construct($providerName) { parent::__construct('login-form'); $language = OW::getLanguage(); $this->setAction(""); $label = $language->text('yncontactimporter', 'login_email'); if ($providerName == 'hyves') { $label = $language->text('yncontactimporter', 'login_username'); } // email $email = new TextField('email'); $email->setLabel($label)->setRequired(true); $this->addElement($email); //pass $password = new PasswordField('password'); $password->setLabel($language->text('yncontactimporter', 'login_password'))->setRequired(true); $this->addElement($password); //providerName $hiddenProviderName = new HiddenField('providerName'); $hiddenProviderName->setValue($providerName); $this->addElement($hiddenProviderName); // button submit $submit = new Submit('submit'); $submit->setValue($language->text('yncontactimporter', 'submit_btn_label')); $this->addElement($submit); }
public function __construct() { parent::__construct('bookmarks_settings'); $language = OW::getLanguage(); $this->setAjax(); $this->setAjaxResetOnSuccess(FALSE); $this->setAction(OW::getRouter()->urlForRoute('bookmarks.admin')); $this->bindJsFunction('success', 'function() { OW.info("' . $language->text('bookmarks', 'settings_saved') . '"); }'); $notifyIntervalConfigVal = OW::getConfig()->getValue('bookmarks', 'notify_interval'); $notifyIntervalVal = array(0 => $language->text('bookmarks', 'remainderinterval_dont_send'), 10 => $language->text('bookmarks', 'remainderinterval_10'), 20 => $language->text('bookmarks', 'remainderinterval_20'), 30 => $language->text('bookmarks', 'remainderinterval_30')); $notifyInterval = new Selectbox('notify_interval'); $notifyInterval->addValidator(new BookmarkSelectboxValidator($notifyIntervalVal)); $notifyInterval->setOptions($notifyIntervalVal); $notifyInterval->setValue($notifyIntervalConfigVal); $notifyInterval->setLabel($language->text('bookmarks', 'notify_interval_label')); $notifyInterval->setDescription($language->text('bookmarks', 'notify_interval_desc')); $notifyInterval->setHasInvitation(FALSE); $this->addElement($notifyInterval); $submit = new Submit('save'); $submit->setValue($language->text('bookmarks', 'submit_label')); $this->addElement($submit); }
public function __construct() { parent::__construct('AddNewIp'); $submit = new Submit('add'); $submit->setValue(OW::getLanguage()->text('watchdog', 'form_btn_add_white_ip')); $this->addElement($submit); }
/** * Class constructor */ public function __construct($providerName) { parent::__construct('provider-config-form'); $this->setAjax(true); $this->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){OW.info(data.message);setTimeout(function(){location.reload();}, 1000);}else{OW.error(data.message);}}'); $this->setAction(OW::getRouter()->urlForRoute('ynsocialconnect-admin-ajaxUpdateProfileQuestion')); $language = OW::getLanguage(); $service = YNSOCIALCONNECT_BOL_ServicesService::getInstance(); $questionDtoList = $service->getOWQuestionDtoList($providerName); $aliases = $service->findAliasList($providerName); $options = $service->getServiceFields($providerName); foreach ($questionDtoList as $question) { $new_element = new Selectbox('alias[' . $question->name . ']'); foreach ($options as $option) { $new_element->addOption($option->name, $option->label); } $new_element->setValue(empty($aliases[$question->name]) ? '' : $aliases[$question->name]); $this->addElement($new_element); } $hidden = new TextField('providerName'); $hidden->addAttribute('type', 'hidden'); $hidden->setValue($providerName); $this->addElement($hidden); $submit = new Submit('edit'); $submit->setValue($language->text('ynsocialconnect', 'save_btn_label')); $this->addElement($submit); }
public function __construct($opponentId) { parent::__construct('composeMessageForm'); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); $field = new HiddenField('uid'); $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_new_message_' . $opponentId)); $this->addElement($field); $field = new HiddenField('opponentId'); $field->setValue($opponentId); $this->addElement($field); $field = new TextField('subject'); $field->setInvitation(OW::getLanguage()->text('mailbox', 'subject')); $field->setHasInvitation(true); $field->setRequired(); $this->addElement($field); $field = new Textarea('message'); $field->setInvitation(OW::getLanguage()->text('mailbox', 'text_message_invitation')); $field->setHasInvitation(true); $field->setRequired(); $this->addElement($field); $field = new HiddenField('attachment'); $this->addElement($field); $submit = new Submit('sendBtn'); $submit->setId('sendBtn'); $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button')); $this->addElement($submit); if (!OW::getRequest()->isAjax()) { $js = UTIL_JsGenerator::composeJsString(' owForms["composeMessageForm"].bind( "submit", function( r ) { $("#newmessage-mail-send-btn").addClass("owm_preloader_circle"); });'); OW::getDocument()->addOnloadScript($js); } }
/** * 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); }
/** * Class constructor * */ public function __construct($plugins) { parent::__construct('configForm'); $language = OW::getLanguage(); $values = OW::getConfig()->getValues('attachments'); if ($plugins['video']) { $field = new CheckboxField('video_share'); $field->setValue($values['video_share']); $this->addElement($field); } if ($plugins['links']) { $field = new CheckboxField('link_share'); $field->setValue($values['link_share']); $this->addElement($field); } if ($plugins['photo']) { $field = new CheckboxField('photo_share'); $field->setId('photo_share_check'); $field->setValue($values['photo_share']); $this->addElement($field); $field = new TextField('photo_album_name'); $field->setValue(OW::getLanguage()->text('attachments', 'default_photo_album_name')); $field->setRequired(); $this->addElement($field); } // submit $submit = new Submit('save'); $submit->setValue($language->text('attachments', 'config_save_label')); $this->addElement($submit); }
public function __construct() { parent::__construct('payeer-config-form'); $language = OW::getLanguage(); $billingService = BOL_BillingService::getInstance(); $gwKey = BILLINGPAYEER_CLASS_PayeerAdapter::GATEWAY_KEY; $element = new TextField('m_key'); $element->setValue($billingService->getGatewayConfigValue($gwKey, 'm_key')); $this->addElement($element); $element = new TextField('m_shop'); $element->setValue($billingService->getGatewayConfigValue($gwKey, 'm_shop')); $this->addElement($element); $element = new Selectbox('m_curr'); $element->setValue($billingService->getGatewayConfigValue($gwKey, 'm_curr'))->setHasInvitation(false)->addOption('RUB', 'RUB')->addOption('usd', 'USD'); $this->addElement($element); $element = new Selectbox('lang'); $element->setValue($billingService->getGatewayConfigValue($gwKey, 'lang'))->setHasInvitation(false)->addOption('ru', 'Русский')->addOption('en', 'English'); $this->addElement($element); $element = new Selectbox('tabNum'); $element->setValue($billingService->getGatewayConfigValue($gwKey, 'tabNum'))->setHasInvitation(false)->addOption('1', 'Electronic Systems')->addOption('2', 'Cash / Bank Transfers')->addOption('3', 'Terminals')->addOption('4', 'SMS payments'); $this->addElement($element); // submit $submit = new Submit('save'); $submit->setValue($language->text('billingpayeer', 'btn_save')); $this->addElement($submit); }
public function testCompile() { $field = new Submit("test", "Test"); $expected = "<input type=\"submit\" name=\"test\" value=\"Test\" />"; $value = $field->compile(); $this->assertEquals($expected, $value); }
public function __construct() { parent::__construct('settingsForm'); $themes = new Selectbox('themeList'); $themes->setRequired(); $themes->setLabel(OW::getLanguage()->text('profileprogressbar', 'theme_label')); $plugin = OW::getPluginManager()->getPlugin('profileprogressbar'); $dirIterator = new RecursiveDirectoryIterator($plugin->getStaticDir() . 'css' . DS); $interator = new RecursiveIteratorIterator($dirIterator); $themesList = array(); foreach ($interator as $file) { if ($file->getFilename() == '.') { continue; } if (!$file->isDir() && pathinfo($file->getPathname(), PATHINFO_EXTENSION) == 'css') { $themeName = substr($file->getFilename(), 0, strrpos($file->getFilename(), '.')); if (file_exists($plugin->getStaticDir() . 'img' . DS . $themeName . DS . 'background.png') && file_exists($plugin->getStaticDir() . 'img' . DS . $themeName . DS . 'complete.png')) { $themesList[$themeName] = ucfirst($themeName); } } } asort($themesList); $themes->setOptions($themesList); $themes->setValue(OW::getConfig()->getValue('profileprogressbar', 'theme')); $this->addElement($themes); $validator = new SelectboxValidator($themesList); $themes->addValidator($validator); $submit = new Submit('save'); $submit->setValue(OW::getLanguage()->text('profileprogressbar', 'save_settings')); $this->addElement($submit); }
public function __construct($userId) { parent::__construct(); $data = OW::getEventManager()->call("photo.entity_albums_find", array("entityType" => "user", "entityId" => $userId)); $albums = empty($data["albums"]) ? array() : $data["albums"]; $source = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_source", $userId); $this->assign("source", $source == "album" ? "album" : "all"); $selectedAlbum = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_album", $userId); $form = new Form("pcGallerySettings"); $form->setEmptyElementsErrorMessage(null); $form->setAction(OW::getRouter()->urlFor("PCGALLERY_CTRL_Gallery", "saveSettings")); $element = new HiddenField("userId"); $element->setValue($userId); $form->addElement($element); $element = new Selectbox("album"); $element->setHasInvitation(true); $element->setInvitation(OW::getLanguage()->text("pcgallery", "settings_album_invitation")); $validator = new PCGALLERY_AlbumValidator(); $element->addValidator($validator); $albumsPhotoCount = array(); foreach ($albums as $album) { $element->addOption($album["id"], $album["name"] . " ({$album["photoCount"]})"); $albumsPhotoCount[$album["id"]] = $album["photoCount"]; if ($album["id"] == $selectedAlbum) { $element->setValue($album["id"]); } } OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('window.pcgallery_settingsAlbumCounts = {$albumsCount};', array("albumsCount" => $albumsPhotoCount))); $element->setLabel(OW::getLanguage()->text("pcgallery", "source_album_label")); $form->addElement($element); $submit = new Submit("save"); $submit->setValue(OW::getLanguage()->text("pcgallery", "save_settings_btn_label")); $form->addElement($submit); $this->addForm($form); }
public function index() { $groups = MODERATION_BOL_Service::getInstance()->getContentGroups(); if (OW::getRequest()->isPost()) { $selectedGroups = empty($_POST["groups"]) ? array() : $_POST["groups"]; $types = array(); foreach ($groups as $group) { $selected = in_array($group["name"], $selectedGroups); foreach ($group["entityTypes"] as $type) { $types[$type] = $selected; } } OW::getConfig()->saveConfig("moderation", "content_types", json_encode($types)); OW::getFeedback()->info(OW::getLanguage()->text("moderation", "content_types_saved_message")); $this->redirect(OW::getRouter()->urlForRoute("moderation.admin")); } $this->setPageHeading(OW::getLanguage()->text("moderation", "admin_heading")); $this->setPageTitle(OW::getLanguage()->text("moderation", "admin_title")); $form = new Form("contentTypes"); $submit = new Submit("save"); $submit->setLabel(OW::getLanguage()->text("admin", "save_btn_label")); $form->addElement($submit); $this->addForm($form); $this->assign("groups", $groups); }
public function __construct($ctrl) { parent::__construct('settings-form'); $configs = OW::getConfig()->getValues('yncontactimporter'); $ctrl->assign('configs', $configs); $l = OW::getLanguage(); $miValidator = new IntValidator(1, 999); $miValidator->setErrorMessage($l->text('yncontactimporter', 'max_validation_error', array('min' => 1, 'max' => 999))); //Contacts per page $textField['contact_per_page'] = new TextField('contact_per_page'); $textField['contact_per_page']->setLabel($l->text('yncontactimporter', 'settings_contact_per_page'))->setValue($configs['contact_per_page'])->addValidator($miValidator)->setRequired(true); $this->addElement($textField['contact_per_page']); //Maximum invite per times $textField['max_invite_per_times'] = new TextField('max_invite_per_times'); $textField['max_invite_per_times']->setLabel($l->text('yncontactimporter', 'settings_max_invite_per_times'))->setValue($configs['max_invite_per_times'])->addValidator($miValidator)->setRequired(true); $this->addElement($textField['max_invite_per_times']); //Default invite message $textField['default_invite_message'] = new Textarea('default_invite_message'); $textField['default_invite_message']->setLabel($l->text('yncontactimporter', 'settings_default_invite_message'))->setValue($configs['default_invite_message']); $this->addElement($textField['default_invite_message']); // Logo width $textField['logo_width'] = new TextField('logo_width'); $textField['logo_width']->setLabel($l->text('yncontactimporter', 'settings_logo_width'))->setValue($configs['logo_width'])->addValidator($miValidator)->setRequired(true); $this->addElement($textField['logo_width']); // Logo Height $textField['logo_height'] = new TextField('logo_height'); $textField['logo_height']->setLabel($l->text('yncontactimporter', 'settings_logo_height'))->setValue($configs['logo_height'])->addValidator($miValidator)->setRequired(true); $this->addElement($textField['logo_height']); $submit = new Submit('submit'); $submit->setValue($l->text('yncontactimporter', 'save_btn_label')); $submit->addAttribute('class', 'ow_ic_save ow_positive'); $this->addElement($submit); }
/** * 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); }
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); }
/** * Class constructor * */ public function __construct() { parent::__construct('configSaveForm'); $language = OW::getLanguage(); $configs = OW::getConfig()->getValues('googlelocation'); $element = new TextField('api_key'); $element->setValue($configs['api_key']); $validator = new StringValidator(0, 40); $validator->setErrorMessage($language->text('googlelocation', 'api_key_too_long')); $element->addValidator($validator); $this->addElement($element); $options = array(GOOGLELOCATION_BOL_LocationService::DISTANCE_UNITS_MILES => $language->text('googlelocation', 'miles'), GOOGLELOCATION_BOL_LocationService::DISTANCE_UNITS_KM => $language->text('googlelocation', 'kms')); $distanseUnits = new Selectbox('distanse_units'); $distanseUnits->setOptions($options); $distanseUnits->setValue(GOOGLELOCATION_BOL_LocationService::getInstance()->getDistanseUnits()); $distanseUnits->setHasInvitation(false); $this->addElement($distanseUnits); $restrictions = new Selectbox('country_restriction'); $restrictions->setValue(!empty($configs['country_restriction']) ? $configs['country_restriction'] : null); $restrictions->setOptions($this->countryList); $restrictions->setInvitation(OW::getLanguage()->text('googlelocation', 'no_country_restriction')); $this->addElement($restrictions); $autofill = OW::getConfig()->getValue('googlelocation', 'auto_fill_location_on_search'); $autoFillLocationOnSearch = new CheckboxField('auto_fill_location_on_search'); $autoFillLocationOnSearch->setValue(empty($autofill) || $autofill == '0' ? false : $autofill); $this->addElement($autoFillLocationOnSearch); // submit $submit = new Submit('save'); $submit->setValue($language->text('base', 'edit_button')); $this->addElement($submit); }
public function __construct() { parent::__construct('upload-form'); $language = OW::getLanguage(); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); $fileField = new FileField('photo'); //$fileField->setRequired(true); $this->addElement($fileField); // album Field $albumField = new TextField('album'); $albumField->setRequired(true); $albumField->setHasInvitation(true); $albumField->setId('album_input'); $albumField->setInvitation($language->text('photo', 'create_album')); $this->addElement($albumField); // description Field $descField = new Textarea('description'); $descField->setHasInvitation(true); $descField->setInvitation($language->text('photo', 'describe_photo')); $this->addElement($descField); $cancel = new Submit('cancel', false); $cancel->setValue($language->text('base', 'cancel_button')); $this->addElement($cancel); $submit = new Submit('submit', false); $this->addElement($submit); }
public function __construct($name) { parent::__construct($name); $this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_signup')); $this->setAjax(); $lang = OW::getLanguage(); $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->setRequired(true); $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); if (OW::getConfig()->getValue('ocsaffiliates', 'terms_agreement')) { $terms = new CheckboxField('terms'); $validator = new RequiredValidator(); $validator->setErrorMessage($lang->text('ocsaffiliates', 'terms_required_msg')); $terms->addValidator($validator); $this->addElement($terms); } $submit = new Submit('signup'); $submit->setValue($lang->text('ocsaffiliates', 'signup_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 }"); }
public function __construct(BASE_CommentsParams $params, $id, $formName) { parent::__construct(); $language = OW::getLanguage(); $form = new Form($formName); $textArea = new Textarea('commentText'); $textArea->setHasInvitation(true); $textArea->setInvitation($language->text('base', 'comment_form_element_invitation_text')); $form->addElement($textArea); $hiddenEls = array('entityType' => $params->getEntityType(), 'entityId' => $params->getEntityId(), 'displayType' => $params->getDisplayType(), 'pluginKey' => $params->getPluginKey(), 'ownerId' => $params->getOwnerId(), 'cid' => $id, 'commentCountOnPage' => $params->getCommentCountOnPage(), 'isMobile' => 1); foreach ($hiddenEls as $name => $value) { $el = new HiddenField($name); $el->setValue($value); $form->addElement($el); } $submit = new Submit('comment-submit'); $submit->setValue($language->text('base', 'comment_add_submit_label')); $form->addElement($submit); $form->setAjax(true); $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment')); // $form->bindJsFunction(Form::BIND_SUBMIT, "function(){ $('#comments-" . $id . " .comments-preloader').show();}"); // $form->bindJsFunction(Form::BIND_SUCCESS, "function(){ $('#comments-" . $id . " .comments-preloader').hide();}"); $this->addForm($form); OW::getDocument()->addOnloadScript("window.owCommentCmps['{$id}'].initForm('" . $textArea->getId() . "', '" . $submit->getId() . "');"); $this->assign('form', true); $this->assign('id', $id); }
public function __construct() { parent::__construct('FindWhiteIp'); $submit = new Submit('search'); $submit->setValue(OW::getLanguage()->text('watchdog', 'search')); $this->addElement($submit); }
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')); }
/** * 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')); }
/** * 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); }
public function __construct($conversationId, $opponentId) { parent::__construct('newMailMessageForm'); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); $field = new TextField('newMessageText'); $field->setValue(OW::getLanguage()->text('mailbox', 'text_message_invitation')); $field->setId('newMessageText'); $this->addElement($field); $field = new HiddenField('attachment'); $this->addElement($field); $field = new HiddenField('conversationId'); $field->setValue($conversationId); $this->addElement($field); $field = new HiddenField('opponentId'); $field->setValue($opponentId); $this->addElement($field); $field = new HiddenField('uid'); $field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId)); $this->addElement($field); $submit = new Submit('newMessageSendBtn'); $submit->setId('newMessageSendBtn'); $submit->setName('newMessageSendBtn'); $submit->setValue(OW::getLanguage()->text('mailbox', 'add_button')); $this->addElement($submit); if (!OW::getRequest()->isAjax()) { $js = UTIL_JsGenerator::composeJsString(' owForms["newMailMessageForm"].bind( "submit", function( r ) { $("#newmessage-mail-send-btn").addClass("owm_preloader_circle"); });'); OW::getDocument()->addOnloadScript($js); } $this->setAction(OW::getRouter()->urlFor('MAILBOX_MCTRL_Messages', 'newmessage')); }
public function __construct() { parent::__construct('set-credits-form'); $this->setAjax(true); $this->setAction(OW::getRouter()->urlFor('USERCREDITS_CTRL_Ajax', 'setCredits')); $lang = OW::getLanguage(); $userIdField = new HiddenField('userId'); $userIdField->setRequired(true); $this->addElement($userIdField); $balance = new TextField('balance'); $this->addElement($balance); $submit = new Submit('save'); $submit->setValue($lang->text('base', 'edit_button')); $this->addElement($submit); $js = 'owForms["' . $this->getName() . '"].bind("success", function(data){ if ( data.error ){ OW.error(data.error); } if ( data.message ) { OW.info(data.message); } _scope.floatBox && _scope.floatBox.close(); _scope.callBack && _scope.callBack(data); });'; OW::getDocument()->addOnloadScript($js); }
public function index($params = array()) { $userService = BOL_UserService::getInstance(); $language = OW::getLanguage(); $this->setPageHeading($language->text('hotlist', 'admin_heading_settings')); $this->setPageHeadingIconClass('ow_ic_gear_wheel'); $settingsForm = new Form('settingsForm'); $settingsForm->setId('settingsForm'); $expiration_time = new TextField('expiration_time'); $expiration_time->setRequired(); $expiration_time->setLabel($language->text('hotlist', 'label_expiration_time')); $expiration_time_value = (int) OW::getConfig()->getValue('hotlist', 'expiration_time') / 86400; $expiration_time->setValue($expiration_time_value); $settingsForm->addElement($expiration_time); $submit = new Submit('save'); $submit->addAttribute('class', 'ow_ic_save'); $submit->setValue($language->text('hotlist', 'label_save_btn_label')); $settingsForm->addElement($submit); $this->addForm($settingsForm); if (OW::getRequest()->isPost()) { if ($settingsForm->isValid($_POST)) { $data = $settingsForm->getValues(); OW::getConfig()->saveConfig('hotlist', 'expiration_time', $data['expiration_time'] * 86400); OW::getFeedback()->info($language->text('hotlist', 'settings_saved')); $this->redirect(); } } }
public function __construct() { parent::__construct('MATCHMAKING_PreferencesForm'); $this->questionService = BOL_QuestionService::getInstance(); $language = OW::getLanguage(); $save = new Submit('save'); $save->setValue($language->text('matchmaking', 'btn_label_save')); $this->addElement($save); }
public function file($params) { $page = empty($_GET['page']) ? 1 : $_GET['page']; $rpp = 5; $first = ($page - 1) * $rpp; $count = $rpp; if (empty($params) && !isset($params['fileId'])) { throw new Redirect404Exception(); } if (!stripos($params['fileId'], "-")) { throw new Redirect404Exception(); } $check = $params['fileId']; $params['fileId'] = substr($params['fileId'], 0, stripos($params['fileId'], "-")); $file = SPDOWNLOAD_BOL_FileService::getInstance()->getFileId($params['fileId']); if ($file->id . '-' . $file->slug != $check) { throw new Redirect404Exception(); } $arrayCheckCategory = array(); $CategoryIdList = SPDOWNLOAD_BOL_FileCategoryService::getInstance()->getCategoryId($params['fileId']); foreach ($CategoryIdList as $key => $value) { array_push($arrayCheckCategory, $value->categoryId); } $cmpCategories = new SPDOWNLOAD_CMP_Category(false, $arrayCheckCategory); $this->addComponent('cmpCategories', $cmpCategories); $versions = SPDOWNLOAD_BOL_VersionService::getInstance()->getVersionList($params['fileId'], $first, $rpp); foreach ($versions as $key => $value) { $value->addedTime = date("Y-m-d H:i:s", $value->addedTime); $value->size = $this->splitFilesize($value->size); } $itemCount = SPDOWNLOAD_BOL_VersionService::getInstance()->getcountVersion($params['fileId']); $pageCount = ceil($itemCount / $rpp); $this->addComponent('paging', new BASE_CMP_Paging($page, $pageCount, 5)); $url = OW::getPluginManager()->getPlugin('spdownload')->getUserFilesUrl(); $nameImage = 'icon_large_' . $file->id . '.png'; $file->icon = $url . $nameImage; $urlBack = OW::getRouter()->urlForRoute('spdownload.up_myfile', array('userId' => OW::getUser()->getId())); $this->assign('urlBack', $urlBack); $this->assign('versions', $versions); $this->assign('file', $file); $form = new Form('delete_file'); $this->addForm($form); $submit = new Submit('delete'); $submit->setValue(OW::getLanguage()->text('spdownload', 'delete-file-yes')); $form->addElement($submit); if (OW::getRequest()->isPost()) { if ($form->isValid($_POST)) { SPDOWNLOAD_BOL_FileThumbService::getInstance()->deleteIdThumb($params['fileId']); SPDOWNLOAD_BOL_FileCategoryService::getInstance()->deleteId($params); SPDOWNLOAD_BOL_VersionService::getInstance()->deleteIdVer($params['fileId']); SPDOWNLOAD_BOL_FileService::getInstance()->deleteIdFile($params['fileId']); $this->redirect(OW::getRouter()->urlForRoute('spdownload.up_myfile', array('userId' => OW::getUser()->getId()))); } } }