Fix LP creation

pull/3844/head
Julio Montoya 5 years ago
parent d787f347f6
commit e5b8df8b72
  1. 14
      public/main/lp/LearnPathItemForm.php
  2. 7
      public/main/lp/learnpath.class.php
  3. 1
      public/main/lp/learnpathItem.class.php

@ -13,13 +13,6 @@ class LearnPathItemForm
{ {
public static function setForm(FormValidator $form, $action, learnpath $lp, CLpItem $lpItem) public static function setForm(FormValidator $form, $action, learnpath $lp, CLpItem $lpItem)
{ {
$itemId = $lpItem->getIid();
$itemTitle = $lpItem->getTitle();
$itemDescription = $lpItem->getDescription();
$parentItemId = $lpItem->getParentItemId();
$itemType = $lpItem->getItemType();
$previousItemId = $lpItem->getPreviousItemId();
$arrLP = $lp->getItemsForForm(); $arrLP = $lp->getItemsForForm();
$lp->tree_array($arrLP); $lp->tree_array($arrLP);
$arrLP = isset($lp->arrMenu) ? $lp->arrMenu : []; $arrLP = isset($lp->arrMenu) ? $lp->arrMenu : [];
@ -44,6 +37,13 @@ class LearnPathItemForm
break; break;
} }
$itemId = $lpItem->getIid();
$itemTitle = $lpItem->getTitle();
$itemDescription = $lpItem->getDescription();
$parentItemId = $lpItem->getParentItemId();
$itemType = $lpItem->getItemType();
$previousItemId = $lpItem->getPreviousItemId();
$arrHide = []; $arrHide = [];
$count = count($arrLP); $count = count($arrLP);
$sections = []; $sections = [];

@ -7179,10 +7179,6 @@ class learnpath
*/ */
public function displayDocumentForm($action = 'add', $lpItem = null) public function displayDocumentForm($action = 'add', $lpItem = null)
{ {
if (empty($lpItem)) {
return '';
}
$courseInfo = api_get_course_info(); $courseInfo = api_get_course_info();
$form = new FormValidator( $form = new FormValidator(
@ -7195,7 +7191,9 @@ class learnpath
$data = $this->generate_lp_folder($courseInfo); $data = $this->generate_lp_folder($courseInfo);
if (null !== $lpItem) {
LearnPathItemForm::setForm($form, $action, $this, $lpItem); LearnPathItemForm::setForm($form, $action, $this, $lpItem);
}
switch ($action) { switch ($action) {
case 'add': case 'add':
@ -8232,7 +8230,6 @@ class learnpath
get_lang('Add the Assignments tool to the course').'</a>'; get_lang('Add the Assignments tool to the course').'</a>';
$return .= '</li>';*/ $return .= '</li>';*/
require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
$works = getWorkListTeacher(0, 100, null, null, null); $works = getWorkListTeacher(0, 100, null, null, null);
if (!empty($works)) { if (!empty($works)) {
$icon = Display::return_icon('works.png', '', [], ICON_SIZE_TINY); $icon = Display::return_icon('works.png', '', [], ICON_SIZE_TINY);

@ -2441,7 +2441,6 @@ class learnpathItem
return $returnstatus; return $returnstatus;
} elseif ('student_publication' === $itemToCheck->type) { } elseif ('student_publication' === $itemToCheck->type) {
require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
$workId = $items[$refs_list[$prereqs_string]]->path; $workId = $items[$refs_list[$prereqs_string]]->path;
$count = get_work_count_by_student($user_id, $workId); $count = get_work_count_by_student($user_id, $workId);
if ($count >= 1) { if ($count >= 1) {

Loading…
Cancel
Save