Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

pull/2487/head
Angel Fernando Quiroz Campos 8 years ago
commit 4fec779de0
  1. 3
      app/Migrations/Schema/V111/Version20160715122300.php
  2. 2
      main/document/showinframes.php
  3. 2
      main/exercise/exercise_submit.php
  4. 28
      main/glossary/glossary.js.php
  5. 11
      main/gradebook/index.php
  6. 8
      main/gradebook/lib/GradebookUtils.php
  7. 15
      main/inc/lib/api.lib.php

@ -5,7 +5,6 @@ namespace Application\Migrations\Schema\V111;
use Application\Migrations\AbstractMigrationChamilo;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
/**
* Class Version20160715122300
@ -23,6 +22,8 @@ class Version20160715122300 extends AbstractMigrationChamilo
{
$this->addSql('ALTER TABLE c_student_publication CHANGE session_id session_id INT DEFAULT NULL');
$this->addSql('UPDATE c_student_publication SET session_id = NULL WHERE session_id = 0');
// Fix not existing session id
$this->addSql('DELETE FROM c_student_publication WHERE session_id not in (SELECT id FROM session)');
$this->addSql('ALTER TABLE c_student_publication ADD CONSTRAINT fk_session FOREIGN KEY (session_id) REFERENCES session (id)');
}

@ -185,7 +185,7 @@ $js_glossary_in_documents = '
{ type:"stylesheet", id:"_fr5", src:"'.api_get_path(WEB_PUBLIC_PATH).'assets/jquery-ui/themes/smoothness/jquery-ui.min.css"},
{ type:"stylesheet", id:"_fr6", src:"'.api_get_path(WEB_PUBLIC_PATH).'assets/jquery-ui/themes/smoothness/theme.css"},
{ type:"script", id:"_fr2", src:"'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js"},
{ type:"script", id:"_fr3", src:"'.api_get_path(WEB_CODE_PATH).'glossary/glossary.js.php"}
{ type:"script", id:"_fr3", src:"'.api_get_path(WEB_CODE_PATH).'glossary/glossary.js.php?'.api_get_cidreq().'"}
]
});';

@ -45,7 +45,7 @@ if ($origin == 'learnpath') {
$showGlossary = in_array($glossaryExtraTools, array('true', 'lp', 'exercise_and_lp'));
}
if ($showGlossary) {
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'glossary/glossary.js.php?add_ready=1"></script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'glossary/glossary.js.php?add_ready=1&'.api_get_cidreq().'"></script>';
$htmlHeadXtra[] = api_get_js('jquery.highlight.js');
}

@ -3,15 +3,27 @@
require_once __DIR__.'/../inc/global.inc.php';
$origin = api_get_origin();
$tpl = new Template();
$templateName = 'glossary/glossary_auto.js.tpl';
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
$templateName = 'glossary/glossary_manual.js.tpl';
$glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
if ($origin == 'learnpath') {
$showGlossary = in_array($glossaryExtraTools, array('lp', 'exercise_and_lp'));
} else {
$showGlossary = in_array($glossaryExtraTools, array('true', 'lp', 'exercise_and_lp'));
}
$addReady = isset($_GET['add_ready']) ? true : false;
$tpl->assign('add_ready', $addReady);
$contentTemplate = $tpl->get_template($templateName);
header('Content-type: application/x-javascript');
$tpl->display($contentTemplate);
if ($showGlossary) {
$templateName = 'glossary/glossary_auto.js.tpl';
if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
$templateName = 'glossary/glossary_manual.js.tpl';
}
$addReady = isset($_GET['add_ready']) ? true : false;
$tpl->assign('add_ready', $addReady);
$contentTemplate = $tpl->get_template($templateName);
header('Content-type: application/x-javascript');
$tpl->display($contentTemplate);
}

@ -975,8 +975,6 @@ if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null, true)
if ($action == 'export_table') {
ob_clean();
$sessionName = api_get_session_name(api_get_session_id());
$sessionName = !empty($sessionName) ? " - $sessionName" : '';
$params = array(
'pdf_title' => sprintf(get_lang('GradeFromX'), $courseInfo['name']),
'course_code' => api_get_course_id(),
@ -986,16 +984,11 @@ if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null, true)
'student_info' => api_get_user_info(),
'show_grade_generated_date' => true,
'show_real_course_teachers' => false,
'show_teacher_as_myself' => false
'show_teacher_as_myself' => false,
'orientation' => 'P'
);
$pdf = new PDF('A4', $params['orientation'], $params);
$address = api_get_setting('institution_address');
$phone = api_get_setting('administratorTelephone');
$address = str_replace('\n', '<br />', $address);
$pdf->custom_header = array('html' => "<h5 align='right'>$address <br />$phone</h5>");
$pdf->html_to_pdf_with_template(
$table.
$graph.

@ -1564,9 +1564,6 @@ class GradebookUtils
$table = $gradebooktable->return_table();
$graph = $gradebooktable->getGraph();
$sessionName = api_get_session_name(api_get_session_id());
$sessionName = !empty($sessionName) ? " - $sessionName" : '';
$params = array(
'pdf_title' => sprintf(get_lang('GradeFromX'), $courseInfo['name']),
'session_info' => '',
@ -1593,11 +1590,6 @@ class GradebookUtils
'<br />'.get_lang('Feedback').'<br />
<textarea rows="5" cols="100" ></textarea>';
/*$address = api_get_setting('institution_address');
$phone = api_get_setting('administratorTelephone');
$address = str_replace('\n', '<br />', $address);
$pdf->custom_header = array('html' => "<h5 align='right'>$address <br />$phone</h5>");*/
$result = $pdf->html_to_pdf_with_template(
$content,
$saveToFile,

@ -7502,16 +7502,21 @@ function api_get_user_blocked_by_captcha($username)
/**
* Remove tags from HTML anf return the $in_number_char first non-HTML char
* Postfix the text with "..." if it has been truncated.
* @param integer $in_number_char
* @param string $text
* @param integer $number
*
* @return string
* @author hubert borderiou
*/
function api_get_short_text_from_html($in_html, $in_number_char)
function api_get_short_text_from_html($text, $number)
{
$out_res = api_remove_tags_with_space($in_html, false);
// Delete script and style tags
$text = preg_replace('/(<(script|style)\b[^>]*>).*?(<\/\2>)/is', "$1$3", $text);
$text = api_html_entity_decode($text);
$out_res = api_remove_tags_with_space($text, false);
$postfix = "...";
if (strlen($out_res) > $in_number_char) {
$out_res = substr($out_res, 0, $in_number_char).$postfix;
if (strlen($out_res) > $number) {
$out_res = substr($out_res, 0, $number).$postfix;
}
return $out_res;
}

Loading…
Cancel
Save