tangra logo
   
[ class tree: tangra_lib ] [ index: tangra_lib ] [ all elements ]
 

Source for file form_field_date_triad_view.class.php

Documentation is available at form_field_date_triad_view.class.php

  1. <?php
  2. // *** Tangra (Application Framework and Tools for PHP)
  3. //  $Id$
  4. //
  5.  
  6. /**
  7.  * Contains class Form_Field_Date_Triad_View
  8.  *
  9.  * @package tangra_lib
  10.  * @subpackage form
  11.  */
  12.  
  13. /**
  14.  *
  15.  */
  16. require_once(TANGRA_MAIN_DIR.'form/fields/form_field_view.class.php');
  17. require_once(TANGRA_MAIN_DIR.'form/date_triad/form_field_date_triad.class.php');
  18.  
  19.  
  20. /**
  21.  * View class for Form_Field_Date_Triad
  22.  *
  23.  * @package tangra_lib
  24.  * @subpackage form
  25.  */
  26.     /**
  27.      * Constructor
  28.      *
  29.      * @param string $tpl_name Field name for template
  30.      * @param Form_Field_Date_Triad $field Field object
  31.      */
  32.     function __construct($tpl_nameForm_Field_Date_Triad $field{
  33.         parent::__construct($tpl_name$field);
  34.     }
  35.  
  36.  
  37.     /**
  38.      * Returns TPLE exports
  39.      *
  40.      * @return TPLE_Exports 
  41.      */
  42.     public function get_tple_exports({
  43.         $exports parent::get_tple_exports();
  44.  
  45.         $day = (int) $this->field->get_day();
  46.         $month = (int) $this->field->get_month();
  47.         $year = (int) $this->field->get_year();
  48.  
  49.         $exports->add_pair($this->get_tpl_name().'_val_day'$day);
  50.         $exports->add_pair($this->get_tpl_name().'_val_month'$month);
  51.         $exports->add_pair($this->get_tpl_name().'_val_year'$year);
  52.  
  53.         $exports->add_pair($this->get_tpl_name().'_day_'.$day.'_selected'true);
  54.         $exports->add_pair($this->get_tpl_name().'_month_'.$month.'_selected'true);
  55.         $exports->add_pair($this->get_tpl_name().'_year_'.$year.'_selected'true);
  56.  
  57.         if ($this->is_field_in_error()) {
  58.             $exports->add_pair($this->get_tpl_name().'_val'$this->field->get_html_value());
  59.         else {
  60.             $exports->add_pair($this->get_tpl_name().'_val'$this->field->get_value());
  61.         }
  62.  
  63.         return $exports;
  64.     }
  65. }