IsNull() public static method

public static IsNull ( QQNode $objQueryNode )
$objQueryNode QQNode
Example #1
0
 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());
     }
 }
Example #2
0
 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);
 }
Example #3
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)));
 }
 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);
 }
Example #5
0
 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);
     }
 }
Example #6
0
 public function dtgGroups_Bind()
 {
     if ($this->chkViewAll->Checked) {
         $objClause = QQ::AndCondition(QQ::Equal(QQN::Group()->GroupParticipation->PersonId, $this->objPerson->Id), QQ::In(QQN::Group()->GroupTypeId, array(GroupType::RegularGroup, GroupType::GrowthGroup)));
     } else {
         $objClause = QQ::AndCondition(QQ::Equal(QQN::Group()->GroupParticipation->PersonId, $this->objPerson->Id), QQ::IsNull(QQN::Group()->GroupParticipation->DateEnd), QQ::In(QQN::Group()->GroupTypeId, array(GroupType::RegularGroup, GroupType::GrowthGroup)));
     }
     // Admins can view anything
     if (QApplication::$Login->RoleTypeId == RoleType::ChMSAdministrator) {
     } else {
         // Non-Admins can only view non-confidential groups
         // OR groups that they are associated with
         $intMinistryIdArray = array();
         foreach (QApplication::$Login->GetMinistryArray() as $objMinistry) {
             $intMinistryIdArray[] = $objMinistry->Id;
         }
         $objSubClause = QQ::OrCondition(QQ::Equal(QQN::Group()->ConfidentialFlag, false), QQ::In(QQN::Group()->MinistryId, $intMinistryIdArray));
         $objClause = QQ::AndCondition($objClause, $objSubClause);
     }
     $this->dtgGroups->DataSource = Group::QueryArray($objClause, QQ::Distinct());
 }
 public function dtgMembers_Bind()
 {
     if ($this->chkViewAll->Checked) {
         $objConditions = QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $this->objGroup->Id);
     } else {
         $objConditions = QQ::AndCondition(QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $this->objGroup->Id), QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd));
     }
     $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);
 }
<?php

