当前位置: 首页>>代码示例>>PHP>>正文


PHP DateHelper::select_year方法代码示例

本文整理汇总了PHP中DateHelper::select_year方法的典型用法代码示例。如果您正苦于以下问题:PHP DateHelper::select_year方法的具体用法?PHP DateHelper::select_year怎么用?PHP DateHelper::select_year使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateHelper的用法示例。


在下文中一共展示了DateHelper::select_year方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_DateHelper


//.........这里部分代码省略.........
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37" selected="selected">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>

<option value="41">41</option>
<option value="42">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>

<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="57">57</option>
<option value="58">58</option>

<option value="59">59</option>
</select>'), array(''))));
        //$ActiveRecord->tally();
        $date = '1978-06-16 12:20:30';
        $this->assertEqual(join(array_diff(explode("\n", DateHelper::select_datetime($date) . DateHelper::select_date($date) . DateHelper::select_time($date) . DateHelper::select_second($date) . DateHelper::select_minute($date) . DateHelper::select_hour($date) . DateHelper::select_day($date) . DateHelper::select_month($date) . DateHelper::select_year($date)), array(''))), join(array_diff(explode("\n", '<select name="dateyear">
<option value="1973">1973</option>
<option value="1974">1974</option>
<option value="1975">1975</option>

<option value="1976">1976</option>
<option value="1977">1977</option>
<option value="1978" selected="selected">1978</option>
<option value="1979">1979</option>
<option value="1980">1980</option>
<option value="1981">1981</option>
<option value="1982">1982</option>
<option value="1983">1983</option>
</select>

<select name="datemonth">
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March</option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June" selected="selected">June</option>
<option value="July">July</option>
<option value="August">August</option>

<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
<select name="dateday">
<option value="1">1</option>
<option value="2">2</option>
开发者ID:joeymetal,项目名称:v1,代码行数:67,代码来源:date_helper.php

示例2: select_datetime

 /**
  * Returns a set of html select-tags (one for year, month, day, hour, and minute) pre-selected with the +datetime+.
  */
 function select_datetime($datetime = null, $options = array())
 {
     $datetime = empty($datetime) ? Ak::getDate() : $datetime;
     return DateHelper::select_year($datetime, $options) . DateHelper::select_month($datetime, $options) . DateHelper::select_day($datetime, $options) . DateHelper::select_hour($datetime, $options) . DateHelper::select_minute($datetime, $options);
 }
开发者ID:joeymetal,项目名称:v1,代码行数:8,代码来源:date_helper.php

示例3: to_date_tag

 function to_date_tag()
 {
     require_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . 'date_helper.php';
     $defaults = $this->default_date_options;
     $date = $this->getValue();
     $date = !empty($date) ? $date : Ak::getDate();
     return DateHelper::select_day($date, array_merge($defaults, array('prefix' => "{$this->object_name}[{$this->_column_name}(3)]"))) . DateHelper::select_month($date, array_merge($defaults, array('prefix' => "{$this->object_name}[{$this->_column_name}(2)]"))) . DateHelper::select_year($date, array_merge($defaults, array('prefix' => "{$this->object_name}[{$this->_column_name}(1)]")));
 }
开发者ID:joeymetal,项目名称:v1,代码行数:8,代码来源:form_helper.php

示例4: testSelect_year

 /**
  *  Test select_year() method
  *
  *  Test {@link DateHelper::select_year()}
  */
 public function testSelect_year()
 {
     $dh = new DateHelper();
     //  Test generation with all arguments omitted
     $this->assertContains('selected="selected">' . date('Y'), $dh->select_year());
     //  Specify year in digits, default all options
     $this->assertEquals('<select name="year">' . "\n" . '<option value="2001">2001</option>' . "\n" . '<option value="2002">2002</option>' . "\n" . '<option value="2003">2003</option>' . "\n" . '<option value="2004">2004</option>' . "\n" . '<option value="2005">2005</option>' . "\n" . '<option value="2006"  selected="selected">2006</option>' . "\n" . '<option value="2007">2007</option>' . "\n" . '<option value="2008">2008</option>' . "\n" . '<option value="2009">2009</option>' . "\n" . '<option value="2010">2010</option>' . "\n" . '<option value="2011">2011</option>' . "\n" . '</select>' . "\n", $dh->select_year('2006'));
     //  Specify year in English, default all options
     $this->assertEquals('<select name="year">' . "\n" . '<option value="1992">1992</option>' . "\n" . '<option value="1993">1993</option>' . "\n" . '<option value="1994">1994</option>' . "\n" . '<option value="1995">1995</option>' . "\n" . '<option value="1996">1996</option>' . "\n" . '<option value="1997"  selected="selected">1997</option>' . "\n" . '<option value="1998">1998</option>' . "\n" . '<option value="1999">1999</option>' . "\n" . '<option value="2000">2000</option>' . "\n" . '<option value="2001">2001</option>' . "\n" . '<option value="2002">2002</option>' . "\n" . '</select>' . "\n", $dh->select_year('September 12, 1997'));
     //  Specify year in digits, option 'start_year' => '2003'
     $this->assertEquals('<select name="year">' . "\n" . '<option value="2003">2003</option>' . "\n" . '<option value="2004">2004</option>' . "\n" . '<option value="2005">2005</option>' . "\n" . '<option value="2006"  selected="selected">2006</option>' . "\n" . '<option value="2007">2007</option>' . "\n" . '<option value="2008">2008</option>' . "\n" . '<option value="2009">2009</option>' . "\n" . '<option value="2010">2010</option>' . "\n" . '<option value="2011">2011</option>' . "\n" . '</select>' . "\n", $dh->select_year('2006', array('start_year' => 2003)));
     //  Specify year in digits, option 'end_year' => '2009'
     $this->assertEquals('<select name="year">' . "\n" . '<option value="2001">2001</option>' . "\n" . '<option value="2002">2002</option>' . "\n" . '<option value="2003">2003</option>' . "\n" . '<option value="2004">2004</option>' . "\n" . '<option value="2005">2005</option>' . "\n" . '<option value="2006"  selected="selected">2006</option>' . "\n" . '<option value="2007">2007</option>' . "\n" . '<option value="2008">2008</option>' . "\n" . '<option value="2009">2009</option>' . "\n" . '</select>' . "\n", $dh->select_year('2006', array('end_year' => '2009')));
     //  Specify year in digits, option 'field_name' => 'tax_year'
     $this->assertEquals('<select name="tax_year">' . "\n" . '<option value="2001">2001</option>' . "\n" . '<option value="2002">2002</option>' . "\n" . '<option value="2003">2003</option>' . "\n" . '<option value="2004">2004</option>' . "\n" . '<option value="2005">2005</option>' . "\n" . '<option value="2006"  selected="selected">2006</option>' . "\n" . '<option value="2007">2007</option>' . "\n" . '<option value="2008">2008</option>' . "\n" . '<option value="2009">2009</option>' . "\n" . '<option value="2010">2010</option>' . "\n" . '<option value="2011">2011</option>' . "\n" . '</select>' . "\n", $dh->select_year('2006', array('field_name' => 'tax_year')));
     //  Specify year in English, default all options
     $this->assertEquals('<select name="year">' . "\n" . '<option value="2001">2001</option>' . "\n" . '<option value="2002">2002</option>' . "\n" . '<option value="2003">2003</option>' . "\n" . '<option value="2004">2004</option>' . "\n" . '<option value="2005">2005</option>' . "\n" . '<option value="2006"  selected="selected">2006</option>' . "\n" . '<option value="2007">2007</option>' . "\n" . '<option value="2008">2008</option>' . "\n" . '<option value="2009">2009</option>' . "\n" . '<option value="2010">2010</option>' . "\n" . '<option value="2011">2011</option>' . "\n" . '</select>' . "\n", $dh->select_year('November 9, 2006'));
     //  Specify year in digits, reverse start and end years
     $this->assertEquals('<select name="year">' . "\n" . '<option value="2009">2009</option>' . "\n" . '<option value="2008">2008</option>' . "\n" . '<option value="2007">2007</option>' . "\n" . '<option value="2006"  selected="selected">2006</option>' . "\n" . '<option value="2005">2005</option>' . "\n" . '<option value="2004">2004</option>' . "\n" . '<option value="2003">2003</option>' . "\n" . '</select>' . "\n", $dh->select_year('2006', array('start_year' => '2009', 'end_year' => '2003')));
     //  Specify year in digits and override with $request_years
     $dh->attribute_name = 'sometime';
     $dh->request_years = array('sometime' => '2002');
     $this->assertEquals('<select name="year">' . "\n" . '<option value="1997">1997</option>' . "\n" . '<option value="1998">1998</option>' . "\n" . '<option value="1999">1999</option>' . "\n" . '<option value="2000">2000</option>' . "\n" . '<option value="2001">2001</option>' . "\n" . '<option value="2002"  selected="selected">2002</option>' . "\n" . '<option value="2003">2003</option>' . "\n" . '<option value="2004">2004</option>' . "\n" . '<option value="2005">2005</option>' . "\n" . '<option value="2006">2006</option>' . "\n" . '<option value="2007">2007</option>' . "\n" . '</select>' . "\n", $dh->select_year('2006'));
 }
开发者ID:phpontrax,项目名称:trax,代码行数:29,代码来源:DateHelperTest.php

示例5: test_should_add_id_into_select

 public function test_should_add_id_into_select()
 {
     $this->assertEqual(DateHelper::select_year('', array('id' => 'year_id', 'prompt' => '-- Select --', 'start_year' => 2008, 'end_year' => 2011)), file_get_contents(HelperUnitTest::getFixturesDir() . DS . 'date_helper_select_year_with_id.txt'));
 }
开发者ID:bermi,项目名称:akelos,代码行数:4,代码来源:date_helper.php

示例6: test_select_year

 function test_select_year()
 {
     $this->assertEqual(DateHelper::select_year($this->date), file_get_contents(AK_TEST_HELPERS_DIR . DS . 'date_helper_select_year.txt'));
     $this->assertEqual(DateHelper::select_year($this->date, array('start_year' => 1950, 'end_year' => 2010)), file_get_contents(AK_TEST_HELPERS_DIR . DS . 'date_helper_select_year_options.txt'));
     $this->assertEqual(DateHelper::select_year($this->date, array('start_year' => 2010, 'end_year' => 1950)), file_get_contents(AK_TEST_HELPERS_DIR . DS . 'date_helper_select_year_options_reverse.txt'));
     $this->assertEqual(DateHelper::select_year($this->date, array('start_year' => 1980, 'end_year' => 1990)), file_get_contents(AK_TEST_HELPERS_DIR . DS . 'date_helper_select_year_options_out_of_range.txt'));
 }
开发者ID:joeymetal,项目名称:v1,代码行数:7,代码来源:date_helper.php

示例7: test_should_add_id_into_select

 function test_should_add_id_into_select()
 {
     $this->assertEqual(DateHelper::select_year('', array('id'=>'year_id','prompt'=>'-- Select --', 'start_year'=>2008, 'end_year'=>2011)),file_get_contents(AK_TEST_HELPERS_DIR.DS.'date_helper_select_year_with_id.txt'));
 }
开发者ID:joeymetal,项目名称:v1,代码行数:4,代码来源:date_helper.php


注:本文中的DateHelper::select_year方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。