本文整理匯總了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);
}