Location: PHPKode > projects > PHP on Trax > johnpipi-trax-f599562/trax/doc/PHPonTrax/tutorial_DateHelper.cls.html
<html>
<head>
<title>DateHelper</title>
<link rel="stylesheet" type="text/css" href="../media/style.css">
</head>
<body>

<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
  <tr>
    <td class="header_top">PHPonTrax</td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
  <tr>
    <td class="header_menu">
  		  [ <a href="../classtrees_PHPonTrax.html" class="menu">class tree: PHPonTrax</a> ]
		  [ <a href="../elementindex_PHPonTrax.html" class="menu">index: PHPonTrax</a> ]
		  [ <a href="../elementindex.html" class="menu">all elements</a> ]
    </td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="200" class="menu">
	<div id="todolist">
			<p><a href="../todolist.html">Todo List</a></p>
	</div>
      <b>Packages:</b><br />
              <a href="../li_PHPonTrax.html">PHPonTrax</a><br />
              <a href="../li_PHPonTraxTest.html">PHPonTraxTest</a><br />
            <br /><br />
		<b>Tutorials/Manuals:</b><br />
					<strong>Package-level:</strong>
							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_PHPonTrax.pkg.html">PHP On Trax</a>
<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_rails_examples.pkg.html">Examples From The Rails Book</a>
</ul>

<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_simpleapp.pkg.html">Build A Simple Trax Application</a>
</ul>

<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_database.pkg.html">Create A Database and User</a>
</ul>

<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_advbuild.pkg.html">Advanced Application Build Topics</a>
</ul>

<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_naming.pkg.html">The Trax Naming Convention</a>
</ul>

<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_troubleshoot.pkg.html">Troubleshooting</a>
</ul>

<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_reference.pkg.html">Reference</a>
</ul>

</li></ul>


										<strong>Class-level:</strong>
							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ActiveRecordHelper.cls.html">ActiveRecordHelper</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_FormTagHelper.cls.html">FormTagHelper</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_Helpers.cls.html">Helpers</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_UrlHelper.cls.html">UrlHelper</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_FormHelper.cls.html">FormHelper</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_InputFilter.cls.html">InputFilter</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ActionMailer.cls.html">ActionMailer</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ApplicationController.cls.html">ApplicationController</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ActionController.cls.html">ActionController</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ActiveRecord.cls.html">ActiveRecord</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_DateHelper.cls.html">DateHelper</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_Router.cls.html">Router</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_FormOptionsHelper.cls.html">FormOptionsHelper</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_TraxGenerator.cls.html">TraxGenerator</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_Session.cls.html">Session</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_Inflector.cls.html">Inflector</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ActiveRecordError.cls.html">ActiveRecordError</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ActionControllerError.cls.html">ActionControllerError</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ScaffoldController.cls.html">ScaffoldController</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_Dispatcher.cls.html">Dispatcher</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_TraxError.cls.html">TraxError</a>
</ul>


							<ul>
	<li type="square"><a href="../PHPonTrax/tutorial_ApplicationMailer.cls.html">ApplicationMailer</a>
