File indexing completed on 2024-12-22 05:33:28

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 /**
0023  * Description of Backend_Form_Partner
0024  *
0025  * @author Björn Schramke
0026  */
0027 class Backend_Form_Partner extends Zend_Form
0028 {
0029 
0030     public function init()
0031     {
0032         $name = $this->createElement('text', 'name')
0033             ->setLabel('Name des Partners')
0034             ->setRequired(true)
0035             ->addErrorMessage('Es muss ein Name angegeben werden.');
0036 
0037         $logo = $this->createElement('file', 'image_logo');
0038         $logo->setLabel('Logo (200x200): ')
0039             ->setDestination(( string )Zend_Registry::get('partnerImages'))
0040             ->setMultiFile(1)
0041             ->getDecorator('description')->setEscape(false);
0042 
0043         $this->addElement($name)
0044             ->addElement($logo)
0045             ->addElement('submit', 'send', array('label' => 'Speichern'))
0046             ->addElement('submit', 'sendclose', array('label' => 'Speichern & Schließen'));
0047     }
0048 
0049     public function setValues($valName = "", $valLogo = "")
0050     {
0051         $name = $this->getElement('name')->setValue($valName);
0052 
0053         if ($valLogo != "") {
0054             $logo = $this->getElement('image_logo');
0055             $logo->setDescription('Vorhandenes Bild:<br/><img src="/images_fe/partner/' . $valLogo . '" border="0" height="200px" />');
0056             $logo->getDecorator('description')->setEscape(false);
0057         }
0058     }
0059 
0060 }
0061