本文整理汇总了PHP中DateHelper::year_select方法的典型用法代码示例。如果您正苦于以下问题:PHP DateHelper::year_select方法的具体用法?PHP DateHelper::year_select怎么用?PHP DateHelper::year_select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateHelper
的用法示例。
在下文中一共展示了DateHelper::year_select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testYear_select_method
/**
* Test year_select() method
*
* Test {@link DateHelper::year_select()} method
*/
public function testYear_select_method()
{
$dh = new DateHelper('foo', 'bar');
$dh->controller_object = new ActionController();
$ar = new ActiveRecord();
$dh->controller_object->foo = $ar;
// With no value in $_REQUEST, data should be
// retrieved from the the ActiveRecord
$ar->expect_query("bar", "1999");
$this->assertEquals('<select name="foo[bar(1i)]">' . "\n" . '<option value="1994">1994</option>' . "\n" . '<option value="1995">1995</option>' . "\n" . '<option value="1996">1996</option>' . "\n" . '<option value="1997">1997</option>' . "\n" . '<option value="1998">1998</option>' . "\n" . '<option value="1999" selected="selected">1999</option>' . "\n" . '<option value="2000">2000</option>' . "\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" . '</select>' . "\n", $dh->year_select());
// Get year from $_REQUEST, default all options
$_REQUEST['foo']['bar(1i)'] = '2004';
$this->assertEquals('<select name="foo[bar(1i)]">' . "\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" . '<option value="2003">2003</option>' . "\n" . '<option value="2004" selected="selected">2004</option>' . "\n" . '<option value="2005">2005</option>' . "\n" . '<option value="2006">2006</option>' . "\n" . '<option value="2007">2007</option>' . "\n" . '<option value="2008">2008</option>' . "\n" . '<option value="2009">2009</option>' . "\n" . '</select>' . "\n", $dh->year_select());
}
示例2: year_select
/**
* Make a new DateHelper object and call its year_select() method
* @param string Name of an ActiveRecord subclass
* @param string Name of an attribute of $object
* @param mixed[] Format options
* @uses DateHelper::year_select()
* @see ActiveRecordHelper::to_scaffold_tag()
*/
function year_select($object, $attribute, $options = array())
{
$date_helper = new DateHelper($object, $attribute);
return $date_helper->year_select($options);
}