本文整理汇总了PHP中Select::setClass方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::setClass方法的具体用法?PHP Select::setClass怎么用?PHP Select::setClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Select
的用法示例。
在下文中一共展示了Select::setClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* __construct
*
* @param string $caption caption
* @param string $name name
* @param integer $size size
* @param integer $value value unix timestamp
* @param boolean $showtime true to show time, false for date only
*/
public function __construct($caption, $name, $size = 2, $value = 0, $showtime = true)
{
parent::__construct($caption, '');
$value = (int) $value;
$value = $value > 0 ? $value : time();
$datetime = getdate($value);
$date = new DateSelect('', $name . '[date]', $size, $value);
$date->setAttribute('id', $name . '-date');
$this->addElement($date);
if ($showtime) {
$timearray = array();
for ($i = 0; $i < 24; ++$i) {
for ($j = 0; $j < 60; $j = $j + 10) {
$key = $i * 3600 + $j * 60;
$timearray[$key] = $j != 0 ? $i . ':' . $j : $i . ':0' . $j;
}
}
ksort($timearray);
$timeselect = new Select('', $name . '[time]', $datetime['hours'] * 3600 + 600 * ceil($datetime['minutes'] / 10));
$timeselect->setAttribute('id', $name . '-time');
$timeselect->addOptionArray($timearray);
$timeselect->setClass('span2');
$this->addElement($timeselect);
} else {
$this->addElement(new Hidden($name . '[time]', 0));
}
}
示例2: testVerificaSeOsDadosForamInseridos
public function testVerificaSeOsDadosForamInseridos()
{
$select = new Select();
$select->setId("selectCat");
$select->setName("categoria");
$select->setClass("form-control");
$select->setProtected("protected");
$select->setLabel("Categoria");
$select->setAlert("Erro no field.");
$this->assertEquals("selectCat", $select->getId());
$this->assertEquals("categoria", $select->getName());
$this->assertEquals("form-control", $select->getClass());
$this->assertEquals("protected", $select->getProtected());
$this->assertEquals("Categoria", $select->getLabel());
$this->assertEquals("Erro no field.", $select->getAlert());
}