本文整理汇总了PHP中QQN::Project方法的典型用法代码示例。如果您正苦于以下问题:PHP QQN::Project方法的具体用法?PHP QQN::Project怎么用?PHP QQN::Project使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQN
的用法示例。
在下文中一共展示了QQN::Project方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
// 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');
}
示例2: tblProjects_Bind
/**
* 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);
}
示例3: Form_Create
protected function Form_Create()
{
// Instantiate the DataGrid
$this->dtgProjects = new QDataGrid($this);
// Style the DataGrid
//$this->dtgProjects->CssClass = 'datagrid';
$this->dtgProjects->AlternateRowCssClass = 'alternate';
// Add Pagination
$this->dtgProjects->Paginator = new QPaginator($this->dtgProjects);
$this->dtgProjects->ItemsPerPage = 3;
// Add columns
// Create a column that will hold a toggle button. We will need to manually draw the content of the cell.
$col = $this->dtgProjects->CreateCallableColumn('', [$this, 'render_btnToggleRecordsSummary']);
$col->HtmlEntities = false;
$col->CellStyler->Width = "1%";
$this->dtgProjects->CreateNodeColumn('Id', QQN::Project()->Id);
$this->dtgProjects->CreateNodeColumn('Name', QQN::Project()->Name);
$this->dtgProjects->CreateNodeColumn('Status', QQN::Project()->ProjectStatusType);
$this->dtgProjects->CreateNodeColumn('Description', QQN::Project()->Description);
$this->dtgProjects->CreateNodeColumn('Start Date', QQN::Project()->StartDate);
$this->dtgProjects->CreateNodeColumn('End Date', QQN::Project()->EndDate);
$this->dtgProjects->CreateNodeColumn('Budget', QQN::Project()->Budget);
$this->dtgProjects->CreateNodeColumn('Spent', QQN::Project()->Spent);
// Create a column that will hold a child datagrid
$col = $this->dtgProjects->CreateCallableColumn('', [$this, 'render_ucRecordsSummary']);
$col->HtmlEntities = false;
$col->CellStyler->Width = 0;
// Specify the Datagrid's Data Binder method
$this->dtgProjects->SetDataBinder('dtgProjects_Bind');
// For purposes of this example, add a css file that styles the table.
// Normally you would include your global style sheets in your tpl file or header.inc.php file.
$this->dtgProjects->AddCssFile(__QCUBED_ASSETS__ . '/php/examples/master_detail/styles.css');
}
示例4: __construct
/**
* This constructor will only be executed once - afterwards,
* the state of the control will be stored into the $_SESSION
* and, on future loads, populated from the session state.
*/
public function __construct($objParentObject)
{
parent::__construct($objParentObject);
$projects = Project::QueryArray(QQ::All(), QQ::OrderBy(QQN::Project()->Name));
foreach ($projects as $project) {
$this->AddItem($project->Name, $project->Id);
}
}
示例5: dtgProjects_Create
protected function dtgProjects_Create()
{
// Define the DataGrid
$this->dtgProjects = new QDataGrid($this);
$this->dtgProjects->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->dtgProjects);
$this->dtgProjects->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->dtgProjects->ItemsPerPage = 20;
// Define Columns
//Project Name
$colName = new QDataGridColumn('Project', '<?= $_ITEM->Name?>');
$colName->OrderByClause = QQ::OrderBy(QQN::Project()->Name);
$colName->ReverseOrderByClause = QQ::OrderBy(QQN::Project()->Name, false);
$this->dtgProjects->AddColumn($colName);
//Project type - filtered
$colType = new QDataGridColumn('Type', '<?= ProjectStatusType::ToString($_ITEM->ProjectStatusTypeId) ?>');
$colType->OrderByClause = QQ::OrderBy(QQN::Project()->ProjectStatusTypeId);
$colType->ReverseOrderByClause = QQ::OrderBy(QQN::Project()->ProjectStatusTypeId, false);
$colType->FilterType = QFilterType::ListFilter;
foreach (ProjectStatusType::$NameArray as $value => $name) {
$colType->FilterAddListItem($name, QQ::Equal(QQN::Project()->ProjectStatusTypeId, $value));
}
$this->dtgProjects->AddColumn($colType);
//Manager First Name
$colFName = new QDataGridColumn('First Name', '<?= $_ITEM->ManagerPerson->FirstName ?>');
$colFName->OrderByClause = QQ::OrderBy(QQN::Project()->ManagerPerson->FirstName);
$colFName->ReverseOrderByClause = QQ::OrderBy(QQN::Project()->ManagerPerson->FirstName, false);
$this->dtgProjects->AddColumn($colFName);
//Manager Last Name - filtered, only show with enabled logins
$colLName = new QDataGridColumn('Last Name', '<?= $_ITEM->ManagerPerson->LastName ?>');
$colLName->OrderByClause = QQ::OrderBy(QQN::Project()->ManagerPerson->LastName);
$colLName->ReverseOrderByClause = QQ::OrderBy(QQN::Project()->ManagerPerson->LastName, false);
QQN::Project()->ManagerPerson->LastName->SetFilteredDataGridColumnFilter($colLName);
$colLName->FilterConstant = QQ::Equal(QQN::Project()->ManagerPerson->Login->IsEnabled, true);
$this->dtgProjects->AddColumn($colLName);
// Specify the Datagrid's Data Binder method
$this->dtgProjects->SetDataBinder('dtgProjects_Bind');
/* * *********************** */
// Make the DataGrid look nice
$objStyle = $this->dtgProjects->RowStyle;
$objStyle->FontSize = 12;
$objStyle = $this->dtgProjects->AlternateRowStyle;
$objStyle->BackColor = '#f6f6f6';
$objStyle = $this->dtgProjects->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->dtgProjects->HeaderLinkStyle;
$objStyle->ForeColor = 'white';
}
示例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: testGroupBy
public function testGroupBy()
{
$objItems = Project::QueryArray(QQ::All(), QQ::Clause(QQ::GroupBy(QQN::Project()->Id), QQ::Count(QQN::Project()->PersonAsTeamMember->PersonId, 'team_member_count')));
$this->assertEqual(sizeof($objItems), 4, "4 projects found");
$this->assertEqual($objItems[0]->Name, "ACME Website Redesign", "Project " . $objItems[0]->Name . " found");
$this->assertEqual($objItems[0]->GetVirtualAttribute('team_member_count'), 5, "5 team members found for project " . $objItems[0]->Name);
$this->assertEqual($objItems[1]->Name, "State College HR System", "Project " . $objItems[1]->Name . " found");
$this->assertEqual($objItems[1]->GetVirtualAttribute('team_member_count'), 6, "6 team members found for project " . $objItems[1]->Name);
$this->assertEqual($objItems[2]->Name, "Blueman Industrial Site Architecture", "Project " . $objItems[2]->Name . " found");
$this->assertEqual($objItems[2]->GetVirtualAttribute('team_member_count'), 5, "5 team members found for project " . $objItems[2]->Name);
}
示例8: __construct
/**
* This constructor will only be executed once - afterwards,
* the state of the control will be stored into the $_SESSION
* and, on future loads, populated from the session state.
*/
public function __construct($objParentObject, $strControlId)
{
parent::__construct($objParentObject, $strControlId);
$projects = Project::QueryArray(QQ::All(), QQ::OrderBy(QQN::Project()->Name));
foreach ($projects as $project) {
$this->AddItem($project->Name, $project->Id);
}
// Reset the status of the parent form's label to indicate
// that the query was actually run
$objParentObject->lblStatus->Text = "The query was executed";
}
示例9: testDbTypeCasting
public function testDbTypeCasting()
{
$dt1 = new QDateTime('Jan 15 2006');
$dt2 = new QDateTime('Mar 15 2006');
$cond = QQ::Between(QQN::Project()->StartDate, $dt1, $dt2);
$a = Project::QueryArray($cond);
$this->assertEquals(2, count($a), "Between 2 QDateTime types works");
$cond = QQ::Between(QQN::Project()->Budget, 2000, 3000);
$a = Project::QueryArray($cond);
$this->assertEquals(1, count($a), "Between 2 int types works");
$cond = QQ::Between(QQN::Project()->Name, 'A', 'C');
$a = Project::QueryArray($cond);
$this->assertEquals(3, count($a), "Between 2 string types works");
}
示例10: lstProjects_Bind
/**
* Add the items to the project list.
*/
public function lstProjects_Bind()
{
$clauses[] = QQ::ExpandAsArray(QQN::Project()->PersonAsTeamMember);
$objProjects = Project::QueryArray(QQ::All(), $clauses);
foreach ($objProjects as $objProject) {
$item = new QHListItem($objProject->Name);
$item->Tag = 'ol';
$item->GetSubTagStyler()->OrderedListType = QOrderedListType::LowercaseRoman;
foreach ($objProject->_PersonAsTeamMemberArray as $objPerson) {
/****
* Here we add a sub-item to each item before adding the item to the main list.
*/
$item->AddItem($objPerson->FirstName . ' ' . $objPerson->LastName);
}
$this->lstProjects->AddItem($item);
}
}
示例11: Form_Create
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);
}
示例12: 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'));
}
示例13: dtgProjects_Bind
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);
}
示例14: foreach
<h3>Custom Load Query: Select all Projects with Budgets over $5000, ordered by Descending Budget</h3>
<?php
// Custom Load Queries must have a resultset that returns all the fields of the
// table which corresponds to the ORM class you want to instantiate
// Note that because the InstantiateDb* methods in your ORM classes are code generated
// it is actually safe to use "SELECT *" for your Custom Load Queries.
$strQuery = 'SELECT project.* FROM project WHERE budget > 5000 ORDER BY budget DESC';
// perform the query
$objDbResult = $objDatabase->Query($strQuery);
// Use the Project::InstantiateDbResult on the $objDbResult to get an array of Project objects
$objProjectArray = Project::InstantiateDbResult($objDbResult);
// Iterate through the Project Array as you would any other ORM object
foreach ($objProjectArray as $objProject) {
_p($objProject->Name . ' has a budget of $' . $objProject->Budget);
_p('<br/>', false);
}
?>
<h3>Qcodo Query: Select all Projects which have a Budget over $5000 and under $10000, ordered by Descending Budget</h3>
<?php
// Perform the Query using Project::QueryArray, which will return an array of Project objects
// given a QQ Condition, and any optional QQ Clauses.
$objProjectArray = Project::QueryArray(QQ::AndCondition(QQ::GreaterThan(QQN::Project()->Budget, 5000), QQ::LessThan(QQN::Project()->Budget, 10000)), QQ::Clause(QQ::OrderBy(QQN::Project()->Budget, false)));
// Iterate through the Project Array like last time
foreach ($objProjectArray as $objProject) {
_p($objProject->Name . ' has a budget of $' . $objProject->Budget);
_p('<br/>', false);
}
require '../includes/footer.inc.php';
示例15: QRssFeed
<?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();