Пример #1
0
    public function init() {
        $this->clearDecorators()
                ->addDecorator('FormElements')
                ->addDecorator('Form')
                ->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'search'))
                ->addDecorator('HtmlTag2', array('tag' => 'div', 'class' => 'clear'));

        $this->setAttribs(array('id' => 'filter_form', 'class' => 'global_form_box'))->setMethod('get');

        //Search Title
        $this->addElement('Text', 'title', array(
            'label' => 'Title',
        ));

        //Search Owner
        $this->addElement('Text', 'owner', array(
            'label' => 'Owner',
        ));

        //Feature
        $this->addElement('Select', 'featured', array(
            'label' => 'Featured',
            'multiOptions' => array(
                '' => '',
                '0' => 'Only Featured Videos',
                '1' => 'Only Not Featured Videos',
            ),
            'value' => '',
        ));

        //Feature
        $this->addElement('Select', 'featured', array(
            'label' => 'Featured',
            'multiOptions' => array(
                '' => '',
                '1' => 'Only Featured Videos',
                '0' => 'Only Not Featured Videos',
            ),
            'value' => '',
        ));

        $videoTypes[''] = '';
        foreach (Ynvideo_Plugin_Factory::getAllSupportTypes() as $key => $type) {
            $videoTypes[$key] = $type;
        }

        //Feature
        $this->addElement('Select', 'type', array(
            'label' => 'Type',
            'multiOptions' => $videoTypes,
            'value' => '',
        ));

        // Buttons
        $this->addElement('Button', 'button', array(
            'label' => 'Search',
            'type' => 'submit',
        ));

        $this->button->clearDecorators()
                ->addDecorator('ViewHelper')
                ->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'buttons'))
                ->addDecorator('HtmlTag2', array('tag' => 'div'));
    }
Пример #2
0
	protected function addAdditionalElements()
	{
		// Init video
		$this -> addElement('Select', 'type', array(
			'label' => 'Video Source',
			'multiOptions' => array('0' => ' '),
			'onchange' => "updateTextFields()",
		));

		$video_options = Ynvideo_Plugin_Factory::getAllSupportTypes();

		$user = Engine_Api::_() -> user() -> getViewer();
		//My Computer
		$allowed_upload = Engine_Api::_() -> authorization() -> getAdapter('levels') -> getAllowed('video', $user, 'upload');
		$ffmpeg_path = Engine_Api::_() -> getApi('settings', 'core') -> ynvideo_ffmpeg_path;
		if (!(!empty($ffmpeg_path) && $allowed_upload))
		{
			unset($video_options[Ynvideo_Plugin_Factory::getUploadedType()]);
		}
		$this -> type -> addMultiOptions($video_options);

		//ADD AUTH STUFF HERE
		// Init url
		$this -> addElement('Textarea', 'url', array(
			'label' => 'Video Link (URL)',
			'description' => 'Paste the web address of the video here.',
		));
		$this -> url -> getDecorator("Description") -> setOption("placement", "append");
        
		$this -> addElement('Hidden', 'code', array('order' => 1));
		$this -> addElement('Hidden', 'id', array('order' => 2));
		$this -> addElement('Hidden', 'ignore', array('order' => 3));

		$this -> addElement('Dummy', 'html5_upload', array(
			'decorators' => array( array(
					'ViewScript',
					array(
						'viewScript' => '_Html5Upload.tpl',
						'class' => 'form element',
					)
				)),
		));
	}