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 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())); } }
protected function init($params = array()) { $accountTypes = $this->questionService->findAllAccountTypes(); $serviceLang = BOL_LanguageService::getInstance(); $language = OW::getLanguage(); $currentLanguageId = OW::getLanguage()->getCurrentId(); $accounts = array(); /* @var $value BOL_QuestionAccount */ foreach ($accountTypes as $value) { $accounts[$value->name] = $this->questionService->getAccountTypeLang($value->name); } $sections = $this->questionService->findSortedSectionList(); // need to hide sections select box if (empty($sections)) { $this->assign('no_sections', true); } $sectionsArray = array(); /* @var $section BOL_QuestionSection */ foreach ($sections as $section) { $sectionsArray[$section->name] = $language->text('base', 'questions_section_' . $section->name . '_label'); } $event = new OW_Event('base.question.add_question_form.on_get_available_sections', $sectionsArray, $sectionsArray); OW::getEventManager()->trigger($event); $sectionsArray = $event->getData(); $presentationList = array_keys($this->presentations2types); $presentations = array(); $presentationsLabel = array(); foreach ($presentationList as $item) { $presentations[$item] = $item; $presentationsLabel[$item] = $language->text('base', 'questions_question_presentation_' . $item . '_label'); } $presentation = $presentationList[0]; if (isset($_POST['qst_answer_type']) && isset($presentations[$_POST['qst_answer_type']])) { $presentation = $presentations[$_POST['qst_answer_type']]; } $qstName = new TextField('qst_name'); $qstName->setLabel($language->text('admin', 'questions_question_name_label')); //$qstName->addValidator(new StringValidator(0, 24000)); $qstName->setRequired(); $this->addElement($qstName); $qstName = new TextField('qst_description'); $qstName->setLabel($language->text('admin', 'questions_question_description_label')); //$qstName->addValidator(new StringValidator(0, 24000)); $this->addElement($qstName); if (count($accountTypes) > 1) { $qstAccountType = new CheckboxGroup('qst_account_type'); $qstAccountType->setLabel($language->text('admin', 'questions_for_account_type_label')); $qstAccountType->setRequired(); $qstAccountType->setDescription($language->text('admin', 'questions_for_account_type_description')); $qstAccountType->setOptions($accounts); $this->addElement($qstAccountType); } if (!empty($sectionsArray)) { $qstSection = new Selectbox('qst_section'); $qstSection->setLabel($language->text('admin', 'questions_question_section_label')); $qstSection->setOptions($sectionsArray); $qstSection->setHasInvitation(false); $this->addElement($qstSection); } $qstAnswerType = new Selectbox('qst_answer_type'); $qstAnswerType->setLabel($language->text('admin', 'questions_answer_type_label')); $qstAnswerType->addAttribute('class', $qstAnswerType->getName()); $qstAnswerType->setOptions($presentationsLabel); $qstAnswerType->setRequired(); $qstAnswerType->setHasInvitation(false); $qstAnswerType->setValue($presentation); $this->addElement($qstAnswerType); // if ( $displayPossibleValues ) // { $qstPossibleValues = new addValueField('qst_possible_values'); //$qstPossibleValues->addAttribute('class', $qstPossibleValues->getName()); $qstPossibleValues->setLabel($language->text('admin', 'questions_possible_values_label')); $qstPossibleValues->setDescription($language->text('admin', 'questions_possible_values_description')); //$qstPossibleValues->setValue( array( '1' => 'aaa', '2' => 'bbbb', '4' => 'ccc' ) ); $this->addElement($qstPossibleValues); // } $configList = $this->questionConfigs; foreach ($configList as $config) { $className = $config->presentationClass; /* @var $qstConfig OW_FormElement */ $qstConfig = OW::getClassInstance($className, $config->name); $qstConfig->setLabel($language->text('admin', 'questions_config_' . $config->name . '_label')); if (!empty($config->description)) { $qstConfig->setDescription($config->description); } $this->addElement($qstConfig); } $qstColumnCount = new Selectbox('qst_column_count'); $qstColumnCount->addAttribute('class', $qstColumnCount->getName()); $qstColumnCount->setLabel($language->text('admin', 'questions_columns_count_label')); $qstColumnCount->setOptions($this->qstColumnCountValues); $qstColumnCount->setValue(1); $this->addElement($qstColumnCount); $qstRequired = new CheckboxField('qst_required'); $qstRequired->setLabel($language->text('admin', 'questions_required_label')); $qstRequired->setDescription($language->text('admin', 'questions_required_description')); $this->addElement($qstRequired); $qstOnSignUp = new CheckboxField('qst_on_sign_up'); $qstOnSignUp->setLabel($language->text('admin', 'questions_on_sing_up_label')); $qstOnSignUp->setDescription($language->text('admin', 'questions_on_sing_up_description')); $this->addElement($qstOnSignUp); $qstOnEdit = new CheckboxField('qst_on_edit'); $qstOnEdit->setLabel($language->text('admin', 'questions_on_edit_label')); $qstOnEdit->setDescription($language->text('admin', 'questions_on_edit_description')); $this->addElement($qstOnEdit); $qstOnView = new CheckboxField('qst_on_view'); $qstOnView->setLabel($language->text('admin', 'questions_on_view_label')); $qstOnView->setDescription($language->text('admin', 'questions_on_view_description')); $this->addElement($qstOnView); $qstOnSearch = new CheckboxField('qst_on_search'); $qstOnSearch->setLabel($language->text('admin', 'questions_on_search_label')); $qstOnSearch->setDescription($language->text('admin', 'questions_on_search_description')); $this->addElement($qstOnSearch); $qstSubmit = new Submit('qst_submit'); $qstSubmit->setValue($language->text('admin', 'save_btn_label')); $qstSubmit->addAttribute('class', 'ow_button ow_ic_save'); $this->addElement($qstSubmit); $this->addElement($qstSubmit); }
public function __construct(OW_Renderable $rendrable) { parent::__construct('page-add-form'); $titleTextField = new TextField('title'); $titleTextField->setLabel(OW::getLanguage()->text('admin', 'pages_edit_local_page_title'))->addAttribute('class', 'ow_text'); $titleTextField->setId('title'); $isLocal = true; if (OW::getRequest()->isPost()) { $isLocal = $_POST['type'] == 'local' ? true : false; } $titleTextField->addValidator(new PageTitleValidator()); $this->addElement($titleTextField); $nameTextField = new TextField('name'); $nameTextField->setLabel(OW::getLanguage()->text('admin', 'pages_add_menu_name'))->setRequired(true)->addAttribute('class', 'ow_text'); $this->addElement($nameTextField); $visibleForCheckboxGroup = new CheckboxGroup('visible-for'); $opts = array('1' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_guests'), '2' => OW::getLanguage()->text('admin', 'pages_edit_visible_for_members')); $visibleForCheckboxGroup->setOptions($opts); $visibleForCheckboxGroup->setLabel(OW::getLanguage()->text('admin', 'pages_edit_local_visible_for')); $this->addElement($visibleForCheckboxGroup); $metaTagsTextarea = new Textarea('meta-tags'); $metaTagsTextarea->setLabel('Page meta tags')->setId('meta-tags')->setDescription(OW::getLanguage()->text('admin', 'pages_page_field_meta_desc')); $this->addElement($metaTagsTextarea); $contentTextArea = new Textarea('content'); $contentTextArea->setLabel(OW::getLanguage()->text('admin', 'pages_add_page_content'))->setId('content')->setDescription(OW::getLanguage()->text('admin', 'pages_page_field_content_desc', array('src' => OW::getThemeManager()->getCurrentTheme()->getStaticImagesUrl() . 'question.png', 'url' => '#'))); $this->addElement($contentTextArea); $typeHiddenField = new TextField('type'); $type = OW::getRequest()->isPost() && $_POST['type'] ? $_POST['type'] : 'local'; $rendrable->assign('isLocal', $isLocal); $typeHiddenField->setValue($type); $typeHiddenField->setId('type'); $typeHiddenField->setLabel(OW::getLanguage()->text('admin', 'page_add_page_address')); $this->addElement($typeHiddenField); $localUrlTextField = new TextField('local-url'); $localUrlTextField->addValidator(new LocalPageUrlValidator())->addValidator(new LocalPageUniqueValidator()); $localUrlTextField->setId('url1'); $this->addElement($localUrlTextField); $externalUrl = new TextField('external-url'); $externalUrl->setInvitation('http://www.example.com')->setHasInvitation(true)->addValidator(new ADMIN_CLASS_ExternalPageUrlValidator())->setId('url2'); $this->addElement($externalUrl); $extOpenInNewWindow = new CheckboxField('ext-open-in-new-window'); $extOpenInNewWindow->setLabel(OW::getLanguage()->text('admin', 'pages_edit_external_url_open_in_new_window')); $this->addElement($extOpenInNewWindow); $submit = new Submit('submit'); $this->addElement($submit->setValue(OW::getLanguage()->text('base', 'pages_add_submit'))); }
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); }