</ul>


							                        <b>Files:</b><br />
      	  <div class="package">
			<a href="../PHPonTrax/_vendor_trax_action_controller_php.html">		action_controller.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_mailer_php.html">		action_mailer.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_php.html">		action_view.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_active_record_php.html">		active_record.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_active_record_helper_php.html">		active_record_helper.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_add_phtml.html">		add.phtml
		</a><br>
			<a href="../PHPonTrax/_data_app_controllers_application_php.html">		application.php
		</a><br>
			<a href="../PHPonTrax/_data_app_views_layouts_application_phtml.html">		application.phtml
		</a><br>
			<a href="../PHPonTrax/_data_app_helpers_application_helper_php.html">		application_helper.php
		</a><br>
			<a href="../PHPonTrax/_data_app_application_mailer_php.html">		application_mailer.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_asset_tag_helper_php.html">		asset_tag_helper.php
		</a><br>
			<a href="../PHPonTrax/_test_layouts_catalog_phtml.html">		catalog.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_controller_php.html">		controller.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_controller_php.html">		controller.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_date_helper_php.html">		date_helper.php
		</a><br>
			<a href="../PHPonTrax/_data_config_environments_development_php.html">		development.php
		</a><br>
			<a href="../PHPonTrax/_data_public_dispatch_php.html">		dispatch.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_dispatcher_php.html">		dispatcher.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_edit_phtml.html">		edit.phtml
		</a><br>
			<a href="../PHPonTrax/_data_config_environment_php.html">		environment.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_error_phtml.html">		error.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_form_helper_php.html">		form_helper.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_form_options_helper_php.html">		form_options_helper.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_form_scaffolding_phtml.html">		form_scaffolding.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_form_tag_helper_php.html">		form_tag_helper.php
		</a><br>
			<a href="../PHPonTrax/_data_script_generate_php.html">		generate.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_helper_php.html">		helper.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_php.html">		helpers.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_index_phtml.html">		index.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_inflector_php.html">		inflector.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_input_filter_php.html">		input_filter.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_javascript_helper_php.html">		javascript_helper.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_layout_phtml.html">		layout.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_layout_phtml.html">		layout.phtml
		</a><br>
			<a href="../PHPonTrax/_makepkg_php.html">		makepkg.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_model_php.html">		model.php
		</a><br>
			<a href="../PHPonTrax/_data_config_environments_production_php.html">		production.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_router_php.html">		router.php
		</a><br>
			<a href="../PHPonTrax/_data_config_routes_php.html">		routes.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_scaffold_controller_php.html">		scaffold_controller.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_session_php.html">		session.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_show_phtml.html">		show.phtml
		</a><br>
			<a href="../PHPonTrax/_data_config_environments_test_php.html">		test.php
		</a><br>
			<a href="../PHPonTrax/_trax_php.html">		trax.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_trax_exceptions_php.html">		trax_exceptions.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_trax_generator_php.html">		trax_generator.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_action_view_helpers_url_helper_php.html">		url_helper.php
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_view_phtml.html">		view.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_view_add_phtml.html">		view_add.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_view_edit_phtml.html">		view_edit.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_view_index_phtml.html">		view_index.phtml
		</a><br>
			<a href="../PHPonTrax/_vendor_trax_templates_scaffolds_generator_templates_view_show_phtml.html">		view_show.phtml
		</a><br>
	  </div><br />

      
            <b>Classes:</b><br />
        <div class="package">
		    		<a href="../PHPonTrax/.html"></a><br />
	    		<a href="../PHPonTrax/ActionController.html">ActionController</a><br />
	    		<a href="../PHPonTrax/ActionControllerError.html">ActionControllerError</a><br />
	    		<a href="../PHPonTrax/ActionMailer.html">ActionMailer</a><br />
	    		<a href="../PHPonTrax/ActiveRecord.html">ActiveRecord</a><br />
	    		<a href="../PHPonTrax/ActiveRecordError.html">ActiveRecordError</a><br />
	    		<a href="../PHPonTrax/ActiveRecordHelper.html">ActiveRecordHelper</a><br />
	    		<a href="../PHPonTrax/ApplicationController.html">ApplicationController</a><br />
	    		<a href="../PHPonTrax/ApplicationMailer.html">ApplicationMailer</a><br />
	    		<a href="../PHPonTrax/AssetTagHelper.html">AssetTagHelper</a><br />
	    		<a href="../PHPonTrax/DateHelper.html">DateHelper</a><br />
	    		<a href="../PHPonTrax/Dispatcher.html">Dispatcher</a><br />
	    		<a href="../PHPonTrax/FormHelper.html">FormHelper</a><br />
	    		<a href="../PHPonTrax/FormOptionsHelper.html">FormOptionsHelper</a><br />
	    		<a href="../PHPonTrax/FormTagHelper.html">FormTagHelper</a><br />
	    		<a href="../PHPonTrax/Helpers.html">Helpers</a><br />
	    		<a href="../PHPonTrax/Inflector.html">Inflector</a><br />
	    		<a href="../PHPonTrax/InputFilter.html">InputFilter</a><br />
	    		<a href="../PHPonTrax/JavaScriptHelper.html">JavaScriptHelper</a><br />
	    		<a href="../PHPonTrax/Router.html">Router</a><br />
	    		<a href="../PHPonTrax/ScaffoldController.html">ScaffoldController</a><br />
	    		<a href="../PHPonTrax/Session.html">Session</a><br />
	    		<a href="../PHPonTrax/TraxError.html">TraxError</a><br />
	    		<a href="../PHPonTrax/TraxGenerator.html">TraxGenerator</a><br />
	    		<a href="../PHPonTrax/UrlHelper.html">UrlHelper</a><br />
	  </div>

                </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10%" align="left" valign="bottom"><a href=
