Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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');
 }
Ejemplo n.º 3
0
 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");
 }
Ejemplo n.º 4
0
 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';
 }
Ejemplo n.º 5
0
 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';
 }
 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');
 }
 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());
 }
Ejemplo n.º 8
0
 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");
                     }
                 }
             }
         }
     }
 }
 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;
     }
 }
Ejemplo n.º 10
0
 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);
 }
Ejemplo n.º 11
0
 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';
 }
Ejemplo n.º 12
0
 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');
 }
Ejemplo n.º 13
0
 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';
 }
Ejemplo n.º 14
0
 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;
 }
Ejemplo n.º 15
0
Archivo: ajax.php Proyecto: qcodo/qcodo
 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';
 }
Ejemplo n.º 16
0
 protected function Form_Create()
 {
     // Define our Label
     $this->lblMessage = new QLabel($this);
     $this->lblMessage->Text = '<None>';
     // Define the ListBox, and create the first listitem as 'Select One'
     $this->lstPersons = new QListBox($this);
     $this->lstPersons->AddItem('- Select One -', null);
     // Add the items for the listbox, pulling in from the Person table
     $objPersons = Person::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
     if ($objPersons) {
         foreach ($objPersons as $objPerson) {
             // We want to display the listitem as Last Name, First Name
             // and the VALUE of the listitem should be the person object itself
             $this->lstPersons->AddItem($objPerson->LastName . ', ' . $objPerson->FirstName, $objPerson);
         }
     }
     // Declare a QChangeEvent to call a server action: the lstPersons_Change PHP method
     $this->lstPersons->AddAction(new QChangeEvent(), new QServerAction('lstPersons_Change'));
     // Do the same but with a multiple selection QCheckboxList
     $this->chkPersons = new QCheckBoxList($this);
     if ($objPersons) {
         foreach ($objPersons as $objPerson) {
             // We want to display the listitem as Last Name, First Name
             // and the VALUE of the listitem will be the database id
             $this->chkPersons->AddItem($objPerson->FirstName . ' ' . $objPerson->LastName, $objPerson->Id);
         }
     }
     $this->chkPersons->RepeatColumns = 2;
     $this->chkPersons->AddAction(new QChangeEvent(), new QServerAction('chkPersons_Change'));
 }
Ejemplo n.º 17
0
 public function testAlias1()
 {
     $objPersonArray = Person::QueryArray(QQ::AndCondition(QQ::Equal(QQ::Alias(QQN::Person()->ProjectAsTeamMember, 'pm1')->ProjectId, 1), QQ::Equal(QQ::Alias(QQN::Person()->ProjectAsTeamMember, 'pm2')->ProjectId, 2)));
     $this->assertEqual(sizeof($objPersonArray), 3);
     $this->verifyObjectPropertyHelper($objPersonArray, 'FirstName', 'Kendall');
     $this->verifyObjectPropertyHelper($objPersonArray, 'LastName', 'Wolfe');
     $this->verifyObjectPropertyHelper($objPersonArray, 'LastName', 'Smith');
 }