QEmailServer::$SmtpServer = SMTP_SERVER;
QEmailServer::$SmtpPort = SMTP_PORT;
QEmailServer::$SmtpUsername = SMTP_USERNAME;
QEmailServer::$SmtpPassword = SMTP_PASSWORD;
QEmailServer::$AuthLogin = true;
$objEmailQueue = EmailQueue::QueryArray(QQ::IsNull(QQN::EmailQueue()->ErrorFlag), QQ::Clause(QQ::LimitInfo(50)));
foreach ($objEmailQueue as $objEmail) {
    $objEmail->Send();
}
Example #9
0
File: rss.php Project: Jobava/narro
     $strCacheId = sprintf('rssfeed_text_%d_%d', $objProject->ProjectId, QApplication::QueryString('l'));
 } else {
     $strCacheId = sprintf('rssfeed_text_%d', QApplication::QueryString('l'));
 }
 if (!($objRssFeed = QApplication::$Cache->load($strCacheId))) {
     if (isset($objProject) && $objProject instanceof NarroProject) {
         $objRssFeed = new QRssFeed(sprintf(t('Texts to translate for %s'), $objProject->ProjectName), __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__, sprintf(t('Get the latest texts to translate for the project %s'), $objProject->ProjectName));
     } else {
         $objRssFeed = new QRssFeed(t('Texts to translate'), __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__, t('Get the latest texts to translate'));
     }
     if (isset($objProject) && $objProject instanceof NarroProject) {
         $objProjectCondition = QQ::Equal(QQN::NarroContextInfo()->Context->ProjectId, $objProject->ProjectId);
     } else {
         $objProjectCondition = QQ::All();
     }
     $arrNarroContextInfo = NarroContextInfo::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->Context->Active, 1), $objProjectCondition, QQ::IsNull(QQN::NarroContextInfo()->ValidSuggestionId), QQ::Equal(QQN::NarroContextInfo()->LanguageId, QApplication::GetLanguageId())), array(QQ::OrderBy(QQN::NarroContextInfo()->Context->Text->Created, 0), QQ::OrderBy(QQN::NarroContextInfo()->Context->TextId, 1), QQ::OrderBy(QQN::NarroContextInfo()->Context->ProjectId, 1), QQ::LimitInfo(20, 0)));
     $intOldTextId = 0;
     $intOldProjectId = 0;
     $strDescription = '';
     foreach ($arrNarroContextInfo as $intKey => $objNarroContextInfo) {
         $strContextLink = sprintf(__HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__ . '/' . NarroLink::Translate($objNarroContextInfo->Context->ProjectId, '', 0, '', 0, 0, 10, 0, $objNarroContextInfo->ContextInfoId));
         if ($intOldTextId != $objNarroContextInfo->Context->TextId) {
             if (isset($objItem)) {
                 $objItem->Description = $strDescription . '</ul><p>' . t('Click on any context to translate the text, on the file name or project name to see all the untranslated texts from that file or project.') . '</p>';
                 $objRssFeed->AddItem($objItem);
                 $strDescription = '';
                 $intOldProjectId = 0;
             }
             $objItem = new QRssItem(strlen($objNarroContextInfo->Context->Text->TextValue) > 124 ? substr($objNarroContextInfo->Context->Text->TextValue, 0, 124) . '...' : $objNarroContextInfo->Context->Text->TextValue, $strContextLink);
             $objItem->PubDate = new QDateTime($objNarroContextInfo->Context->Text->Created);
             if ($objNarroContextInfo->Context->Text->HasComments) {
 public function dtgFile_SetConditions()
 {
     if ($this->txtSearch->Text == '') {
         $objCommonCondition = QQ::AndCondition(QQ::Equal(QQN::NarroFileProgress()->File->Active, 1), QQ::Equal(QQN::NarroFileProgress()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroFileProgress()->File->ProjectId, $this->objProject->ProjectId));
     } else {
         $objCommonCondition = QQ::AndCondition(QQ::Equal(QQN::NarroFileProgress()->File->Active, 1), QQ::Equal(QQN::NarroFileProgress()->LanguageId, QApplication::GetLanguageId()), QQ::Equal(QQN::NarroFileProgress()->File->ProjectId, $this->objProject->ProjectId), QQ::Like(QQN::NarroFileProgress()->File->FileName, sprintf('%%%s%%', $this->txtSearch->Text)));
     }
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if (!$this->chkShowHierarchy->Checked) {
         if ($this->chkShowFolders->Checked) {
             $this->dtgFile->AdditionalConditions = $objCommonCondition;
         } else {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, QQ::NotEqual(QQN::NarroFileProgress()->File->TypeId, NarroFileType::Folder));
         }
     } elseif ($this->objParentFile) {
         $objParentCondition = QQ::Equal(QQN::NarroFileProgress()->File->ParentId, $this->objParentFile->FileId);
         if ($this->chkShowFolders->Checked) {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, $objParentCondition);
         } else {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, $objParentCondition, QQ::NotEqual(QQN::NarroFileProgress()->File->TypeId, NarroFileType::Folder));
         }
     } else {
         $objParentCondition = QQ::IsNull(QQN::NarroFileProgress()->File->ParentId);
         if ($this->chkShowFolders->Checked) {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, $objParentCondition);
         } else {
             $this->dtgFile->AdditionalConditions = QQ::AndCondition($objCommonCondition, $objParentCondition, QQ::NotEqual(QQN::NarroFileProgress()->File->TypeId, NarroFileType::Folder));
         }
     }
     $this->MarkAsModified();
 }
Example #11
0
 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;
 }
