本文整理汇总了PHP中TButton::setCommandName方法的典型用法代码示例。如果您正苦于以下问题:PHP TButton::setCommandName方法的具体用法?PHP TButton::setCommandName怎么用?PHP TButton::setCommandName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TButton
的用法示例。
在下文中一共展示了TButton::setCommandName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createPagerButton
/**
* Creates a pager button.
* Depending on the button type, a TLinkButton or a TButton may be created.
* If it is enabled (clickable), its command name and parameter will also be set.
* Derived classes may override this method to create additional types of buttons, such as TImageButton.
* @param string button type, either LinkButton or PushButton
* @param boolean whether the button should be enabled
* @param string caption of the button.
* @param string CommandName corresponding to the OnCommand event of the button.
* @param string CommandParameter corresponding to the OnCommand event of the button
* @return mixed the button instance
*/
protected function createPagerButton($buttonType, $enabled, $text, $commandName, $commandParameter)
{
if ($buttonType === TPagerButtonType::LinkButton) {
if ($enabled) {
$button = new TLinkButton();
} else {
$button = new TLabel();
$button->setText($text);
return $button;
}
} else {
if ($buttonType === TPagerButtonType::ImageButton) {
$button = new TImageButton();
$button->setImageUrl($this->getPageImageUrl($text, $commandName));
} else {
$button = new TButton();
}
if (!$enabled) {
$button->setEnabled(false);
}
}
$button->setText($text);
$button->setCommandName($commandName);
$button->setCommandParameter($commandParameter);
$button->setCausesValidation(false);
return $button;
}
示例2: createPagerButton
/**
* Creates a pager button.
* Depending on the button type, a TLinkButton or a TButton may be created.
* If it is enabled (clickable), its command name and parameter will also be set.
* Derived classes may override this method to create additional types of buttons, such as TImageButton.
* @param mixed the container pager instance of TActiveDatagridPager
* @param string button type, either LinkButton or PushButton
* @param boolean whether the button should be enabled
* @param string caption of the button
* @param string CommandName corresponding to the OnCommand event of the button
* @param string CommandParameter corresponding to the OnCommand event of the button
* @return mixed the button instance
*/
protected function createPagerButton($pager, $buttonType, $enabled, $text, $commandName, $commandParameter)
{
if ($buttonType === TDataGridPagerButtonType::LinkButton) {
if ($enabled) {
$button = new TLinkButton();
} else {
$button = new TLabel();
$button->setText($text);
return $button;
}
} else {
$button = new TButton();
if (!$enabled) {
$button->setEnabled(false);
}
}
$button->setText($text);
$button->setCommandName($commandName);
$button->setCommandParameter($commandParameter);
$button->setCausesValidation(false);
return $button;
}