/**
  * Bind the Projects table to the html table.
  *
  * @throws QCallerException
  */
 protected function tblProjects_Bind()
 {
     // Expand the PersonAsTeamMember node as an array so that it will be included in each item sent to the columns.
     $clauses = QQ::ExpandAsArray(QQN::Project()->PersonAsTeamMember);
     // We load the data source, and set it to the datagrid's DataSource parameter
     $this->tblProjects->DataSource = Project::LoadAll($clauses);
 }
 protected function dtgProjects_Bind()
 {
     $this->dtgProjects->TotalItemCount = Project::QueryCount(QQ::All());
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->dtgProjects->OrderByClause) {
         $objClauses[] = $objClause;
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgProjects->LimitClause) {
         $objClauses[] = $objClause;
     }
     $this->dtgProjects->DataSource = Project::LoadAll($objClauses);
 }
Example #3
0
 protected function Form_Create()
 {
     // Setup the Dropdown of Project Names
     $this->lstProjects = new QListBox($this);
     $this->lstProjects->AddItem('- Select One -', null, true);
     foreach (Project::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Project()->Name))) as $objProject) {
         $this->lstProjects->AddItem($objProject->Name, $objProject->Id);
     }
     $this->lstProjects->AddAction(new QChangeEvent(), new QAjaxAction('lstProjects_Change'));
     // Setup our Left and Right Panel Placeholders
     // Notice that both panels have "AutoRenderChildren" set to true so that
     // instantiated child panels will automatically get displayed
     $this->pnlLeft = new QPanel($this);
     $this->pnlLeft->Position = QPosition::Relative;
     $this->pnlLeft->CssClass = 'panelDefault';
     $this->pnlLeft->AutoRenderChildren = true;
     $this->pnlRight = new QPanel($this);
     $this->pnlRight->Position = QPosition::Relative;
     $this->pnlRight->CssClass = 'panelDefault panelRight';
     $this->pnlRight->AutoRenderChildren = true;
     $this->objDefaultWaitIcon = new QWaitIcon($this);
 }
Example #4
0
	and in doing so they can unnecessarily overengineer some pieces of functionality.
	If the focus is on getting the application functional, first, then after the application is in
	a usable state, you can profile the functionality that tends to get used more often and simply
	focus on optimizing this smaller subset of heavily-used functionality.</p>

	<p>For information about Expanding through Association Tables, please refer to the
	<a href="../qcubed_query/association.php">Handling Association Tables example</a>.</p>
</div>

<div id="demoZone">
	<h2>List All Projects and its Manager</h2>
<?php 
// Enable Profiling (we're assuming the Examples Site Database is at index 1)
// NOTE: Profiling should only be enabled when you are actively wanting to profile a specific PHP script.
// Because of SIGNIFICANT performance degradation, it should otherwise always be off.
QApplication::$Database[1]->EnableProfiling();
// Load the Project array
// The following line of code is the ONLY line of code we will modify
$objProjectArray = Project::LoadAll(QQ::Clause(QQ::Expand(QQN::Project()->ManagerPerson)));
foreach ($objProjectArray as $objProject) {
    _p(QApplication::HtmlEntities($objProject->Name) . ' is managed by ' . $objProject->ManagerPerson->FirstName . ' ' . $objProject->ManagerPerson->LastName);
    _p('<br/>', false);
}
_p('<br/>', false);
// Output Profiling Data
QApplication::$Database[1]->OutputProfiling();
?>
</div>

<?php 
require '../includes/footer.inc.php';
Example #5
0
		<b>ManagerPerson</b>.  Using the built in Qcodo Database Profiler, you can see that
		five database calls are made: One call to get all the projects (four rows in all), and then four calls
		to <b>Person::Load</b> (one for each of those projects).
	</div>


	<h3>List All the Projects and View Its Manager</h3>
