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')); }
public function __construct($layout, $params) { parent::__construct(); if (empty($params['available'])) { if (!empty($params['msg'])) { $msg = $params['msg']; } else { $msg = OW::getLanguage()->text('base', 'authorization_failed_feedback'); } $this->assign('authError', $msg); return; } switch ($layout) { case 'page': $class = ' ow_photoview_info_onpage'; break; default: if ((bool) OW::getConfig()->getValue('photo', 'photo_view_classic')) { $class = ' ow_photoview_pint_mode'; } else { $class = ''; } break; } $this->assign('class', $class); $this->assign('layout', $layout); }
public static function process($prefix, $key) { $languageService = BOL_LanguageService::getInstance(); $list = $languageService->findActiveList(); $currentLanguageId = OW::getLanguage()->getCurrentId(); $currentLangValue = ""; foreach ($list as $item) { $keyDto = $languageService->findKey($prefix, $key); if (empty($keyDto)) { $prefixDto = $languageService->findPrefix($prefix); $keyDto = $languageService->addKey($prefixDto->getId(), $key); } $value = trim($_POST['lang'][$item->getId()][$prefix][$key]); if (mb_strlen(trim($value)) == 0 || $value == json_decode('"\\u00a0"')) { $value = ' '; } $dto = $languageService->findValue($item->getId(), $keyDto->getId()); if ($dto !== null) { $event = new OW_Event('admin.before_save_lang_value', array('dto' => $dto)); OW::getEventManager()->trigger($event); if ($dto->getValue() !== $value) { $languageService->saveValue($dto->setValue($value)); } } else { $dto = $languageService->addValue($item->getId(), $prefix, $key, $value); } if ((int) $currentLanguageId === (int) $item->getId()) { $currentLangValue = $value; } } exit(json_encode(array('result' => 'success', 'prefix' => $prefix, 'key' => $key, 'value' => $currentLangValue))); }
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($plugins) { parent::__construct('configForm'); $language = OW::getLanguage(); $values = OW::getConfig()->getValues('uheader'); 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('uheader', 'default_photo_album_name')); $field->setRequired(); $this->addElement($field); } $field = new TextField('cover_height'); $field->setValue($values['cover_height']); $field->addValidator(new IntValidator(self::COVER_MIN_HEIGHT, self::COVER_MAX_HEIGHT)); $field->setRequired(); $this->addElement($field); // submit $submit = new Submit('save'); $submit->setValue($language->text('uheader', 'config_save_label')); $this->addElement($submit); }
public function getUploadErrorMessage($errorCode) { $message = ''; if (!isset($errorCode)) { return false; } $language = OW::getLanguage(); if ($errorCode != UPLOAD_ERR_OK) { switch ($errorCode) { case UPLOAD_ERR_INI_SIZE: $message = $language->text('base', 'upload_file_max_upload_filesize_error'); break; case UPLOAD_ERR_PARTIAL: $message = $language->text('base', 'upload_file_file_partially_uploaded_error'); break; case UPLOAD_ERR_NO_FILE: $message = $language->text('base', 'upload_file_no_file_error'); break; case UPLOAD_ERR_NO_TMP_DIR: $error = $language->text('base', 'upload_file_no_tmp_dir_error'); $message; case UPLOAD_ERR_CANT_WRITE: $message = $language->text('base', 'upload_file_cant_write_file_error'); break; case UPLOAD_ERR_EXTENSION: $message = $language->text('base', 'upload_file_invalid_extention_error'); break; default: $message = $language->text('base', 'upload_file_fail'); } } return $message; }
public function setCustomMetaInfo() { OW::getDocument()->setDescription(null); if (OW::getLanguage()->valueExist('base', "local_page_meta_tags_{$this->getDocumentKey()}")) { OW::getDocument()->addCustomHeadInfo(OW::getLanguage()->text('base', "local_page_meta_tags_{$this->getDocumentKey()}")); } }
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() { parent::__construct('FindWhiteIp'); $submit = new Submit('search'); $submit->setValue(OW::getLanguage()->text('watchdog', 'search')); $this->addElement($submit); }
function payeer_add_admin_notification(BASE_CLASS_EventCollector $coll) { $billingService = BOL_BillingService::getInstance(); if (!mb_strlen($billingService->getGatewayConfigValue(BILLINGPAYEER_CLASS_PayeerAdapter::GATEWAY_KEY, 'm_key')) && !mb_strlen($billingService->getGatewayConfigValue(BILLINGPAYEER_CLASS_PayeerAdapter::GATEWAY_KEY, 'm_shop'))) { $coll->add(OW::getLanguage()->text('billingpayeer', 'plugin_configuration_notice', array('url' => OW::getRouter()->urlForRoute('billing_payeer_admin')))); } }
public function __construct() { parent::__construct('add-album'); $this->setAjax(); $this->setAjaxResetOnSuccess(FALSE); $this->setAction(OW::getRouter()->urlFor('PHOTO_CTRL_Photo', 'ajaxResponder')); $ajaxFunc = new HiddenField('ajaxFunc'); $ajaxFunc->setValue('ajaxMoveToAlbum'); $ajaxFunc->setRequired(); $this->addElement($ajaxFunc); $fromAlbum = new HiddenField('from-album'); $fromAlbum->setRequired(); $fromAlbum->addValidator(new PHOTO_CLASS_AlbumOwnerValidator()); $this->addElement($fromAlbum); $toAlbum = new HiddenField('to-album'); $this->addElement($toAlbum); $photos = new HiddenField('photos'); $photos->setRequired(); $this->albumPhotosValidator = new AlbumPhotosValidator(); $photos->addValidator($this->albumPhotosValidator); $this->addElement($photos); $albumName = new TextField('album-name'); $albumName->setRequired(); $albumName->addValidator(new PHOTO_CLASS_AlbumNameValidator(FALSE)); $albumName->setHasInvitation(TRUE); $albumName->setInvitation(OW::getLanguage()->text('photo', 'album_name')); $albumName->addAttribute('class', 'ow_smallmargin'); $this->addElement($albumName); $desc = new Textarea('desc'); $desc->setHasInvitation(TRUE); $desc->setInvitation(OW::getLanguage()->text('photo', 'album_desc')); $this->addElement($desc); $this->addElement(new Submit('add')); }
/** * Constructor. */ public function __construct() { parent::__construct(); if (!OW::getUser()->isAdmin()) { throw new AuthenticateException(); } if (!OW::getRequest()->isAjax()) { $document = OW::getDocument(); $document->setMasterPage(new ADMIN_CLASS_MasterPage()); $this->setPageTitle(OW::getLanguage()->text('admin', 'page_default_title')); } BOL_PluginService::getInstance()->checkManualUpdates(); $plugin = BOL_PluginService::getInstance()->findNextManualUpdatePlugin(); $handlerParams = OW::getRequestHandler()->getHandlerAttributes(); // TODO refactor shortcut below if (!defined('OW_PLUGIN_XP') && $plugin !== null) { if ($handlerParams['controller'] === 'ADMIN_CTRL_Plugins' && $handlerParams['action'] === 'manualUpdateRequest') { //action } else { throw new RedirectException(OW::getRouter()->urlFor('ADMIN_CTRL_Plugins', 'manualUpdateRequest', array('key' => $plugin->getKey()))); } } // TODO temp admin pge inform event function admin_check_if_admin_page() { return true; } OW::getEventManager()->bind('admin.check_if_admin_page', 'admin_check_if_admin_page'); }
/** * 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')); }
public function __construct($data) { $script = UTIL_JsGenerator::composeJsString(' OWM.bind("mailbox.ready", function(readyStatus){ if (readyStatus == 2){ OWM.conversation = new MAILBOX_Conversation({$params}); OWM.conversationView = new MAILBOX_MailConversationView({model: OWM.conversation}); } }); ', array('params' => $data)); OW::getDocument()->addOnloadScript($script); OW::getLanguage()->addKeyForJs('mailbox', 'text_message_invitation'); $form = new MAILBOX_MCLASS_NewMailMessageForm($data['conversationId'], $data['opponentId']); $this->addForm($form); $this->assign('data', $data); $this->assign('defaultAvatarUrl', BOL_AvatarService::getInstance()->getDefaultAvatarUrl()); $firstMessage = MAILBOX_BOL_ConversationService::getInstance()->getFirstMessage($data['conversationId']); if (empty($firstMessage)) { $actionName = 'send_message'; } else { $actionName = 'reply_to_message'; } $isAuthorized = OW::getUser()->isAuthorized('mailbox', $actionName); if (!$isAuthorized) { $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', $actionName); if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) { $this->assign('sendAuthMessage', $status['msg']); } elseif ($status['status'] != BOL_AuthorizationService::STATUS_AVAILABLE) { $this->assign('sendAuthMessage', OW::getLanguage()->text('mailbox', $actionName . '_permission_denied')); } } }
/** * 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(array $aParams) { parent::__construct(); //print_r($aParams); exit; foreach ($aParams['items'] as $k => $v) { $aParams['items'][$k]['media_parent'] = isset($aParams['items'][$k]['media_parent']) ? $aParams['items'][$k]['media_parent'] : ''; $aParams['items'][$k]['title_decode'] = urldecode($aParams['items'][$k]['title']); $aParams['items'][$k]['update_page_param'] = http_build_query(array('service' => $aParams['items'][$k]['provider'], 'media' => 'photo', 'media_parent' => $aParams['items'][$k]['media_parent'], 'extra' => 'aid', 'aid' => $aParams['items'][$k]['aid'])); //$aParams['items'][$k]['brief_title'] = substr($aParams['items'][$k]['title_decode'], 0, 20); $aParams['items'][$k]['status_text'] = OW::getLanguage()->text("ynmediaimporter", 'import_status_' . $aParams['items'][$k]['status']); $aParams['items'][$k]['json'] = json_encode($aParams['items'][$k]); } //print_r($aParams); exit; if (isset($aParams['items'])) { $this->assign('items', $aParams['items']); } if (isset($aParams['params'])) { $this->assign('params', $aParams['params']); $this->assign('params_json', json_encode($aParams['params'])); } if (isset($aParams['item_count'])) { $this->assign('item_count', $aParams['item_count']); } if (isset($aParams['userId'])) { $this->assign('userId', $aParams['userId']); } }
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); }
function smarty_function_text_edit($params, $smarty) { $key = $params['key']; unset($params['key']); $key = explode('+', $key); if (empty($key[0]) || empty($key[1])) { return '_INVALID_KEY_'; } $prefix = $key[0]; $key = $key[1]; $text = OW::getLanguage()->text($prefix, $key, $params); $keyDto = BOL_LanguageService::getInstance()->findKey($prefix, $key); if (!$keyDto) { return '<span class="ow_red">' . $text . '</span>'; } $script = '$("a.ow_text_edit").click(function(){ var self=$(this), lang = this.rel.split("+"); OW.editLanguageKey(lang[0],lang[1], function(e){ self.text(e.value); }); });'; OW::getDocument()->addOnloadScript($script); $rel = json_encode($prefix . '+' . $key); return '<a href="javascript://" rel=' . $rel . ' class="ow_text_edit">' . $text . '</a>'; }
/** * 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); }
/** * @return Constructor. */ public function __construct($groupId) { parent::__construct(); $service = GROUPS_BOL_Service::getInstance(); $groupDto = $service->findGroupById($groupId); $group = array('title' => htmlspecialchars($groupDto->title), 'description' => $groupDto->description, 'time' => $groupDto->timeStamp, 'imgUrl' => empty($groupDto->imageHash) ? false : $service->getGroupImageUrl($groupDto), 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $groupDto->id)), "id" => $groupDto->id); $imageUrl = empty($groupDto->imageHash) ? '' : $service->getGroupImageUrl($groupDto); OW::getDocument()->addMetaInfo('image', $imageUrl, 'itemprop'); OW::getDocument()->addMetaInfo('og:image', $imageUrl, 'property'); $createDate = UTIL_DateTime::formatDate($groupDto->timeStamp); $adminName = BOL_UserService::getInstance()->getDisplayName($groupDto->userId); $adminUrl = BOL_UserService::getInstance()->getUserUrl($groupDto->userId); $js = UTIL_JsGenerator::newInstance()->jQueryEvent('#groups_toolbar_flag', 'click', UTIL_JsGenerator::composeJsString('OW.flagContent({$entity}, {$id}, {$title}, {$href}, "groups+flags", {$ownerId});', array('entity' => GROUPS_BOL_Service::WIDGET_PANEL_NAME, 'id' => $groupDto->id, 'title' => $group['title'], 'href' => $group['url'], 'ownerId' => $groupDto->userId))); OW::getDocument()->addOnloadScript($js, 1001); $toolbar = array(array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_create_date', array('date' => $createDate))), array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_admin', array('name' => $adminName, 'url' => $adminUrl)))); if ($service->isCurrentUserCanEdit($groupDto)) { $toolbar[] = array('label' => OW::getLanguage()->text('groups', 'edit_btn_label'), 'href' => OW::getRouter()->urlForRoute('groups-edit', array('groupId' => $groupId))); } if (OW::getUser()->isAuthenticated() && OW::getUser()->getId() != $groupDto->userId) { $toolbar[] = array('label' => OW::getLanguage()->text('base', 'flag'), 'href' => 'javascript://', 'id' => 'groups_toolbar_flag'); } $event = new BASE_CLASS_EventCollector('groups.on_toolbar_collect', array('groupId' => $groupId)); OW::getEventManager()->trigger($event); foreach ($event->getData() as $item) { $toolbar[] = $item; } $this->assign('toolbar', $toolbar); $this->assign('group', $group); }
public function __construct() { parent::__construct('delete-membership-form'); $this->setAjaxResetOnSuccess(false); $this->setAjax(true); $this->setAction(OW::getRouter()->urlForRoute('membership_delete_type')); $lang = OW::getLanguage(); $typeId = new HiddenField('typeId'); $typeId->setRequired(true); $this->addElement($typeId); $newTypeId = new Selectbox('newTypeId'); $newTypeId->setHasInvitation(false); $this->addElement($newTypeId); $types = new RadioGroupItemField('type'); $types->setRequired(true); $types->setLabel($lang->text('membership', 'set_membership')); $this->addElement($types); $this->bindJsFunction(Form::BIND_SUCCESS, "function( data ) {\n if ( data.result ) {\n document.location.reload();\n }\n }"); $script = '$("#btn-confirm-type-delete").click(function(){ if ( confirm(' . json_encode($lang->text('membership', 'type_delete_confirm')) . ') ) { $(this).parents("form:eq(0)").submit(); } }); '; OW::getDocument()->addOnloadScript($script); }
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 grantCredits() { if (!OW::getRequest()->isAjax()) { throw new Redirect404Exception(); } if (!OW::getUser()->isAuthenticated()) { throw new AuthenticateException(); } $form = new USERCREDITS_CLASS_GrantCreditsForm(); if ($form->isValid($_POST)) { $lang = OW::getLanguage(); $creditService = USERCREDITS_BOL_CreditsService::getInstance(); $grantorId = OW::getUser()->getId(); $values = $form->getValues(); $userId = (int) $values['userId']; $amount = abs((int) $values['amount']); $granted = $creditService->grantCredits($grantorId, $userId, $amount); $credits = $creditService->getCreditsBalance($grantorId); if ($granted) { $data = array('amount' => $amount, 'grantorId' => $grantorId, 'userId' => $userId); $event = new OW_Event('usercredits.grant', $data); OW::getEventManager()->trigger($event); $data = array('message' => $lang->text('usercredits', 'credits_granted', array('amount' => $amount)), 'credits' => $credits); } else { $data = array('error' => $lang->text('usercredits', 'credits_grant_error')); } exit(json_encode($data)); } }
public function __construct($configs, $features) { parent::__construct('MCOMPOSE_ConfigForm'); $this->configs = $configs; $language = OW::getLanguage(); $field = new TextField('max_users'); $field->setRequired(); $field->setValue($configs['max_users']); $this->addElement($field); if ($features["friends"]) { $field = new CheckboxField('friends_enabled'); $field->setValue($configs['friends_enabled']); $this->addElement($field); } if ($features["groups"]) { $field = new CheckboxField('groups_enabled'); $field->setValue($configs['groups_enabled']); $this->addElement($field); } if ($features["events"]) { $field = new CheckboxField('events_enabled'); $field->setValue($configs['events_enabled']); $this->addElement($field); } // submit $submit = new Submit('save'); $submit->setValue($language->text('mcompose', 'admin_save_btn')); $this->addElement($submit); }
public function getMenu() { $language = OW::getLanguage(); $menu = new BASE_CMP_ContentMenu(); $menuItem = new BASE_MenuItem(); $menuItem->setKey('all'); $menuItem->setPrefix('questions'); $menuItem->setLabel($language->text('equestions', 'list_all_tab')); $menuItem->setOrder(1); $menuItem->setUrl(OW::getRouter()->urlForRoute('equestions-all')); $menuItem->setIconClass('ow_ic_lens'); $menu->addElement($menuItem); if (OW::getUser()->isAuthenticated()) { if (OW::getPluginManager()->isPluginActive('friends')) { $menuItem = new BASE_MenuItem(); $menuItem->setKey('friends'); $menuItem->setPrefix('questions'); $menuItem->setLabel($language->text('equestions', 'list_friends_tab')); $menuItem->setOrder(2); $menuItem->setUrl(OW::getRouter()->urlForRoute('equestions-friends')); $menuItem->setIconClass('ow_ic_user'); $menu->addElement($menuItem); } $menuItem = new BASE_MenuItem(); $menuItem->setKey('my'); $menuItem->setPrefix('questions'); $menuItem->setLabel($language->text('equestions', 'list_my_tab')); $menuItem->setOrder(3); $menuItem->setUrl(OW::getRouter()->urlForRoute('equestions-my')); $menuItem->setIconClass('ow_ic_user'); $menu->addElement($menuItem); } return $menu; }
public function index($params) { if (OW::getRequest()->isAjax()) { exit; } $language = OW::getLanguage(); $this->setPageHeading($language->text('base', 'massmailing_unsubscribe')); $code = null; $userId = null; $result = false; if (isset($params['code']) && isset($params['id'])) { $result = 'confirm'; if (!empty($_POST['cancel'])) { $this->redirect(OW_URL_HOME); } $code = trim($params['code']); $userId = $params['id']; $user = $this->userServise->findUserById($userId); if ($user !== null) { if (md5($user->username . $user->password) === $code) { $result = 'confirm'; if (!empty($_POST['confirm'])) { BOL_PreferenceService::getInstance()->savePreferenceValue('mass_mailing_subscribe', false, $user->id); $result = true; OW::getFeedback()->info($language->text('base', 'massmailing_unsubscribe_successful')); $this->redirect(OW_URL_HOME); } } } } $this->assign('result', $result); }
/** * @see OW_ActionController::init() * */ public function init() { parent::init(); $language = OW::getLanguage(); $this->setPageHeading($language->text('mailbox', 'mailbox')); $this->setPageHeadingIconClass('ow_ic_mail'); }
function contactus_handler_after_install(BASE_CLASS_EventCollector $event) { if (count(CONTACTUS_BOL_Service::getInstance()->getDepartmentList()) < 1) { $url = OW::getRouter()->urlForRoute('contactus.admin'); $event->add(OW::getLanguage()->text('contactus', 'after_install_notification', array('url' => $url))); } }
public function uploadTmpAvatar($file) { if (isset($file)) { $lang = OW::getLanguage(); if (!UTIL_File::validateImage($file['name'])) { return array('result' => false, 'error' => $lang->text('base', 'not_valid_image')); } if (!empty($file['error'])) { $message = BOL_FileService::getInstance()->getUploadErrorMessage($file['error']); } if (!empty($message)) { return array('result' => false, 'error' => $message); } $filesize = OW::getConfig()->getValue('base', 'avatar_max_upload_size'); if (empty($file['size']) || $filesize * 1024 * 1024 < $file['size']) { $message = OW::getLanguage()->text('base', 'upload_file_max_upload_filesize_error'); return array('result' => false, 'error' => $message); } $avatarService = BOL_AvatarService::getInstance(); $key = $avatarService->getAvatarChangeSessionKey(); $uploaded = $avatarService->uploadUserTempAvatar($key, $file['tmp_name']); if (!$uploaded) { return array('result' => false, 'error' => $lang->text('base', 'upload_avatar_faild')); } $url = $avatarService->getTempAvatarUrl($key, 3); return array('result' => true, 'url' => $url); } return array('result' => false); }
/** * 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); }