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

pull/3883/head
Christian 5 years ago
commit b06bdd0a50
  1. 2
      main/admin/career_diagram.php
  2. 3
      main/admin/user_information.php
  3. 67
      main/auth/my_progress.php
  4. 28
      main/inc/lib/MyStudents.php
  5. 113
      main/inc/lib/sessionmanager.lib.php
  6. 107
      main/inc/lib/tracking.lib.php
  7. 2
      main/inc/lib/usergroup.lib.php
  8. 28
      main/inc/lib/usermanager.lib.php
  9. 15
      main/mySpace/myStudents.php
  10. 5
      main/mySpace/student_follow_export.php
  11. 2
      main/session/index.php
  12. 308
      main/template/default/career/diagram.tpl
  13. 6
      main/template/default/career/diagram_full.tpl
  14. 6
      main/template/default/career/diagram_iframe.tpl
  15. 2
      main/template/default/my_space/student_follow_pdf.tpl
  16. 12
      main/user/career_diagram.php
  17. 12
      main/webservices/api/v2.php

@ -107,5 +107,5 @@ if (!empty($diagram)) {
}
$tpl->assign('content', $html);
$layout = $tpl->get_template('career/diagram.tpl');
$layout = $tpl->get_template('career/diagram_full.tpl');
$tpl->display($layout);

@ -702,7 +702,8 @@ if (api_get_configuration_value('allow_career_users')) {
echo SessionManager::getCareerDiagramPerSession($session['session_id'], $userId);
}
}
echo MyStudents::getBlockForCareers($userId);
echo Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']);
echo MyStudents::userCareersTable($userId);
}
echo Display::page_subheader(get_lang('SessionList'), null, 'h3', ['class' => 'section-title']);

