LP: Create new item root when creating a LP + remove unused code

pull/3890/head
Julio Montoya 4 years ago
parent 479e2ad22b
commit 6b57a1a130
  1. 8
      public/main/inc/ajax/lp.ajax.php
  2. 2
      public/main/lp/lp_add.php
  3. 14
      public/main/lp/lp_controller.php

@ -130,14 +130,6 @@ switch ($action) {
if (empty($orderList)) {
exit;
}
/*$sections = explode('^', $new_order);
$sections = array_filter($sections);
// We have to update parent_item_id, previous_item_id, next_item_id, display_order in the database
$orderList = [];
foreach ($sections as $items) {
[$id, $parentId] = explode('|', $items);
$orderList[$id] = $parentId;
}*/
$learningPath = new learnpath($lp, api_get_course_info(), api_get_user_id());
$learningPath->sortItemByOrderList($orderList);

@ -207,7 +207,7 @@ if ($form->validate()) {
);*/
$lp->setSubscribeUsers(isset($_REQUEST['subscribe_users']) ? 1 : 0);
$lp->setAccumulateScormTime(1 == (int) $_REQUEST['accumulate_scorm_time'] ? 1 : 0);
$lp->setAccumulateScormTime(1 === (int) $_REQUEST['accumulate_scorm_time'] ? 1 : 0);
$lpRepo->update($lp);
$url = api_get_self().'?action=add_item&type=step&lp_id='.$lpId.'&'.api_get_cidreq();

@ -287,20 +287,6 @@ switch ($action) {
}
Session::write('refresh', 1);
// Creates first root item.
$itemRoot = $lpItemRepo->getItemRoot($lpId);
if (null == $itemRoot) {
$lpItem = new CLpItem();
$lpItem
->setTitle('root')
->setPath('root')
->setLp($lp)
->setItemType('root')
;
$em = Database::getManager();
$em->persist($lpItem);
$em->flush();
}
if (isset($_POST['submit_button']) && !empty($post_title)) {
Session::write('post_time', $_POST['post_time']);

Loading…
Cancel
Save