本文整理汇总了PHP中QQ::IsNotNull方法的典型用法代码示例。如果您正苦于以下问题:PHP QQ::IsNotNull方法的具体用法?PHP QQ::IsNotNull怎么用?PHP QQ::IsNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQ
的用法示例。
在下文中一共展示了QQ::IsNotNull方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetTranslation
/**
* A translation here consists of the project, file, text, translation, context, plurals, approval, ignore equals
*
* @param string $strOriginal the original text
* @param string $strOriginalAccKey access key for the original text
* @param string $strTranslation the translated text from the import file (can be empty)
* @param string $strOriginalAccKey access key for the translated text
* @param string $strContext the context where the text/translation appears in the file
* @param string $intPluralForm if this is a plural, what plural form is it (0 singular, 1 plural form 1, and so on)
* @param string $strComment a comment from the imported file
*
* @return string valid suggestion
*/
protected function GetTranslation($strOriginal, $strContext)
{
$objNarroContextInfo = NarroContextInfo::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->Context->ProjectId, $this->objProject->ProjectId), QQ::Equal(QQN::NarroContextInfo()->Context->FileId, $this->objFile->FileId), QQ::Equal(QQN::NarroContextInfo()->Context->ContextMd5, md5($strContext)), QQ::Equal(QQN::NarroContextInfo()->Context->Text->TextValueMd5, md5($strOriginal)), QQ::Equal(QQN::NarroContextInfo()->LanguageId, $this->objTargetLanguage->LanguageId), QQ::IsNotNull(QQN::NarroContextInfo()->ValidSuggestionId)));
if ($objNarroContextInfo instanceof NarroContextInfo) {
return $objNarroContextInfo->ValidSuggestion->SuggestionValue;
} else {
return $strOriginal;
}
}
示例2: 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'));
}
示例3: _
public static function _(QQNode $objQueryNode, $strSymbol, $mixValue, $mixValueTwo = null)
{
try {
switch (strtolower(trim($strSymbol))) {
case '=':
return QQ::Equal($objQueryNode, $mixValue);
case '!=':
return QQ::NotEqual($objQueryNode, $mixValue);
case '>':
return QQ::GreaterThan($objQueryNode, $mixValue);
case '<':
return QQ::LessThan($objQueryNode, $mixValue);
case '>=':
return QQ::GreaterOrEqual($objQueryNode, $mixValue);
case '<=':
return QQ::LessOrEqual($objQueryNode, $mixValue);
case 'in':
return QQ::In($objQueryNode, $mixValue);
case 'not in':
return QQ::NotIn($objQueryNode, $mixValue);
case 'like':
return QQ::Like($objQueryNode, $mixValue);
case 'not like':
return QQ::NotLike($objQueryNode, $mixValue);
case 'is null':
return QQ::IsNull($objQueryNode, $mixValue);
case 'is not null':
return QQ::IsNotNull($objQueryNode, $mixValue);
case 'between':
return QQ::Between($objQueryNode, $mixValue, $mixValueTwo);
case 'not between':
return QQ::NotBetween($objQueryNode, $mixValue, $mixValueTwo);
default:
throw new QCallerException('Unknown Query Comparison Operation: ' . $strSymbol, 0);
}
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
示例4: COUNT
<p>Note: the code below generates <a href="http://docs.hp.com/en/36216-90103/ch03s02.html">
correlated (dependent) subqueries</a>. These are frequently not the
fastest way to run queries against your SQL engine. If there is an
opportunity to rewrite your subquery using simple joins, do it - this
will improve the performance of your applications dramatically.</p>
<p>In general, it's a good idea to use EXPLAIN statements to determine
the query execution plan of the SQL statement that QQuery generates
to determine what the SQL engine will actually do to run your queries.
This is one of the best ways to improve the performance of your
database-driven application.</p>
</div>
<div id="demoZone">
<h2>Select names of project managers whose projects are over budget by at least $20</h2>
<?php
QApplication::$Database[1]->EnableProfiling();
$objPersonArray = Person::QueryArray(QQ::IsNotNull(QQ::Virtual('over_budget_projects', QQ::SubSql("SELECT COUNT(*)\n\t\t\t\t\t\t\tFROM project\n\t\t\t\t\t\t\tWHERE (spent - budget > 20)\n\t\t\t\t\t\t\t\tAND manager_person_id={1}\n\t\t\t\t\t\t\tGROUP BY manager_person_id", QQN::Person()->Id))), QQ::Clause(QQ::OrderBy(QQ::Virtual('over_budget_projects'), false), QQ::Expand(QQ::Virtual('over_budget_projects'))));
foreach ($objPersonArray as $objPerson) {
_p($objPerson->FirstName . ' ' . $objPerson->LastName . ': ' . $objPerson->GetVirtualAttribute("over_budget_projects") . " project(s) over budget");
_p('<br/>', false);
}
?>
<p><?php
QApplication::$Database[1]->OutputProfiling();
?>
</p>
</div>
<?php
require '../includes/footer.inc.php';
示例5: testOrderByExpansion
public function testOrderByExpansion()
{
$objPersonArray = Person::QueryArray(QQ::All(), QQ::OrderBy(QQ::IsNotNull(QQN::Person()->ProjectAsManager->Description), false, QQN::Person()->ProjectAsManager->Id));
$this->assertEquals(7, $objPersonArray[0]->Id, "Found first project with manager");
}
示例6: dtgReviews_Create
protected function dtgReviews_Create()
{
$dtgReviews = new NarroContextInfoDataGrid($this->tabActivity);
$dtgReviews->SetCustomStyle('padding', '5px');
$dtgReviews->Title = sprintf(t('Translations approved by <b>%s</b>'), $this->objUser->RealName);
$colText = $dtgReviews->MetaAddColumn(QQN::NarroContextInfo()->ValidSuggestion->Text->TextValue);
$colText->Name = t('Original text');
$colText->Html = '<?= $_CONTROL->colText_Render($_ITEM); ?>';
$colText->HtmlEntities = false;
$colSuggestion = $dtgReviews->MetaAddColumn(QQN::NarroContextInfo()->ValidSuggestion->SuggestionValue);
$colSuggestion->Name = t('Approved translation');
$colSuggestion->Html = '<?= $_CONTROL->colSuggestion_Render($_ITEM); ?>';
$colProject = $dtgReviews->MetaAddColumn(QQN::NarroContextInfo()->Context->Project->ProjectName);
$colProject->Name = t('Project');
$colProject->Filter = null;
foreach (NarroProject::LoadArrayByActive(1) as $objProject) {
$colProject->FilterAddListItem($objProject->ProjectName, QQ::Equal(QQN::NarroContextInfo()->Context->ProjectId, $objProject->ProjectId));
}
$colProject->Html = '<?= $_CONTROL->colProject_Render($_ITEM); ?>';
$colProject->HtmlEntities = false;
$colLanguage = $dtgReviews->MetaAddColumn(QQN::NarroContextInfo()->Language->LanguageName);
$colLanguage->Name = t('Language');
$colLanguage->Filter = null;
foreach (NarroLanguage::LoadAllActive() as $objLanguage) {
$colLanguage->FilterAddListItem($objLanguage->LanguageName, QQ::Equal(QQN::NarroContextInfo()->LanguageId, $objLanguage->LanguageId));
}
$colLanguage->FilterActivate(QApplication::$TargetLanguage->LanguageName);
$colLanguage->Html = '<?= $_CONTROL->colLanguage_Render($_ITEM); ?>';
$colModified = $dtgReviews->MetaAddColumn(QQN::NarroContextInfo()->Modified);
$colModified->Name = t('Approved');
$colModified->FilterType = QFilterType::None;
$colModified->Html = '<?= $_CONTROL->colModified_Render($_ITEM); ?>';
$colModified->HtmlEntities = false;
$colModified->Wrap = false;
// Datagrid Paginator
$dtgReviews->Paginator = new QPaginator($dtgReviews);
$dtgReviews->ItemsPerPage = QApplication::$User->GetPreferenceValueByName('Items per page');
// Specify Whether or Not to Refresh using Ajax
$dtgReviews->UseAjax = true;
$dtgReviews->SortColumnIndex = 4;
$dtgReviews->SortDirection = true;
$dtgReviews->AdditionalClauses = array(QQ::Expand(QQN::NarroContextInfo()->ValidSuggestion), QQ::Expand(QQN::NarroContextInfo()->Language));
$dtgReviews->AdditionalConditions = QQ::AndCondition(QQ::IsNotNull(QQN::NarroContextInfo()->ValidSuggestionId), QQ::Equal(QQN::NarroContextInfo()->ValidatorUserId, $this->objUser->UserId));
$dtgReviews->btnFilter_Click($this->Form->FormId, $dtgReviews->FilterButton->ControlId, '');
}
示例7: dtrText_Conditions
protected function dtrText_Conditions($blnReset = false)
{
$this->arrConditions = array(QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroContextInfo()->Context->Active, true), QQ::Equal(QQN::NarroContextInfo()->Context->File->Active, true)));
if ($blnReset) {
$this->intMaxRowCount = 0;
}
$this->arrClauses = array(QQ::Expand(QQN::NarroContextInfo()->Context), QQ::Expand(QQN::NarroContextInfo()->Context->Text), QQ::Expand(QQN::NarroContextInfo()->Context->File), QQ::Expand(QQN::NarroContextInfo()->Context->Project), QQ::Expand(QQN::NarroContextInfo()->ValidSuggestion));
if ($this->lstProject->SelectedValue > 0) {
$this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->Context->ProjectId, $this->lstProject->SelectedValue);
}
switch ($this->lstFilter->SelectedValue) {
case self::SHOW_NOT_TRANSLATED:
$this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, false);
break;
case self::SHOW_NOT_APPROVED:
$this->arrConditions[] = QQ::AndCondition(QQ::IsNull(QQN::NarroContextInfo()->ValidSuggestionId), QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, true));
break;
case self::SHOW_APPROVED:
$this->arrConditions[] = QQ::IsNotNull(QQN::NarroContextInfo()->ValidSuggestionId);
break;
case self::SHOW_APPROVED_AND_NOT_APPROVED:
$this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, true);
break;
case self::SHOW_NOT_APPROVED_AND_NOT_TRANSLATED:
$this->arrConditions[] = QQ::IsNull(QQN::NarroContextInfo()->ValidSuggestionId);
break;
case self::SHOW_NOT_APPROVED_AND_WITHOUT_VOTES:
$this->arrConditions[] = QQ::Equal(QQ::SubSql('SELECT COUNT(*) FROM narro_suggestion_vote, narro_suggestion WHERE narro_suggestion_vote.suggestion_id=narro_suggestion.suggestion_id AND narro_suggestion.text_id={1}', QQN::NarroContextInfo()->Context->TextId), 0);
break;
case self::SHOW_NOT_APPROVED_AND_WITH_VOTES:
$this->arrConditions[] = QQ::NotEqual(QQ::SubSql('SELECT COUNT(*) FROM narro_suggestion_vote, narro_suggestion WHERE narro_suggestion_vote.suggestion_id=narro_suggestion.suggestion_id AND narro_suggestion.text_id={1}', QQN::NarroContextInfo()->Context->TextId), 0);
break;
case self::SHOW_IDENTICAL_APPROVED:
$this->arrClauses[] = QQ::ExpandAsArray(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText);
$this->arrClauses[] = QQ::Distinct();
$this->arrConditions[] = QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->Context->Text->TextValueMd5, QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionValueMd5), QQ::Equal(QQN::NarroContextInfo()->ValidSuggestionId, QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionId), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QQN::NarroContextInfo()->LanguageId));
break;
case self::SHOW_IDENTICAL:
$this->arrClauses[] = QQ::ExpandAsArray(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText);
$this->arrClauses[] = QQ::Distinct();
$this->arrConditions[] = QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->Context->Text->TextValueMd5, QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionValueMd5), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QQN::NarroContextInfo()->LanguageId));
break;
case self::SHOW_ALL:
default:
}
if ($this->txtFile->Text != t('all files') && $this->txtFile->Text != '') {
if (preg_match("/^'.+'\$/", $this->txtFile->Text)) {
$this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->Context->File->FilePath, substr($this->txtFile->Text, 1, -1));
} elseif (preg_match('/^".+"$/', $this->txtFile->Text)) {
$this->arrConditions[] = QQ::Equal(QQN::NarroContextInfo()->Context->File->FilePath, substr($this->txtFile->Text, 1, -1));
} else {
$this->arrConditions[] = QQ::Like(QQN::NarroContextInfo()->Context->File->FilePath, '%' . $this->txtFile->Text . '%');
}
}
if ($this->txtSearch->Text) {
if (preg_match("/^'.+'\$/", $this->txtSearch->Text)) {
$strLikeSearch = substr($this->txtSearch->Text, 1, -1);
} elseif (preg_match('/^".+"$/', $this->txtSearch->Text)) {
$strLikeSearch = substr($this->txtSearch->Text, 1, -1);
} else {
$strLikeSearch = '%' . $this->txtSearch->Text . '%';
}
switch ($this->lstSearchIn->SelectedValue) {
case self::SEARCH_IN_TEXTS:
$this->arrConditions[] = QQ::Like(QQN::NarroContextInfo()->Context->Text->TextValue, $strLikeSearch);
break;
case self::SEARCH_IN_TRANSLATIONS:
$this->arrClauses[] = QQ::ExpandAsArray(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText);
$this->arrConditions[] = QQ::AndCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionValue, $strLikeSearch), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId()));
break;
case self::SEARCH_IN_AUTHORS:
$this->arrClauses[] = QQ::ExpandAsArray(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText);
$this->arrConditions[] = QQ::AndCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->User->RealName, $strLikeSearch), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId()));
break;
case self::SEARCH_IN_CONTEXTS:
$this->arrConditions[] = QQ::OrCondition(QQ::Like(QQN::NarroContextInfo()->Context->Context, $strLikeSearch), QQ::Like(QQN::NarroContextInfo()->Context->Comment, $strLikeSearch));
break;
case self::SEARCH_IN_ALL:
default:
$this->arrClauses[] = QQ::Distinct();
$this->arrConditions[] = QQ::OrCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->TextValue, $strLikeSearch), QQ::AndCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->SuggestionValue, $strLikeSearch), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId())), QQ::AndCondition(QQ::Like(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->User->RealName, $strLikeSearch), QQ::Equal(QQN::NarroContextInfo()->Context->Text->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId())), QQ::Like(QQN::NarroContextInfo()->Context->Context, $strLikeSearch), QQ::Like(QQN::NarroContextInfo()->Context->Comment, $strLikeSearch));
}
}
switch ($this->lstSort->SelectedValue) {
case self::SORT_TEXT:
$this->arrClauses[] = QQ::OrderBy(QQN::NarroContextInfo()->Context->Text->TextValue, $this->lstSortDir->SelectedValue);
break;
case self::SORT_TEXT_LENGTH:
$this->arrClauses[] = QQ::OrderBy(QQN::NarroContextInfo()->Context->Text->TextWordCount, $this->lstSortDir->SelectedValue);
break;
case self::SORT_TRANSLATION:
$this->arrClauses[] = QQ::OrderBy(QQN::NarroContextInfo()->ValidSuggestion->SuggestionValue, $this->lstSortDir->SelectedValue);
break;
case self::SORT_TRANSLATION_DATE:
$this->arrClauses[] = QQ::OrderBy(QQN::NarroContextInfo()->Modified, $this->lstSortDir->SelectedValue);
break;
}
}
示例8: GetTmx
/**
* Returns a tmx file
* @param QQCondition $objLangCondition e.g. QQ::In(QQN::NarroText()->NarroSuggestionAsText->LanguageId, QApplication::GetLanguageId());
* @return a tmx file, formatted as a string
*/
public static function GetTmx($objLangCondition)
{
$tmx = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE tmx SYSTEM "tmx13.dtd"><tmx />');
$tmx->addAttribute('version', '1.3');
$header = $tmx->addChild('header');
// mandatory
$header->addAttribute('creationtool', "Narro");
$header->addAttribute('creationtoolversion', NARRO_VERSION);
$header->addAttribute('segtype', "sentence");
$header->addAttribute('o-tmf', "ABCTransMem");
$header->addAttribute('adminlang', NarroLanguage::SOURCE_LANGUAGE_CODE);
$header->addAttribute('srclang', NarroLanguage::SOURCE_LANGUAGE_CODE);
$header->addAttribute('datatype', "PlainText");
// optional
$header->addAttribute('creationdate', QDateTime::NowToString('YYYYMMDDThhmmssZ'));
if (QApplication::$User) {
$header->addAttribute('creationid', QApplication::$User->Username);
}
$header->addAttribute('changedate', "19970314T023401Z");
$header->addAttribute('o-encoding', "utf-8");
$body = $tmx->addChild('body');
$strQuery = NarroText::GetQueryStatement($objQueryBuilder, QQ::AndCondition(QQ::IsNotNull(QQN::NarroText()->NarroSuggestionAsText->SuggestionId), $objLangCondition), array(QQ::ExpandAsArray(QQN::NarroText()->NarroSuggestionAsText)), array(), false);
$objDbResult = NarroText::GetDatabase()->Query($strQuery);
$intRowCount = $objDbResult->CountRows();
$intLastTextId = 0;
while ($objDbRow = $objDbResult->GetNextRow()) {
$objText = NarroText::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, null, $objQueryBuilder->ColumnAliasArray);
if ($intLastTextId != $objText->TextId) {
$intLastTextId = $objText->TextId;
$tu = $body->addChild('tu');
$tu->addAttribute('tuid', $objText->TextId);
$tu->addAttribute('datatype', 'Text');
// $tu->addAttribute('usagecount', $objText->CountNarroContextsAsText());
// $objLastContext = NarroContext::QuerySingle(QQ::Equal(QQN::NarroContext()->TextId, $objText->TextId), array(QQ::OrderBy(QQN::NarroContext()->Created, 0)));
// if ($objLastContext && $objLastContext->Created instanceof QDateTime)
// $tu->addAttribute('lastusagedate', $objLastContext->Created->qFormat('YYYYMMDDThhmmssZ'));
$tuv = $tu->addChild('tuv');
$tuv->addAttribute('xml:lang', NarroLanguage::SOURCE_LANGUAGE_CODE);
$seg = $tuv->addChild('seg');
$tuv->seg = $objText->TextValue;
if ($objText->Created instanceof QDateTime) {
$tuv->addAttribute('creationdate', $objText->Created->qFormat('YYYYMMDDThhmmssZ'));
}
if ($objText->Modified instanceof QDateTime) {
$tuv->addAttribute('changedate', $objText->Modified->qFormat('YYYYMMDDThhmmssZ'));
}
}
foreach ($objText->_NarroSuggestionAsTextArray as $objSuggestion) {
/* @var $objSuggestion NarroSuggestion */
$tuv = $tu->addChild('tuv');
$tuv->addAttribute('xml:lang', $objSuggestion->Language->LanguageCode);
$seg = $tuv->addChild('seg');
$tuv->seg = $objSuggestion->SuggestionValue;
if ($objSuggestion->Created instanceof QDateTime) {
$tuv->addAttribute('creationdate', $objSuggestion->Created->qFormat('YYYYMMDDThhmmssZ'));
}
if ($objSuggestion->Modified instanceof QDateTime) {
$tuv->addAttribute('changedate', $objSuggestion->Modified->qFormat('YYYYMMDDThhmmssZ'));
}
if ($objSuggestion->User instanceof NarroUser) {
$tuv->addAttribute('creationid', $objSuggestion->User->RealName);
}
// $tuv->addAttribute('usagecount', $objSuggestion->CountNarroContextInfosAsValidSuggestion());
// $objLastContextInfo = NarroContextInfo::QuerySingle(QQ::Equal(QQN::NarroContextInfo()->ValidSuggestionId, $objSuggestion->SuggestionId), array(QQ::OrderBy(QQN::NarroContextInfo()->Created, 0)));
// if ($objLastContextInfo && $objLastContextInfo->Created instanceof QDateTime)
// $tuv->addAttribute('lastusagedate', $objLastContextInfo->Created->qFormat('YYYYMMDDThhmmssZ'));
}
}
return $tmx->asXML();
}
示例9: foreach
<h2>Example 2: Projects that are related to both 'Blueman Industrial Site Architecture' and 'ACME Payment System' projects</h2>
<?php
$objProjectArray = Project::QueryArray(QQ::AndCondition(QQ::Equal(QQ::Alias(QQN::Project()->ProjectAsRelated, 'related1')->Project->Name, 'Blueman Industrial Site Architecture'), QQ::Equal(QQ::Alias(QQN::Project()->ProjectAsRelated, 'related2')->Project->Name, 'ACME Payment System')));
foreach ($objProjectArray as $objProject) {
_p($objProject->Name . " (" . $objProject->Description . ")");
_p('<br/>', false);
}
?>
<h2>Example 3: Managers having one least a project with a conson milestone, and for each manager, the first voyel milestone and the first conson one</h2>
<?php
$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(QQN::Person()->ProjectAsManager, null, $emptySelect), 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)));
foreach ($objPersonArray as $objManager) {
_p($objManager->FirstName . ' ' . $objManager->LastName . " (" . $objManager->GetVirtualAttribute('min_voyel') . ', ' . $objManager->GetVirtualAttribute('min_conson') . ")");
_p('<br/>', false);
}
?>
<h2>Example 4: Projects with, for each one, the "min" city from the addresses containing 'r' and the "min" city from the addresses NOT containing 'r' </h2>
<?php
$nWithR = QQ::Alias(QQN::Project()->PersonAsTeamMember->Person->Address, 'with_r');
$nWithoutR = QQ::Alias(QQN::Project()->PersonAsTeamMember->Person->Address, 'without_r');
$objProjectArray = Project::QueryArray(QQ::All(), QQ::Clause(QQ::Expand($nWithR, QQ::Like($nWithR->Street, '%r%')), QQ::Expand($nWithoutR, QQ::NotLike($nWithoutR->Street, '%r%')), QQ::GroupBy(QQN::Project()->Id), QQ::Minimum($nWithR->City, 'min_city_r'), QQ::Minimum($nWithoutR->City, 'min_city_wor')));
foreach ($objProjectArray as $objProject) {
_p($objProject->Name . " (" . $objProject->GetVirtualAttribute('min_city_r') . ', ' . $objProject->GetVirtualAttribute('min_city_wor') . ")");
_p('<br/>', false);
}
示例10: testConditionalExpansion3
public function testConditionalExpansion3()
{
// A complex join with conditions. Find all team members of completed projects which have an open child project.
$clauses = QQ::Clause(QQ::Expand(QQN::Person()->ProjectAsTeamMember->Project, QQ::Equal(QQN::Person()->ProjectAsTeamMember->Project->ProjectStatusTypeId, ProjectStatusType::Completed)), QQ::Expand(QQN::Person()->ProjectAsTeamMember->Project->ProjectAsRelated->Project, QQ::Equal(QQN::Person()->ProjectAsTeamMember->Project->ProjectAsRelated->Project->ProjectStatusTypeId, ProjectStatusType::Open)));
$cond = QQ::IsNotNull(QQN::Person()->ProjectAsTeamMember->Project->ProjectAsRelated->Project->Id);
// Filter out unsuccessful joins
$targetPersonArray = Person::QueryArray($cond, $clauses);
$targetPerson = reset($targetPersonArray);
$this->assertEquals(ProjectStatusType::Completed, $targetPerson->ProjectAsTeamMember->ProjectStatusTypeId, "Found completed parent project");
$this->assertEquals(ProjectStatusType::Open, $targetPerson->ProjectAsTeamMember->ProjectAsRelated->ProjectStatusTypeId, "Found open child project");
}
示例11: CountByFileName
public static function CountByFileName($strFileName, $intFilter, $objExtraCondition = null)
{
if (!is_object($objExtraCondition)) {
$objExtraCondition = QQ::All();
}
if (trim($strFileName) == '') {
$objSearchCondition = QQ::All();
} elseif (preg_match("/^'.*'\$/", $strFileName)) {
$objSearchCondition = QQ::Equal(QQN::NarroContextInfo()->Context->File->FileName, substr($strFileName, 1, -1));
} else {
$objSearchCondition = QQ::Like(QQN::NarroContextInfo()->Context->File->FileName, '%' . $strFileName . '%');
}
switch ($intFilter) {
case NarroTextListForm::SHOW_UNTRANSLATED_TEXTS:
$objFilterCondition = QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, 0);
break;
case NarroTextListForm::SHOW_APPROVED_TEXTS:
$objFilterCondition = QQ::IsNotNull(QQN::NarroContextInfo()->ValidSuggestionId);
break;
case NarroTextListForm::SHOW_TEXTS_THAT_REQUIRE_APPROVAL:
$objFilterCondition = QQ::AndCondition(QQ::IsNull(QQN::NarroContextInfo()->ValidSuggestionId), QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, 1));
break;
default:
// no filters
$objFilterCondition = QQ::All();
}
$intContextCount = NarroContextInfo::QueryCount(QQ::AndCondition($objSearchCondition, $objFilterCondition, $objExtraCondition), array(QQ::GroupBy(QQN::NarroContextInfo()->ContextId)));
return $intContextCount;
}
示例12: LoadByPasswordResetCode
public static function LoadByPasswordResetCode($strPasswordResetCode)
{
// Reset code must be 32 characters
if (strlen($strPasswordResetCode) != 32) {
return null;
}
// Load all users with unexpired reset codes
$arrUserAccount = UserAccount::QueryArray(QQ::AndCondition(QQ::Equal(QQN::UserAccount()->ActiveFlag, 1), QQ::IsNotNull(QQN::UserAccount()->PasswordResetCode), QQ::GreaterThan(QQN::UserAccount()->PasswordResetExpiry, QDateTime::Now())));
// Check submitted reset code against any valid codes
foreach ($arrUserAccount as $objUserAccount) {
if (QApplication::CheckPassword($strPasswordResetCode, $objUserAccount->PasswordResetCode)) {
// Match found
return $objUserAccount;
}
}
return null;
}