Example #12
0
 protected function CalculateQqCondition(QueryCondition $objQueryCondition, QQNode $objQqNode, QQCondition $objQqConditionToAdd = null)
 {
     // Get the comparison Query Operation we are using
     $objOperation = $objQueryCondition->QueryOperation;
     // Get the QQ Factory Name we are using -- this becomes the Qq Method Name we run to construct
     // the QcodoQueryCondition
     $strMethodName = $objOperation->QqFactoryName;
     // Generate the QcodoQueryCondition
     switch ($objQueryCondition->QueryNode->QueryDataTypeId) {
         case QueryDataType::BooleanValue:
             if ($objQueryCondition->Value) {
                 $objQqCondition = QQ::Equal($objQqNode, true);
             } else {
                 $objQqCondition = QQ::OrCondition(QQ::Equal($objQqNode, false), QQ::IsNull($objQqNode));
             }
             break;
         default:
             if ($objOperation->ArgumentFlag) {
                 $strArgument = $objOperation->ArgumentPrepend . $objQueryCondition->Value . $objOperation->ArgumentPostpend;
                 $objQqCondition = QQ::$strMethodName($objQqNode, $strArgument);
             } else {
                 $objQqCondition = QQ::$strMethodName($objQqNode);
             }
             break;
     }
     if ($objQqConditionToAdd) {
         $objQqCondition = QQ::AndCondition($objQqConditionToAdd, $objQqCondition);
     }
     return $objQqCondition;
 }
Example #13
0
 public function RenderCurrentGroups(Person $objPerson)
 {
     $this->objParticipations = GroupParticipation::QueryArray(QQ::AndCondition(QQ::Equal(QQN::GroupParticipation()->PersonId, $objPerson->Id), QQ::IsNull(QQN::GroupParticipation()->DateEnd), QQ::In(QQN::GroupParticipation()->GroupId, $this->intGroupIdArray)), QQ::Clause(QQ::OrderBy(QQN::GroupParticipation()->Group->Name), QQ::Expand(QQN::GroupParticipation()->Group->Name)));
     $strArray = array();
     foreach ($this->objParticipations as $objParticipation) {
         $strArray[] = $objParticipation->Group->Name;
     }
     if (count($strArray)) {
         return implode(' and ', $strArray);
     } else {
         return '<span style="font-size: 10px; color: #999;">No current groups</span>';
     }
 }
Example #14
0
 /**
  * Gets all associated ACTIVE GroupParticipations as an array of GroupParticipation objects
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return GroupParticipation[]
  */
 public function GetActiveGroupParticipationArray($objOptionalClauses = null)
 {
     if (is_null($this->intId)) {
         return array();
     }
     try {
         return GroupParticipation::QueryArray(QQ::AndCondition(QQ::Equal(QQN::GroupParticipation()->GroupId, $this->intId), QQ::OrCondition(QQ::IsNull(QQN::GroupParticipation()->DateEnd), QQ::GreaterThan(QQN::GroupParticipation()->DateEnd, QDateTime::Now()))), $objOptionalClauses);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
 public function dtgParentPagerIndividual_Bind()
 {
     $objCondition = QQ::All();
     if (strlen($strText = trim($this->txtServerIdentifier->Text))) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::ParentPagerIndividual()->ServerIdentifier, $strText));
     }
     if (strlen($strText = trim($this->txtFirstName->Text))) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::ParentPagerIndividual()->FirstName, $strText . '%'));
     }
     if (strlen($strText = trim($this->txtLastName->Text))) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::ParentPagerIndividual()->LastName, $strText . '%'));
     }
     if ($this->chkShowUnlinkedOnly->Checked) {
         $objCondition = QQ::AndCondition($objCondition, QQ::IsNull(QQN::ParentPagerIndividual()->PersonId));
     }
     $this->dtgParentPagerIndividuals->MetaDataBinder($objCondition);
 }
<?php

