Show
Ignore:
Timestamp:
02/23/06 20:09:13 (6 years ago)
Author:
john
Message:

added in phpDoc commenting tests docs - Walt

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/trax/vendor/trax/action_view/helpers/form_tag_helper.php

    r132 r138  
    11<?php 
    2 # $Id$ 
    3 # 
    4 # Copyright (c) 2005 John Peterson 
    5 # 
    6 # Permission is hereby granted, free of charge, to any person obtaining 
    7 # a copy of this software and associated documentation files (the 
    8 # "Software"), to deal in the Software without restriction, including 
    9 # without limitation the rights to use, copy, modify, merge, publish, 
    10 # distribute, sublicense, and/or sell copies of the Software, and to 
    11 # permit persons to whom the Software is furnished to do so, subject to 
    12 # the following conditions: 
    13 # 
    14 # The above copyright notice and this permission notice shall be 
    15 # included in all copies or substantial portions of the Software. 
    16 # 
    17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
    18 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
    19 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
    20 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 
    21 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
    22 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
    23 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
    24  
     2/** 
     3 *  File containing the FormTagHelper class and support functions 
     4 * 
     5 *  (PHP 5) 
     6 * 
     7 *  @package PHPonTrax 
     8 *  @version $Id$ 
     9 *  @copyright (c) 2005 John Peterson 
     10 * 
     11 *  Permission is hereby granted, free of charge, to any person obtaining 
     12 *  a copy of this software and associated documentation files (the 
     13 *  "Software"), to deal in the Software without restriction, including 
     14 *  without limitation the rights to use, copy, modify, merge, publish, 
     15 *  distribute, sublicense, and/or sell copies of the Software, and to 
     16 *  permit persons to whom the Software is furnished to do so, subject to 
     17 *  the following conditions: 
     18 * 
     19 *  The above copyright notice and this permission notice shall be 
     20 *  included in all copies or substantial portions of the Software. 
     21 * 
     22 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
     23 *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
     24 *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
     25 *  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 
     26 *  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 
     27 *  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 
     28 *  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
     29 */ 
     30 
     31/** 
     32 * 
     33 *  @package PHPonTrax 
     34 */ 
    2535class FormTagHelper extends Helpers { 
    2636 
    27  
     37    /** 
     38     * 
     39     */ 
    2840    private function convert_options($options = array()) { 
    2941        $arr = array('disabled', 'readonly', 'multiple'); 
     
    3446    } 
    3547 
     48    /** 
     49     * 
     50     */ 
    3651    private function boolean_attribute(&$options, $attribute) { 
    3752        if($options[$attribute]) { 
     
    4257    } 
    4358 
     59    /** 
     60     * 
     61     */ 
    4462    function form_tag($url_for_options = array(), $options = array(), $parameters_for_url = array()) { 
    4563        $html_options = array_merge(array("method" => "post"), $options); 
     
    5472    } 
    5573 
     74    /** 
     75     * 
     76     */ 
    5677    function start_form_tag() { 
    5778        $args = func_get_args(); 
     
    5980    } 
    6081 
     82    /** 
     83     * 
     84     */ 
    6185    function select_tag($name, $option_tags = null, $options = array()) { 
    6286        return $this->content_tag("select", $option_tags, array_merge(array("name" => $name, "id" => $name), $this->convert_options($options))); 
    6387    } 
    6488 
     89    /** 
     90     * 
     91     */ 
    6592    function text_field_tag($name, $value = null, $options = array()) { 
    6693        return $this->tag("input", array_merge(array("type" => "text", "name" => $name, "id" => $name, "value" => $value), $this->convert_options($options))); 
    6794    } 
    6895 
     96    /** 
     97     * 
     98     */ 
    6999    function hidden_field_tag($name, $value = null, $options = array()) { 
    70100        return $this->text_field_tag($name, $value, array_merge($options, array("type" => "hidden"))); 
    71101    } 
    72102 
     103    /** 
     104     * 
     105     */ 
    73106    function file_field_tag($name, $options = array()) { 
    74107        return $this->text_field_tag($name, null, array_merge($this->convert_options($options), array("type" => "file"))); 
    75108    } 
    76109 
     110    /** 
     111     * 
     112     */ 
    77113    function password_field_tag($name = "password", $value = null, $options = array()) { 
    78114        return $this->text_field_tag($name, $value, array_merge($this->convert_options($options), array("type" => "password"))); 
    79115    } 
    80116 
     117    /** 
     118     * 
     119     */ 
    81120    function text_area_tag($name, $content = null, $options = array()) { 
    82121        if ($options["size"]) { 
     
    90129    } 
    91130 
     131    /** 
     132     * 
     133     */ 
    92134    function check_box_tag($name, $value = "1", $checked = false, $options = array()) { 
    93135        $html_options = array_merge(array("type" => "checkbox", "name" => $name, "id" => $name, "value" => $value), $this->convert_options($options)); 
     
    96138    } 
    97139 
     140    /** 
     141     * 
     142     */ 
    98143    function radio_button_tag($name, $value, $checked = false, $options = array()) { 
    99144        $html_options = array_merge(array("type" => "radio", "name" => $name, "id" => $name, "value" => $value), $this->convert_options($options)); 
     
    102147    } 
    103148 
     149    /** 
     150     * 
     151     */ 
    104152    function submit_tag($value = "Save changes", $options = array()) { 
    105153        return $this->tag("input", array_merge(array("type" => "submit", "name" => "commit", "value" => $value), $this->convert_options($options))); 
    106154    } 
    107155 
     156    /** 
     157     * 
     158     */ 
    108159    function image_submit_tag($source, $options = array()) { 
    109160        return $this->tag("input", array_merge(array("type" => "image", "src" => image_path($source)), $this->convert_options($options))); 
     
    112163} 
    113164 
    114 ################################################################################################ 
    115 ## Avialble functions for use in views 
    116 ################################################################################################ 
     165/** 
     166 * Avialble functions for use in views 
     167 */ 
    117168function form_tag() { 
    118169    $form_tag_helper = new FormTagHelper(); 
     
    121172} 
    122173 
     174/** 
     175 * 
     176 */ 
    123177function start_form_tag() { 
    124178    $args = func_get_args(); 
     
    126180} 
    127181 
     182/** 
     183 * 
     184 */ 
    128185function end_form_tag() { 
    129186    return "</form>"; 
    130187} 
    131188 
     189/** 
     190 * 
     191 */ 
    132192function select_tag() { 
    133193    $form_tag_helper = new FormTagHelper(); 
     
    136196} 
    137197 
     198/** 
     199 * 
     200 */ 
    138201function text_field_tag() { 
    139202    $form_tag_helper = new FormTagHelper(); 
     
    142205} 
    143206 
     207/** 
     208 * 
     209 */ 
    144210function hidden_field_tag() { 
    145211    $form_tag_helper = new FormTagHelper(); 
     
    148214} 
    149215 
     216/** 
     217 * 
     218 */ 
    150219function file_field_tag() { 
    151220    $form_tag_helper = new FormTagHelper(); 
     
    154223} 
    155224 
     225/** 
     226 * 
     227 */ 
    156228function password_field_tag() { 
    157229    $form_tag_helper = new FormTagHelper(); 
     
    160232} 
    161233 
     234/** 
     235 * 
     236 */ 
    162237function text_area_tag() { 
    163238    $form_tag_helper = new FormTagHelper(); 
     
    166241} 
    167242 
     243/** 
     244 * 
     245 */ 
    168246function check_box_tag() { 
    169247    $form_tag_helper = new FormTagHelper(); 
     
    172250} 
    173251 
     252/** 
     253 * 
     254 */ 
    174255function radio_button_tag() { 
    175256    $form_tag_helper = new FormTagHelper(); 
     
    178259} 
    179260 
     261/** 
     262 * 
     263 */ 
    180264function submit_tag() { 
    181265    $form_tag_helper = new FormTagHelper(); 
     
    184268} 
    185269 
     270/** 
     271 * 
     272 */ 
    186273function image_submit_tag() { 
    187274    $form_tag_helper = new FormTagHelper();