本文整理汇总了PHP中QQ::NotEqual方法的典型用法代码示例。如果您正苦于以下问题:PHP QQ::NotEqual方法的具体用法?PHP QQ::NotEqual怎么用?PHP QQ::NotEqual使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQ
的用法示例。
在下文中一共展示了QQ::NotEqual方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testOrderByCondition
public function testOrderByCondition()
{
$objItems = Person::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQ::NotEqual(QQN::Person()->LastName, 'Smith'), QQN::Person()->FirstName)));
$this->assertEqual($objItems[0]->FirstName . " " . $objItems[0]->LastName, "Alex Smith");
$this->assertEqual($objItems[1]->FirstName . " " . $objItems[1]->LastName, "Jennifer Smith");
$this->assertEqual($objItems[2]->FirstName . " " . $objItems[2]->LastName, "Wendy Smith");
$this->assertEqual($objItems[3]->FirstName . " " . $objItems[3]->LastName, "Ben Robinson");
}
示例2: GenerateStewardship
public static function GenerateStewardship()
{
$dttDate = new QDateTime('2004-01-05');
print 'Generating Stewardship... ';
$objFundArray = StewardshipFund::QueryArray(QQ::NotEqual(QQN::StewardshipFund()->Id, 1));
while ($dttDate->IsEarlierThan(QDateTime::Now())) {
print $strDate = '[' . $dttDate->ToString('YYYY-MMM-DD') . ']';
$intCheckCount = rand(10, 55);
$arrStack = array();
for ($i = 0; $i < floor(($intCheckCount - 1) / 25) + 1; $i++) {
$arrStack[] = null;
}
$objBatch = StewardshipBatch::Create(self::GenerateFromArray(self::$StewardshipUserArray), $arrStack, self::GenerateFromArray(array('Weekend T/O', 'Weekend Giving', 'Tithes and Offerings', 'Tithes & Offerings', null)), $dttDate, $dttDate);
$intStackCount = $objBatch->CountStewardshipStacks();
$dttStart = new QDateTime($dttDate);
$dttStart->SetTime(8, 0, 0);
$dttEnd = new QDateTime($dttDate);
$dttEnd->SetTime(16, 0, 0);
for ($i = 0; $i < $intStackCount; $i++) {
if ($i == $intStackCount - 1) {
if ($intCheckCount % 25 == 0) {
$intChecksInStackCount = 25;
} else {
$intChecksInStackCount = $intCheckCount % 25;
}
} else {
$intChecksInStackCount = 25;
}
$objStack = StewardshipStack::LoadByStewardshipBatchIdStackNumber($objBatch->Id, $i + 1);
for ($j = 0; $j < $intChecksInStackCount; $j++) {
$objHousehold = self::GenerateFromArray(self::$HouseholdArray);
$objHouseholdParticipant = self::GenerateFromArray($objHousehold->GetHouseholdParticipationArray());
$mixAmountArray = array();
if (rand(0, 50)) {
$mixAmountArray[] = array(1, rand(1000, 150000) / 100);
} else {
$mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100);
}
if (!rand(0, 20)) {
$mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100);
}
$objContribution = StewardshipContribution::Create($objBatch->CreatedByLogin, $objHouseholdParticipant->Person, $objStack, StewardshipContributionType::Check, rand(1000, 9999), $mixAmountArray, self::GenerateDateTime($dttStart, $dttEnd), null, null, null, false);
if (rand(0, 5)) {
$objContribution->SaveImageFile(__DEVTOOLS_CLI__ . '/datagen_file_assets/check.tif');
}
}
$objStack->RefreshActualTotalAmount();
}
if ($intCheckCount != $objBatch->CountStewardshipContributions()) {
print "\r\n" . 'MISCOUNT: ' . $objBatch->Id . "\r\n";
}
$objBatch->RefreshActualTotalAmount();
$dttDate->Day += 7;
print str_repeat(chr(8) . ' ' . chr(8), strlen($strDate));
}
print "Done.\r\n";
}
示例3: dtgComments_Bind
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);
}
示例4: btnSave_Click
protected function btnSave_Click($strFormId, $strControlId, $strParameter)
{
try {
$arrRestrictedFields = array('asset code', 'asset tag', 'model', 'category', 'manufacturer', 'location', 'assets', 'name', 'asset model code', 'model number', 'inventory code', 'quantity', 'company name', 'city', 'state/province', 'country', 'title', 'company', 'email', 'address', 'shipment number', 'ship date', 'ship to company', 'ship to contact', 'ship to address', 'scheduled by', 'status', 'tracking', 'receipt number', 'receive from company', 'receive from contact', 'description', 'account', 'courier', 'account number', 'field name', 'type', 'enabled', 'required', 'role', 'username', 'user role', 'active', 'admin');
$blnError = false;
/*if ($this->chkRequiredFlag->Checked) {
if ($this->lstCustomFieldQtype->SelectedValue != 2 && $this->txtDefaultValue->Text == '') {
$blnError = true;
$this->btnCancel->Warning = 'A custom field must have a default value if it is required.';
}
}*/
if (count($this->chkEntityQtype->SelectedItems) == 0) {
$blnError = true;
$this->btnCancel->Warning = 'You must select at least one field in the Apply To list box.';
}
if (in_array(strtolower($this->txtShortDescription->Text), $arrRestrictedFields, false)) {
$blnError = true;
$this->btnCancel->Warning = sprintf("'%s' is a Tracmor restricted word. Please choose another name for this custom field", $this->txtShortDescription->Text);
}
if (in_array('1', $this->chkEntityQtype->SelectedValues) && $this->rblAllAssetModels->SelectedValue == 2 && count($this->arrAssetModels) == 0) {
$blnError = true;
$this->btnCancel->Warning = 'You must apply at least one Model.';
}
if ($this->blnEditMode) {
$objCustomFieldDuplicate = CustomField::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::CustomField()->ShortDescription, $this->txtShortDescription->Text), QQ::NotEqual(QQN::CustomField()->CustomFieldId, $this->objCustomField->CustomFieldId)));
} else {
$objCustomFieldDuplicate = CustomField::QuerySingle(QQ::Equal(QQN::CustomField()->ShortDescription, $this->txtShortDescription->Text));
}
if ($objCustomFieldDuplicate) {
$blnError = true;
$this->btnCancel->Warning = 'A custom field already exists with that name. Please choose another.';
}
if (!$blnError) {
$this->UpdateCustomFieldFields();
$this->objCustomField->Save();
// If this field is a required field
if ($this->objCustomField->RequiredFlag) {
$blnDefaultIsNone = false;
// If this custom field is a text or textarea,
if ($this->lstCustomFieldQtype->SelectedValue != 2) {
if ($this->txtDefaultValue->Text != null) {
// Assign the existing DefaultCustomFieldValue
if ($this->blnEditMode && $this->objCustomField->DefaultCustomFieldValueId) {
$objCustomFieldValue = CustomFieldValue::Load($this->objCustomField->DefaultCustomFieldValueId);
} else {
$objCustomFieldValue = new CustomFieldValue();
$objCustomFieldValue->CustomFieldId = $this->objCustomField->CustomFieldId;
}
// Save the new CustomFieldValue
$objCustomFieldValue->ShortDescription = $this->txtDefaultValue->Text;
$objCustomFieldValue->Save();
// Set the DefaultCustomFieldValueId of the custom field
$this->objCustomField->DefaultCustomFieldValueId = $objCustomFieldValue->CustomFieldValueId;
} else {
$this->objCustomField->DefaultCustomFieldValueId = null;
$blnDefaultIsNone = true;
}
} elseif ($this->lstCustomFieldQtype->SelectedValue == 2) {
$this->objCustomField->DefaultCustomFieldValueId = $this->lstDefaultValue->SelectedValue;
if ($this->lstDefaultValue->SelectedValue == null) {
$blnDefaultIsNone = true;
}
}
// Save the custom field
$this->objCustomField->Save();
// Update the EntityQtypeCustomFields if they have changed (or if it is a new custom field
$this->UpdateEntityQtypeCustomFields();
// Update all of the CustomFieldSelections and values for the EntityQtypes
if (!$blnDefaultIsNone) {
$this->objCustomField->UpdateRequiredFieldSelections();
// impove logic for asset customfields
if ($this->blnAssetEntityType && $this->rblAllAssetModels->SelectedValue == 2) {
// define assets to set default value
$chosenAssetModels = array();
foreach ($this->arrAssetModels as $chosenAssetModel) {
$assetsToFill = Asset::LoadArrayByAssetModelId($chosenAssetModel->AssetModelId);
if (count($assetsToFill > 0)) {
foreach ($assetsToFill as $assetToFill) {
array_push($chosenAssetModels, $assetToFill->AssetId);
}
}
}
$chosenAssetModels = implode(",", $chosenAssetModels);
if ($chosenAssetModels) {
$objDatabase = CustomField::GetDatabase();
$strQuery = sprintf("UPDATE `asset_custom_field_helper` SET `cfv_%s`= NULL WHERE `asset_id` NOT IN({$chosenAssetModels});", $this->objCustomField->CustomFieldId);
$objDatabase->NonQuery($strQuery);
}
}
}
} else {
$this->objCustomField->DefaultCustomFieldValueId = null;
$this->objCustomField->Save();
$this->UpdateEntityQtypeCustomFields();
}
// If it is a new select Custom Field, then stay to add options
if (!$this->blnEditMode && $this->objCustomField->CustomFieldQtypeId == 2) {
QApplication::Redirect('custom_field_edit.php?intCustomFieldId=' . $this->objCustomField->CustomFieldId);
} else {
QApplication::Redirect('custom_field_list.php');
//.........这里部分代码省略.........
示例5: dtgInventoryTransaction_Bind
protected function dtgInventoryTransaction_Bind()
{
$this->ctlInventoryEdit->dtgInventoryTransaction->TotalItemCount = InventoryTransaction::CountShipmentReceiptByInventoryModelId($this->ctlInventoryEdit->objInventoryModel->InventoryModelId, false);
if ($this->ctlInventoryEdit->dtgInventoryTransaction->TotalItemCount === 0) {
$this->ctlInventoryEdit->dtgInventoryTransaction->ShowHeader = false;
} else {
$this->ctlInventoryEdit->dtgInventoryTransaction->ShowHeader = true;
}
$objClauses = array();
if ($objClause = $this->ctlInventoryEdit->dtgInventoryTransaction->OrderByClause) {
array_push($objClauses, $objClause);
}
if ($objClause = $this->ctlInventoryEdit->dtgInventoryTransaction->LimitClause) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::InventoryTransaction()->Transaction->TransactionType)) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::InventoryTransaction()->SourceLocation)) {
array_push($objClauses, $objClause);
}
if ($objClause = QQ::Expand(QQN::InventoryTransaction()->DestinationLocation)) {
array_push($objClauses, $objClause);
}
$objCondition = QQ::AndCondition(QQ::Equal(QQN::InventoryTransaction()->InventoryLocation->InventoryModelId, $this->ctlInventoryEdit->objInventoryModel->InventoryModelId), QQ::NotEqual(QQN::InventoryTransaction()->Transaction->TransactionTypeId, 6), QQ::NotEqual(QQN::InventoryTransaction()->Transaction->TransactionTypeId, 7));
$this->ctlInventoryEdit->dtgInventoryTransaction->DataSource = InventoryTransaction::QueryArray($objCondition, $objClauses);
}
示例6: array
//////////////////////
$objForumArray = Forum::LoadAll();
$objForumTopicArray = array();
while (QDataGen::DisplayWhileTask('Generating Forum Topics', GENERATE_FORUM_TOPICS)) {
$objForum = QDataGen::GenerateFromArray($objForumArray);
$strName = QDataGen::GenerateTitle(4, 12);
$strFirstMessageText = QDataGen::GenerateContent(rand(1, 5));
$objPerson = Person::Load(rand(1, $intMaxPersonId));
$dttDateTime = QDataGen::GenerateDateTime($dttStartDate, QDateTime::Now());
$objTopic = $objForum->PostTopic($strName, $strFirstMessageText, $objPerson, $dttDateTime);
$objForumTopicArray[] = $objTopic;
}
//////////////////////
// Qcodo Package Manager
//////////////////////
$objPackageCategories = PackageCategory::QueryArray(QQ::NotEqual(QQN::PackageCategory()->Token, 'issues'));
while (QDataGen::DisplayWhileTask('Generating QPM Packages...', GENERATE_QPM)) {
$objPackage = new Package();
$objPackage->PackageCategory = QDataGen::GenerateFromArray($objPackageCategories);
$objPackage->Name = QDataGen::GenerateTitle(1, 3);
$objPackage->Token = Package::SanitizeForToken($objPackage->Name);
while (Package::LoadByToken($objPackage->Token)) {
$objPackage->Name = QDataGen::GenerateTitle(1, 3);
$objPackage->Token = Package::SanitizeForToken($objPackage->Name);
}
$objPackage->Description = QDataGen::GenerateContent(rand(1, 3), 20, 80);
$objPackage->Save();
$objPackage->CreateTopicAndTopicLink(Person::Load(rand(1, $intMaxPersonId)));
$intContributionCount = rand(1, 10);
for ($intContribution = 0; $intContribution < $intContributionCount; $intContribution++) {
while (PackageContribution::LoadByPackageIdPersonId($objPackage->Id, $objPerson->Id)) {
示例7: btnSave_Click
protected function btnSave_Click($strFormId, $strControlId, $strParameter)
{
try {
$arrRestrictedFields = array('asset code', 'model', 'category', 'manufacturer', 'location', 'assets', 'name', 'asset model code', 'inventory code', 'quantity', 'company name', 'city', 'state/province', 'country', 'title', 'company', 'email', 'address', 'shipment number', 'ship date', 'ship to company', 'ship to contact', 'ship to address', 'scheduled by', 'status', 'tracking', 'receipt number', 'receive from company', 'receive from contact', 'description', 'account', 'courier', 'account number', 'field name', 'type', 'enabled', 'required', 'role', 'username', 'user role', 'active', 'admin');
$blnError = false;
if ($this->chkRequiredFlag->Checked) {
if ($this->lstCustomFieldQtype->SelectedValue != 2 && $this->txtDefaultValue->Text == '') {
$blnError = true;
$this->btnCancel->Warning = 'A custom field must have a default value if it is required.';
}
}
if (count($this->lstEntityQtype->SelectedItems) == 0) {
$blnError = true;
$this->btnCancel->Warning = 'You must select at least one field in the Apply To list box.';
}
if (in_array(strtolower($this->txtShortDescription->Text), $arrRestrictedFields, false)) {
$blnError = true;
$this->btnCancel->Warning = sprintf("'%s' is a Tracmor restricted word. Please choose another name for this custom field", $this->txtShortDescription->Text);
}
if ($this->blnEditMode) {
$objCustomFieldDuplicate = CustomField::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::CustomField()->ShortDescription, $this->txtShortDescription->Text), QQ::NotEqual(QQN::CustomField()->CustomFieldId, $this->objCustomField->CustomFieldId)));
} else {
$objCustomFieldDuplicate = CustomField::QuerySingle(QQ::Equal(QQN::CustomField()->ShortDescription, $this->txtShortDescription->Text));
}
if ($objCustomFieldDuplicate) {
$blnError = true;
$this->btnCancel->Warning = 'A custom field already exists with that name. Please choose another.';
}
if (!$blnError) {
$this->UpdateCustomFieldFields();
$this->objCustomField->Save();
// If this field is a required field
if ($this->objCustomField->RequiredFlag) {
// If this custom field is a text or textarea,
if ($this->lstCustomFieldQtype->SelectedValue != 2) {
// Assign the existing DefaultCustomFieldValue
if ($this->blnEditMode && $this->objCustomField->DefaultCustomFieldValueId) {
$objCustomFieldValue = CustomFieldValue::Load($this->objCustomField->DefaultCustomFieldValueId);
} else {
$objCustomFieldValue = new CustomFieldValue();
$objCustomFieldValue->CustomFieldId = $this->objCustomField->CustomFieldId;
}
// Save the new CustomFieldValue
$objCustomFieldValue->ShortDescription = $this->txtDefaultValue->Text;
$objCustomFieldValue->Save();
// Set the DefaultCustomFieldValueId of the custom field
$this->objCustomField->DefaultCustomFieldValueId = $objCustomFieldValue->CustomFieldValueId;
} elseif ($this->lstCustomFieldQtype->SelectedValue == 2) {
$this->objCustomField->DefaultCustomFieldValueId = $this->lstDefaultValue->SelectedValue;
}
// Save the custom field
$this->objCustomField->Save();
// Update the EntityQtypeCustomFields if they have changed (or if it is a new custom field
$this->UpdateEntityQtypeCustomFields();
// Update all of the CustomFieldSelections and values for the EntityQtypes
$this->objCustomField->UpdateRequiredFieldSelections();
} else {
$this->objCustomField->DefaultCustomFieldValueId = null;
$this->objCustomField->Save();
$this->UpdateEntityQtypeCustomFields();
}
// If it is a new select Custom Field, then stay to add options
if (!$this->blnEditMode && $this->objCustomField->CustomFieldQtypeId == 2) {
QApplication::Redirect('custom_field_edit.php?intCustomFieldId=' . $this->objCustomField->CustomFieldId);
} else {
QApplication::Redirect('custom_field_list.php');
}
}
} catch (QExtendedOptimisticLockingException $objExc) {
$this->btnCancel->Warning = sprintf('This custom field has been updated by another user. You must <a href="custom_field_edit.php?intCustomFieldId=%s">Refresh</a> to edit this custom field.', $this->objCustomField->CustomFieldId);
}
}
示例8: btnSave_Click
protected function btnSave_Click($strFormId, $strControlId, $strParameter)
{
$blnError = false;
// Do not allow empty/whitespace for role name
if (!trim($this->txtShortDescription->Text)) {
$blnError = true;
$this->txtShortDescription->Warning = QApplication::Translate('You must enter a Role Name.');
}
// Role Duplicate checks
if ($this->blnEditMode) {
$objRoleDuplicate = Role::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::Role()->ShortDescription, trim($this->txtShortDescription->Text)), QQ::NotEqual(QQN::Role()->RoleId, $this->objRole->RoleId)));
} else {
$objRoleDuplicate = Role::QuerySingle(QQ::Equal(QQN::Role()->ShortDescription, trim($this->txtShortDescription->Text)));
}
if ($objRoleDuplicate) {
$blnError = true;
$this->txtShortDescription->Warning = QApplication::Translate('That Role Name is already in use.');
}
if (!$blnError) {
try {
// Get an instance of the database
$objDatabase = QApplication::$Database[1];
// Begin a MySQL Transaction to be either committed or rolled back
$objDatabase->TransactionBegin();
// Update the role fields
$this->UpdateRoleFields();
// Save the role
$this->objRole->Save();
// Update the authorizations for this role
// This must be done after saving the Role. If it is new, we need a RoleId first.
$this->UpdateAuthorizations();
// Update the Role Field Authorization for this role
$this->UpdateFieldLevelAuthorizations();
// Update the Role Transaction Level Authorization for this role
$this->UpdateTransactionLevelAuthorizations();
// Commit the transaction to the database
$objDatabase->TransactionCommit();
QApplication::Redirect('role_list.php');
} catch (QExtendedOptimisticLockingException $objExc) {
// Roll back the transaction from the database
$objDatabase->TransactionRollback();
$this->btnCancel->Warning = sprintf('This role has been updated by another user. You must <a href="role_edit.php?intRoleId=%s">Refresh</a> to edit this role.', $this->objRole->RoleId);
}
}
}
示例9: catch
} catch (Exception $objEx) {
if (strstr($objEx->getMessage(), 'Duplicate')) {
$arrDuplicateTexts = NarroText::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroText()->TextValue, $objText->TextValue), QQ::NotEqual(QQN::NarroText()->TextId, $objText->TextId)));
error_log(sprintf('Found duplicates for "%s": %d', $objText->TextValue, count($arrDuplicateTexts)));
foreach ($arrDuplicateTexts as $objDuplicateText) {
if ($objText->TextValue !== $objDuplicateText->TextValue) {
continue;
}
foreach (NarroTextComment::LoadArrayByTextId($objDuplicateText->TextId) as $objTextComment) {
error_log('Moving text comment');
$objTextComment->TextId = $objText->TextId;
$objTextComment->Save();
}
foreach (NarroSuggestion::LoadArrayByTextId($objDuplicateText->TextId) as $objSuggestion) {
error_log('Moving text from suggestion');
$arrDuplicateSuggestions = NarroSuggestion::QueryArray(QQ::AndCondition(QQ::NotEqual(QQN::NarroSuggestion()->SuggestionId, $objSuggestion->SuggestionId), QQ::Equal(QQN::NarroSuggestion()->SuggestionValue, $objSuggestion->SuggestionValue), QQ::Equal(QQN::NarroSuggestion()->TextId, $objText->TextId), QQ::Equal(QQN::NarroSuggestion()->LanguageId, $objSuggestion->LanguageId)));
if (count($arrDuplicateSuggestions)) {
error_log(sprintf('Found duplicates for "%s": %d', $objSuggestion->SuggestionValue, count($arrDuplicateSuggestions)));
foreach ($arrDuplicateSuggestions as $objDuplicateSuggestion) {
if ($objSuggestion->SuggestionValue !== $objDuplicateSuggestion->SuggestionValue) {
continue;
}
foreach (NarroSuggestionComment::LoadArrayBySuggestionId($objDuplicateSuggestion->SuggestionId) as $objSuggestionComment) {
error_log('Moving suggestion comment');
$objSuggestionComment->SuggestionId = $objSuggestion->SuggestionId;
$objSuggestionComment->Save();
}
foreach (NarroSuggestionVote::LoadArrayBySuggestionId($objDuplicateSuggestion->SuggestionId) as $objSuggestionVote) {
error_log('Moving suggestion vote');
$objSuggestionVote->SuggestionId = $objSuggestion->SuggestionId;
$objSuggestionVote->Save();
示例10: CountAllActive
public static function CountAllActive()
{
return parent::QueryCount(QQ::AndCondition(QQ::NotEqual(QQN::NarroLanguage()->LanguageCode, NarroLanguage::SOURCE_LANGUAGE_CODE), QQ::Equal(QQN::NarroLanguage()->Active, 1)));
}
示例11: foreach
</ul>
<h2>Select all People, Ordered by Last Name then First Name, Limited to the first 4 results</h2>
<p><em>Combining QQ::OrderBy and QQ::LimitInfo</em></p>
<ul>
<?php
$objPersonArray = Person::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName), QQ::LimitInfo(4)));
foreach ($objPersonArray as $objPerson) {
_p('<li>' . $objPerson->FirstName . ' ' . $objPerson->LastName . '</li>', false);
}
?>
</ul>
<h2>Select all People, those with last name Smith first, then ordered by First Name</h2>
<p><em>Using a QQ::Condition as an ORDER BY clause</em></p>
<ul>
<?php
$objPersonArray = Person::QueryArray(QQ::All(), QQ::Clause(QQ::OrderBy(QQ::NotEqual(QQN::Person()->LastName, 'Smith'), QQN::Person()->FirstName)));
foreach ($objPersonArray as $objPerson) {
_p('<li>' . $objPerson->FirstName . ' ' . $objPerson->LastName . '</li>', false);
}
?>
</ul>
<h2>Select all Projects and the Count of Team Members (if applicable)</h2>
<p><em>GROUP BY in action</em></p>
<ul>
<?php
$objProjectArray = Project::QueryArray(QQ::All(), QQ::Clause(QQ::GroupBy(QQN::Project()->Id), QQ::Count(QQN::Project()->PersonAsTeamMember->PersonId, 'team_member_count')));
foreach ($objProjectArray as $objProject) {
_p('<li>' . $objProject->Name . ' (' . $objProject->GetVirtualAttribute('team_member_count') . ' team members)' . '</li>', false);
}
?>
</ul>
示例12: btnSave_Click
protected function btnSave_Click($strFormId, $strControlId, $strParameter)
{
$blnError = false;
if ($this->txtPassword->Text != $this->txtPasswordConfirm->Text) {
$blnError = true;
$this->txtPassword->Warning = "The passwords do not match, please re-enter.";
$this->txtPassword->Text = "";
$this->txtPasswordConfirm->Text = "";
} else {
if (!($this->blnEditMode && $this->txtPassword->Text == '') && strlen($this->txtPassword->Text) < 8) {
$blnError = true;
$this->txtPassword->Warning = "Password must be at least 8 characters.";
}
}
// Check for a valid email address
if (!filter_var($this->txtEmailAddress->Text, FILTER_VALIDATE_EMAIL)) {
$blnError = true;
$this->txtEmailAddress->Warning = 'Please enter a valid email address';
}
// Do not allow duplicate email addresses
$objUserAccountDupe = UserAccount::LoadByEmailAddress($this->txtEmailAddress->Text);
if ($this->blnEditMode && $objUserAccountDupe && $objUserAccountDupe->UserAccountId != $this->objUserAccount->UserAccountId || !$this->blnEditMode && $objUserAccountDupe) {
$blnError = true;
$this->txtEmailAddress->Warning = 'A user account with that email address already exists.';
}
$intUserLimit = is_numeric(QApplication::$TracmorSettings->UserLimit) ? QApplication::$TracmorSettings->UserLimit : 99999;
// Do not allow creation of a new active user if user limit will be exceeded
if (!$this->blnEditMode && $this->chkActiveFlag->Checked) {
if (UserAccount::CountActive() >= $intUserLimit) {
$blnError = true;
$this->chkActiveFlag->Warning = "You have exceeded your user limit.";
}
}
// Do not allow activation of a disabled user if the user limit will be exceeded
if ($this->blnEditMode && $this->chkActiveFlag->Checked && !$this->objUserAccount->ActiveFlag) {
if (UserAccount::CountActive() >= $intUserLimit) {
$blnError = true;
$this->chkActiveFlag->Warning = "You have exceeded your user limit.";
}
}
// Do not allow duplicate usernames
if ($this->blnEditMode) {
$objUserAccountDuplicate = UserAccount::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::UserAccount()->Username, $this->txtUsername->Text), QQ::NotEqual(QQN::UserAccount()->UserAccountId, $this->objUserAccount->UserAccountId)));
} else {
$objUserAccountDuplicate = UserAccount::QuerySingle(QQ::Equal(QQN::UserAccount()->Username, $this->txtUsername->Text));
}
if ($objUserAccountDuplicate) {
$blnError = true;
$this->btnCancel->Warning = 'A user account already exists with that username. Please choose another.';
}
// Do not allow deactivation of owner account
$this->objOwnerAccount = UserAccount::LoadOwner();
if ($this->blnEditMode && $this->objOwnerAccount && $this->objOwnerAccount->UserAccountId == $this->objUserAccount->UserAccountId && !$this->chkActiveFlag->Checked) {
$blnError = true;
$this->btnCancel->Warning = 'This user cannot be deactivated because they are the account owner.';
}
if (!$blnError) {
try {
$this->UpdateUserAccountFields();
$this->objUserAccount->Save();
QApplication::Redirect('user_account_list.php');
} catch (QExtendedOptimisticLockingException $objExc) {
$this->btnCancel->Warning = sprintf('This user account has been updated by another user. You must <a href="user_account_edit.php?intUserAccountId=%s">Refresh</a> to edit this user account.', $this->objUserAccount->UserAccountId);
}
}
}
示例13: dtgPeople_Bind
public function dtgPeople_Bind()
{
$objConditions = QQ::NotEqual(QQN::Person()->Id, $this->objPerson->Id);
$objClauses = array();
if ($strName = trim($this->txtName->Text)) {
Person::PrepareQqForSearch($strName, $objConditions, $objClauses);
}
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 . '%'));
}
if ($strName = trim($this->txtCity->Text)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->PrimaryCityText, $strName . '%'));
}
if ($strName = trim($this->txtEmail->Text)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->PrimaryEmail->Address, $strName . '%'));
}
if ($strName = trim($this->txtPhone->Text)) {
$objClauses[] = QQ::Distinct();
$objConditions = QQ::AndCondition($objConditions, QQ::OrCondition(QQ::Like(QQN::Person()->Phone->Number, $strName . '%'), QQ::Like(QQN::Person()->HouseholdParticipation->Household->Address->Phone->Number, $strName . '%')));
}
if (!is_null($strValue = $this->lstGender->SelectedValue)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Person()->Gender, $strValue));
}
if (!is_null($strValue = $this->lstMemberStatus->SelectedValue)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Person()->MembershipStatusTypeId, $strValue));
}
$this->dtgPeople->MetaDataBinder($objConditions, $objClauses);
}
示例14: LoadAllButHome
/**
* This returns all Module objects except for the Home module
* It is intended to use for the role_edit page because the home module always grants full authorization
*
* @return Array Module Objects
*/
public static function LoadAllButHome()
{
$objModuleArray = Module::QueryArray(QQ::NotEqual(QQN::Module()->ModuleId, 1));
return $objModuleArray;
}
示例15: dtgIssues_Bind
public function dtgIssues_Bind()
{
$objCondition = QQ::All();
if (trim($this->txtSummary->Text)) {
$objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::Issue()->Title, '%' . trim($this->txtSummary->Text) . '%'));
}
if ($intValue = $this->lstCategory->SelectedValue) {
$objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::Issue()->IssueFieldValue->IssueFieldId, $this->objIssueFieldForCategory->Id), QQ::Equal(QQN::Issue()->IssueFieldValue->IssueFieldOptionId, $intValue));
}
if ($intValue = $this->lstStatus->SelectedValue) {
$objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::Issue()->IssueStatusTypeId, $intValue));
}
if ($intValue = $this->lstPriority->SelectedValue) {
$objCondition = QQ::AndCondition($objCondition, QQ::Equal(QQN::Issue()->IssuePriorityTypeId, $intValue));
}
if (trim($this->txtPostedBy->Text)) {
$objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::Issue()->PostedByPerson->DisplayName, trim($this->txtPostedBy->Text) . '%'));
}
if (trim($this->txtAssignedTo->Text)) {
$objCondition = QQ::AndCondition($objCondition, QQ::Like(QQN::Issue()->AssignedToPerson->DisplayName, trim($this->txtAssignedTo->Text) . '%'));
}
if (!$this->chkIncludeClosed->Checked) {
$objCondition = QQ::AndCondition($objCondition, QQ::NotEqual(QQN::Issue()->IssueStatusTypeId, IssueStatusType::Closed));
}
$this->dtgIssues->TotalItemCount = Issue::QueryCount($objCondition);
$objClauses = array();
if ($objClause = $this->dtgIssues->LimitClause) {
$objClauses[] = $objClause;
}
if ($objClause = $this->dtgIssues->OrderByClause) {
$objClauses[] = $objClause;
}
$this->dtgIssues->DataSource = Issue::QueryArray($objCondition, $objClauses);
}