protected function Form_Create()
 {
     // Setup DataGrid Columns
     $this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_FORM->dtgUserAccount_EditLinkColumn_Render($_ITEM) ?>');
     $this->colEditLinkColumn->HtmlEntities = false;
     $this->colUserAccountId = new QDataGridColumn(QApplication::Translate('User Account Id'), '<?= $_ITEM->UserAccountId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->UserAccountId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->UserAccountId, false)));
     $this->colFirstName = new QDataGridColumn(QApplication::Translate('First Name'), '<?= QString::Truncate($_ITEM->FirstName, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->FirstName, false)));
     $this->colLastName = new QDataGridColumn(QApplication::Translate('Last Name'), '<?= QString::Truncate($_ITEM->LastName, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->LastName, false)));
     $this->colUsername = new QDataGridColumn(QApplication::Translate('Username'), '<?= QString::Truncate($_ITEM->Username, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->Username), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->Username, false)));
     $this->colPasswordHash = new QDataGridColumn(QApplication::Translate('Password Hash'), '<?= QString::Truncate($_ITEM->PasswordHash, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->PasswordHash), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->PasswordHash, false)));
     $this->colEmailAddress = new QDataGridColumn(QApplication::Translate('Email Address'), '<?= QString::Truncate($_ITEM->EmailAddress, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->EmailAddress), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->EmailAddress, false)));
     $this->colActiveFlag = new QDataGridColumn(QApplication::Translate('Active Flag'), '<?= ($_ITEM->ActiveFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->ActiveFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->ActiveFlag, false)));
     $this->colAdminFlag = new QDataGridColumn(QApplication::Translate('Admin Flag'), '<?= ($_ITEM->AdminFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->AdminFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->AdminFlag, false)));
     $this->colPortableAccessFlag = new QDataGridColumn(QApplication::Translate('Portable Access Flag'), '<?= ($_ITEM->PortableAccessFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->PortableAccessFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->PortableAccessFlag, false)));
     $this->colPortableUserPin = new QDataGridColumn(QApplication::Translate('Portable User Pin'), '<?= $_ITEM->PortableUserPin; ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->PortableUserPin), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->PortableUserPin, false)));
     $this->colRoleId = new QDataGridColumn(QApplication::Translate('Role Id'), '<?= $_FORM->dtgUserAccount_Role_Render($_ITEM); ?>');
     $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_FORM->dtgUserAccount_CreatedByObject_Render($_ITEM); ?>');
     $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_FORM->dtgUserAccount_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->CreationDate, false)));
     $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_FORM->dtgUserAccount_ModifiedByObject_Render($_ITEM); ?>');
     $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->ModifiedDate, false)));
     // Setup DataGrid
     $this->dtgUserAccount = new QDataGrid($this);
     $this->dtgUserAccount->CellSpacing = 0;
     $this->dtgUserAccount->CellPadding = 4;
     $this->dtgUserAccount->BorderStyle = QBorderStyle::Solid;
     $this->dtgUserAccount->BorderWidth = 1;
     $this->dtgUserAccount->GridLines = QGridLines::Both;
     // Datagrid Paginator
     $this->dtgUserAccount->Paginator = new QPaginator($this->dtgUserAccount);
     $this->dtgUserAccount->ItemsPerPage = 10;
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgUserAccount->UseAjax = false;
     // Specify the local databind method this datagrid will use
     $this->dtgUserAccount->SetDataBinder('dtgUserAccount_Bind');
     $this->dtgUserAccount->AddColumn($this->colEditLinkColumn);
     $this->dtgUserAccount->AddColumn($this->colUserAccountId);
     $this->dtgUserAccount->AddColumn($this->colFirstName);
     $this->dtgUserAccount->AddColumn($this->colLastName);
     $this->dtgUserAccount->AddColumn($this->colUsername);
     $this->dtgUserAccount->AddColumn($this->colPasswordHash);
     $this->dtgUserAccount->AddColumn($this->colEmailAddress);
     $this->dtgUserAccount->AddColumn($this->colActiveFlag);
     $this->dtgUserAccount->AddColumn($this->colAdminFlag);
     $this->dtgUserAccount->AddColumn($this->colPortableAccessFlag);
     $this->dtgUserAccount->AddColumn($this->colPortableUserPin);
     $this->dtgUserAccount->AddColumn($this->colRoleId);
     $this->dtgUserAccount->AddColumn($this->colCreatedBy);
     $this->dtgUserAccount->AddColumn($this->colCreationDate);
     $this->dtgUserAccount->AddColumn($this->colModifiedBy);
     $this->dtgUserAccount->AddColumn($this->colModifiedDate);
 }
Пример #2
0
 protected function dtgUserAccount_Create()
 {
     $this->dtgUserAccount = new QDataGrid($this);
     $this->dtgUserAccount->CellPadding = 5;
     $this->dtgUserAccount->CellSpacing = 0;
     $this->dtgUserAccount->CssClass = "datagrid";
     $this->dtgUserAccount->SortColumnIndex = 0;
     // Enable AJAX - this won't work while using the DB profiler
     $this->dtgUserAccount->UseAjax = true;
     // Enable Pagination, and set to 20 items per page
     $objPaginator = new QPaginator($this->dtgUserAccount);
     $this->dtgUserAccount->Paginator = $objPaginator;
     $this->dtgUserAccount->ItemsPerPage = 20;
     $this->dtgUserAccount->AddColumn(new QDataGridColumn('Username', '<?= $_ITEM->__toStringWithLink("bluelink") ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->Username), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->Username, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false)));
     $this->dtgUserAccount->AddColumn(new QDataGridColumn('Name', '<?= $_ITEM->FirstName ?> <?= $_ITEM->LastName ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->LastName, false, QQN::UserAccount()->FirstName, false), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->LastName, QQN::UserAccount()->FirstName), 'CssClass' => "dtg_column")));
     $this->dtgUserAccount->AddColumn(new QDataGridColumn('User Role', '<?= $_ITEM->Role->__toString() ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->Role->ShortDescription), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->Role->ShortDescription, false), 'CssClass' => "dtg_column")));
     $this->dtgUserAccount->AddColumn(new QDataGridColumn('E-Mail', '<?= $_ITEM->EmailAddress ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->EmailAddress), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->EmailAddress, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false)));
     $this->dtgUserAccount->AddColumn(new QDataGridColumn('Active', '<?= $_ITEM->__toStringActiveFlag() ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->ActiveFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->ActiveFlag, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false)));
     $this->dtgUserAccount->AddColumn(new QDataGridColumn('Admin', '<?= $_ITEM->__toStringAdminFlag() ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->AdminFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->AdminFlag, false), 'CssClass' => "dtg_column", 'HtmlEntities' => false)));
     $this->dtgUserAccount->AddColumn(new QDataGridColumn('Created By', '<?= $_ITEM->CreatedByObject->__toStringFullName() ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->CreatedByObject->LastName, false, QQN::UserAccount()->CreatedByObject->FirstName, false), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->CreatedByObject->LastName, QQN::UserAccount()->CreatedByObject->FirstName), 'CssClass' => "dtg_column")));
     $this->dtgUserAccount->SortColumnIndex = 0;
     $this->dtgUserAccount->SortDirection = 0;
     $objStyle = $this->dtgUserAccount->RowStyle;
     $objStyle->ForeColor = '#000000';
     $objStyle->BackColor = '#FFFFFF';
     $objStyle->FontSize = 12;
     $objStyle = $this->dtgUserAccount->AlternateRowStyle;
     $objStyle->BackColor = '#EFEFEF';
     $objStyle = $this->dtgUserAccount->HeaderRowStyle;
     $objStyle->ForeColor = '#000000';
     $objStyle->BackColor = '#EFEFEF';
     $objStyle->CssClass = 'dtg_header';
 }
 protected function CheckOutTo_Create()
 {
     $this->lstCheckOutTo = new QRadioButtonList($this);
     $this->lstCheckOutTo->AddItem(new QListItem('User', 1, false, null, 'FontSize=12px'));
     $this->lstCheckOutTo->AddItem(new QListItem('Contact', 2, false, null, 'FontSize=12px'));
     $this->lstCheckOutTo->SelectedIndex = 0;
     $this->lstCheckOutTo->AddAction(new QChangeEvent(), new QAjaxAction('lstCheckOutTo_Select'));
     $this->lstUser = new QListBox($this);
     $this->lstUser->Name = 'User';
     $this->lstUser->AddItem('- Select One -', null);
     foreach (UserAccount::LoadAll(QQ::Clause(QQ::OrderBy(QQN::UserAccount()->Username))) as $objUser) {
         $this->lstUser->AddItem(sprintf("%s", $objUser->Username), $objUser->UserAccountId);
     }
     $this->lstCheckOutTo_Select();
 }
Пример #4
0
 public function LoadByUserAccountIdPortableUserPin($intUserAccountId, $strPortableUserPin)
 {
     return UserAccount::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::UserAccount()->UserAccountId, $intUserAccountId), QQ::Equal(QQN::UserAccount()->PortableUserPin, $strPortableUserPin)));
     /*$strQuery = "SELECT * FROM `user_account` where `user_account_id`='$intUserAccountId' AND `portable_user_pin`='$strPortableUserPin'";
     		    
     		    $objDatabase = QApplication::$Database[1];
     	
         	    // Perform the Query
         	    $objDbResult = $objDatabase->Query($strQuery);
         	    
         	    $mixArray = $objDbResult->FetchArray();
         	    if ($mixArray) {
         	    	return $mixArray;
     	        }
     		    return false;*/
 }
Пример #5
0
 protected function lstUserCheckedOutReserved_Create()
 {
     $this->lstUser = new QListBox($this);
     $this->lstUser->Name = 'User';
     $this->lstUser->AddItem('- Select One -', null);
     $this->lstCheckedOutBy = new QListBox($this);
     $this->lstCheckedOutBy->Name = 'Checked Out By';
     $this->lstCheckedOutBy->AddItem('- Select One -', null);
     //$this->lstCheckedOutBy->AddItem('- Any -', 'any');
     $this->lstReservedBy = new QListBox($this);
     $this->lstReservedBy->Name = 'Reserved By';
     $this->lstReservedBy->AddItem('- Select One -', null);
     //$this->lstReservedBy->AddItem('- Any -', 'any');
     foreach (UserAccount::LoadAll(QQ::Clause(QQ::OrderBy(QQN::UserAccount()->Username))) as $objUserAccount) {
         $this->lstUser->AddItem($objUserAccount->Username, $objUserAccount->UserAccountId);
         $this->lstCheckedOutBy->AddItem($objUserAccount->Username, $objUserAccount->UserAccountId);
         $this->lstReservedBy->AddItem($objUserAccount->Username, $objUserAccount->UserAccountId);
     }
 }
Пример #6
0
 protected function btnRecoverPassword_Click()
 {
     $blnError = false;
     $objUserAccount = null;
     if (!filter_var($this->txtEmail->Text, FILTER_VALIDATE_EMAIL)) {
         $blnError = true;
     } else {
         $objUserAccount = UserAccount::QuerySingle(QQ::AndCondition(QQ::Equal(QQN::UserAccount()->EmailAddress, $this->txtEmail->Text), QQ::Equal(QQN::UserAccount()->ActiveFlag, '1')));
         if (!$objUserAccount) {
             $blnError = true;
         }
     }
     if (!$blnError) {
         // Hide password reset controls and show instructions
         $this->txtEmail->Visible = false;
         $this->btnRecoverPassword->Display = false;
         $this->lblForgotPassword->Text = sprintf('A link to reset your password has been sent to:<br/><strong>%s</strong>', $this->txtEmail->Text);
         $this->lblForgotPassword->FontUnderline = false;
         $this->lblForgotPassword->Cursor = null;
         $this->lblForgotPassword->RemoveAllActions('onclick');
         $this->lblForgotPassword->Display = true;
         $this->lblForgotPassword->Blink();
         // Re-enable login controls
         $this->txtUsername->Enabled = $this->txtPassword->Enabled = $this->btnLogin->Enabled = true;
         $this->txtUsername->Focus();
         $objUserAccount->SendPasswordResetEmail();
     } else {
         $this->txtEmail->Warning = 'Unrecognized email address';
         $this->txtEmail->Blink();
         $this->txtEmail->Focus();
         $this->txtEmail->Select();
     }
 }
Пример #7
0
 protected function btnPrintLabels_Click()
 {
     //if ($this->blnPrintLabels) {
     $this->strBarCodeArray = array();
     $this->strTablesBufferArray = array();
     $this->intCurrentBarCodeLabel = 0;
     // Set start value for PDF generation progress bar
     $_SESSION["intGeneratingStatus"] = 0;
     set_time_limit(0);
     $blnError = false;
     // Array[0] - DataGrid Object name; array[1] - Id; array[2] - used for Bar Code Label Generation
     $arrDataGridObjectNameId = $this->ctlSearchMenu->GetDataGridObjectNameId();
     $this->intObjectIdArray = $this->ctlSearchMenu->{$arrDataGridObjectNameId}[0]->GetSelected($arrDataGridObjectNameId[1]);
     $objCheckedArray = array();
     if (count($this->intObjectIdArray)) {
         // Switch statement for all four entity types
         switch ($this->lstLabelTypeControl->SelectedValue) {
             case 1:
                 // Load an array of Assets by AssetId
                 $objCheckedArray = Asset::QueryArray(QQ::In(QQN::Asset()->AssetId, $this->intObjectIdArray));
                 break;
             case 2:
                 // Load an array of Inventories by InventoryModelId
                 $objCheckedArray = InventoryModel::QueryArray(QQ::In(QQN::InventoryModel()->InventoryModelId, $this->intObjectIdArray));
                 break;
             case 3:
                 // Load an array of Locations by LocationId
                 $objCheckedArray = Location::QueryArray(QQ::In(QQN::Location()->LocationId, $this->intObjectIdArray));
                 break;
             case 4:
                 $objCheckedArray = UserAccount::QueryArray(QQ::In(QQN::UserAccount()->UserAccountId, $this->intObjectIdArray));
                 break;
             default:
                 $this->btnPrintLabels->Warning = "Please select Label Type.<br/>";
                 $this->intObjectIdArray = array();
                 $blnError = true;
                 break;
         }
         $objArrayById = array();
         // Create array of objects where the key is Id
         foreach ($objCheckedArray as $objChecked) {
             $objArrayById[$objChecked->{$arrDataGridObjectNameId}[1]] = $objChecked;
         }
         // Fill the BarCodeArray in the order items sorted in the datagrid
         foreach ($this->intObjectIdArray as $intObjectId) {
             $this->strBarCodeArray[] = $objArrayById[$intObjectId]->{$arrDataGridObjectNameId}[2];
         }
     } else {
         $blnError = true;
     }
     if (!$blnError) {
         $this->btnPrintLabels->Warning = "";
         $this->lstLabelStock->SelectedValue = 0;
         $this->lstLabelOffset->RemoveAllItems();
         $this->lstLabelOffset->AddItem(new QListItem('None', 0, 1));
         $this->lstLabelStock->Enabled = true;
         $this->lstLabelOffset->Enabled = true;
         $this->dlgPrintLabels->ShowDialogBox();
     } else {
         // If we have no checked items
         $this->btnPrintLabels->Warning .= "You must check at least one item.";
     }
     // Enable Print Labels button
     $this->btnPrintLabels->Enabled = true;
     //$this->blnPrintLabels = false;
     /*}
     		else {
     		  $this->btnPrintLabels->Warning = "Please wait... loading.";
     		  $this->blnPrintLabels = true;
     		  QApplication::ExecuteJavaScript("document.getElementById('".$this->btnPrintLabels->ControlId."').click(); document.getElementById('warning_loading').innerHTML = '';");
     		}*/
     QApplication::ExecuteJavaScript("document.getElementById('warning_loading').innerHTML = '';");
 }
Пример #8
0
 public static function LoadByPasswordResetCode($strPasswordResetCode)
 {
     // Reset code must be 32 characters
     if (strlen($strPasswordResetCode) != 32) {
         return null;
     }
     // Load all users with unexpired reset codes
     $arrUserAccount = UserAccount::QueryArray(QQ::AndCondition(QQ::Equal(QQN::UserAccount()->ActiveFlag, 1), QQ::IsNotNull(QQN::UserAccount()->PasswordResetCode), QQ::GreaterThan(QQN::UserAccount()->PasswordResetExpiry, QDateTime::Now())));
     // Check submitted reset code against any valid codes
     foreach ($arrUserAccount as $objUserAccount) {
         if (QApplication::CheckPassword($strPasswordResetCode, $objUserAccount->PasswordResetCode)) {
             // Match found
             return $objUserAccount;
         }
     }
     return null;
 }
Пример #9
0
 public function dtgUserAccount_Bind()
 {
     $objClauses = array();
     if ($objClause = $this->dtgUserAccount->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     $objClause = QQ::Expand(QQN::UserAccount()->CreatedByObject);
     array_push($objClauses, $objClause);
     $objClause = QQ::Expand(QQN::UserAccount()->Role);
     array_push($objClauses, $objClause);
     $this->strUsername = $this->txtUsername->Text;
     if ($this->strUsername) {
         $this->dtgUserAccount->TotalItemCount = UserAccount::QueryCount(QQ::Like(QQN::UserAccount()->Username, '%' . $this->strUsername . '%'), $objClauses);
         if ($this->dtgUserAccount->TotalItemCount > 0) {
             $this->dtgUserAccount->ShowHeader = true;
             // Add the LimitClause information, as well
             if ($objClause = $this->dtgUserAccount->LimitClause) {
                 array_push($objClauses, $objClause);
             }
             $this->dtgUserAccount->DataSource = UserAccount::QueryArray(QQ::Like(QQN::UserAccount()->Username, '%' . $this->strUsername . '%'), $objClauses);
         } else {
             $this->dtgUserAccount->ShowHeader = false;
         }
     } else {
         // Get Total Count b/c of Pagination
         $this->dtgUserAccount->TotalItemCount = UserAccount::CountAll();
         if ($this->dtgUserAccount->TotalItemCount == 0) {
             $this->dtgUserAccount->ShowHeader = false;
         } else {
             if ($objClause = $this->dtgUserAccount->LimitClause) {
                 array_push($objClauses, $objClause);
             }
             $this->dtgUserAccount->DataSource = UserAccount::LoadAll($objClauses);
             $this->dtgUserAccount->ShowHeader = true;
         }
     }
 }
 public function __construct($objParentObject, $strSetEditPanelMethod, $strCloseEditPanelMethod, $strControlId = null)
 {
     // Call the Parent
     try {
         parent::__construct($objParentObject, $strControlId);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     // Record Method Callbacks
     $this->strSetEditPanelMethod = $strSetEditPanelMethod;
     $this->strCloseEditPanelMethod = $strCloseEditPanelMethod;
     // Setup DataGrid Columns
     $this->colEditLinkColumn = new QDataGridColumn(QApplication::Translate('Edit'), '<?= $_CONTROL->ParentControl->dtgUserAccount_EditLinkColumn_Render($_ITEM) ?>');
     $this->colEditLinkColumn->HtmlEntities = false;
     $this->colUserAccountId = new QDataGridColumn(QApplication::Translate('User Account Id'), '<?= $_ITEM->UserAccountId; ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->UserAccountId), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->UserAccountId, false)));
     $this->colFirstName = new QDataGridColumn(QApplication::Translate('First Name'), '<?= QString::Truncate($_ITEM->FirstName, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->FirstName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->FirstName, false)));
     $this->colLastName = new QDataGridColumn(QApplication::Translate('Last Name'), '<?= QString::Truncate($_ITEM->LastName, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->LastName), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->LastName, false)));
     $this->colUsername = new QDataGridColumn(QApplication::Translate('Username'), '<?= QString::Truncate($_ITEM->Username, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->Username), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->Username, false)));
     $this->colPasswordHash = new QDataGridColumn(QApplication::Translate('Password Hash'), '<?= QString::Truncate($_ITEM->PasswordHash, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->PasswordHash), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->PasswordHash, false)));
     $this->colEmailAddress = new QDataGridColumn(QApplication::Translate('Email Address'), '<?= QString::Truncate($_ITEM->EmailAddress, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->EmailAddress), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->EmailAddress, false)));
     $this->colActiveFlag = new QDataGridColumn(QApplication::Translate('Active Flag'), '<?= ($_ITEM->ActiveFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->ActiveFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->ActiveFlag, false)));
     $this->colAdminFlag = new QDataGridColumn(QApplication::Translate('Admin Flag'), '<?= ($_ITEM->AdminFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->AdminFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->AdminFlag, false)));
     $this->colPortableAccessFlag = new QDataGridColumn(QApplication::Translate('Portable Access Flag'), '<?= ($_ITEM->PortableAccessFlag) ? "true" : "false" ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->PortableAccessFlag), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->PortableAccessFlag, false)));
     $this->colPortableUserPin = new QDataGridColumn(QApplication::Translate('Portable User Pin'), '<?= $_ITEM->PortableUserPin; ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->PortableUserPin), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->PortableUserPin, false)));
     $this->colRoleId = new QDataGridColumn(QApplication::Translate('Role Id'), '<?= $_CONTROL->ParentControl->dtgUserAccount_Role_Render($_ITEM); ?>');
     $this->colCreatedBy = new QDataGridColumn(QApplication::Translate('Created By'), '<?= $_CONTROL->ParentControl->dtgUserAccount_CreatedByObject_Render($_ITEM); ?>');
     $this->colCreationDate = new QDataGridColumn(QApplication::Translate('Creation Date'), '<?= $_CONTROL->ParentControl->dtgUserAccount_CreationDate_Render($_ITEM); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->CreationDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->CreationDate, false)));
     $this->colModifiedBy = new QDataGridColumn(QApplication::Translate('Modified By'), '<?= $_CONTROL->ParentControl->dtgUserAccount_ModifiedByObject_Render($_ITEM); ?>');
     $this->colModifiedDate = new QDataGridColumn(QApplication::Translate('Modified Date'), '<?= QString::Truncate($_ITEM->ModifiedDate, 200); ?>', array('OrderByClause' => QQ::OrderBy(QQN::UserAccount()->ModifiedDate), 'ReverseOrderByClause' => QQ::OrderBy(QQN::UserAccount()->ModifiedDate, false)));
     // Setup DataGrid
     $this->dtgUserAccount = new QDataGrid($this);
     $this->dtgUserAccount->CellSpacing = 0;
     $this->dtgUserAccount->CellPadding = 4;
     $this->dtgUserAccount->BorderStyle = QBorderStyle::Solid;
     $this->dtgUserAccount->BorderWidth = 1;
     $this->dtgUserAccount->GridLines = QGridLines::Both;
     // Datagrid Paginator
     $this->dtgUserAccount->Paginator = new QPaginator($this->dtgUserAccount);
     $this->dtgUserAccount->ItemsPerPage = 10;
     // Specify Whether or Not to Refresh using Ajax
     $this->dtgUserAccount->UseAjax = true;
     // Specify the local databind method this datagrid will use
     $this->dtgUserAccount->SetDataBinder('dtgUserAccount_Bind', $this);
     $this->dtgUserAccount->AddColumn($this->colEditLinkColumn);
     $this->dtgUserAccount->AddColumn($this->colUserAccountId);
     $this->dtgUserAccount->AddColumn($this->colFirstName);
     $this->dtgUserAccount->AddColumn($this->colLastName);
     $this->dtgUserAccount->AddColumn($this->colUsername);
     $this->dtgUserAccount->AddColumn($this->colPasswordHash);
     $this->dtgUserAccount->AddColumn($this->colEmailAddress);
     $this->dtgUserAccount->AddColumn($this->colActiveFlag);
     $this->dtgUserAccount->AddColumn($this->colAdminFlag);
     $this->dtgUserAccount->AddColumn($this->colPortableAccessFlag);
     $this->dtgUserAccount->AddColumn($this->colPortableUserPin);
     $this->dtgUserAccount->AddColumn($this->colRoleId);
     $this->dtgUserAccount->AddColumn($this->colCreatedBy);
     $this->dtgUserAccount->AddColumn($this->colCreationDate);
     $this->dtgUserAccount->AddColumn($this->colModifiedBy);
     $this->dtgUserAccount->AddColumn($this->colModifiedDate);
     // Setup the Create New button
     $this->btnCreateNew = new QButton($this);
     $this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('UserAccount');
     $this->btnCreateNew->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCreateNew_Click'));
 }
Пример #11
0
 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);
         }
     }
 }
Пример #12
0
 /**
  * Count UserAccounts
  * by RoleId Index(es)
  * @param integer $intRoleId
  * @return int
  */
 public static function CountByRoleId($intRoleId, $objOptionalClauses = null)
 {
     // Call UserAccount::QueryCount to perform the CountByRoleId query
     return UserAccount::QueryCount(QQ::Equal(QQN::UserAccount()->RoleId, $intRoleId), $objOptionalClauses);
 }
Пример #13
0
 /**
  * Count UserAccounts
  * by RoleId Index(es)
  * @param integer $intRoleId
  * @return int
  */
 public static function CountByRoleId($intRoleId)
 {
     // Call UserAccount::QueryCount to perform the CountByRoleId query
     return UserAccount::QueryCount(QQ::Equal(QQN::UserAccount()->RoleId, $intRoleId));
 }
 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a UserAccount-based QQNode.
  * It will also verify that it is a proper UserAccount-based QQNode, and will throw an exception otherwise.
  *
  * @param mixed $mixContent
  * @return QQNode
  */
 protected function ResolveContentItem($mixContent)
 {
     if ($mixContent instanceof QQNode) {
         if (!$mixContent->_ParentNode) {
             throw new QCallerException('Content QQNode cannot be a Top Level Node');
         }
         if ($mixContent->_RootTableName == 'user_account') {
             if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             }
             $objCurrentNode = $mixContent;
             while ($objCurrentNode = $objCurrentNode->_ParentNode) {
                 if (!$objCurrentNode instanceof QQNode) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
                 if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
             }
             return $mixContent;
         } else {
             throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "user_account".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'UserAccountId':
                     return QQN::UserAccount()->UserAccountId;
                 case 'FirstName':
                     return QQN::UserAccount()->FirstName;
                 case 'LastName':
                     return QQN::UserAccount()->LastName;
                 case 'Username':
                     return QQN::UserAccount()->Username;
                 case 'PasswordHash':
                     return QQN::UserAccount()->PasswordHash;
                 case 'EmailAddress':
                     return QQN::UserAccount()->EmailAddress;
                 case 'ActiveFlag':
                     return QQN::UserAccount()->ActiveFlag;
                 case 'AdminFlag':
                     return QQN::UserAccount()->AdminFlag;
                 case 'PortableAccessFlag':
                     return QQN::UserAccount()->PortableAccessFlag;
                 case 'PortableUserPin':
                     return QQN::UserAccount()->PortableUserPin;
                 case 'RoleId':
                     return QQN::UserAccount()->RoleId;
                 case 'Role':
                     return QQN::UserAccount()->Role;
                 case 'CreatedBy':
                     return QQN::UserAccount()->CreatedBy;
                 case 'CreatedByObject':
                     return QQN::UserAccount()->CreatedByObject;
                 case 'CreationDate':
                     return QQN::UserAccount()->CreationDate;
                 case 'ModifiedBy':
                     return QQN::UserAccount()->ModifiedBy;
                 case 'ModifiedByObject':
                     return QQN::UserAccount()->ModifiedByObject;
                 case 'ModifiedDate':
                     return QQN::UserAccount()->ModifiedDate;
                 default:
                     throw new QCallerException('Simple Property not found in UserAccountDataGrid content: ' . $mixContent);
             }
         } else {
             if ($mixContent instanceof QQAssociationNode) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             } else {
                 throw new QCallerException('Invalid Content type');
             }
         }
     }
 }
 protected function lstCheckedOutBy_Create()
 {
     $this->lstCheckedOutBy = new QListBox($this);
     $this->lstCheckedOutBy->Name = 'Checked Out By';
     $this->lstCheckedOutBy->AddItem('- Select One -', null, true);
     $this->lstCheckedOutBy->AddItem('Any', 'any');
     $objUserAccountArray = UserAccount::LoadAll(QQ::Clause(QQ::OrderBy(QQN::UserAccount()->Username)));
     if ($objUserAccountArray) {
         foreach ($objUserAccountArray as $objUserAccount) {
             $this->lstCheckedOutBy->AddItem($objUserAccount->__toString(), $objUserAccount->UserAccountId);
         }
     }
 }
Пример #16
0
 /**
  * Count Active UserAccounts
  * @return int
  */
 public static function CountActive()
 {
     // Call UserAccount::QueryCount to perform the Count query
     return UserAccount::QueryCount(QQ::Equal(QQN::UserAccount()->ActiveFlag, 1));
 }
Пример #17
0
 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);
         }
     }
 }