protected function Form_Create() { parent::Form_Create(); $this->pnlTab = new QTabs($this); $pnlDummy = new QPanel($this->pnlTab); $pnlDummy = new QPanel($this->pnlTab); $pnlDummy = new QPanel($this->pnlTab); $arrHeaders = array(NarroLink::ProjectList(t('Projects')), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_ALL, '', 0, 0, 10, 0, 0, t('Translate')), NarroLink::Translate(0, '', NarroTranslatePanel::SHOW_NOT_APPROVED, '', 0, 0, 10, 0, 0, t('Review'))); /** * Do not show the langauge tab if only two languages are active (source and target * Unless the user is an administrator and might want to set another one active */ if (NarroLanguage::CountAllActive() > 2 || QApplication::HasPermission('Administrator')) { $this->pnlLanguageTab = new QTabs($this->pnlTab); $pnlDummy = new QPanel($this->pnlLanguageTab); $arrLangHeaders[] = t('List'); if (QApplication::HasPermissionForThisLang('Can add language')) { $this->pnlLanguageEdit = new NarroLanguageEditPanel($this->pnlLanguageTab, NarroLanguage::Load(QApplication::QueryString('lid'))); $arrLangHeaders[] = QApplication::QueryString('lid') ? t('Edit') : t('Add'); } $this->pnlLanguageTab->Headers = $arrLangHeaders; $this->pnlLanguageTab->Selected = 1; $arrHeaders[] = t('Languages'); $this->pnlTab->Selected = count($arrHeaders) - 1; } $pnlDummy = new QPanel($this->pnlTab); $arrHeaders[] = NarroLink::UserList('', t('Users')); $pnlDummy = new QPanel($this->pnlTab); $arrHeaders[] = NarroLink::RoleList(0, '', t('Roles')); if (QApplication::HasPermissionForThisLang('Administrator')) { $pnlDummy = new QPanel($this->pnlTab); $arrHeaders[] = NarroLink::Log('', t('Application Log')); } $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 '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; } } }
/** * 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 'ProjectProgressId': /** * Gets the value for intProjectProgressId (Read-Only PK) * @return integer */ return $this->intProjectProgressId; case 'ProjectId': /** * Gets the value for intProjectId (Not Null) * @return integer */ return $this->intProjectId; case 'LanguageId': /** * Gets the value for intLanguageId (Not Null) * @return integer */ return $this->intLanguageId; case 'Active': /** * Gets the value for blnActive * @return boolean */ return $this->blnActive; case 'LastModified': /** * Gets the value for dttLastModified (Not Null) * @return QDateTime */ return $this->dttLastModified; case 'TotalTextCount': /** * Gets the value for intTotalTextCount (Not Null) * @return integer */ return $this->intTotalTextCount; case 'FuzzyTextCount': /** * Gets the value for intFuzzyTextCount (Not Null) * @return integer */ return $this->intFuzzyTextCount; case 'ApprovedTextCount': /** * Gets the value for intApprovedTextCount (Not Null) * @return integer */ return $this->intApprovedTextCount; case 'ProgressPercent': /** * Gets the value for intProgressPercent (Not Null) * @return integer */ return $this->intProgressPercent; case 'Data': /** * Gets the value for strData * @return string */ return $this->strData; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Project': /** * Gets the value for the NarroProject object referenced by intProjectId (Not Null) * @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 (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 '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
public function btnTmx_Click($strFormId, $strControlId, $intLanguageId) { set_time_limit(0); $objLanguage = NarroLanguage::Load($intLanguageId); if (!$objLanguage) { return false; } header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); // required for certain browsers header("Content-Type: text/xml"); header("Content-Disposition: attachment; filename=\"" . sprintf('%s %s.tmx', preg_replace('/^[a-z]/i', '_', __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__), $objLanguage->LanguageName) . "\";"); ob_clean(); $strXml = NarroLanguage::GetTmx(QQ::Equal(QQN::NarroText()->NarroSuggestionAsText->LanguageId, $intLanguageId)); header("Content-Length: " . strlen($strXml)); echo $strXml; exit; }
/** * Reload this NarroLanguage 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 NarroLanguage object.'); } $this->DeleteCache(); // Reload the Object $objReloaded = NarroLanguage::Load($this->intLanguageId); // Update $this's local variables to match $this->strLanguageName = $objReloaded->strLanguageName; $this->strLanguageCode = $objReloaded->strLanguageCode; $this->strCountryCode = $objReloaded->strCountryCode; $this->strDialectCode = $objReloaded->strDialectCode; $this->strEncoding = $objReloaded->strEncoding; $this->strTextDirection = $objReloaded->strTextDirection; $this->strSpecialCharacters = $objReloaded->strSpecialCharacters; $this->strPluralForm = $objReloaded->strPluralForm; $this->blnActive = $objReloaded->blnActive; }
/** * 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 NarroLanguageMetaControl * @param integer $intLanguageId primary key value * @param QMetaControlCreateType $intCreateType rules governing NarroLanguage object creation - defaults to CreateOrEdit * @return NarroLanguageMetaControl */ public static function Create($objParentObject, $intLanguageId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intLanguageId)) { $objNarroLanguage = NarroLanguage::Load($intLanguageId); // NarroLanguage was found -- return it! if ($objNarroLanguage) { return new NarroLanguageMetaControl($objParentObject, $objNarroLanguage); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a NarroLanguage object with PK arguments: ' . $intLanguageId); } } // 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 NarroLanguageMetaControl($objParentObject, new NarroLanguage()); }
* Copyright (C) 2008-2011 Alexandru Szasz <*****@*****.**> * 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'; QApplication::$TargetLanguage = NarroLanguage::Load(QApplication::QueryString('l')); if (QApplication::QueryString('p')) { $objProject = NarroProject::Load(QApplication::QueryString('p')); } switch (QApplication::QueryString('t')) { case 'suggestion': if (isset($objProject) && $objProject instanceof NarroProject) { $strCacheId = sprintf('rssfeed_suggestion_%d_%d', $objProject->ProjectId, QApplication::QueryString('l')); } else { $strCacheId = sprintf('rssfeed_suggestion_%d', QApplication::QueryString('l')); } if (!($objRssFeed = QApplication::$Cache->load($strCacheId))) { if (isset($objProject) && $objProject instanceof NarroProject) { $objRssFeed = new QRssFeed(sprintf(t('Translations for %s'), $objProject->ProjectName), __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__, sprintf(t('Get the latest translation suggestions in %s for %s'), t(QApplication::$TargetLanguage->LanguageName), $objProject->ProjectName)); } else { $objRssFeed = new QRssFeed(sprintf(t('Translations for all projects'), t(QApplication::$TargetLanguage->LanguageName)), __HTTP_URL__ . __VIRTUAL_DIRECTORY__ . __SUBDIRECTORY__, sprintf(t('Get the latest translation suggestions in %s'), t(QApplication::$TargetLanguage->LanguageName)));
/** * 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 'FileProgressId': /** * Gets the value for intFileProgressId (Read-Only PK) * @return integer */ return $this->intFileProgressId; case 'FileId': /** * Gets the value for intFileId (Not Null) * @return integer */ return $this->intFileId; case 'LanguageId': /** * Gets the value for intLanguageId (Not Null) * @return integer */ return $this->intLanguageId; case 'FileMd5': /** * Gets the value for strFileMd5 * @return string */ return $this->strFileMd5; case 'Header': /** * Gets the value for strHeader * @return string */ return $this->strHeader; case 'TotalTextCount': /** * Gets the value for intTotalTextCount (Not Null) * @return integer */ return $this->intTotalTextCount; case 'ApprovedTextCount': /** * Gets the value for intApprovedTextCount (Not Null) * @return integer */ return $this->intApprovedTextCount; case 'FuzzyTextCount': /** * Gets the value for intFuzzyTextCount (Not Null) * @return integer */ return $this->intFuzzyTextCount; case 'ProgressPercent': /** * Gets the value for intProgressPercent (Not Null) * @return integer */ return $this->intProgressPercent; case 'Export': /** * Gets the value for blnExport * @return boolean */ return $this->blnExport; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'File': /** * Gets the value for the NarroFile object referenced by intFileId (Not Null) * @return NarroFile */ try { if (!$this->objFile && !is_null($this->intFileId)) { $this->objFile = NarroFile::Load($this->intFileId); } return $this->objFile; } 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 '__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 '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; } } }