"../PHPonTrax/tutorial_ActiveRecord.cls.html">Prev</a></td>
<td width="80%" align="center" valign="bottom"></td>
<td width="10%" align="right" valign="bottom"><a href=
"../PHPonTrax/tutorial_Router.cls.html">Next</a></td>
</tr>
</table>
<div><a name=""></a><div class="ref-title-box">DateHelper<h1 class="ref-title">DateHelper</h1>
  <h2 class="ref-purpose">Date/time pulldown menu utilities class</h2></div>
 <div class="ref-synopsis"><span class="author">Walt Haas
   <div class="author-blurb"><a href="mailto:hide@address.com">hide@address.com</a></div></span></div>
 <h1 align="center">Table of Contents</h1>
<ul>

<a href="../PHPonTrax/tutorial_DateHelper.cls.html#intro">Introduction</a><br />

<a href="../PHPonTrax/tutorial_DateHelper.cls.html#low_level">Low Level Methods</a><br />

&nbsp;&nbsp;&nbsp;<a href="../PHPonTrax/tutorial_DateHelper.cls.html#low_level.low_level_arg1">First Argument: Date/Time Value</a><br />

&nbsp;&nbsp;&nbsp;<a href="../PHPonTrax/tutorial_DateHelper.cls.html#low_level.low_level_arg2">Second Argument: Output Format Options</a><br />

&nbsp;&nbsp;&nbsp;<a href="../PHPonTrax/tutorial_DateHelper.cls.html#low_level.low_level_composite">Composite Methods</a><br />