<?php 
// Enable Profiling (we're assuming the Examples Site Database is at index 1)
// NOTE: Profiling should only be enabled when you are actively wanting to profile a specific PHP script.
// Because of SIGNIFICANT performance degradation, it should otherwise always be off.
QApplication::$Database[1]->EnableProfiling();
// Load the Project array
// Note how even though we make two calls to ManagerPerson PER project, only ONE call to
// Person::Load is made per project -- this is because ManagerPerson is bound to the
// Project during the first call.  So the second call is using the ManagerPerson that's
// already bound to that project object.
$objProjectArray = Project::LoadAll();
foreach ($objProjectArray as $objProject) {
    _p($objProject->Name . ' is managed by ' . $objProject->ManagerPerson->FirstName . ' ' . $objProject->ManagerPerson->LastName);
    _p('<br/>', false);
}
_p('<br/>', false);
// Output Profiling Data
QApplication::$Database[1]->OutputProfiling();
?>



<?php 
require __INCLUDES__ . '/examples/footer.inc.php';
    public function dtgProjects_Bind()
    {
        // Get Total Count b/c of Pagination
        $this->dtgProjects->TotalItemCount = Project::CountAll();
        $objClauses = array();
        if ($objClause = $this->dtgProjects->OrderByClause) {
            $objClauses[] = $objClause;
        }
        if ($objClause = $this->dtgProjects->LimitClause) {
            $objClauses[] = $objClause;
        }
        // Create a virtual attribute that lets us know if this Project is related to ACME
        $objClauses[] = QQ::Expand(QQ::Virtual('assn_item', QQ::SubSql('select 
							project_id
					 	from 
					 		related_project_assn
					 	where 
							child_project_id = {1} 
							 and project_id = 1', QQN::Project()->Id)));
        $this->dtgProjects->DataSource = Project::LoadAll($objClauses);
    }
<?php

require_once '../qcubed.inc.php';
// Setup the Feed, itself
$objRss = new QRssFeed('Examples Site Projects', 'http://examples.qcu.be/', 'An Example RSS feed of the Qcubed Examples Site Projects');
$objRss->Image = new QRssImage('http://www.qcu.be/sites/all/themes/qcubednew/images/QCubed.png');
$objRss->PubDate = new QDateTime(QDateTime::Now);
// Iterate through all the projects, and setup a QRssItem per project
// Limit it to the "10 most recently started projects"
foreach ($objProjects = Project::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Project()->StartDate, false), QQ::LimitInfo(10))) as $objProject) {
    $objItem = new QRssItem($objProject->Name, 'http://examples.qcu.be/examples/communication/rss.php/' . $objProject->Id, $objProject->Description);
    $objItem->Author = $objProject->ManagerPerson->FirstName . ' ' . $objProject->ManagerPerson->LastName;
    $objItem->PubDate = $objProject->StartDate;
    $objItem->Guid = $objItem->Link;
    $objItem->GuidPermaLink = true;
    $objItem->AddCategory(new QRssCategory('Some Project Category 1'));
    $objItem->AddCategory(new QRssCategory('Some Project Category 2'));
    $objRss->AddItem($objItem);
}
// Output/Run the feed
// Note that the Run method will reset the output buffer and setup the Headers to output XML,
// so any HTML or Text outputted until now will be lost.  If for whatever reason you just
// want the XML, you can call $objRss->GetXml(), which will return the XML string.
// Also, if you need to change the encoding of the XML, you can do so in QApplication::$EncodingType.
$objRss->Run();
 protected function lstProjectsAsTeamMember_Create()
 {
     $this->lstProjectsAsTeamMember = new QListBox($this);
     $this->lstProjectsAsTeamMember->Name = QApplication::Translate('Projects As Team Member');
     $this->lstProjectsAsTeamMember->SelectionMode = QSelectionMode::Multiple;
     $objAssociatedArray = $this->objPerson->GetProjectAsTeamMemberArray();
     $objProjectArray = Project::LoadAll();
     if ($objProjectArray) {
         foreach ($objProjectArray as $objProject) {
             $objListItem = new QListItem($objProject->__toString(), $objProject->Id);
             foreach ($objAssociatedArray as $objAssociated) {
                 if ($objAssociated->Id == $objProject->Id) {
                     $objListItem->Selected = true;
                 }
             }
             $this->lstProjectsAsTeamMember->AddItem($objListItem);
         }
     }
 }
 /**
  * Bind the Projects table to the html table.
  *
  * @throws QCallerException
  */
 protected function tblProjects_Bind()
 {
     // We load the data source, and set it to the datagrid's DataSource parameter
     $this->tblProjects->DataSource = Project::LoadAll();
 }