';
- //$allowLevels = [];
+
if (!empty($skillParents)) {
if (empty($allowLevels)) {
$tableResult .= $this->processSkillList($skills);
} else {
- $table = new HTML_Table(['class' => 'table table-bordered']);
- if (!empty($skillParents)) {
- $column = 0;
- $skillAdded = [];
- foreach ($skillParents as $parentId => $data) {
- if (in_array($parentId, $skillAdded)) {
- continue;
- }
- $parentName = '';
- if ($data['passed']) {
- $parentInfo = $skills[$parentId];
- $parentName = $this->processSkillList([$parentInfo], 'mini', false);
+ $graph = new \Fhaculty\Graph\Graph();
+ $graph->setAttribute('graphviz.graph.rankdir', 'LR');
+ foreach ($skillParents as $skillId => $parentList) {
+ $old = null;
+ foreach ($parentList as $parent) {
+ if ($graph->hasVertex($parent['id'])) {
+ $current = $graph->getVertex($parent['id']);
+ } else {
+ $current = $graph->createVertex($parent['id']);
+ $current->setAttribute('graphviz.data', $parent['data']);
}
- $table->setHeaderContents(0, $column, $parentName);
- $row = 1;
- $skillsToShow = [];
- foreach ($data as $skillData) {
- if ($skillData['id'] == $parentId) {
- continue;
+
+ if (!empty($old)) {
+ if ($graph->hasVertex($old['id'])) {
+ $nextVertex = $graph->getVertex($old['id']);
+ } else {
+ $nextVertex = $graph->createVertex($old['id']);
+ $nextVertex->setAttribute('graphviz.data', $old['data']);
}
- if (empty($skillData['id'])) {
- continue;
+
+ if (!$nextVertex->hasEdgeTo($current)) {
+ $nextVertex->createEdgeTo($current);
}
- $skillAdded[] = $skillData['id'];
- $skillsToShow[] = $skillData;
}
- $table->setCellContents(
- $row,
- $column,
- $this->processSkillList($skillsToShow, 'mini', false)
- );
- $row++;
- $column++;
+
+ $old = $parent;
}
}
- $tableResult .= $table->toHtml();
+
+ $table = '';
+ $root = $graph->getVertex(1);
+ $table .= '';
+ /** @var \Fhaculty\Graph\Vertex $vertex */
+ foreach ($root->getVerticesEdgeTo() as $vertex) {
+ $data = $vertex->getAttribute('graphviz.data');
+ $label = $this->processSkillList([$data], 'mini', false);
+
+ $table .= '';
+ $table .= $label;
+ $table .= $this->processVertex($vertex);
+ $table .= ' | ';
+ }
+ $table .= ' ';
+ $tableResult .= $table;
}
} else {
$tableResult .= get_lang('WithoutAchievedSkills');
@@ -1235,7 +1318,7 @@ class Skill extends Model
return [
'skills' => $tableRows,
- 'table' => $tableResult
+ 'table' => $tableResult,
];
}
@@ -1271,7 +1354,7 @@ class Skill extends Model
$skills[1] = array(
'id' => '1',
'name' => get_lang('Root'),
- 'parent_id' => '0'
+ 'parent_id' => '0',
);
$skillInfo = $this->getSkillInfo($skill_id);
@@ -1382,7 +1465,7 @@ class Skill extends Model
'name' => get_lang('SkillRootName'),
'id' => 'root',
'children' => $refs['root']['children'],
- 'data' => array()
+ 'data' => array(),
);
}
@@ -1423,7 +1506,7 @@ class Skill extends Model
}
$simple_tree[] = array(
'name' => $element['name'],
- 'children' => $children
+ 'children' => $children,
);
}
}
@@ -1612,7 +1695,7 @@ class Skill extends Model
$whereConditions = array(
'user_id = ? ' => intval($userId),
- 'AND skill_id = ? ' => intval($skillId)
+ 'AND skill_id = ? ' => intval($skillId),
);
if ($courseId > 0) {
@@ -1624,7 +1707,7 @@ class Skill extends Model
'COUNT(1) AS qty',
$this->table_skill_rel_user,
array(
- 'where' => $whereConditions
+ 'where' => $whereConditions,
),
'first'
);
@@ -1658,8 +1741,8 @@ class Skill extends Model
$skillRelProfileTable,
array(
'where' => array(
- 'skill_id = ?' => $id
- )
+ 'skill_id = ?' => $id,
+ ),
),
'first'
);
@@ -1955,7 +2038,7 @@ class Skill extends Model
foreach ($result as $item) {
$skills[] = [
'name' => self::translateName($item['name']),
- 'acquired_skill_at' => $item['acquired_skill_at']
+ 'acquired_skill_at' => $item['acquired_skill_at'],
];
}
@@ -1975,6 +2058,10 @@ class Skill extends Model
return isset($GLOBALS[$camelCase]) ? $GLOBALS[$camelCase] : $name;
}
+ /**
+ * @param string $code
+ * @return mixed|string
+ */
public static function translateCode($code)
{
if (empty($code)) {
diff --git a/main/social/my_skills_report.php b/main/social/my_skills_report.php
index 2056333572..21b7730eba 100644
--- a/main/social/my_skills_report.php
+++ b/main/social/my_skills_report.php
@@ -38,7 +38,7 @@ if ($isStudent) {
$tpl->assign('skill_table', $result['table']);
$tplPath = 'skill/student_report.tpl';
} elseif ($isStudentBoss) {
- $selectedStudent = isset($_REQUEST['student']) ? intval($_REQUEST['student']) : 0;
+ $selectedStudent = isset($_REQUEST['student']) ? (int) $_REQUEST['student'] : 0;
$tableRows = array();
$followedStudents = UserManager::getUsersFollowedByStudentBoss($userId);
@@ -60,10 +60,10 @@ if ($isStudent) {
while ($resultData = Database::fetch_assoc($result)) {
$tableRow = array(
- 'completeName' => $followedStudents[$selectedStudent]['completeName'],
- 'skillName' => Skill::translateName($resultData['name']),
- 'achievedAt' => api_format_date($resultData['acquired_skill_at'], DATE_FORMAT_NUMBER),
- 'courseImage' => Display::return_icon(
+ 'complete_name' => $followedStudents[$selectedStudent]['completeName'],
+ 'skill_name' => Skill::translateName($resultData['name']),
+ 'achieved_at' => api_format_date($resultData['acquired_skill_at'], DATE_FORMAT_NUMBER),
+ 'course_image' => Display::return_icon(
'course.png',
null,
null,
@@ -71,7 +71,7 @@ if ($isStudent) {
null,
true
),
- 'courseName' => $resultData['title']
+ 'course_name' => $resultData['title']
);
$imageSysPath = sprintf("%s%s/course-pic.png", api_get_path(SYS_COURSE_PATH), $resultData['directory']);
@@ -92,8 +92,8 @@ if ($isStudent) {
}
$tplPath = 'skill/student_boss_report.tpl';
- $tpl->assign('followedStudents', $followedStudents);
- $tpl->assign('selectedStudent', $selectedStudent);
+ $tpl->assign('followed_students', $followedStudents);
+ $tpl->assign('selected_student', $selectedStudent);
} elseif ($isDRH) {
$selectedCourse = isset($_REQUEST['course']) ? intval($_REQUEST['course']) : null;
$selectedSkill = isset($_REQUEST['skill']) ? intval($_REQUEST['skill']) : 0;
@@ -144,9 +144,9 @@ if ($isStudent) {
}
foreach ($tableRows as &$row) {
- $row['completeName'] = api_get_person_name($row['firstname'], $row['lastname']);
- $row['achievedAt'] = api_format_date($row['acquired_skill_at'], DATE_FORMAT_NUMBER);
- $row['courseImage'] = Display::return_icon(
+ $row['complete_name'] = api_get_person_name($row['firstname'], $row['lastname']);
+ $row['achieved_at'] = api_format_date($row['acquired_skill_at'], DATE_FORMAT_NUMBER);
+ $row['course_image'] = Display::return_icon(
'course.png',
null,
null,
@@ -167,20 +167,22 @@ if ($isStudent) {
$courseImageThumb->send_image($thumbSysPath);
}
- $row['courseImage'] = $thumbWebPath;
+ $row['course_image'] = $thumbWebPath;
}
}
$tplPath = 'skill/drh_report.tpl';
-
$tpl->assign('action', $action);
$tpl->assign('courses', $courses);
$tpl->assign('skills', $skills);
- $tpl->assign('selectedCourse', $selectedCourse);
- $tpl->assign('selectedSkill', $selectedSkill);
- $tpl->assign('reportTitle', $reportTitle);
+ $tpl->assign('selected_course', $selectedCourse);
+ $tpl->assign('selected_skill', $selectedSkill);
+ $tpl->assign('report_title', $reportTitle);
}
+if (empty($tableRows)) {
+ Display::addFlash(Display::return_message(get_lang('NoResults')));
+}
$tpl->assign('rows', $tableRows);
$templateName = $tpl->get_template($tplPath);
$contentTemplate = $tpl->fetch($templateName);
diff --git a/main/template/default/skill/drh_report.tpl b/main/template/default/skill/drh_report.tpl
index 413a8ae5bf..230f0dbdf9 100644
--- a/main/template/default/skill/drh_report.tpl
+++ b/main/template/default/skill/drh_report.tpl
@@ -1,14 +1,17 @@
{% if allow_skill_tool %}
{% endif %}
-
@@ -28,16 +33,19 @@
-
+
-
-
+
{% if rows %}
@@ -56,25 +64,21 @@
- {% for row in rows %}
-
- {% if action == 'filterByCourse' %}
- {{ row.c_name }} |
- {{ row.skill_name }} |
- {{ row.completeName }} |
- {{ row.achievedAt }} |
- {% elseif action == 'filterBySkill' %}
- {{ row.skill_name }} |
- {{ row.completeName }} |
- {{ row.achievedAt }} |
- {{ row.c_name }} |
- {% endif %}
-
- {% endfor %}
+ {% for row in rows %}
+
+ {% if action == 'filterByCourse' %}
+ {{ row.c_name }} |
+ {{ row.skill_name }} |
+ {{ row.complete_name }} |
+ {{ row.achieved_at }} |
+ {% elseif action == 'filterBySkill' %}
+ {{ row.skill_name }} |
+ {{ row.complete_name }} |
+ {{ row.achieved_at }} |
+ {{ row.c_name }} |
+ {% endif %}
+
+ {% endfor %}
-{% else %}
-
- {{ 'NoResults' | get_lang }}
-
{% endif %}
diff --git a/main/template/default/skill/student_boss_report.tpl b/main/template/default/skill/student_boss_report.tpl
index 85874bdab0..b3f3423b4b 100644
--- a/main/template/default/skill/student_boss_report.tpl
+++ b/main/template/default/skill/student_boss_report.tpl
@@ -12,8 +12,10 @@
@@ -30,18 +32,14 @@
|