<a href="../PHPonTrax/tutorial_DateHelper.cls.html#high_level">High Level Methods</a><br />
</ul>

 <span><a name="intro"></a><h2 class="title">Introduction</h2><p>The <a href="../PHPonTrax/DateHelper.html">DateHelper</a> class provides a variety of utility
   methods to help construction of pulldown menus for dates and
   times.  Calls to DateHelper methods are generated by
   <a href="../PHPonTrax/ActiveRecordHelper.html#methodto_scaffold_tag">ActiveRecordHelper::to_scaffold_tag()</a> in response to the
   <code>php&nbsp;script/generate.php&nbsp;scaffold</code> console
   command.  The call generated for each data item is chosen based 
   on the data type reported by the database for the corresponding
   column.</p>

  <p>There are two main groups of methods in the DateHelper class:
   <ol><li>Low level methods that generate a menu with a name and
     options controlled by the arguments of the method
     call.</li>
    <li>High level methods that use the name of an
     <a href="../PHPonTrax/ActiveRecord.html">ActiveRecord</a> subclass and one of its attributes to
     reference the database for a value.  These methods use the
     information from the database to construct arguments, then call
     corresponding low level methods to generate the HTML.</li></ol></p>

  <p>DateHelper must be instantiated before its methods can be
   called. For each DateHelper method called from a form, there is a
   corresponding function that creates an instance of DateHelper then
   passes its arguments to the relevant method of that instance.
   These functions usually have the same name as the method they call,
   and the functions are grouped together in the
   <a href="../PHPonTrax/_vendor_trax_action_view_helpers_date_helper_php.html">date_helper.php</a> procedural file following the definition of
   the DateHelper class.</p></span>
 <span><a name="low_level"></a><h2 class="title">Low Level Methods</h2><p>There are six basic low level methods:
   <ul><li><a href="../PHPonTrax/DateHelper.html#methodselect_day">select_day()</a></li>
    <li><a href="../PHPonTrax/DateHelper.html#methodselect_hour">select_hour()</a></li>
    <li><a href="../PHPonTrax/DateHelper.html#methodselect_minute">select_minute()</a></li>
    <li><a href="../PHPonTrax/DateHelper.html#methodselect_month">select_month()</a></li>
    <li><a href="../PHPonTrax/DateHelper.html#methodselect_second">select_second()</a></li>
    <li><a href="../PHPonTrax/DateHelper.html#methodselect_year">select_year()</a></li></ul>
   Each of these methods accepts two arguments, both optional:

   <ol><li><span class="cmd-title">First Argument: Date/Time Value</span>
     <div class="cmd-synopsis"><p>When the browser user fills in a
     form and clicks the Submit button, the browser sends a POST
     <a href="http://en.wikipedia.org/wiki/HTTP">HTTP</a> message to the web
     server with the name and value of each field of the form.  When
     PHP processes the POST message it puts the name and value of each
     field of the message into global variable
     <a href="http://www.php.net/manual/en/reserved.variables.php#reserved.variables.request">$_REQUEST</a>
     before starting execution of the Trax application.  Therefore if
     a value for a field is present in $_REQUEST, it is because the
     user specifically entered that value, or accepted a value that
     was already there.  This information is assumed to be more valid
     than the date/time value in the argument, so if a value for this
     field is defined in $_REQUEST, that value is used and the
     argument is ignored.</p>

     <p>If there is no defined value for the field in $_REQUEST,
      then the argument is used to generate the initially selected
      value in the menu, or if the argument is also omitted, 
      the current date/time is initially
      selected.</p></div></li> 

    <li><span class="cmd-title">Second Argument: Output Format Options</span>
     <div class="cmd-synopsis">Specify the format of the HTML string returned by
     the method.  If omitted, the output will be
     in a default format.</div></li></ol>

   Each of these methods returns a character string containing HTML
   defining the pulldown menu as
   <pre class="example">&lt;select name=...&gt;
&lt;option value=...&gt; ... &lt;/option&gt;
&lt;option value=...&gt; ... &lt;/option&gt;
...
&lt;/select&gt;</pre>
   This character string is ready to be inserted directly into a page.</p>
  <a name="low_level.low_level_arg1"></a><h3 class="title">First Argument: Date/Time Value</h3><p>As mentioned above, if a DateHelper object is created as a
    result of a POST message, the values transmitted in the
    message will appear in $_REQUEST, so this value is assumed to be
    more valid than the argument value.</p>

   <p>However, the six low-level methods do not access this
    information directly from $_REQUEST.  Instead, they rely on the
    fact that
    <a href="../PHPonTrax/DateHelper.html#methodcheck_request_for_value">check_request_for_value()</a>
    was called previously to parse the contents of $_REQUEST and
    copy relevant values to instance variables named
    <code>$request_</code><span class = "tute-comment">typename</span><code>s</code>
    where <span class = "tute-comment">typename</span> is the type of
    time unit supported by the method (minute, month etc.).  The
    <code>$request_</code><span class = "tute-comment">typename</span><code>s</code>
    instance variables are arrays indexed by the name of the field, so
    that if there were two year selector fields named
    <code>start_year</code> and <code>end_year</code> in
    the POST message, <code>check_request_for_value()</code>
    would store their values in
    <code>$request_years['start_year']</code> and
    <code>$request_years['end_year']</code> respectively.</p>

   <p>At the time the DateHelper object is created, the name of the
    field that it processes is assigned to instance variable
    <a href="../PHPonTrax/Helpers.html#var$attribute_name">$attribute_name</a>.  So in the
    example of the two year fields named <code>start_year</code>
    and <code>end_year</code>, two DateHelper objects would be
    created, one with
    <code>$attribute_name = 'start_year'</code>
    and the other with
    <code>$attribute_name = 'end_year'</code>.  Usually this
    value is set in the object constructor call.  So when
    <code>select_year()</code> is called, it checks 
    <code>$this-&gt;request_years[$this-&gt;attribute_name]</code>
    to see if the user specified an initial value for the
    field whose name is in <code>$attribute_name</code>.
