protected function Form_Create() { $this->mctObject = ClassInstructorMetaControl::CreateFromPathInfo($this, QMetaControlCreateType::CreateOnRecordNotFound); if ($this->mctObject->EditMode) { $this->strPageTitle .= 'Edit Instructor'; } else { $this->strPageTitle .= 'Create New Instructor'; } $this->lstLogin = $this->mctObject->lstLogin_Create(null, QQ::OrCondition(QQ::AndCondition(QQ::IsNull(QQN::Login()->ClassInstructor->Id), QQ::Equal(QQN::Login()->LoginActiveFlag, true), QQ::Equal(QQN::Login()->DomainActiveFlag, true)), QQ::Equal(QQN::Login()->Id, $this->mctObject->ClassInstructor->LoginId)), QQ::OrderBy(QQN::Login()->FirstName, QQN::Login()->LastName)); $this->txtDisplayName = $this->mctObject->txtDisplayName_Create(); $this->txtDisplayName->AddAction(new QEnterKeyEvent(), new QTerminateAction()); $this->btnSave = new QButton($this); $this->btnSave->CssClass = 'primary'; $this->btnSave->Text = $this->mctObject->EditMode ? 'Update' : 'Create'; $this->btnSave->CausesValidation = true; $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click')); $this->btnSave->AddAction(new QClickEvent(), new QTerminateAction()); $this->btnCancel = new QLinkButton($this); $this->btnCancel->CssClass = 'cancel'; $this->btnCancel->Text = 'Cancel'; $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click')); $this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction()); if ($this->mctObject->EditMode) { $this->btnDelete = new QLinkButton($this); $this->btnDelete->CssClass = 'delete'; $this->btnDelete->Text = 'Delete'; $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to PERMANENTLY DELETE this?')); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click')); $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction()); } }
public static function RestoreByNameForClass($strName, $intClassId, $strVersion, $objFile) { $objOperation = Operation::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::Operation()->QcodoClassId, $intClassId), QQ::Equal(QQN::Operation()->Name, $strName))); if (!$objOperation) { $objOperation = new Operation(); $objOperation->Name = $strName; $objOperation->QcodoClassId = $intClassId; $objOperation->FirstVersion = $strVersion; $objOperation->File = $objFile; $objOperation->Save(); } else { $blnSave = false; if ($objOperation->LastVersion) { $objOperation->LastVersion = null; $blnSave = true; } if ($objFile->Id != $objOperation->intFileId) { $objOperation->File = $objFile; $blnSave = true; } if ($blnSave) { $objOperation->Save(); } } return $objOperation; }
public function Save($blnForceInsert = false, $blnForceUpdate = false) { $this->intSuggestionWordCount = NarroString::WordCount($this->strSuggestionValue); $this->intSuggestionCharCount = mb_strlen($this->strSuggestionValue); $this->strSuggestionValueMd5 = md5($this->strSuggestionValue); if (!isset($this->blnIsImported)) { $this->blnIsImported = false; } if (!$this->__blnRestored || $blnForceInsert) { $this->dttCreated = QDateTime::Now(); } else { $this->dttModified = QDateTime::Now(); } parent::Save($blnForceInsert, $blnForceUpdate); /** * Update all context infos with the has suggestion property */ $arrContextInfo = NarroContextInfo::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->Context->TextId, $this->intTextId), QQ::Equal(QQN::NarroContextInfo()->LanguageId, $this->intLanguageId), QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, 0))); foreach ($arrContextInfo as $objOneContextInfo) { $objOneContextInfo->HasSuggestions = 1; $objOneContextInfo->Modified = QDateTime::Now(); try { $objOneContextInfo->Save(); } catch (Exception $objEx) { NarroLogger::LogWarn($objEx->getMessage()); } } }
function CreateGroupParticipations(mysqli $objAcsDatabase, Group $objGroup, GroupRole $objRole, $intAcsGroupId, $intAcsReserveId) { print "Adding for Group: " . $objGroup->Name . "\r\n "; if ($intAcsReserveId) { $objResult = $objAcsDatabase->query(sprintf('select * from awgrrost where groupid=%s AND reserveid1=%s', $intAcsGroupId, $intAcsReserveId)); } else { $objResult = $objAcsDatabase->query(sprintf('select * from awgrrost where groupid=%s', $intAcsGroupId)); } while ($objRow = $objResult->fetch_array()) { $objAttributeValueArray = AttributeValue::QueryArray(QQ::AndCondition(QQ::Equal(QQN::AttributeValue()->AttributeId, 2), QQ::Equal(QQN::AttributeValue()->TextValue, $objRow['indvid']))); if (count($objAttributeValueArray) != 1) { printf("Issue with awgrrost.pkid of %s - IndvId %s for Group %s - AVCount of %s\r\n", $objRow['pkid'], $objRow['indvid'], $objGroup->Name, count($objAttributeValueArray)); } else { $objPerson = $objAttributeValueArray[0]->Person; $dttStartDate = new QDateTime($objRow['dateadded']); if ($objRow['dateremoved']) { $dttEndDate = new QDateTime($objRow['dateremoved']); } else { $dttEndDate = null; } $objGroup->AddPerson($objPerson, $objRole->Id, $dttStartDate, $dttEndDate); print "*"; } } print "\r\n Done.\r\n\r\n"; }
/** * @param DleCategory $objDleCategory The DB ORM object to process */ protected function process_object($objDleCategory) { // wp: term_taxonomy_id, term_id, description, parent // dl: id, id, descr, parentid $wpTerms = $objDleCategory->LoadWpTerms(); if (!$wpTerms) { throw QCallerException(QApplication::Translate("Failed to find the WpTerm object for DleCategory.")); } $wpTermsParent = null; if ($objDleCategory->ParentidObject) { $wpTermsParent = $objDleCategory->ParentidObject->LoadWpTerms(); } $intWpTermsParentId = 0; if ($wpTermsParent) { $intWpTermsParentId = $wpTermsParent->TermId; } // check if already copied if (!WpTermTaxonomy::QueryCount(QQ::AndCondition(QQ::Equal(QQN::WpTermTaxonomy()->TermId, $wpTerms->TermId), QQ::Equal(QQN::WpTermTaxonomy()->Parent, $intWpTermsParentId)))) { $objWpTermTaxonomy = new WpTermTaxonomy(); $objWpTermTaxonomy->Initialize(); // set defaults $objWpTermTaxonomy->TermId = $wpTerms->TermId; $objWpTermTaxonomy->Description = $objDleCategory->Descr; $objWpTermTaxonomy->Parent = $intWpTermsParentId; $objWpTermTaxonomy->Taxonomy = "category"; $objWpTermTaxonomy->Count = 0; $objWpTermTaxonomy->Save(); $this->intTermTaxonomyCount++; } }
public function dtgWikiItems_Bind() { $objCondition = QQ::All(); if (trim($this->txtTitle->Text)) { $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::WikiItem()->CurrentName, '%' . trim($this->txtTitle->Text) . '%')); } if ($strPath = trim($this->txtPath->Text)) { $strPath = WikiItem::SanitizeForPath($strPath, $intWikiItemTypeId); $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::WikiItem()->Path, $strPath . '%')); } if ($intValue = $this->lstWikiItemType->SelectedValue) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::WikiItem()->WikiItemTypeId, $intValue)); } if (trim($this->txtPostedBy->Text)) { $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::WikiItem()->CurrentPostedByPerson->DisplayName, trim($this->txtPostedBy->Text) . '%')); } $this->dtgWikiItems->TotalItemCount = WikiItem::QueryCount($objCondition); $objClauses = array(); if ($objClause = $this->dtgWikiItems->LimitClause) { $objClauses[] = $objClause; } if ($objClause = $this->dtgWikiItems->OrderByClause) { $objClauses[] = $objClause; } $this->dtgWikiItems->DataSource = WikiItem::QueryArray($objCondition, $objClauses); }
public function chkPermission_Click($strFormId, $strControlId, $strParameter) { if (is_numeric($strParameter)) { $chkPermission = $this->Form->GetControl($strControlId); if ($chkPermission->Checked) { $objRolePermission = new NarroRolePermission(); $objRolePermission->RoleId = $this->objRole->RoleId; $objRolePermission->PermissionId = $strParameter; try { $objRolePermission->Save(); } catch (QMySqliDatabaseException $objExc) { if (strpos($objExc->getMessage(), 'Duplicate entry') === false) { throw $objExc; } else { // } } } else { $objRolePermission = NarroRolePermission::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::NarroRolePermission()->RoleId, $this->objRole->RoleId), QQ::Equal(QQN::NarroRolePermission()->PermissionId, $strParameter))); if ($objRolePermission instanceof NarroRolePermission) { $objRolePermission->Delete(); } } } else { $this->dtgPermission_Bind(); } }
public function dtgStaff_Bind() { $objConditions = QQ::All(); if ($this->lstMinistry->SelectedValue) { $objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Login()->Ministry->MinistryId, $this->lstMinistry->SelectedValue)); } if ($this->lstActiveFlag->SelectedValue) { $objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Login()->DomainActiveFlag, true), QQ::Equal(QQN::Login()->LoginActiveFlag, true)); } else { $objConditions = QQ::AndCondition($objConditions, QQ::OrCondition(QQ::Equal(QQN::Login()->DomainActiveFlag, false), QQ::Equal(QQN::Login()->LoginActiveFlag, false))); } $this->dtgStaff->TotalItemCount = Login::QueryCount($objConditions); // Setup the $objClauses Array $objClauses = array(); // 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->dtgStaff->OrderByClause) { array_push($objClauses, $objClause); } // Add the LimitClause information, as well if ($objClause = $this->dtgStaff->LimitClause) { array_push($objClauses, $objClause); } // Set the DataSource to be a Query result from Login, given the clauses above $this->dtgStaff->DataSource = Login::QueryArray($objConditions, $objClauses); }
public function GetControlHtml() { $strLogContents = ''; foreach (NarroLog::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroLog()->ProjectId, $this->intProjectId), QQ::Equal(QQN::NarroLog()->LanguageId, $this->intLanguageId), QQ::GreaterThan(QQN::NarroLog()->Date, $this->dttStart))) as $objLogEntry) { switch ($objLogEntry->Priority) { case NarroLog::PRIORITY_INFO: $strLogContents .= '<div class="info"'; break; case NarroLog::PRIORITY_WARN: $strLogContents .= '<div class="warning"'; break; case NarroLog::PRIORITY_ERROR: $strLogContents .= '<div class="error"'; break; default: $strLogContents .= '<div'; } $strLogContents .= sprintf('title="%s">%s</div>', $objLogEntry->Date, nl2br(NarroString::HtmlEntities($objLogEntry->Message))); } $this->strText = sprintf('<div class="ui-accordion ui-widget ui-helper-reset ui-accordion-icons"> <h3 class="ui-accordion-header ui-helper-reset ui-state-default ui-state-active ui-corner-top"> <span class="ui-icon ui-icon-triangle-1-s"></span> <a>%s</a> </h3> <div class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active" style="max-height:300px;overflow:auto"> %s </div> </div>', t('Operation log'), $strLogContents); return parent::GetControlHtml(); }
public static function RestoreByNameForClass($strName, $intClassId, $strVersion, $objFile) { $objConstant = QcodoConstant::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::QcodoConstant()->QcodoClassId, $intClassId), QQ::Equal(QQN::QcodoConstant()->Variable->Name, $strName))); if (!$objConstant) { $objVariable = new Variable(); $objVariable->Name = $strName; $objVariable->VariableTypeId = VariableType::String; $objVariable->FirstVersion = $strVersion; $objVariable->Save(); $objConstant = new QcodoConstant(); $objConstant->Variable = $objVariable; $objConstant->File = $objFile; $objConstant->QcodoClassId = $intClassId; $objConstant->Save(); } else { if ($objConstant->Variable->LastVersion) { $objConstant->Variable->LastVersion = null; $objConstant->Variable->Save(); } if ($objFile->Id != $objConstant->intFileId) { $objConstant->File = $objFile; $objConstant->Save(); } } return $objConstant; }
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; }
/** * @return WpPosts|null The WpPosts object, that is a copy of this DLE post. */ public function LoadWpPosts() { $objWpUsers = $this->LoadWpUser(); if (!$objWpUsers) { return null; } return WpPosts::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::WpPosts()->PostAuthor, $objWpUsers->Id), QQ::Equal(QQN::WpPosts()->PostDate, $this->Date), QQ::Equal(QQN::WpPosts()->PostName, $this->AltName)), QQ::Clause(QQ::LimitInfo(1))); }
public function txtSearch_KeyUp() { if (strlen($this->txtSearch->Text) < 2 || preg_match("/^'.*'\$/", $this->txtSearch->Text) || preg_match('/^".*"$/', $this->txtSearch->Text)) { $this->dtgSuggestion->AdditionalConditions = QQ::AndCondition(QQ::Equal(QQN::NarroSuggestion()->LanguageId, $this->lstLanguage->SelectedValue), QQ::Like(QQN::NarroSuggestion()->Text->TextValue, substr($this->txtSearch->Text, 1, -1))); } else { $this->dtgSuggestion->AdditionalConditions = QQ::AndCondition(QQ::Equal(QQN::NarroSuggestion()->LanguageId, $this->lstLanguage->SelectedValue), QQ::Like(QQN::NarroSuggestion()->Text->TextValue, '%' . $this->txtSearch->Text . '%')); } $this->dtgSuggestion->Refresh(); }
protected function dtgGroupRegistration_Bind() { $objConditions = QQ::All(); $objClauses = QQ::Clause($this->dtgGroupRegistrations->OrderByClause); if (!$this->chkShowInactive->Checked) { $objConditions = QQ::AndCondition($objConditions, QQ::OrCondition(QQ::Equal(QQN::GroupRegistrations()->ProcessedFlag, false), QQ::IsNull(QQN::GroupRegistrations()->ProcessedFlag))); } $this->dtgGroupRegistrations->DataSource = GroupRegistrations::QueryArray($objConditions, $objClauses); }
/** * 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; } }
public function LoadByCustomFieldShortDescription($intCustomFieldId, $strShortDescription) { // Call CustomFieldValue::QueryArray to perform the LoadByCustFieldShortDescription query try { return CustomFieldValue::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::CustomFieldValue()->CustomFieldId, $intCustomFieldId), QQ::Equal(QQN::CustomFieldValue()->ShortDescription, $strShortDescription))); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
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))); }
public function dtgFunds_Bind() { $objCondition = QQ::All(); if (!is_null($blnOption = $this->lstActiveFlag->SelectedValue)) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipFund()->ActiveFlag, $blnOption)); } if (!is_null($blnOption = $this->lstExternalFlag->SelectedValue)) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipFund()->ExternalFlag, $blnOption)); } $this->dtgFunds->MetaDataBinder($objCondition); }
public function dtgComments_Bind() { // Only bind comments about this person $objCondition = QQ::Equal(QQN::Comment()->PersonId, $this->objPerson->Id); // Do NOT allow viewing of Confidential notes if the Login isn't allowed to see them if (!QApplication::$Login->IsPermissionAllowed(PermissionType::AccessConfidentialNotes)) { $objCondition = QQ::AndCondition($objCondition, QQ::NotEqual(QQN::Comment()->CommentPrivacyTypeId, CommentPrivacyType::Confidential)); } // Perform the Bind $this->dtgComments->MetaDataBinder($objCondition); }
/** * @return WpComments|null The Worpress comment for this DLE comment. */ public function LoadWpComments() { $objWpPosts = $this->LoadWpPosts(); if (!$objWpPosts) { return null; } $objWpUsers = $this->LoadWpUsers(); $conUsersCondition = QQ::Equal(QQN::WpComments()->CommentAuthorEmail, $this->Email); if ($objWpUsers) { $conUsersCondition = QQ::Equal(QQN::WpComments()->UserId, $objWpUsers->Id); } return WpComments::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::WpComments()->CommentPostID, $objWpPosts->Id), $conUsersCondition, QQ::Equal(QQN::WpComments()->CommentDate, $this->Date), QQ::Equal(QQN::WpComments()->CommentContent, str_replace('\\"', '"', $this->Text))), QQ::Clause(QQ::OrderBy(QQN::WpComments()->CommentID), QQ::LimitInfo(1))); }
protected function GetAssetLog() { $objClauses = array(); array_push($objClauses, QQ::OrderBy(QQN::Assetsauditlog()->RealReturnDate)); if ($this->txtSearchTerm->Text == "") { $condition = QQ::Equal(QQN::Assetsauditlog()->Owner, $_SESSION['User']); $myassets = Assetsauditlog::QueryArray($condition, $objClauses); } else { $objCondition = QQ::AndCondition(QQ::OrCondition(QQ::Like(QQN::Assetsauditlog()->Asin, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Assetsauditlog()->Email, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Assetsauditlog()->Title, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Assetsauditlog()->FullName, '%' . $this->txtSearchTerm->Text . '%')), QQ::Equal(QQN::Assetsauditlog()->Owner, $_SESSION['User'])); $objDbResult = Assetsauditlog::QueryArray($objCondition, $objClauses); $myassets = $objDbResult; } return $myassets; }
protected function dtgBatches_Bind() { $objCondition = QQ::All(); if (strlen($strText = trim($this->txtDescription->Text))) { $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::StewardshipBatch()->Description, $strText . '%')); } if ($this->lstCreatedBy->SelectedValue) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipBatch()->CreatedByLoginId, $this->lstCreatedBy->SelectedValue)); } if ($this->lstStatus->SelectedValue) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::StewardshipBatch()->StewardshipBatchStatusTypeId, $this->lstStatus->SelectedValue)); } $this->dtgBatches->MetaDataBinder($objCondition); }
public function dtgMembers_Bind() { $objCondition = QQ::In(QQN::Person()->GroupParticipation->GroupId, $this->intGroupIdArray); $objCondition = QQ::AndCondition($objCondition, QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd)); $this->dtgMembers->TotalItemCount = Person::QueryCount($objCondition); $objClauses = array(QQ::Distinct()); if ($objClause = $this->dtgMembers->LimitClause) { $objClauses[] = $objClause; } if ($objClause = $this->dtgMembers->OrderByClause) { $objClauses[] = $objClause; } $this->dtgMembers->DataSource = Person::QueryArray($objCondition, $objClauses); }
public function testSaveAndDelete() { $objPerson1 = new Person(); $objPerson1->FirstName = "Test1"; $objPerson1->LastName = "Last1"; $objPerson1->Save(); $items = Person::QueryArray(QQ::AndCondition(QQ::Equal(QQN::Person()->FirstName, "Test1"), QQ::Equal(QQN::Person()->LastName, "Last1"))); $this->assertEqual(sizeof($items), 1, "Saved the Person object"); $objPerson2 = $items[0]; $this->assertEqual($objPerson2->FirstName, "Test1", "The first name is correct"); $this->assertEqual($objPerson2->LastName, "Last1", "The last name is correct"); $objPerson2->Delete(); $items = Person::QueryArray(QQ::AndCondition(QQ::Equal(QQN::Person()->FirstName, "Test1"), QQ::Equal(QQN::Person()->LastName, "Last1"))); $this->assertEqual(sizeof($items), 0, "Deleting the Person object"); }
public function dtgShowcaseItems_Bind() { $objCondition = QQ::All(); if (!is_null($blnValue = $this->lstLiveFlag->SelectedValue)) { $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::ShowcaseItem()->LiveFlag, $blnValue)); } $this->dtgShowcaseItems->TotalItemCount = ShowcaseItem::QueryCount($objCondition); $objClauses = array(); if ($objClause = $this->dtgShowcaseItems->LimitClause) { $objClauses[] = $objClause; } if ($objClause = $this->dtgShowcaseItems->OrderByClause) { $objClauses[] = $objClause; } $this->dtgShowcaseItems->DataSource = ShowcaseItem::QueryArray($objCondition, $objClauses); }
/** * Refreshes pledge infromation (e.g. amount contributed, status, etc.) * @param boolean $blnSave whether or not to save */ public function Refresh($blnSave = true) { $objAmountArray = StewardshipContributionAmount::QueryArray(QQ::AndCondition(QQ::Equal(QQN::StewardshipContributionAmount()->StewardshipFundId, $this->StewardshipFundId), QQ::Equal(QQN::StewardshipContributionAmount()->StewardshipContribution->PersonId, $this->PersonId))); $fltTotal = 0; foreach ($objAmountArray as $objAmount) { $fltTotal += $objAmount->Amount; } $this->fltContributedAmount = $fltTotal; $this->fltRemainingAmount = max(0, $this->fltPledgeAmount - $this->fltContributedAmount); $this->blnFulfilledFlag = $this->fltRemainingAmount < 1.0; if ($this->blnFulfilledFlag) { $this->blnActiveFlag = false; } if ($blnSave) { $this->Save(); } }
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); }
protected function GetShareDetails() { $objClauses = array(); array_push($objClauses, QQ::OrderBy(QQN::Sharedetails()->ReturnDate)); if ($objClause = $this->dtrShareDetails->LimitClause) { array_push($objClauses, $this->dtrShareDetails->LimitClause); } if ($this->txtSearchTerm->Text == "") { $objCondition = QQ::Equal(QQN::Sharedetails()->Owner, $_SESSION['User']); $myassets = Sharedetails::QueryArray($objCondition, $objClauses); } else { $objCondition = QQ::AndCondition(QQ::OrCondition(QQ::Like(QQN::Sharedetails()->Asin, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->Email, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->TakenDate, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->ReturnDate, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->Title, '%' . $this->txtSearchTerm->Text . '%'), QQ::Like(QQN::Sharedetails()->FullName, '%' . $this->txtSearchTerm->Text . '%')), QQ::Equal(QQN::Myassets()->Owner, $_SESSION['User'])); $objDbResult = Sharedetails::QueryArray($objCondition, $objClauses); $myassets = $objDbResult; } //$this->dtrShareDetails->TotalItemCount = Sharedetails::QueryCount($condition); $this->arrShareDetails = $myassets; return $objCondition; }
public function dtgMembers_Bind() { $objConditions = QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $this->objGroup->Id); $this->dtgMembers->TotalItemCount = Person::QueryCount($objConditions); if ($strName = trim($this->txtFirstName->Text)) { $objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->FirstName, $strName . '%')); } if ($strName = trim($this->txtLastName->Text)) { $objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->LastName, $strName . '%')); } $objClauses = array(QQ::Distinct()); if ($objClause = $this->dtgMembers->LimitClause) { $objClauses[] = $objClause; } if ($objClause = $this->dtgMembers->OrderByClause) { $objClauses[] = $objClause; } $this->dtgMembers->DataSource = Person::QueryArray($objConditions, $objClauses); }
public function RenderCount($objGroup) { // Count differently if it's a group Category or Growth Group if ($objGroup->Type == GroupType::$NameArray[GroupType::GroupCategory]) { // Setup Group Array $objGroupArray = $objGroup->GetThisAndChildren(); $intGroupIdArray = array(); foreach ($objGroupArray as $objGroup) { $intGroupIdArray[] = $objGroup->Id; } $objCondition = QQ::In(QQN::Person()->GroupParticipation->GroupId, $intGroupIdArray); $objCondition = QQ::AndCondition($objCondition, QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd)); $strReturn = Person::QueryCount($objCondition); return "<b>" . $strReturn . "</b>"; } else { $objCondition = QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $objGroup->Id); $objCondition = QQ::AndCondition($objCondition, QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd)); return Person::QueryCount($objCondition); } }