Exemplo n.º 1
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $adminForm = new Form('adminForm');
     $element = new TextField('allowedFileSize');
     $element->setRequired(true);
     $element->setValue($config->getValue('ivideo', 'allowedFileSize'));
     $element->setLabel($language->text('ivideo', 'admin_allowed_file_size'));
     $element->setDescription($language->text('ivideo', 'admin_allowed_file_size_desc'));
     $validator = new FloatValidator(1);
     $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new Multiselect('allowedExtensions');
     $element->setRequired(true);
     $element->setValue(explode(",", $config->getValue('ivideo', 'allowedExtensions')));
     $element->setLabel($language->text('ivideo', 'admin_allowed_extension'));
     $element->setDescription($language->text('ivideo', 'admin_allowed_extension_desc'));
     $element->addOption('mp4', 'MP4');
     $element->addOption('flv', 'FLV');
     $element->addOption('avi', 'AVI');
     $element->addOption('wmv', 'WMV');
     $element->addOption('swf', 'SWF');
     $element->addOption('mov', 'MOV');
     $element->addOption('mpg', 'MPG');
     $element->addOption('3g2', '3G2');
     $element->addOption('ram', 'RAM');
     $element->setSize(6);
     $adminForm->addElement($element);
     $element = new TextField('videosPerRow');
     $element->setValue($config->getValue('ivideo', 'videosPerRow'));
     $element->setLabel($language->text('ivideo', 'admin_videos_per_row'));
     $element->setDescription($language->text('ivideo', 'admin_videos_per_row_desc'));
     $validator = new IntValidator();
     $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new TextField('videoPreviewWidth');
     $element->setValue($config->getValue('ivideo', 'videoPreviewWidth'));
     $element->setLabel($language->text('ivideo', 'admin_video_preview_size'));
     $element->setDescription($language->text('ivideo', 'admin_video_preview_size_desc'));
     $validator = new IntValidator();
     $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new TextField('videoPreviewHeight');
     $element->setValue($config->getValue('ivideo', 'videoPreviewHeight'));
     $element->setLabel($language->text('ivideo', 'admin_video_preview_height'));
     $validator = new IntValidator();
     $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new TextField('videoWidth');
     $element->setValue($config->getValue('ivideo', 'videoWidth'));
     $element->setLabel($language->text('ivideo', 'admin_video_size'));
     $element->setDescription($language->text('ivideo', 'admin_video_size_desc'));
     $validator = new IntValidator();
     $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new TextField('videoHeight');
     $element->setValue($config->getValue('ivideo', 'videoHeight'));
     $element->setLabel($language->text('ivideo', 'admin_video_height'));
     $validator = new IntValidator();
     $validator->setErrorMessage($language->text('ivideo', 'admin_invalid_number_error'));
     $element->addValidator($validator);
     $adminForm->addElement($element);
     $element = new Selectbox('videoApproval');
     $element->setRequired(true);
     $element->setValue($config->getValue('ivideo', 'videoApproval'));
     $element->setLabel($language->text('ivideo', 'admin_video_approval'));
     $element->addOption('auto', $language->text('ivideo', 'auto_approve'));
     $element->addOption('admin', $language->text('ivideo', 'admin_approve'));
     $element->setDescription($language->text('ivideo', 'admin_video_approval_desc'));
     $adminForm->addElement($element);
     $element = new Selectbox('theme');
     $element->setRequired(true);
     $element->setValue($config->getValue('ivideo', 'theme'));
     $element->setLabel($language->text('ivideo', 'admin_video_theme'));
     $element->addOption('baseTheme', $language->text('ivideo', 'baseTheme'));
     $element->addOption('classicTheme', $language->text('ivideo', 'classicTheme'));
     $element->addOption('fancyTheme', $language->text('ivideo', 'fancyTheme'));
     $element->addOption('listTheme', $language->text('ivideo', 'listTheme'));
     $element->setDescription($language->text('ivideo', 'admin_video_theme_desc'));
     $adminForm->addElement($element);
     $element = new TextField('resultsPerPage');
     $element->setRequired(true);
     $element->setLabel($language->text('ivideo', 'admin_results_per_page'));
     $element->setDescription($language->text('ivideo', 'admin_results_per_page_desc'));
     $element->setValue($config->getValue('ivideo', 'resultsPerPage'));
     $adminForm->addElement($element);
     $element = new TextField('ffmpegPath');
     $element->setLabel($language->text('ivideo', 'admin_ffmpeg_path'));
     $element->setDescription($language->text('ivideo', 'admin_ffmpeg_path_desc'));
     $element->setValue($config->getValue('ivideo', 'ffmpegPath'));
     $adminForm->addElement($element);
     $element = new CheckboxField('makeUploaderMain');
     $element->setLabel($language->text('ivideo', 'admin_make_uploader_main'));
     $element->setDescription($language->text('ivideo', 'admin_make_uploader_main_desc'));
     $element->setValue($config->getValue('ivideo', 'makeUploaderMain'));
     $adminForm->addElement($element);
     $element = new Submit('saveSettings');
     $element->setValue(OW::getLanguage()->text('ivideo', 'admin_save_settings'));
     $adminForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($adminForm->isValid($_POST)) {
             $values = $adminForm->getValues();
             $config->saveConfig('ivideo', 'allowedFileSize', $values['allowedFileSize']);
             $config->saveConfig('ivideo', 'allowedExtensions', implode(",", $values['allowedExtensions']));
             $config->saveConfig('ivideo', 'videoWidth', $values['videoWidth']);
             $config->saveConfig('ivideo', 'videoHeight', $values['videoHeight']);
             $config->saveConfig('ivideo', 'videoPreviewWidth', $values['videoPreviewWidth']);
             $config->saveConfig('ivideo', 'videoPreviewHeight', $values['videoPreviewHeight']);
             $config->saveConfig('ivideo', 'resultsPerPage', $values['resultsPerPage']);
             $config->saveConfig('ivideo', 'videoApproval', $values['videoApproval']);
             $config->saveConfig('ivideo', 'theme', $values['theme']);
             $config->saveConfig('ivideo', 'videosPerRow', $values['videosPerRow']);
             $config->saveConfig('ivideo', 'makeUploaderMain', $values['makeUploaderMain']);
             $config->saveConfig('ivideo', 'ffmpegPath', $values['ffmpegPath']);
             OW::getFeedback()->info($language->text('ivideo', 'user_save_success'));
         }
     }
     $this->addForm($adminForm);
 }
Exemplo n.º 2
0
 private function getAdsForm($name)
 {
     $language = OW::getLanguage();
     $form = new Form($name);
     $title = new TextField('title');
     $title->setLabel($language->text('ads', 'ads_add_banner_title_label'));
     $title->setRequired(true);
     $form->addElement($title);
     $bannerCode = new Textarea('code');
     $bannerCode->setRequired(true);
     $bannerCode->setLabel($language->text('ads', 'ads_add_banner_code_label'));
     $bannerCode->setDescription($language->text('ads', 'ads_add_banner_code_desc'));
     $form->addElement($bannerCode);
     if ($this->adsService->getLocationEnabled()) {
         $countSelect = new Multiselect('select_country');
         $countSelect->setLabel($language->text('ads', 'ads_add_banner_country_label'));
         $countSelect->setDescription($language->text('ads', 'ads_add_banner_country_desc'));
         $countSelect->setOptions(BOL_GeolocationService::getInstance()->getAllCountryNameListForCC3());
         $form->addElement($countSelect);
     } else {
         $this->assign('locDisabled', true);
     }
     $submit = new Submit('submit');
     $submit->setValue($language->text('ads', 'ads_add_banner_submit_label'));
     $form->addElement($submit);
     return $form;
 }