@ -64,22 +64,24 @@ if (!empty($courseUserList)) {
$course_info = api_get_course_info_by_id($result['c_id']);
$course_image = '<img src="'.$course_info['course_image_large'].'">';
$dates .= '<li><a href="#'.$login.'">'.api_convert_and_format_date($login, DATE_FORMAT_SHORT).'</a></li>';
$issues .= '<li id ="'.$login.'">';
$issues .= '<div class="img-course">'.$course_image.'</div>';
$issues .= '<div class="text-course">';
$issues .= '<p>'.sprintf(
$entered = sprintf(
get_lang('YouHaveEnteredTheCourseXInY'),
'" '.$courseInfo['name'].' "',
api_convert_and_format_date($login, DATE_TIME_FORMAT_LONG)
).'</p>';
$issues .= '</div>';
$issues .= '</li>';
);
$issues .= '<li id ="'.$login.'">
<div class="img-course">'.$course_image.'</div>
<div class="text-course">
<p>'.$entered.'</p>
</div>
</li>';
$count++;
}
}
$content = Tracking::show_user_progress($user_id, $sessionId);
$content = Tracking::showUserProgress($user_id, $sessionId);
$showAllSessionCourses = api_get_configuration_value('my_progress_session_show_all_courses');
if ($showAllSessionCourses && !empty($sessionId) && empty($courseCode)) {
@ -98,26 +100,26 @@ if ($showAllSessionCourses && !empty($sessionId) && empty($courseCode)) {
}
if (!empty($dates)) {
if (!empty($content)) {
$content .= '';
}
$content .= Display::page_subheader(get_lang('Timeline'));
$content .= '<div class="row">';
$content .= '<div class="col-md-12">';
$content .= '<div id="my_timeline">';
$content .= '<ul id="dates">'.$dates.'</ul>';
$content .= '<ul id="issues">'.$issues.'</ul>';
$content .= '<div id="grad_left"></div>';
$content .= '<div id="grad_right"></div>';
$content .= '<a href="#" id="prev"></a>';
$content .= '<a href="#" id="next"></a>';
$content .= '</div></div>';
$content .= '
<div class="row">
<div class="col-md-12">
<div id="my_timeline">
<ul id="dates">'.$dates.'</ul>
<ul id="issues">'.$issues.'</ul>
<div id="grad_left"></div>
<div id="grad_right"></div>
<a href="#" id="prev"></a>
<a href="#" id="next"></a>
</div>
</div>
</div>
';
}
if (api_get_configuration_value('private_messages_about_user_visible_to_user') === true) {
$allowMessages = api_get_configuration_value('private_messages_about_user');
if ($allowMessages === true) {
// Messages
$content .= Display::page_subheader2(get_lang('Messages'));
$content .= MessageManager::getMessagesAboutUserToString(api_get_user_info());
}
@ -128,27 +130,6 @@ if (empty($content)) {
$message = Display::return_message(get_lang('NoDataAvailable'), 'warning');
}
if ($allowCareerUser) {
$careers = UserManager::getUserCareers($user_id);
if (!empty($careers)) {
$title = Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']);
$table = new HTML_Table(['class' => 'table table-hover table-striped data_table']);
$table->setHeaderContents(0, 0, get_lang('Career'));
$table->setHeaderContents(0, 1, get_lang('Diagram'));
$row = 1;
foreach ($careers as $careerData) {
$table->setCellContents($row, 0, $careerData['name']);
$url = api_get_path(WEB_CODE_PATH).'user/career_diagram.php?career_id='.$careerData['id'];
$diagram = Display::url(get_lang('Diagram'), $url);
$table->setCellContents($row, 1, $diagram);
$row++;
}
$content = $title.$table->toHtml().$content;
}
}
$tpl = new Template($nameTools);
$tpl->assign('message', $message);
$tpl->assign('content', $content);

@ -2,21 +2,27 @@
/* For licensing terms, see /license.txt */
/**
* Class MyStudents.
*/
class MyStudents
{
public static function getBlockForCareers(int $studentId): ?string
public static function userCareersTable(int $studentId): string
{
if (!api_get_configuration_value('allow_career_users')) {
return null;
return '';
}
$careers = UserManager::getUserCareers($studentId);
if (empty($careers)) {
return null;
return '';
}
return self::getCareersTable($careers);
}
public static function getCareersTable(array $careers): string
{
if (empty($careers)) {
return '';
}
$webCodePath = api_get_path(WEB_CODE_PATH);
@ -28,11 +34,11 @@ class MyStudents
];
$data = array_map(
function (array $careerData) use ($webCodePath, $iconDiagram) {
$url = $webCodePath.'user/career_diagram.php?career_id='.$careerData['id'];
function (array $careerInfo) use ($webCodePath, $iconDiagram) {
$url = $webCodePath.'user/career_diagram.php?career_id='.$careerInfo['id'];
return [
$careerData['name'],
$careerInfo['name'],
Display::url($iconDiagram, $url),
];
},
@ -43,10 +49,10 @@ class MyStudents
$table->setHeaders($headers);
$table->setData($data);
return Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title'])
.$table->toHtml();
return $table->toHtml();
}
public static function getBlockForSkills(int $studentId, int $courseId, int $sessionId): string
{
$allowAll = api_get_configuration_value('allow_teacher_access_student_skills');

@ -6125,35 +6125,15 @@ class SessionManager
}
if (!empty($keyword)) {
$keyword = Database::escape_string($keyword);
$keywordParts = explode(' ', $keyword);
$extraConditions = '';
if (!empty($keywordParts)) {
$keywordParts = array_filter($keywordParts);
foreach ($keywordParts as $part) {
if (empty($part)) {
continue;
}
$part = Database::escape_string($part);
$extraConditions .= "
OR
(u.username LIKE '%$part%' OR
u.firstname LIKE '%$part%' OR
u.lastname LIKE '%$part%' OR
u.official_code LIKE '%$part%'
)
";
}
}
$keyword = trim(Database::escape_string($keyword));
$userConditions .= " AND (
u.username LIKE '%$keyword%' OR
u.firstname LIKE '%$keyword%' OR
u.lastname LIKE '%$keyword%' OR
u.official_code LIKE '%$keyword%' OR
u.email LIKE '%$keyword%'
$extraConditions
u.email LIKE '%$keyword%' OR
CONCAT(u.firstname, ' ', u.lastname) LIKE '%$keyword%' OR
CONCAT(u.lastname, ' ', u.firstname) LIKE '%$keyword%'
)";
}
@ -9651,43 +9631,74 @@ class SessionManager
}
}
public static function getCareerDiagramPerSession($sessionId, $userId): string
public static function getCareersFromSession(int $sessionId): array
{
$extraFieldValueSession = new ExtraFieldValue('session');
$extraFieldValueCareer = new ExtraFieldValue('career');
$visibility = api_get_session_visibility($sessionId, null, false, $userId);
$value = $extraFieldValueSession->get_values_by_handler_and_field_variable($sessionId, 'careerid');
$careers = [];
if (isset($value['value']) && !empty($value['value'])) {
$careerList = str_replace(['[', ']'], '', $value['value']);
$careerList = explode(',', $careerList);
$careerManager = new Career();
foreach ($careerList as $career) {
$careerIdValue = $extraFieldValueCareer->get_item_id_from_field_variable_and_field_value(
'external_career_id',
$career
);
if (isset($careerIdValue['item_id']) && !empty($careerIdValue['item_id'])) {
$finalCareerId = $careerIdValue['item_id'];
$careerInfo = $careerManager->get($finalCareerId);
if (!empty($careerInfo)) {
$careers[] = $careerInfo;
}
}
}
}
return $careers;
}
public static function getCareerDiagramPerSession($sessionId, $userId): string
{
$sessionId = (int) $sessionId;
$userId = (int) $userId;
$visibility = api_get_session_visibility($sessionId, null, false, $userId);
$content = '';
if (SESSION_AVAILABLE === $visibility) {
$value = $extraFieldValueSession->get_values_by_handler_and_field_variable($sessionId, 'careerid');
if (isset($value['value']) && !empty($value['value'])) {
$careerList = str_replace(['[', ']'], '', $value['value']);
$careerList = explode(',', $careerList);
foreach ($careerList as $career) {
$careerIdValue = $extraFieldValueCareer->get_item_id_from_field_variable_and_field_value(
'external_career_id',
$career
);
if (isset($careerIdValue['item_id']) && !empty($careerIdValue['item_id'])) {
$finalCareerId = $careerIdValue['item_id'];
$career = new Career();
$careerInfo = $career->get($finalCareerId);
if (!empty($careerInfo)) {
$careerUrl = api_get_path(WEB_CODE_PATH).
'user/career_diagram.php?iframe=1&career_id='.$finalCareerId;
$content .= '<iframe
style="width:100%; height:500px"
border="0"
frameborder="0"
src="'.$careerUrl.'"></iframe>';
}
}
}
$careerList = self::getCareersFromSession($sessionId);
if (empty($careerList)) {
return '';
}
foreach ($careerList as $career) {
$careerUrl = api_get_path(WEB_CODE_PATH).'user/career_diagram.php?iframe=1&career_id='.$career['id'].'&user_id='.$userId;
$content .= '
<iframe
onload="resizeIframe(this)"
style="width:100%;"
border="0"
frameborder="0"
scrolling="no"
src="'.$careerUrl.'"
></iframe>';
}
}
if (!empty($content)) {
$content .= '
<script>
resizeIframe = function(iFrame) {
//iFrame.width = iFrame.contentWindow.document.body.scrollWidth;
iFrame.height = iFrame.contentWindow.document.body.scrollHeight + 20;
}
</script>
';
}
if (!empty($content)) {
$content = Display::page_subheader(get_lang('OngoingTraining')).$content;
}

@ -4697,7 +4697,7 @@ class Tracking
*
* @return string|array
*/
public static function show_user_progress(
public static function showUserProgress(
$user_id,
$session_id = 0,
$extra_params = '',
@ -4767,7 +4767,7 @@ class Tracking
$courseIdList[] = $row['id'];
}
$orderBy = ' ORDER BY name ';
$orderBy = ' ORDER BY display_end_date DESC, name ';
$extraInnerJoin = null;
if (SessionManager::orderCourseIsEnabled() && !empty($session_id)) {
@ -4849,7 +4849,7 @@ class Tracking
}
$html = '';
// Course list
// Course list.
if ($show_courses) {
if (!empty($courses)) {
$html .= Display::page_header(
@ -4942,10 +4942,7 @@ class Tracking
$bestScoreAverageNotInLP = round($bestScoreAverageNotInLP / count($exerciseList) * 100, 2);
}
$last_connection = self::get_last_connection_date_on_the_course(
$user_id,
$courseInfo
);
$last_connection = self::get_last_connection_date_on_the_course($user_id, $courseInfo);
if (is_null($progress) || empty($progress)) {
$progress = '0%';
@ -5004,7 +5001,9 @@ class Tracking
}
}
// Session list
$allowCareerUser = api_get_configuration_value('allow_career_users');
// Session list.
if (!empty($course_in_session)) {
$main_session_graph = '';
// Load graphics only when calling to an specific session
@ -5012,12 +5011,22 @@ class Tracking
$my_results = [];
$all_exercise_graph_list = [];
$all_exercise_start_time = [];
$allCareers = [];
foreach ($course_in_session as $my_session_id => $session_data) {
$course_list = $session_data['course_list'];
$user_count = count(SessionManager::get_users_by_session($my_session_id));
$exercise_graph_name_list = [];
$exercise_graph_list = [];
$visibility = api_get_session_visibility($my_session_id, null, false, $user_id);
if (SESSION_AVAILABLE === $visibility) {
$careers = SessionManager::getCareersFromSession($my_session_id);
if (!empty($careers)) {
$allCareers = array_merge($allCareers, $careers);
}
}
foreach ($course_list as $course_data) {
$exercise_list = ExerciseLib::get_all_exercises(
$course_data,
@ -5200,6 +5209,16 @@ class Tracking
);
}
if ($allowCareerUser && !empty($allCareers)) {
$careers = [];
foreach ($allCareers as $career) {
$careers[$career['id']] = $career;
}
$title = Display::page_subheader(get_lang('OngoingTraining'));
$html .= $title.MyStudents::getCareersTable($careers);
}
$html .= Display::div($sessionsTable->toHtml(), ['class' => 'table-responsive']);
$html .= Display::div(
$main_session_graph,
@ -5435,52 +5454,50 @@ class Tracking
* @param string $course_code
* @param int $session_id
* @param bool $showDiagram
*
* @return string html code
*/
public static function show_course_detail($user_id, $course_code, $session_id, $showDiagram = false)
public static function show_course_detail($user_id, $course_code, $session_id, $showDiagram = false): string
{
$html = '';
if (isset($course_code)) {
$user_id = (int) $user_id;
$session_id = (int) $session_id;
$course_info = api_get_course_info($course_code);
if (empty($course_info)) {
return '';
}
if (empty($user_id) || empty($course_code)) {
return '';
}
$html .= '<a name="course_session_data"></a>';
$html .= Display::page_subheader2($course_info['title']);
$course_info = api_get_course_info($course_code);
if (empty($course_info)) {
return '';
}
if ($showDiagram && !empty($session_id)) {
$visibility = api_get_session_visibility($session_id);
if (SESSION_AVAILABLE === $visibility) {
$html .= Display::page_subheader2($course_info['title']);
}
}
$user_id = (int) $user_id;
$session_id = (int) $session_id;
// Course details
$html = '<a name="course_session_data"></a>';
$html .= Display::page_subheader2($course_info['title']);
// Show exercise results of invisible exercises? see BT#4091
$quizzesHtml = self::generateQuizzesTable($course_info, $session_id);
// LP table results
$learningPathsHtml = self::generateLearningPathsTable($user_id, $course_info, $session_id);
$skillsHtml = self::displayUserSkills($user_id, $course_info['id'], $session_id);
if ($showDiagram && !empty($session_id)) {
$visibility = api_get_session_visibility($session_id);
if (SESSION_AVAILABLE === $visibility) {
$html .= Display::page_subheader2($course_info['title']);
}
}
$toolsHtml = [
'quizzes' => $quizzesHtml,
'learning_paths' => $learningPathsHtml,
'skills' => $skillsHtml,
];
// Show exercise results of invisible exercises? see BT#4091
$quizzesHtml = self::generateQuizzesTable($course_info, $session_id);
// LP table results
$learningPathsHtml = self::generateLearningPathsTable($user_id, $course_info, $session_id);
$skillsHtml = self::displayUserSkills($user_id, $course_info['id'], $session_id);
$toolsOrder = api_get_configuration_value('my_progress_course_tools_order');
$toolsHtml = [
'quizzes' => $quizzesHtml,
'learning_paths' => $learningPathsHtml,
'skills' => $skillsHtml,
];
if (empty($toolsOrder)) {
$html .= implode(PHP_EOL, $toolsHtml);
} else {
foreach ($toolsOrder['order'] as $tool) {
$html .= $toolsHtml[$tool].PHP_EOL;
}
$toolsOrder = api_get_configuration_value('my_progress_course_tools_order');
if (empty($toolsOrder)) {
$html .= implode(PHP_EOL, $toolsHtml);
} else {
foreach ($toolsOrder['order'] as $tool) {
$html .= $toolsHtml[$tool].PHP_EOL;
}
}

@ -170,7 +170,7 @@ class UserGroup extends Model
}
}
$courseAndSessionList = Tracking::show_user_progress(
$courseAndSessionList = Tracking::showUserProgress(
$userId,
0,
'',

@ -5394,36 +5394,16 @@ class UserManager
}
if (!empty($keyword)) {
$keyword = Database::escape_string($keyword);
$keywordParts = explode(' ', $keyword);
$extraConditions = '';
if (!empty($keywordParts)) {
$keywordParts = array_filter($keywordParts);
foreach ($keywordParts as $part) {
if (empty($part)) {
continue;
}
$part = Database::escape_string($part);
$extraConditions .= "
OR
(u.username LIKE '%$part%' OR
u.firstname LIKE '%$part%' OR
u.lastname LIKE '%$part%' OR
u.official_code LIKE '%$part%'
)
";
}
}
$keyword = trim(Database::escape_string($keyword));
$userConditions .= " AND (
u.username LIKE '%$keyword%' OR
u.firstname LIKE '%$keyword%' OR
u.lastname LIKE '%$keyword%' OR
u.official_code LIKE '%$keyword%' OR
u.email LIKE '%$keyword%'
$extraConditions
u.email LIKE '%$keyword%' OR
CONCAT(u.firstname, ' ', u.lastname) LIKE '%$keyword%' OR
CONCAT(u.lastname, ' ', u.firstname) LIKE '%$keyword%'
)";
}

@ -427,10 +427,16 @@ while ($row = Database::fetch_array($rs)) {
}
}
$sessionTable = Database::get_main_table(TABLE_MAIN_SESSION);
// Get the list of sessions where the user is subscribed as student
$sql = 'SELECT session_id, c_id
FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).'
WHERE user_id='.$student_id;
$sql = 'SELECT scu.session_id, scu.c_id
FROM '.Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER).' scu
INNER JOIN '.$sessionTable.' as s
ON (s.id = scu.session_id)
WHERE user_id = '.$student_id.'
ORDER BY display_end_date DESC
';
$rs = Database::query($sql);
$tmp_sessions = [];
while ($row = Database::fetch_array($rs, 'ASSOC')) {
@ -943,7 +949,8 @@ if (api_get_configuration_value('allow_career_users')) {
foreach ($courses_in_session as $sId => $courses) {
echo SessionManager::getCareerDiagramPerSession($sId, $student_id);
}
echo MyStudents::getBlockForCareers($student_id);
echo Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']);
echo MyStudents::userCareersTable($student_id);
}
echo MyStudents::getBlockForSkills(

@ -503,10 +503,10 @@ if ($form->validate()) {
$coursesInfo[] = generateHtmlForCourse($studentInfo['id'], $coursesInSessions, $courseId, $sessionId);
}
}
$title = Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']);
$view = new Template('', false, false, false, true, false, false);
$view->assign('user_info', $studentInfo);
$view->assign('carrers', MyStudents::getBlockForCareers($studentInfo['id']));
$view->assign('careers', $title.MyStudents::userCareersTable($studentInfo['id']));
$view->assign('skills', Tracking::displayUserSkills($studentInfo['id']));
$view->assign('classes', MyStudents::getBlockForClasses($studentInfo['id']));
$view->assign('courses_info', $coursesInfo);
@ -519,7 +519,6 @@ if ($form->validate()) {
'orientation' => 'P',
];
$css = api_get_print_css();
$css = '
.user-info { clear: both; }
.user-info__col { float: left; width: 33.33%; }

@ -620,7 +620,7 @@ $(function() {
$courseCode = isset($_GET['course']) ? $_GET['course'] : null;
$reportingTab = '';
if (!api_is_anonymous()) {
$reportingTab = Tracking::show_user_progress(
$reportingTab = Tracking::showUserProgress(
api_get_user_id(),
$session_id,
'#tabs-5',

@ -1,165 +1,161 @@
{% extends 'layout/layout_1_col.tpl'|get_template %}
{% block content %}
<script>
mxBasePath = '{{ _p.web_lib }}mxgraph/src/';
</script>
<style>
#graphContainer svg {
min-width: 100% !important;
}
</style>
<script type="text/javascript" src="{{ _p.web_lib }}mxgraph/src/js/mxClient.js"></script>
<script>
// Overridden to define per-shape connection points
mxGraph.prototype.getAllConnectionConstraints = function(terminal, source) {
if (terminal != null && terminal.shape != null) {
<script>
mxBasePath = '{{ _p.web_lib }}mxgraph/src/';
</script>
<style>
#graphContainer svg {
min-width: 100% !important;
}
</style>
<script type="text/javascript" src="{{ _p.web_lib }}mxgraph/src/js/mxClient.js"></script>
<script>
// Overridden to define per-shape connection points
mxGraph.prototype.getAllConnectionConstraints = function(terminal, source) {
if (terminal != null && terminal.shape != null) {
if (terminal.shape.stencil != null) {
if (terminal.shape.stencil != null) {
if (terminal.shape.stencil != null) {
return terminal.shape.stencil.constraints;
}
} else if (terminal.shape.constraints != null) {
return terminal.shape.constraints;
return terminal.shape.stencil.constraints;
}
} else if (terminal.shape.constraints != null) {
return terminal.shape.constraints;
}
}
return null;
};
// Edges have no connection points
mxPolyline.prototype.constraints = null;
// Program starts here. Creates a sample graph in the
// DOM node with the specified ID. This function is invoked
// from the onLoad event handler of the document (see below).
function main(container)
{
// Checks if the browser is supported
if (!mxClient.isBrowserSupported()) {
// Displays an error message if the browser is not supported.
mxUtils.error('Browser is not supported!', 200, false);
} else {
// Disables the built-in context menu
mxEvent.disableContextMenu(container);
// Creates the graph inside the given container
var graph = new mxGraph(container);
graph.setConnectable(true);
graph.setHtmlLabels(true);
// Blocks the selection of elements
graph.setEnabled(false);
// Enables connect preview for the default edge style
graph.connectionHandler.createEdgeState = function(me) {
var edge = graph.createEdge(null, null, null, null, null);
return new mxCellState(this.graph.view, edge, this.graph.getCellStyle(edge));
};
// Specifies the default edge style
graph.getStylesheet().getDefaultEdgeStyle()['edgeStyle'] = 'orthogonalEdgeStyle';
// Enables rubberband selection
new mxRubberband(graph);
// Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0).
var parent = graph.getDefaultParent();
// Adds cells to the model in a single step
graph.getModel().beginUpdate();
try {
//var v1 = graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30);
//var v2 = graph.insertVertex(parent, null, 'World!', 200, 150, 80, 30);
//var e1 = graph.insertEdge(parent, null, '', v1, v2);
{% for vertex in group_list %}
{{ vertex }}
{% endfor %}
{% for vertex in subgroup_list %}
{{ vertex }}
{% endfor %}
{% for vertex in vertex_list %}
{{ vertex }}
{% endfor %}
{% for vertex in connections %}
{{ vertex }}
{% endfor %}
} finally {
// Updates the display
graph.getModel().endUpdate();
}
return null;
};
// Edges have no connection points
mxPolyline.prototype.constraints = null;
// Program starts here. Creates a sample graph in the
// DOM node with the specified ID. This function is invoked
// from the onLoad event handler of the document (see below).
function main(container)
{
// Checks if the browser is supported
if (!mxClient.isBrowserSupported()) {
// Displays an error message if the browser is not supported.
mxUtils.error('Browser is not supported!', 200, false);
} else {
// Disables the built-in context menu
mxEvent.disableContextMenu(container);
// Creates the graph inside the given container
var graph = new mxGraph(container);
graph.setConnectable(true);
graph.setHtmlLabels(true);
// Blocks the selection of elements
graph.setEnabled(false);
// Enables connect preview for the default edge style
graph.connectionHandler.createEdgeState = function(me) {
var edge = graph.createEdge(null, null, null, null, null);
return new mxCellState(this.graph.view, edge, this.graph.getCellStyle(edge));
};
// Specifies the default edge style
graph.getStylesheet().getDefaultEdgeStyle()['edgeStyle'] = 'orthogonalEdgeStyle';
// Enables rubberband selection
new mxRubberband(graph);
// Gets the default parent for inserting new cells. This
// is normally the first child of the root (ie. layer 0).
var parent = graph.getDefaultParent();
// Adds cells to the model in a single step
graph.getModel().beginUpdate();
try {
//var v1 = graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30);
//var v2 = graph.insertVertex(parent, null, 'World!', 200, 150, 80, 30);
//var e1 = graph.insertEdge(parent, null, '', v1, v2);
{% for vertex in group_list %}
{{ vertex }}
{% endfor %}
{% for vertex in subgroup_list %}
{{ vertex }}
{% endfor %}
{% for vertex in vertex_list %}
{{ vertex }}
{% endfor %}
{% for vertex in connections %}
{{ vertex }}
{% endfor %}
} finally {
// Updates the display
graph.getModel().endUpdate();
}
}
$(function () {
main(document.getElementById('graphContainer'));
var svg1 = document.getElementsByTagName("svg")[0];
var data = svg1.getBBox();
var widthValue = data.width + 100;
var heightValue = data.height + 100;
var att = document.createAttributeNS(null, "viewBox");
att.value = '0 0 ' + widthValue + ' ' + heightValue;
svg1.setAttributeNode(att);
$(".popup").qtip({
content: {
text: function(event, api) {
var item = $(this);
var itemId = $(this).attr("id");
var desc = $(this).attr("data-description");
var period = $(this).attr("data-period");
var teacherText = $(this).attr("data-teacher-text");
var teacher = $(this).attr("data-teacher");
var score = $(this).attr("data-score");
var value = $(this).attr("data-score-value");
var info = $(this).attr("data-info");
var teacherLabel = '';
if (teacher != '') {
teacherLabel = teacherText + ': ' + teacher + '<br />';
}
var textToShow = desc + '<br />' +
period + '<br />' +
teacherLabel +
score + ': ' + value + '<br /><br />'+
info + '<br />'
;
return textToShow;
}
},
events: {
render: function(event, api) {
var popup = $(api.elements.target);
var bg = popup.attr("data-background-color");
var color = popup.attr("data-color");
var borderColor = popup.attr("data-border-color");
// Grab the tooltip element from the API
//var tooltip = api.elements.tooltip;
$(this).css('background-color', bg);
$(this).css('color', color);
$(this).css('border-color', borderColor);
}
},
position: {
my: 'bottom left', // Position my top left...
at: 'top right', // at the bottom right of...
adjust: {
x: 0,
y: 0
}
$(function () {
main(document.getElementById('graphContainer'));
var svg1 = document.getElementsByTagName("svg")[0];
var data = svg1.getBBox();
var widthValue = data.width + 100;
var heightValue = data.height + 100;
var att = document.createAttributeNS(null, "viewBox");
att.value = '0 0 ' + widthValue + ' ' + heightValue;
svg1.setAttributeNode(att);
$(".popup").qtip({
content: {
text: function(event, api) {
var item = $(this);
var itemId = $(this).attr("id");
var desc = $(this).attr("data-description");
var period = $(this).attr("data-period");
var teacherText = $(this).attr("data-teacher-text");
var teacher = $(this).attr("data-teacher");
var score = $(this).attr("data-score");
var value = $(this).attr("data-score-value");
var info = $(this).attr("data-info");
var teacherLabel = '';
if (teacher != '') {
teacherLabel = teacherText + ': ' + teacher + '<br />';
}
var textToShow = desc + '<br />' +
period + '<br />' +
teacherLabel +
score + ': ' + value + '<br /><br />'+
info + '<br />'
;
return textToShow;
}
});
},
events: {
render: function(event, api) {
var popup = $(api.elements.target);
var bg = popup.attr("data-background-color");
var color = popup.attr("data-color");
var borderColor = popup.attr("data-border-color");
// Grab the tooltip element from the API
//var tooltip = api.elements.tooltip;
$(this).css('background-color', bg);
$(this).css('color', color);
$(this).css('border-color', borderColor);
}
},
position: {
my: 'bottom left', // Position my top left...
at: 'top right', // at the bottom right of...
adjust: {
x: 0,
y: 0
}
}
});
</script>
{{ content }}
{% endblock %}
});
</script>
{{ content }}

@ -0,0 +1,6 @@
{% extends 'layout/layout_1_col.tpl'|get_template %}
{% block content %}
{% include 'career/diagram.tpl' |get_template %}
{{ content }}
{% endblock %}

@ -0,0 +1,6 @@
{% extends 'layout/no_layout.tpl'|get_template %}
{% block body %}
{% include 'career/diagram.tpl' |get_template %}
{{ content }}
{% endblock %}

@ -35,7 +35,7 @@
<hr>
</div>
{{ carrers }}
{{ careers }}
{{ skills }}

@ -17,9 +17,12 @@ if (api_get_configuration_value('allow_career_diagram') == false) {
api_not_allowed(true);
}
api_block_anonymous_users();
$this_section = SECTION_COURSES;
$careerId = isset($_GET['career_id']) ? $_GET['career_id'] : 0;
$userId = isset($_GET['user_id']) ? $_GET['user_id'] : api_get_user_id();
if (empty($careerId)) {
api_not_allowed(true);
@ -30,8 +33,6 @@ $careerInfo = $career->get($careerId);
if (empty($careerInfo)) {
api_not_allowed(true);
}
$userId = api_get_user_id();
$allow = UserManager::userHasCareer($userId, $careerId) || api_is_platform_admin() || api_is_drh();
if ($allow === false) {
@ -97,5 +98,10 @@ if (!empty($diagram)) {
}
$tpl->assign('content', $html);
$layout = $tpl->get_template('career/diagram.tpl');
if ($showFullPage) {
$layout = $tpl->get_template('career/diagram_full.tpl');
} else {
$layout = $tpl->get_template('career/diagram_iframe.tpl');
}
$tpl->display($layout);

@ -214,6 +214,7 @@ try {
break;
case Rest::GET_COURSES_FROM_EXTRA_FIELD:
$variable = $_REQUEST['extra_field_variable'] ?? '';
$value = $_REQUEST['extra_field_value'] ?? '';
$urlId = $_REQUEST['id_campus'] ?? '';
$extraField = new ExtraField('course');
$extraFieldInfo = $extraField->get_handler_field_info_by_field_variable($variable);
@ -223,12 +224,19 @@ try {
}
$extraFieldValue = new ExtraFieldValue('course');
$items = $extraFieldValue->getValuesByFieldId($extraFieldInfo['id']);
$items = $extraFieldValue->get_item_id_from_field_variable_and_field_value(
$variable,
$value,
false,
false,
true
);
$courseList = [];
foreach ($items as $item) {
$courseId = $item['item_id'];
if (UrlManager::relation_url_course_exist($courseId, $urlId)) {
$courseList[] = api_get_course_info($courseId);
$courseList[] = api_get_course_info_by_id($courseId);
}
}

Loading…
Cancel
Save