|
@@ -453,13 +453,34 @@ class Career extends Model
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- * @param Graph $graph
|
|
+ * @param array $careerInfo
|
|
* @param Template $tpl
|
|
* @param Template $tpl
|
|
|
|
+ * @param int $loadUserIdData
|
|
*
|
|
*
|
|
* @return string
|
|
* @return string
|
|
*/
|
|
*/
|
|
- public static function renderDiagramByColumn($graph, $tpl)
|
|
+ public static function renderDiagramByColumn($careerInfo, $tpl, $loadUserIdData = 0)
|
|
{
|
|
{
|
|
|
|
+ $careerId = isset($careerInfo['id']) ? $careerInfo['id'] : 0;
|
|
|
|
+ if (empty($careerId)) {
|
|
|
|
+ return '';
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $extraFieldValue = new ExtraFieldValue('career');
|
|
|
|
+ $item = $extraFieldValue->get_values_by_handler_and_field_variable(
|
|
|
|
+ $careerId,
|
|
|
|
+ 'career_diagram',
|
|
|
|
+ false,
|
|
|
|
+ false,
|
|
|
|
+ false
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ $graph = null;
|
|
|
|
+ if (!empty($item) && isset($item['value']) && !empty($item['value'])) {
|
|
|
|
+
|
|
|
|
+ $graph = UnserializeApi::unserialize('career', $item['value']);
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!($graph instanceof Graph)) {
|
|
if (!($graph instanceof Graph)) {
|
|
return '';
|
|
return '';
|
|
}
|
|
}
|
|
@@ -473,6 +494,14 @@ class Career extends Model
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ $userResult = [];
|
|
|
|
+ if (!empty($loadUserIdData)) {
|
|
|
|
+ $careerData = UserManager::getUserCareer($loadUserIdData, $careerId);
|
|
|
|
+ if (isset($careerData['extra_data']) && !empty($careerData['extra_data'])) {
|
|
|
|
+ $userResult = unserialize($careerData['extra_data']);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
$list = [];
|
|
$list = [];
|
|
$subGroups = [];
|
|
$subGroups = [];
|
|
|
|
|
|
@@ -492,7 +521,6 @@ class Career extends Model
|
|
$subGroupLabel = isset($subGroupData[1]) ? $subGroupData[1] : '';
|
|
$subGroupLabel = isset($subGroupData[1]) ? $subGroupData[1] : '';
|
|
|
|
|
|
if (!empty($subGroupId) && !in_array($subGroupId, $subGroups)) {
|
|
if (!empty($subGroupId) && !in_array($subGroupId, $subGroups)) {
|
|
-
|
|
|
|
$subGroups[$subGroupId]['items'][] = $vertex->getId();
|
|
$subGroups[$subGroupId]['items'][] = $vertex->getId();
|
|
$subGroups[$subGroupId]['label'] = $subGroupLabel;
|
|
$subGroups[$subGroupId]['label'] = $subGroupLabel;
|
|
}
|
|
}
|
|
@@ -507,7 +535,6 @@ class Career extends Model
|
|
$list[$column]['column'] = $column;
|
|
$list[$column]['column'] = $column;
|
|
}
|
|
}
|
|
|
|
|
|
- $groupDrawLine = [];
|
|
|
|
$groupCourseList = [];
|
|
$groupCourseList = [];
|
|
$simpleConnectionList = [];
|
|
$simpleConnectionList = [];
|
|
|
|
|
|
@@ -517,7 +544,6 @@ class Career extends Model
|
|
|
|
|
|
foreach ($subGroupList['items'] as $vertex) {
|
|
foreach ($subGroupList['items'] as $vertex) {
|
|
if ($vertex instanceof Vertex) {
|
|
if ($vertex instanceof Vertex) {
|
|
- $rowId = $vertex->getId();
|
|
|
|
$groupCourseList[$vertex->getAttribute('Column')][] = $vertex->getId();
|
|
$groupCourseList[$vertex->getAttribute('Column')][] = $vertex->getId();
|
|
$connectionList = $vertex->getAttribute('Connections');
|
|
$connectionList = $vertex->getAttribute('Connections');
|
|
if (empty($connectionList)) {
|
|
if (empty($connectionList)) {
|
|
@@ -537,12 +563,11 @@ class Career extends Model
|
|
'',
|
|
'',
|
|
$explode[0]
|
|
$explode[0]
|
|
);
|
|
);
|
|
- $groupDrawLine[$groupValueId] = true;
|
|
|
|
$simpleFirstConnection = 'g'.(int) $groupValueId;
|
|
$simpleFirstConnection = 'g'.(int) $groupValueId;
|
|
} else {
|
|
} else {
|
|
|
|
|
|
if (!empty($explode[0])) {
|
|
if (!empty($explode[0])) {
|
|
- $simpleFirstConnection = 'v'.(int) $explode[0];
|
|
+ $simpleFirstConnection = 'v'.$explode[0];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -566,7 +591,6 @@ class Career extends Model
|
|
$value
|
|
$value
|
|
);
|
|
);
|
|
$simpleSecondConnection = 'g'.(int) $groupValueId;
|
|
$simpleSecondConnection = 'g'.(int) $groupValueId;
|
|
- $groupDrawLine[$groupValueId] = true;
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
if (!empty($explode[0]) && isset($explode[1])) {
|
|
if (!empty($explode[0]) && isset($explode[1])) {
|
|
@@ -607,11 +631,18 @@ class Career extends Model
|
|
|
|
|
|
$graph->xGap = 70;
|
|
$graph->xGap = 70;
|
|
$graph->yGap = 55;
|
|
$graph->yGap = 55;
|
|
|
|
+
|
|
$graph->xDiff = 70;
|
|
$graph->xDiff = 70;
|
|
$graph->yDiff = 55;
|
|
$graph->yDiff = 55;
|
|
|
|
|
|
|
|
+ if (!empty($userResult)) {
|
|
|
|
+ $graph->blockHeight = 180;
|
|
|
|
+ $graph->yGap = 60;
|
|
|
|
+ $graph->yDiff = 60;
|
|
|
|
+ }
|
|
|
|
+
|
|
foreach ($groupsBetweenColumns as $group => $items) {
|
|
foreach ($groupsBetweenColumns as $group => $items) {
|
|
- self::parseColumnList($groupCourseList, $items, '', $graph, $simpleConnectionList);
|
|
+ self::parseColumnList($groupCourseList, $items, $graph, $simpleConnectionList, $userResult);
|
|
}
|
|
}
|
|
|
|
|
|
$graphHtml .= '<style>
|
|
$graphHtml .= '<style>
|
|
@@ -692,7 +723,6 @@ class Career extends Model
|
|
$width = $data['max_width'] + $subGroupDiffX * 2;
|
|
$width = $data['max_width'] + $subGroupDiffX * 2;
|
|
$height = $data['max_height'] + $subGroupDiffX * 2 + $spaceForSubGroupTitle;
|
|
$height = $data['max_height'] + $subGroupDiffX * 2 + $spaceForSubGroupTitle;
|
|
|
|
|
|
-
|
|
|
|
$label = '<h4 style="background: white">'.$data['label'].'</h4>';
|
|
$label = '<h4 style="background: white">'.$data['label'].'</h4>';
|
|
$vertexData = "var sg$subGroupId = graph.insertVertex(parent, null, '$label', $x, $y, $width, $height, '$style');";
|
|
$vertexData = "var sg$subGroupId = graph.insertVertex(parent, null, '$label', $x, $y, $width, $height, '$style');";
|
|
$subGroupList[] = $vertexData;
|
|
$subGroupList[] = $vertexData;
|
|
@@ -721,7 +751,16 @@ class Career extends Model
|
|
return $graphHtml;
|
|
return $graphHtml;
|
|
}
|
|
}
|
|
|
|
|
|
- public static function parseColumnList($groupCourseList, $columnList, $width, &$graph, &$connections)
|
|
+
|
|
|
|
+ * @param $groupCourseList
|
|
|
|
+ * @param $columnList
|
|
|
|
+ * @param $graph
|
|
|
|
+ * @param $connections
|
|
|
|
+ * @param $userResult
|
|
|
|
+ *
|
|
|
|
+ * @return string
|
|
|
|
+ */
|
|
|
|
+ public static function parseColumnList($groupCourseList, $columnList, &$graph, &$connections, $userResult)
|
|
{
|
|
{
|
|
$graphHtml = '';
|
|
$graphHtml = '';
|
|
$oldGroup = null;
|
|
$oldGroup = null;
|
|
@@ -798,7 +837,8 @@ class Career extends Model
|
|
$addRow,
|
|
$addRow,
|
|
$graph,
|
|
$graph,
|
|
$newGroup,
|
|
$newGroup,
|
|
- $connections
|
|
+ $connections,
|
|
|
|
+ $userResult
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -817,10 +857,11 @@ class Career extends Model
|
|
* @param stdClass $graph
|
|
* @param stdClass $graph
|
|
* @param int $group
|
|
* @param int $group
|
|
* @param array $connections
|
|
* @param array $connections
|
|
|
|
+ * @param array $userResult
|
|
*
|
|
*
|
|
* @return string
|
|
* @return string
|
|
*/
|
|
*/
|
|
- public static function parseVertexList($groupCourseList, $vertexList, $addRow = 0, &$graph, $group, &$connections)
|
|
+ public static function parseVertexList($groupCourseList, $vertexList, $addRow = 0, &$graph, $group, &$connections, $userResult)
|
|
{
|
|
{
|
|
if (empty($vertexList)) {
|
|
if (empty($vertexList)) {
|
|
return '';
|
|
return '';
|
|
@@ -851,6 +892,54 @@ class Career extends Model
|
|
$content = '<div class="pull-left">'.$vertex->getAttribute('Notes').'</div>';
|
|
$content = '<div class="pull-left">'.$vertex->getAttribute('Notes').'</div>';
|
|
$content .= '<div class="pull-right">['.$id.']</div>';
|
|
$content .= '<div class="pull-right">['.$id.']</div>';
|
|
|
|
|
|
|
|
+ if (!empty($userResult) && isset($userResult[$id])) {
|
|
|
|
+ $results = '';
|
|
|
|
+ $size = 2;
|
|
|
|
+ foreach ($userResult[$id] as $resultId => $iconData) {
|
|
|
|
+ $icon = '';
|
|
|
|
+ switch ($iconData['Icon']) {
|
|
|
|
+ case 0:
|
|
|
|
+ $icon = Display::returnFontAwesomeIcon('times-circle', $size);
|
|
|
|
+ break;
|
|
|
|
+ case 1:
|
|
|
|
+ $icon = Display::returnFontAwesomeIcon('check-circle', $size);
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ $icon = Display::returnFontAwesomeIcon('info-circle', $size);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (substr($resultId, 0, 1) == 2) {
|
|
|
|
+ $iconData['Description'] = 'Result Id = '.$resultId;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!empty($icon)) {
|
|
|
|
+ $params = [
|
|
|
|
+ 'id' => 'course_'.$id.'_'.$resultId,
|
|
|
|
+ 'data-toggle' => 'popover',
|
|
|
|
+ 'title' => 'Popover title',
|
|
|
|
+ 'class' => 'popup',
|
|
|
|
+ 'data-description' => $iconData['Description'],
|
|
|
|
+ 'data-period' => $iconData['Period'],
|
|
|
|
+ 'data-teacher-text' => $iconData['TeacherText'],
|
|
|
|
+ 'data-teacher' => $iconData['TeacherUsername'],
|
|
|
|
+ 'data-score' => $iconData['ScoreText'],
|
|
|
|
+ 'data-score-value' => $iconData['ScoreValue'],
|
|
|
|
+ 'data-info' => $iconData['Info'],
|
|
|
|
+ 'data-background-color' => $iconData['BgColor'],
|
|
|
|
+ 'data-color' => $iconData['Color'],
|
|
|
|
+ 'data-border-color' => $iconData['BorderColor'],
|
|
|
|
+ 'style' => 'color:'.$iconData['IconColor'],
|
|
|
|
+ ];
|
|
|
|
+ $results .= Display::url($icon, 'javascript:void(0);', $params);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!empty($results)) {
|
|
|
|
+ $content .= '<div class="row"></div><div class="pull-right">'.$results.'</div>';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
$title = $vertex->getAttribute('graphviz.label');
|
|
$title = $vertex->getAttribute('graphviz.label');
|
|
if (!empty($vertex->getAttribute('LinkedElement'))) {
|
|
if (!empty($vertex->getAttribute('LinkedElement'))) {
|
|
$title = Display::url($title, $vertex->getAttribute('LinkedElement'));
|
|
$title = Display::url($title, $vertex->getAttribute('LinkedElement'));
|