QEmailServer::$SmtpServer = SMTP_SERVER;
QEmailServer::$OriginatingServerIp = SMTP_EHLO;
QEmailServer::$TestMode = SMTP_TEST_MODE;
$objEmailQueue = EmailQueue::QueryArray(QQ::IsNull(QQN::EmailQueue()->ErrorFlag), QQ::Clause(QQ::OrderBy(QQN::EmailQueue()->HighPriorityFlag, false), QQ::LimitInfo(50)));
foreach ($objEmailQueue as $objEmail) {
    $objEmail->Send();
}
Example #17
0
File: log.php Project: Jobava/narro
 protected function Form_Create()
 {
     parent::Form_Create();
     if (!QApplication::HasPermissionForThisLang('Administrator')) {
         QApplication::Redirect(NarroLink::ProjectList());
     }
     $this->pnlTab = new QTabs($this);
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::ProjectList(t('Projects'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Review(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Review'));
     if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::LanguageList(t('Languages'));
     }
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserList('', t('Users'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         $this->pnlLog = new QPanel($this->pnlTab);
         $this->pnlLog->AutoRenderChildren = true;
         $btnClearLog = new QButton($this->pnlLog);
         $btnClearLog->Text = t('Clear the log');
         $btnClearLog->AddAction(new QClickEvent(), new QConfirmAction(t('Are you sure you want to delete all the logged messages?')));
         $btnClearLog->AddAction(new QClickEvent(), new QAjaxAction('btnClearLog_Click'));
         $this->dtgLog = new NarroLogDataGrid($this->pnlLog);
         // Datagrid Paginator
         $this->dtgLog->Paginator = new QPaginator($this->dtgLog);
         $this->dtgLog->PaginatorAlternate = new QPaginator($this->dtgLog);
         $this->dtgLog->ItemsPerPage = QApplication::$User->GetPreferenceValueByName('Items per page');
         $this->dtgLog->SortColumnIndex = 0;
         $this->dtgLog->SortDirection = 1;
         $colDate = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Date);
         $colDate->OrderByClause = QQ::OrderBy(QQN::NarroLog()->LogId);
         $colDate->ReverseOrderByClause = QQ::OrderBy(QQN::NarroLog()->LogId, 0);
         if (QApplication::HasPermission('Administrator')) {
             $colLanguage = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Language->LanguageName);
             $colLanguage->Filter = null;
             $colLanguage->FilterAddListItem(t('-Not set-'), QQ::IsNull(QQN::NarroLog()->LanguageId));
             foreach (NarroLanguage::LoadAll(QQ::OrderBy(QQN::NarroLanguage()->LanguageName)) as $objLanguage) {
                 $colLanguage->FilterAddListItem($objLanguage->LanguageName, QQ::Equal(QQN::NarroLog()->LanguageId, $objLanguage->LanguageId));
             }
         } else {
             $this->dtgLog->AdditionalConditions = QQ::Equal(QQN::NarroLog()->LanguageId, QApplication::GetLanguageId());
         }
         $colProject = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Project->ProjectName);
         $colProject->Filter = null;
         $colProject->FilterAddListItem(t('-Not set-'), QQ::IsNull(QQN::NarroLog()->ProjectId));
         foreach (NarroProject::LoadAll(QQ::OrderBy(QQN::NarroProject()->ProjectName)) as $objProject) {
             $colProject->FilterAddListItem($objProject->ProjectName, QQ::Equal(QQN::NarroLog()->ProjectId, $objProject->ProjectId));
         }
         $colUser = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->User->Username);
         $colUser->Html = '<?=(($_ITEM->UserId)?NarroLink::UserProfile($_ITEM->UserId, $_ITEM->User->Username):"")?>';
         $colUser->HtmlEntities = false;
         $colPriority = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Priority);
         $colPriority->Name = 'P';
         $colPriority->Width = 16;
         $colPriority->FilterBoxSize = 1;
         $colPriority->HtmlEntities = false;
         $colMessage = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Message);
         $colMessage->HtmlEntities = false;
         $colMessage->Html = '<?=$_FORM->dtgLog_colMessage_Render($_ITEM)?>';
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
         $this->pnlTab->Selected = count($arrHeaders) - 1;
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
 public function ExportFromDirectory()
 {
     // NarroLogger::LogDebug(sprintf('Starting to export in directory "%s"', $this->strTranslationPath));
     /**
      * get the file list with complete paths
      */
     $arrFiles = $this->ListDir($this->strTemplatePath);
     $intTotalFilesToProcess = count($arrFiles);
     if ($intTotalFilesToProcess == 1 && pathinfo($arrFiles[0], PATHINFO_EXTENSION) == 'xpi') {
         return $this->ExportToXpi($arrFiles[0]);
     }
     if ($intTotalFilesToProcess > __MAXIMUM_FILE_COUNT_TO_EXPORT__) {
         NarroLogger::LogError(sprintf('Too many files to process: %d. The maximum number of files to export is set in the configuration file at %d', $intTotalFilesToProcess, __MAXIMUM_FILE_COUNT_TO_EXPORT__));
         return false;
     }
     // NarroLogger::LogDebug(sprintf('Starting to process %d files', $intTotalFilesToProcess));
     $arrDirectories = array();
     NarroProgress::SetProgress(0, $this->objProject->ProjectId, 'export', $intTotalFilesToProcess);
     if (is_array($arrFiles)) {
         foreach ($arrFiles as $intFileNo => $strFileToExport) {
             $arrFileParts = explode('/', str_replace($this->strTemplatePath, '', $strFileToExport));
             $strFileName = $arrFileParts[count($arrFileParts) - 1];
             unset($arrFileParts[count($arrFileParts) - 1]);
             unset($arrFileParts[0]);
             $strPath = '';
             $intParentId = null;
             $arrDirectories = array();
             foreach ($arrFileParts as $intPos => $strDir) {
                 $strPath = $strPath . '/' . $strDir;
                 if (!isset($arrDirectories[$strPath])) {
                     if (!is_null($intParentId)) {
                         $objFile = NarroFile::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::NarroFile()->ProjectId, $this->objProject->ProjectId), QQ::Equal(QQN::NarroFile()->FileName, $strDir), QQ::Equal(QQN::NarroFile()->TypeId, NarroFileType::Folder), QQ::Equal(QQN::NarroFile()->ParentId, $intParentId)));
                     } else {
                         $objFile = NarroFile::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::NarroFile()->ProjectId, $this->objProject->ProjectId), QQ::Equal(QQN::NarroFile()->FileName, $strDir), QQ::Equal(QQN::NarroFile()->TypeId, NarroFileType::Folder), QQ::IsNull(QQN::NarroFile()->ParentId)));
                     }
                     if (!$objFile instanceof NarroFile) {
                         NarroLogger::LogWarn(sprintf('Could not find folder "%s" with parent id "%d" in the database.', $strDir, $intParentId));
                         continue;
                     }
                     $arrDirectories[$strPath] = $objFile->FileId;
                 }
                 $intParentId = $arrDirectories[$strPath];
             }
             $strTranslatedFileToExport = str_replace($this->strTemplatePath, $this->strTranslationPath, $strFileToExport);
             if (!file_exists(dirname($strTranslatedFileToExport))) {
                 if (!mkdir(dirname($strTranslatedFileToExport), 0777, true)) {
                     NarroLogger::LogWarn(sprintf('Failed to create the parent directories for the file %s', $strFileToExport));
                     return false;
                 }
                 NarroUtils::RecursiveChmod(dirname($strTranslatedFileToExport));
             }
             $objFile = NarroFile::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::NarroFile()->ProjectId, $this->objProject->ProjectId), QQ::Equal(QQN::NarroFile()->FileName, $strFileName), QQ::Equal(QQN::NarroFile()->ParentId, $intParentId), QQ::Equal(QQN::NarroFile()->Active, 1)));
             if (!$objFile instanceof NarroFile) {
                 continue;
             }
             // NarroLogger::LogDebug(sprintf('Exporting file "%s" using template "%s"', $objFile->FileName, $strTranslatedFileToExport));
             $intTime = time();
             $this->ExportFile($objFile, $strFileToExport, $strTranslatedFileToExport);
             $intElapsedTime = time() - $intTime;
             // NarroLogger::LogDebug(sprintf('Processed file "%s" in %d seconds, %d files left', str_replace($this->strTemplatePath, '', $strFileToExport), $intElapsedTime, (count($arrFiles) - $intFileNo - 1)));
             NarroImportStatistics::$arrStatistics['Exported files']++;
             NarroProgress::SetProgress((int) ceil($intFileNo * 100 / $intTotalFilesToProcess), $this->objProject->ProjectId, 'export');
         }
     }
     return true;
 }
