Пример #1
0
 public function renderForm()
 {
     $this->toolbar_btn['save-and-stay'] = array('href' => '#', 'desc' => $this->l('Save and stay'));
     $defaultLanguage = $this->default_form_language;
     $this->initToolbar();
     if (!$this->loadObject(true)) {
         return;
     }
     $this->fields_form = array('tinymce' => true, 'legend' => array('title' => $this->l('Video'), 'image' => '../img/admin/tab-categories.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Title:'), 'name' => 'title', 'required' => true, 'lang' => true, 'class' => 'copy2friendlyUrl', 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'textarea', 'label' => $this->l('Description :'), 'name' => 'description', 'autoload_rte' => true, 'rows' => 10, 'cols' => 100, 'lang' => true, 'desc' => $this->l('Will be displayed in top of category page')), array('type' => 'text', 'label' => $this->l('Video ID:'), 'name' => 'youtube_id', 'required' => true, 'class' => 'copy2friendlyUrl', 'hint' => $this->l('This is the id of youtube video')), array('type' => 'file', 'label' => $this->l('Image Cover:'), 'name' => 'image', 'required' => true, 'display_image' => true)), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
     $this->fields_form['input'][] = array('type' => 'text', 'label' => $this->l('Position :'), 'size' => 3, 'name' => 'position');
     $categories = VideoCategory::listCategories($defaultLanguage);
     $this->fields_form['input'][] = array('type' => 'select', 'label' => $this->l('Category'), 'desc' => $this->l('Choose a category'), 'name' => 'id_video_cat', 'required' => true, 'options' => array('query' => $categories, 'id' => 'id_option', 'name' => 'name'));
     $this->fields_form['input'][] = array('type' => 'radio', 'label' => $this->l('Status :'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))));
     if (!($video = $this->loadObject(true))) {
         return;
     }
     //        $image = ImageManager::thumbnail(_PS_MYVIDEO_IMG_DIR_.'/'.$video->id.'.jpg', $this->table.'_'.(int)$video->id.'.'.$this->imageType, 350, $this->imageType, true);
     //		$this->fields_value = array(
     //			'image' => $image ? $image : false,
     //			'size' => $image ? filesize(_PS_MYVIDEO_IMG_DIR_.'/'.$video->id.'.jpg') / 1000 : false
     //		);
     return parent::renderForm();
 }