Warning, file /webapps/ocs-webserver/application/modules/default/forms/helpers/FormSelectNotEscaped.php was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 // require_once APPLICATION_LIB . '/Zend/View/Helper/FormSelect.php';
0023 
0024 class Default_Form_Helper_FormSelectNotEscaped extends Zend_View_Helper_FormSelect
0025 {
0026 
0027     public function formSelectNotEscaped($name, $value = null, $attribs = null,
0028                                          $options = null, $listsep = "<br />\n")
0029     {
0030         return parent::formSelect($name, $value, $attribs, $options, $listsep);
0031     }
0032 
0033     /**
0034      * Builds the actual <option> tag
0035      *
0036      * @param string $value Options Value
0037      * @param string $label Options Label
0038      * @param array $selected The option value(s) to mark as 'selected'
0039      * @param array|bool $disable Whether the select is disabled, or individual options are
0040      * @param array $optionClasses The classes to associate with each option value
0041      * @return string Option Tag XHTML
0042      */
0043     protected function _build($value, $label, $selected, $disable, $optionClasses = array())
0044     {
0045         if (is_bool($disable)) {
0046             $disable = array();
0047         }
0048 
0049         $class = null;
0050         if (array_key_exists($value, $optionClasses)) {
0051             $class = $optionClasses[$value];
0052         }
0053 
0054 
0055         $opt = '<option'
0056             . ' value="' . $this->view->escape($value) . '"';
0057 
0058         if ($class) {
0059             $opt .= ' class="' . $class . '"';
0060         }
0061         // selected?
0062         if (in_array((string)$value, $selected)) {
0063             $opt .= ' selected="selected"';
0064         }
0065 
0066         // disabled?
0067         if (in_array($value, $disable)) {
0068             $opt .= ' disabled="disabled"';
0069         }
0070 
0071         $opt .= '>' . ($label) . "</option>";
0072 
0073         return $opt;
0074     }
0075 }