Example #19
0
// Disable strict no-cache for IE due to IE issues with downloading no-cache items
if (QApplication::IsBrowser(QBrowserType::InternetExplorer)) {
    header("Pragma:");
    header("Expires:");
}
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename=growthgroupreport.csv');
function EscapeCsv($strString)
{
    return '"' . str_replace('"', '""', $strString) . '"';
}
print "Growth Group,First Name,Last Name,E-mail,Phone,Address,City,State,Zip Code\r\n";
foreach ($groupArray as $objGroup) {
    // If it's a growth group then display the details
    if ($objGroup->Type != GroupType::$NameArray[GroupType::GroupCategory]) {
        $objPersonCursor = Person::QueryCursor(QQ::AndCondition(QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $objGroup->Id), QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd)), QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName), QQ::Distinct()));
        $intGroupCount++;
        while ($objPerson = Person::InstantiateCursor($objPersonCursor)) {
            print EscapeCsv($objGroup->Name);
            print ",";
            print EscapeCsv($objPerson->FirstName);
            print ",";
            print EscapeCsv($objPerson->LastName);
            print ",";
            if ($objPerson->PrimaryEmail) {
                print EscapeCsv($objPerson->PrimaryEmail->Address);
            }
            print ",";
            print EscapeCsv($objPerson->PrimaryPhoneText);
            print ",";
            print EscapeCsv($objPerson->PrimaryAddressText);
Example #20
0
File: index.php Project: alcf/chms
 public function dtgParentPagerIndividual_Bind()
 {
     $objCondition = QQ::All();
     if (strlen($strText = trim($this->txtServerIdentifier->Text))) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::ParentPagerIndividual()->ServerIdentifier, $strText));
     }
     if (strlen($strText = trim($this->txtFirstName->Text))) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::ParentPagerIndividual()->FirstName, $strText . '%'));
     }
     if (strlen($strText = trim($this->txtLastName->Text))) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::ParentPagerIndividual()->LastName, $strText . '%'));
     }
     if ($intId = $this->lstParentPagerSyncStatusTypeId->SelectedValue) {
         if ($intId == -1) {
             $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::ParentPagerIndividual()->HiddenFlag, true));
         } else {
             $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::ParentPagerIndividual()->ParentPagerSyncStatusTypeId, $intId), QQ::OrCondition(QQ::Equal(QQN::ParentPagerIndividual()->HiddenFlag, false), QQ::IsNull(QQN::ParentPagerIndividual()->HiddenFlag)));
         }
     }
     if ($strValue = $this->lstGender->SelectedValue) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::ParentPagerIndividual()->Gender, $strValue));
     }
     if (strlen($strText = trim($this->txtGraduationYear->Text))) {
         $objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::ParentPagerIndividual()->GraduationYear, $strText));
     }
     $this->dtgParentPagerIndividuals->MetaDataBinder($objCondition);
 }
 public function dtgMembers_Bind()
 {
     if ($this->chkViewAll->Checked) {
         $objCondition = QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $this->objGroup->Id);
     } else {
         $objCondition = QQ::AndCondition(QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $this->objGroup->Id), 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);
 }
