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); }