示例#1
0
 public function export()
 {
     $postsList = $this->loadTopic($this->getTopicId());
     $topicInfo = get_topic_settings($this->getTopicId());
     $css = $this->importCss();
     $form = new PhpTemplate(get_module_path('CLFRM') . '/templates/forum_export.tpl.php');
     $form->assign('forum_id', $topicInfo['forum_id']);
     $form->assign('topic_id', $topicInfo['topic_id']);
     $form->assign('notification_bloc', false);
     $form->assign('topic_subject', $topicInfo['topic_title']);
     $form->assign('postList', $postsList);
     $form->assign('claro_notifier', false);
     $form->assign('is_allowedToEdit', false);
     $form->assign('date', null);
     $out = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n" . '<html>' . "\n" . '<head>' . "\n" . '<meta http-equiv="Content-Type" content="text/HTML; charset=' . get_conf('charset') . '"  />' . "\n" . '<style type="text/css">' . $css . '</style>' . "\n" . '<title>' . $topicInfo['topic_title'] . '</title>' . "\n" . '</head>' . "\n" . '<body><div id="forumExport">' . "\n";
     $out .= $form->render();
     $out .= '</div></body>' . "\n" . '</html>';
     $path = get_conf('rootSys') . get_conf('tmpPathSys') . '/forum_export/';
     $filename = $path . replace_dangerous_char(str_replace(' ', '_', $topicInfo['topic_title']) . '_' . $topicInfo['topic_id']) . '.html';
     claro_mkdir($path);
     file_put_contents($filename, $out);
     switch ($this->output) {
         case 'screen':
             header('Content-Description: File Transfer');
             header('Content-Type: application/force-download');
             header('Content-Length: ' . filesize($filename));
             header('Content-Disposition: attachment; filename=' . basename($filename));
             readfile($filename);
             claro_delete_file($filename);
             break;
         case 'file':
             break;
     }
     return true;
 }
示例#2
0
<?php

// $Id: help_document.php 11782 2009-05-25 13:02:05Z dimitrirambout $
require '../inc/claro_init_global.inc.php';
$nameTools = get_lang('Documents help');
$hide_banner = true;
$hide_footer = true;
$out = '';
$tpl = new PhpTemplate(get_path('incRepositorySys') . '/templates/help_document.tpl.php');
$out .= $tpl->render();
$claroline->setDisplayType(Claroline::POPUP);
$claroline->display->body->appendContent($out);
echo $claroline->display->render();
示例#3
0
文件: document.php 项目: rhertzog/lcs
 /*------------------------------------------------------------------------
                         CREATE DOCUMENT : STEP 1
   ------------------------------------------------------------------------*/
 // see rqmkhtml.php ...
 /*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
                          EDIT DOCUMENT CONTENT
   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
 // TODO use the same code as exMkHml
 if ('exEditHtml' == $cmd) {
     $_REQUEST['file'] = secure_file_path($_REQUEST['file']);
     $fp = fopen($baseWorkDir . $_REQUEST['file'], 'w');
     if ($fp) {
         $htmlContent = claro_parse_user_text($_REQUEST['htmlContent']);
         $template = new PhpTemplate(get_path('incRepositorySys') . '/templates/document_create.tpl.php');
         $template->assign('content', $htmlContent);
         $htmlContent = $template->render();
         if (fwrite($fp, $htmlContent)) {
             $eventNotifier->notifyCourseEvent('document_htmlfile_edited', claro_get_current_course_id(), claro_get_current_tool_id(), $_REQUEST['file'], claro_get_current_group_id(), "0");
             $dialogBox->success(get_lang('File content modified'));
         }
     }
 }
 /*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
                                CREATE URL
   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */
 /*
  * The code begins with STEP 2
  * so it allows to return to STEP 1 if STEP 2 unsucceeds
  */
 /*------------------------------------------------------------------------
                             CREATE URL : STEP 2