Ejemplo n.º 18
0
 protected function Form_Create()
 {
     // Define the DataGrid
     $this->dtgPersons = new QDataGrid($this);
     $this->dtgPersons->CellPadding = 5;
     $this->dtgPersons->CellSpacing = 0;
     // Define Columns -- we will define render helper methods to help with the rendering
     // of the HTML for most of these 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))));
     // Setup the First and Last name columns with HtmlEntities set to false (because they may be rendering textbox controls)
     $this->dtgPersons->AddColumn(new QDataGridColumn('First Name', '<?= $_FORM->FirstNameColumn_Render($_ITEM) ?>', 'Width=200', 'HtmlEntities=false', array('OrderByClause' => QQ::OrderBy(QQN::Person()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->FirstName, false))));
     $this->dtgPersons->AddColumn(new QDataGridColumn('Last Name', '<?= $_FORM->LastNameColumn_Render($_ITEM) ?>', 'Width=200', 'HtmlEntities=false', array('OrderByClause' => QQ::OrderBy(QQN::Person()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->LastName, false))));
     // Again, we setup the "Edit" column and ensure that the column's HtmlEntities is set to false
     $this->dtgPersons->AddColumn(new QDataGridColumn('Edit', '<?= $_FORM->EditColumn_Render($_ITEM) ?>', 'Width=120', 'HtmlEntities=false'));
     // Let's pre-default the sorting by id (column index #0) and use AJAX
     $this->dtgPersons->SortColumnIndex = 0;
     $this->dtgPersons->UseAjax = true;
     // 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';
     // Create the other textboxes and buttons -- make sure we specify
     // the datagrid as the parent.  If they hit the escape key, let's perform a Cancel.
     // Note that we need to terminate the action on the escape key event, too, b/c
     // many browsers will perform additional processing that we won't not want.
     $this->txtFirstName = new QTextBox($this->dtgPersons);
     $this->txtFirstName->Required = true;
     $this->txtFirstName->MaxLength = 50;
     $this->txtFirstName->Width = 200;
     $this->txtFirstName->AddAction(new QEscapeKeyEvent(), new QAjaxAction('btnCancel_Click'));
     $this->txtFirstName->AddAction(new QEscapeKeyEvent(), new QTerminateAction());
     $this->txtLastName = new QTextBox($this->dtgPersons);
     $this->txtLastName->Required = true;
     $this->txtLastName->MaxLength = 50;
     $this->txtLastName->Width = 200;
     $this->txtLastName->AddAction(new QEscapeKeyEvent(), new QAjaxAction('btnCancel_Click'));
     $this->txtLastName->AddAction(new QEscapeKeyEvent(), new QTerminateAction());
     // We want the Save button to be Primary, so that the save will perform if the
     // user hits the enter key in either of the textboxes.
     $this->btnSave = new QButton($this->dtgPersons);
     $this->btnSave->Text = 'Save';
     $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click'));
     $this->btnSave->PrimaryButton = true;
     $this->btnSave->CausesValidation = true;
     // Make sure we turn off validation on the Cancel button
     $this->btnCancel = new QButton($this->dtgPersons);
     $this->btnCancel->Text = 'Cancel';
     $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click'));
     $this->btnCancel->CausesValidation = false;
     // Finally, let's add a "New" button
     $this->btnNew = new QButton($this);
     $this->btnNew->Text = 'New';
     $this->btnNew->AddAction(new QClickEvent(), new QAjaxAction('btnNew_Click'));
     $this->btnNew->CausesValidation = false;
 }
Ejemplo n.º 19
0
 protected function Form_Create()
 {
     // Define the DataGrid
     $this->dtgPersons = new QDataGrid($this);
     // Define Columns -- we will define render helper methods to help with the rendering
     // of the HTML for most of these columns
     $col = $this->dtgPersons->CreateNodeColumn('Person Id', QQN::Person()->Id);
     $col->CellStyler->Width = 100;
     $col = $this->dtgPersons->CreateCallableColumn('First Name', [$this, 'FirstNameColumn_Render']);
     $col->CellStyler->Width = 200;
     $col->HtmlEntities = false;
     $col = $this->dtgPersons->CreateCallableColumn('Last Name', [$this, 'LastNameColumn_Render']);
     $col->HtmlEntities = false;
     $col->CellStyler->Width = 200;
     $col = $this->dtgPersons->CreateCallableColumn('Edit', [$this, 'EditColumn_Render']);
     $col->HtmlEntities = false;
     $col->CellStyler->Width = 120;
     // Let's pre-default the sorting by id (column index #0) and use AJAX
     $this->dtgPersons->SortColumnIndex = 0;
     $this->dtgPersons->UseAjax = true;
     // Specify the DataBinder method for the DataGrid
     $this->dtgPersons->SetDataBinder('dtgPersons_Bind');
     // Create the other textboxes and buttons -- make sure we specify
     // the datagrid as the parent.  If they hit the escape key, let's perform a Cancel.
     // Note that we need to terminate the action on the escape key event, too, b/c
     // many browsers will perform additional processing that we won't not want.
     $this->txtFirstName = new QTextBox($this->dtgPersons);
     $this->txtFirstName->Required = true;
     $this->txtFirstName->MaxLength = 50;
     $this->txtFirstName->Width = 200;
     $this->txtFirstName->AddAction(new QEscapeKeyEvent(), new QAjaxAction('btnCancel_Click'));
     $this->txtFirstName->AddAction(new QEscapeKeyEvent(), new QTerminateAction());
     $this->txtLastName = new QTextBox($this->dtgPersons);
     $this->txtLastName->Required = true;
     $this->txtLastName->MaxLength = 50;
     $this->txtLastName->Width = 200;
     $this->txtLastName->AddAction(new QEscapeKeyEvent(), new QAjaxAction('btnCancel_Click'));
     $this->txtLastName->AddAction(new QEscapeKeyEvent(), new QTerminateAction());
     // We want the Save button to be Primary, so that the save will perform if the
     // user hits the enter key in either of the textboxes.
     $this->btnSave = new QButton($this->dtgPersons);
     $this->btnSave->Text = 'Save';
     $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click'));
     $this->btnSave->PrimaryButton = true;
     $this->btnSave->CausesValidation = true;
     // Make sure we turn off validation on the Cancel button
     $this->btnCancel = new QButton($this->dtgPersons);
     $this->btnCancel->Text = 'Cancel';
     $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click'));
     $this->btnCancel->CausesValidation = false;
     // Finally, let's add a "New" button
     $this->btnNew = new QButton($this);
     $this->btnNew->Text = 'New';
     $this->btnNew->AddAction(new QClickEvent(), new QAjaxAction('btnNew_Click'));
     $this->btnNew->CausesValidation = false;
 }
