From: vincent@cubedesigners.com Date: Fri, 3 Jun 2011 13:24:20 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=376ee5f46e388fb3dd3451dd543802bc9839f983;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 2293b7f58..1e70e4bbb 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -37,7 +37,7 @@ class wsUrl { cubePage::contextMenu(); $droits = wsDroits::getDroits(); - + fb(microtime(true)); commonDroits::min(1); @@ -57,7 +57,7 @@ class wsUrl { $res .= self::contextBookDownload($context_download_id); $res .= self::contextBookStatus($context_status_id); - + fb(microtime(true)); $res .= ''; @@ -88,7 +88,7 @@ class wsUrl { if ($droits->creation) { $btDel = cubeMedia::cssRollover($core->typo->Supprimer('suppr.', '', false)); } - + fb(microtime(true)); foreach ($liste as $id => $book) { @@ -120,7 +120,7 @@ class wsUrl { } else if ($book->status > 1) { $res .= ''; } - $res.=''; + $res.=''; } if ($book->version > 1 || $droits->admin) { $res .= ''; @@ -140,9 +140,9 @@ class wsUrl { $res .= ''; $i++; } - + fb(microtime(true)); - + if (!isset($settings['search']) || is_null($settings['search'])) { $odd = cubeMath::isOdd($i) ? ' class="odd"' : ''; $res .= '
' . $core->books_status[1] . ''.$book->version.'' . $book->version . '' . $btVoir . '
'; @@ -249,7 +249,13 @@ class wsUrl { $dao = new wsDAOLang($core->con); $lang = $dao->selectById($lang_id); - $res = '
'; + $res = commonPage::bh(); + $res .= ''; + $res .= ''; + $res .= '
' . __('Exporter au format Excel') . '
'; + $res .= commonPage::bf(); + + $res .= ''; $res .= commonPage::bh(); $res .= ''; @@ -260,6 +266,8 @@ class wsUrl { $res .= '
'; $res .= commonPage::bf(); + + $res .= commonPage::bh(); $res .= cubeLang::translationForm(PLAYER_SOURCES, $lang_id, null, 'liste', array(), '' . $core->typo->Ajouter(__('Enregistrer')) . '', $lang->traductions); $res .= commonPage::bf(); @@ -267,6 +275,55 @@ class wsUrl { return $res; } + 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 = $dao->selectById($lang_id); + $en = $dao->selectById('en'); + + + $tab = cubeLang::getTranslationsList(PLAYER_SOURCES, array('php', 'as'), array(), $lang->traductions); + fb($tab); + + $s->setCellValueByColumnAndRow(0, 1, 'ID', true); + $s->setCellValueByColumnAndRow(1, 1, 'English', 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(2, $j, $msgstr); + $j++; + } + + $s->getColumnDimensionByColumn(0)->setAutoSize(true); + $s->getColumnDimensionByColumn(1)->setAutoSize(true); + $s->getColumnDimensionByColumn(2)->setAutoSize(true); + + $xls->setActiveSheetIndex(0); + + //return; + + 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 getFonts() { $formats = array('ttf', 'otf', 'TTF', 'OTF');