';
}
- //return $title;
+
$buttons = Display::tag(
'div',
"
@@ -4846,10 +4747,7 @@ class learnpath
",
['class' => 'btn-toolbar button_actions']
);
- //$buttons = '';
- //$extra = '';
- //Display::span($title, ['title' => $fullTitle])
- //return $title. $extra;
+
return
"
$extra
@@ -6130,14 +6028,14 @@ class learnpath
if (cbo) {
for(var i = cbo.length - 1; i > 0; i--) {
cbo.options[i] = null;
- }
+ }
var k=0;
for (var i = 1; i <= child_name[id].length; i++){
var option = new Option(child_name[id][i - 1], child_value[id][i - 1]);
option.style.paddingLeft = '40px';
cbo.options[i] = option;
k = i;
- }
+ }
cbo.options[k].selected = true;
}
@@ -7880,9 +7778,6 @@ class learnpath
'Width' => '100%',
'Height' => '500',
'FullPage' => true,
-// 'CreateDocumentDir' => $relative_prefix,
- // 'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
- // 'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/'.$relative_path,
];
$url = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([
@@ -7940,7 +7835,7 @@ class learnpath
Display::return_message(get_lang('Added'))
);
} else {
- $this->edit_document($this->course_info);
+ $this->edit_document();
}
}
@@ -8081,15 +7976,8 @@ class learnpath
'learnpath_item_id' => $id_in_path,
'exerciseId' => $id,
]);
- case TOOL_HOTPOTATOES: //lowercase because of strtolower above
- /*$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
- $result = Database::query("SELECT * FROM ".$TBL_DOCUMENT." WHERE c_id = $course_id AND iid=$id");
- $myrow = Database::fetch_array($result);
- $path = $myrow['path'];
-
- return $main_dir_path.'exercise/showinframes.php?file='.$path.'&cid='.$course_code.'&uid='
- .api_get_user_id().'&learnpath_id='.$learningPathId.'&learnpath_item_id='.$id_in_path
- .'&lp_view_id='.$lpViewId.'&'.$extraParams;*/
+ case TOOL_HOTPOTATOES:
+ return '';
case TOOL_FORUM:
return $main_dir_path.'forum/viewforum.php?forum='.$id.'&lp=true&'.$extraParams;
case TOOL_THREAD:
@@ -8098,19 +7986,19 @@ class learnpath
if (empty($id)) {
return '';
}
- $sql = "SELECT * FROM $tbl_topics WHERE c_id = $course_id AND iid=$id";
+ $sql = "SELECT * FROM $tbl_topics WHERE iid=$id";
$result = Database::query($sql);
- $myrow = Database::fetch_array($result);
+ $row = Database::fetch_array($result);
- return $main_dir_path.'forum/viewthread.php?thread='.$id.'&forum='.$myrow['forum_id'].'&lp=true&'
+ return $main_dir_path.'forum/viewthread.php?thread='.$id.'&forum='.$row['forum_id'].'&lp=true&'
.$extraParams;
case TOOL_POST:
$tbl_post = Database::get_course_table(TABLE_FORUM_POST);
- $result = Database::query("SELECT * FROM $tbl_post WHERE c_id = $course_id AND post_id=$id");
- $myrow = Database::fetch_array($result);
+ $result = Database::query("SELECT * FROM $tbl_post WHERE post_id=$id");
+ $row = Database::fetch_array($result);
- return $main_dir_path.'forum/viewthread.php?post='.$id.'&thread='.$myrow['thread_id'].'&forum='
- .$myrow['forum_id'].'&lp=true&'.$extraParams;
+ return $main_dir_path.'forum/viewthread.php?post='.$id.'&thread='.$row['thread_id'].'&forum='
+ .$row['forum_id'].'&lp=true&'.$extraParams;
case TOOL_READOUT_TEXT:
return api_get_path(WEB_CODE_PATH).
'lp/readout_text.php?&id='.$id.'&lp_id='.$learningPathId.'&'.$extraParams;
@@ -8127,31 +8015,6 @@ class learnpath
}
return null;
-
- $documentPathInfo = pathinfo($document->getPath());
- $mediaSupportedFiles = ['mp3', 'mp4', 'ogv', 'ogg', 'flv', 'm4v'];
- $extension = isset($documentPathInfo['extension']) ? $documentPathInfo['extension'] : '';
- $showDirectUrl = !in_array($extension, $mediaSupportedFiles);
-
- $openmethod = 2;
- $officedoc = false;
- Session::write('openmethod', $openmethod);
- Session::write('officedoc', $officedoc);
-
- if ($showDirectUrl) {
- $file = $main_course_path.'document'.$document->getPath().'?'.$extraParams;
- if (api_get_configuration_value('allow_pdf_viewerjs_in_lp')) {
- if (Link::isPdfLink($file)) {
- $pdfUrl = api_get_path(WEB_LIBRARY_PATH).'javascript/ViewerJS/index.html#'.$file;
-
- return $pdfUrl;
- }
- }
-
- return $file;
- }
-
- return api_get_path(WEB_CODE_PATH).'document/showinframes.php?id='.$id.'&'.$extraParams;
case TOOL_LP_FINAL_ITEM:
return api_get_path(WEB_CODE_PATH).'lp/lp_final_item.php?&id='.$id.'&lp_id='.$learningPathId.'&'
.$extraParams;
@@ -8803,7 +8666,6 @@ class learnpath
$itemEntity->setNextItemId(null);
//}
-
$itemEntity->setDisplayOrder($counter);
$em->persist($itemEntity);
if ($flush) {
diff --git a/public/main/lp/learnpathItem.class.php b/public/main/lp/learnpathItem.class.php
index d3bff6af5f..2bc0717a7e 100644
--- a/public/main/lp/learnpathItem.class.php
+++ b/public/main/lp/learnpathItem.class.php
@@ -320,7 +320,6 @@ class learnpathItem
{
$lp_item_view = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$lp_item = Database::get_course_table(TABLE_LP_ITEM);
- $courseId = $this->courseId;
$sql = "DELETE FROM $lp_item_view
WHERE lp_item_id = ".$this->db_id;
@@ -580,8 +579,6 @@ class learnpathItem
// If the user is an invitee, we consider there's no interaction
return 0;
}
- $courseId = $this->courseId;
-
if ($checkdb) {
$tbl = Database::get_course_table(TABLE_LP_ITEM_VIEW);
$sql = "SELECT iid FROM $tbl
@@ -623,7 +620,7 @@ class learnpathItem
{
$return = '';
if ($checkdb) {
- $this->load_interactions(true);
+ $this->load_interactions();
}
foreach ($this->interactions as $id => $in) {
$return .= "[
diff --git a/public/main/lp/lp_view.php b/public/main/lp/lp_view.php
index 9646df99e7..fe19deb235 100644
--- a/public/main/lp/lp_view.php
+++ b/public/main/lp/lp_view.php
@@ -35,7 +35,6 @@ $user_id = api_get_user_id();
$course = api_get_course_entity($course_id);
$session = api_get_session_entity($sessionId);
$lpRepo = Container::getLpRepository();
-
/** @var learnpath $oLP */
$oLP = Session::read('oLP');
// Check if the learning path is visible for student - (LP requisites)
@@ -64,7 +63,7 @@ if (!api_is_allowed_to_edit(null, true)) {
$em = Database::getManager();
if ($category) {
$block = false;
- $user = UserManager::getRepository()->find($user_id);
+ $user = api_get_user_entity($user_id);
$users = $category->getUsers();
if (!empty($users) && $users->count() > 0) {
if ($user && !$category->hasUserAdded($user)) {
@@ -362,7 +361,6 @@ if (Database::num_rows($res_media) > 0) {
$is_allowed_to_edit = api_is_allowed_to_edit(false, true, true, false);
-//global $interbreadcrumb;
if ($is_allowed_to_edit) {
$interbreadcrumb[] = [
'url' => api_get_self().'?action=list&isStudentView=false&'.api_get_cidreq(true, true, 'course'),
@@ -421,18 +419,18 @@ if ($oLP->current == $oLP->get_last()) {
);
if (!empty($categories)) {
- $gradebookEvaluations = $categories[0]->get_evaluations();
+ $evaluations = $categories[0]->get_evaluations();
$gradebookLinks = $categories[0]->get_links();
- if (0 === count($gradebookEvaluations) &&
+ if (0 === count($evaluations) &&
1 === count($gradebookLinks) &&
LINK_LEARNPATH == $gradebookLinks[0]->get_type() &&
$gradebookLinks[0]->get_ref_id() == $oLP->lp_id
) {
- $gradebookMinScore = $categories[0]->getCertificateMinScore();
+ $minScore = $categories[0]->getCertificateMinScore();
$userScore = $gradebookLinks[0]->calc_score($user_id, 'best');
$categoryEntity = Container::getGradeBookCategoryRepository()->find($categories[0]->get_id());
- if ($userScore[0] >= $gradebookMinScore) {
+ if ($userScore[0] >= $minScore) {
Category::generateUserCertificate($categoryEntity, $user_id);
}
}
@@ -471,11 +469,11 @@ $template->assign('toc_list', $get_toc_list);
$template->assign('teacher_toc_buttons', $get_teacher_buttons);
$template->assign('iframe_src', $src);
$template->assign('navigation_bar_bottom', $navigation_bar_bottom);
-$template->assign('show_left_column', 0 == $lp->getHideTocFrame());
+$template->assign('show_left_column', !$lp->getHideTocFrame());
$showMenu = 0;
$settings = api_get_configuration_value('lp_view_settings');
-$display = isset($settings['display']) ? $settings['display'] : false;
+$display = $settings['display'] ?? false;
$navigationInTheMiddle = false;
if (!empty($display)) {
$showMenu = isset($display['show_toolbar_by_default']) && $display['show_toolbar_by_default'] ? 1 : 0;
@@ -494,7 +492,7 @@ $template->assign('lp_author', $lp->getAuthor());
$lpMinTime = '';
if (Tracking::minimumTimeAvailable(api_get_session_id(), api_get_course_int_id())) {
- // Calulate minimum and accumulated time
+ // Calculate minimum and accumulated time
$timeLp = $_SESSION['oLP']->getAccumulateWorkTime();
$timeTotalCourse = $_SESSION['oLP']->getAccumulateWorkTimeTotalCourse();
// Minimum connection percentage
@@ -548,7 +546,7 @@ $template->assign('lp_title_scorm', $lp->getName());
$template->assign('data_panel', null);
//echo '';var_dump($oLP->get_toc(), array_column($oLP->get_toc(), 'status_class', 'id'));
$template->assign('status_list', array_column($oLP->get_toc(), 'status_class', 'id'));
-$template->assign('data_list', $oLP->getListArrayToc($get_toc_list));
+$template->assign('data_list', $oLP->getListArrayToc());
//var_dump($oLP->getListArrayToc($get_toc_list));
$template->assign('lp_id', $lp->getIid());
diff --git a/src/CoreBundle/Resources/views/LearnPath/menubar.html.twig b/src/CoreBundle/Resources/views/LearnPath/menubar.html.twig
index b270ed51ca..f2916ad4e1 100644
--- a/src/CoreBundle/Resources/views/LearnPath/menubar.html.twig
+++ b/src/CoreBundle/Resources/views/LearnPath/menubar.html.twig
@@ -12,10 +12,10 @@
{% endautoescape %}
\ No newline at end of file
diff --git a/src/CoreBundle/Resources/views/LearnPath/view.html.twig b/src/CoreBundle/Resources/views/LearnPath/view.html.twig
index 832357bf52..899b1300c5 100644
--- a/src/CoreBundle/Resources/views/LearnPath/view.html.twig
+++ b/src/CoreBundle/Resources/views/LearnPath/view.html.twig
@@ -68,7 +68,7 @@
- {{ "ProgressSpentInLp"|get_lang|format(lp_accumulate_work_time) }}
+ {{ "Progress"|trans|format(lp_accumulate_work_time) }}
@@ -80,7 +80,7 @@
- {{ "TimeSpentInLp"|get_lang|format(lp_accumulate_work_time) }}
+ {{ "Time spent in the learning path"|trans|format(lp_accumulate_work_time) }}
@@ -124,7 +124,7 @@
{% endif %}
- {{ "XPoints"|get_lang|format(gamification_points) }}
+ {{ "%s points"|trans|format(gamification_points) }}
@@ -158,17 +158,17 @@
@@ -256,9 +256,9 @@
$('#lp-view-expand-toggle span.fa').toggleClass('fa-expand');
var className = $('#lp-view-expand-toggle span.fa').attr('class');
if (className == 'fa fa-expand') {
- $(this).attr('title', '{{ "Expand" | get_lang }}');
+ $(this).attr('title', '{{ "Expand" | trans }}');
} else {
- $(this).attr('title', '{{ "Collapse" | get_lang }}');
+ $(this).attr('title', '{{ "Collapse" | trans }}');
}
if($('#navTabBar').is(':hidden')) {
@@ -276,9 +276,9 @@
var className = $('#lp-view-expand-toggle span.fa').attr('class');
if (className == 'fa fa-expand') {
- $(this).attr('title', '{{ "Expand" | get_lang }}');
+ $(this).attr('title', '{{ "Expand" | trans }}');
} else {
- $(this).attr('title', '{{ "Collapse" | get_lang }}');
+ $(this).attr('title', '{{ "Collapse" | trans }}');
}
});
{% endif %}
diff --git a/src/CourseBundle/Entity/CLp.php b/src/CourseBundle/Entity/CLp.php
index 88f1156bf7..1d6f280989 100644
--- a/src/CourseBundle/Entity/CLp.php
+++ b/src/CourseBundle/Entity/CLp.php
@@ -117,11 +117,13 @@ class CLp extends AbstractResource implements ResourceInterface
/**
* @ORM\Column(name="theme", type="string", length=255, nullable=false)
*/
+ #[Assert\NotBlank]
protected string $theme;
/**
* @ORM\Column(name="author", type="text", nullable=false)
*/
+ #[Assert\NotBlank]
protected string $author;
/**
@@ -509,12 +511,7 @@ class CLp extends AbstractResource implements ResourceInterface
return $this;
}
- /**
- * Get theme.
- *
- * @return string
- */
- public function getTheme()
+ public function getTheme(): string
{
return $this->theme;
}
@@ -526,12 +523,7 @@ class CLp extends AbstractResource implements ResourceInterface
return $this;
}
- /**
- * Get author.
- *
- * @return string
- */
- public function getAuthor()
+ public function getAuthor(): string
{
return $this->author;
}
@@ -560,12 +552,7 @@ class CLp extends AbstractResource implements ResourceInterface
return $this;
}
- /**
- * Get hideTocFrame.
- *
- * @return bool
- */
- public function getHideTocFrame()
+ public function getHideTocFrame(): bool
{
return $this->hideTocFrame;
}