コード例 #1
0
 /**
  * Refresh this MetaControl with Data from the local NarroLog object.
  * @param boolean $blnReload reload NarroLog from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objNarroLog->Reload();
     }
     if ($this->lblLogId) {
         if ($this->blnEditMode) {
             $this->lblLogId->Text = $this->objNarroLog->LogId;
         }
     }
     if ($this->lstLanguage) {
         $this->lstLanguage->RemoveAllItems();
         $this->lstLanguage->AddItem(QApplication::Translate('- Select One -'), null);
         $objLanguageArray = NarroLanguage::LoadAll();
         if ($objLanguageArray) {
             foreach ($objLanguageArray as $objLanguage) {
                 $objListItem = new QListItem($objLanguage->__toString(), $objLanguage->LanguageId);
                 if ($this->objNarroLog->Language && $this->objNarroLog->Language->LanguageId == $objLanguage->LanguageId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstLanguage->AddItem($objListItem);
             }
         }
     }
     if ($this->lblLanguageId) {
         $this->lblLanguageId->Text = $this->objNarroLog->Language ? $this->objNarroLog->Language->__toString() : null;
     }
     if ($this->lstProject) {
         $this->lstProject->RemoveAllItems();
         $this->lstProject->AddItem(QApplication::Translate('- Select One -'), null);
         $objProjectArray = NarroProject::LoadAll();
         if ($objProjectArray) {
             foreach ($objProjectArray as $objProject) {
                 $objListItem = new QListItem($objProject->__toString(), $objProject->ProjectId);
                 if ($this->objNarroLog->Project && $this->objNarroLog->Project->ProjectId == $objProject->ProjectId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstProject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblProjectId) {
         $this->lblProjectId->Text = $this->objNarroLog->Project ? $this->objNarroLog->Project->__toString() : null;
     }
     if ($this->lstUser) {
         $this->lstUser->RemoveAllItems();
         $this->lstUser->AddItem(QApplication::Translate('- Select One -'), null);
         $objUserArray = NarroUser::LoadAll();
         if ($objUserArray) {
             foreach ($objUserArray as $objUser) {
                 $objListItem = new QListItem($objUser->__toString(), $objUser->UserId);
                 if ($this->objNarroLog->User && $this->objNarroLog->User->UserId == $objUser->UserId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstUser->AddItem($objListItem);
             }
         }
     }
     if ($this->lblUserId) {
         $this->lblUserId->Text = $this->objNarroLog->User ? $this->objNarroLog->User->__toString() : null;
     }
     if ($this->txtMessage) {
         $this->txtMessage->Text = $this->objNarroLog->Message;
     }
     if ($this->lblMessage) {
         $this->lblMessage->Text = $this->objNarroLog->Message;
     }
     if ($this->txtPriority) {
         $this->txtPriority->Text = $this->objNarroLog->Priority;
     }
     if ($this->lblPriority) {
         $this->lblPriority->Text = $this->objNarroLog->Priority;
     }
     if ($this->calDate) {
         $this->calDate->DateTime = $this->objNarroLog->Date;
     }
     if ($this->lblDate) {
         $this->lblDate->Text = sprintf($this->objNarroLog->Date) ? $this->objNarroLog->Date->qFormat($this->strDateDateTimeFormat) : null;
     }
 }
コード例 #2
0
 /**
  * Refresh this MetaControl with Data from the local NarroContextInfo object.
  * @param boolean $blnReload reload NarroContextInfo from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objNarroContextInfo->Reload();
     }
     if ($this->lblContextInfoId) {
         if ($this->blnEditMode) {
             $this->lblContextInfoId->Text = $this->objNarroContextInfo->ContextInfoId;
         }
     }
     if ($this->lstContext) {
         $this->lstContext->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstContext->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objContextArray = NarroContext::LoadAll();
         if ($objContextArray) {
             foreach ($objContextArray as $objContext) {
                 $objListItem = new QListItem($objContext->__toString(), $objContext->ContextId);
                 if ($this->objNarroContextInfo->Context && $this->objNarroContextInfo->Context->ContextId == $objContext->ContextId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstContext->AddItem($objListItem);
             }
         }
     }
     if ($this->lblContextId) {
         $this->lblContextId->Text = $this->objNarroContextInfo->Context ? $this->objNarroContextInfo->Context->__toString() : null;
     }
     if ($this->lstLanguage) {
         $this->lstLanguage->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstLanguage->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objLanguageArray = NarroLanguage::LoadAll();
         if ($objLanguageArray) {
             foreach ($objLanguageArray as $objLanguage) {
                 $objListItem = new QListItem($objLanguage->__toString(), $objLanguage->LanguageId);
                 if ($this->objNarroContextInfo->Language && $this->objNarroContextInfo->Language->LanguageId == $objLanguage->LanguageId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstLanguage->AddItem($objListItem);
             }
         }
     }
     if ($this->lblLanguageId) {
         $this->lblLanguageId->Text = $this->objNarroContextInfo->Language ? $this->objNarroContextInfo->Language->__toString() : null;
     }
     if ($this->lstValidatorUser) {
         $this->lstValidatorUser->RemoveAllItems();
         $this->lstValidatorUser->AddItem(QApplication::Translate('- Select One -'), null);
         $objValidatorUserArray = NarroUser::LoadAll();
         if ($objValidatorUserArray) {
             foreach ($objValidatorUserArray as $objValidatorUser) {
                 $objListItem = new QListItem($objValidatorUser->__toString(), $objValidatorUser->UserId);
                 if ($this->objNarroContextInfo->ValidatorUser && $this->objNarroContextInfo->ValidatorUser->UserId == $objValidatorUser->UserId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstValidatorUser->AddItem($objListItem);
             }
         }
     }
     if ($this->lblValidatorUserId) {
         $this->lblValidatorUserId->Text = $this->objNarroContextInfo->ValidatorUser ? $this->objNarroContextInfo->ValidatorUser->__toString() : null;
     }
     if ($this->lstValidSuggestion) {
         $this->lstValidSuggestion->RemoveAllItems();
         $this->lstValidSuggestion->AddItem(QApplication::Translate('- Select One -'), null);
         $objValidSuggestionArray = NarroSuggestion::LoadAll();
         if ($objValidSuggestionArray) {
             foreach ($objValidSuggestionArray as $objValidSuggestion) {
                 $objListItem = new QListItem($objValidSuggestion->__toString(), $objValidSuggestion->SuggestionId);
                 if ($this->objNarroContextInfo->ValidSuggestion && $this->objNarroContextInfo->ValidSuggestion->SuggestionId == $objValidSuggestion->SuggestionId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstValidSuggestion->AddItem($objListItem);
             }
         }
     }
     if ($this->lblValidSuggestionId) {
         $this->lblValidSuggestionId->Text = $this->objNarroContextInfo->ValidSuggestion ? $this->objNarroContextInfo->ValidSuggestion->__toString() : null;
     }
     if ($this->chkHasSuggestions) {
         $this->chkHasSuggestions->Checked = $this->objNarroContextInfo->HasSuggestions;
     }
     if ($this->lblHasSuggestions) {
         $this->lblHasSuggestions->Text = $this->objNarroContextInfo->HasSuggestions ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->txtSuggestionAccessKey) {
         $this->txtSuggestionAccessKey->Text = $this->objNarroContextInfo->SuggestionAccessKey;
     }
     if ($this->lblSuggestionAccessKey) {
         $this->lblSuggestionAccessKey->Text = $this->objNarroContextInfo->SuggestionAccessKey;
     }
     if ($this->txtSuggestionCommandKey) {
         $this->txtSuggestionCommandKey->Text = $this->objNarroContextInfo->SuggestionCommandKey;
     }
     if ($this->lblSuggestionCommandKey) {
         $this->lblSuggestionCommandKey->Text = $this->objNarroContextInfo->SuggestionCommandKey;
     }
     if ($this->calCreated) {
         $this->calCreated->DateTime = $this->objNarroContextInfo->Created;
     }
     if ($this->lblCreated) {
         $this->lblCreated->Text = sprintf($this->objNarroContextInfo->Created) ? $this->objNarroContextInfo->Created->qFormat($this->strCreatedDateTimeFormat) : null;
     }
     if ($this->calModified) {
         $this->calModified->DateTime = $this->objNarroContextInfo->Modified;
     }
     if ($this->lblModified) {
         $this->lblModified->Text = sprintf($this->objNarroContextInfo->Modified) ? $this->objNarroContextInfo->Modified->qFormat($this->strModifiedDateTimeFormat) : null;
     }
 }
コード例 #3
0
 /**
  * Refresh this MetaControl with Data from the local NarroSuggestionVote object.
  * @param boolean $blnReload reload NarroSuggestionVote from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objNarroSuggestionVote->Reload();
     }
     if ($this->lstSuggestion) {
         $this->lstSuggestion->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstSuggestion->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objSuggestionArray = NarroSuggestion::LoadAll();
         if ($objSuggestionArray) {
             foreach ($objSuggestionArray as $objSuggestion) {
                 $objListItem = new QListItem($objSuggestion->__toString(), $objSuggestion->SuggestionId);
                 if ($this->objNarroSuggestionVote->Suggestion && $this->objNarroSuggestionVote->Suggestion->SuggestionId == $objSuggestion->SuggestionId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSuggestion->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSuggestionId) {
         $this->lblSuggestionId->Text = $this->objNarroSuggestionVote->Suggestion ? $this->objNarroSuggestionVote->Suggestion->__toString() : null;
     }
     if ($this->lstContext) {
         $this->lstContext->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstContext->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objContextArray = NarroContext::LoadAll();
         if ($objContextArray) {
             foreach ($objContextArray as $objContext) {
                 $objListItem = new QListItem($objContext->__toString(), $objContext->ContextId);
                 if ($this->objNarroSuggestionVote->Context && $this->objNarroSuggestionVote->Context->ContextId == $objContext->ContextId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstContext->AddItem($objListItem);
             }
         }
     }
     if ($this->lblContextId) {
         $this->lblContextId->Text = $this->objNarroSuggestionVote->Context ? $this->objNarroSuggestionVote->Context->__toString() : null;
     }
     if ($this->lstUser) {
         $this->lstUser->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstUser->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objUserArray = NarroUser::LoadAll();
         if ($objUserArray) {
             foreach ($objUserArray as $objUser) {
                 $objListItem = new QListItem($objUser->__toString(), $objUser->UserId);
                 if ($this->objNarroSuggestionVote->User && $this->objNarroSuggestionVote->User->UserId == $objUser->UserId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstUser->AddItem($objListItem);
             }
         }
     }
     if ($this->lblUserId) {
         $this->lblUserId->Text = $this->objNarroSuggestionVote->User ? $this->objNarroSuggestionVote->User->__toString() : null;
     }
     if ($this->txtVoteValue) {
         $this->txtVoteValue->Text = $this->objNarroSuggestionVote->VoteValue;
     }
     if ($this->lblVoteValue) {
         $this->lblVoteValue->Text = $this->objNarroSuggestionVote->VoteValue;
     }
     if ($this->calCreated) {
         $this->calCreated->DateTime = $this->objNarroSuggestionVote->Created;
     }
     if ($this->lblCreated) {
         $this->lblCreated->Text = sprintf($this->objNarroSuggestionVote->Created) ? $this->objNarroSuggestionVote->Created->qFormat($this->strCreatedDateTimeFormat) : null;
     }
     if ($this->calModified) {
         $this->calModified->DateTime = $this->objNarroSuggestionVote->Modified;
     }
     if ($this->lblModified) {
         $this->lblModified->Text = sprintf($this->objNarroSuggestionVote->Modified) ? $this->objNarroSuggestionVote->Modified->qFormat($this->strModifiedDateTimeFormat) : null;
     }
 }
コード例 #4
0
 /**
  * Refresh this MetaControl with Data from the local NarroSuggestion object.
  * @param boolean $blnReload reload NarroSuggestion from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objNarroSuggestion->Reload();
     }
     if ($this->lblSuggestionId) {
         if ($this->blnEditMode) {
             $this->lblSuggestionId->Text = $this->objNarroSuggestion->SuggestionId;
         }
     }
     if ($this->lstUser) {
         $this->lstUser->RemoveAllItems();
         $this->lstUser->AddItem(QApplication::Translate('- Select One -'), null);
         $objUserArray = NarroUser::LoadAll();
         if ($objUserArray) {
             foreach ($objUserArray as $objUser) {
                 $objListItem = new QListItem($objUser->__toString(), $objUser->UserId);
                 if ($this->objNarroSuggestion->User && $this->objNarroSuggestion->User->UserId == $objUser->UserId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstUser->AddItem($objListItem);
             }
         }
     }
     if ($this->lblUserId) {
         $this->lblUserId->Text = $this->objNarroSuggestion->User ? $this->objNarroSuggestion->User->__toString() : null;
     }
     if ($this->lstText) {
         $this->lstText->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstText->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objTextArray = NarroText::LoadAll();
         if ($objTextArray) {
             foreach ($objTextArray as $objText) {
                 $objListItem = new QListItem($objText->__toString(), $objText->TextId);
                 if ($this->objNarroSuggestion->Text && $this->objNarroSuggestion->Text->TextId == $objText->TextId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstText->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTextId) {
         $this->lblTextId->Text = $this->objNarroSuggestion->Text ? $this->objNarroSuggestion->Text->__toString() : null;
     }
     if ($this->lstLanguage) {
         $this->lstLanguage->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstLanguage->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objLanguageArray = NarroLanguage::LoadAll();
         if ($objLanguageArray) {
             foreach ($objLanguageArray as $objLanguage) {
                 $objListItem = new QListItem($objLanguage->__toString(), $objLanguage->LanguageId);
                 if ($this->objNarroSuggestion->Language && $this->objNarroSuggestion->Language->LanguageId == $objLanguage->LanguageId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstLanguage->AddItem($objListItem);
             }
         }
     }
     if ($this->lblLanguageId) {
         $this->lblLanguageId->Text = $this->objNarroSuggestion->Language ? $this->objNarroSuggestion->Language->__toString() : null;
     }
     if ($this->txtSuggestionValue) {
         $this->txtSuggestionValue->Text = $this->objNarroSuggestion->SuggestionValue;
     }
     if ($this->lblSuggestionValue) {
         $this->lblSuggestionValue->Text = $this->objNarroSuggestion->SuggestionValue;
     }
     if ($this->txtSuggestionValueMd5) {
         $this->txtSuggestionValueMd5->Text = $this->objNarroSuggestion->SuggestionValueMd5;
     }
     if ($this->lblSuggestionValueMd5) {
         $this->lblSuggestionValueMd5->Text = $this->objNarroSuggestion->SuggestionValueMd5;
     }
     if ($this->txtSuggestionCharCount) {
         $this->txtSuggestionCharCount->Text = $this->objNarroSuggestion->SuggestionCharCount;
     }
     if ($this->lblSuggestionCharCount) {
         $this->lblSuggestionCharCount->Text = $this->objNarroSuggestion->SuggestionCharCount;
     }
     if ($this->txtSuggestionWordCount) {
         $this->txtSuggestionWordCount->Text = $this->objNarroSuggestion->SuggestionWordCount;
     }
     if ($this->lblSuggestionWordCount) {
         $this->lblSuggestionWordCount->Text = $this->objNarroSuggestion->SuggestionWordCount;
     }
     if ($this->chkHasComments) {
         $this->chkHasComments->Checked = $this->objNarroSuggestion->HasComments;
     }
     if ($this->lblHasComments) {
         $this->lblHasComments->Text = $this->objNarroSuggestion->HasComments ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->chkIsImported) {
         $this->chkIsImported->Checked = $this->objNarroSuggestion->IsImported;
     }
     if ($this->lblIsImported) {
         $this->lblIsImported->Text = $this->objNarroSuggestion->IsImported ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->calCreated) {
         $this->calCreated->DateTime = $this->objNarroSuggestion->Created;
     }
     if ($this->lblCreated) {
         $this->lblCreated->Text = sprintf($this->objNarroSuggestion->Created) ? $this->objNarroSuggestion->Created->qFormat($this->strCreatedDateTimeFormat) : null;
     }
     if ($this->calModified) {
         $this->calModified->DateTime = $this->objNarroSuggestion->Modified;
     }
     if ($this->lblModified) {
         $this->lblModified->Text = sprintf($this->objNarroSuggestion->Modified) ? $this->objNarroSuggestion->Modified->qFormat($this->strModifiedDateTimeFormat) : null;
     }
 }
コード例 #5
0
 * http://code.google.com/p/narro/
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
 * later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
require_once dirname(__FILE__) . '/configuration/prepend.inc.php';
if (QApplication::HasPermission('Administrator')) {
    foreach (NarroUser::LoadAll() as $objUser) {
        $arrUserPermissions = array();
        foreach (NarroUserPermission::LoadArrayByUserId($objUser->UserId) as $objUserPermission) {
            $objUserRole = new NarroUserRole();
            switch ($objUserPermission->PermissionId) {
                case 1:
                case 2:
                case 4:
                    $objUserRole->RoleId = 2;
                    break;
                case 3:
                    $objUserRole->RoleId = 3;
                    break;
                case 5:
                case 6:
                case 8:
コード例 #6
0
ファイル: NarroUser.class.php プロジェクト: Jobava/narro
 public static function RegisterUser($strUsername, $strEmail, $strPassword, $strRealName)
 {
     $objMaxUser = NarroUser::LoadAll(QQ::Clause(QQ::LimitInfo(1, 0), QQ::OrderBy(QQN::NarroUser()->UserId, false)));
     $objUser = new NarroUser();
     $objUser->UserId = $objMaxUser[0]->UserId + 1;
     $objUser->Username = $strUsername;
     if ($strRealName) {
         $objUser->RealName = $strRealName;
     }
     $objUser->Email = $strEmail;
     require_once __NARRO_INCLUDES__ . '/PasswordHash.class.php';
     $objHasher = new PasswordHash(8, FALSE);
     $objUser->Password = $objHasher->HashPassword($strPassword);
     try {
         $objUser->Save();
     } catch (Exception $objEx) {
         throw $objEx;
     }
     /**
      * set up default roles
      */
     $objUserRole = new NarroUserRole();
     if ($objUser->UserId == 1) {
         $objUserRole->RoleId = 5;
     } else {
         $objUserRole->RoleId = 2;
     }
     $objUserRole->UserId = $objUser->UserId;
     $objUserRole->Save();
     return NarroUser::LoadByUsernameAndPassword($strUsername, md5($strPassword));
 }
