本文整理汇总了PHP中ExampleForm::Run方法的典型用法代码示例。如果您正苦于以下问题:PHP ExampleForm::Run方法的具体用法?PHP ExampleForm::Run怎么用?PHP ExampleForm::Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExampleForm
的用法示例。
在下文中一共展示了ExampleForm::Run方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: QLabel
$this->flaSample->TemporaryUploadPath = __QCUBED_UPLOAD__;
$this->flaSample->ClickToView = true;
// NOTICE: If we are wanting users to immediately "click to view" files that are uploaded directly to the docroot,
// we MUST take security precautions to prevent users from executing arbitrary code on the system.
// Precautions could be: defining / overriding our own GetWebUrl() method in QFileAsset or
// limiting the "types" of files that a user could upload. We will go ahead and do this limiting here.
$this->flaSample->FileAssetType = QFileAssetType::Image;
// Feel free to uncomment this yourself, but note that you can pre-define the File property.
// Notice how the path is an absolute path to a file.
// Also notice that the file doesn't even need to be in the docroot.
// $this->flaSample->File = __DOCROOT__ . __IMAGE_ASSETS__ . '/calendar.png';
// Add Styling
$this->flaSample->CssClass = 'file_asset';
$this->flaSample->imgFileIcon->CssClass = 'file_asset_icon';
$this->lblMessage = new QLabel($this);
$this->lblMessage->Text = 'Click on the button to change this message.';
// The "Form Submit" Button -- notice how the form is being submitted via AJAX, even though we are handling
// File Uploads on the form.
$this->btnButton = new QButton($this);
$this->btnButton->Text = 'Click Me';
$this->btnButton->AddAction(new QClickEvent(), new QAjaxAction('btnButton_Click'));
$this->btnButton->CausesValidation = true;
}
protected function btnButton_Click($strFormId, $strControlId, $strParameter)
{
$this->lblMessage->Text = 'Thanks for uploading the file: ' . $this->flaSample->FileName . ". File size: " . $this->flaSample->Size . " bytes";
}
}
// And now run our defined form
ExampleForm::Run('ExampleForm', 'file_asset.tpl.php');
示例2: dtgPerson_BalanceRender
* @param $item
* @return string
*/
public function dtgPerson_BalanceRender($item)
{
$val = $item->Budget - $item->Spent;
if ($val < 0) {
return '(' . number_format(-$val) . ')';
} else {
return number_format($val);
}
}
/**
* Style the number in the column. All number columns will use the amount class. If the number is negative, make
* the cell red.
*
* @param $item
* @return mixed
*/
public function dtgPerson_BalanceAttributes($item)
{
$ret['class'] = 'amount';
$val = $item->Budget - $item->Spent;
if ($val < 0) {
$ret['style'] = 'color:red';
}
return $ret;
}
}
ExampleForm::Run('ExampleForm');
示例3: Form_Create
require __INCLUDES__ . '/examples/examples.inc.php';
// Define the Qform with all our Qcontrols
class ExampleForm extends ExamplesBaseForm
{
// Local declarations of our Qcontrols
protected $lblMessage;
protected $btnButton;
// Initialize our Controls during the Form Creation process
protected function Form_Create()
{
// Define the Label
$this->lblMessage = new QLabel($this);
$this->lblMessage->Text = 'Click the button to change my message.';
// Define the Button
$this->btnButton = new QButton($this);
$this->btnButton->Text = 'Click Me!';
// Add a Click event handler to the button -- the action to run is an AjaxAction.
// The AjaxAction names a PHP method (which will be run asynchronously) called "btnButton_Click"
$this->btnButton->AddAction(new QClickEvent(), new QAjaxAction('btnButton_Click'));
}
// The "btnButton_Click" Event handler
protected function btnButton_Click($strFormId, $strControlId, $strParameter)
{
$this->lblMessage->Text = 'Hello, world!';
}
}
// Run the Form we have defined
// We will explicitly specify an alternate filepath for the HTML template file. Note
// that this filepath is relative to the path of this PHP script.
ExampleForm::Run('ExampleForm', 'some_template_file.tpl.php');