Exemplo n.º 1
0
switch ($action) {
    case 'addglossary':
        $tool_name = get_lang('Add');
        break;
    case 'edit_glossary':
        $tool_name = get_lang('Edit');
        break;
    case 'import':
        $tool_name = get_lang('ImportGlossary');
        break;
    case 'changeview':
        $tool_name = get_lang('List');
        break;
}
if (isset($_GET['action']) && $_GET['action'] == 'export') {
    $data = GlossaryManager::get_glossary_data(0, GlossaryManager::get_number_glossary_terms(api_get_session_id()), 0, 'ASC');
    usort($data, "sorter");
    $list = array();
    $list[] = array('term', 'definition');
    foreach ($data as $line) {
        $list[] = array($line[0], $line[1]);
    }
    $filename = 'glossary_course_' . api_get_course_id();
    Export::export_table_csv_utf8($list, $filename);
}
if (isset($_GET['action']) && $_GET['action'] == 'export_to_pdf') {
    GlossaryManager::export_to_pdf();
}
Display::display_header($tool_name);
// Tool introduction
Display::display_introduction_section(TOOL_GLOSSARY);
Exemplo n.º 2
0
 /**
  *
  */
 public static function export_to_pdf()
 {
     $data = GlossaryManager::get_glossary_data(0, GlossaryManager::get_number_glossary_terms(api_get_session_id()), 0, 'ASC');
     $html = '<html><body>';
     $html .= '<h2>' . get_lang('Glossary') . '</h2><hr><br><br>';
     foreach ($data as $item) {
         $term = $item[0];
         $description = $item[1];
         $html .= '<h4>' . $term . '</h4><p>' . $description . '<p><hr>';
     }
     $html .= '</body></html>';
     $course_code = api_get_course_id();
     $pdf = new PDF();
     //$pdf->set_custom_header($title);
     /*$css_file = api_get_path(SYS_CODE_PATH).'css/print.css';
       if (file_exists($css_file)) {
           $css = @file_get_contents($css_file);
       } else {
           $css = '';
       }*/
     $pdf->content_to_pdf($html, '', get_lang('Glossary') . '_' . $course_code, $course_code);
 }
Exemplo n.º 3
0
 static function export_to_pdf()
 {
     $data = GlossaryManager::get_glossary_data(0, GlossaryManager::get_number_glossary_terms(api_get_session_id()), 0, 'ASC');
     $html = '<html><body>';
     $html .= '<h2>' . get_lang('Glossary') . '</h2><hr><br><br>';
     foreach ($data as $item) {
         $term = $item[0];
         $description = $item[1];
         $html .= '<h4>' . $term . '</h4><p>' . $description . '<p><hr>';
     }
     $html .= '</body></html>';
     $course_code = api_get_course_id();
     $pdf = new PDF();
     $css = null;
     $pdf->content_to_pdf($html, $css, get_lang('Glossary') . '_' . $course_code, $course_code);
 }