Cnz_Html
[ class tree: Cnz_Html ] [ index: Cnz_Html ] [ all elements ]

Source for file File.php

Documentation is available at File.php

  1. <?php
  2. /**
  3.  * CNZ Framework
  4.  *
  5.  * A Framework for Creating and Using Complex Web Elements
  6.  *
  7.  * The purpose of this framework is to provide a library of high-level objects
  8.  * to facilitate common HTML coding tasks, such as menus, tables, and forms.
  9.  * The intent is to reduce repetitive HTML coding as much as possible, replacing
  10.  * it with a combination of configuration files and style sheets with
  11.  * standardized naming conventions.
  12.  *
  13.  * This framework is built on and requires the
  14.  * {@link http://framework.zend.com/ Zend Framework}.
  15.  *
  16.  * @category   Cnz
  17.  * @package    Cnz_Html
  18.  * @subpackage Form
  19.  *
  20.  * @author    Lyle Frost <lfrost@cnz.com>
  21.  * @copyright Copyright (c) 2006-2007 Citadel Network <{@link http://www.citadelnetwork.com/}>
  22.  * @filesource
  23.  * @license   http://www.citadelnetwork.com/license/cnzframework New BSD License
  24.  * @version   $Id: File.php 27 2007-07-19 18:47:54Z lfrost $
  25.  */
  26.  
  27. /**
  28.  * Required classes.
  29.  *
  30.  * @ignore
  31.  */
  32. Zend_Loader::loadClass('Cnz_Html_Form_Item');
  33.  
  34. /**
  35.  * HTML Form File class
  36.  *
  37.  * This class automates the creation and display of a file field.
  38.  *
  39.  * @category   Cnz
  40.  * @package    Cnz_Html
  41.  * @subpackage Form
  42.  */
  43. {
  44.     /* Methods ===========================================================*/
  45.  
  46.     /**
  47.      * Option fields:
  48.      *   none
  49.      *
  50.      * Configuration fields:
  51.      *   none
  52.      *
  53.      * @param  array       $options Options
  54.      * @param  Zend_Config $config  Configuration
  55.      */
  56.     public function __construct(array $options array()Zend_Config $config NULL)
  57.     {
  58.         parent::__construct($options$config);
  59.         return;
  60.     }
  61.  
  62.     /**
  63.      * @param  string $style Value for outermost style attribute
  64.      * @return void 
  65.      */
  66.     public function display($style NULL)
  67.     {
  68.         $indent Cnz_Html::indentGenerate();
  69.  
  70.         echo $indent'<div class = "'$this->genStyles('label')'"><label for = "'$this->genId()'">'empty($this->label'&nbsp;' $this->label'</label></div>'"\n";
  71.         echo $indent'<div class = "'$this->genStyles('field')'">';
  72.         echo '<input id = "'$this->genId()'" name = "'$this->name'" type = "file"';
  73.         if (!empty($this->value)) echo ' value = "'$this->value'"';
  74.         echo '/>';
  75.         echo '</div>'"\n";
  76.  
  77.         return;
  78.     }
  79.  
  80.     /**
  81.      * @param  array  $data Form data
  82.      * @return string 
  83.      */
  84.     public function submitString(array $data NULL)
  85.     {
  86.         return sprintf('%-24s : %s'$this->labelisset($_FILES[$this->name]$_FILES[$this->name]['name'''"\n";
  87.     }
  88. }

Documentation generated on Thu, 19 Jul 2007 15:02:01 -0400 by phpDocumentor 1.4.0RC2