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; }
/** * Sets a variable and its value. * * The variable will be extracted to the local scope of the template with * the same name given as parameter to the method. So setting a variable * named "title" will result in a $title variable available to the template. * * The value can be a string, a number or a PhpTemplate instance. In the * latter case, the variable content will be the result of the whole parsed * template of the PhpTemplate instance. * * The proper method for setting arrays is setArray(). * * @since 1.1 * @param string $name Name of the variable. * @param string|number|PhpTemplate $value variable content. * @see setArray() */ public function set($name, $value) { if ($value instanceof \Innomatic\Tpl\Template) { // This is a subtemplate, process it. // $this->vars[$name] = $value->parse(); } elseif (is_array($value)) { // This is an array, it must be passed encoded. // $this->vars[$name] = $value; $this->tplEngine->set($name, \Shared\Wui\WuiXml::encode($value)); } elseif (is_numeric($value)) { // This is a number, it must be passed as it is. // $this->vars[$name] = $value; $this->tplEngine->set($name, $value); } else { // This is a string, it must be passed as a CDATA. // $this->vars[$name] = $value; $this->tplEngine->set($name, \Shared\Wui\WuiXml::cdata($value)); } }
/** * Sets a variable and its value. * * The variable will be extracted to the local scope of the template with * the same name given as parameter to the method. So setting a variable * named "title" will result in a $title variable available to the template. * * The value can be a string, a number or a PhpTemplate instance. In the * latter case, the variable content will be the result of the whole parsed * template of the PhpTemplate instance. * * The proper method for setting arrays is setArray(). * * @since 1.1 * @param string $name Name of the variable. * @param string|number|PhpTemplate $value variable content. * @see setArray() */ public function set($name, $value) { $this->vars[$name] = $value instanceof \Innomatic\Tpl\Template ? $value->parse() : $value; }
<?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();
/** * @param string $moduleLabel label of the module * @param string $template name of the template */ public function __construct($moduleLabel, $template) { $template = secure_file_path($template); $moduleLabel = secure_file_path($moduleLabel); // Custom template file for the installed campus $customTemplatePath = get_path('rootSys') . 'platform/templates/' . $moduleLabel . '/' . $template; // Version specific template file $defaultVersionTemplatePath = get_module_path($moduleLabel) . '/templates/1_11/' . $template; // Default template path $defaultTemplatePath = get_module_path($moduleLabel) . '/templates/' . $template; if (file_exists($customTemplatePath)) { parent::__construct($customTemplatePath); } elseif (file_exists($defaultVersionTemplatePath)) { parent::__construct($defaultVersionTemplatePath); } elseif (file_exists($defaultTemplatePath)) { parent::__construct($defaultTemplatePath); } else { throw new Exception("Template not found {$template} " . "at custom location {$customTemplatePath} " . "or default location {$defaultTemplatePath} !"); } }
} } /*------------------------------------------------------------------------ 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 */
} if (isset($_REQUEST['officialCode'])) { $userName = $_REQUEST['officialCode']; } else { $officialCode = ''; } if (isset($_REQUEST['mail'])) { $mail = $_REQUEST['mail']; } else { $mail = ''; } $action_list[get_lang('All')] = 'all'; $action_list[get_lang('Student')] = 'followcourse'; $action_list[get_lang('Course creator')] = 'createcourse'; $action_list[get_lang('Platform administrator')] = 'plateformadmin'; //header and bredcrump display ///////////// // OUTPUT $out = ''; $out .= claro_html_tool_title($nameTools . ' : '); $tpl = new PhpTemplate(get_path('incRepositorySys') . '/templates/advancedUserSearch.tpl.php'); $tpl->assign('lastName', $lastName); $tpl->assign('firstName', $firstName); $tpl->assign('userName', $userName); $tpl->assign('officialCode', $officialCode); $tpl->assign('mail', $mail); $tpl->assign('action', $action); $tpl->assign('action_list', $action_list); $out .= $tpl->render(); $claroline->display->body->appendContent($out); echo $claroline->display->render();
// Security check if (!claro_is_user_authenticated()) { claro_disp_auth_form(); } if (!claro_is_platform_admin()) { claro_die(get_lang('Not allowed')); } // table $tbl_used_lang = '`' . get_conf('mainDbName') . '`.`' . get_conf('mainTblPrefix') . TABLE_USED_LANG_VAR . '`'; $tbl_used_translation = '`' . get_conf('mainDbName') . '`.`' . get_conf('mainTblPrefix') . TABLE_TRANSLATION . '`'; $sql1 = " select count(*) from " . $tbl_used_lang; $sql2 = " select count(*) from " . $tbl_used_translation; mysql_query($sql1); if (mysql_errno() == 1146) { $table_exists = FALSE; } mysql_query($sql2); if (mysql_errno() == 1146) { $table_exists = FALSE; } // DISPLAY // Deal with interbredcrumps and title variable ClaroBreadCrumbs::getInstance()->prepend(get_lang('SDK'), $urlSDK); ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb')); $tpl = new PhpTemplate(get_path('incRepositorySys') . '/templates/translation_index.tpl.php'); $tpl->assign('table_exists', $table_exists); $out = ''; $out .= claro_html_tool_title($nameTools); $out .= $tpl->render(); $claroline->display->body->appendContent($out); echo $claroline->display->render();
require_once 'model/Feedback.php'; require_once 'model/Schedule.php'; require_once 'model/Subtitles.php'; require_once 'model/Overview.php'; require_once 'model/Room.php'; require_once 'model/RoomTab.php'; require_once 'model/RoomSelection.php'; require_once 'model/Stream.php'; require_once 'model/Relive.php'; require_once 'model/Upcoming.php'; ob_start(); try { $route = @$_GET['route']; $route = rtrim($route, '/'); // generic template $tpl = new PhpTemplate('template/page.phtml'); $tpl->set(array('baseurl' => forceslash(baseurl()), 'route' => $route, 'canonicalurl' => forceslash(baseurl()) . forceslash($route), 'assemblies' => 'template/assemblies/', 'assets' => 'assets/', 'conference' => new GenericConference())); if (startswith('//', @$GLOBALS['CONFIG']['BASEURL'])) { $tpl->set(array('httpsurl' => forceslash(forceslash('https:' . $GLOBALS['CONFIG']['BASEURL']) . @$GLOBALS['MANDATOR']) . forceslash($route), 'httpurl' => forceslash(forceslash('http:' . $GLOBALS['CONFIG']['BASEURL']) . @$GLOBALS['MANDATOR']) . forceslash($route))); } // GLOBAL ROUTES if ($route == 'gen/main.css') { // global css (for conferences overview) handle_lesscss_request('assets/css/main.less', '../assets/css/'); exit; } else { if ($route == 'streams/v1.json') { require 'view/streams-json-v1.php'; exit; } else { if ($route == 'about') {
} else { $searchLang = ""; } // Search needed info in db to create the right formulaire $arrayFaculty = course_category_get_list(); $category_array = claro_get_cat_flat_list(); $category_array = array_merge(array(get_lang('All') => ''), $category_array); $language_list = claro_get_lang_flat_list(); $language_list = array_merge(array(get_lang('All') => ''), $language_list); //---------------------------------- // DISPLAY //---------------------------------- $out = ''; //tool title $out .= claro_html_tool_title($nameTools . ' : '); $tpl = new PhpTemplate(get_path('incRepositorySys') . '/templates/advancedCourseSearch.tpl.php'); $tpl->assign('code', $code); $tpl->assign('intitule', $intitule); $tpl->assign('category_array', $category_array); $tpl->assign('language_list', $language_list); $tpl->assign('access', $access); $tpl->assign('subscription', $subscription); $tpl->assign('visibility', $visibility); $out .= $tpl->render(); $claroline->display->body->appendContent($out); echo $claroline->display->render(); //NEEDED FUNCTION (to be moved in libraries) /** *This function create de select box to choose categories * * @author - < Benoît Muret >