Careers: Add career_diagram_legend and career_diagram_disclaimer config

In order to show a legend and a disclaimer below the career diagram

BT#18720
pull/3905/head
Julio Montoya 4 years ago
parent 74cfb85930
commit 84b0a23480
  1. 2
      main/auth/my_progress.php
  2. 18
      main/inc/lib/career.lib.php
  3. 4
      main/inc/lib/sessionmanager.lib.php
  4. 7
      main/install/configuration.dist.php
  5. 2
      main/user/career_diagram.php

@ -39,8 +39,6 @@ $courseUserList = CourseManager::get_courses_list_by_user_id($user_id);
$dates = $issues = ''; $dates = $issues = '';
$sessionId = isset($_GET['session_id']) ? (int) $_GET['session_id'] : 0; $sessionId = isset($_GET['session_id']) ? (int) $_GET['session_id'] : 0;
$courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null; $courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null;
$allowCareerUser = api_get_configuration_value('allow_career_users');
$showGraph = false === api_get_configuration_value('hide_session_graph_in_my_progress'); $showGraph = false === api_get_configuration_value('hide_session_graph_in_my_progress');
$isAllowedToEdit = api_is_allowed_to_edit(); $isAllowedToEdit = api_is_allowed_to_edit();

@ -500,7 +500,7 @@ class Career extends Model
* *
* @return string * @return string
*/ */
public static function renderDiagramByColumn($careerInfo, $tpl, $loadUserIdData = 0) public static function renderDiagramByColumn($careerInfo, $tpl, $loadUserIdData = 0, $showFooter = true)
{ {
$careerId = isset($careerInfo['id']) ? $careerInfo['id'] : 0; $careerId = isset($careerInfo['id']) ? $careerInfo['id'] : 0;
if (empty($careerId)) { if (empty($careerId)) {
@ -792,6 +792,9 @@ class Career extends Model
$tpl->assign('vertex_list', $graph->elementList); $tpl->assign('vertex_list', $graph->elementList);
$graphHtml .= '<div id="graphContainer"></div>'; $graphHtml .= '<div id="graphContainer"></div>';
if ($showFooter) {
$graphHtml .= self::renderDiagramFooter();
}
return $graphHtml; return $graphHtml;
} }
@ -1411,4 +1414,17 @@ class Career extends Model
return $html; return $html;
} }
public static function renderDiagramFooter(): string
{
$footer = '';
if (api_get_configuration_value('career_diagram_legend')) {
$footer .= get_lang('CareerDiagramLegend');
}
if (api_get_configuration_value('career_diagram_disclaimer')) {
$footer .= get_lang('CareerDiagramDisclaimer');
}
return $footer;
}
} }

@ -9740,6 +9740,10 @@ class SessionManager
} }
} }
if (!empty($content)) {
$content .= Career::renderDiagramFooter();
}
return $content; return $content;
} }

@ -1935,6 +1935,13 @@ ALTER TABLE gradebook_comment ADD CONSTRAINT FK_C3B70763AD3ED51C FOREIGN KEY (gr
// Allows the use of the external id instead of the internal id. // Allows the use of the external id instead of the internal id.
//$_configuration['use_career_external_id_as_identifier_in_diagrams'] = true; //$_configuration['use_career_external_id_as_identifier_in_diagrams'] = true;
// Add a career legend below the diagram, a variable will be called
// get_lang('CareerDiagramLegend') and printed below a diagram
// $_configuration['career_diagram_legend'] = true;
// If true then a variable will be called get_lang('CareerDiagramDisclaimer') and printed below a diagram;
//$_configuration['career_diagram_disclaimer'] = true;
// KEEP THIS AT THE END // KEEP THIS AT THE END
// -------- Custom DB changes // -------- Custom DB changes
// Add user activation by confirmation email // Add user activation by confirmation email

@ -85,7 +85,7 @@ if (!empty($itemUrls) && !empty($itemUrls['value'])) {
$showFullPage = isset($_REQUEST['iframe']) && 1 === (int) $_REQUEST['iframe'] ? false : true; $showFullPage = isset($_REQUEST['iframe']) && 1 === (int) $_REQUEST['iframe'] ? false : true;
$tpl = new Template(get_lang('Diagram'), $showFullPage, $showFullPage, !$showFullPage); $tpl = new Template(get_lang('Diagram'), $showFullPage, $showFullPage, !$showFullPage);
$html = Display::page_subheader2($careerInfo['name'].$urlToString); $html = Display::page_subheader2($careerInfo['name'].$urlToString);
$diagram = Career::renderDiagramByColumn($careerInfo, $tpl, $userId); $diagram = Career::renderDiagramByColumn($careerInfo, $tpl, $userId, !$showFullPage);
if (!empty($diagram)) { if (!empty($diagram)) {
$html .= $diagram; $html .= $diagram;

Loading…
Cancel
Save