コード例 #1
0
 public function ExportFile($objFile, $strTemplateFile, $strTranslatedFile)
 {
     if (!$objFile instanceof NarroFile) {
         NarroLogger::LogWarn(sprintf('Failed to find a corresponding file in the database for %s', $strTemplateFile));
         return false;
     }
     if (NarroFileProgress::CountByFileIdLanguageIdExport($objFile->FileId, $this->objTargetLanguage->LanguageId, 0)) {
         NarroLogger::LogWarn(sprintf('Not exporting %s based on the file settings.', $strTemplateFile));
         return false;
     }
     $objFileImporter = NarroFileType::GetFileImporter($objFile->TypeId, $this);
     // NarroLogger::LogDebug( sprintf( t('Starting to export "%s"'), str_replace($this->objProject->DefaultTranslationPath, '', $strTranslatedFile) ) );
     $objFileImporter->File = $objFile;
     QApplication::$PluginHandler->BeforeExportFile($objFile, $strTemplateFile, $strTranslatedFile);
     $blnMixResult = $objFileImporter->ExportFile($strTemplateFile, $strTranslatedFile);
     if (file_exists($strTranslatedFile)) {
         QApplication::$PluginHandler->AfterExportFile($objFile, $strTemplateFile, $strTranslatedFile);
     }
     $this->arrFileId[$objFile->FileId] = 1;
     return $blnMixResult;
 }
コード例 #2
0
 public function dtgFile_colSettings_Render(NarroFileProgress $objProgress)
 {
     if ($objProgress->File->TypeId == NarroFileType::Folder) {
         return '';
     }
     $strControlId = 'chkExport' . $objProgress->FileId;
     $chkExport = $this->dtgFile->GetChildControl($strControlId);
     if (!$chkExport) {
         $chkExport = new QCheckBox($this->dtgFile, $strControlId);
         $chkExport->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'chkExport_Click'));
         $chkExport->Name = t('Export with project');
         $chkExport->ToolTip = t('If ticked, this file will be exported when doing a project export. Useful for excluding some files from the project export.');
     }
     $chkExport->ActionParameter = $objProgress->File->FileId;
     $chkExport->Checked = NarroFileProgress::CountByFileIdLanguageIdExport($objProgress->File->FileId, QApplication::GetLanguageId(), 1);
     $chkExport->Display = QApplication::HasPermission('Can export project', $this->objProject->ProjectId, QApplication::GetLanguageId());
     return $chkExport->RenderWithName(false);
 }