File indexing completed on 2024-05-12 05:58:42

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 class Default_Form_ProjectUpdate extends Zend_Form
0023 {
0024     public function __construct($options = null)
0025     {
0026         parent::__construct($options);
0027 
0028         $this->setAction('');
0029         $this->setAttrib('enctype', 'multipart/form-data');
0030 
0031     }
0032 
0033     public function init()
0034     {
0035         $this->setDecorators(array('FormElements', 'Form'));
0036         $this->setAttrib('class', 'standard-form span6 offset3');
0037 
0038         $filterStripSlashes = new Zend_Filter_Callback('stripslashes');
0039 
0040         $projectUpdateId = $this->createElement('hidden', 'upid')
0041             ->removeDecorator('HtmlTag')
0042             ->removeDecorator('Description');
0043 
0044         $title = $this->createElement('text', 'title')
0045             ->setLabel('Update Title')
0046             ->setRequired(true)
0047             ->addErrorMessage('ProjectAddFormTitleErr')
0048             ->setFilters(array('StringTrim', $filterStripSlashes))
0049             ->setDecorators(
0050                 array(
0051                     'ViewHelper',
0052                     'Label',
0053                     'Errors',
0054                     array('ViewScript', array(
0055                         'viewScript' => 'product/viewscripts/input_default.phtml',
0056                         'placement' => false
0057                     ))
0058                 ));
0059 
0060         $description = $this->createElement('textarea', 'description', array('cols' => 30, 'rows' => 3))
0061             ->setLabel('Description')
0062             ->setRequired(true)
0063             ->addErrorMessage('ProjectAddFormDescErr')
0064             ->setDecorators(
0065                 array(
0066                     'ViewHelper',
0067                     'Label',
0068                     'Errors',
0069                     array('ViewScript', array(
0070                         'viewScript' => 'product/viewscripts/input_default.phtml',
0071                         'placement' => false
0072                     ))
0073                 ));
0074 
0075         $embed_code = $this->createElement('textarea', 'embed_code', array('cols' => 30, 'rows' => 3))
0076             ->setLabel('Embedded content (Youtube, Vimeo, Soundcloud etc.)')
0077             ->setRequired(false)
0078             ->addErrorMessage('ProjectAddFormEmbedErr')
0079             ->setDecorators(
0080                 array(
0081                     'ViewHelper',
0082                     'Label',
0083                     'Errors',
0084                     array('ViewScript', array(
0085                         'viewScript' => 'product/viewscripts/input_default.phtml',
0086                         'placement' => false
0087                     ))
0088                 ));
0089 
0090 
0091         $link_1 = $this->createElement('text', 'link_1', array())
0092             ->setLabel('Product Page Link')
0093             ->setRequired(false)
0094             ->addErrorMessage("ProjectAddFormFacebookErr")
0095             ->setFilters(array('StringTrim'))
0096             ->setDecorators(
0097                 array(
0098                     'ViewHelper',
0099                     'Label',
0100                     'Errors',
0101                     array('ViewScript', array(
0102                         'viewScript' => 'product/viewscripts/input_default.phtml',
0103                         'placement' => false
0104                     ))
0105                 ))
0106             ->addPrefixPath('Local_Validate', 'Local/Validate', Zend_Form_Element::VALIDATE)
0107             ->addValidator('SanitizeUrl', true);
0108 
0109         $submit = $this->createElement('button', 'send');
0110         $submit->setLabel('Save');
0111         $submit->setDecorators(array('ViewHelper'));
0112         $submit->setAttrib('class', 'span3 btn btn-submit pull-right');
0113         $submit->setAttrib('type', 'submit');
0114 
0115         $cancel = $this->createElement('button', 'cancel');
0116         $cancel->setLabel('Cancel');
0117         $cancel->setDecorators(array('ViewHelper'));
0118         $cancel->setAttrib('class', 'span3 btn btn-submit pull-right');
0119         $cancel->setAttrib('type', 'submit');
0120 
0121 
0122         $this->addElement($title)
0123             ->addElement($projectUpdateId)
0124             ->addElement($description)
0125             ->addElement($embed_code)
0126 //            ->addElement($link_1)
0127 //            ->addElement($small_picture)
0128             ->addElement($cancel)
0129             ->addElement($submit);
0130     }
0131 
0132 }
0133