Ejemplo n.º 20
0
 public function testAssociationTables()
 {
     // All People Who Are on a Project Managed by Karen Wolfe (Person ID #7)
     $objPersonArray = Person::QueryArray(QQ::Equal(QQN::Person()->ProjectAsTeamMember->Project->ManagerPersonId, 7), QQ::Clause(QQ::Distinct(), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
     $arrNamesOnly = array();
     foreach ($objPersonArray as $item) {
         $arrNamesOnly[] = $item->FirstName . " " . $item->LastName;
     }
     $this->assertEqual($arrNamesOnly, array("Brett Carlisle", "John Doe", "Samantha Jones", "Jacob Pratt", "Kendall Public", "Ben Robinson", "Alex Smith", "Wendy Smith", "Karen Wolfe"), "List managed persons is correct");
 }
Ejemplo n.º 21
0
 public function auto_Bind($strFormId, $strControlId, $term)
 {
     $cond = QQ::OrCondition(QQ::Like(QQN::Person()->FirstName, '%' . $term . '%'), QQ::Like(QQN::Person()->LastName, '%' . $term . '%'));
     $a = Person::QueryArray($cond);
     $items = array();
     foreach ($a as $obj) {
         $items[] = new QListItem($obj->FirstName . ' ' . $obj->LastName, $obj->Id);
     }
     $this->auto2->DataSource = $items;
 }
 public function dtrResults_Bind()
 {
     if (trim($this->txtMemberSearch->Text)) {
         $objArray = array(null);
         $objArray = array_merge($objArray, Person::LoadArrayForMemberSearch(trim($this->txtMemberSearch->Text), array(QQ::OrderBy(QQN::Person()->DisplayName))));
         $this->dtrResults->DataSource = $objArray;
     } else {
         $this->dtrResults->DataSource = array(null);
     }
 }
Ejemplo n.º 23
0
 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);
     $this->dtgItems->DataSource = Person::QueryArray(QQ::AndCondition(QQ::GreaterOrEqual(QQN::Person()->StewardshipContribution->DateCredited, $dttStart), QQ::LessThan(QQN::Person()->StewardshipContribution->DateCredited, $dttEnd), QQ::IsNull(QQN::Person()->PrimaryAddressText), QQ::IsNull(QQN::Person()->StewardshipAddressId)), QQ::Clause(QQ::Distinct(), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
 }
 public function __construct($objParentObject, $objProject, $strPanelRightControlId, $strControlId = null)
 {
     // First, let's call the Parent's __constructor
     try {
         parent::__construct($objParentObject, $strControlId);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     // Next, we set the local project object
     $this->objProject = $objProject;
     /* Let's record the reference to the form's RightPanel
      * Note: this ProjectViewPanel needs the reference to the main form's RightPanel so that it can
      * "update" the RightPanel's contents during the ProjectViewPanel's event handlers (e.g., when the user
      * click's "Edit" on a Person, this ProjectViewPanel's btnEdit_Click handler will update RightPanel
      * to display the PersonEditPanel panel.
      *
      * HOWEVER, realize that this interaction can be done many different ways.
      * A very suitable alternative would be for this __construct to take in a public method name from the Form instead
      * of $strPanelRightControlId.  And btnEdit_Click, instead of updating the right panel directly, could simply
      * make a call to the Form's method, and the interaction could be defined on the Form itself.
      *
      * This design decision depends on how tightly coupled the custom panels are together, or if each panel
      * is to be more independent and you want the Form to define the interaction only.  So it would depend on how
      * the developer would want to do it.
      *
      * We show an example of accessing the RightPanel direclty in ProjectViewPanel, and we show examples
      * of MethodCallbacks on the Form in ProjectEditPanel and PersonEditPanel.
      */
     $this->strPanelRightControlId = $strPanelRightControlId;
     // Let's set up some other local child control
     // Notice that we define the child controls' parents to be "this", which is this ProjectViewPanel object.
     $this->pnlTitle = new QPanel($this);
     $this->pnlTitle->Text = $objProject->Name;
     $this->pnlTitle->CssClass = 'projectTitle';
     $this->btnEditProject = new QButton($this);
     $this->btnEditProject->Text = 'Edit Project Name';
     $this->btnEditProject->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnEditProject_Click'));
     // Now, let's set up this custom panel's child controls
     $this->dtgMembers = new QDataGrid($this);
     $col = $this->dtgMembers->CreateNodeColumn('ID', QQN::Person()->Id);
     $col->CellStyler->Width = 30;
     $col = $this->dtgMembers->CreateNodeColumn('First Name', QQN::Person()->FirstName);
     $col->CellStyler->Width = 120;
     $col = $this->dtgMembers->CreateNodeColumn('Last Name', QQN::Person()->LastName);
     $col->CellStyler->Width = 120;
     $col = $this->dtgMembers->CreateCallableColumn('Edit', [$this, 'EditColumn_Render']);
     $col->HtmlEntities = false;
     // Let's make sorting Ajax-ified
     $this->dtgMembers->UseAjax = true;
     // Finally, we take advantage of the DataGrid's SetDataBinder to specify the method we use to actually bind
     // a datasource to the DataGrid
     $this->dtgMembers->SetDataBinder('dtgMembers_Bind', $this);
 }
Ejemplo n.º 25
0
 protected function BindData()
 {
     if ($strFilter = $this->dtgTable->Search["search"]) {
         $objCondition = QQ::OrCondition(QQ::Like(QQN::Person()->FirstName, '%' . $strFilter . '%'), QQ::Like(QQN::Person()->LastName, '%' . $strFilter . '%'));
     } else {
         $objCondition = QQ::All();
     }
     $this->dtgTable->TotalItemCount = Person::QueryCount($objCondition);
     $objClauses[] = $this->dtgTable->OrderByClause;
     $objClauses[] = $this->dtgTable->LimitClause;
     $this->dtgTable->DataSource = Person::QueryArray($objCondition, $objClauses);
 }
Ejemplo n.º 26
0
 protected function Form_Create()
 {
     // Define the DataGrid
     $this->tblPersons = new QHtmlTable($this);
     $this->tblPersons->CssClass = 'simple_table';
     $this->tblPersons->RowCssClass = 'odd_row';
     $this->tblPersons->AlternateRowCssClass = 'even_row';
     $this->tblPersons->HeaderRowCssClass = 'header_row';
     // Define Columns
     // This demonstrates how to first create a column, and then add it to the table
     $objColumn = new QHtmlTableCallableColumn('Full Name', [$this, 'getFullName']);
     $this->tblPersons->AddColumn($objColumn);
     // The second column demonstrates using a property name for fetching the data
     // This also demonstrates how to create a column and add it to the table all at once, using the CreatePropertyColumn shortcut
     $this->tblPersons->CreatePropertyColumn('First Name', 'FirstName');
     // The second column demonstrates using a node column for fetching the data
     $this->tblPersons->CreateNodeColumn('Last Name', QQN::Person()->LastName);
     // Specify the local Method which will actually bind the data source to the datagrid.
     // In order to not over-bloat the form state, the datagrid will use the data source only when rendering itself,
     // and then it will proceed to remove the data source from memory.  Because of this, you will need to define
     // a "data binding" method which will set the datagrid's data source.  You specify the name of the method
     // here.  The framework will be responsible for calling your data binding method whenever the datagrid wants
     // to render itself.
     $this->tblPersons->SetDataBinder('tblPersons_Bind');
     $this->tblReport = new QHtmlTable($this);
     $this->tblReport->CssClass = 'simple_table';
     $this->tblReport->RowCssClass = 'odd_row';
     $this->tblReport->AlternateRowCssClass = 'even_row';
     $this->tblReport->HeaderRowCssClass = 'header_row';
     // "named" index columns
     $this->tblReport->CreateIndexedColumn("Year", 0);
     $this->tblReport->CreateIndexedColumn("Model", 1);
     // "unnamed" index columns
     $this->tblReport->CreateIndexedColumn();
     $this->tblReport->CreateIndexedColumn();
     // index columns for associative arrays
     $this->tblReport->CreateIndexedColumn("Count", "#count");
     $this->tblReport->SetDataBinder('tblReport_Bind');
     $this->tblComplex = new QHtmlTable($this);
     $this->tblComplex->CssClass = 'simple_table';
     $this->tblComplex->RowCssClass = 'odd_row';
     $this->tblComplex->AlternateRowCssClass = 'even_row';
     $this->tblComplex->HeaderRowCssClass = 'header_row';
     // "named" index columns
     $col = $this->tblComplex->AddColumn(new ComplexColumn("", "Name"));
     $col->RenderAsHeader = true;
     $this->tblComplex->AddColumn(new ComplexColumn("2000", 1));
     $this->tblComplex->AddColumn(new ComplexColumn("2001", 2));
     $this->tblComplex->AddColumn(new ComplexColumn("2002", 3));
     $this->tblComplex->HeaderRowCount = 2;
     $this->tblComplex->SetDataBinder('tblComplex_Bind');
 }
Ejemplo n.º 27
0
 protected function Form_Create()
 {
     // Setup DataGrid Columns
     $this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_FORM->dtgPerson_EditLinkColumn_Render($_ITEM) ?>');
     $this->colEditLinkColumn->HtmlEntities = false;
     $this->colId = new QDataGridColumn(QApplication::Translate('Id'), '<?= $_ITEM->Id; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Id), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Id, false)));
     $this->colPersonTypeId = new QDataGridColumn(QApplication::Translate('Person Type'), '<?= $_FORM->dtgPerson_PersonTypeId_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->PersonTypeId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->PersonTypeId, false)));
     $this->colUsername = new QDataGridColumn(QApplication::Translate('Username'), '<?= QString::Truncate($_ITEM->Username, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Username), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Username, false)));
     $this->colPassword = new QDataGridColumn(QApplication::Translate('Password'), '<?= QString::Truncate($_ITEM->Password, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Password), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Password, false)));
     $this->colFirstName = new QDataGridColumn(QApplication::Translate('First Name'), '<?= QString::Truncate($_ITEM->FirstName, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->FirstName, false)));
     $this->colLastName = new QDataGridColumn(QApplication::Translate('Last Name'), '<?= QString::Truncate($_ITEM->LastName, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->LastName, false)));
     $this->colEmail = new QDataGridColumn(QApplication::Translate('Email'), '<?= QString::Truncate($_ITEM->Email, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Email), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Email, false)));
     $this->colDisplayRealNameFlag = new QDataGridColumn(QApplication::Translate('Display Real Name Flag'), '<?= ($_ITEM->DisplayRealNameFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->DisplayRealNameFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->DisplayRealNameFlag, false)));
     $this->colDisplayEmailFlag = new QDataGridColumn(QApplication::Translate('Display Email Flag'), '<?= ($_ITEM->DisplayEmailFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->DisplayEmailFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->DisplayEmailFlag, false)));
     $this->colOptInFlag = new QDataGridColumn(QApplication::Translate('Opt In Flag'), '<?= ($_ITEM->OptInFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->OptInFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->OptInFlag, false)));
     $this->colDonatedFlag = new QDataGridColumn(QApplication::Translate('Donated Flag'), '<?= ($_ITEM->DonatedFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->DonatedFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->DonatedFlag, false)));
     $this->colLocation = new QDataGridColumn(QApplication::Translate('Location'), '<?= QString::Truncate($_ITEM->Location, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Location), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Location, false)));
     $this->colCountryId = new QDataGridColumn(QApplication::Translate('Country Id'), '<?= $_ITEM->CountryId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->CountryId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->CountryId, false)));
     $this->colUrl = new QDataGridColumn(QApplication::Translate('Url'), '<?= QString::Truncate($_ITEM->Url, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Url), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Url, false)));
     $this->colRegistrationDate = new QDataGridColumn(QApplication::Translate('Registration Date'), '<?= $_FORM->dtgPerson_RegistrationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::Person()->RegistrationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->RegistrationDate, false)));
     // 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;
     // Datagrid Paginator
     $this->dtgPerson->Paginator = new QPaginator($this->dtgPerson);
     $this->dtgPerson->ItemsPerPage = 10;
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgPerson->UseAjax = false;
     // Specify the local databind method this datagrid will use
     $this->dtgPerson->SetDataBinder('dtgPerson_Bind');
     $this->dtgPerson->AddColumn($this->colEditLinkColumn);
     $this->dtgPerson->AddColumn($this->colId);
     $this->dtgPerson->AddColumn($this->colPersonTypeId);
     $this->dtgPerson->AddColumn($this->colUsername);
     $this->dtgPerson->AddColumn($this->colPassword);
     $this->dtgPerson->AddColumn($this->colFirstName);
     $this->dtgPerson->AddColumn($this->colLastName);
     $this->dtgPerson->AddColumn($this->colEmail);
     $this->dtgPerson->AddColumn($this->colDisplayRealNameFlag);
     $this->dtgPerson->AddColumn($this->colDisplayEmailFlag);
     $this->dtgPerson->AddColumn($this->colOptInFlag);
     $this->dtgPerson->AddColumn($this->colDonatedFlag);
     $this->dtgPerson->AddColumn($this->colLocation);
     $this->dtgPerson->AddColumn($this->colCountryId);
     $this->dtgPerson->AddColumn($this->colUrl);
     $this->dtgPerson->AddColumn($this->colRegistrationDate);
 }
Ejemplo n.º 28
0
 public function dtgMembers_Bind()
 {
     $objCondition = QQ::In(QQN::Person()->GroupParticipation->GroupId, $this->intGroupIdArray);
     $objCondition = QQ::AndCondition($objCondition, QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd));
     $this->dtgMembers->TotalItemCount = Person::QueryCount($objCondition);
     $objClauses = array(QQ::Distinct());
     if ($objClause = $this->dtgMembers->LimitClause) {
         $objClauses[] = $objClause;
     }
     if ($objClause = $this->dtgMembers->OrderByClause) {
         $objClauses[] = $objClause;
     }
     $this->dtgMembers->DataSource = Person::QueryArray($objCondition, $objClauses);
 }
Ejemplo n.º 29
0
 protected function Form_Create()
 {
     // Define the DataGrid
     $this->dtgPersons = new QDataGrid($this, 'dtgPersons');
     // Style this with a QCubed built-in style that will highlight the row hovered over.
     $this->dtgPersons->AddCssClass('clickable-rows');
     // Define Columns
     $this->dtgPersons->CreateNodeColumn('First Name', QQN::Person()->FirstName);
     $this->dtgPersons->CreateNodeColumn('Last Name', QQN::Person()->LastName);
     // Specify the Datagrid's Data Binder method
     $this->dtgPersons->SetDataBinder('dtgPersons_Bind');
     // Attach a callback to the table that will create an attribute in the row's tr tag that will be the id of data row in the database
     $this->dtgPersons->RowParamsCallback = [$this, 'dtgPersons_GetRowParams'];
     // Add an action that will detect a click on the row, and return the html data value that was created by RowParamsCallback
     $this->dtgPersons->AddAction(new QCellClickEvent(0, null, QCellClickEvent::RowDataValue('value')), new QAjaxAction('dtgPersonsRow_Click'));
 }
Ejemplo n.º 30
0
 protected function Form_Create()
 {
     // Define the DataGrid
     $this->dtgPersons = new QDataGrid($this);
     $this->dtgPersons->ShowFilter = 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 = 20;
     // Define Columns
     $idCol = new QDataGridColumn('Person ID', '<?= $_ITEM->Id ?>', 'Width=100', array('OrderByClause' => QQ::OrderBy(QQN::Person()->Id), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->Id, false)));
     $idCol->Filter = QQ::Equal(QQN::Person()->Id, null);
     $idCol->FilterType = QFilterType::TextFilter;
     $idCol->FilterBoxSize = 3;
     //note that due to the CSS applied to the examples, this doesn't do anything
     $this->dtgPersons->AddColumn($idCol);
     $fNameCol = new QDataGridColumn('First Name', '<?= $_ITEM->FirstName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->FirstName, false)));
     $fNameCol->Filter = QQ::Like(QQN::Person()->FirstName, null);
     $fNameCol->FilterPrefix = $fNameCol->FilterPostfix = '%';
     $fNameCol->FilterType = QFilterType::TextFilter;
     $this->dtgPersons->AddColumn($fNameCol);
     $lNameCol = new QDataGridColumn('Last Name', '<?= $_ITEM->LastName ?>', 'Width=200', array('OrderByClause' => QQ::OrderBy(QQN::Person()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::Person()->LastName, false)));
     QQN::Person()->LastName->SetFilteredDataGridColumnFilter($lNameCol);
     $this->dtgPersons->AddColumn($lNameCol);
     // Let's default the sorting to the last name column (column #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';
 }