use DOMDocument;
use DOMElement;
use DOMXPath;
+use Exception;
use Fluidbook\Tools\Compiler\CompilerInterface;
use Fluidbook\Tools\SVG\SVGTools;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
+use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
+use PhpOffice\PhpSpreadsheet\Spreadsheet;
use SimpleXMLElement;
use SplFileInfo;
$file = $this->wdir . '/' . $this->fluidbookSettings->audiodescriptionTexts;
if (file_exists($file)) {
- new PHPExcel();
- $reader = new PHPExcel_Reader_Excel2007();
+ $reader = new Xlsx();
$phpexcel = $reader->load($file);
$sheet = $phpexcel->getActiveSheet();
- $maxRow = $sheet->getHighestRow(0);
+ $maxRow = $sheet->getHighestRow('A');
for ($i = 0; $i <= $maxRow; $i++) {
- $page = trim($sheet->getCellByColumnAndRow(0, $i)->getValue());
- $text = trim($sheet->getCellByColumnAndRow(1, $i)->getValue());
- $voice = trim($sheet->getCellByColumnAndRow(2, $i)->getValue());
+ $page = trim($sheet->getCell('A' . $i)->getValue());
+ $text = trim($sheet->getCell('B' . $i)->getValue());
+ $voice = trim($sheet->getCell('C' . $i)->getValue());
if ($page == '' || $text == '') {
continue;
}
}
}
- $this->config->audiodescription[$page] = $fname;
+ $this->config->set('audiodescription.' . $page, $fname);
$this->vdir->copy($file, 'data/audiodescription/' . $fname);
}
$this->accessibleTexts[$page] = $text;
try {
$api = new \Cubist\Azure\TTS\Api('28fdfcdcc7f141b29cd9db4afc5779c5');
$api->textToSpeech($text, $locale, $gender, $voiceName, $output);
+ if (!file_exists($output)) {
+ throw new Exception('Error while making tts (' . $output . ') : ' . $text . ', ' . $locale . ', ' . $gender . ', ' . $voiceName);
+ }
} catch (Exception $e) {
dd($e);
}
protected function _getMultilangOptions($fluidbooks)
{
- $defaultFlags = ['en' => 'gb', 'sv' => 'se', 'zh' => 'cn', 'el' => 'gr'];
+ $defaultFlags = ['en' => 'gb', 'sv' => 'se', 'zh' => 'cn', 'el' => 'gr', 'ja' => 'jp', 'ko' => 'kr'];
$multilang = [];
foreach ($fluidbooks as $fbid => $publication) {
$days = 15;
$limit = time() - (3600 * 24 * $days);
- $directoriesToClean = [protected_path('signedexe/')];
+ $directoriesToClean = [protected_path('signedexe/'),protected_path('fluidbookpublication/packager'),protected_path('fluidbookpublication/packager/download')];
$types = ['elearningmedia', 'elearningpackage', 'quiz', 'fluidbookcollection', 'fluidbookpublication'];
foreach ($types as $type) {
'column_type' => 'model_function',
'column_function_name' => 'getTitleForColumn',
'column_move_after' => 'id',
- 'column_limit' => 150,
+ 'column_limit' => 500,
'column_escape' => false,
],
'c_pages' => [
if ($this->mobileNavigationType === 'mobilefirst') {
$more .= ' <i class="fluidbook-title-icon las la-mobile"></i>';
}
- return '<span style="white-space: normal;">' . e($this->c_title) . $more . '</span>';
+ return '<span style="white-space: normal;">' . e(trim($this->c_title, ' -')) . $more . '</span>';
}
public function allowsDownload()