LessThan() public static méthode

public static LessThan ( QQNode $objQueryNode, $mixValue )
$objQueryNode QQNode
Exemple #1
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;
 }
Exemple #2
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)));
 }
Exemple #3
0
 public function dtgPosts_Bind()
 {
     $objCondition = QQ::All();
     if ($intId = $this->lstCategory->SelectedValue) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::ClassifiedPost()->ClassifiedCategoryId, $intId));
     }
     if (!is_null($blnValue = $this->lstApproval->SelectedValue)) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::ClassifiedPost()->ApprovalFlag, $blnValue));
     }
     if (!is_null($blnValue = $this->lstExpiration->SelectedValue)) {
         $objCondition = QQ::AndCondition($objCondition, $blnValue ? QQ::LessThan(QQN::ClassifiedPost()->DateExpired, QDateTime::Now()) : QQ::GreaterOrEqual(QQN::ClassifiedPost()->DateExpired, QDateTime::Now()));
     }
     if (strlen($strText = trim($this->txtTitle->Text))) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::ClassifiedPost()->Title, '%' . $strText . '%'));
     }
     if (strlen($strText = trim($this->txtName->Text))) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::ClassifiedPost()->Name, '%' . $strText . '%'));
     }
     $this->dtgPosts->MetaDataBinder($objCondition);
 }
Exemple #4
0
 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;
     }
 }
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
 * later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
require_once dirname(__FILE__) . '/configuration/prepend.inc.php';
if (isset($argv[0])) {
    $intCnt = 0;
    $intSkipped = 0;
    foreach (NarroSuggestion::QueryArray(QQ::AndCondition(QQ::NotEqual(QQN::NarroSuggestion()->UserId, 0), QQ::LessThan(QQN::NarroSuggestion()->SuggestionWordCount, 1)), array(QQ::OrderBy(QQN::NarroSuggestion()->SuggestionId, 0), QQ::LimitInfo(10000, 0))) as $intVal => $objSuggestion) {
        if ($objSuggestion->SuggestionValueMd5 != md5($objSuggestion->SuggestionValue)) {
            $intSkipped++;
            continue;
        }
        try {
            $objSuggestion->SaveWordCount();
            $intCnt++;
        } catch (Exception $objEx) {
            echo $objEx->getMessage();
        }
    }
    printf("Skipped %d, saved %d suggestions, last suggestion id is %d\n", $intSkipped, $intCnt, $objSuggestion->SuggestionId);
    die;
}
//    if (QApplication::HasPermission('Administrator')) {
Exemple #6
0
	<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';
Exemple #7
0
 /**
  * This will move all the transactions for a given year to be credited to another person
  * @param integer $intYear
  * @param Person $objPerson
  */
 public function MoveStewardshipTransactions($intYear, Person $objPerson)
 {
     StewardshipContribution::GetDatabase()->TransactionBegin();
     $objArray = StewardshipContribution::QueryArray(QQ::AndCondition(QQ::Equal(QQN::StewardshipContribution()->PersonId, $this->intId), QQ::GreaterOrEqual(QQN::StewardshipContribution()->DateCredited, new QDateTime($intYear . '-01-01')), QQ::LessThan(QQN::StewardshipContribution()->DateCredited, new QDateTime($intYear + 1 . '-01-01'))));
     foreach ($objArray as $objContribution) {
         $objContribution->Person = $objPerson;
         $objContribution->Save();
         foreach ($objContribution->GetStewardshipPostLineItemArray() as $objLineItem) {
             $objLineItem->Person = $objPerson;
             $objLineItem->Save();
         }
     }
     StewardshipContribution::GetDatabase()->TransactionCommit();
 }
 public function testSelect()
 {
     $objTest = new TypeTest();
     $objTest->TestFloat = 1.0;
     $objTest->Save();
     $objTest2 = new TypeTest();
     $objTest2->TestFloat = 2.0;
     $objTest2->Save();
     $objResArray = TypeTest::QueryArray(QQ::LessThan(QQ::Virtual('mul1', QQ::Mul(QQN::TypeTest()->TestFloat, -2.0)), -1.0), QQ::Clause(QQ::OrderBy(QQ::Virtual('mul1')), QQ::Expand(QQ::Virtual('mul1')), QQ::Select(QQ::Virtual('mul1'))));
     $this->assertEquals(2, count($objResArray));
     if (2 == count($objResArray)) {
         $objRes = $objResArray[0];
         $this->assertNotNull($objRes);
         if ($objRes) {
             $this->assertNull($objRes->TestFloat);
             $this->assertEquals(-4.0, $objRes->GetVirtualAttribute('mul1'));
         }
         $objRes = $objResArray[1];
         $this->assertNotNull($objRes);
         if ($objRes) {
             $this->assertNull($objRes->TestFloat);
             $this->assertEquals(-2.0, $objRes->GetVirtualAttribute('mul1'));
         }
     }
     $objTest->Delete();
     $objTest2->Delete();
 }