Example #22
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;
     }
 }
 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;
     }
 }
Example #24
0
 public function btnAddAsset_Click($strFormId, $strControlId, $strParameter)
 {
     if ($this->rblAssetType->SelectedValue == 'new') {
         $blnError = false;
         // Do not allow creation of an asset if asset limit will be exceeded
         $intAssetLimit = is_numeric(QApplication::$TracmorSettings->AssetLimit) ? QApplication::$TracmorSettings->AssetLimit : false;
         if ($intAssetLimit && Asset::CountActive() >= $intAssetLimit) {
             $blnError = true;
             $this->txtNewAssetCode->Warning = "Your asset limit has been reached.";
         }
         // Assign an empty string to the asset code for now (NULL won't work to render properly in the datagrid
         if ($this->chkAutoGenerateAssetCode->Checked == true) {
             $strAssetCode = '';
         } else {
             $strAssetCode = $this->txtNewAssetCode->Text;
             if (!$strAssetCode) {
                 $blnError = true;
                 $this->txtNewAssetCode->Warning = 'You must enter an asset tag.';
             }
         }
         // Generate an error if that asset code already exists
         if ($objDuplicate = Asset::LoadByAssetCode($strAssetCode)) {
             $blnError = true;
             $this->txtNewAssetCode->Warning = 'That asset tag already exists. Choose another.';
         } elseif (!$this->lstAssetModel->SelectedValue) {
             $blnError = true;
             $this->txtNewAssetCode->Warning = 'You must select one model.';
         }
         if (!$blnError) {
             $objNewAsset = new Asset();
             $objNewAsset->AssetModelId = $this->lstAssetModel->SelectedValue;
             $objNewAsset->LocationId = 5;
             // To Be Received
             $objNewAsset->AssetCode = $strAssetCode;
             // Set the AssetId to 0. This is so that it can be assigned to an AssetTransaction object without being saved to the db
             // We don't want to save this until btnSave_Click, because we don't want to create new assets that could get orphaned
             $objNewAsset->AssetId = 0;
             // This can be combined with the code below it
             $this->txtNewAssetCode->Text = null;
             $this->txtNewAssetCode->Enabled = true;
             $this->chkAutoGenerateAssetCode->Checked = false;
             $this->lstAssetModel->SelectedValue = null;
             $objNewAssetTransaction = new AssetTransaction();
             // The source location can either be 'Shipped'(2) or 'To Be Received'(5)
             $objNewAssetTransaction->SourceLocationId = $objNewAsset->LocationId;
             // $objNewAssetTransaction->AssetId = $objNewAsset->AssetId;
             $objNewAssetTransaction->Asset = $objNewAsset;
             $this->objAssetTransactionArray[] = $objNewAssetTransaction;
             // Set this boolean to true so that the datagrid updates
             $this->blnModifyAssets = true;
         }
     } elseif ($this->rblAssetType->SelectedValue == 'existing') {
         $strAssetCode = $this->txtNewAssetCode->Text;
         $blnDuplicate = false;
         $blnError = false;
         if ($strAssetCode) {
             // Begin error checking
             if ($this->objAssetTransactionArray) {
                 foreach ($this->objAssetTransactionArray as $objAssetTransaction) {
                     if ($objAssetTransaction && $objAssetTransaction->Asset->AssetCode == $strAssetCode) {
                         $blnError = true;
                         $this->txtNewAssetCode->Warning = "That asset has already been added.";
                     }
                 }
             }
             if (!$blnError) {
                 $objNewAsset = Asset::LoadByAssetCode($this->txtNewAssetCode->Text);
                 if (!$objNewAsset instanceof Asset) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "That asset tag does not exist.";
                 } elseif ($objNewAsset->LinkedFlag) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "That asset is locked to a parent asset.";
                 } elseif ($objNewAsset->ArchivedFlag) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "That asset is archived.";
                 } elseif ($objNewAsset->CheckedOutFlag) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "That asset is checked out.";
                 } elseif ($objNewAsset->ReservedFlag) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "That asset is reserved.";
                 } elseif (!($objNewAsset->LocationId == 5 || $objNewAsset->LocationId == 2)) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "That asset has already been received.";
                 } elseif (!QApplication::AuthorizeEntityBoolean($objNewAsset, 2)) {
                     $blnError = true;
                     $this->txtNewAssetCode->Warning = "You do not have authorization to perform a transaction on this asset.";
                 } elseif ($objLinkedAssetArray = Asset::LoadChildLinkedArrayByParentAssetId($objNewAsset->AssetId)) {
                     $strAssetCodeArray = array();
                     $objCheckedLinkedAssetArray = array();
                     foreach ($objLinkedAssetArray as $objLinkedAsset) {
                         if (!QApplication::AuthorizeEntityBoolean($objLinkedAsset, 2)) {
                             $blnError = true;
                             $this->txtNewAssetCode->Warning = sprintf("You do not have authorization to perform a transaction on locked asset %s.", $objLinkedAsset->AssetCode);
                             break;
                         } else {
                             $objCheckedLinkedAssetArray[] = $objLinkedAsset;
                             $strAssetCodeArray[] = $objLinkedAsset->AssetCode;
                         }
                         if (!$blnError) {
                             $this->txtNewAssetCode->Warning = sprintf("The following asset(s) have been added to the transaction because they are locked to asset (%s):<br />%s", $objNewAsset->AssetCode, implode('<br />', $strAssetCodeArray));
                         }
                     }
                     if (!$blnError) {
                         foreach ($objCheckedLinkedAssetArray as $objCheckedLinkedAsset) {
                             $objNewAssetTransaction = new AssetTransaction();
                             // We can assign the AssetId for existing assets because they have already been saved to the db
                             $objNewAssetTransaction->AssetId = $objCheckedLinkedAsset->AssetId;
                             // The source location can either be 'Shipped'(2) or 'To Be Received'(5)
                             $objNewAssetTransaction->SourceLocationId = $objCheckedLinkedAsset->LocationId;
                             $this->objAssetTransactionArray[] = $objNewAssetTransaction;
                         }
                     }
                 }
                 if (!$blnError) {
                     // Check that the asset isn't already in another pending receipt
                     $arrPendingReceipts = AssetTransaction::QueryArray(QQ::AndCondition(QQ::Equal(QQN::AssetTransaction()->AssetId, $objNewAsset->AssetId), QQ::In(QQN::AssetTransaction()->SourceLocationId, array(5, 2)), QQ::IsNull(QQN::AssetTransaction()->DestinationLocationId), QQ::NotEqual(QQN::AssetTransaction()->TransactionId, $this->objReceipt->TransactionId)));
                     if (!$blnError && count($arrPendingReceipts) != 0) {
                         $blnError = true;
                         $this->txtNewAssetCode->Warning = 'That asset is already pending receipt.';
                     } elseif (!$blnError && ($objPendingShipment = AssetTransaction::PendingShipment($objNewAsset->AssetId))) {
                         $blnError = true;
                         $this->txtNewAssetCode->Warning = 'That asset is in a pending shipment.';
                     }
                 }
                 // Create a new, but incomplete AssetTransaction
                 if (!$blnError) {
                     $this->txtNewAssetCode->Text = null;
                     $this->txtNewAssetCode->Enabled = true;
                     $this->chkAutoGenerateAssetCode->Checked = false;
                     $this->lstAssetModel->SelectedValue = null;
                     $objNewAssetTransaction = new AssetTransaction();
                     // We can assign the AssetId for existing assets because they have already been saved to the db
                     $objNewAssetTransaction->AssetId = $objNewAsset->AssetId;
                     // The source location can either be 'Shipped'(2) or 'To Be Received'(5)
                     $objNewAssetTransaction->SourceLocationId = $objNewAsset->LocationId;
                     $this->objAssetTransactionArray[] = $objNewAssetTransaction;
                     // Set this boolean to true so that the datagrid updates
                     $this->blnModifyAssets = true;
                 }
             }
         }
     }
     $this->dtgAssetTransact->Refresh();
     $this->txtNewAssetCode->Focus();
 }
<?php

/**
 * Ongoing service to ensure that any groups that are "flagged" for refresh get recalculated
 */
// Up the Memory Limit
ini_set('memory_limit', '1024M');
// Ensure we are NOT running
QApplication::CliProcessEnsureUnique();
// Setup a Lock File
QApplication::CliProcessSetupLockFile();
// Run the Logic/Code
while (QApplication::CliProcessIsLockFileValid()) {
    foreach (SmartGroup::QueryArray(QQ::IsNull(QQN::SmartGroup()->DateRefreshed)) as $objSmartGroup) {
        $objSmartGroup->RefreshParticipationList();
    }
    foreach (GroupCategory::QueryArray(QQ::IsNull(QQN::GroupCategory()->DateRefreshed)) as $objGroupCategory) {
        $objGroupCategory->RefreshParticipationList();
    }
    sleep(10);
}