/** * 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); }
/** * 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($configs) { parent::__construct('QUESTIONS_ConfigSaveForm'); $this->configs = $configs; $language = OW::getLanguage(); $field = new CheckboxField('allow_comments'); $field->setLabel($language->text('questions', 'admin_allow_comments_label')); $field->setValue($configs['allow_comments']); $this->addElement($field); $field = new Selectbox('list_order'); foreach (array(QUESTIONS_CMP_Feed::ORDER_LATEST, QUESTIONS_CMP_Feed::ORDER_POPULAR) as $v) { $field->addOption($v, $language->text('questions', 'feed_order_' . $v)); } $field->setHasInvitation(false); $field->setLabel($language->text('questions', 'admin_list_order_label')); $field->setValue($configs['list_order']); $this->addElement($field); $field = new CheckboxField('enable_follow'); $field->setLabel($language->text('questions', 'admin_enable_follow_label')); $field->setValue($configs['enable_follow']); $this->addElement($field); $field = new CheckboxField('allow_popups'); $field->setLabel($language->text('questions', 'admin_allow_popups_label')); $field->setValue($configs['allow_popups']); $this->addElement($field); // submit $submit = new Submit('save'); $submit->setValue($language->text('questions', 'admin_save_btn')); $this->addElement($submit); }
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); }
/** * 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() { 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 __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); }
/** * Class constructor */ public function __construct() { parent::__construct('edit-goal-form'); $this->setAction(OW::getRouter()->urlFor('OCSFUNDRAISING_CTRL_Admin', 'editGoal')); $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA); $lang = OW::getLanguage(); $id = new HiddenField('goalId'); $this->addElement($id); $name = new TextField('name'); $name->setRequired(true); $name->setLabel($lang->text('ocsfundraising', 'name')); $this->addElement($name); $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML); $desc = new WysiwygTextarea('description', $btnSet); $desc->setRequired(true); $sValidator = new StringValidator(1, 50000); $desc->addValidator($sValidator); $desc->setLabel($lang->text('ocsfundraising', 'description')); $this->addElement($desc); $category = new Selectbox('category'); $category->setLabel($lang->text('ocsfundraising', 'category')); $list = OCSFUNDRAISING_BOL_Service::getInstance()->getCategoryList(); if ($list) { foreach ($list as $cat) { $category->addOption($cat->id, $lang->text('ocsfundraising', 'category_' . $cat->id)); } } $this->addElement($category); $target = new TextField('target'); $target->setRequired(true); $target->setLabel($lang->text('ocsfundraising', 'target_amount')); $this->addElement($target); $current = new TextField('current'); $current->setRequired(true); $current->setLabel($lang->text('ocsfundraising', 'current_amount')); $this->addElement($current); $min = new TextField('min'); $min->setLabel($lang->text('ocsfundraising', 'min_amount')); $this->addElement($min); $end = new DateField('end'); $end->setMinYear(date('Y')); $end->setMaxYear(date('Y') + 2); $end->setLabel($lang->text('ocsfundraising', 'end_date')); $this->addElement($end); $imageField = new FileField('image'); $imageField->setLabel($lang->text('ocsfundraising', 'image_label')); $this->addElement($imageField); $submit = new Submit('update'); $submit->setLabel($lang->text('base', 'save')); $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 __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('acc-type-select-form'); $this->setMethod(Form::METHOD_GET); $accountType = new Selectbox('accountType'); $accountType->addAttribute('id', 'account-type-select'); $accTypes = BOL_QuestionService::getInstance()->findAllAccountTypesWithLabels(); $accountType->setOptions($accTypes); $accountType->setHasInvitation(false); $this->addElement($accountType); $script = '$("#account-type-select").change( function(){ $(this).parents("form:eq(0)").submit(); }); '; OW::getDocument()->addOnloadScript($script); }
public static function renderListTypeSelect($uniqName, $fieldName, $value) { $language = OW::getLanguage(); $field = new Selectbox($fieldName); $uniqId = uniqid("select-list-"); $field->setId($uniqId); $field->setOptions(array('latest' => $language->text('ucarousel', 'widget_list_type_latest'), 'recently' => $language->text('ucarousel', 'widget_list_type_recently'), 'online' => $language->text('ucarousel', 'widget_list_type_online'), 'featured' => $language->text('ucarousel', 'widget_list_type_featured'), 'by_role' => $language->text('ucarousel', 'widget_list_type_by_role'), 'by_account_type' => $language->text('ucarousel', 'widget_list_type_by_account_type'))); $field->setValue($value); if ($value != "by_role") { OW::getDocument()->addOnloadScript('$("#uc-role-setting").parents("tr:eq(0)").hide();'); } if ($value != "by_account_type") { OW::getDocument()->addOnloadScript('$("#uc-account-type-setting").parents("tr:eq(0)").hide();'); } OW::getDocument()->addOnloadScript('$("#' . $uniqId . '").change(function() { ' . '$("#uc-role-setting").parents("tr:eq(0)").hide(); ' . '$("#uc-account-type-setting").parents("tr:eq(0)").hide(); ' . 'if ($(this).val() == "by_role") $("#uc-role-setting").parents("tr:eq(0)").show(); ' . 'if ($(this).val() == "by_account_type") $("#uc-account-type-setting").parents("tr:eq(0)").show(); ' . ' })'); return $field->renderInput(); }
/** * Class constructor */ public function __construct($tpls) { parent::__construct('edit-template-form'); $this->setAction(OW::getRouter()->urlFor('VIRTUALGIFTS_CTRL_Admin', 'editTemplate')); $single = count($tpls) == 1; $this->setEnctype('multipart/form-data'); $language = OW::getLanguage(); $giftService = VIRTUALGIFTS_BOL_VirtualGiftsService::getInstance(); if ($single) { $file = new FileField('file'); $file->setLabel($language->text('virtualgifts', 'gift_image')); $this->addElement($file); $tpl = $giftService->findTemplateById($tpls[0]); } $tplId = new HiddenField('tplId'); $tplId->setRequired(true); $tplId->setValue(implode('|', $tpls)); $this->addElement($tplId); if ($giftService->categoriesSetup()) { $categories = new Selectbox('category'); $categories->setLabel($language->text('virtualgifts', 'category')); $categories->setOptions($giftService->getCategories()); if ($single && isset($tpl)) { $categories->setValue($tpl->categoryId); } $this->addElement($categories); } if (OW::getPluginManager()->isPluginActive('usercredits')) { $price = new TextField('price'); $price->setLabel($language->text('virtualgifts', 'gift_price')); if ($single && isset($tpl)) { $price->setValue($tpl->price); } $this->addElement($price); } // submit $submit = new Submit('save'); $submit->setValue($language->text('virtualgifts', 'btn_save')); $this->addElement($submit); }
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); }
function usearch_set_presentation(OW_Event $event) { $params = $event->getParams(); if ($params['type'] != 'search' || !in_array($params['fieldName'], array('sex', 'birthdate'))) { return; } $lang = OW::getLanguage(); $sessionData = OW::getSession()->get(USEARCH_CLASS_QuickSearchForm::FORM_SESSEION_VAR); switch ($params['fieldName']) { case 'sex': $field = new Selectbox('sex'); $field->setLabel($lang->text('usearch', 'search_label_sex')); $field->setHasInvitation(false); if (!empty($sessionData['sex'])) { $field->setValue($sessionData['sex']); } break; case 'birthdate': $field = new USEARCH_CLASS_AgeRangeField('birthdate'); $field->setLabel($lang->text('usearch', 'age')); if (!empty($sessionData['birthdate']['from']) && !empty($sessionData['birthdate']['to'])) { $field->setValue($sessionData['birthdate']); } $configs = !empty($params['configs']) ? BOL_QuestionService::getInstance()->getQuestionConfig($params['configs'], 'year_range') : null; $max = !empty($configs['from']) ? date("Y") - (int) $configs['from'] : null; $min = !empty($configs['to']) ? date("Y") - (int) $configs['to'] : null; $field->setMaxAge($max); $field->setMinAge($min); $validator = new USEARCH_CLASS_AgeRangeValidator($min, $max); $errorMsg = $lang->text('usearch', 'age_range_incorrect_values', array('min' => $min, 'max' => $max)); $validator->setErrorMessage($errorMsg); $field->addValidator($validator); break; } if (!empty($field)) { $event->setData($field); } }
public function index() { $this->setPageTitle(OW::getLanguage()->text('spdownload', 'admin_index_page_title')); $this->setPageHeading(OW::getLanguage()->text('spdownload', 'admin_index_page_heading')); $downloads = SPDOWNLOAD_BOL_CategoryService::getInstance()->getCategoryList(); $downloadCategories = array(); foreach ($downloads as $key => $value) { $downloadCategories[$value->id] = $value->name; } $form = new Form('add_category'); $this->addForm($form); // Create selectbox $fieldTo = new Selectbox('parent_category'); foreach ($downloadCategories as $key => $label) { $fieldTo->addOption($key, $label); } $fieldTo->setLabel(OW::getLanguage()->text('spdownload', 'ad_parent_category')); $form->addElement($fieldTo); $fieldCate = new TextField('category'); $fieldCate->setLabel(OW::getLanguage()->text('spdownload', 'ad_label_category')); $fieldCate->setRequired(); $fieldCate->setHasInvitation(true); $form->addElement($fieldCate); $submit = new Submit('add'); $submit->setValue(OW::getLanguage()->text('spdownload', 'form_add_category_submit')); $form->addElement($submit); if (OW::getRequest()->isPost()) { if ($form->isValid($_POST)) { $data = $form->getValues(); if ($data['parent_category'] == null) { $data['parent_category'] = 0; } SPDOWNLOAD_BOL_CategoryService::getInstance()->addCategory($data['category'], $data['parent_category']); $this->redirect(); } } }
/** * Class constructor */ public function __construct($providerId) { parent::__construct('provider-edit-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('yncontactimporter-admin-ajaxEditProvider')); $language = OW::getLanguage(); $provider = YNCONTACTIMPORTER_BOL_ProviderService::getInstance()->findProviderById($providerId); // provider id field $providerIdField = new HiddenField('id'); $providerIdField->setRequired(true); $this->addElement($providerIdField); // provider title $providerTitle = new TextField('title'); $providerTitle->setLabel($language->text('yncontactimporter', 'provider_title')); $providerTitle->setRequired(true); $this->addElement($providerTitle); for ($i = 1; $i <= 10; $i++) { $option[$i] = $i; } // provider order $providerOrder = new Selectbox('order'); $providerOrder->setLabel($language->text('yncontactimporter', 'order')); $providerOrder->addOptions($option); $providerOrder->setHasInvitation(false); $this->addElement($providerOrder); // provider enable $providerEnable = new Selectbox('enable'); $providerEnable->setLabel($language->text('yncontactimporter', 'enabled_disabled')); $providerEnable->addOptions(array(1 => 'Enabled', 0 => 'Disabled')); $providerEnable->setHasInvitation(false); $this->addElement($providerEnable); $submit = new Submit('edit'); $submit->setValue($language->text('yncontactimporter', 'save_btn_label')); $this->addElement($submit); }
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); }
public function fillAccountType($params) { if (!OW::getUser()->isAuthenticated()) { throw new AuthenticateException(); } $user = OW::getUser()->getUserObject(); $accountType = BOL_QuestionService::getInstance()->findAccountTypeByName($user->accountType); if (!empty($accountType)) { throw new Redirect404Exception(); } $event = new OW_Event(OW_EventManager::ON_BEFORE_USER_COMPLETE_ACCOUNT_TYPE, array('user' => $user)); OW::getEventManager()->trigger($event); $accounts = $this->getAccountTypes(); if (count($accounts) == 1) { $accountTypeList = array_keys($accounts); $firstAccountType = reset($accountTypeList); $accountType = BOL_QuestionService::getInstance()->findAccountTypeByName($firstAccountType); if ($accountType) { $user->accountType = $firstAccountType; BOL_UserService::getInstance()->saveOrUpdate($user); //BOL_PreferenceService::getInstance()->savePreferenceValue('profile_details_update_stamp', time(), $user->getId()); $this->redirect(OW::getRouter()->urlForRoute('base_default_index')); } } $form = new Form('accountTypeForm'); $joinAccountType = new Selectbox('accountType'); $joinAccountType->setLabel(OW::getLanguage()->text('base', 'questions_question_account_type_label')); $joinAccountType->setRequired(); $joinAccountType->setOptions($accounts); $joinAccountType->setHasInvitation(false); $form->addElement($joinAccountType); $submit = new Submit('submit'); $submit->addAttribute('class', 'ow_button ow_ic_save'); $submit->setValue(OW::getLanguage()->text('base', 'continue_button')); $form->addElement($submit); if (OW::getRequest()->isPost()) { if ($form->isValid($_POST)) { $data = $form->getValues(); $this->saveRequiredQuestionsData($data, $user->id); } } else { OW::getDocument()->addOnloadScript(" OW.info(" . json_encode(OW::getLanguage()->text('base', 'complete_profile_info')) . ") "); } $this->addForm($form); }
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 }"); }
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 }"); }
function __construct($prefixes, $language, $isDevMode = false) { parent::__construct('form'); $languageService = BOL_LanguageService::getInstance(); $this->setAjax(true); $this->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'ajaxAddKey')); $this->setMethod('post'); $languageHidden = new HiddenField('language'); $languageHidden->setValue($language->getId()); $this->addElement($languageHidden); $keyTextField = new TextField('key'); $keyTextField->setLabel(OW::getLanguage()->text('admin', 'add_key_form_lbl_key')); $this->addElement($keyTextField->setRequired(ADMIN_CTRL_Languages::isDevMode())); $prefixSelectBox = new Selectbox('prefix'); if (!empty($_GET['prefix']) && strlen($_GET['prefix']) > 0) { $prefixSelectBox->setValue($_GET['prefix']); } $options = array(); foreach ($prefixes as $prefix) { $options["{$prefix->getPrefix()}"] = $prefix->getLabel(); } $prefixSelectBox->setOptions($options)->setLabel(OW::getLanguage()->text('admin', 'section')); $this->addElement($prefixSelectBox->setRequired(ADMIN_CTRL_Languages::isDevMode())); $valueTextArea = new Textarea('value'); $this->addElement($valueTextArea->setRequired(true)->setLabel(OW::getLanguage()->text('admin', 'add_key_form_lbl_val', array('label' => $language->getLabel(), 'tag' => $language->getTag())))); $submit = new Submit('submit'); $submit->setValue(OW::getLanguage()->text('admin', 'add_key_form_lbl_add')); if (!OW::getRequest()->isAjax()) { OW::getDocument()->addOnloadScript("owForms['{$this->getName()}'].bind('success', function(json){\n\t\t\t\tswitch( json['result'] ){\n\t\t\t\t\tcase 'success':\n\t\t\t\t\t\tlocation.reload();\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'dublicate':\n\t\t\t\t\t\tOW.info('" . OW::getLanguage()->text('admin', 'msg_dublicate_key') . "');\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t});"); } $this->addElement($submit); }
/** * Class constructor * */ public function __construct($clipId) { parent::__construct('vwlsEditForm'); $language = OW::getLanguage(); // clip id field $clipIdField = new HiddenField('id'); $clipIdField->setRequired(true); $this->addElement($clipIdField); // select box for broadcasting $arr1 = array('1' => 'yes', '0' => 'no'); $arr0 = array('0' => 'no', '1' => 'yes'); // select box for permission $permArr0 = array('1' => 'moderators', '3' => 'none', '2' => 'owner', '0' => 'all'); $permArr1 = array('0' => 'all', '3' => 'none', '2' => 'owner', '1' => 'moderators'); $permArr2 = array('3' => 'none', '2' => 'owner', '1' => 'moderators', '0' => 'all'); // room_name Field $generated = base_convert(time() - 1224000000 . rand(0, 10), 10, 36); $room_nameField = new TextField('room_name'); $sValidator = new StringValidator(1, 22); $room_nameField->addValidator($sValidator); $room_nameField->setRequired(true); $room_nameField->setValue($generated); $this->addElement($room_nameField->setLabel($language->text('vwls', 'room_name'))); // Description Field $descriptionField = new Textarea('description'); $this->addElement($descriptionField->setLabel($language->text('vwls', 'description'))); // Room limit Field $room_limitField = new TextField('room_limit'); $room_limitField->setRequired(false); $room_limitField->setValue(0); $this->addElement($room_limitField->setLabel($language->text('vwls', 'room_limit'))); // Show Camera Settings Field $show_camera_settingsField = new Selectbox('show_camera_settings'); $show_camera_settingsField->addOptions($arr1); $show_camera_settingsField->setRequired(); $show_camera_settingsField->setHasInvitation(false); $this->addElement($show_camera_settingsField->setLabel($language->text('vwls', 'show_camera_settings'))); // Advanced Camera Settings Field $advanced_camera_settingsField = new Selectbox('advanced_camera_settings'); $advanced_camera_settingsField->addOptions($arr1); $advanced_camera_settingsField->setRequired(); $advanced_camera_settingsField->setHasInvitation(false); $this->addElement($advanced_camera_settingsField->setLabel($language->text('vwls', 'advanced_camera_settings'))); // Configure Source Field $configure_sourceField = new Selectbox('configure_source'); $configure_sourceField->addOptions($arr1); $configure_sourceField->setRequired(); $configure_sourceField->setHasInvitation(false); $this->addElement($configure_sourceField->setLabel($language->text('vwls', 'configure_source'))); // user_list Field $user_listField = new Textarea('user_list'); $this->addElement($user_listField->setLabel($language->text('vwls', 'user_list'))); // moderator_list Field $moderator_listField = new Textarea('moderator_list'); $userService = BOL_UserService::getInstance(); $user = $userService->findUserById(OW::getUser()->getId()); $username = $user->getUsername(); $moderator_listField->setValue($username); $this->addElement($moderator_listField->setLabel($language->text('vwls', 'moderator_list'))); // administrator Field /** $administratorField = new Selectbox('administrator'); $administratorField->addOptions($permArr0); $administratorField->setRequired(); $administratorField->setHasInvitation(false); $this->addElement($administratorField->setLabel($language->text('vwls', 'administrator'))); */ // clean_up Field $clean_upField = new TextField('clean_up'); $clean_upField->setValue(0); $this->addElement($clean_upField->setLabel($language->text('vwls', 'clean_up'))); // Broadcasting // welcome Field $welcomeField = new Textarea('welcome'); $welcomeField->setValue($language->text('vwls', 'welcome_default')); $this->addElement($welcomeField->setLabel($language->text('vwls', 'welcome'))); // Only video Field $only_videoField = new Selectbox('only_video'); $only_videoField->addOptions($arr0); $only_videoField->setRequired(); $only_videoField->setHasInvitation(false); $this->addElement($only_videoField->setLabel($language->text('vwls', 'only_video'))); // No Video Field $no_videoField = new Selectbox('no_video'); $no_videoField->addOptions($arr0); $no_videoField->setRequired(); $no_videoField->setHasInvitation(false); $this->addElement($no_videoField->setLabel($language->text('vwls', 'no_video'))); // No Embeds Field $no_embedsField = new Selectbox('no_embeds'); $no_embedsField->addOptions($arr0); $no_embedsField->setRequired(); $no_embedsField->setHasInvitation(false); $this->addElement($no_embedsField->setLabel($language->text('vwls', 'no_embeds'))); // Show Timer Field $show_timerField = new Selectbox('show_timer'); $show_timerField->addOptions($arr1); $show_timerField->setRequired(); $show_timerField->setHasInvitation(false); $this->addElement($show_timerField->setLabel($language->text('vwls', 'show_timer'))); // writeText Field $write_textField = new Selectbox('write_text'); $write_textField->addOptions($arr1); $write_textField->setRequired(); $write_textField->setHasInvitation(false); $this->addElement($write_textField->setLabel($language->text('vwls', 'write_text'))); // resolution Field $resolutionArr = array('320x240' => '320x240', '160x120' => '160x120', '176x144' => '176x144', '352x288' => '352x288', '640x480' => '640x480'); $resolutionField = new Selectbox('resolution'); $resolutionField->addOptions($resolutionArr); $resolutionField->setRequired(); $resolutionField->setHasInvitation(false); $this->addElement($resolutionField->setLabel($language->text('vwls', 'resolution'))); // camera_fps Field $camera_fpsArr = array('10' => '10', '12' => '12', '20' => '20', '25' => '25', '30' => '30'); $camera_fpsField = new Selectbox('camera_fps'); $camera_fpsField->addOptions($camera_fpsArr); $camera_fpsField->setRequired(); $camera_fpsField->setHasInvitation(false); $this->addElement($camera_fpsField->setLabel($language->text('vwls', 'camera_fps'))); // Microphone Rate Field $microphone_rateArr = array('11' => '11', '22' => '22', '44' => '44', '48' => '48'); $microphone_rateField = new Selectbox('microphone_rate'); $microphone_rateField->addOptions($microphone_rateArr); $microphone_rateField->setRequired(); $microphone_rateField->setHasInvitation(false); $this->addElement($microphone_rateField->setLabel($language->text('vwls', 'microphone_rate'))); // soundQuality Field $soundQualityField = new TextField('soundQuality'); $soundQualityField->setRequired(true); $this->addElement($soundQualityField->setLabel($language->text('vwls', 'soundQuality'))); // Bandwidth Field $bandwidthField = new TextField('bandwidth'); $bandwidthField->setRequired(true); $bandwidthField->setValue(40960); $this->addElement($bandwidthField->setLabel($language->text('vwls', 'bandwidth'))); // FloodProtection Field $flood_protectionField = new TextField('flood_protection'); $flood_protectionField->setValue(3); $this->addElement($flood_protectionField->setLabel($language->text('vwls', 'flood_protection'))); // verbose_level Field $verbose_levelArr = array('2' => 'warning/recoverable failure', '0' => 'nothing', '1' => 'failure', '3' => 'success', '4' => 'action'); $verbose_levelField = new Selectbox('verbose_level'); $verbose_levelField->addOptions($verbose_levelArr); $verbose_levelField->setRequired(); $verbose_levelField->setHasInvitation(false); $this->addElement($verbose_levelField->setLabel($language->text('vwls', 'verbose_level'))); // Label Color Field $label_colorField = new TextField('label_color'); $label_colorField->setValue('FFFFFF'); $this->addElement($label_colorField->setLabel($language->text('vwls', 'label_color'))); // privateTextchat Field $private_textchatField = new Selectbox('private_textchat'); $private_textchatField->addOptions($arr1); $private_textchatField->setRequired(); $private_textchatField->setHasInvitation(false); $this->addElement($private_textchatField->setLabel($language->text('vwls', 'private_textchat'))); // Layout Code Field $layout_codeField = new Textarea('layout_code'); $this->addElement($layout_codeField->setLabel($language->text('vwls', 'layout_code'))); // Fill window Field $fill_windowField = new Selectbox('fill_window'); $fill_windowField->addOptions($arr1); $fill_windowField->setRequired(); $fill_windowField->setHasInvitation(false); $this->addElement($fill_windowField->setLabel($language->text('vwls', 'fill_window'))); // Video / Watch // welcome Field $welcome2Field = new Textarea('welcome2'); $welcome2Field->setValue($language->text('vwls', 'welcome_default2')); $this->addElement($welcome2Field->setLabel($language->text('vwls', 'welcome2'))); // Offline message Field $offline_messageField = new Textarea('offline_message'); $this->addElement($offline_messageField->setLabel($language->text('vwls', 'offline_message'))); // FloodProtection2 Field $flood_protection2Field = new TextField('flood_protection2'); $flood_protection2Field->setValue(3); $this->addElement($flood_protection2Field->setLabel($language->text('vwls', 'flood_protection2'))); // Filter regex Field $filter_regexField = new TextField('filter_regex'); $filter_regexField->setValue('(?i)(f**k|c**t)(?-i)'); $this->addElement($filter_regexField->setLabel($language->text('vwls', 'filter_regex'))); // Filter replace Field $filter_replaceField = new TextField('filter_replace'); $filter_replaceField->setValue('**'); $this->addElement($filter_replaceField->setLabel($language->text('vwls', 'filter_replace'))); // Layout Code2 Field $layout_code2Field = new Textarea('layout_code2'); $this->addElement($layout_code2Field->setLabel($language->text('vwls', 'layout_code2'))); // Fill window2 Field $fill_window2Field = new Selectbox('fill_window2'); $fill_window2Field->addOptions($permArr0); $fill_window2Field->setRequired(); $fill_window2Field->setHasInvitation(false); $this->addElement($fill_window2Field->setLabel($language->text('vwls', 'fill_window2'))); // writeText2 Field $write_text2Field = new Selectbox('write_text2'); $write_text2Field->addOptions($permArr1); $write_text2Field->setRequired(); $write_text2Field->setHasInvitation(false); $this->addElement($write_text2Field->setLabel($language->text('vwls', 'write_text2'))); // Enable Video Field $enable_videoField = new Selectbox('enable_video'); $enable_videoField->addOptions($permArr1); $enable_videoField->setRequired(); $enable_videoField->setHasInvitation(false); $this->addElement($enable_videoField->setLabel($language->text('vwls', 'enable_video'))); // Enable chat Field $enable_chatField = new Selectbox('enable_chat'); $enable_chatField->addOptions($permArr1); $enable_chatField->setRequired(); $enable_chatField->setHasInvitation(false); $this->addElement($enable_chatField->setLabel($language->text('vwls', 'enable_chat'))); // Enable users Field $enable_usersField = new Selectbox('enable_users'); $enable_usersField->addOptions($permArr1); $enable_usersField->setRequired(); $enable_usersField->setHasInvitation(false); $this->addElement($enable_usersField->setLabel($language->text('vwls', 'enable_users'))); $entityTags = BOL_TagService::getInstance()->findEntityTags($clipId, 'vwls'); if ($entityTags) { $tags = array(); foreach ($entityTags as $entityTag) { $tags[] = $entityTag->label; } $tagsField = new TagsField('tags', $tags); } else { $tagsField = new TagsField('tags'); } $this->addElement($tagsField->setLabel($language->text('vwls', 'tags'))); $submit = new Submit('edit'); $submit->setValue($language->text('vwls', 'btn_edit')); $this->addElement($submit); }
protected function addGenderQuestions($controller, $accounts, $questionValueList, $questionData) { $controller->assign('displayGender', false); $controller->assign('displayAccountType', false); if (count($accounts) > 1) { $controller->assign('displayAccountType', true); if (!OW::getUser()->isAuthenticated()) { $controller->assign('displayGender', true); $sex = new Selectbox('sex'); $sex->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('sex')); $sex->setRequired(); $sex->setHasInvitation(false); //$accountType->setHasInvitation(false); $this->setFieldOptions($sex, 'sex', $questionValueList['sex']); if (!empty($questionData['sex'])) { $sex->setValue($questionData['sex']); } $this->addElement($sex); } else { $sexData = BOL_QuestionService::getInstance()->getQuestionData(array(OW::getUser()->getId()), array('sex')); if (!empty($sexData[OW::getUser()->getId()]['sex'])) { $sex = new HiddenField('sex'); $sex->setValue($sexData[OW::getUser()->getId()]['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($questionData['match_sex'])) { $matchSex->setValue($questionData['match_sex']); } $this->addElement($matchSex); } }
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); }
public function sitemap() { $language = OW::getLanguage(); $config = OW::getConfig(); $form = new Form('sitemap_form'); $sitemapUrl = new TextField('sitemap_url'); $sitemapUrl->setLabel($language->text('oaseo', 'sitemap_url_label')); $sitemapUrl->setDescription($language->text('oaseo', 'sitemap_url_desc')); $sitemapUrl->setValue(OW_URL_HOME . $config->getValue('oaseo', 'sitemap_url')); $form->addElement($sitemapUrl); // $rorUrl = new TextField('ror_url'); // $rorUrl->setLabel($language->text('oaseo', 'ror_url_label')); // $rorUrl->setDescription($language->text('oaseo', 'ror_url_desc')); // $rorUrl->setValue(OW_URL_HOME . $config->getValue('oaseo', 'ror_url')); // $form->addElement($rorUrl); $imageUrl = new TextField('imagemap_url'); $imageUrl->setLabel($language->text('oaseo', 'imagemap_url_label')); $imageUrl->setDescription($language->text('oaseo', 'imagemap_url_desc')); $imageUrl->setValue(OW_URL_HOME . $config->getValue('oaseo', 'imagemap_url')); $form->addElement($imageUrl); $undateFreq = new Selectbox('update_freq'); $options = array('86400' => 'Daily', '604800' => 'Weekly', '2419200' => 'Monthly'); $undateFreq->setHasInvitation(false); $undateFreq->addOptions($options); $undateFreq->setLabel($language->text('oaseo', 'update_freq_label')); $undateFreq->setDescription($language->text('oaseo', 'update_freq_desc')); $form->addElement($undateFreq); $undateFreq->setValue($config->getValue('oaseo', 'update_freq')); // $prio = new CheckboxField('prio'); // $prio->setLabel($language->text('oaseo', 'prio_label')); // $prio->setDescription($language->text('oaseo', 'prio_desc')); // $form->addElement($prio); // $email = new TextField('email'); // $email->setLabel($language->text('oaseo', 'email_label')); // $email->setDescription($language->text('oaseo', 'email_desc')); // $form->addElement($email); $inform = new CheckboxGroup('inform'); $inform->setLabel($language->text('oaseo', 'inform_label')); $inform->setDescription($language->text('oaseo', 'inform_desc')); $inform->setOptions(array('google' => 'Google', 'bing' => 'Bing', 'yahoo' => 'Yahoo', 'ask' => 'Ask')); $form->addElement($inform); $inform->setValue(json_decode($config->getValue('oaseo', 'inform'))); // $extlink = new CheckboxField('extlink'); // $extlink->setLabel($language->text('oaseo', 'extlink_label')); // $extlink->setDescription($language->text('oaseo', 'extlink_desc')); // $form->addElement($extlink); // // $brock = new CheckboxField('brock_link'); // $brock->setLabel($language->text('oaseo', 'brock_link_label')); // $brock->setDescription($language->text('oaseo', 'brock_link_desc')); // $form->addElement($brock); $submit = new Submit('submit'); $submit->setValue(OW::getLanguage()->text('admin', 'save_btn_label')); $form->addElement($submit); $this->addForm($form); if (OW::getRequest()->isPost() && $form->isValid($_POST)) { $data = $form->getValues(); $config->saveConfig('oaseo', 'sitemap_url', str_replace(OW_URL_HOME, '', $data['sitemap_url'])); $config->saveConfig('oaseo', 'imagemap_url', str_replace(OW_URL_HOME, '', $data['imagemap_url'])); $config->saveConfig('oaseo', 'update_freq', (int) $data['update_freq']); $config->saveConfig('oaseo', 'inform', json_encode($data['inform'] ? $data['inform'] : array())); } }
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); }
/** * @param OW_ActionController $controller */ public function __construct($controller) { parent::__construct('MainSearchForm'); $this->controller = $controller; $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); $questionData = OW::getSession()->get(self::FORM_SESSEION_VAR); if ($questionData === null) { $questionData = array(); if (OW::getUser()->isAuthenticated()) { $data = BOL_QuestionService::getInstance()->getQuestionData(array(OW::getUser()->getId()), array('match_sex')); $questionData['match_sex'] = $data[OW::getUser()->getId()]['match_sex']; $questionData['googlemap_location']['distance'] = 50; OW::getSession()->set(self::FORM_SESSEION_VAR, $questionData); } } if (!empty($questionData['match_sex'])) { if (is_array($questionData['match_sex'])) { $questionData['match_sex'] = array_shift($questionData['match_sex']); } else { for ($i = 0; $i < 31; $i++) { if (pow(2, $i) & $questionData['match_sex']) { $questionData['match_sex'] = pow(2, $i); break; } } } } $accounts = $this->getAccountTypes(); $accountList = array(); foreach ($accounts as $key => $account) { $accountList[$key] = $account; } $keys = array_keys($accountList); $this->accountType = $keys[0]; $this->matchSexValue = USEARCH_BOL_Service::getInstance()->getGenderByAccounType($this->accountType); if (isset($questionData['match_sex'])) { $accountType = USEARCH_BOL_Service::getInstance()->getAccounTypeByGender($questionData['match_sex']); if (!empty($accountType)) { $this->accountType = $accountType; $this->matchSexValue = $questionData['match_sex']; } } $questions = $questionService->findSearchQuestionsForAccountType($this->accountType); $mainSearchQuestion = array(); $questionNameList = array('sex' => 'sex', 'match_sex' => 'match_sex'); 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 { $mainSearchQuestion[$sectionName][] = $question; } } $questionValueList = $questionService->findQuestionsValuesByQuestionNameList($questionNameList); $controller->assign('displayGender', false); if (count($accounts) > 1) { $this->displayAccountType = true; if (!OW::getUser()->isAuthenticated()) { $controller->assign('displayGender', true); $sex = new Selectbox('sex'); $sex->setLabel(BOL_QuestionService::getInstance()->getQuestionLang('sex')); $sex->setRequired(); $sex->setHasInvitation(false); //$accountType->setHasInvitation(false); $this->setFieldOptions($sex, 'sex', $questionValueList['sex']); if (!empty($questionData['sex'])) { $sex->setValue($questionData['sex']); } $this->addElement($sex); } else { $sexData = BOL_QuestionService::getInstance()->getQuestionData(array(OW::getUser()->getId()), array('sex')); if (!empty($sexData[OW::getUser()->getId()]['sex'])) { $sex = new HiddenField('sex'); $sex->setValue($sexData[OW::getUser()->getId()]['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($questionData['match_sex'])) { $matchSex->setValue($questionData['match_sex']); } $this->addElement($matchSex); } $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', $mainSearchQuestion); $controller->assign('displayAccountType', $this->displayAccountType); // '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); // if ( OW::getPluginManager()->isPluginActive('photo') ) // { // with photo $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); // } }
public function index($params = array()) { $userService = BOL_UserService::getInstance(); $language = OW::getLanguage(); $this->setPageHeading($language->text('admin', 'massmailing')); $this->setPageHeadingIconClass('ow_ic_script'); $massMailingForm = new Form('massMailingForm'); $massMailingForm->setId('massMailingForm'); $rolesList = BOL_AuthorizationService::getInstance()->getRoleList(); $userRoles = new CheckboxGroup('userRoles'); $userRoles->setLabel($language->text('admin', 'massmailing_user_roles_label')); foreach ($rolesList as $role) { if ($role->name != 'guest') { $userRoles->addOption($role->name, $language->text('base', 'authorization_role_' . $role->name)); } } $massMailingForm->addElement($userRoles); $emailFormat = new Selectbox('emailFormat'); $emailFormat->setLabel($language->text('admin', 'massmailing_email_format_label')); $emailFormat->setOptions(array(self::EMAIL_FORMAT_TEXT => $language->text('admin', 'massmailing_email_format_text'), self::EMAIL_FORMAT_HTML => $language->text('admin', 'massmailing_email_format_html'))); $emailFormat->setValue(self::EMAIL_FORMAT_TEXT); $emailFormat->setHasInvitation(false); if (!empty($_POST['emailFormat'])) { $emailFormat->setValue($_POST['emailFormat']); } $massMailingForm->addElement($emailFormat); $subject = new TextField('subject'); $subject->addAttribute('class', 'ow_text'); $subject->addAttribute('style', 'width: auto;'); $subject->setRequired(); $subject->setLabel($language->text('admin', 'massmailing_subject_label')); if (!empty($_POST['subject'])) { $subject->setValue($_POST['subject']); } $massMailingForm->addElement($subject); $body = new Textarea('body'); if ($emailFormat->getValue() == self::EMAIL_FORMAT_HTML) { $body = new WysiwygTextarea('body'); $body->forceAddButtons(array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_HTML)); } $body->addAttribute('class', 'ow_text'); $body->addAttribute('style', 'width: auto;'); $body->setRequired(); $body->setLabel($language->text('admin', 'massmailing_body_label')); if (!empty($_POST['body'])) { $body->setValue($_POST['body']); } $massMailingForm->addElement($body); $submit = new Submit('startMailing'); $submit->addAttribute('class', 'ow_button'); $submit->setValue($language->text('admin', 'massmailing_start_mailing_button')); $massMailingForm->addElement($submit); $this->addForm($massMailingForm); $ignoreUnsubscribe = false; $isActive = true; if (defined('OW_PLUGIN_XP')) { $massMailingTimestamp = OW::getConfig()->getValue('admin', 'mass_mailing_timestamp'); $timeout = $massMailingTimestamp + 60 * 60 * 24 - time(); if ($timeout > 0) { $isActive = false; $this->assign('expireText', $language->text('admin', 'massmailing_expire_text', array('hours' => (int) ceil($timeout / (60 * 60))))); } } $this->assign('isActive', $isActive); $total = $userService->findMassMailingUserCount($ignoreUnsubscribe); if (OW::getRequest()->isPost() && $isActive && isset($_POST['startMailing'])) { if ($massMailingForm->isValid($_POST)) { $data = $massMailingForm->getValues(); $start = 0; $count = self::MAILS_ARRAY_MAX_RECORDS; $mailCount = 0; $total = $userService->findMassMailingUserCount($ignoreUnsubscribe, $data['userRoles']); while ($start < $total) { $result = $this->userService->findMassMailingUsers($start, $count, $ignoreUnsubscribe, $data['userRoles']); $mails = array(); $userIdList = array(); foreach ($result as $user) { $userIdList[] = $user->id; } $displayNameList = $this->userService->getDisplayNamesForList($userIdList); $event = new BASE_CLASS_EventCollector('base.add_global_lang_keys'); OW::getEventManager()->trigger($event); $vars = call_user_func_array('array_merge', $event->getData()); foreach ($result as $key => $user) { $vars['user_email'] = $user->email; $mail = OW::getMailer()->createMail(); $mail->addRecipientEmail($user->email); $vars['user_name'] = $displayNameList[$user->id]; $code = md5($user->username . $user->password); $link = OW::getRouter()->urlForRoute('base_massmailing_unsubscribe', array('id' => $user->id, 'code' => $code)); $subjectText = UTIL_String::replaceVars($data['subject'], $vars); $mail->setSubject($subjectText); if ($data['emailFormat'] === self::EMAIL_FORMAT_HTML) { $htmlContent = UTIL_String::replaceVars($data['body'], $vars); $htmlContent .= $language->text('admin', 'massmailing_unsubscribe_link_html', array('link' => $link)); $mail->setHtmlContent($htmlContent); $textContent = preg_replace("/\\<br\\s*[\\/]?\\s*\\>/", "\n", $htmlContent); $textContent = strip_tags($textContent); $mail->setTextContent($textContent); } else { $textContent = UTIL_String::replaceVars($data['body'], $vars); $textContent .= "\n\n" . $language->text('admin', 'massmailing_unsubscribe_link_text', array('link' => $link)); $mail->setTextContent($textContent); } $mails[] = $mail; $mailCount++; } $start += $count; //printVar($mails); OW::getMailer()->addListToQueue($mails); } OW::getFeedback()->info($language->text('admin', 'massmailing_send_mails_message', array('count' => $mailCount))); if (defined('OW_PLUGIN_XP')) { OW::getConfig()->saveConfig('admin', 'mass_mailing_timestamp', time()); } $this->redirect(); } } $this->assign('userCount', $total); $language->addKeyForJs('admin', 'questions_empty_lang_value'); $language->addKeyForJs('admin', 'massmailing_total_members'); $script = ' window.massMailing = new MassMailing(\'' . $this->ajaxResponderUrl . '\'); '; OW::getDocument()->addOnloadScript($script); $jsDir = OW::getPluginManager()->getPlugin("admin")->getStaticJsUrl(); OW::getDocument()->addScript($jsDir . "mass_mailing.js"); }
public function index($params) { $adminMode = false; $oneAccountType = false; $viewerId = OW::getUser()->getId(); if (!OW::getUser()->isAuthenticated() || $viewerId === null) { throw new AuthenticateException(); } if (!empty($params['userId']) && $params['userId'] != $viewerId) { if (OW::getUser()->isAdmin() || OW::getUser()->isAuthorized('base')) { $adminMode = true; $userId = (int) $params['userId']; $user = BOL_UserService::getInstance()->findUserById($userId); if (empty($user) || BOL_AuthorizationService::getInstance()->isSuperModerator($userId)) { throw new Redirect404Exception(); } $editUserId = $userId; } else { throw new Redirect403Exception(); } } else { $editUserId = $viewerId; $changePassword = new BASE_CMP_ChangePassword(); $this->addComponent("changePassword", $changePassword); $contentMenu = new BASE_CMP_DashboardContentMenu(); $contentMenu->getElement('profile_edit')->setActive(true); $this->addComponent('contentMenu', $contentMenu); $user = OW::getUser()->getUserObject(); //BOL_UserService::getInstance()->findUserById($editUserId); } $accountType = $user->accountType; // dispaly account type if (OW::getUser()->isAdmin() || OW::getUser()->isAuthorized('base')) { $accountType = !empty($_GET['accountType']) ? $_GET['accountType'] : $user->accountType; // get available account types from DB $accountTypes = BOL_QuestionService::getInstance()->findAllAccountTypes(); $accounts = array(); if (count($accountTypes) > 1) { /* @var $value BOL_QuestionAccount */ foreach ($accountTypes as $key => $value) { $accounts[$value->name] = OW::getLanguage()->text('base', 'questions_account_type_' . $value->name); } if (!in_array($accountType, array_keys($accounts))) { if (in_array($user->accountType, array_keys($accounts))) { $accountType = $user->accountType; } else { $accountType = BOL_QuestionService::getInstance()->getDefaultAccountType()->name; } } $editAccountType = new Selectbox('accountType'); $editAccountType->setId('accountType'); $editAccountType->setLabel(OW::getLanguage()->text('base', 'questions_question_account_type_label')); $editAccountType->setRequired(); $editAccountType->setOptions($accounts); $editAccountType->setHasInvitation(false); } else { $accountType = BOL_QuestionService::getInstance()->getDefaultAccountType()->name; } } $language = OW::getLanguage(); $this->setPageHeading($language->text('base', 'edit_index')); $this->setPageHeadingIconClass('ow_ic_user'); // -- Edit form -- $editForm = new EditQuestionForm('editForm', $editUserId); $editForm->setId('editForm'); $this->assign('displayAccountType', false); // dispaly account type if (!empty($editAccountType)) { $editAccountType->setValue($accountType); $editForm->addElement($editAccountType); OW::getDocument()->addOnloadScript(" \$('#accountType').change(function() {\n\n var form = \$(\"<form method='get'><input type='text' name='accountType' value='\" + \$(this).val() + \"' /></form>\");\n \$('body').append(form);\n \$(form).submit();\n\n } ); "); $this->assign('displayAccountType', true); } $editSubmit = new Submit('editSubmit'); $editSubmit->addAttribute('class', 'ow_button ow_ic_save'); $editSubmit->setValue($language->text('base', 'edit_button')); $editForm->addElement($editSubmit); $questions = $this->questionService->findEditQuestionsForAccountType($accountType); $section = null; $questionArray = array(); $questionNameList = array(); // echo '<pre>'; // print_r($questions); // echo '</pre>'; $userData = BOL_QuestionService::getInstance()->getQuestionData(array($editUserId), array(HAMMU_DB_IM_USING_HAMMU_AS_KEY)); $im_using_hammu_as = $userData[$editUserId][HAMMU_DB_IM_USING_HAMMU_AS_KEY]; foreach ($questions as $sort => $question) { if ($section !== $question['sectionName']) { $section = $question['sectionName']; } $questionArray[$section][$sort] = $questions[$sort]; $questionNameList[] = $questions[$sort]['name']; } echo "user->" . $editUserId; $this->assign('questionArray', $questionArray); $questionData = $this->questionService->getQuestionData(array($editUserId), $questionNameList); $questionValues = $this->questionService->findQuestionsValuesByQuestionNameList($questionNameList); $editForm->addQuestions($questions, $questionValues, !empty($questionData[$editUserId]) ? $questionData[$editUserId] : array()); if (OW::getRequest()->isPost() && isset($_POST['editSubmit'])) { if ($editForm->isValid($_POST)) { $data = $editForm->getValues(); foreach ($questionArray as $section) { foreach ($section as $key => $question) { switch ($question['presentation']) { case 'multicheckbox': if (is_array($data[$question['name']])) { $data[$question['name']] = array_sum($data[$question['name']]); } else { $data[$question['name']] = 0; } break; } } } // save user data if (!empty($user->id)) { if ($this->questionService->saveQuestionsData($data, $user->id)) { if (!$adminMode) { $event = new OW_Event(OW_EventManager::ON_USER_EDIT, array('userId' => $user->id, 'method' => 'native')); OW::getEventManager()->trigger($event); OW::getFeedback()->info($language->text('base', 'edit_successfull_edit')); $this->redirect(); } else { $event = new OW_Event(OW_EventManager::ON_USER_EDIT_BY_ADMIN, array('userId' => $user->id)); OW::getEventManager()->trigger($event); OW::getFeedback()->info($language->text('base', 'edit_successfull_edit')); $this->redirect(OW::getRouter()->urlForRoute('base_user_profile', array('username' => BOL_UserService::getInstance()->getUserName($editUserId)))); } } else { OW::getFeedback()->info($language->text('base', 'edit_edit_error')); } } else { OW::getFeedback()->info($language->text('base', 'edit_edit_error')); } } } $this->addForm($editForm); $this->assign('unregisterProfileUrl', OW::getRouter()->urlForRoute('base_delete_user')); $language->addKeyForJs('base', 'join_error_username_not_valid'); $language->addKeyForJs('base', 'join_error_username_already_exist'); $language->addKeyForJs('base', 'join_error_email_not_valid'); $language->addKeyForJs('base', 'join_error_email_already_exist'); $language->addKeyForJs('base', 'join_error_password_not_valid'); $language->addKeyForJs('base', 'join_error_password_too_short'); $language->addKeyForJs('base', 'join_error_password_too_long'); //include js $onLoadJs = " window.edit = new OW_BaseFieldValidators( " . json_encode(array('formName' => $editForm->getName(), 'responderUrl' => OW::getRouter()->urlFor("BASE_CTRL_Edit", "ajaxResponder"))) . ",\n " . UTIL_Validator::EMAIL_PATTERN . ", " . UTIL_Validator::USER_NAME_PATTERN . ", " . $editUserId . " ); "; $this->assign('isAdmin', OW::getUser()->isAdmin()); OW::getDocument()->addOnloadScript($onLoadJs); $jsDir = OW::getPluginManager()->getPlugin("base")->getStaticJsUrl(); OW::getDocument()->addScript($jsDir . "base_field_validators.js"); if (!$adminMode) { $editSynchronizeHook = OW::getRegistry()->getArray(self::EDIT_SYNCHRONIZE_HOOK); if (!empty($editSynchronizeHook)) { $content = array(); foreach ($editSynchronizeHook as $function) { $result = call_user_func($function); if (trim($result)) { $content[] = $result; } } $content = array_filter($content, 'trim'); if (!empty($content)) { $this->assign('editSynchronizeHook', $content); } } } }