本文整理汇总了PHP中QButton::AddAction方法的典型用法代码示例。如果您正苦于以下问题:PHP QButton::AddAction方法的具体用法?PHP QButton::AddAction怎么用?PHP QButton::AddAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QButton
的用法示例。
在下文中一共展示了QButton::AddAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($objParentObject, $strControlId = null, StewardshipBatch $objBatch, StewardshipStack $objStack = null, $strUrlHashArgument1 = null, $strUrlHashArgument2 = null, $strUrlHashArgument3 = null)
{
try {
parent::__construct($objParentObject, $strControlId);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
$this->strTemplate = dirname(__FILE__) . '/' . get_class($this) . '.tpl.php';
$this->objBatch = $objBatch;
$this->objStack = $objStack;
$this->strUrlHashArgument = $strUrlHashArgument1;
$this->strUrlHashArgument2 = $strUrlHashArgument2;
$this->strUrlHashArgument3 = $strUrlHashArgument3;
$this->btnSave = new QButton($this);
$this->btnSave->Text = 'Save';
$this->btnSave->CssClass = 'primary';
$this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
$this->btnSave->CausesValidation = $this;
$this->btnCancel = new QLinkButton($this);
$this->btnCancel->Text = 'Cancel';
$this->btnCancel->CssClass = 'cancel';
$this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click'));
$this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction());
$this->SetupPanel();
}
示例2: dtg_ButtonRender
public function dtg_ButtonRender($item)
{
$strControl = new QButton($this);
$strControl->Text = 'Button';
$strControl->ActionParameter = $item;
$strControl->AddAction(new QClickEvent(), new QServerAction('btn_click'));
return $strControl->Render(false);
}
示例3: Form_Create
protected function Form_Create()
{
// default legacy protection, will throw an exception
$this->txtTextbox1 = new QTextbox($this);
$this->txtTextbox1->Text = 'Hello!';
$this->txtTextbox1->Width = 500;
$this->lblLabel1 = new QLabel($this);
$this->lblLabel1->HtmlEntities = false;
$this->lblLabel1->Text = "";
$this->btnButton1 = new QButton($this);
$this->btnButton1->Text = "Parse and Display";
$this->btnButton1->AddAction(new QClickEvent(), new QAjaxAction('btnButton1_Click'));
// htmlentities mode
$this->txtTextbox2 = new QTextbox($this);
$this->txtTextbox2->CrossScripting = QCrossScripting::HtmlEntities;
$this->txtTextbox2->Text = 'Hello! <script>alert("I am an evil attacker.")</script>';
$this->txtTextbox2->Width = 500;
$this->lblLabel2 = new QLabel($this);
$this->lblLabel2->Text = "";
$this->btnButton2 = new QButton($this);
$this->btnButton2->Text = "Parse and Display";
$this->btnButton2->AddAction(new QClickEvent(), new QAjaxAction('btnButton2_Click'));
// full protection with the HTMLPurifier defaults
$this->txtTextbox3 = new QTextbox($this);
$this->txtTextbox3->CrossScripting = QCrossScripting::HTMLPurifier;
$this->txtTextbox3->Text = 'Hello! <script>alert("I am an evil attacker.")</script>';
$this->txtTextbox3->Width = 500;
$this->lblLabel3 = new QLabel($this);
$this->lblLabel3->Text = "";
$this->btnButton3 = new QButton($this);
$this->btnButton3->Text = "Parse and Display";
$this->btnButton3->AddAction(new QClickEvent(), new QAjaxAction('btnButton3_Click'));
// full protection with an allowed list of tags
$this->txtTextbox4 = new QTextbox($this);
$this->txtTextbox4->CrossScripting = QCrossScripting::HTMLPurifier;
$this->txtTextbox4->SetPurifierConfig("HTML.Allowed", "b,strong,i,em,img[src]");
$this->txtTextbox4->Text = 'Hello! <script>alert("I am an evil attacker.")</script><b>Hello</b> <i>again</i>!';
$this->txtTextbox4->Width = 500;
$this->lblLabel4 = new QLabel($this);
$this->lblLabel4->HtmlEntities = false;
$this->lblLabel4->Text = "";
$this->btnButton4 = new QButton($this);
$this->btnButton4->Text = "Parse and Display";
$this->btnButton4->AddAction(new QClickEvent(), new QAjaxAction('btnButton4_Click'));
// the textbox won't have the XSS protection!
$this->txtTextbox5 = new QTextbox($this);
$this->txtTextbox5->CrossScripting = QCrossScripting::Allow;
$this->txtTextbox5->Text = 'Hello! <script>alert("I am an evil attacker.")</script><b>Hello</b> again!';
$this->txtTextbox5->Width = 500;
$this->lblLabel5 = new QLabel($this);
$this->lblLabel5->HtmlEntities = false;
$this->lblLabel5->Text = "";
$this->btnButton5 = new QButton($this);
$this->btnButton5->Text = "Parse and Display";
$this->btnButton5->AddAction(new QClickEvent(), new QAjaxAction('btnButton5_Click'));
}
示例4: dtgNotificationUserAccount_EditLinkColumn_Render
public function dtgNotificationUserAccount_EditLinkColumn_Render(NotificationUserAccount $objNotificationUserAccount)
{
$strControlId = 'btnEdit' . $this->dtgNotificationUserAccount->CurrentRowIndex;
$btnEdit = $this->objForm->GetControl($strControlId);
if (!$btnEdit) {
$btnEdit = new QButton($this->dtgNotificationUserAccount, $strControlId);
$btnEdit->Text = QApplication::Translate('Edit');
$btnEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnEdit_Click'));
}
$btnEdit->ActionParameter = $objNotificationUserAccount->NotificationUserAccountId;
return $btnEdit->Render(false);
}
示例5: dtgDatagrid_EditLinkColumn_Render
public function dtgDatagrid_EditLinkColumn_Render(Datagrid $objDatagrid)
{
$strControlId = 'btnEdit' . $this->dtgDatagrid->CurrentRowIndex;
$btnEdit = $this->objForm->GetControl($strControlId);
if (!$btnEdit) {
$btnEdit = new QButton($this->dtgDatagrid, $strControlId);
$btnEdit->Text = QApplication::Translate('Edit');
$btnEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnEdit_Click'));
}
$btnEdit->ActionParameter = $objDatagrid->DatagridId;
return $btnEdit->Render(false);
}
示例6: renderButton
public function renderButton(Person $objPerson)
{
$objControlId = "editButton" . $objPerson->Id;
if (!($objControl = $this->GetControl($objControlId))) {
$objControl = new QButton($this, $objControlId);
$objControl->Text = "Edit Person #" . $objPerson->Id;
$objControl->AddAction(new QClickEvent(), new QAjaxAction("renderButton_Click"));
$objControl->ActionParameter = $objPerson->Id;
}
// We pass the parameter of "false" to make sure the control doesn't render
// itself RIGHT HERE - that it instead returns its string rendering result.
return $objControl->Render(false);
}
示例7: RenderDeleteButton
/**
* A non-delegated event version. Create a new button for each control and attach an action to it.
*
* @param Person $objPerson
* @return String
*/
public function RenderDeleteButton($objPerson)
{
$strControlId = 'btn' . $objPerson->Id;
$objControl = $this->GetControl($strControlId);
if (!$objControl) {
$objControl = new QButton($this);
$objControl->Text = 'Edit';
$objControl->ActionParameter = $objPerson->Id;
$objControl->AddAction(new QClickEvent(), new QAjaxAction('dtgPersonsButton_Click'));
// This will generate a javascript call for every button created.
}
return $objControl->Render(false);
}
示例8: lnkSelected_Render
public function lnkSelected_Render(Praises $objPraise)
{
$strControlId = 'lnkSelected' . $objPraise->Id;
// Let's see if the Checkbox exists already
$lnkSelected = $this->GetControl($strControlId);
if (!$lnkSelected) {
$lnkSelected = new QButton($this->dtgPraises, $strControlId);
$lnkSelected->Text = $objPraise->Subject;
$lnkSelected->ActionParameter = $objPraise->Id;
$lnkSelected->CssClass = 'linkButton';
$lnkSelected->AddAction(new QClickEvent(), new QServerAction('lnkSelected_Click'));
}
return $lnkSelected->Render(false);
}
示例9: __construct
public function __construct($objParentObject, $strControlId = null, Person $objPerson = null, $strUrlHashArgument)
{
try {
parent::__construct($objParentObject, $strControlId);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
$this->strTemplate = dirname(__FILE__) . '/../' . $this->objForm->strSubNavItemArray[$this->objForm->strSubNavItemToken][1] . '/' . get_class($this) . '.tpl.php';
$this->objPerson = $objPerson;
$this->strUrlHashArgument = $strUrlHashArgument;
$this->btnSave = new QButton($this);
$this->btnSave->Text = 'Save';
$this->btnSave->CssClass = 'primary';
$this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
$this->btnSave->CausesValidation = $this;
$this->btnCancel = new QLinkButton($this);
$this->btnCancel->Text = 'Cancel';
$this->btnCancel->CssClass = 'cancel';
$this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click'));
$this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction());
$this->SetupPanel();
}
示例10: EditColumn_Render
public function EditColumn_Render(Attribute $objAttribute)
{
// Let's specify a specific Control ID for our button, using the datagrid's CurrentRowIndex
$strControlId = 'btnEditAttribute' . $this->dtgAttributes->CurrentRowIndex;
$btnEdit = $this->objForm->GetControl($strControlId);
if (!$btnEdit) {
// Only create/instantiate a new Edit button for this Row if it doesn't yet exist
$btnEdit = new QButton($this->dtgAttributes, $strControlId);
$btnEdit->Text = 'Add';
$btnEdit->CssClass = 'primary';
// Define an Event Handler on the Button
// Because the event handler, itself, is defined in the control, we use QAjaxControlAction instead of QAjaxAction
$btnEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnEditAttribute_Click'));
}
// Finally, update the Actionparameter for our button to store the $objAttribute's ID.
$btnEdit->ActionParameter = $objAttribute->Id . "_" . $objAttribute->AttributeDataTypeId . "_" . $objAttribute->Name . "_" . $this->dtgAttributes->CurrentRowIndex;
// Return the Rendered Button Control
return $btnEdit->Render(false);
}
示例11: SetupEmailMessageControls
/**
* Sets up the EmailMessageRouteDataGrid if there are messages associated with this group
* @return void
*/
protected function SetupEmailMessageControls()
{
$this->dtgEmailMessageRoute = new EmailMessageRouteDataGrid($this);
$this->dtgEmailMessageRoute->MetaAddColumn(QQN::EmailMessageRoute()->EmailMessage->DateReceived, 'Width=115px', 'FontSize=11px', 'Html=<?= $_CONTROL->ParentControl->RenderEmailDateReceived($_ITEM); ?>');
$this->dtgEmailMessageRoute->MetaAddColumn(QQN::EmailMessageRoute()->EmailMessage->FromAddress, 'Width=200px', 'FontSize=11px', 'Html=<?= $_CONTROL->ParentControl->RenderEmailFromAddress($_ITEM); ?>', 'HtmlEntities=false');
$this->dtgEmailMessageRoute->MetaAddColumn(QQN::EmailMessageRoute()->EmailMessage->Subject, 'Width=420px', 'FontSize=11px', 'Html=<?= $_CONTROL->ParentControl->RenderEmailSubject($_ITEM); ?>', 'HtmlEntities=false');
$this->dtgEmailMessageRoute->SetDataBinder('dtgEmailMessageRoute_Bind', $this);
$this->dtgEmailMessageRoute->Paginator = new QPaginator($this->dtgEmailMessageRoute);
$this->dtgEmailMessageRoute->SortColumnIndex = 0;
$this->dtgEmailMessageRoute->SortDirection = 1;
$this->dlgEmailMessage = new QDialogBox($this);
$this->dlgEmailMessage->Template = dirname(__FILE__) . '/dlgEmailMessage.tpl.php';
$this->dlgEmailMessage->HideDialogBox();
$this->btnEmailMessage = new QButton($this->dlgEmailMessage);
$this->btnEmailMessage->Text = 'Close';
$this->btnEmailMessage->AddAction(new QClickEvent(), new QHideDialogBox($this->dlgEmailMessage));
$this->pxyEmailMessage = new QControlProxy($this);
$this->pxyEmailMessage->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'pxyEmailMessage_Click'));
$this->pxyEmailMessage->AddAction(new QClickEvent(), new QTerminateAction());
}
示例12: render_btnToggleRecordsSummary
public function render_btnToggleRecordsSummary(Project $objProject)
{
// Create their unique id...
$objControlId = 'btnToggleRecordsSummary' . $objProject->Id;
if (!($objControl = $this->GetControl($objControlId))) {
$intTeamMemberCount = Person::CountByProjectAsTeamMember($objProject->Id);
if ($intTeamMemberCount > 0) {
// If not exists create our toggle button who his parent
// is our master QDataGrid...
$objControl = new QButton($this->dtgProjects, $objControlId);
$objControl->Width = 25;
$objControl->Text = '+' . $intTeamMemberCount;
$objControl->CssClass = 'inputbutton';
// Pass the id of the bounded item just for other process
// on click event
$objControl->ActionParameter = $objProject->Id;
// Add event on click the toogle button
$objControl->AddAction(new QClickEvent(), new QAjaxAction('btnToggleRecordsSummary_Click'));
}
}
// We pass the parameter of "false" to make sure the control doesn't render
// itself RIGHT HERE - that it instead returns its string rendering result.
return $objControl->Render(false);
}
示例13: RemoveColumn_Render
public function RemoveColumn_Render(InventoryLocation $objInventoryLocation)
{
// If the transaction is a Move or a Take Out, use the InventoryLocationId as the Action Parameter
if ($this->ctlInventoryTransact->intTransactionTypeId == 1 || $this->ctlInventoryTransact->intTransactionTypeId == 5) {
$strControlId = 'btnRemove' . $objInventoryLocation->InventoryLocationId;
} elseif ($this->ctlInventoryTransact->intTransactionTypeId == 4) {
$strControlId = 'btnRemove' . $objInventoryLocation->InventoryModelId;
}
$btnRemove = $this->GetControl($strControlId);
if (!$btnRemove) {
// Create the Remove button for this row in the DataGrid
// Use ActionParameter to specify the ID of the InventoryLocation or InventoryModelId, depending on the transaction type
$btnRemove = new QButton($this->ctlInventoryTransact->dtgInventoryTransact, $strControlId);
$btnRemove->Text = 'Remove';
// If the transaction is a Move or a Take Out, use the InventoryLocationId as the Action Parameter
if ($this->ctlInventoryTransact->intTransactionTypeId == 1 || $this->ctlInventoryTransact->intTransactionTypeId == 5) {
$btnRemove->ActionParameter = $objInventoryLocation->InventoryLocationId;
} elseif ($this->ctlInventoryTransact->intTransactionTypeId == 4) {
$btnRemove->ActionParameter = $objInventoryLocation->InventoryModelId;
}
$btnRemove->AddAction(new QClickEvent(), new QAjaxAction('btnRemove_Click'));
$btnRemove->AddAction(new QEnterKeyEvent(), new QAjaxAction('btnRemove_Click'));
$btnRemove->AddAction(new QEnterKeyEvent(), new QTerminateAction());
$btnRemove->CausesValidation = false;
}
return $btnRemove->Render(false);
}
示例14: dtgUserRole_ActionsColumn_Render
public function dtgUserRole_ActionsColumn_Render(NarroUserRole $objUserRole)
{
$strControlId = 'btnEditRole' . $objUserRole->UserRoleId;
$btnEdit = $this->Form->GetControl($strControlId);
if (!$btnEdit) {
$btnEdit = new QButton($this->dtgUserRole, $strControlId);
$btnEdit->Text = t('Edit');
if (QApplication::$UseAjax) {
$btnEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnEditRole_Click'));
} else {
$btnEdit->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnEditRole_Click'));
}
}
$btnEdit->ActionParameter = $objUserRole->UserRoleId;
$btnEdit->Display = QApplication::HasPermission('Can manage user roles', $objUserRole->ProjectId, $objUserRole->LanguageId);
$strControlId = 'btnDeleteRole' . $objUserRole->UserRoleId;
$btnDelete = $this->Form->GetControl($strControlId);
if (!$btnDelete) {
$btnDelete = new QButton($this->dtgUserRole, $strControlId);
$btnDelete->Text = t('Delete');
$btnDelete->AddAction(new QClickEvent(), new QConfirmAction(t('Are you sure you want to revoke this role for this user?')));
if (QApplication::$UseAjax) {
$btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDeleteRole_Click'));
} else {
$btnDelete->AddAction(new QClickEvent(), new QServerControlAction($this, 'btnDeleteRole_Click'));
}
}
$btnDelete->ActionParameter = $objUserRole->UserRoleId;
$btnDelete->Display = QApplication::HasPermission('Can manage user roles', $objUserRole->ProjectId, $objUserRole->LanguageId);
return $btnEdit->Render(false) . ' ' . $btnDelete->Render(false);
}
示例15: btnAddField_Click
protected function btnAddField_Click()
{
$intTotalCount = count($this->lstMapHeaderArray);
$this->lstMapHeader_Create($this, $intTotalCount - 1, $this->chkHeaderRow->Checked ? "addfield" : null);
$objTemp = $this->lstMapHeaderArray[$intTotalCount];
$this->lstMapHeaderArray[$intTotalCount] = $this->lstMapHeaderArray[$intTotalCount - 1];
$this->lstMapHeaderArray[$intTotalCount - 1] = $objTemp;
$txtDefaultValue = new QTextBox($this);
$txtDefaultValue->Width = 200;
$this->txtMapDefaultValueArray[] = $txtDefaultValue;
$lstDefaultValue = new QListBox($this);
$lstDefaultValue->Width = 200;
$lstDefaultValue->Display = false;
$this->lstMapDefaultValueArray[] = $lstDefaultValue;
$dtpDate = new QDateTimePicker($this);
$dtpDate->DateTimePickerType = QDateTimePickerType::Date;
$dtpDate->DateTimePickerFormat = QDateTimePickerFormat::MonthDayYear;
$dtpDate->Display = false;
$this->dtpDateArray[] = $dtpDate;
$btnRemove = new QButton($this);
$btnRemove->Text = "Remove";
$btnRemove->ActionParameter = $intTotalCount - 1;
$btnRemove->AddAction(new QClickEvent(), new QServerAction('btnRemove_Click'));
$btnRemove->AddAction(new QEnterKeyEvent(), new QServerAction('btnRemove_Click'));
$btnRemove->AddAction(new QEnterKeyEvent(), new QTerminateAction());
if (isset($this->arrMapFields[$intTotalCount - 1])) {
unset($this->arrMapFields[$intTotalCount - 1]);
}
$this->btnRemoveArray[$intTotalCount - 1] = $btnRemove;
}