當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserAccount::CountActive方法代碼示例

本文整理匯總了PHP中UserAccount::CountActive方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserAccount::CountActive方法的具體用法?PHP UserAccount::CountActive怎麽用?PHP UserAccount::CountActive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserAccount的用法示例。


在下文中一共展示了UserAccount::CountActive方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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);
         }
     }
 }
開發者ID:proxymoron,項目名稱:tracmor,代碼行數:66,代碼來源:user_account_edit.php

示例2: 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 = "";
     }
     $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.';
     }
     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);
         }
     }
 }
開發者ID:brustj,項目名稱:tracmor,代碼行數:44,代碼來源:user_account_edit.php


注:本文中的UserAccount::CountActive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。