Esempio n. 1
0
 protected function Form_Create()
 {
     parent::Form_Create();
     $this->pnlTab = new QTabPanel($this);
     $this->pnlTab->UseAjax = false;
     $this->pnlRoleTab = new QTabPanel($this->pnlTab);
     $this->pnlRoleEdit = new NarroRoleEditPanel($this->pnlRoleTab, NarroRole::Load(QApplication::QueryString('rid')));
     $this->pnlRoleTab->addTab(new QPanel($this->pnlRoleTab), t('List'), NarroLink::RoleList());
     $this->pnlRoleTab->addTab($this->pnlRoleEdit, QApplication::QueryString('lid') ? t('Edit') : t('Add'));
     $this->pnlTab->addTab(new QPanel($this->pnlTab), t('Projects'), NarroLink::ProjectList());
     $this->pnlTab->addTab(new QPanel($this->pnlTab), t('Translate'), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_ALL, '', 0, 0, 10, 0, 0));
     $this->pnlTab->addTab(new QPanel($this->pnlTab), t('Languages'), NarroLink::LanguageList());
     $this->pnlTab->addTab(new QPanel($this->pnlTab), t('Users'), NarroLink::UserList());
     $this->pnlTab->addTab($this->pnlRoleTab, t('Roles'));
     $this->pnlTab->SelectedTab = 4;
     $this->pnlRoleTab->SelectedTab = 1;
     $this->pnlTab = new QTabs($this);
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::ProjectList(t('Projects'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_TRANSLATED, '', 0, 0, 10, 0, 0, t('Translate'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::Review(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Translate'));
     if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::LanguageList(t('Languages'));
     }
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::UserList('', t('Users'));
     $this->pnlRoleTab = new QTabs($this->pnlTab);
     new QPanel($this->pnlRoleTab);
     $arrRoleHeaders[] = NarroLink::RoleList(0, '', t('List'));
     if (QApplication::HasPermissionForThisLang('Can add role')) {
         $pnlDummy = new NarroRoleEditPanel($this->pnlRoleTab, NarroRole::Load(QApplication::QueryString('rid')));
         $arrRoleHeaders[] = NarroLink::RoleEdit(null, t('Add'));
         $this->pnlRoleTab->Selected = count($arrRoleHeaders) - 1;
     }
     $this->pnlRoleTab->Headers = $arrRoleHeaders;
     $arrHeaders[] = t('Roles');
     $this->pnlTab->Selected = count($arrHeaders) - 1;
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         $pnlDummy = new QPanel($this->pnlTab);
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
Esempio n. 2
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 'UserRoleId':
             /**
              * Gets the value for intUserRoleId (Read-Only PK)
              * @return integer
              */
             return $this->intUserRoleId;
         case 'UserId':
             /**
              * Gets the value for intUserId (Not Null)
              * @return integer
              */
             return $this->intUserId;
         case 'RoleId':
             /**
              * Gets the value for intRoleId (Not Null)
              * @return integer
              */
             return $this->intRoleId;
         case 'ProjectId':
             /**
              * Gets the value for intProjectId 
              * @return integer
              */
             return $this->intProjectId;
         case 'LanguageId':
             /**
              * Gets the value for intLanguageId 
              * @return integer
              */
             return $this->intLanguageId;
             ///////////////////
             // Member Objects
             ///////////////////
         ///////////////////
         // Member Objects
         ///////////////////
         case 'User':
             /**
              * Gets the value for the NarroUser object referenced by intUserId (Not Null)
              * @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 'Role':
             /**
              * Gets the value for the NarroRole object referenced by intRoleId (Not Null)
              * @return NarroRole
              */
             try {
                 if (!$this->objRole && !is_null($this->intRoleId)) {
                     $this->objRole = NarroRole::Load($this->intRoleId);
                 }
                 return $this->objRole;
             } 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 '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;
             }
             ////////////////////////////
             // 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;
             }
     }
 }
Esempio n. 3
0
 public function btnEditRole_Click($strFormId, $strControlId, $strParameter)
 {
     if (is_numeric($strParameter)) {
         $btnEditRole = $this->Form->GetControl($strControlId);
         $txtEditRole = $this->Form->GetControl('txtEditRole' . $strParameter);
         $lblRoleName = $this->Form->GetControl('lblRoleName' . $strParameter);
         if ($btnEditRole->Text == t('Edit')) {
             $txtEditRole->DisplayStyle = QDisplayStyle::Inline;
             $lblRoleName->DisplayStyle = QDisplayStyle::None;
             $btnEditRole->Text = t('Save');
         } else {
             $txtEditRole->DisplayStyle = QDisplayStyle::None;
             $lblRoleName->DisplayStyle = QDisplayStyle::Inline;
             $objNarroRole = NarroRole::Load($strParameter);
             if ($objNarroRole->RoleName != $txtEditRole->Text) {
                 $objNarroRole->RoleName = $txtEditRole->Text;
                 $lblRoleName->Text = $txtEditRole->Text;
                 $objNarroRole->Save();
             }
             $btnEditRole->Text = t('Edit');
         }
         $this->dtgRole->MarkAsModified();
     } else {
         $this->dtgRole_Bind();
     }
 }
 /**
  * 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 NarroRoleMetaControl
  * @param integer $intRoleId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing NarroRole object creation - defaults to CreateOrEdit
  * @return NarroRoleMetaControl
  */
 public static function Create($objParentObject, $intRoleId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intRoleId)) {
         $objNarroRole = NarroRole::Load($intRoleId);
         // NarroRole was found -- return it!
         if ($objNarroRole) {
             return new NarroRoleMetaControl($objParentObject, $objNarroRole);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a NarroRole object with PK arguments: ' . $intRoleId);
             }
         }
         // 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 NarroRoleMetaControl($objParentObject, new NarroRole());
 }
Esempio n. 5
0
 /**
  * Reload this NarroRole 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 NarroRole object.');
     }
     $this->DeleteCache();
     // Reload the Object
     $objReloaded = NarroRole::Load($this->intRoleId);
     // Update $this's local variables to match
     $this->strRoleName = $objReloaded->strRoleName;
 }