public static function getSettingList() { $language = OW::getLanguage(); $pluginManager = OW::getPluginManager(); return array('banners' => array('presentation' => self::PRESENTATION_CUSTOM, 'label' => $language->text('skadate', 'banners_label'), 'render' => function ($uniqName, $name, $value) { OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('skadate')->getStaticJsUrl() . 'mobile_experience.js'); OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString(';window.SKADATE_ME_SETTINGS({$params});', array('params' => array('iosActive' => OW::getPluginManager()->isPluginActive(SKADATE_CMP_MobileExperience::IOS), 'androidActive' => OW::getPluginManager()->isPluginActive(SKADATE_CMP_MobileExperience::ANDROID))))); $input = new CheckboxGroup('banners'); $input->setOptions(array(SKADATE_CMP_MobileExperience::IOS => OW::getLanguage()->text('skadate', 'ios_label'), SKADATE_CMP_MobileExperience::ANDROID => OW::getLanguage()->text('skadate', 'android_label'))); $input->setColumnCount(2); $input->setValue(!empty($value) ? array_keys($value) : null); return $input->renderInput(); }, 'value' => array(self::IOS => $pluginManager->isPluginActive(self::IOS), self::ANDROID => $pluginManager->isPluginActive(self::ANDROID))), 'show_first' => array('presentation' => self::PRESENTATION_CUSTOM, 'label' => $language->text('skadate', 'show_first_label'), 'render' => function ($uniqName, $name, $value) { $input = new RadioField('show_first[]'); $input->setOptions(array(SKADATE_CMP_MobileExperience::IOS => OW::getLanguage()->text('skadate', 'ios_label'), SKADATE_CMP_MobileExperience::ANDROID => OW::getLanguage()->text('skadate', 'android_label'))); $input->setValue($value); $input->setColumnCount(2); return $input->renderInput(); }, 'value' => $pluginManager->isPluginActive(self::IOS) ? self::IOS : self::ANDROID)); }
public function slugs() { $language = OW::getLanguage(); if (OW::getRequest()->isAjax() && OW::getRequest()->isPost()) { if (isset($_POST['plugins']) && is_array($_POST['plugins'])) { OW::getConfig()->saveConfig('oaseo', OASEO_BOL_Service::CNF_SLUG_PLUGINS, json_encode($_POST['plugins'])); } if (isset($_POST['redirect'])) { OW::getConfig()->saveConfig('oaseo', OASEO_BOL_Service::CNF_SLUG_OLD_URLS_ENABLE, (bool) $_POST['redirect']); } if (isset($_POST['words'])) { OW::getConfig()->saveConfig('oaseo', OASEO_BOL_Service::CNF_SLUG_FILTER_COMMON_WORDS, json_encode(array_map('mb_strtolower', array_map('trim', explode(',', $_POST['words']))))); } exit(json_encode(array('message' => $language->text('oaseo', 'slugs_submit_message')))); } $data = $this->service->getSlugData(); $pluginKeys = array_keys($data); $event = new BASE_CLASS_EventCollector('admin.add_auth_labels'); OW::getEventManager()->trigger($event); $labelData = $event->getData(); $dataLabels = empty($labelData) ? array() : call_user_func_array('array_merge', $labelData); $finalData = array(); foreach ($dataLabels as $pluginKey => $pluginInfo) { if (in_array($pluginKey, $pluginKeys)) { $finalData[$pluginKey] = $pluginInfo['label']; } } $form = new Form('slugs_form'); $form->setAjax(); $form->setAjaxResetOnSuccess(false); $form->bindJsFunction(Form::BIND_SUCCESS, "function(data){OW.info(data.message);}"); $plugins = new CheckboxGroup('plugins'); $plugins->setLabel($language->text('oaseo', 'slug_plugins_label')); $plugins->setDescription($language->text('oaseo', 'slug_plugins_desc')); $plugins->setOptions($finalData); $plugins->setValue(json_decode(OW::getConfig()->getValue('oaseo', OASEO_BOL_Service::CNF_SLUG_PLUGINS), true)); $form->addElement($plugins); $redirect = new CheckboxField('redirect'); $redirect->setLabel($language->text('oaseo', 'slug_redirect_label')); $redirect->setDescription($language->text('oaseo', 'slug_redirect_desc')); $redirect->setValue(OW::getConfig()->getValue('oaseo', OASEO_BOL_Service::CNF_SLUG_OLD_URLS_ENABLE)); $form->addElement($redirect); $words = new Textarea('words'); $words->setLabel($language->text('oaseo', 'slug_words_label')); $words->setDescription($language->text('oaseo', 'slug_words_desc')); $wordsList = json_decode(OW::getConfig()->getValue('oaseo', OASEO_BOL_Service::CNF_SLUG_FILTER_COMMON_WORDS)); if (is_array($wordsList)) { $valString = implode(', ', $wordsList); } else { $valString = ''; } $words->setValue($valString); $form->addElement($words); $submit = new Submit('submit'); $submit->setValue(OW::getLanguage()->text('admin', 'save_btn_label')); $form->addElement($submit); $this->addForm($form); }
public function __construct($configs) { parent::__construct('YNSOCIALSTREAM_LevelSettingsForm'); $language = OW::getLanguage(); $field = new CheckboxGroup('level_id'); $field->setLabel($language->text('ynsocialstream', 'admin_level_id_label')); $field->setValue($configs['get_feed']); $field->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '0' => $language->text('admin', 'permissions_index_no'))); $this->addElement($field); $field = new RadioField('get_feed'); $field->setLabel($language->text('ynsocialstream', 'admin_get_feed_label')); $field->setValue($configs['get_feed']); $field->addOptions(array('1' => $language->text('admin', 'permissions_index_yes'), '0' => $language->text('admin', 'permissions_index_no'))); $this->addElement($field); $btn = new Submit('save'); $btn->setValue($language->text('ynsocialstream', 'save_customization_btn_label')); $this->addElement($btn); }
public function toplinklist($curr = null) { OW::getDocument()->addStyleSheet(OW::getPluginManager()->getPlugin('toplink')->getStaticCssUrl() . 'style.css'); OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('toplink')->getStaticJsUrl() . 'toplink.js'); $currId = @$curr['id']; $topForm = new Form("topForm"); $topForm->setEnctype('multipart/form-data'); $topSubmit = new Submit("topSubmit"); $topForm->addElement($topSubmit); $topName = new TextField("topName"); $topUrl = new TextField("topUrl"); $topIcon = new TextField("topIcon"); $topId = new HiddenField("topId"); $uploadIcon = new FileField('topIconFile'); $uploadIcon->setLabel($this->text('toplink', 'new_icon')); $topOrder = new TextField('toporder'); $topTarget = new CheckboxField('toptarget'); $topPermission = new CheckboxGroup('toppermission'); $topPermission->setColumnCount(1); $topPermission->setLabel($this->text('toplink', 'new_permission')); $availableDesc = TOPLINK_BOL_Service::$visibility; $topPermission->addOptions($availableDesc); $topOrder->setLabel($this->text('toplink', 'new_order')); $topOrder->setRequired(); $topTarget->setLabel($this->text('toplink', 'new_target')); $topName->setLabel($this->text('toplink', 'new_name')); //$topName->setRequired(); $topUrl->setLabel($this->text('toplink', 'new_url')); $topUrl->setRequired(); $topIcon->setLabel($this->text('toplink', 'new_icon')); if (!empty($currId) && !OW::getRequest()->isPost()) { $theTopLink = $this->myService->getTopLinkById($currId); $topName->setValue($theTopLink->itemname); $topId->setValue($currId); $topUrl->setValue($theTopLink->url); $topIcon->setValue($theTopLink->icon); $topTarget->setValue($theTopLink->target); $topOrder->setValue($theTopLink->order); $theTopLinkChild = $this->myService->getTopLinkChildObjectByParentId($currId); $theTopLinkPermission = $this->myService->getTopLinkPermissionById($currId); if (!empty($theTopLinkPermission)) { $i = 1; foreach ($theTopLinkPermission as $topLinkPermission) { $permissionOption[$i] = $topLinkPermission->availablefor; $i++; } $topPermission->setValue($permissionOption); } } $topForm->addElement($topName); $topForm->addElement($topUrl); $topForm->addElement($topIcon); $topForm->addElement($topId); $topForm->addElement($topTarget); $topForm->addElement($topOrder); $topForm->addElement($uploadIcon); $topForm->addElement($topPermission); $this->addForm($topForm); /* --- form submit --- */ $childrenNameList = @$_REQUEST['menuchildname']; $childrenUrlList = @$_REQUEST['menuchildurl']; $childrenIDList = @$_REQUEST['menuchildid']; if (OW::getRequest()->isPost()) { if ($topForm->isValid($_POST)) { $fdata = $topForm->getValues(); $newtoplink = new TOPLINK_BOL_Toplink(); $newtoplink->id = $fdata['topId']; $newtoplink->itemname = $fdata['topName']; $theurl = $fdata['topUrl']; if (!empty($theurl)) { $theurl = preg_match("/^http/", $theurl) ? $theurl : "http://" . $theurl; } else { $theurl = "#"; } $newtoplink->url = $theurl; /* check file exist */ if (!empty($fdata['topIcon']) && preg_match("/^\\//", $fdata['topIcon'])) { $newtoplink->icon = $fdata['topIcon']; $iconFileName = preg_replace("/^\\//", "", $newtoplink->icon); if (!file_exists($this->iconDir . $iconFileName)) { $newtoplink->icon = null; } } /* end */ $newtoplink->target = $fdata['toptarget']; $newtoplink->order = empty($fdata['toporder']) ? 5 : $fdata['toporder']; $loadedExts = get_loaded_extensions(); if (in_array('imagick', $loadedExts)) { $this->iMagicInstalled = true; } if ($_FILES['topIconFile']['error'] == 0) { $ext = explode('.', $_FILES['topIconFile']['name']); $ext = end($ext); if ($this->iMagicInstalled) { $image = new Imagick($_FILES['topIconFile']['tmp_name']); $image->thumbnailImage(16, 0); file_put_contents($this->iconDir . $_FILES['topIconFile']['name'] . '.png', $image); $uploadresult = $_FILES['topIconFile']['name'] . '.png'; } else { try { $image = new UTIL_Image($_FILES['topIconFile']['tmp_name'], 'PNG'); $image->resizeImage(16, 16, false)->saveImage($this->iconDir . $_FILES['topIconFile']['name'] . '.png'); $uploadresult = $_FILES['topIconFile']['name'] . '.png'; } catch (Exception $e) { $uploadresult = null; } } if ($uploadresult) { $newtoplink->icon = "/" . $uploadresult; } /* check file exist AGAIN AFTER UPLOAD */ if ($newtoplink->icon && preg_match("/^\\//", $newtoplink->icon)) { $iconFileName = preg_replace("/^\\//", "", $newtoplink->icon); if (!file_exists($this->iconDir . $iconFileName)) { $newtoplink->icon = null; } } /* end */ } $permission = $fdata['toppermission']; //save link $newid = $this->myService->saveToplink($newtoplink, $permission); $toplinkid = !empty($newtoplink->id) ? $newtoplink->id : $newid; $childIds = $this->myService->getTopLinkChildIdByParentId($toplinkid); if (!empty($childIds)) { if (!empty($childrenIDList)) { foreach ($childIds as $cid) { if (!in_array($cid, $childrenIDList)) { $this->myService->removeToplinkChild($cid); } } } else { foreach ($childIds as $cid) { $this->myService->removeToplinkChild($cid); } } } //process children if any if (!empty($childrenNameList) && !empty($childrenUrlList)) { foreach ($childrenNameList as $childIndex => $childName) { if (!empty($childName) && !empty($childrenUrlList[$childIndex])) { $childDoa = new TOPLINK_BOL_ToplinkChildren(); $childDoa->childof = $toplinkid; $childDoa->name = $childName; if (!empty($childrenUrlList[$childIndex])) { $thecurl = preg_match("/^http/", $childrenUrlList[$childIndex]) ? $childrenUrlList[$childIndex] : "http://" . $childrenUrlList[$childIndex]; } else { $thecurl = "#"; } $childDoa->url = $thecurl; if (!empty($childrenIDList[$childIndex])) { $childDoa->id = $childrenIDList[$childIndex]; } $this->myService->saveTopLinkChild($childDoa); } } } OW::getFeedback()->info($this->text('toplink', 'save_success_message')); $this->redirect(OW::getRouter()->urlForRoute('toplink.admin')); } } $alltoplink = $this->myService->getTopLink(true); $updatelink = array(); if (!empty($alltoplink)) { foreach ($alltoplink as $toplinkId => $toplink) { $toplink->itemname = empty($toplink->itemname) ? $this->text('toplink', 'top_link_no_name') : $toplink->itemname; $permissionx = array(); $theTopLinkPermission = $this->myService->getTopLinkPermissionById($toplink->id); foreach ($theTopLinkPermission as $topLinkPermission) { $permissionx[] = ucwords($availableDesc[$topLinkPermission->availablefor]); } $toplink->permission = !empty($permissionx) ? implode(',', $permissionx) : ''; $toplink->updateurl = OW::getRouter()->urlForRoute('toplink.admin2', array('id' => $toplink->id)); $toplink->removeurl = OW::getRouter()->urlForRoute('toplink.remove', array('id' => $toplink->id)); $alltoplink[$toplinkId] = $toplink; } } if (!empty($theTopLinkChild)) { $this->assign('children', $theTopLinkChild); } $this->assign('alltoplink', $alltoplink); }
public function index() { $language = OW::getLanguage(); $config = OW::getConfig(); $adminForm = new Form('adminForm'); $element = new Selectbox('itemApproval'); $element->setRequired(true); $element->setValue($config->getValue('eventx', 'itemApproval')); $element->setLabel($language->text('eventx', 'admin_event_approval')); $element->addOption('auto', $language->text('eventx', 'auto_approve')); $element->addOption('admin', $language->text('eventx', 'admin_approve')); $adminForm->addElement($element); $element = new CheckboxGroup('eventDelete'); $element->setRequired(true); $element->setColumnCount(3); $element->setValue(explode(",", $config->getValue('eventx', 'eventDelete'))); $element->setLabel($language->text('eventx', 'admin_event_delete')); $element->addOption(1, $language->text('eventx', 'admin')); $element->addOption(2, $language->text('eventx', 'moderator')); $element->addOption(3, $language->text('eventx', 'creator_del')); $adminForm->addElement($element); $element = new TextField('resultsPerPage'); $element->setRequired(true); $element->setLabel($language->text('eventx', 'admin_results_per_page')); $element->setValue($config->getValue('eventx', 'resultsPerPage')); $validator = new IntValidator(1); $validator->setErrorMessage($language->text('eventx', 'invalid_numeric_format')); $element->addValidator($validator); $adminForm->addElement($element); $element = new TextField('mapWidth'); $element->setRequired(true); $element->setValue($config->getValue('eventx', 'mapWidth')); $validator = new IntValidator(0); $validator->setErrorMessage($language->text('eventx', 'invalid_numeric_format')); $element->addValidator($validator); $adminForm->addElement($element); $element = new TextField('mapHeight'); $element->setRequired(true); $element->setValue($config->getValue('eventx', 'mapHeight')); $validator = new IntValidator(0); $validator->setErrorMessage($language->text('eventx', 'invalid_numeric_format')); $element->addValidator($validator); $adminForm->addElement($element); $element = new CheckboxField('enableCategoryList'); $element->setLabel($language->text('eventx', 'admin_enable_category_listing')); $element->setValue($config->getValue('eventx', 'enableCategoryList')); $adminForm->addElement($element); $element = new CheckboxField('enableCalendar'); $element->setLabel($language->text('eventx', 'admin_enable_calendar')); $element->setValue($config->getValue('eventx', 'enableCalendar')); $adminForm->addElement($element); $element = new CheckboxField('enableTagsList'); $element->setLabel($language->text('eventx', 'admin_enable_tag_listing')); $element->setValue($config->getValue('eventx', 'enableTagsList')); $adminForm->addElement($element); $element = new CheckboxField('enableMultiCategories'); $element->setLabel($language->text('eventx', 'enable_multi_categories')); $element->setValue($config->getValue('eventx', 'enableMultiCategories')); $adminForm->addElement($element); $element = new CheckboxField('enable3DTagCloud'); $element->setLabel($language->text('eventx', 'enable_3d_cloud_categories')); $element->setValue($config->getValue('eventx', 'enable3DTagCloud')); $adminForm->addElement($element); $element = new CheckboxField('enableMapSuggestion'); $element->setLabel($language->text('eventx', 'enable_map_suggestion')); $element->setValue($config->getValue('eventx', 'enableMapSuggestion')); $adminForm->addElement($element); $element = new Submit('saveSettings'); $element->setValue(OW::getLanguage()->text('eventx', 'admin_save_settings')); $adminForm->addElement($element); if (OW::getRequest()->isPost()) { if ($adminForm->isValid($_POST)) { $values = $adminForm->getValues(); $config->saveConfig('eventx', 'resultsPerPage', $values['resultsPerPage']); $config->saveConfig('eventx', 'itemApproval', $values['itemApproval']); $config->saveConfig('eventx', 'enableCategoryList', $values['enableCategoryList']); $config->saveConfig('eventx', 'enableMultiCategories', $values['enableMultiCategories']); $config->saveConfig('eventx', 'enable3DTagCloud', $values['enable3DTagCloud']); $config->saveConfig('eventx', 'enableMapSuggestion', $values['enableMapSuggestion']); $config->saveConfig('eventx', 'mapWidth', $values['mapWidth']); $config->saveConfig('eventx', 'mapHeight', $values['mapHeight']); $config->saveConfig('eventx', 'eventDelete', implode(",", $values['eventDelete'])); $config->saveConfig('eventx', 'enableTagsList', $values['enableTagsList']); $config->saveConfig('eventx', 'enableCalendar', $values['enableCalendar']); OW::getFeedback()->info($language->text('eventx', 'user_save_success')); $this->redirect(OW::getRouter()->urlForRoute('eventx_admin_index')); } } $this->addForm($adminForm); }