本文整理汇总了PHP中DateHelper::datetime_select方法的典型用法代码示例。如果您正苦于以下问题:PHP DateHelper::datetime_select方法的具体用法?PHP DateHelper::datetime_select怎么用?PHP DateHelper::datetime_select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateHelper
的用法示例。
在下文中一共展示了DateHelper::datetime_select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDatetime_select_method
/**
* Test datetime_select() method
*
* Test the {@link DateHelper::datetime_select()} method
*/
public function testDatetime_select_method()
{
$dh = new DateHelper('Person', 'birth');
$dh->controller_object = new ActionController();
$ar = new ActiveRecord();
$dh->controller_object->Person = $ar;
// With no value in $_REQUEST, data should be
// retrieved from the the ActiveRecord
$ar->expect_query("birth", "2001-07-05 11:30:45");
$this->assertEquals('<select name="Person[birth(1i)]">' . "\n" . '<option value="1996">1996</option>' . "\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" selected="selected">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">2006</option>' . "\n" . '</select>' . "\n" . '<select name="Person[birth(2i)]">' . "\n" . '<option value="01">January</option>' . "\n" . '<option value="02">February</option>' . "\n" . '<option value="03">March</option>' . "\n" . '<option value="04">April</option>' . "\n" . '<option value="05">May</option>' . "\n" . '<option value="06">June</option>' . "\n" . '<option value="07" selected="selected">July</option>' . "\n" . '<option value="08">August</option>' . "\n" . '<option value="09">September</option>' . "\n" . '<option value="10">October</option>' . "\n" . '<option value="11">November</option>' . "\n" . '<option value="12">December</option>' . "\n" . '</select>' . "\n" . '<select name="Person[birth(3i)]">' . "\n" . '<option value="01">01</option>' . "\n" . '<option value="02">02</option>' . "\n" . '<option value="03">03</option>' . "\n" . '<option value="04">04</option>' . "\n" . '<option value="05" selected="selected">05</option>' . "\n" . '<option value="06">06</option>' . "\n" . '<option value="07">07</option>' . "\n" . '<option value="08">08</option>' . "\n" . '<option value="09">09</option>' . "\n" . '<option value="10">10</option>' . "\n" . '<option value="11">11</option>' . "\n" . '<option value="12">12</option>' . "\n" . '<option value="13">13</option>' . "\n" . '<option value="14">14</option>' . "\n" . '<option value="15">15</option>' . "\n" . '<option value="16">16</option>' . "\n" . '<option value="17">17</option>' . "\n" . '<option value="18">18</option>' . "\n" . '<option value="19">19</option>' . "\n" . '<option value="20">20</option>' . "\n" . '<option value="21">21</option>' . "\n" . '<option value="22">22</option>' . "\n" . '<option value="23">23</option>' . "\n" . '<option value="24">24</option>' . "\n" . '<option value="25">25</option>' . "\n" . '<option value="26">26</option>' . "\n" . '<option value="27">27</option>' . "\n" . '<option value="28">28</option>' . "\n" . '<option value="29">29</option>' . "\n" . '<option value="30">30</option>' . "\n" . '<option value="31">31</option>' . "\n" . '</select>' . "\n" . ' — <select name="Person[birth(4i)]">' . "\n" . '<option value="00">00</option>' . "\n" . '<option value="01">01</option>' . "\n" . '<option value="02">02</option>' . "\n" . '<option value="03">03</option>' . "\n" . '<option value="04">04</option>' . "\n" . '<option value="05">05</option>' . "\n" . '<option value="06">06</option>' . "\n" . '<option value="07">07</option>' . "\n" . '<option value="08">08</option>' . "\n" . '<option value="09">09</option>' . "\n" . '<option value="10">10</option>' . "\n" . '<option value="11" selected="selected">11</option>' . "\n" . '<option value="12">12</option>' . "\n" . '<option value="13">13</option>' . "\n" . '<option value="14">14</option>' . "\n" . '<option value="15">15</option>' . "\n" . '<option value="16">16</option>' . "\n" . '<option value="17">17</option>' . "\n" . '<option value="18">18</option>' . "\n" . '<option value="19">19</option>' . "\n" . '<option value="20">20</option>' . "\n" . '<option value="21">21</option>' . "\n" . '<option value="22">22</option>' . "\n" . '<option value="23">23</option>' . "\n" . '</select>' . "\n" . ' : <select name="Person[birth(5i)]">' . "\n" . '<option value="00">00</option>' . "\n" . '<option value="01">01</option>' . "\n" . '<option value="02">02</option>' . "\n" . '<option value="03">03</option>' . "\n" . '<option value="04">04</option>' . "\n" . '<option value="05">05</option>' . "\n" . '<option value="06">06</option>' . "\n" . '<option value="07">07</option>' . "\n" . '<option value="08">08</option>' . "\n" . '<option value="09">09</option>' . "\n" . '<option value="10">10</option>' . "\n" . '<option value="11">11</option>' . "\n" . '<option value="12">12</option>' . "\n" . '<option value="13">13</option>' . "\n" . '<option value="14">14</option>' . "\n" . '<option value="15">15</option>' . "\n" . '<option value="16">16</option>' . "\n" . '<option value="17">17</option>' . "\n" . '<option value="18">18</option>' . "\n" . '<option value="19">19</option>' . "\n" . '<option value="20">20</option>' . "\n" . '<option value="21">21</option>' . "\n" . '<option value="22">22</option>' . "\n" . '<option value="23">23</option>' . "\n" . '<option value="24">24</option>' . "\n" . '<option value="25">25</option>' . "\n" . '<option value="26">26</option>' . "\n" . '<option value="27">27</option>' . "\n" . '<option value="28">28</option>' . "\n" . '<option value="29">29</option>' . "\n" . '<option value="30" selected="selected">30</option>' . "\n" . '<option value="31">31</option>' . "\n" . '<option value="32">32</option>' . "\n" . '<option value="33">33</option>' . "\n" . '<option value="34">34</option>' . "\n" . '<option value="35">35</option>' . "\n" . '<option value="36">36</option>' . "\n" . '<option value="37">37</option>' . "\n" . '<option value="38">38</option>' . "\n" . '<option value="39">39</option>' . "\n" . '<option value="40">40</option>' . "\n" . '<option value="41">41</option>' . "\n" . '<option value="42">42</option>' . "\n" . '<option value="43">43</option>' . "\n" . '<option value="44">44</option>' . "\n" . '<option value="45">45</option>' . "\n" . '<option value="46">46</option>' . "\n" . '<option value="47">47</option>' . "\n" . '<option value="48">48</option>' . "\n" . '<option value="49">49</option>' . "\n" . '<option value="50">50</option>' . "\n" . '<option value="51">51</option>' . "\n" . '<option value="52">52</option>' . "\n" . '<option value="53">53</option>' . "\n" . '<option value="54">54</option>' . "\n" . '<option value="55">55</option>' . "\n" . '<option value="56">56</option>' . "\n" . '<option value="57">57</option>' . "\n" . '<option value="58">58</option>' . "\n" . '<option value="59">59</option>' . "\n" . '</select>' . "\n", $dh->datetime_select());
}
示例2: MockAkActiveRecord
//.........这里部分代码省略.........
$this->assertEqual(join(array_diff(explode("\n", $DateHelper->date_select('person', 'date', array('include_blank' => true, 'discard_day' => true, 'order' => array('month', 'year')))), array(''))), join(array_diff(explode("\n", '<select name="person[date(2i)]">
<option value=""></option>
<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="person[date(1i)]">
<option value=""></option>
<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>'), array(''))));
$this->assertEqual(join(array_diff(explode("\n", $DateHelper->datetime_select('person', 'date')), array(''))), join(array_diff(explode("\n", '<select name="person[date(1i)]">
<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="person[date(2i)]">
<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="person[date(3i)]">
<option value="1">1</option>
示例3: datetime_select
/**
* Make a new DateHelper object and call its datetime_select() method
* @param string Name of an ActiveRecord subclass
* @param string Name of an attribute of $object
* @param mixed[] Format options
* @uses DateHelper::datetime_select()
* @see ActiveRecordHelper::to_scaffold_tag()
*/
function datetime_select($object, $attribute, $options = array())
{
$date_helper = new DateHelper($object, $attribute);
return $date_helper->datetime_select($options);
}