本文整理汇总了PHP中QQN::Person方法的典型用法代码示例。如果您正苦于以下问题:PHP QQN::Person方法的具体用法?PHP QQN::Person怎么用?PHP QQN::Person使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQN
的用法示例。
在下文中一共展示了QQN::Person方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Form_Create
protected function Form_Create()
{
// Define the DataGrid
$this->dtgPersons = new QDataGrid($this);
$this->dtgPersons->CellPadding = 5;
$this->dtgPersons->CellSpacing = 0;
// Specify Pagination with 10 items per page
$objPaginator = new QPaginator($this->dtgPersons);
$this->dtgPersons->Paginator = $objPaginator;
$this->dtgPersons->ItemsPerPage = 10;
// Define Columns
$this->dtgPersons->AddColumn(new QDataGridColumn('Person ID', '<?= $_ITEM->Id ?>', 'Width=100', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Id), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Id, false))));
$this->dtgPersons->AddColumn(new QDataGridColumn('First Name', '<?= $_ITEM->FirstName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->FirstName, false))));
$this->dtgPersons->AddColumn(new QDataGridColumn('Last Name', '<?= $_ITEM->LastName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->LastName, false))));
// For the last column we will be calling a PHP method on the form
// to help with the dynamic creation of a Checkbox
$this->dtgPersons->AddColumn(new QDataGridColumn('Select Person', '<?= $_FORM->chkSelected_Render($_ITEM) ?>', 'HtmlEntities=false'));
// Let's pre-default the sorting by last name (column index #2)
$this->dtgPersons->SortColumnIndex = 2;
// Specify the DataBinder method for the DataGrid
$this->dtgPersons->SetDataBinder('dtgPersons_Bind');
// Make the DataGrid look nice
$objStyle = $this->dtgPersons->RowStyle;
$objStyle->FontSize = 12;
$objStyle = $this->dtgPersons->AlternateRowStyle;
$objStyle->BackColor = '#f6f6f6';
// Define the Label -- keep it blank for now
$this->lblResponse = new QLabel($this);
$this->lblResponse->HtmlEntities = false;
}
示例2: Form_Create
protected function Form_Create()
{
// Define the DataGrid
$this->dtgPersons = new QDataGrid($this);
// Define Columns
// Note how we add SortByCommand and ReverseSortByCommand properties to each column
$col = $this->dtgPersons->CreatePropertyColumn('Person Id', 'Id');
$col->OrderByClause = QQ::OrderBy(QQN::Person()->Id);
// The clause to use when the column header is first clicked.
$col->ReverseOrderByClause = QQ::OrderBy(QQN::Person()->Id, false);
// The clause to use the second time the column header is clicked.
// Note above the use of 'false' in the node list of the OrderBy clause. This tells OrderBy to go in descending order for the previous database column.
// Here we illustrate how you can sort on multiple columns by specifying multiple nodes in the OrderBy clause
$col = $this->dtgPersons->CreatePropertyColumn('First Name', 'FirstName');
$col->OrderByClause = QQ::OrderBy(QQN::Person()->FirstName, QQN::Person()->LastName);
// The clause to use when the column header is first clicked.
$col->ReverseOrderByClause = QQ::OrderBy(QQN::Person()->FirstName, false, QQN::Person()->LastName, false);
// The clause to use the second time the column header is clicked.
// Here we save some typing by using a NodeColumn. Node columns use the nodes to both display the data, and sort on the data.
// Notice that we are passing an array of nodes here. The first node is used for display, and the entire list of nodes is
// used for sorting.
$this->dtgPersons->CreateNodeColumn('Last Name', [QQN::Person()->LastName, QQN::Person()->FirstName]);
// Let's pre-default the sorting by last name (column index #2)
$this->dtgPersons->SortColumnIndex = 2;
// Specify the Datagrid2's Data Binder method
$this->dtgPersons->SetDataBinder('dtgPersons_Bind');
}
示例3: testMultiLevel
public function testMultiLevel()
{
$arrPeople = Person::LoadAll(QQ::Clause(QQ::ExpandAsArray(QQN::Person()->Address), QQ::ExpandAsArray(QQN::Person()->ProjectAsManager), QQ::ExpandAsArray(QQN::Person()->ProjectAsManager->Milestone)));
$targetPerson = null;
foreach ($arrPeople as $objPerson) {
if ($objPerson->LastName == "Wolfe") {
$targetPerson = $objPerson;
}
}
$this->assertEqual(sizeof($arrPeople), 12);
$this->assertNotEqual($targetPerson, null, "Karen Wolfe found");
$targetProject = null;
foreach ($targetPerson->_ProjectAsManagerArray as $objProject) {
if ($objProject->Name == "ACME Payment System") {
$targetProject = $objProject;
}
}
$this->assertEqual(sizeof($targetPerson->_ProjectAsManagerArray), 2, "2 projects found");
$this->assertNotEqual($targetProject, null, "ACME Payment System project found");
$targetMilestone = null;
foreach ($targetProject->_MilestoneArray as $objMilestone) {
if ($objMilestone->Name == "Milestone H") {
$targetMilestone = $objMilestone;
}
}
$this->assertEqual(sizeof($targetProject->_MilestoneArray), 4, "4 milestones found");
$this->assertNotEqual($targetMilestone, null, "Milestone H found");
}
示例4: Form_Create
protected function Form_Create()
{
// Define the DataGrid
$this->dtgPersons = new QDataGrid($this);
$this->dtgPersons->CellPadding = 5;
$this->dtgPersons->CellSpacing = 0;
// Using Ajax for Pagination
$this->dtgPersons->UseAjax = true;
// To create pagination, we will create a new paginator, and specify the datagrid
// as the paginator's parent. (We do this because the datagrid is the control
// who is responsible for rendering the paginator, as opposed to the form.)
$objPaginator = new QPaginator($this->dtgPersons);
$this->dtgPersons->Paginator = $objPaginator;
// Now, with a paginator defined, we can set up some additional properties on
// the datagrid. For purposes of this example, let's make the datagrid show
// only 5 items per page.
$this->dtgPersons->ItemsPerPage = 5;
// Define Columns
$this->dtgPersons->AddColumn(new QDataGridColumn('Person ID', '<?= $_ITEM->Id ?>', 'Width=100', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Id), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Id, false))));
$this->dtgPersons->AddColumn(new QDataGridColumn('First Name', '<?= $_ITEM->FirstName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->FirstName, false))));
$this->dtgPersons->AddColumn(new QDataGridColumn('Last Name', '<?= $_ITEM->LastName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->LastName, false))));
// Let's pre-default the sorting by last name (column index #2)
$this->dtgPersons->SortColumnIndex = 2;
// Specify the Datagrid's Data Binder method
$this->dtgPersons->SetDataBinder('dtgPersons_Bind');
// Make the DataGrid look nice
$objStyle = $this->dtgPersons->RowStyle;
$objStyle->FontSize = 12;
$objStyle = $this->dtgPersons->AlternateRowStyle;
$objStyle->BackColor = '#f6f6f6';
}
示例5: Form_Create
protected function Form_Create()
{
// Define the DataGrid
$this->dtgPersons = new QDataGrid($this);
$this->dtgPersons->CellPadding = 5;
$this->dtgPersons->CellSpacing = 0;
// Define Columns
// Note how we add SortByCommand and ReverseSortByCommand properties to each column
$this->dtgPersons->AddColumn(new QDataGridColumn('Person ID', '<?= $_ITEM->Id ?>', 'Width=100', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Id), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Id, false))));
$this->dtgPersons->AddColumn(new QDataGridColumn('First Name', '<?= $_ITEM->FirstName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->FirstName, false))));
$this->dtgPersons->AddColumn(new QDataGridColumn('Last Name', '<?= $_ITEM->LastName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->LastName, false))));
// Let's pre-default the sorting by last name (column index #2)
$this->dtgPersons->SortColumnIndex = 2;
// Specify the Datagrid's Data Binder method
$this->dtgPersons->SetDataBinder('dtgPersons_Bind');
// Make the DataGrid look nice
$objStyle = $this->dtgPersons->RowStyle;
$objStyle->FontSize = 12;
$objStyle = $this->dtgPersons->AlternateRowStyle;
$objStyle->BackColor = '#f6f6f6';
$objStyle = $this->dtgPersons->HeaderRowStyle;
$objStyle->ForeColor = 'white';
$objStyle->BackColor = '#780000';
// Because browsers will apply different styles/colors for LINKs
// We must explicitly define the ForeColor for the HeaderLink.
// The header row turns into links when the column can be sorted.
$objStyle = $this->dtgPersons->HeaderLinkStyle;
$objStyle->ForeColor = 'white';
}
示例6: Form_Create
protected function Form_Create()
{
// Define the DataGrid
$this->dtgPersons = new QDataGrid($this, 'dtgPersons');
$this->dtgPersons->Height = "560px";
// Define the DataGrid using event delegation
$this->dtgPersonsDelegated = new QDataGrid($this, 'dtgPersonsDelegated');
// Define Columns
$this->dtgPersons->CreateNodeColumn('Person Id', QQN::Person()->Id);
$this->dtgPersons->CreateNodeColumn('First Name', QQN::Person()->FirstName);
$this->dtgPersons->CreateNodeColumn('Last Name', QQN::Person()->LastName);
$col = $this->dtgPersons->CreateCallableColumn('', [$this, 'RenderDeleteButton']);
$col->HtmlEntities = false;
$this->dtgPersonsDelegated->CreateNodeColumn('Person Id', QQN::Person()->Id);
$this->dtgPersonsDelegated->CreateNodeColumn('First Name', QQN::Person()->FirstName);
$this->dtgPersonsDelegated->CreateNodeColumn('Last Name', QQN::Person()->LastName);
$col = $this->dtgPersonsDelegated->CreateCallableColumn('', [$this, 'RenderDeleteButton2']);
$col->HtmlEntities = false;
// Create the delegated event action. We bind the event to the data grid, even though the event is
// coming from buttons in the datagrid. These click events will bubble up to the table.
$this->dtgPersonsDelegated->AddAction(new QClickEvent(null, 0, 'button[data-id]'), new QAjaxAction('dtgPersonsButton_Click', null, null, '$j(event.target).data("id")'));
// Specify the Datagrid's Data Binder method
// Notice we are using the same binder for two datagrids
$this->dtgPersons->SetDataBinder('dtgPersons_Bind');
$this->dtgPersonsDelegated->SetDataBinder('dtgPersons_Bind');
}
示例7: dtgPersons_Create
protected function dtgPersons_Create()
{
// Define the DataGrid
$this->dtgPersons = new QDataGrid($this);
// Specify Pagination with 10 items per page
$objPaginator = new QPaginator($this->dtgPersons);
$this->dtgPersons->Paginator = $objPaginator;
$this->dtgPersons->ItemsPerPage = 10;
// Define Columns
$col = $this->dtgPersons->CreateNodeColumn('Person ID', QQN::Person()->Id);
$col->CellStyler->Width = 100;
$col = $this->dtgPersons->CreateNodeColumn('First Name', [QQN::Person()->FirstName, QQN::Person()->LastName]);
$col->CellStyler->Width = 200;
$col = $this->dtgPersons->CreateNodeColumn('Last Name', [QQN::Person()->LastName, QQN::Person()->LastName]);
$col->CellStyler->Width = 200;
//Create the select column, a subclass of QDataGrid_CheckBoxColumn
$this->colSelect = new ExampleCheckColumn1('');
$this->colSelect->ShowCheckAll = true;
$this->colSelect->CellStyler->Width = 20;
$this->dtgPersons->AddColumnAt(0, $this->colSelect);
// Let's pre-default the sorting by last name (column index #2)
$this->dtgPersons->SortColumnIndex = 2;
// Specify the DataBinder method for the DataGrid
$this->dtgPersons->SetDataBinder('dtgPersons_Bind');
$this->dtgPersons->AddAction(new QHtmlTableCheckBoxColumn_ClickEvent(), new QAjaxAction('chkSelected_Click'));
// Make sure changes to the database by other users are reflected in the datagrid on the next event
$this->dtgPersons->Watch(QQN::Person());
}
示例8: testSelectSubsetInExpandAsArray
public function testSelectSubsetInExpandAsArray()
{
$objPersonArray = Person::LoadAll(QQ::Clause(QQ::Select(QQN::Person()->FirstName), QQ::ExpandAsArray(QQN::Person()->Address, QQ::Select(QQN::Person()->Address->Street, QQN::Person()->Address->City)), QQ::ExpandAsArray(QQN::Person()->ProjectAsManager, QQ::Select(QQN::Person()->ProjectAsManager->StartDate)), QQ::ExpandAsArray(QQN::Person()->ProjectAsManager->Milestone, QQ::Select(QQN::Person()->ProjectAsManager->Milestone->Name))));
foreach ($objPersonArray as $objPerson) {
$this->assertNull($objPerson->LastName, "LastName should be null, since it was not selected");
$this->assertNotNull($objPerson->Id, "Id should not be null since it's always added to the select list");
if (sizeof($objPerson->_AddressArray) > 0) {
foreach ($objPerson->_AddressArray as $objAddress) {
$this->assertNotNull($objAddress->Id, "Address->Id should not be null since it's always added to the select list");
$this->assertNull($objAddress->PersonId, "Address->PersonId should be null, since it was not selected");
}
}
if (sizeof($objPerson->_ProjectAsManagerArray) > 0) {
foreach ($objPerson->_ProjectAsManagerArray as $objProject) {
$this->assertNotNull($objProject->Id, "Project->Id should not be null since it's always added to the select list");
$this->assertNull($objProject->Name, "Project->Name should be null, since it was not selected");
if (sizeof($objProject->_MilestoneArray) > 0) {
foreach ($objProject->_MilestoneArray as $objMilestone) {
$this->assertNotNull($objMilestone->Id, "Milestone->Id should not be null since it's always added to the select list");
$this->assertNull($objMilestone->ProjectId, "Milestone->ProjectId should be null, since it was not selected");
}
}
}
}
}
}
示例9: __construct
public function __construct($objParentObject, Project $objProject, $strControlId = null)
{
try {
parent::__construct($objParentObject, $strControlId);
// Watch out for template later gonna talk about it,
// need a trick to look good
// (insert the child content as row in table already present for Master
// close colums -insert row - insert child - close row - open column
// </td> <tr><td> render content of this child </td> </tr> <td> )
$this->Template = 'records.summary.tpl.php';
// Setting local the Msster QDataGrid to refresh on
// Saves on the Child DataGrid..
$this->objParentObject = $objParentObject;
$this->objProject = $objProject;
// Create the child DataGrid as a normal QDataGrid
$this->dtgRecordsSummary = new QDataGrid($this);
// pagination
$this->dtgRecordsSummary->Paginator = new QPaginator($this->dtgRecordsSummary);
$this->dtgRecordsSummary->ItemsPerPage = 5;
$this->dtgRecordsSummary->SetDataBinder('dtgRecordsSummary_Bind', $this);
// Add some data to show...
$this->dtgRecordsSummary->CreateCallableColumn('Person', [$this, 'render_PersonColumn']);
$col = $this->dtgRecordsSummary->CreateNodeColumn('Id', QQN::Person()->Id);
$col->CellStyler->Width = 120;
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
示例10: Form_Create
protected function Form_Create()
{
// Setup DataGrid Columns
// Note that although we are using "Beta 2" style of SortBy and LimitInfo, QDataGrid does have support to "convert" QQ::OrderBy to SortBy strings.
$this->colId = new QDataGridColumn(QApplication::Translate('Id'), '<?= $_ITEM->Id; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Id), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Id, false)));
/* $this->colId = new QDataGridColumn(QApplication::Translate('Id'), '<?= $_ITEM->Id; ?>', 'SortByCommand="id ASC"', 'ReverseSortByCommand="id DESC"');*/
$this->colFirstName = new QDataGridColumn(QApplication::Translate('First Name'), '<?= $_ITEM->FirstName; ?>', 'SortByCommand="first_name ASC"', 'ReverseSortByCommand="first_name DESC"');
$this->colLastName = new QDataGridColumn(QApplication::Translate('Last Name'), '<?= $_ITEM->LastName; ?>', 'SortByCommand="last_name ASC"', 'ReverseSortByCommand="last_name DESC"');
// Setup DataGrid
$this->dtgPerson = new QDataGrid($this);
$this->dtgPerson->CellSpacing = 0;
$this->dtgPerson->CellPadding = 4;
$this->dtgPerson->BorderStyle = QBorderStyle::Solid;
$this->dtgPerson->BorderWidth = 1;
$this->dtgPerson->GridLines = QGridLines::Both;
$this->dtgPerson->SortColumnIndex = 0;
// Datagrid Paginator
$this->dtgPerson->Paginator = new QPaginator($this->dtgPerson);
$this->dtgPerson->ItemsPerPage = 5;
// Specify Whether or Not to Refresh using Ajax
$this->dtgPerson->UseAjax = true;
// Add the Columns to the DataGrid
$this->dtgPerson->AddColumn($this->colId);
$this->dtgPerson->AddColumn($this->colFirstName);
$this->dtgPerson->AddColumn($this->colLastName);
}
示例11: Form_Create
protected function Form_Create()
{
// Define the DataGrid
// NOTE: We are using a special QDataGrid subclass that we have defined in the
// included /examples/datagrid/QDataGrid.inc file. Feel free to make changes to the
// main QDataGrid.inc custom subclass, which is located in /includes/qform/QDataGrid.inc.
$this->dtgPersons = new QDataGrid($this);
$this->dtgPersons->CellPadding = 5;
$this->dtgPersons->CellSpacing = 0;
// Enabling AJAX
$this->dtgPersons->UseAjax = true;
// Enable Pagination, and set to 5 items per page
$objPaginator = new QPaginator($this->dtgPersons);
$this->dtgPersons->Paginator = $objPaginator;
$this->dtgPersons->ItemsPerPage = 20;
// Let's create our ALTERNATE paginator
$this->dtgPersons->PaginatorAlternate = new QPaginator($this->dtgPersons);
// Define Columns
$this->dtgPersons->AddColumn(new QDataGridColumn('Person ID', '<?= $_ITEM->Id ?>', 'Width=100', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Id), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Id, false))));
$this->dtgPersons->AddColumn(new QDataGridColumn('First Name', '<?= $_ITEM->FirstName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->FirstName, false))));
$this->dtgPersons->AddColumn(new QDataGridColumn('Last Name', '<?= $_ITEM->LastName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->LastName, false))));
// Let's pre-default the sorting by last name (column index #2)
$this->dtgPersons->SortColumnIndex = 2;
// Specify the Datagrid's Data Binder method
$this->dtgPersons->SetDataBinder('dtgPersons_Bind');
// Make the DataGrid look nice
$objStyle = $this->dtgPersons->RowStyle;
$objStyle->FontSize = 12;
$objStyle = $this->dtgPersons->AlternateRowStyle;
$objStyle->BackColor = '#f6f6f6';
}
示例12: Form_Create
protected function Form_Create()
{
// Define the DataGrid
$this->dtgPersons = new QDataGrid($this);
// Using Ajax for Pagination
$this->dtgPersons->UseAjax = true;
// To create pagination, we will create a new paginator, and specify the datagrid
// as the paginator's parent. (We do this because the datagrid is the control
// who is responsible for rendering the paginator, as opposed to the form.)
$objPaginator = new QPaginator($this->dtgPersons);
$this->dtgPersons->Paginator = $objPaginator;
// Now, with a paginator defined, we can set up some additional properties on
// the datagrid. For purposes of this example, let's make the datagrid show
// only 5 items per page.
$this->dtgPersons->ItemsPerPage = 5;
// Define Columns
$col = $this->dtgPersons->CreateNodeColumn('Person ID', QQN::Person()->Id);
$col->CellStyler->Width = 100;
$col = $this->dtgPersons->CreateNodeColumn('First Name', [QQN::Person()->FirstName, QQN::Person()->LastName]);
$col->CellStyler->Width = 200;
$col = $this->dtgPersons->CreateNodeColumn('Last Name', [QQN::Person()->LastName, QQN::Person()->LastName]);
$col->CellStyler->Width = 200;
// Let's pre-default the sorting by last name (column index #2)
$this->dtgPersons->SortColumnIndex = 2;
// Specify the Datagrid's Data Binder method
$this->dtgPersons->SetDataBinder('dtgPersons_Bind');
}
示例13: Form_Create
protected function Form_Create()
{
// Define the DataGrid
$this->dtgPersons = new QDataGrid($this);
$this->dtgPersons->CellPadding = 5;
$this->dtgPersons->CellSpacing = 0;
// Let's enable AJAX!!!
$this->dtgPersons->UseAjax = true;
// Enable Pagination, and set to 5 items per page
$objPaginator = new QPaginator($this->dtgPersons);
$this->dtgPersons->Paginator = $objPaginator;
$this->dtgPersons->ItemsPerPage = 20;
// Define Columns
$this->dtgPersons->AddColumn(new QDataGridColumn('Person ID', '<?= $_ITEM->Id ?>', 'Width=100', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Id), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Id, false))));
$this->dtgPersons->AddColumn(new QDataGridColumn('First Name', '<?= $_ITEM->FirstName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->FirstName, false))));
$this->dtgPersons->AddColumn(new QDataGridColumn('Last Name', '<?= $_ITEM->LastName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->LastName, false))));
// Let's pre-default the sorting by last name (column index #2)
$this->dtgPersons->SortColumnIndex = 2;
// Finally, we define the method that will handle the binding of the data source to the datagrid
$this->dtgPersons->SetDataBinder('dtgPersons_Bind');
// Make the DataGrid look nice
$objStyle = $this->dtgPersons->RowStyle;
$objStyle->FontSize = 12;
$objStyle = $this->dtgPersons->AlternateRowStyle;
$objStyle->BackColor = '#f6f6f6';
}
示例14: dtgItems_Bind
public function dtgItems_Bind()
{
$intYear = QApplication::PathInfo(0);
$dttStart = new QDateTime($intYear . '-01-01');
$dttEnd = new QDateTime($dttStart);
$dttEnd->Year += 1;
$dttStart->SetTime(null, null, null);
$dttEnd->SetTime(null, null, null);
$objPersonCursor = Person::QueryCursor(QQ::AndCondition(QQ::GreaterOrEqual(QQN::Person()->StewardshipContribution->DateCredited, $dttStart), QQ::LessThan(QQN::Person()->StewardshipContribution->DateCredited, $dttEnd)), QQ::Clause(QQ::Distinct(), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
$strNameArray = array();
$strNameValueArray = array();
while ($objPerson = Person::InstantiateCursor($objPersonCursor)) {
$strToken = strtolower($objPerson->FirstName . '|' . $objPerson->LastName);
$strToken = str_replace(' ', '', $strToken);
$strToken = str_replace('.', '', $strToken);
$strToken = str_replace(',', '', $strToken);
$strToken = str_replace('-', '', $strToken);
$strToken = str_replace('_', '', $strToken);
$strToken = str_replace('/', '', $strToken);
if (array_key_exists($strToken, $strNameArray)) {
$strNameValueArray[$strToken] = $objPerson->FirstName . ' ' . $objPerson->LastName;
}
$strNameArray[$strToken] = true;
}
$this->dtgItems->DataSource = $strNameValueArray;
}
示例15: Form_Create
protected function Form_Create()
{
// Define the DataGrid
$this->dtgPersons = new QDataGrid($this);
$this->dtgPersons->CellPadding = 5;
$this->dtgPersons->CellSpacing = 0;
// Let's enable AJAX!!!
$this->dtgPersons->UseAjax = true;
// Enable Pagination, and set to 5 items per page
$objPaginator = new QPaginator($this->dtgPersons);
$this->dtgPersons->Paginator = $objPaginator;
$this->dtgPersons->ItemsPerPage = 20;
// Define Columns
$this->dtgPersons->AddColumn(new QDataGridColumn('Person ID', '<?= $_ITEM->Id ?>', 'Width=100', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Id), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Id, false))));
$this->dtgPersons->AddColumn(new QDataGridColumn('First Name', '<?= $_ITEM->FirstName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->FirstName, false))));
$this->dtgPersons->AddColumn(new QDataGridColumn('Last Name', '<?= $_ITEM->LastName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->LastName, false))));
// Let's pre-default the sorting by last name (column index #2)
$this->dtgPersons->SortColumnIndex = 2;
// Finally, we define the method that will handle the binding of the data source to the datagrid
$this->dtgPersons->SetDataBinder('dtgPersons_Bind');
// Make the DataGrid look nice
$objStyle = $this->dtgPersons->RowStyle;
$objStyle->FontSize = 12;
$objStyle = $this->dtgPersons->AlternateRowStyle;
$objStyle->BackColor = '#eaeaea';
$objStyle = $this->dtgPersons->HeaderRowStyle;
$objStyle->ForeColor = 'white';
$objStyle->BackColor = '#000066';
// Because browsers will apply different styles/colors for LINKs
// We must explicitly define the ForeColor for the HeaderLink.
// The header row turns into links when the column can be sorted.
$objStyle = $this->dtgPersons->HeaderLinkStyle;
$objStyle->ForeColor = 'white';
}