Пример #1
0
 /**
  * @return array
  */
 function &SelectAllAccounts($pageNumber, $accountPerPage, $sortField, $sortOrder, $searchText)
 {
     $mailBoxSizes = array();
     if ($this->_dbConnection->Execute($this->_commandCreator->CountAllMailboxSizes())) {
         while ($row = $this->_dbConnection->GetNextRecord()) {
             $mailBoxSizes[$row->id_user] = $row->mailboxes_size;
         }
     }
     $outarray = array();
     if (!$this->_dbConnection->Execute($this->_commandCreator->SelectAllAccounts($pageNumber, $accountPerPage, $sortField, $sortOrder, $searchText))) {
         return $outarray;
     }
     while ($row = $this->_dbConnection->GetNextRecord()) {
         if ($row) {
             $temp = array();
             $temp['Id'] = (int) $row->id_acct;
             $temp['IdUser'] = (int) $row->id_user;
             $temp['Deleted'] = $row->deleted;
             $temp['Email'] = $row->email;
             $temp['MailIncHost'] = $row->mail_inc_host;
             $temp['MailOutHost'] = $row->mail_out_host;
             $temp['LastLogin'] = $row->nlast_login;
             $temp['LoginsCount'] = (int) $row->logins_count;
             $temp['MailboxSize'] = $row->mailbox_size;
             $temp['MailboxLimit'] = $row->mailbox_limit;
             $temp['UserMailboxSize'] = isset($mailBoxSizes[$row->id_user]) ? $mailBoxSizes[$row->id_user] : 0;
             $temp['DefAcct'] = $row->def_acct;
             $outarray[] = $temp;
         }
     }
     $this->_dbConnection->FreeResult();
     return $outarray;
 }