コード例 #7
0
 /**
  * Refresh this MetaControl with Data from the local NarroUserRole object.
  * @param boolean $blnReload reload NarroUserRole from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objNarroUserRole->Reload();
     }
     if ($this->lblUserRoleId) {
         if ($this->blnEditMode) {
             $this->lblUserRoleId->Text = $this->objNarroUserRole->UserRoleId;
         }
     }
     if ($this->lstUser) {
         $this->lstUser->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstUser->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objUserArray = NarroUser::LoadAll();
         if ($objUserArray) {
             foreach ($objUserArray as $objUser) {
                 $objListItem = new QListItem($objUser->__toString(), $objUser->UserId);
                 if ($this->objNarroUserRole->User && $this->objNarroUserRole->User->UserId == $objUser->UserId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstUser->AddItem($objListItem);
             }
         }
     }
     if ($this->lblUserId) {
         $this->lblUserId->Text = $this->objNarroUserRole->User ? $this->objNarroUserRole->User->__toString() : null;
     }
     if ($this->lstRole) {
         $this->lstRole->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstRole->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objRoleArray = NarroRole::LoadAll();
         if ($objRoleArray) {
             foreach ($objRoleArray as $objRole) {
                 $objListItem = new QListItem($objRole->__toString(), $objRole->RoleId);
                 if ($this->objNarroUserRole->Role && $this->objNarroUserRole->Role->RoleId == $objRole->RoleId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstRole->AddItem($objListItem);
             }
         }
     }
     if ($this->lblRoleId) {
         $this->lblRoleId->Text = $this->objNarroUserRole->Role ? $this->objNarroUserRole->Role->__toString() : null;
     }
     if ($this->lstProject) {
         $this->lstProject->RemoveAllItems();
         $this->lstProject->AddItem(QApplication::Translate('- Select One -'), null);
         $objProjectArray = NarroProject::LoadAll();
         if ($objProjectArray) {
             foreach ($objProjectArray as $objProject) {
                 $objListItem = new QListItem($objProject->__toString(), $objProject->ProjectId);
                 if ($this->objNarroUserRole->Project && $this->objNarroUserRole->Project->ProjectId == $objProject->ProjectId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstProject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblProjectId) {
         $this->lblProjectId->Text = $this->objNarroUserRole->Project ? $this->objNarroUserRole->Project->__toString() : null;
     }
     if ($this->lstLanguage) {
         $this->lstLanguage->RemoveAllItems();
         $this->lstLanguage->AddItem(QApplication::Translate('- Select One -'), null);
         $objLanguageArray = NarroLanguage::LoadAll();
         if ($objLanguageArray) {
             foreach ($objLanguageArray as $objLanguage) {
                 $objListItem = new QListItem($objLanguage->__toString(), $objLanguage->LanguageId);
                 if ($this->objNarroUserRole->Language && $this->objNarroUserRole->Language->LanguageId == $objLanguage->LanguageId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstLanguage->AddItem($objListItem);
             }
         }
     }
     if ($this->lblLanguageId) {
         $this->lblLanguageId->Text = $this->objNarroUserRole->Language ? $this->objNarroUserRole->Language->__toString() : null;
     }
 }
コード例 #8
0
 /**
  * Refresh this MetaControl with Data from the local NarroTextComment object.
  * @param boolean $blnReload reload NarroTextComment from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objNarroTextComment->Reload();
     }
     if ($this->lblTextCommentId) {
         if ($this->blnEditMode) {
             $this->lblTextCommentId->Text = $this->objNarroTextComment->TextCommentId;
         }
     }
     if ($this->lstText) {
         $this->lstText->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstText->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objTextArray = NarroText::LoadAll();
         if ($objTextArray) {
             foreach ($objTextArray as $objText) {
                 $objListItem = new QListItem($objText->__toString(), $objText->TextId);
                 if ($this->objNarroTextComment->Text && $this->objNarroTextComment->Text->TextId == $objText->TextId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstText->AddItem($objListItem);
             }
         }
     }
     if ($this->lblTextId) {
         $this->lblTextId->Text = $this->objNarroTextComment->Text ? $this->objNarroTextComment->Text->__toString() : null;
     }
     if ($this->lstUser) {
         $this->lstUser->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstUser->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objUserArray = NarroUser::LoadAll();
         if ($objUserArray) {
             foreach ($objUserArray as $objUser) {
                 $objListItem = new QListItem($objUser->__toString(), $objUser->UserId);
                 if ($this->objNarroTextComment->User && $this->objNarroTextComment->User->UserId == $objUser->UserId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstUser->AddItem($objListItem);
             }
         }
     }
     if ($this->lblUserId) {
         $this->lblUserId->Text = $this->objNarroTextComment->User ? $this->objNarroTextComment->User->__toString() : null;
     }
     if ($this->lstLanguage) {
         $this->lstLanguage->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstLanguage->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objLanguageArray = NarroLanguage::LoadAll();
         if ($objLanguageArray) {
             foreach ($objLanguageArray as $objLanguage) {
                 $objListItem = new QListItem($objLanguage->__toString(), $objLanguage->LanguageId);
                 if ($this->objNarroTextComment->Language && $this->objNarroTextComment->Language->LanguageId == $objLanguage->LanguageId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstLanguage->AddItem($objListItem);
             }
         }
     }
     if ($this->lblLanguageId) {
         $this->lblLanguageId->Text = $this->objNarroTextComment->Language ? $this->objNarroTextComment->Language->__toString() : null;
     }
     if ($this->calCreated) {
         $this->calCreated->DateTime = $this->objNarroTextComment->Created;
     }
     if ($this->lblCreated) {
         $this->lblCreated->Text = sprintf($this->objNarroTextComment->Created) ? $this->objNarroTextComment->Created->qFormat($this->strCreatedDateTimeFormat) : null;
     }
     if ($this->calModified) {
         $this->calModified->DateTime = $this->objNarroTextComment->Modified;
     }
     if ($this->lblModified) {
         $this->lblModified->Text = sprintf($this->objNarroTextComment->Modified) ? $this->objNarroTextComment->Modified->qFormat($this->strModifiedDateTimeFormat) : null;
     }
     if ($this->txtCommentText) {
         $this->txtCommentText->Text = $this->objNarroTextComment->CommentText;
     }
     if ($this->lblCommentText) {
         $this->lblCommentText->Text = $this->objNarroTextComment->CommentText;
     }
     if ($this->txtCommentTextMd5) {
         $this->txtCommentTextMd5->Text = $this->objNarroTextComment->CommentTextMd5;
     }
     if ($this->lblCommentTextMd5) {
         $this->lblCommentTextMd5->Text = $this->objNarroTextComment->CommentTextMd5;
     }
 }