public static Equal ( QQNode $objQueryNode, $mixValue ) | ||
$objQueryNode | QQNode |
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); }
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()); } }
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"; }
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 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 function render_btnToggleRecords($parControl, $strType) { $strControlId = 'btnToggleRecordsforaddressofperson' . $strType->Id . 'ofproject' . $this->objProject->Id; if (!($objControl = $parControl->GetChildControl($strControlId))) { // But in this case the parent control of the button // would be this child QDataGrid, don't forget that... $person_addresses = Address::QueryCount(QQ::Equal(QQN::Address()->PersonId, $strType->Id)); if ($person_addresses > 0) { $objControl = new QButton($parControl, $strControlId); $objControl->Width = 20; $objControl->Text = '+'; $objControl->CssClass = 'inputbutton'; $objControl->ActionParameter = "{$strType->Id}"; // Important! for a better coding we want to all // actions referer to the child QdataGris stay // in the child Qdatagrid, so the actions are now // QAjaxControlAction or QServerControlAction, were the // controlId parameter is $this, becaouse in $this class // is defined the event for this button... kind of easy, // and clean. $objControl->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnToggleRecords_Click', $this->objParentObject->WaitIcon)); } else { // No addresses to expand; we'll use an empty label control to signify that $objControl = new QLabel($parControl, $strControlId); $objControl->Text = ''; } } // We pass the parameter of "false" to make sure the control doesn't render // itself RIGHT HERE - that it instead returns its string rendering result. return $objControl->Render(false); }
/** * @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++; } }
function getPrimaryResource($strResourceName, $intResourceID, $arrVariables) { if ($intResourceID) { $objPrimaryData = call_user_func(array(ucwords($strResourceName), 'Load'), $intResourceID); } else { // IF VARIABLES PASSED, USE IN QUERY if (!empty($arrVariables)) { $arrSearch = array(); // LOOP THROUGH VARIABLES foreach ($arrVariables as $strField => $strValue) { // IF NOT _VARIABLE if (substr($strField, 0, 1) != '_') { // ADD VARIABLE TO SEARCH ARRAY; $objQQN = call_user_func(array('QQN', $strResourceName)); $objQQNode = $objQQN->{ucwords($strField)}; $arrSearch[] = QQ::Equal($objQQNode, $strValue); } } if (!empty($arrSearch)) { $objPrimaryData = call_user_func(array($strResourceName, 'QueryArray'), call_user_func(array('QQ', 'AndCondition'), $arrSearch)); } else { $objPrimaryData = call_user_func(array($strResourceName, 'LoadAll')); } } else { $objPrimaryData = call_user_func(array($strResourceName, 'LoadAll')); } } return $objPrimaryData; }
/** * @param DleUsers $objDleUsers The DB ORM object to process */ protected function process_object($objDleUsers) { // wp: ID, user_login, user_nicename, user_email, user_registered, display_name // dl: user_id, name, name, email, FROM_UNIXTIME( reg_date ), fullname $strEmail = $objDleUsers->Email; if ($strEmail && strlen($strEmail)) { // check if already copied if (!WpUsers::QueryCount(QQ::Equal(QQN::WpUsers()->UserEmail, $strEmail))) { $objWpUsers = new WpUsers(); $objWpUsers->Initialize(); // set defaults $objWpUsers->UserLogin = $objDleUsers->Name; $objWpUsers->UserNicename = $objDleUsers->Name; $objWpUsers->UserEmail = $objDleUsers->Email; $objWpUsers->UserRegistered = QDateTime::FromTimestamp(intval($objDleUsers->RegDate)); $objWpUsers->DisplayName = $objDleUsers->Fullname; $objWpUsers->UserPass = ''; $objWpUsers->UserUrl = ''; $objWpUsers->UserActivationKey = ''; $objWpUsers->UserStatus = 0; $objWpUsers->Save(); $this->intUserCount++; } } }
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 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; }
/** * Load a single AssetTransactionCheckout object with expansion map of Contact and UserAccount, * by TransactionId * @param integer $intAssetId * @return object $objAssetTransactionCheckout */ public function LoadWithToContactToUserByTransactionId($intAssetTransactionId = null) { $objClauses = array(); array_push($objClauses, QQ::Expand(QQN::AssetTransactionCheckout()->ToContact)); array_push($objClauses, QQ::Expand(QQN::AssetTransactionCheckout()->ToUser)); $objAssetTransactionCheckout = AssetTransactionCheckout::QuerySingle(QQ::Equal(QQN::AssetTransactionCheckout()->AssetTransactionId, $intAssetTransactionId), $objClauses); return $objAssetTransactionCheckout; }
/** * @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))); }
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'; }
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(); }
/** * 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; } }
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); }
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 testAssociationTables() { // All People Who Are on a Project Managed by Karen Wolfe (Person ID #7) $objPersonArray = Person::QueryArray(QQ::Equal(QQN::Person()->ProjectAsTeamMember->Project->ManagerPersonId, 7), QQ::Clause(QQ::Distinct(), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName))); $arrNamesOnly = array(); foreach ($objPersonArray as $item) { $arrNamesOnly[] = $item->FirstName . " " . $item->LastName; } $this->assertEqual($arrNamesOnly, array("Brett Carlisle", "John Doe", "Samantha Jones", "Jacob Pratt", "Kendall Public", "Ben Robinson", "Alex Smith", "Wendy Smith", "Karen Wolfe"), "List managed persons is correct"); }
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); }
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 dtgCommLists_Bind() { if ($this->intMinistryId) { $this->dtgCommLists->MetaDataBinder(QQ::Equal(QQN::CommunicationList()->MinistryId, $this->intMinistryId)); $this->dtgCommLists->Visible = true; } else { $this->dtgCommLists->DataSource = null; $this->dtgCommLists->Visible = false; } $this->lblStartText->Visible = !$this->dtgCommLists->Visible; }
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); }
public function RefreshStats() { $this->intPackageCount = $this->CountPackages(); $objPackage = Package::QuerySingle(QQ::Equal(QQN::Package()->PackageCategoryId, $this->intId), QQ::Clause(QQ::LimitInfo(1), QQ::OrderBy(QQN::Package()->LastPostDate, false))); if ($objPackage && $objPackage->LastPostDate) { $this->dttLastPostDate = new QDateTime($objPackage->LastPostDate); } else { $this->dttLastPostDate = null; } $this->Save(); }
protected function dtgNewMembers_Bind() { $dtAfterValue = new QDateTime($this->dtxAfterValue->Text); $dtBeforeValue = new QDateTime($this->dtxBeforeValue->Text); $objcondition = QQ::Equal(QQN::Membership()->Person->AttributeValue->Attribute->Name, 'Post-2016'); $this->dtgNewMembers->TotalItemCount = Membership::CountArrayByStartDateRange($dtAfterValue, $dtBeforeValue, $objcondition); $objMembershipArray = Membership::LoadArrayByStartDateRange($dtAfterValue, $dtBeforeValue, $objcondition, $this->dtgNewMembers->LimitClause); $this->dtgNewMembers->DataSource = $objMembershipArray; $this->iTotalCount = count($objMembershipArray); $this->CalculateMaritalAndAgeStatus($objMembershipArray); $this->CalculateAttributeStatistics($objMembershipArray); }
/** * This will refresh all the stats (last post date, message/topic counts) and save the record to the database * @return void */ public function RefreshStats() { $objMessage = Message::QuerySingle(QQ::Equal(QQN::Message()->TopicLinkId, $this->intId), QQ::Clause(QQ::OrderBy(QQN::Message()->PostDate, false), QQ::LimitInfo(1))); if ($objMessage) { $this->dttLastPostDate = $objMessage->PostDate; } else { $this->dttLastPostDate = null; } $this->intMessageCount = Message::CountByTopicLinkId($this->intId); $this->intTopicCount = Topic::CountByTopicLinkId($this->intId); $this->Save(); }
/** * @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 dtgContributions_Bind() { $objCondition = QQ::Equal(QQN::PackageContribution()->PackageId, $this->objPackage->Id); $this->dtgContributions->TotalItemCount = PackageContribution::QueryCount($objCondition); $objClauses = array(); if ($objClause = $this->dtgContributions->LimitClause) { $objClauses[] = $objClause; } if ($objClause = $this->dtgContributions->OrderByClause) { $objClauses[] = $objClause; } $this->dtgContributions->DataSource = PackageContribution::QueryArray($objCondition, $objClauses); }
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); }