本文整理汇总了PHP中QQ::Expand方法的典型用法代码示例。如果您正苦于以下问题:PHP QQ::Expand方法的具体用法?PHP QQ::Expand怎么用?PHP QQ::Expand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQ
的用法示例。
在下文中一共展示了QQ::Expand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Form_PreRender
protected function Form_PreRender()
{
$objExpansionMap[UserAccount::ExpandCreatedByObject] = true;
$objExpansionMap[UserAccount::ExpandRole] = true;
// Get Total Count b/c of Pagination
$this->dtgUserAccount->TotalItemCount = UserAccount::CountAll();
if ($this->dtgUserAccount->TotalItemCount == 0) {
$this->dtgUserAccount->ShowHeader = false;
} else {
$objClauses = array();
if ($objClause = $this->dtgUserAccount->OrderByClause) {
array_push($objClauses, $objClause);
}
if ($objClause = $this->dtgUserAccount->LimitClause) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::UserAccount()->CreatedByObject)) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::UserAccount()->Role)) {
$this->dtgUserAccount->DataSource = UserAccount::LoadAll($objClauses);
}
$this->dtgUserAccount->ShowHeader = true;
}
}
示例2: __construct
public function __construct(QPanel $pnlContent, $strReturnUrl)
{
$this->pnlContent = $pnlContent;
$this->pnlContent->Template = dirname(__FILE__) . '/EditGroupParticipationDelegate.tpl.php';
// Throw Exception if Group Cannot have Explicitly Defined Participants
if (!$this->pnlContent->objGroup->IsGroupCanHaveExplicitlyDefinedParticipants()) {
throw new Exception('Group Cannot have Explicitly Defined Participants');
}
$this->strReturnUrl = $strReturnUrl;
$this->objParticipationArray = GroupParticipation::LoadArrayByPersonIdGroupId($this->pnlContent->objPerson->Id, $this->pnlContent->objGroup->Id, QQ::OrderBy(QQN::GroupParticipation()->GroupRole->Name, QQN::GroupParticipation()->DateStart), QQ::Clause(QQ::Expand(QQN::GroupParticipation()->GroupRole)));
$this->chkIsAuthorizedSender = new QCheckBox($this->pnlContent);
$this->chkIsAuthorizedSender->Name = ' Is Authorized Sender';
if (GroupAuthorizedSender::LoadByGroupIdPersonId($this->pnlContent->objGroup->Id, $this->pnlContent->objPerson->Id)) {
$this->chkIsAuthorizedSender->Checked = true;
} else {
$this->chkIsAuthorizedSender->Checked = false;
}
$this->lblCurrentRoles = new QLabel($this->pnlContent);
$this->lblCurrentRoles->Name = 'Current Roles';
$this->lblCurrentRoles->HtmlEntities = false;
$this->lblCurrentRoles_Refresh();
$this->dtgParticipations = new QDataGrid($this->pnlContent);
$this->dtgParticipations->AddColumn(new QDataGridColumn('Role', '<?= $_CONTROL->ParentControl->objDelegate->RenderRole($_ITEM); ?>', 'HtmlEntities=false', 'Width=100px'));
$this->dtgParticipations->AddColumn(new QDataGridColumn('Participation Started', '<?= $_CONTROL->ParentControl->objDelegate->RenderDateStart($_ITEM); ?>', 'HtmlEntities=false', 'Width=150px'));
$this->dtgParticipations->AddColumn(new QDataGridColumn('Participation Ended', '<?= $_CONTROL->ParentControl->objDelegate->RenderDateEnd($_ITEM); ?>', 'HtmlEntities=false', 'Width=150px'));
$this->dtgParticipations->SetDataBinder('dtgParticipations_Bind', $this);
$this->pxyEdit = new QControlProxy($this->pnlContent);
$this->pxyEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this->pnlContent, 'pxyEdit_Click'));
$this->pxyEdit->AddAction(new QClickEvent(), new QTerminateAction());
$this->dlgEdit_Setup();
}
示例3: LoadWithToContactToUserByTransactionId
/**
* Load a single AssetTransactionCheckout object with expansion map of Contact and UserAccount,
* by TransactionId
* @param integer $intAssetId
* @return object $objAssetTransactionCheckout
*/
public function LoadWithToContactToUserByTransactionId($intAssetTransactionId = null)
{
$objClauses = array();
array_push($objClauses, QQ::Expand(QQN::AssetTransactionCheckout()->ToContact));
array_push($objClauses, QQ::Expand(QQN::AssetTransactionCheckout()->ToUser));
$objAssetTransactionCheckout = AssetTransactionCheckout::QuerySingle(QQ::Equal(QQN::AssetTransactionCheckout()->AssetTransactionId, $intAssetTransactionId), $objClauses);
return $objAssetTransactionCheckout;
}
示例4: __construct
public function __construct(QcodoClass $objQcodoClass, $objParentControl, $strControlId = null)
{
parent::__construct($objParentControl, $strControlId);
// We're looking at ALL Methods/Operations
$this->objQcodoClass = $objQcodoClass;
$this->strUrl = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php/' . $this->objQcodoClass->Name . '/Constants';
$this->strTemplate = 'ConstantPanel.tpl.php';
$this->objConstantArray = $this->objQcodoClass->GetQcodoConstantArray(QQ::Clause(QQ::OrderBy(QQN::QcodoConstant()->Variable->Name), QQ::Expand(QQN::QcodoConstant()->Variable)));
}
示例5: testSelectSubsetInExpand
public function testSelectSubsetInExpand()
{
$objPersonArray = Person::QueryArray(QQ::OrCondition(QQ::Like(QQN::Person()->ProjectAsManager->Name, '%ACME%'), QQ::Like(QQN::Person()->ProjectAsManager->Name, '%HR%')), QQ::Clause(QQ::Select(QQN::Person()->LastName), QQ::Expand(QQN::Person()->ProjectAsManager, null, QQ::Select(QQN::Person()->ProjectAsManager->Spent)), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
foreach ($objPersonArray as $objPerson) {
$this->assertNull($objPerson->FirstName, "FirstName 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");
$this->assertNotNull($objPerson->_ProjectAsManager->Id, "ProjectAsManager->Id should not be null since id's are always added to the select list");
$this->assertNull($objPerson->_ProjectAsManager->Name, "ProjectAsManager->Name should be null since it was not selected");
}
}
示例6: Go_Click
protected function Go_Click()
{
QApplication::$blnLocalCache = false;
$timeNoCache = -microtime(true);
$a = Person::LoadAll();
// noncached loads
$timeNoCache += microtime(true);
QApplication::$blnLocalCache = true;
$timeLoad1Cached = -microtime(true);
$a = Person::LoadAll();
// noncached loads
$timeLoad1Cached += microtime(true);
$timeLoad2Cached = -microtime(true);
$a = Person::LoadAll();
// cached loads
$timeLoad2Cached += microtime(true);
QApplication::$blnLocalCache = new QCacheProviderLocalMemory(array());
$timeLoad3Cached = -microtime(true);
$a = Person::LoadAll();
// noncached loads
$timeLoad3Cached += microtime(true);
$timeLoad4Cached = -microtime(true);
$a = Person::LoadAll();
// cached loads
$timeLoad4Cached += microtime(true);
$this->pnlTiny->Text = sprintf("Load No Cache: %2.1f%% \n", 100 * $timeNoCache / $timeNoCache) . sprintf("Populate Cache: %2.1f%% \n", 100 * $timeLoad1Cached / $timeNoCache) . sprintf("Load With Cache: %2.1f%% \n", 100 * $timeLoad2Cached / $timeNoCache) . sprintf("Populate LocalCacheProvider: %2.1f%% \n", 100 * $timeLoad3Cached / $timeNoCache) . sprintf("Load LocalCacheProvider: %2.1f%% \n", 100 * $timeLoad4Cached / $timeNoCache);
$cond = QQ::Equal(QQN::Project()->ProjectStatusTypeId, ProjectStatusType::Open);
$clauses[] = QQ::Expand(QQN::Project()->ManagerPerson);
Project::ClearCache();
Person::ClearCache();
QApplication::$blnLocalCache = false;
$timeNoCache = -microtime(true);
$a = Project::QueryArray($cond, $clauses);
// noncached loads
$timeNoCache += microtime(true);
QApplication::$blnLocalCache = true;
$timeLoad1Cached = -microtime(true);
$a = Project::QueryArray($cond, $clauses);
// noncached loads
$timeLoad1Cached += microtime(true);
$timeLoad2Cached = -microtime(true);
$a = Project::QueryArray($cond, $clauses);
// cached loads
$timeLoad2Cached += microtime(true);
QApplication::$blnLocalCache = new QCacheProviderLocalMemory(array());
$timeLoad3Cached = -microtime(true);
$a = Project::QueryArray($cond, $clauses);
// noncached loads
$timeLoad3Cached += microtime(true);
$timeLoad4Cached = -microtime(true);
$a = Project::QueryArray($cond, $clauses);
// cached loads
$timeLoad4Cached += microtime(true);
$this->pnlBig->Text = sprintf("Load No Cache: %2.1f%% \n", 100 * $timeNoCache / $timeNoCache) . sprintf("Populate Cache: %2.1f%% \n", 100 * $timeLoad1Cached / $timeNoCache) . sprintf("Load With Cache: %2.1f%% \n", 100 * $timeLoad2Cached / $timeNoCache) . sprintf("Populate LocalCacheProvider: %2.1f%% \n", 100 * $timeLoad3Cached / $timeNoCache) . sprintf("Load LocalCacheProvider: %2.1f%% \n", 100 * $timeLoad4Cached / $timeNoCache);
}
示例7: Form_Create
protected function Form_Create()
{
// Create the Header Menu
$this->ctlHeaderMenu_Create();
$this->ctlShortcutMenu_Create();
if ($_GET && $_GET['method'] == 'delete') {
$objAudit = Audit::Load($_GET['intAuditId']);
if ($objAudit) {
$objAudit->Delete();
QApplication::Redirect("./inventory_audit_list.php");
}
}
// Load an array of Audit objects using join on UserAccount.
$this->objAuditArray = Audit::LoadArrayByEntityQtypeId(2, QQ::Clause(QQ::Expand(QQN::Audit()->CreatedByObject)));
}
示例8: __get
public function __get($strName)
{
switch ($strName) {
case 'ShortDescriptionAsHtml':
$strToReturn = QApplication::HtmlEntities(trim($this->strShortDescription));
$strToReturn = str_replace("\r", '', $strToReturn);
$strToReturn = str_replace("\n", '<br/>', $strToReturn);
return $strToReturn;
case 'Parameters':
return $this->GetParameterArray(QQ::Clause(QQ::OrderBy(QQN::Parameter()->OrderNumber), QQ::Expand(QQN::Parameter()->Variable)));
/* ONLY TO BE USED when OPERATION is restored via QcodoClass::Operations */
/* ONLY TO BE USED when OPERATION is restored via QcodoClass::Operations */
case 'InheritenceState':
return $this->intInheritenceState;
/* ONLY TO BE USED when OPERATION is restored via QcodoClass::Operations */
/* ONLY TO BE USED when OPERATION is restored via QcodoClass::Operations */
case 'OverridesOperation':
return $this->objOverridesOperation;
/* CAN BE USED ANYWHERE */
/* CAN BE USED ANYWHERE */
case 'Overrides':
$objClass = $this->QcodoClass->ParentQcodoClass;
while ($objClass) {
if ($objOperation = Operation::LoadByQcodoClassIdQcodoInterfaceIdName($objClass->Id, null, $this->strName)) {
return $objOperation;
}
$objClass = $objClass->ParentQcodoClass;
}
return null;
case 'DisplayName':
switch ($this->intInheritenceState) {
case InheritenceState::Interited:
return $this->strName . ' <img src="/images/inherited_light.png" border="0" alt="Inherited"/>';
case InheritenceState::Overrides:
return $this->strName . ' <img src="/images/overrides.png" border="0" alt="Overrides"/>';
default:
return $this->strName;
}
default:
try {
return parent::__get($strName);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
}
示例9: dtgLanguage_Create
protected function dtgLanguage_Create()
{
$this->dtgLanguage = new NarroLanguageDataGrid($this);
$this->dtgLanguage->SortColumnIndex = 1;
$this->dtgLanguage->SortDirection = 1;
$this->dtgLanguage->AdditionalConditions = QQ::AndCondition(QQ::Equal(QQN::NarroLanguage()->Active, true), QQ::Equal(QQN::NarroLanguage()->NarroProjectProgressAsLanguage->ProjectId, $this->objProject->ProjectId));
$this->dtgLanguage->AdditionalClauses = array(QQ::Expand(QQN::NarroLanguage()->NarroProjectProgressAsLanguage));
$colLanguage = $this->dtgLanguage->MetaAddColumn(QQN::NarroLanguage()->LanguageName);
$colLanguage->Name = t('Language');
$colProgress = new QDataGridColumn(t('Progress'));
$colProgress->Html = '<?=$_CONTROL->ParentControl->dtgLanguage_PercentTranslated_Render($_ITEM)?>';
$colProgress->HtmlEntities = false;
$colProgress->OrderByClause = QQ::OrderBy(QQN::NarroLanguage()->NarroProjectProgressAsLanguage->ProgressPercent, 1, QQN::NarroLanguage()->NarroProjectProgressAsLanguage->FuzzyTextCount, 1);
$colProgress->ReverseOrderByClause = QQ::OrderBy(QQN::NarroLanguage()->NarroProjectProgressAsLanguage->ProgressPercent, 0, QQN::NarroLanguage()->NarroProjectProgressAsLanguage->FuzzyTextCount, 0);
$this->dtgLanguage->AddColumn($colProgress);
//$colLanguage = $this->dtgLanguage->MetaAddColumn(QQN::NarroLanguage()->NarroProjectProgressAsLanguage->ProgressPercent);
}
示例10: Form_Create
protected function Form_Create()
{
// Create the Header Menu
$this->ctlHeaderMenu_Create();
$this->ctlShortcutMenu_Create();
//QApplication::$Database[1]->EnableProfiling();
if ($_GET && $_GET['method'] == 'delete') {
$objAudit = Audit::Load($_GET['intAuditId']);
if ($objAudit) {
// Set the relationship to ON DELETE CASCADE so that the AuditScans will be automatically deleted when deleting the Audit Object
$objAudit->Delete();
QApplication::Redirect("./asset_audit_list.php");
}
}
// Load an array of Audit objects using join on UserAccount.
$this->objAuditArray = Audit::LoadAll(QQ::Clause(QQ::Expand(QQN::Audit()->CreatedByObject)));
}
示例11: testAlias3
public function testAlias3()
{
$emptySelect = QQ::Select();
$emptySelect->SetSkipPrimaryKey(true);
$nVoyel = QQ::Alias(QQN::Person()->ProjectAsManager->Milestone, 'voyel');
$nConson = QQ::Alias(QQN::Person()->ProjectAsManager->Milestone, 'conson');
$objPersonArray = Person::QueryArray(QQ::IsNotNull($nConson->Id), QQ::Clause(QQ::Expand($nVoyel, QQ::In($nVoyel->Name, array('Milestone A', 'Milestone E', 'Milestone I')), $emptySelect), QQ::Expand($nConson, QQ::NotIn($nConson->Name, array('Milestone A', 'Milestone E', 'Milestone I')), $emptySelect), QQ::GroupBy(QQN::Person()->Id), QQ::Minimum($nVoyel->Name, 'min_voyel'), QQ::Minimum($nConson->Name, 'min_conson'), QQ::Expand(QQN::Person()->ProjectAsManager, null, $emptySelect), QQ::Minimum(QQN::Person()->ProjectAsManager->Id, 'dummy'), QQ::Select(QQN::Person()->FirstName, QQN::Person()->LastName)));
$this->assertEquals(3, sizeof($objPersonArray));
$obj = $this->verifyObjectPropertyHelper($objPersonArray, 'LastName', 'Doe');
$this->assertNull($obj->GetVirtualAttribute('min_voyel'));
$this->assertEquals('Milestone F', $obj->GetVirtualAttribute('min_conson'));
$obj = $this->verifyObjectPropertyHelper($objPersonArray, 'LastName', 'Ho');
$this->assertEquals('Milestone E', $obj->GetVirtualAttribute('min_voyel'));
$this->assertEquals('Milestone D', $obj->GetVirtualAttribute('min_conson'));
$obj = $this->verifyObjectPropertyHelper($objPersonArray, 'LastName', 'Wolfe');
$this->assertEquals('Milestone A', $obj->GetVirtualAttribute('min_voyel'));
$this->assertEquals('Milestone B', $obj->GetVirtualAttribute('min_conson'));
}
示例12: RetrieveUsernameForEmail
/**
* This will email the Username information (or Usernames) for a given Email address,
* if any is found. If none is found, this will do nothing.
* @param string $strEmailAddress
*/
public static function RetrieveUsernameForEmail($strEmailAddress)
{
// Look for associated accounts
$objPublicLoginArray = PublicLogin::QueryArray(QQ::Equal(QQN::PublicLogin()->Person->PrimaryEmail->Address, $strEmailAddress), QQ::Expand(QQN::PublicLogin()->Person));
// If none found, return
if (!count($objPublicLoginArray)) {
// Setup email info
$strFromAddress = 'ALCF my.alcf Account Support <do_not_reply@alcf.net>';
$strToAddress = trim(strtolower($strEmailAddress));
$strSubject = 'Account Support: Retreive Your Username';
// Setup the SubstitutionArray
$strArray = array();
// Setup Always-Used Fields
$strArray['CONTACT'] = strip_tags(Registry::GetValue('contact_sentence_my_alcf_support'));
$strArray['EMAIL'] = $strEmailAddress;
$strTemplateName = 'retrieve_username_none';
OutgoingEmailQueue::QueueFromTemplate($strTemplateName, $strArray, $strToAddress, $strFromAddress, $strSubject);
return;
}
// Setup email info
$strFromAddress = 'ALCF my.alcf Account Support <do_not_reply@alcf.net>';
$strToAddress = trim(strtolower($strEmailAddress));
$strSubject = 'Account Support: Retreive Your Username';
// Setup the SubstitutionArray
$strArray = array();
// Setup Always-Used Fields
$strArray['PERSON_NAME'] = $objPublicLoginArray[0]->Person->Name;
$strArray['CONTACT'] = strip_tags(Registry::GetValue('contact_sentence_my_alcf_support'));
if (count($objPublicLoginArray) == 1) {
// Template
$strTemplateName = 'retrieve_username_single';
$strArray['USERNAME'] = $objPublicLoginArray[0]->Username;
} else {
// Template
$strTemplateName = 'retrieve_username_multiple';
$strUsernameList = array();
foreach ($objPublicLoginArray as $objPublicLogin) {
$strUsernameList[] = 'Username: ' . $objPublicLogin->Username;
}
$strArray['USERNAMES'] = implode("\r\n", $strUsernameList);
}
OutgoingEmailQueue::QueueFromTemplate($strTemplateName, $strArray, $strToAddress, $strFromAddress, $strSubject);
}
示例13: __construct
public function __construct(NarroText $objText, $objParentObject, $strControlId = null)
{
// Call the Parent
try {
parent::__construct($objParentObject, $strControlId);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
$this->blnAutoRenderChildren = true;
$this->intTextId = $objText->TextId;
$this->strText = sprintf('<span class="instructions">%s</span>', t('User comments'));
$this->dtgComments = new NarroTextCommentDataGrid($this);
$colComment = $this->dtgComments->MetaAddColumn(QQN::NarroTextComment()->CommentText);
$colComment->HtmlEntities = false;
$colComment->Html = '<?=$_CONTROL->ParentControl->colComment_Render($_ITEM)?>';
$this->dtgComments->ShowFilter = false;
$this->dtgComments->ShowHeader = false;
$this->dtgComments->AdditionalConditions = QQ::Equal(QQN::NarroTextComment()->TextId, $objText->TextId);
$this->dtgComments->AdditionalClauses = array(QQ::OrderBy(QQN::NarroTextComment()->Created, 1), QQ::Expand(QQN::NarroTextComment()->Language), QQ::Expand(QQN::NarroTextComment()->User));
$this->txtComment = new QTextBox($this);
$this->txtComment->Name = t('Comment');
$this->txtComment->TextMode = QTextMode::MultiLine;
$this->txtComment->PreferedRenderMethod = 'Render';
$this->txtComment->Columns = 80;
$this->txtComment->ToolTip = t('Enter your comments here');
$this->txtComment->CssClass = 'comment';
$this->txtComment->DisplayStyle = QDisplayStyle::Block;
$this->txtComment->Display = QApplication::HasPermissionForThisLang('Can comment');
$this->btnSave = new QImageButton($this);
$this->btnSave->AlternateText = t('Add comment');
$this->btnSave->CssClass = 'imgbutton save';
$this->btnSave->ToolTip = $this->btnSave->AlternateText;
$this->btnSave->ImageUrl = __NARRO_IMAGE_ASSETS__ . '/comment.png';
$this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
$this->btnSave->Display = QApplication::HasPermissionForThisLang('Can comment');
}
示例14: Form_Create
protected function Form_Create()
{
// Define the DataGrid -- note that the Meta DataGrid is a DataGrid, itself --
// so let's just use it as a datagrid
$this->dtgProjects = new ProjectDataGrid($this);
// Only show projects whose status is "open"
$this->dtgProjects->AdditionalConditions = QQ::Equal(QQN::Project()->ProjectStatusTypeId, ProjectStatusType::Open);
//expand on the ManagerPerson's login, since we're displaying it
$this->dtgProjects->AdditionalClauses = array(QQ::Expand(QQN::Project()->ManagerPerson), QQ::Expand(QQN::Project()->ManagerPerson->Login));
// DataBinding is already configured -- so we do not need to worry about it
// But remember that dtgProjects is just a regular datagrid, as well
// So we can configure as we see fit, e.g. adding pagination or styling
$this->dtgProjects->Paginator = new QPaginator($this->dtgProjects);
$this->dtgProjects->ItemsPerPage = 6;
$this->dtgProjects->AlternateRowStyle->CssClass = 'alternate';
// All we need to do is to utilize the ProjectDataGrid built-in functionality
// to create, define and setup the various columns that WE choose, in the order
// that WE want. NOTE that we use simple string-based property names, OR QQuery
// node descriptors to specify what we want for each column.
$this->dtgProjects->MetaAddColumn('Name');
$this->dtgProjects->MetaAddColumn('StartDate');
$this->dtgProjects->MetaAddColumn(QQN::Project()->EndDate);
// We can easily add columns from linked/related tables. However, to do this
// you MUST use a QQuery node descriptor. No string-based properties allowed.
// Bonus: the Meta DataGrid will even automatically add sorting for columns in related tables.
$colUsername = $this->dtgProjects->MetaAddColumn(QQN::Project()->ManagerPerson->Login->Username);
// And remember, since it's a regular datagrid with regular columns,
// we can stylize as we see fit
$colUsername->BackColor = '#cef';
$colUsername->Name = 'Manager\'s Username';
// Also, note that MetaAddColumn and MetaAddTypeColumn can use attribute overriding as well
$this->dtgProjects->MetaAddTypeColumn('ProjectStatusTypeId', 'ProjectStatusType', 'FontBold=true');
$this->pxyExample = new QControlProxy($this);
$this->pxyExample->AddAction(new QClickEvent(), new QAjaxAction('pxyExample_Click'));
// FInally, there are even Meta methods to add an Edit Button column
$this->dtgProjects->MetaAddEditProxyColumn($this->pxyExample, 'Click Me', 'Faux Edit Column');
}
示例15: Form_Create
protected function Form_Create()
{
// Define the DataGrid -- note that the DataGrid Connector is a DataGrid, itself --
// so let's just use it as a datagrid
$this->dtgProjects = new ProjectList($this);
$this->dtgProjects->SetDataBinder('DefaultDataBinder', $this);
// Only show projects whose status is "open"
$this->objAdditionalConditions = QQ::Equal(QQN::Project()->ProjectStatusTypeId, ProjectStatusType::Open);
//expand on the ManagerPerson's login, since we're displaying it
$this->objAdditionalClauses = array(QQ::Expand(QQN::Project()->ManagerPerson), QQ::Expand(QQN::Project()->ManagerPerson->Login));
// DataBinding is already configured -- so we do not need to worry about it
// But remember that dtgProjects is just a regular datagrid, as well
// So we can configure as we see fit, e.g. adding pagination or styling
$this->dtgProjects->Paginator = new QPaginator($this->dtgProjects);
$this->dtgProjects->ItemsPerPage = 6;
$this->dtgProjects->AlternateRowCssClass = 'alternate';
// All we need to do is to utilize the ProjectDataGrid built-in functionality
// to create, define and setup the various columns that WE choose, in the order
// that WE want.
$this->dtgProjects->CreateNodeColumn('Name', QQN::Project()->Name);
$this->dtgProjects->CreateNodeColumn('StartDate', QQN::Project()->StartDate);
$this->dtgProjects->CreateNodeColumn("EndDate", QQN::Project()->EndDate);
// We can easily add columns from linked/related tables. However, to do this
// you MUST use a QQuery node descriptor. No string-based properties allowed.
// Bonus: the DataGrid Connector will even automatically add sorting for columns in related tables.
$colUsername = $this->dtgProjects->CreateNodeColumn('Username', QQN::Project()->ManagerPerson->Login->Username);
// And remember, since it's a regular datagrid with regular columns,
// we can stylize as we see fit
$colUsername->CellParamsCallback = [$this, 'GetUserNameCellParams'];
$colUsername->Name = 'Manager\'s Username';
$colStatus = $this->dtgProjects->CreateNodeColumn('ProjectStatusType', QQN::Project()->ProjectStatusType);
$colStatus->HtmlEntities = false;
$colStatus->Format = '<strong>%s</strong>';
$this->pxyExample = new QControlProxy($this);
$this->pxyExample->AddAction(new QClickEvent(), new QAjaxAction('pxyExample_Click'));
}