From: vincent@cubedesigners.com Date: Wed, 13 Jul 2011 13:05:17 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=dc79c0dea6149b0573a927febc8b25e66a7c5a5e;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index b26006b94..51aa71767 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -168,7 +168,7 @@ class wsAjax extends cubeAjax { global $core; $dao = new wsDAOBook($core->con); if ($_POST['book'] != '') { - $book = $dao->duplicate($_POST['book'], $core->user->utilisateur_id, $_POST['title']); + $book = $dao->duplicate($_POST['book'], $core->user->utilisateur_id, $_POST['title'],isset($_POST['pages'])); } else { $book = $dao->creeEmpty($core->user->utilisateur_id, $core->user->lang, $_POST['title']); } diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index f8fb2f216..78e1e3093 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -245,7 +245,9 @@ class wsUrl { $res = commonPage::bh(); $res .= ''; - $res .= ''; + $res .= ''; $res .= '
' . __('Exporter au format Excel') . '
' . __('Exporter au format Excel') . ''; + $res.=' | ' . __('Exporter toutes les langues au format Excel') . ''; + $res.='
'; $res .= commonPage::bf(); @@ -272,30 +274,83 @@ class wsUrl { public static function exportLangAsExcel($args) { global $core; - $dao = new wsDAOLang($core->con); - $lang_id = $args[1]; - $lang_name = cubeLang::getNameByCode($lang_id, 'en'); $xls = new PHPExcel(); $s = $xls->setActiveSheetIndex(0); - $s->setTitle($lang_name); + + $lang_name = self::exportLangAsSheet($s, $lang_id, 'en'); + + $xls->setActiveSheetIndex(0); + + ob_end_clean(); + files::registerMimeTypes(array('xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')); + cubeHTTP::forceDownload('Fluidbook_' . $lang_name . '.xlsx', false); + + $writer = new PHPExcel_Writer_Excel2007($xls); + $writer->save('php://output'); + + exit; + } + + public static function exportAllLangsAsExcel($args) { + global $core; + + $xls = new PHPExcel(); + + $dao = new wsDAOLang($core->con); + $all = $dao->selectAll(); + + $i = 0; + foreach ($all as $l) { + try { + $s = $xls->getSheet($i); + } catch (Exception $e) { + $s = $xls->createSheet($i); + } + self::exportLangAsSheet($s, $l->lang_id, 'en'); + $i++; + } + + $xls->setActiveSheetIndex(0); + + ob_end_clean(); + files::registerMimeTypes(array('xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')); + cubeHTTP::forceDownload('Fluidbook_All_Languages.xlsx', false); + + $writer = new PHPExcel_Writer_Excel2007($xls); + $writer->save('php://output'); + } + + public static function exportLangAsSheet($s, $lang_id, $ref_id='en') { + global $core; + $dao = new wsDAOLang($core->con); + $lang = $dao->selectById($lang_id); - $en = $dao->selectById('en'); + $ref = $dao->selectById($ref_id); + $lang_name = cubeLang::getNameByCode($lang_id, 'en'); + $ref_name = cubeLang::getNameByCode($ref_id, 'en'); + + $s->setTitle(cubeText::str2URL($lang_name)); $tab = cubeLang::getTranslationsList(PLAYER_SOURCES, array('php', 'as'), array(), $lang->traductions); $s->setCellValueByColumnAndRow(0, 1, 'ID', true); - $s->setCellValueByColumnAndRow(1, 1, 'English', true); + $s->setCellValueByColumnAndRow(1, 1, $ref_name, true); $s->setCellValueByColumnAndRow(2, 1, $lang_name, true); $j = 2; foreach ($tab as $msgid => $msgstr) { $s->setCellValueByColumnAndRow(0, $j, $msgid); - $s->setCellValueByColumnAndRow(1, $j, $en->traductions[$msgid]); + $s->setCellValueByColumnAndRow(1, $j, $ref->traductions[$msgid]); $s->setCellValueByColumnAndRow(2, $j, $msgstr); + + if ($msgstr == '') { + $s->getStyleByColumnAndRow(2, $j)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID); + $s->getStyleByColumnAndRow(2, $j)->getFill()->getStartColor()->setARGB('FFFFFF00'); + } $j++; } @@ -303,16 +358,7 @@ class wsUrl { $s->getColumnDimensionByColumn(1)->setAutoSize(true); $s->getColumnDimensionByColumn(2)->setAutoSize(true); - $xls->setActiveSheetIndex(0); - - ob_end_clean(); - files::registerMimeTypes(array('xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')); - cubeHTTP::forceDownload('Fluidbook_' . $lang_name . '.xlsx', false); - - $writer = new PHPExcel_Writer_Excel2007($xls); - $writer->save('php://output'); - - exit; + return $lang_name; } public static function getFonts() { @@ -726,10 +772,11 @@ html{height:100%}' . "\n"; public static function chooseExistingBook() { wsDroits::creation(true); - $res = '

' . __("Si votre nouvelle publication a des paramètres en commun avec une publication existante, veuillez rechercher cette publication afin d'attribuer par défaut à votre nouvelle publication les paramètres de l'existante") . '

'; + $res = '

a' . __("Si votre nouvelle publication a des paramètres en commun avec une publication existante, veuillez rechercher cette publication afin d'attribuer par défaut à votre nouvelle publication les paramètres de l'existante") . '

'; $res .= '' . __('Rechercher une publication') . ' : ' . form::field('book_nom', 64, 1024) . form::hidden('book', '') . ''; - // $res .= '
'; $res .= '' . __('Indiquez le titre de votre nouvelle publication') . '' . form::field('title', 64, 1024) . ''; + $res .= '