Exemple #1
0
 protected function Form_Create()
 {
     parent::Form_Create();
     if (QApplication::GetUserId() == NarroUser::ANONYMOUS_USER_ID) {
         QApplication::Redirect(NarroLink::ProjectList());
         exit;
     }
     if (QApplication::GetUserId() != QApplication::QueryString('u') && QApplication::HasPermissionForThisLang('Can manage users', null)) {
         $this->objUser = NarroUser::Load(QApplication::QueryString('u'));
     }
     if (!$this->objUser instanceof NarroUser) {
         $this->objUser = QApplication::$User;
     }
     $this->pnlBreadcrumb->setElements(NarroLink::ProjectList(t('Projects')), NarroLink::UserList('', t('Users')), $this->objUser->RealName);
     $this->pnlTab = new QTabs($this);
     new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserProfile($this->objUser->UserId, t('Profile'));
     if (QApplication::GetUserId() == $this->objUser->UserId || QApplication::HasPermissionForThisLang('Can manage users', null)) {
         new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::UserPreferences($this->objUser->UserId, t('Preferences'));
     }
     new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserRole($this->objUser->UserId, t('Roles'));
     if (QApplication::GetUserId() == $this->objUser->UserId || QApplication::HasPermissionForThisLang('Can manage users', null)) {
         $this->pnlUser = new NarroUserEditPanel($this->objUser, $this->pnlTab);
         $arrHeaders[] = NarroLink::UserEdit($this->objUser->UserId, t('Edit'));
         $this->pnlTab->Selected = count($arrHeaders) - 1;
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
 /**
  * Override method to perform a property "Get"
  * This will get the value of $strName
  *
  * @param string $strName Name of the property to get
  * @return mixed
  */
 public function __get($strName)
 {
     switch ($strName) {
         ///////////////////
         // Member Variables
         ///////////////////
         case 'SuggestionId':
             /**
              * Gets the value for intSuggestionId (PK)
              * @return integer
              */
             return $this->intSuggestionId;
         case 'ContextId':
             /**
              * Gets the value for intContextId (PK)
              * @return integer
              */
             return $this->intContextId;
         case 'UserId':
             /**
              * Gets the value for intUserId (PK)
              * @return integer
              */
             return $this->intUserId;
         case 'VoteValue':
             /**
              * Gets the value for intVoteValue (Not Null)
              * @return integer
              */
             return $this->intVoteValue;
         case 'Created':
             /**
              * Gets the value for dttCreated (Not Null)
              * @return QDateTime
              */
             return $this->dttCreated;
         case 'Modified':
             /**
              * Gets the value for dttModified 
              * @return QDateTime
              */
             return $this->dttModified;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Suggestion':
             /**
              * Gets the value for the NarroSuggestion object referenced by intSuggestionId (PK)
              * @return NarroSuggestion
              */
             try {
                 if (!$this->objSuggestion && !is_null($this->intSuggestionId)) {
                     $this->objSuggestion = NarroSuggestion::Load($this->intSuggestionId);
                 }
                 return $this->objSuggestion;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Context':
             /**
              * Gets the value for the NarroContext object referenced by intContextId (PK)
              * @return NarroContext
              */
             try {
                 if (!$this->objContext && !is_null($this->intContextId)) {
                     $this->objContext = NarroContext::Load($this->intContextId);
                 }
                 return $this->objContext;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'User':
             /**
              * Gets the value for the NarroUser object referenced by intUserId (PK)
              * @return NarroUser
              */
             try {
                 if (!$this->objUser && !is_null($this->intUserId)) {
                     $this->objUser = NarroUser::Load($this->intUserId);
                 }
                 return $this->objUser;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             ////////////////////////////
             // Virtual Object References (Many to Many and Reverse References)
             // (If restored via a "Many-to" expansion)
             ////////////////////////////
         ////////////////////////////
         // Virtual Object References (Many to Many and Reverse References)
         // (If restored via a "Many-to" expansion)
         ////////////////////////////
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Exemple #3
0
 /**
  * Override method to perform a property "Get"
  * This will get the value of $strName
  *
  * @param string $strName Name of the property to get
  * @return mixed
  */
 public function __get($strName)
 {
     switch ($strName) {
         ///////////////////
         // Member Variables
         ///////////////////
         case 'LogId':
             /**
              * Gets the value for intLogId (Read-Only PK)
              * @return integer
              */
             return $this->intLogId;
         case 'LanguageId':
             /**
              * Gets the value for intLanguageId 
              * @return integer
              */
             return $this->intLanguageId;
         case 'ProjectId':
             /**
              * Gets the value for intProjectId 
              * @return integer
              */
             return $this->intProjectId;
         case 'UserId':
             /**
              * Gets the value for intUserId 
              * @return integer
              */
             return $this->intUserId;
         case 'Message':
             /**
              * Gets the value for strMessage (Not Null)
              * @return string
              */
             return $this->strMessage;
         case 'Priority':
             /**
              * Gets the value for intPriority (Not Null)
              * @return integer
              */
             return $this->intPriority;
         case 'Date':
             /**
              * Gets the value for dttDate (Not Null)
              * @return QDateTime
              */
             return $this->dttDate;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Language':
             /**
              * Gets the value for the NarroLanguage object referenced by intLanguageId 
              * @return NarroLanguage
              */
             try {
                 if (!$this->objLanguage && !is_null($this->intLanguageId)) {
                     $this->objLanguage = NarroLanguage::Load($this->intLanguageId);
                 }
                 return $this->objLanguage;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Project':
             /**
              * Gets the value for the NarroProject object referenced by intProjectId 
              * @return NarroProject
              */
             try {
                 if (!$this->objProject && !is_null($this->intProjectId)) {
                     $this->objProject = NarroProject::Load($this->intProjectId);
                 }
                 return $this->objProject;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'User':
             /**
              * Gets the value for the NarroUser object referenced by intUserId 
              * @return NarroUser
              */
             try {
                 if (!$this->objUser && !is_null($this->intUserId)) {
                     $this->objUser = NarroUser::Load($this->intUserId);
                 }
                 return $this->objUser;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             ////////////////////////////
             // Virtual Object References (Many to Many and Reverse References)
             // (If restored via a "Many-to" expansion)
             ////////////////////////////
         ////////////////////////////
         // Virtual Object References (Many to Many and Reverse References)
         // (If restored via a "Many-to" expansion)
         ////////////////////////////
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
 /**
  * Override method to perform a property "Get"
  * This will get the value of $strName
  *
  * @param string $strName Name of the property to get
  * @return mixed
  */
 public function __get($strName)
 {
     switch ($strName) {
         ///////////////////
         // Member Variables
         ///////////////////
         case 'SuggestionId':
             /**
              * Gets the value for intSuggestionId (Read-Only PK)
              * @return integer
              */
             return $this->intSuggestionId;
         case 'UserId':
             /**
              * Gets the value for intUserId 
              * @return integer
              */
             return $this->intUserId;
         case 'TextId':
             /**
              * Gets the value for intTextId (Not Null)
              * @return integer
              */
             return $this->intTextId;
         case 'LanguageId':
             /**
              * Gets the value for intLanguageId (Not Null)
              * @return integer
              */
             return $this->intLanguageId;
         case 'SuggestionValue':
             /**
              * Gets the value for strSuggestionValue (Not Null)
              * @return string
              */
             return $this->strSuggestionValue;
         case 'SuggestionValueMd5':
             /**
              * Gets the value for strSuggestionValueMd5 (Not Null)
              * @return string
              */
             return $this->strSuggestionValueMd5;
         case 'SuggestionCharCount':
             /**
              * Gets the value for intSuggestionCharCount 
              * @return integer
              */
             return $this->intSuggestionCharCount;
         case 'SuggestionWordCount':
             /**
              * Gets the value for intSuggestionWordCount 
              * @return integer
              */
             return $this->intSuggestionWordCount;
         case 'HasComments':
             /**
              * Gets the value for blnHasComments 
              * @return boolean
              */
             return $this->blnHasComments;
         case 'IsImported':
             /**
              * Gets the value for blnIsImported (Not Null)
              * @return boolean
              */
             return $this->blnIsImported;
         case 'Created':
             /**
              * Gets the value for dttCreated (Not Null)
              * @return QDateTime
              */
             return $this->dttCreated;
         case 'Modified':
             /**
              * Gets the value for dttModified 
              * @return QDateTime
              */
             return $this->dttModified;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'User':
             /**
              * Gets the value for the NarroUser object referenced by intUserId 
              * @return NarroUser
              */
             try {
                 if (!$this->objUser && !is_null($this->intUserId)) {
                     $this->objUser = NarroUser::Load($this->intUserId);
                 }
                 return $this->objUser;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Text':
             /**
              * Gets the value for the NarroText object referenced by intTextId (Not Null)
              * @return NarroText
              */
             try {
                 if (!$this->objText && !is_null($this->intTextId)) {
                     $this->objText = NarroText::Load($this->intTextId);
                 }
                 return $this->objText;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Language':
             /**
              * Gets the value for the NarroLanguage object referenced by intLanguageId (Not Null)
              * @return NarroLanguage
              */
             try {
                 if (!$this->objLanguage && !is_null($this->intLanguageId)) {
                     $this->objLanguage = NarroLanguage::Load($this->intLanguageId);
                 }
                 return $this->objLanguage;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             ////////////////////////////
             // Virtual Object References (Many to Many and Reverse References)
             // (If restored via a "Many-to" expansion)
             ////////////////////////////
         ////////////////////////////
         // Virtual Object References (Many to Many and Reverse References)
         // (If restored via a "Many-to" expansion)
         ////////////////////////////
         case '_NarroContextInfoAsValidSuggestion':
             /**
              * Gets the value for the private _objNarroContextInfoAsValidSuggestion (Read-Only)
              * if set due to an expansion on the narro_context_info.valid_suggestion_id reverse relationship
              * @return NarroContextInfo
              */
             return $this->_objNarroContextInfoAsValidSuggestion;
         case '_NarroContextInfoAsValidSuggestionArray':
             /**
              * Gets the value for the private _objNarroContextInfoAsValidSuggestionArray (Read-Only)
              * if set due to an ExpandAsArray on the narro_context_info.valid_suggestion_id reverse relationship
              * @return NarroContextInfo[]
              */
             return $this->_objNarroContextInfoAsValidSuggestionArray;
         case '_NarroSuggestionVoteAsSuggestion':
             /**
              * Gets the value for the private _objNarroSuggestionVoteAsSuggestion (Read-Only)
              * if set due to an expansion on the narro_suggestion_vote.suggestion_id reverse relationship
              * @return NarroSuggestionVote
              */
             return $this->_objNarroSuggestionVoteAsSuggestion;
         case '_NarroSuggestionVoteAsSuggestionArray':
             /**
              * Gets the value for the private _objNarroSuggestionVoteAsSuggestionArray (Read-Only)
              * if set due to an ExpandAsArray on the narro_suggestion_vote.suggestion_id reverse relationship
              * @return NarroSuggestionVote[]
              */
             return $this->_objNarroSuggestionVoteAsSuggestionArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Exemple #5
0
 /**
  * Reload this NarroUser from the database.
  * @return void
  */
 public function Reload()
 {
     // Make sure we are actually Restored from the database
     if (!$this->__blnRestored) {
         throw new QCallerException('Cannot call Reload() on a new, unsaved NarroUser object.');
     }
     $this->DeleteCache();
     // Reload the Object
     $objReloaded = NarroUser::Load($this->intUserId);
     // Update $this's local variables to match
     $this->intUserId = $objReloaded->intUserId;
     $this->__intUserId = $this->intUserId;
     $this->strUsername = $objReloaded->strUsername;
     $this->strPassword = $objReloaded->strPassword;
     $this->strEmail = $objReloaded->strEmail;
     $this->strRealName = $objReloaded->strRealName;
     $this->strData = $objReloaded->strData;
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to
  * edit, or if we are also allowed to create a new one, etc.
  *
  * @param mixed $objParentObject QForm or QPanel which will be using this NarroUserMetaControl
  * @param integer $intUserId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing NarroUser object creation - defaults to CreateOrEdit
  * @return NarroUserMetaControl
  */
 public static function Create($objParentObject, $intUserId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intUserId)) {
         $objNarroUser = NarroUser::Load($intUserId);
         // NarroUser was found -- return it!
         if ($objNarroUser) {
             return new NarroUserMetaControl($objParentObject, $objNarroUser);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a NarroUser object with PK arguments: ' . $intUserId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new NarroUserMetaControl($objParentObject, new NarroUser());
 }
 /**
  * Override method to perform a property "Get"
  * This will get the value of $strName
  *
  * @param string $strName Name of the property to get
  * @return mixed
  */
 public function __get($strName)
 {
     switch ($strName) {
         ///////////////////
         // Member Variables
         ///////////////////
         case 'ContextInfoId':
             /**
              * Gets the value for intContextInfoId (Read-Only PK)
              * @return integer
              */
             return $this->intContextInfoId;
         case 'ContextId':
             /**
              * Gets the value for intContextId (Not Null)
              * @return integer
              */
             return $this->intContextId;
         case 'LanguageId':
             /**
              * Gets the value for intLanguageId (Not Null)
              * @return integer
              */
             return $this->intLanguageId;
         case 'ValidatorUserId':
             /**
              * Gets the value for intValidatorUserId
              * @return integer
              */
             return $this->intValidatorUserId;
         case 'ValidSuggestionId':
             /**
              * Gets the value for intValidSuggestionId
              * @return integer
              */
             return $this->intValidSuggestionId;
         case 'HasSuggestions':
             /**
              * Gets the value for blnHasSuggestions
              * @return boolean
              */
             return $this->blnHasSuggestions;
         case 'SuggestionAccessKey':
             /**
              * Gets the value for strSuggestionAccessKey
              * @return string
              */
             return $this->strSuggestionAccessKey;
         case 'SuggestionCommandKey':
             /**
              * Gets the value for strSuggestionCommandKey
              * @return string
              */
             return $this->strSuggestionCommandKey;
         case 'Created':
             /**
              * Gets the value for dttCreated (Not Null)
              * @return QDateTime
              */
             return $this->dttCreated;
         case 'Modified':
             /**
              * Gets the value for dttModified
              * @return QDateTime
              */
             return $this->dttModified;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'Context':
             /**
              * Gets the value for the NarroContext object referenced by intContextId (Not Null)
              * @return NarroContext
              */
             try {
                 if (!$this->objContext && !is_null($this->intContextId)) {
                     $this->objContext = NarroContext::Load($this->intContextId);
                 }
                 return $this->objContext;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Language':
             /**
              * Gets the value for the NarroLanguage object referenced by intLanguageId (Not Null)
              * @return NarroLanguage
              */
             try {
                 if (!$this->objLanguage && !is_null($this->intLanguageId)) {
                     $this->objLanguage = NarroLanguage::Load($this->intLanguageId);
                 }
                 return $this->objLanguage;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ValidatorUser':
             /**
              * Gets the value for the NarroUser object referenced by intValidatorUserId
              * @return NarroUser
              */
             try {
                 if (!$this->objValidatorUser && !is_null($this->intValidatorUserId)) {
                     $this->objValidatorUser = NarroUser::Load($this->intValidatorUserId);
                 }
                 return $this->objValidatorUser;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'ValidSuggestion':
             /**
              * Gets the value for the NarroSuggestion object referenced by intValidSuggestionId
              * @return NarroSuggestion
              */
             try {
                 if (!$this->objValidSuggestion && !is_null($this->intValidSuggestionId)) {
                     $this->objValidSuggestion = NarroSuggestion::Load($this->intValidSuggestionId);
                 }
                 return $this->objValidSuggestion;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             ////////////////////////////
             // Virtual Object References (Many to Many and Reverse References)
             // (If restored via a "Many-to" expansion)
             ////////////////////////////
         ////////////////////////////
         // Virtual Object References (Many to Many and Reverse References)
         // (If restored via a "Many-to" expansion)
         ////////////////////////////
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }