예제 #1
0
파일: log.php 프로젝트: Jobava/narro
 protected function Form_Create()
 {
     parent::Form_Create();
     if (!QApplication::HasPermissionForThisLang('Administrator')) {
         QApplication::Redirect(NarroLink::ProjectList());
     }
     $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('Review'));
     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'));
     $pnlDummy = new QPanel($this->pnlTab);
     $arrHeaders[] = NarroLink::RoleList(0, '', t('Roles'));
     if (QApplication::HasPermissionForThisLang('Administrator')) {
         $this->pnlLog = new QPanel($this->pnlTab);
         $this->pnlLog->AutoRenderChildren = true;
         $btnClearLog = new QButton($this->pnlLog);
         $btnClearLog->Text = t('Clear the log');
         $btnClearLog->AddAction(new QClickEvent(), new QConfirmAction(t('Are you sure you want to delete all the logged messages?')));
         $btnClearLog->AddAction(new QClickEvent(), new QAjaxAction('btnClearLog_Click'));
         $this->dtgLog = new NarroLogDataGrid($this->pnlLog);
         // Datagrid Paginator
         $this->dtgLog->Paginator = new QPaginator($this->dtgLog);
         $this->dtgLog->PaginatorAlternate = new QPaginator($this->dtgLog);
         $this->dtgLog->ItemsPerPage = QApplication::$User->GetPreferenceValueByName('Items per page');
         $this->dtgLog->SortColumnIndex = 0;
         $this->dtgLog->SortDirection = 1;
         $colDate = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Date);
         $colDate->OrderByClause = QQ::OrderBy(QQN::NarroLog()->LogId);
         $colDate->ReverseOrderByClause = QQ::OrderBy(QQN::NarroLog()->LogId, 0);
         if (QApplication::HasPermission('Administrator')) {
             $colLanguage = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Language->LanguageName);
             $colLanguage->Filter = null;
             $colLanguage->FilterAddListItem(t('-Not set-'), QQ::IsNull(QQN::NarroLog()->LanguageId));
             foreach (NarroLanguage::LoadAll(QQ::OrderBy(QQN::NarroLanguage()->LanguageName)) as $objLanguage) {
                 $colLanguage->FilterAddListItem($objLanguage->LanguageName, QQ::Equal(QQN::NarroLog()->LanguageId, $objLanguage->LanguageId));
             }
         } else {
             $this->dtgLog->AdditionalConditions = QQ::Equal(QQN::NarroLog()->LanguageId, QApplication::GetLanguageId());
         }
         $colProject = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Project->ProjectName);
         $colProject->Filter = null;
         $colProject->FilterAddListItem(t('-Not set-'), QQ::IsNull(QQN::NarroLog()->ProjectId));
         foreach (NarroProject::LoadAll(QQ::OrderBy(QQN::NarroProject()->ProjectName)) as $objProject) {
             $colProject->FilterAddListItem($objProject->ProjectName, QQ::Equal(QQN::NarroLog()->ProjectId, $objProject->ProjectId));
         }
         $colUser = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->User->Username);
         $colUser->Html = '<?=(($_ITEM->UserId)?NarroLink::UserProfile($_ITEM->UserId, $_ITEM->User->Username):"")?>';
         $colUser->HtmlEntities = false;
         $colPriority = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Priority);
         $colPriority->Name = 'P';
         $colPriority->Width = 16;
         $colPriority->FilterBoxSize = 1;
         $colPriority->HtmlEntities = false;
         $colMessage = $this->dtgLog->MetaAddColumn(QQN::NarroLog()->Message);
         $colMessage->HtmlEntities = false;
         $colMessage->Html = '<?=$_FORM->dtgLog_colMessage_Render($_ITEM)?>';
         $arrHeaders[] = NarroLink::Log('', t('Application Log'));
         $this->pnlTab->Selected = count($arrHeaders) - 1;
     }
     $this->pnlTab->Headers = $arrHeaders;
 }
예제 #2
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;
     }
 }
 /**
  * Refresh this MetaControl with Data from the local NarroProjectProgress object.
  * @param boolean $blnReload reload NarroProjectProgress from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objNarroProjectProgress->Reload();
     }
     if ($this->lblProjectProgressId) {
         if ($this->blnEditMode) {
             $this->lblProjectProgressId->Text = $this->objNarroProjectProgress->ProjectProgressId;
         }
     }
     if ($this->lstProject) {
         $this->lstProject->RemoveAllItems();
         if (!$this->blnEditMode) {
             $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->objNarroProjectProgress->Project && $this->objNarroProjectProgress->Project->ProjectId == $objProject->ProjectId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstProject->AddItem($objListItem);
             }
         }
     }
     if ($this->lblProjectId) {
         $this->lblProjectId->Text = $this->objNarroProjectProgress->Project ? $this->objNarroProjectProgress->Project->__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->objNarroProjectProgress->Language && $this->objNarroProjectProgress->Language->LanguageId == $objLanguage->LanguageId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstLanguage->AddItem($objListItem);
             }
         }
     }
     if ($this->lblLanguageId) {
         $this->lblLanguageId->Text = $this->objNarroProjectProgress->Language ? $this->objNarroProjectProgress->Language->__toString() : null;
     }
     if ($this->chkActive) {
         $this->chkActive->Checked = $this->objNarroProjectProgress->Active;
     }
     if ($this->lblActive) {
         $this->lblActive->Text = $this->objNarroProjectProgress->Active ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->calLastModified) {
         $this->calLastModified->DateTime = $this->objNarroProjectProgress->LastModified;
     }
     if ($this->lblLastModified) {
         $this->lblLastModified->Text = sprintf($this->objNarroProjectProgress->LastModified) ? $this->objNarroProjectProgress->LastModified->qFormat($this->strLastModifiedDateTimeFormat) : null;
     }
     if ($this->txtTotalTextCount) {
         $this->txtTotalTextCount->Text = $this->objNarroProjectProgress->TotalTextCount;
     }
     if ($this->lblTotalTextCount) {
         $this->lblTotalTextCount->Text = $this->objNarroProjectProgress->TotalTextCount;
     }
     if ($this->txtFuzzyTextCount) {
         $this->txtFuzzyTextCount->Text = $this->objNarroProjectProgress->FuzzyTextCount;
     }
     if ($this->lblFuzzyTextCount) {
         $this->lblFuzzyTextCount->Text = $this->objNarroProjectProgress->FuzzyTextCount;
     }
     if ($this->txtApprovedTextCount) {
         $this->txtApprovedTextCount->Text = $this->objNarroProjectProgress->ApprovedTextCount;
     }
     if ($this->lblApprovedTextCount) {
         $this->lblApprovedTextCount->Text = $this->objNarroProjectProgress->ApprovedTextCount;
     }
     if ($this->txtProgressPercent) {
         $this->txtProgressPercent->Text = $this->objNarroProjectProgress->ProgressPercent;
     }
     if ($this->lblProgressPercent) {
         $this->lblProgressPercent->Text = $this->objNarroProjectProgress->ProgressPercent;
     }
     if ($this->txtData) {
         $this->txtData->Text = $this->objNarroProjectProgress->Data;
     }
     if ($this->lblData) {
         $this->lblData->Text = $this->objNarroProjectProgress->Data;
     }
 }
 /**
  * Refresh this MetaControl with Data from the local NarroFileProgress object.
  * @param boolean $blnReload reload NarroFileProgress from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objNarroFileProgress->Reload();
     }
     if ($this->lblFileProgressId) {
         if ($this->blnEditMode) {
             $this->lblFileProgressId->Text = $this->objNarroFileProgress->FileProgressId;
         }
     }
     if ($this->lstFile) {
         $this->lstFile->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstFile->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objFileArray = NarroFile::LoadAll();
         if ($objFileArray) {
             foreach ($objFileArray as $objFile) {
                 $objListItem = new QListItem($objFile->__toString(), $objFile->FileId);
                 if ($this->objNarroFileProgress->File && $this->objNarroFileProgress->File->FileId == $objFile->FileId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstFile->AddItem($objListItem);
             }
         }
     }
     if ($this->lblFileId) {
         $this->lblFileId->Text = $this->objNarroFileProgress->File ? $this->objNarroFileProgress->File->__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->objNarroFileProgress->Language && $this->objNarroFileProgress->Language->LanguageId == $objLanguage->LanguageId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstLanguage->AddItem($objListItem);
             }
         }
     }
     if ($this->lblLanguageId) {
         $this->lblLanguageId->Text = $this->objNarroFileProgress->Language ? $this->objNarroFileProgress->Language->__toString() : null;
     }
     if ($this->txtFileMd5) {
         $this->txtFileMd5->Text = $this->objNarroFileProgress->FileMd5;
     }
     if ($this->lblFileMd5) {
         $this->lblFileMd5->Text = $this->objNarroFileProgress->FileMd5;
     }
     if ($this->txtHeader) {
         $this->txtHeader->Text = $this->objNarroFileProgress->Header;
     }
     if ($this->lblHeader) {
         $this->lblHeader->Text = $this->objNarroFileProgress->Header;
     }
     if ($this->txtTotalTextCount) {
         $this->txtTotalTextCount->Text = $this->objNarroFileProgress->TotalTextCount;
     }
     if ($this->lblTotalTextCount) {
         $this->lblTotalTextCount->Text = $this->objNarroFileProgress->TotalTextCount;
     }
     if ($this->txtApprovedTextCount) {
         $this->txtApprovedTextCount->Text = $this->objNarroFileProgress->ApprovedTextCount;
     }
     if ($this->lblApprovedTextCount) {
         $this->lblApprovedTextCount->Text = $this->objNarroFileProgress->ApprovedTextCount;
     }
     if ($this->txtFuzzyTextCount) {
         $this->txtFuzzyTextCount->Text = $this->objNarroFileProgress->FuzzyTextCount;
     }
     if ($this->lblFuzzyTextCount) {
         $this->lblFuzzyTextCount->Text = $this->objNarroFileProgress->FuzzyTextCount;
     }
     if ($this->txtProgressPercent) {
         $this->txtProgressPercent->Text = $this->objNarroFileProgress->ProgressPercent;
     }
     if ($this->lblProgressPercent) {
         $this->lblProgressPercent->Text = $this->objNarroFileProgress->ProgressPercent;
     }
     if ($this->chkExport) {
         $this->chkExport->Checked = $this->objNarroFileProgress->Export;
     }
     if ($this->lblExport) {
         $this->lblExport->Text = $this->objNarroFileProgress->Export ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
 }
 /**
  * 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;
     }
 }
 /**
  * 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;
     }
 }
예제 #7
0
 public function Save($blnForceInsert = false, $blnForceUpdate = false)
 {
     $blnNew = !$this->__blnRestored || $blnForceInsert;
     $objProjectProgress = NarroProjectProgress::LoadByProjectIdLanguageId($this->intProjectId, QApplication::GetLanguageId());
     if (is_array($this->arrPreferences)) {
         foreach ($this->arrPreferences as $strName => $strValue) {
             if (self::$AvailablePreferences[$strName]['global'] == false) {
                 if ($objProjectProgress) {
                     $objProjectProgress->SetPreferenceValueByName($strName, $strValue);
                 }
             } else {
                 $arrGlobalPreferences[$strName] = $strValue;
             }
         }
     }
     if (isset($arrGlobalPreferences)) {
         $this->strData = serialize($arrGlobalPreferences);
     }
     if ($objProjectProgress) {
         $objProjectProgress->Save();
     }
     $mixResult = parent::Save($blnForceInsert, $blnForceUpdate);
     if ($blnNew) {
         if (!file_exists(__IMPORT_PATH__ . '/' . $this->ProjectId)) {
             @mkdir(__IMPORT_PATH__ . '/' . $this->ProjectId, 0777, true);
             NarroUtils::RecursiveChmod(__IMPORT_PATH__ . '/' . $this->ProjectId);
         }
         if (!file_exists($this->DefaultTemplatePath)) {
             @mkdir($this->DefaultTemplatePath, 0777, true);
             NarroUtils::RecursiveChmod($this->DefaultTemplatePath);
         }
         foreach (NarroLanguage::LoadAll() as $objLanguage) {
             $objProjectProgress = new NarroProjectProgress();
             $objProjectProgress->LanguageId = $objLanguage->LanguageId;
             $objProjectProgress->ProjectId = $this->ProjectId;
             $objProjectProgress->Active = $this->Active;
             $objProjectProgress->TotalTextCount = 0;
             $objProjectProgress->ApprovedTextCount = 0;
             $objProjectProgress->FuzzyTextCount = 0;
             $objProjectProgress->ProgressPercent = 0;
             $objProjectProgress->Active = $this->Active;
             $objProjectProgress->LastModified = QDateTime::Now();
             $objProjectProgress->Save();
             if (!file_exists($this->DefaultTranslationPath)) {
                 @mkdir($this->DefaultTranslationPath, 0777, true);
             }
             NarroUtils::RecursiveChmod($this->DefaultTranslationPath, 0666, 0777);
         }
     }
     return $mixResult;
 }
 /**
  * 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;
     }
 }
 /**
  * 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;
     }
 }