.</p>

  <p>If the method finds no value in
   <code>$request_</code><span class = "tute-comment">typename</span><code>s</code>,
   it examines the first argument.  Two types of value are
   legitimate for this argument: a string of decimal digits of exactly
   the right length and value, and a date/time description in any of
   the formats accepted by <a href="http://www.php.net/strtotime">http://www.php.net/strtotime</a>.
   It is often most practical to use a single date/time value for all 
   <code>select_</code><span class = "tute-comment">typename</span><code>()</code>
   calls, usually the SQL format
   <code>YYYY-MM-DD&nbsp;HH:MM:SS</code>.
   Given an argument value in this format, the method extracts that
   part of the argument applicable to its type.  For example:
<pre class="example">$datetime = '1997-10-23 17:46:57';
select_month($datetime);
select_day($datetime);
select_year($datetime);</pre>
    would create three menus, a month menu with initial value 'October',
    a day menu with initial value '23' and a year menu with initial
    value '1997'.</p>

  <p>The options available on each menu of course depend on the
   type. A month menu always has twelve months, a day menu always has
   31 days and so forth.  In the case of the year menu, there are a
   potentially infinite number of possible years, so the default is to
   generate options in the range of the initial value plus or
   minus five years.  The range can be changed with the second
   argument.</p><hr />
  <a name="low_level.low_level_arg2"></a><h3 class="title">Second Argument: Output Format Options</h3><p>The second argument to a low-level method call is an array
    in which each key is a character string naming an option, and the
    value assigned to that key is the option value, which may be either a
    character string or boolean value depending on the option.</p>

   <p>Certain options are available for all method types.  One such
    option is <code>include_blank</code>.  This governs whether
    or not there is a blank as one option of the menu. The default
    value is <code>'include_blank'=&gt;false</code> which prevents
    the blank line.  You can specify
    <code>'include_blank'=&gt;true</code> in your options array to
    cause a blank line to appear as an option.  Unfortunately there is
    currently no way to choose that as the initially selected value,
    nor to insert a line with a character string value such as
    <code>--Select--</code>.</p>

   <p>Three options, also available for all method types, combine
    to set the value of the <code>name</code> attribute of the
    output <code>&lt;select&gt;</code>.  They are
    <code>prefix</code>, 
    <code>field_name</code> and
    <code>discard_type</code>.  The default combination is
    <code>'prefix'=&gt;null</code>,
    <code>'discard_type'=&gt;false</code> and 
    <code>'field_name'=&gt;</code><span class = "tute-comment">typename</span>.
    The type of <code>select_year()</code> is
    <code>'year'</code>, so the method call
    <code>select_year();</code> is equivalent to 
    <code>select_year(null,array('prefix'=&gt;null,'discard_type'=&gt;false,
    'field_name'=&gt;'year'));</code> which generates as  output
    <code>&lt;select&nbsp;name=&quot;year&quot;&gt;...&lt;/select&gt;</code>.</p>

   <p>A simple change is to replace the default name, so
    <code>select_year(null,array('field_name'=&gt;'start_year'));</code>
    will generate
    <code>&lt;select&nbsp;name=&quot;start_year&quot;&gt;...&lt;/select&gt;</code>.</p>

   <p>It is also possible to insert a prefix before the name.  The
    simplest case is to insert the prefix while maintaining the
    default name: 
    <code>select_year(null,array('prefix'=&gt;'start_date'));</code>
    will generate
    <code>&lt;select&nbsp;name=&quot;start_date[year]&quot;&gt;...&lt;/select&gt;</code>.
    This is a handy way to assign related names to several date/time fields.</p>

   <p>Finally it is possible to have the prefix replace the name
    completely.  This is done with the
    <code>'discard_type'</code> option, which prevents output of
    the value of the
    <code>'field_name'</code> option.  So the method call
    <code>select_year(null,array('prefix'=&gt;'start_date','discard_type'=&gt;true));</code>
    will generate
    <code>&lt;select&nbsp;name=&quot;start_date&quot;&gt;...&lt;/select&gt;</code>.</p>    

    <p>start_year, end_year for select_year()</p><hr />

  <a name="low_level.low_level_composite"></a><h3 class="title">Composite Methods</h3><p>Combine or specialize calls to low level methods</p>
   <ul><li><a href="../PHPonTrax/DateHelper.html#methodselect_date">select_date()</a></li>
    <li><a href="../PHPonTrax/DateHelper.html#methodselect_datetime">      select_datetime()</a></li>
    <li><a href="../PHPonTrax/DateHelper.html#methodselect_expiration_date">      select_expiration_date()</a></li>
    <li><a href="../PHPonTrax/DateHelper.html#methodselect_time">select_time()</a></li></ul>
    <p>options:field_separator on to_date_select_tag(). 
     Discard components</p><hr /></span>

 <span><a name="high_level"></a><h2 class="title">High Level Methods</h2><p>Use model data as arguments for low level methods.  Page calls
   function which creates DateHelper object and calls method</p>
  <p>All use <a href="../PHPonTrax/DateHelper.html#methodvalue">DateHelper::value()</a> to get data from model</p>
   <ul><li><a href="../PHPonTrax/_vendor_trax_action_view_helpers_date_helper_php.html#functiondatetime_select">datetime_select() function</a>
     calls <a href="../PHPonTrax/DateHelper.html#methoddatetime_select">datetime_select()       method</a></li>
    <li><a href="../PHPonTrax/_vendor_trax_action_view_helpers_date_helper_php.html#functiondate_select">date_select() function</a> calls
     <a href="../PHPonTrax/DateHelper.html#methoddate_select">date_select() method</a></li>
    <li><a href="../PHPonTrax/_vendor_trax_action_view_helpers_date_helper_php.html#functionexpiration_date_select">expiration_date_select()       function</a> calls <a href="../PHPonTrax/DateHelper.html#methodexpiration_date_select">      expiration_date_select() method</a></li>
    <li><a href="../PHPonTrax/_vendor_trax_action_view_helpers_date_helper_php.html#functiontime_select">time_select() function</a>
     calls <a href="../PHPonTrax/DateHelper.html#methodtime_select">time_select()       method</a></li>
    <li><a href="../PHPonTrax/_vendor_trax_action_view_helpers_date_helper_php.html#functionyear_select">year_select() function</a>
     calls <a href="../PHPonTrax/DateHelper.html#methodyear_select">year_select()       method</a></li></ul></span></div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="../PHPonTrax/tutorial_ActiveRecord.cls.html">Prev</a></td>
<td width="34%" align="center" valign="top">&nbsp;</td>
<td width="33%" align="right" valign="top"><a href=
"../PHPonTrax/tutorial_Router.cls.html">Next</a></td>
</tr>

<tr>
<td width="33%" align="left" valign="top">ActiveRecord</td>
<td width="34%" align="center" valign="top"></td>
<td width="33%" align="right" valign="top">Router</td>
</tr>
</table>
        <div class="credit">
		    <hr />
		    Documentation generated on Thu, 04 May 2006 19:46:55 -0600 by <a href="http://www.phpdoc.org">phpDocumentor 1.3.0RC4</a>
	      </div>
      </td></tr></table>
    </td>
  </tr>
</table>

</body>
</html>
Return current item: PHP on Trax