|
|
|
|
@ -253,11 +253,6 @@ class learnpath |
|
|
|
|
ORDER BY parent_item_id, display_order"; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
|
|
|
|
|
if ($debug) { |
|
|
|
|
error_log('learnpath::__construct() '.__LINE__.' - query lp items: '.$sql); |
|
|
|
|
error_log('-- Start while--'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$lp_item_id_list = []; |
|
|
|
|
while ($row = Database::fetch_array($res)) { |
|
|
|
|
$lp_item_id_list[] = $row['iid']; |
|
|
|
|
@ -342,10 +337,6 @@ class learnpath |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($debug) { |
|
|
|
|
error_log('learnpath::__construct() '.__LINE__.' ----- end while ----'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($lp_item_id_list)) { |
|
|
|
|
$lp_item_id_list_to_string = implode("','", $lp_item_id_list); |
|
|
|
|
if (!empty($lp_item_id_list_to_string)) { |
|
|
|
|
@ -359,14 +350,6 @@ class learnpath |
|
|
|
|
lp_view_id = ".$this->get_view_id()." AND |
|
|
|
|
lp_item_id IN ('".$lp_item_id_list_to_string."') |
|
|
|
|
ORDER BY view_count DESC "; |
|
|
|
|
|
|
|
|
|
if ($debug) { |
|
|
|
|
error_log( |
|
|
|
|
'learnpath::__construct() - Selecting item_views: '.$sql, |
|
|
|
|
0 |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$status_list = []; |
|
|
|
|
$res = Database::query($sql); |
|
|
|
|
while ($row = Database:: fetch_array($res)) { |
|
|
|
|
@ -524,7 +507,7 @@ class learnpath |
|
|
|
|
WHERE |
|
|
|
|
c_id = $course_id AND |
|
|
|
|
lp_id = ".$this->get_id()." AND |
|
|
|
|
parent_item_id = ".$parent; |
|
|
|
|
parent_item_id = $parent "; |
|
|
|
|
|
|
|
|
|
$res_count = Database::query($sql); |
|
|
|
|
$row = Database::fetch_array($res_count); |
|
|
|
|
@ -1164,6 +1147,7 @@ class learnpath |
|
|
|
|
public function delete_children_items($id) |
|
|
|
|
{ |
|
|
|
|
$course_id = $this->course_info['real_id']; |
|
|
|
|
|
|
|
|
|
$num = 0; |
|
|
|
|
$id = (int) $id; |
|
|
|
|
if (empty($id) || empty($course_id)) { |
|
|
|
|
@ -3302,7 +3286,7 @@ class learnpath |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$dirTypes = self::getChapterTypes(); |
|
|
|
|
$mycurrentitemid = $this->get_current_item_id(); |
|
|
|
|
$currentItemId = $this->get_current_item_id(); |
|
|
|
|
$list = []; |
|
|
|
|
$classStatus = [ |
|
|
|
|
'not attempted' => 'scorm_not_attempted', |
|
|
|
|
@ -3346,7 +3330,7 @@ class learnpath |
|
|
|
|
$subtree['title'] = $title; |
|
|
|
|
$subtree['class'] = $classStyle.' '.$cssStatus; |
|
|
|
|
$subtree['url'] = $this->get_link('http', $subtree['id'], $tree); |
|
|
|
|
$subtree['current_id'] = $mycurrentitemid; |
|
|
|
|
$subtree['current_id'] = $currentItemId; |
|
|
|
|
} |
|
|
|
|
$list[] = $subtree; |
|
|
|
|
} |
|
|
|
|
@ -3368,7 +3352,7 @@ class learnpath |
|
|
|
|
$toc_list = $this->get_toc(); |
|
|
|
|
} |
|
|
|
|
// Temporary variables. |
|
|
|
|
$mycurrentitemid = $this->get_current_item_id(); |
|
|
|
|
$currentItemId = $this->get_current_item_id(); |
|
|
|
|
$list = []; |
|
|
|
|
$arrayList = []; |
|
|
|
|
$classStatus = [ |
|
|
|
|
@ -3432,7 +3416,7 @@ class learnpath |
|
|
|
|
} else { |
|
|
|
|
$list['title'] = stripslashes($title); |
|
|
|
|
$list['url'] = $this->get_link('http', $item['id'], $toc_list); |
|
|
|
|
$list['current_id'] = $mycurrentitemid; |
|
|
|
|
$list['current_id'] = $currentItemId; |
|
|
|
|
} |
|
|
|
|
$arrayList[] = $list; |
|
|
|
|
} |
|
|
|
|
@ -3497,6 +3481,14 @@ class learnpath |
|
|
|
|
return 'N/A'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
public function getNameNoTags() |
|
|
|
|
{ |
|
|
|
|
return strip_tags($this->get_name()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Gets a link to the resource from the present location, depending on item ID. |
|
|
|
|
* |
|
|
|
|
@ -5989,34 +5981,7 @@ class learnpath |
|
|
|
|
public function processBuildMenuElements($update_audio = 'false') |
|
|
|
|
{ |
|
|
|
|
$is_allowed_to_edit = api_is_allowed_to_edit(null, true); |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$table = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM $table |
|
|
|
|
WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
|
|
|
|
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$arrLP = []; |
|
|
|
|
while ($row = Database::fetch_array($result)) { |
|
|
|
|
$arrLP[] = [ |
|
|
|
|
'id' => $row['iid'], |
|
|
|
|
'item_type' => $row['item_type'], |
|
|
|
|
'title' => Security::remove_XSS($row['title']), |
|
|
|
|
'path' => $row['path'], |
|
|
|
|
'description' => Security::remove_XSS($row['description']), |
|
|
|
|
'parent_item_id' => $row['parent_item_id'], |
|
|
|
|
'previous_item_id' => $row['previous_item_id'], |
|
|
|
|
'next_item_id' => $row['next_item_id'], |
|
|
|
|
'max_score' => $row['max_score'], |
|
|
|
|
'min_score' => $row['min_score'], |
|
|
|
|
'mastery_score' => $row['mastery_score'], |
|
|
|
|
'prerequisite' => $row['prerequisite'], |
|
|
|
|
'display_order' => $row['display_order'], |
|
|
|
|
'audio' => $row['audio'], |
|
|
|
|
'prerequisite_max_score' => $row['prerequisite_max_score'], |
|
|
|
|
'prerequisite_min_score' => $row['prerequisite_min_score'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
$arrLP = $this->getItemsForForm(); |
|
|
|
|
|
|
|
|
|
$this->tree_array($arrLP); |
|
|
|
|
$arrLP = isset($this->arrMenu) ? $this->arrMenu : []; |
|
|
|
|
@ -6482,7 +6447,6 @@ class learnpath |
|
|
|
|
*/ |
|
|
|
|
public function return_new_tree($update_audio = 'false', $drop_element_here = false) |
|
|
|
|
{ |
|
|
|
|
$return = ''; |
|
|
|
|
$result = $this->processBuildMenuElements($update_audio); |
|
|
|
|
|
|
|
|
|
$list = '<ul id="lp_item_list">'; |
|
|
|
|
@ -6501,7 +6465,7 @@ class learnpath |
|
|
|
|
} |
|
|
|
|
$list .= '</ul>'; |
|
|
|
|
|
|
|
|
|
$return .= Display::panelCollapse( |
|
|
|
|
$return = Display::panelCollapse( |
|
|
|
|
$this->name, |
|
|
|
|
$list, |
|
|
|
|
'scorm-list', |
|
|
|
|
@ -6533,7 +6497,7 @@ class learnpath |
|
|
|
|
$item['type'] = $default_content[$item['load_data']]['item_type']; |
|
|
|
|
} |
|
|
|
|
$sub_list = ''; |
|
|
|
|
if (isset($item['type']) && $item['type'] == 'dir') { |
|
|
|
|
if (isset($item['type']) && $item['type'] === 'dir') { |
|
|
|
|
// empty value |
|
|
|
|
$sub_list = Display::tag('li', '', ['class' => 'sub_item empty']); |
|
|
|
|
} |
|
|
|
|
@ -7453,7 +7417,6 @@ class learnpath |
|
|
|
|
{ |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$id = (int) $id; |
|
|
|
|
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$tbl_quiz = Database::get_course_table(TABLE_QUIZ_TEST); |
|
|
|
|
|
|
|
|
|
if ($id != 0 && is_array($extra_info)) { |
|
|
|
|
@ -7480,30 +7443,7 @@ class learnpath |
|
|
|
|
$parent = $extra_info['parent_item_id']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM $tbl_lp_item |
|
|
|
|
WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
|
|
|
|
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$arrLP = []; |
|
|
|
|
while ($row = Database::fetch_array($result)) { |
|
|
|
|
$arrLP[] = [ |
|
|
|
|
'id' => $row['iid'], |
|
|
|
|
'item_type' => $row['item_type'], |
|
|
|
|
'title' => $row['title'], |
|
|
|
|
'path' => $row['path'], |
|
|
|
|
'description' => $row['description'], |
|
|
|
|
'parent_item_id' => $row['parent_item_id'], |
|
|
|
|
'previous_item_id' => $row['previous_item_id'], |
|
|
|
|
'next_item_id' => $row['next_item_id'], |
|
|
|
|
'display_order' => $row['display_order'], |
|
|
|
|
'max_score' => $row['max_score'], |
|
|
|
|
'min_score' => $row['min_score'], |
|
|
|
|
'mastery_score' => $row['mastery_score'], |
|
|
|
|
'prerequisite' => $row['prerequisite'], |
|
|
|
|
'max_time_allowed' => $row['max_time_allowed'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$arrLP = $this->getItemsForForm(); |
|
|
|
|
$this->tree_array($arrLP); |
|
|
|
|
$arrLP = isset($this->arrMenu) ? $this->arrMenu : []; |
|
|
|
|
unset($this->arrMenu); |
|
|
|
|
@ -7530,7 +7470,7 @@ class learnpath |
|
|
|
|
$form->addHeader($legend); |
|
|
|
|
|
|
|
|
|
if ($action != 'move') { |
|
|
|
|
$form->addText('title', get_lang('Title'), true, ['id' => 'idTitle']); |
|
|
|
|
$this->setItemTitle($form); |
|
|
|
|
$defaults['title'] = $item_title; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -7620,13 +7560,13 @@ class learnpath |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($action == 'add') { |
|
|
|
|
if ($action === 'add') { |
|
|
|
|
$form->addButtonSave(get_lang('AddExercise'), 'submit_button'); |
|
|
|
|
} else { |
|
|
|
|
$form->addButtonSave(get_lang('EditCurrentExecice'), 'submit_button'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($action == 'move') { |
|
|
|
|
if ($action === 'move') { |
|
|
|
|
$form->addHidden('title', $item_title); |
|
|
|
|
$form->addHidden('description', $item_description); |
|
|
|
|
} |
|
|
|
|
@ -7656,8 +7596,7 @@ class learnpath |
|
|
|
|
public function display_hotpotatoes_form($action = 'add', $id = 0, $extra_info = '') |
|
|
|
|
{ |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$uploadPath = DIR_HOTPOTATOES; //defined in main_api |
|
|
|
|
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$uploadPath = DIR_HOTPOTATOES; |
|
|
|
|
|
|
|
|
|
if ($id != 0 && is_array($extra_info)) { |
|
|
|
|
$item_title = stripslashes($extra_info['title']); |
|
|
|
|
@ -7665,9 +7604,9 @@ class learnpath |
|
|
|
|
} elseif (is_numeric($extra_info)) { |
|
|
|
|
$TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT); |
|
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM ".$TBL_DOCUMENT." |
|
|
|
|
$sql = "SELECT * FROM $TBL_DOCUMENT |
|
|
|
|
WHERE |
|
|
|
|
c_id = ".$course_id." AND |
|
|
|
|
c_id = $course_id AND |
|
|
|
|
path LIKE '".$uploadPath."/%/%htm%' AND |
|
|
|
|
iid = ".(int) $extra_info." |
|
|
|
|
ORDER BY iid ASC"; |
|
|
|
|
@ -7686,35 +7625,12 @@ class learnpath |
|
|
|
|
$item_description = ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$parent = 0; |
|
|
|
|
if ($id != 0 && is_array($extra_info)) { |
|
|
|
|
$parent = $extra_info['parent_item_id']; |
|
|
|
|
} else { |
|
|
|
|
$parent = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM $tbl_lp_item |
|
|
|
|
WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$arrLP = []; |
|
|
|
|
while ($row = Database::fetch_array($result)) { |
|
|
|
|
$arrLP[] = [ |
|
|
|
|
'id' => $row['id'], |
|
|
|
|
'item_type' => $row['item_type'], |
|
|
|
|
'title' => $row['title'], |
|
|
|
|
'path' => $row['path'], |
|
|
|
|
'description' => $row['description'], |
|
|
|
|
'parent_item_id' => $row['parent_item_id'], |
|
|
|
|
'previous_item_id' => $row['previous_item_id'], |
|
|
|
|
'next_item_id' => $row['next_item_id'], |
|
|
|
|
'display_order' => $row['display_order'], |
|
|
|
|
'max_score' => $row['max_score'], |
|
|
|
|
'min_score' => $row['min_score'], |
|
|
|
|
'mastery_score' => $row['mastery_score'], |
|
|
|
|
'prerequisite' => $row['prerequisite'], |
|
|
|
|
'max_time_allowed' => $row['max_time_allowed'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$arrLP = $this->getItemsForForm(); |
|
|
|
|
$legend = '<legend>'; |
|
|
|
|
if ($action == 'add') { |
|
|
|
|
$legend .= get_lang('CreateTheExercise'); |
|
|
|
|
@ -7738,9 +7654,7 @@ class learnpath |
|
|
|
|
$return .= '<td class="input">'; |
|
|
|
|
$return .= '<select id="idParent" name="parent" onChange="javascript: load_cbo(this.value);" size="1">'; |
|
|
|
|
$return .= '<option class="top" value="0">'.$this->name.'</option>'; |
|
|
|
|
$arrHide = [ |
|
|
|
|
$id, |
|
|
|
|
]; |
|
|
|
|
$arrHide = [$id]; |
|
|
|
|
|
|
|
|
|
if (count($arrLP) > 0) { |
|
|
|
|
for ($i = 0; $i < count($arrLP); $i++) { |
|
|
|
|
@ -7781,7 +7695,8 @@ class learnpath |
|
|
|
|
$selected = ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'.get_lang('After').' "'.$arrLP[$i]['title'].'"</option>'; |
|
|
|
|
$return .= '<option '.$selected.'value="'.$arrLP[$i]['id'].'">'. |
|
|
|
|
get_lang('After').' "'.$arrLP[$i]['title'].'"</option>'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -7849,9 +7764,11 @@ class learnpath |
|
|
|
|
public function display_forum_form($action = 'add', $id = 0, $extra_info = '') |
|
|
|
|
{ |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$tbl_forum = Database::get_course_table(TABLE_FORUM); |
|
|
|
|
|
|
|
|
|
$item_title = ''; |
|
|
|
|
$item_description = ''; |
|
|
|
|
|
|
|
|
|
if ($id != 0 && is_array($extra_info)) { |
|
|
|
|
$item_title = stripslashes($extra_info['title']); |
|
|
|
|
} elseif (is_numeric($extra_info)) { |
|
|
|
|
@ -7864,41 +7781,12 @@ class learnpath |
|
|
|
|
|
|
|
|
|
$item_title = $row['title']; |
|
|
|
|
$item_description = $row['comment']; |
|
|
|
|
} else { |
|
|
|
|
$item_title = ''; |
|
|
|
|
$item_description = ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$parent = 0; |
|
|
|
|
if ($id != 0 && is_array($extra_info)) { |
|
|
|
|
$parent = $extra_info['parent_item_id']; |
|
|
|
|
} else { |
|
|
|
|
$parent = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM $tbl_lp_item |
|
|
|
|
WHERE |
|
|
|
|
c_id = $course_id AND |
|
|
|
|
lp_id = ".$this->lp_id; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$arrLP = []; |
|
|
|
|
while ($row = Database::fetch_array($result)) { |
|
|
|
|
$arrLP[] = [ |
|
|
|
|
'id' => $row['iid'], |
|
|
|
|
'item_type' => $row['item_type'], |
|
|
|
|
'title' => $row['title'], |
|
|
|
|
'path' => $row['path'], |
|
|
|
|
'description' => $row['description'], |
|
|
|
|
'parent_item_id' => $row['parent_item_id'], |
|
|
|
|
'previous_item_id' => $row['previous_item_id'], |
|
|
|
|
'next_item_id' => $row['next_item_id'], |
|
|
|
|
'display_order' => $row['display_order'], |
|
|
|
|
'max_score' => $row['max_score'], |
|
|
|
|
'min_score' => $row['min_score'], |
|
|
|
|
'mastery_score' => $row['mastery_score'], |
|
|
|
|
'prerequisite' => $row['prerequisite'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$arrLP = $this->getItemsForForm(); |
|
|
|
|
$this->tree_array($arrLP); |
|
|
|
|
$arrLP = isset($this->arrMenu) ? $this->arrMenu : []; |
|
|
|
|
unset($this->arrMenu); |
|
|
|
|
@ -7921,12 +7809,7 @@ class learnpath |
|
|
|
|
$form->addHeader($legend); |
|
|
|
|
|
|
|
|
|
if ($action != 'move') { |
|
|
|
|
$form->addText( |
|
|
|
|
'title', |
|
|
|
|
get_lang('Title'), |
|
|
|
|
true, |
|
|
|
|
['id' => 'idTitle', 'class' => 'learnpath_item_form'] |
|
|
|
|
); |
|
|
|
|
$this->setItemTitle($form); |
|
|
|
|
$defaults['title'] = $item_title; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -8070,9 +7953,10 @@ class learnpath |
|
|
|
|
if (empty($course_id)) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$tbl_forum = Database::get_course_table(TABLE_FORUM_THREAD); |
|
|
|
|
|
|
|
|
|
$item_title = ''; |
|
|
|
|
$item_description = ''; |
|
|
|
|
if ($id != 0 && is_array($extra_info)) { |
|
|
|
|
$item_title = stripslashes($extra_info['title']); |
|
|
|
|
} elseif (is_numeric($extra_info)) { |
|
|
|
|
@ -8084,40 +7968,14 @@ class learnpath |
|
|
|
|
|
|
|
|
|
$item_title = $row['title']; |
|
|
|
|
$item_description = ''; |
|
|
|
|
} else { |
|
|
|
|
$item_title = ''; |
|
|
|
|
$item_description = ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$parent = 0; |
|
|
|
|
if ($id != 0 && is_array($extra_info)) { |
|
|
|
|
$parent = $extra_info['parent_item_id']; |
|
|
|
|
} else { |
|
|
|
|
$parent = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM $tbl_lp_item |
|
|
|
|
WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
|
|
|
|
|
$arrLP = []; |
|
|
|
|
while ($row = Database::fetch_array($result)) { |
|
|
|
|
$arrLP[] = [ |
|
|
|
|
'id' => $row['iid'], |
|
|
|
|
'item_type' => $row['item_type'], |
|
|
|
|
'title' => $row['title'], |
|
|
|
|
'path' => $row['path'], |
|
|
|
|
'description' => $row['description'], |
|
|
|
|
'parent_item_id' => $row['parent_item_id'], |
|
|
|
|
'previous_item_id' => $row['previous_item_id'], |
|
|
|
|
'next_item_id' => $row['next_item_id'], |
|
|
|
|
'display_order' => $row['display_order'], |
|
|
|
|
'max_score' => $row['max_score'], |
|
|
|
|
'min_score' => $row['min_score'], |
|
|
|
|
'mastery_score' => $row['mastery_score'], |
|
|
|
|
'prerequisite' => $row['prerequisite'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$arrLP = $this->getItemsForForm(); |
|
|
|
|
$this->tree_array($arrLP); |
|
|
|
|
$arrLP = isset($this->arrMenu) ? $this->arrMenu : []; |
|
|
|
|
unset($this->arrMenu); |
|
|
|
|
@ -8212,12 +8070,7 @@ class learnpath |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($action != 'move') { |
|
|
|
|
$form->addText( |
|
|
|
|
'title', |
|
|
|
|
get_lang('Title'), |
|
|
|
|
true, |
|
|
|
|
['id' => 'idTitle'] |
|
|
|
|
); |
|
|
|
|
$this->setItemTitle($form); |
|
|
|
|
$defaults['title'] = $item_title; |
|
|
|
|
|
|
|
|
|
$id_prerequisite = 0; |
|
|
|
|
@ -8339,7 +8192,7 @@ class learnpath |
|
|
|
|
$arrLP[] = [ |
|
|
|
|
'id' => $row['iid'], |
|
|
|
|
'item_type' => $row['item_type'], |
|
|
|
|
'title' => $row['title'], |
|
|
|
|
'title' => $this->cleanItemTitle($row['title']), |
|
|
|
|
'path' => $row['path'], |
|
|
|
|
'description' => $row['description'], |
|
|
|
|
'parent_item_id' => $row['parent_item_id'], |
|
|
|
|
@ -8359,7 +8212,7 @@ class learnpath |
|
|
|
|
|
|
|
|
|
$url = api_get_self().'?'.api_get_cidreq().'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id; |
|
|
|
|
|
|
|
|
|
$form = new FormValidator('form', 'POST', $url); |
|
|
|
|
$form = new FormValidator('form_'.$item_type, 'POST', $url); |
|
|
|
|
$defaults['title'] = api_html_entity_decode( |
|
|
|
|
$item_title, |
|
|
|
|
ENT_QUOTES, |
|
|
|
|
@ -8373,7 +8226,7 @@ class learnpath |
|
|
|
|
$charset = api_get_system_encoding(); |
|
|
|
|
for ($i = 0; $i < count($arrLP); $i++) { |
|
|
|
|
if ($action != 'add') { |
|
|
|
|
if ($arrLP[$i]['item_type'] == 'dir' && !in_array($arrLP[$i]['id'], $arrHide) && |
|
|
|
|
if ($arrLP[$i]['item_type'] === 'dir' && !in_array($arrLP[$i]['id'], $arrHide) && |
|
|
|
|
!in_array($arrLP[$i]['parent_item_id'], $arrHide) |
|
|
|
|
) { |
|
|
|
|
$arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
|
|
|
|
@ -8383,7 +8236,7 @@ class learnpath |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if ($arrLP[$i]['item_type'] == 'dir') { |
|
|
|
|
if ($arrLP[$i]['item_type'] === 'dir') { |
|
|
|
|
$arrHide[$arrLP[$i]['id']]['value'] = $arrLP[$i]['title']; |
|
|
|
|
$arrHide[$arrLP[$i]['id']]['padding'] = 20 + $arrLP[$i]['depth'] * 20; |
|
|
|
|
if ($parent == $arrLP[$i]['id']) { |
|
|
|
|
@ -8394,9 +8247,7 @@ class learnpath |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($action != 'move') { |
|
|
|
|
$form->addElement('text', 'title', get_lang('Title')); |
|
|
|
|
$form->applyFilter('title', 'html_filter'); |
|
|
|
|
$form->addRule('title', get_lang('ThisFieldIsRequired'), 'required'); |
|
|
|
|
$this->setItemTitle($form); |
|
|
|
|
} else { |
|
|
|
|
$form->addElement('hidden', 'title'); |
|
|
|
|
} |
|
|
|
|
@ -8408,7 +8259,7 @@ class learnpath |
|
|
|
|
'', |
|
|
|
|
[ |
|
|
|
|
'id' => 'idParent', |
|
|
|
|
'onchange' => "javascript: load_cbo(this.value);", |
|
|
|
|
'onchange' => 'javascript: load_cbo(this.value);', |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
@ -8428,6 +8279,7 @@ class learnpath |
|
|
|
|
if (is_array($arrLP)) { |
|
|
|
|
reset($arrLP); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$arrHide = []; |
|
|
|
|
// POSITION |
|
|
|
|
for ($i = 0; $i < count($arrLP); $i++) { |
|
|
|
|
@ -8467,7 +8319,7 @@ class learnpath |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// When new chapter add at the end |
|
|
|
|
if ($action == 'add_item') { |
|
|
|
|
if ($action === 'add_item') { |
|
|
|
|
$position->setSelected($lastPosition); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -8478,7 +8330,7 @@ class learnpath |
|
|
|
|
$form->addButtonSave(get_lang('SaveSection'), 'submit_button'); |
|
|
|
|
|
|
|
|
|
//fix in order to use the tab |
|
|
|
|
if ($item_type == 'dir') { |
|
|
|
|
if ($item_type === 'dir') { |
|
|
|
|
$form->addElement('hidden', 'type', 'dir'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -8503,7 +8355,6 @@ class learnpath |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$relative_prefix = ''; |
|
|
|
|
|
|
|
|
|
$editor_config = [ |
|
|
|
|
'ToolbarSet' => 'LearningPathDocuments', |
|
|
|
|
'Width' => '100%', |
|
|
|
|
@ -8562,7 +8413,6 @@ class learnpath |
|
|
|
|
{ |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$_course = api_get_course_info(); |
|
|
|
|
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$tbl_doc = Database::get_course_table(TABLE_DOCUMENT); |
|
|
|
|
|
|
|
|
|
$no_display_edit_textarea = false; |
|
|
|
|
@ -8594,6 +8444,9 @@ class learnpath |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$item_title = ''; |
|
|
|
|
$item_description = ''; |
|
|
|
|
if ($id != 0 && is_array($extra_info)) { |
|
|
|
|
$item_title = stripslashes($extra_info['title']); |
|
|
|
|
$item_description = stripslashes($extra_info['description']); |
|
|
|
|
@ -8614,39 +8467,15 @@ class learnpath |
|
|
|
|
$path_parts = pathinfo($row['path']); |
|
|
|
|
$item_title = stripslashes($path_parts['filename']); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
$item_title = ''; |
|
|
|
|
$item_description = ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$return = '<legend>'; |
|
|
|
|
$parent = 0; |
|
|
|
|
if ($id != 0 && is_array($extra_info)) { |
|
|
|
|
$parent = $extra_info['parent_item_id']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM $tbl_lp_item |
|
|
|
|
WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$arrLP = []; |
|
|
|
|
|
|
|
|
|
while ($row = Database::fetch_array($result)) { |
|
|
|
|
$arrLP[] = [ |
|
|
|
|
'id' => $row['iid'], |
|
|
|
|
'item_type' => $row['item_type'], |
|
|
|
|
'title' => $row['title'], |
|
|
|
|
'path' => $row['path'], |
|
|
|
|
'description' => $row['description'], |
|
|
|
|
'parent_item_id' => $row['parent_item_id'], |
|
|
|
|
'previous_item_id' => $row['previous_item_id'], |
|
|
|
|
'next_item_id' => $row['next_item_id'], |
|
|
|
|
'display_order' => $row['display_order'], |
|
|
|
|
'max_score' => $row['max_score'], |
|
|
|
|
'min_score' => $row['min_score'], |
|
|
|
|
'mastery_score' => $row['mastery_score'], |
|
|
|
|
'prerequisite' => $row['prerequisite'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$arrLP = $this->getItemsForForm(); |
|
|
|
|
$this->tree_array($arrLP); |
|
|
|
|
$arrLP = isset($this->arrMenu) ? $this->arrMenu : []; |
|
|
|
|
unset($this->arrMenu); |
|
|
|
|
@ -8701,14 +8530,7 @@ class learnpath |
|
|
|
|
if (isset($data['id'])) { |
|
|
|
|
$defaults['directory_parent_id'] = $data['id']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$form->addElement( |
|
|
|
|
'text', |
|
|
|
|
'title', |
|
|
|
|
get_lang('Title'), |
|
|
|
|
['id' => 'idTitle', 'class' => 'col-md-4'] |
|
|
|
|
); |
|
|
|
|
$form->applyFilter('title', 'html_filter'); |
|
|
|
|
$this->setItemTitle($form); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$arrHide[0]['value'] = $this->name; |
|
|
|
|
@ -8951,7 +8773,6 @@ class learnpath |
|
|
|
|
{ |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$_course = api_get_course_info(); |
|
|
|
|
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$tbl_doc = Database::get_course_table(TABLE_DOCUMENT); |
|
|
|
|
|
|
|
|
|
$no_display_edit_textarea = false; |
|
|
|
|
@ -8968,6 +8789,8 @@ class learnpath |
|
|
|
|
} |
|
|
|
|
$no_display_add = false; |
|
|
|
|
|
|
|
|
|
$item_title = ''; |
|
|
|
|
$item_description = ''; |
|
|
|
|
if ($id != 0 && is_array($extra_info)) { |
|
|
|
|
$item_title = stripslashes($extra_info['title']); |
|
|
|
|
$item_description = stripslashes($extra_info['description']); |
|
|
|
|
@ -8986,44 +8809,19 @@ class learnpath |
|
|
|
|
$path_parts = pathinfo($row['path']); |
|
|
|
|
$item_title = stripslashes($path_parts['filename']); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
$item_title = ''; |
|
|
|
|
$item_description = ''; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$parent = 0; |
|
|
|
|
if ($id != 0 && is_array($extra_info)) { |
|
|
|
|
$parent = $extra_info['parent_item_id']; |
|
|
|
|
} else { |
|
|
|
|
$parent = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM $tbl_lp_item WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$arrLP = []; |
|
|
|
|
|
|
|
|
|
while ($row = Database::fetch_array($result)) { |
|
|
|
|
$arrLP[] = [ |
|
|
|
|
'id' => $row['iid'], |
|
|
|
|
'item_type' => $row['item_type'], |
|
|
|
|
'title' => $row['title'], |
|
|
|
|
'path' => $row['path'], |
|
|
|
|
'description' => $row['description'], |
|
|
|
|
'parent_item_id' => $row['parent_item_id'], |
|
|
|
|
'previous_item_id' => $row['previous_item_id'], |
|
|
|
|
'next_item_id' => $row['next_item_id'], |
|
|
|
|
'display_order' => $row['display_order'], |
|
|
|
|
'max_score' => $row['max_score'], |
|
|
|
|
'min_score' => $row['min_score'], |
|
|
|
|
'mastery_score' => $row['mastery_score'], |
|
|
|
|
'prerequisite' => $row['prerequisite'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$arrLP = $this->getItemsForForm(); |
|
|
|
|
$this->tree_array($arrLP); |
|
|
|
|
$arrLP = isset($this->arrMenu) ? $this->arrMenu : []; |
|
|
|
|
unset($this->arrMenu); |
|
|
|
|
|
|
|
|
|
if ($action == 'add') { |
|
|
|
|
if ($action === 'add') { |
|
|
|
|
$formHeader = get_lang('CreateTheDocument'); |
|
|
|
|
} else { |
|
|
|
|
$formHeader = get_lang('EditTheCurrentDocument'); |
|
|
|
|
@ -9074,14 +8872,7 @@ class learnpath |
|
|
|
|
if (isset($data['id'])) { |
|
|
|
|
$defaults['directory_parent_id'] = $data['id']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$form->addElement( |
|
|
|
|
'text', |
|
|
|
|
'title', |
|
|
|
|
get_lang('Title') |
|
|
|
|
); |
|
|
|
|
$form->applyFilter('title', 'trim'); |
|
|
|
|
$form->applyFilter('title', 'html_filter'); |
|
|
|
|
$this->setItemTitle($form); |
|
|
|
|
|
|
|
|
|
$arrHide[0]['value'] = $this->name; |
|
|
|
|
$arrHide[0]['padding'] = 20; |
|
|
|
|
@ -9417,7 +9208,6 @@ class learnpath |
|
|
|
|
public function display_link_form($action = 'add', $id = 0, $extra_info = '') |
|
|
|
|
{ |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$tbl_link = Database::get_course_table(TABLE_LINK); |
|
|
|
|
|
|
|
|
|
$item_title = ''; |
|
|
|
|
@ -9451,28 +9241,7 @@ class learnpath |
|
|
|
|
$parent = $extra_info['parent_item_id']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM $tbl_lp_item |
|
|
|
|
WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$arrLP = []; |
|
|
|
|
|
|
|
|
|
while ($row = Database::fetch_array($result)) { |
|
|
|
|
$arrLP[] = [ |
|
|
|
|
'id' => $row['id'], |
|
|
|
|
'item_type' => $row['item_type'], |
|
|
|
|
'title' => $row['title'], |
|
|
|
|
'path' => $row['path'], |
|
|
|
|
'description' => $row['description'], |
|
|
|
|
'parent_item_id' => $row['parent_item_id'], |
|
|
|
|
'previous_item_id' => $row['previous_item_id'], |
|
|
|
|
'next_item_id' => $row['next_item_id'], |
|
|
|
|
'display_order' => $row['display_order'], |
|
|
|
|
'max_score' => $row['max_score'], |
|
|
|
|
'min_score' => $row['min_score'], |
|
|
|
|
'mastery_score' => $row['mastery_score'], |
|
|
|
|
'prerequisite' => $row['prerequisite'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
$arrLP = $this->getItemsForForm(); |
|
|
|
|
|
|
|
|
|
$this->tree_array($arrLP); |
|
|
|
|
$arrLP = isset($this->arrMenu) ? $this->arrMenu : []; |
|
|
|
|
@ -9489,7 +9258,7 @@ class learnpath |
|
|
|
|
$form->addHeader($legend); |
|
|
|
|
|
|
|
|
|
if ($action != 'move') { |
|
|
|
|
$form->addText('title', get_lang('Title'), true, ['class' => 'learnpath_item_form']); |
|
|
|
|
$this->setItemTitle($form); |
|
|
|
|
$defaults['title'] = $item_title; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -9624,7 +9393,6 @@ class learnpath |
|
|
|
|
$extra_info = '' |
|
|
|
|
) { |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$tbl_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION); |
|
|
|
|
|
|
|
|
|
$item_title = get_lang('Student_publication'); |
|
|
|
|
@ -9649,28 +9417,7 @@ class learnpath |
|
|
|
|
$parent = $extra_info['parent_item_id']; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM $tbl_lp_item |
|
|
|
|
WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$arrLP = []; |
|
|
|
|
|
|
|
|
|
while ($row = Database::fetch_array($result)) { |
|
|
|
|
$arrLP[] = [ |
|
|
|
|
'id' => $row['iid'], |
|
|
|
|
'item_type' => $row['item_type'], |
|
|
|
|
'title' => $row['title'], |
|
|
|
|
'path' => $row['path'], |
|
|
|
|
'description' => $row['description'], |
|
|
|
|
'parent_item_id' => $row['parent_item_id'], |
|
|
|
|
'previous_item_id' => $row['previous_item_id'], |
|
|
|
|
'next_item_id' => $row['next_item_id'], |
|
|
|
|
'display_order' => $row['display_order'], |
|
|
|
|
'max_score' => $row['max_score'], |
|
|
|
|
'min_score' => $row['min_score'], |
|
|
|
|
'mastery_score' => $row['mastery_score'], |
|
|
|
|
'prerequisite' => $row['prerequisite'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
$arrLP = $this->getItemsForForm(); |
|
|
|
|
|
|
|
|
|
$this->tree_array($arrLP); |
|
|
|
|
$arrLP = isset($this->arrMenu) ? $this->arrMenu : []; |
|
|
|
|
@ -9687,12 +9434,7 @@ class learnpath |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($action != 'move') { |
|
|
|
|
$form->addText( |
|
|
|
|
'title', |
|
|
|
|
get_lang('Title'), |
|
|
|
|
true, |
|
|
|
|
['class' => 'learnpath_item_form', 'id' => 'idTitle'] |
|
|
|
|
); |
|
|
|
|
$this->setItemTitle($form); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$parentSelect = $form->addSelect( |
|
|
|
|
@ -9914,6 +9656,7 @@ class learnpath |
|
|
|
|
$return .= 'var child_value = new Array();'."\n\n"; |
|
|
|
|
$return .= 'child_name[0] = new Array();'."\n"; |
|
|
|
|
$return .= 'child_value[0] = new Array();'."\n\n"; |
|
|
|
|
|
|
|
|
|
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$sql = "SELECT * FROM ".$tbl_lp_item." |
|
|
|
|
WHERE |
|
|
|
|
@ -9924,7 +9667,9 @@ class learnpath |
|
|
|
|
$res_zero = Database::query($sql); |
|
|
|
|
$i = 0; |
|
|
|
|
|
|
|
|
|
while ($row_zero = Database::fetch_array($res_zero)) { |
|
|
|
|
$list = $this->getItemsForForm(true); |
|
|
|
|
|
|
|
|
|
foreach ($list as $row_zero) { |
|
|
|
|
if ($row_zero['item_type'] !== TOOL_LP_FINAL_ITEM) { |
|
|
|
|
if ($row_zero['item_type'] == TOOL_QUIZ) { |
|
|
|
|
$row_zero['title'] = Exercise::get_formated_title_variable($row_zero['title']); |
|
|
|
|
@ -9934,6 +9679,7 @@ class learnpath |
|
|
|
|
$return .= 'child_value[0]['.$i++.'] = "'.$row_zero['iid'].'";'."\n"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$return .= "\n"; |
|
|
|
|
$sql = "SELECT * FROM $tbl_lp_item |
|
|
|
|
WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
|
|
|
@ -9950,7 +9696,7 @@ class learnpath |
|
|
|
|
$return .= 'child_value['.$row['iid'].'] = new Array();'."\n\n"; |
|
|
|
|
|
|
|
|
|
while ($row_parent = Database::fetch_array($res_parent)) { |
|
|
|
|
$js_var = json_encode(get_lang('After').' '.$row_parent['title']); |
|
|
|
|
$js_var = json_encode(get_lang('After').' '.$this->cleanItemTitle($row_parent['title'])); |
|
|
|
|
$return .= 'child_name['.$row['iid'].']['.$i.'] = '.$js_var.' ;'."\n"; |
|
|
|
|
$return .= 'child_value['.$row['iid'].']['.$i++.'] = "'.$row_parent['iid'].'";'."\n"; |
|
|
|
|
} |
|
|
|
|
@ -10100,7 +9846,6 @@ class learnpath |
|
|
|
|
$sql = "SELECT * FROM $tbl_lp_item |
|
|
|
|
WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$arrLP = []; |
|
|
|
|
|
|
|
|
|
$selectedMinScore = []; |
|
|
|
|
$selectedMaxScore = []; |
|
|
|
|
@ -10111,26 +9856,9 @@ class learnpath |
|
|
|
|
$selectedMaxScore[$row['prerequisite']] = $row['prerequisite_max_score']; |
|
|
|
|
} |
|
|
|
|
$masteryScore[$row['iid']] = $row['mastery_score']; |
|
|
|
|
|
|
|
|
|
$arrLP[] = [ |
|
|
|
|
'id' => $row['iid'], |
|
|
|
|
'item_type' => $row['item_type'], |
|
|
|
|
'title' => $row['title'], |
|
|
|
|
'ref' => $row['ref'], |
|
|
|
|
'description' => $row['description'], |
|
|
|
|
'parent_item_id' => $row['parent_item_id'], |
|
|
|
|
'previous_item_id' => $row['previous_item_id'], |
|
|
|
|
'next_item_id' => $row['next_item_id'], |
|
|
|
|
'max_score' => $row['max_score'], |
|
|
|
|
'min_score' => $row['min_score'], |
|
|
|
|
'mastery_score' => $row['mastery_score'], |
|
|
|
|
'prerequisite' => $row['prerequisite'], |
|
|
|
|
'display_order' => $row['display_order'], |
|
|
|
|
'prerequisite_min_score' => $row['prerequisite_min_score'], |
|
|
|
|
'prerequisite_max_score' => $row['prerequisite_max_score'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$arrLP = $this->getItemsForForm(); |
|
|
|
|
$this->tree_array($arrLP); |
|
|
|
|
$arrLP = isset($this->arrMenu) ? $this->arrMenu : []; |
|
|
|
|
unset($this->arrMenu); |
|
|
|
|
@ -13820,6 +13548,81 @@ EOD; |
|
|
|
|
return Display::img($path); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param string $value |
|
|
|
|
* |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
public function cleanItemTitle($value) |
|
|
|
|
{ |
|
|
|
|
$value = Security::remove_XSS(strip_tags($value)); |
|
|
|
|
|
|
|
|
|
return $value; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @param FormValidator $form |
|
|
|
|
*/ |
|
|
|
|
public function setItemTitle(FormValidator $form) |
|
|
|
|
{ |
|
|
|
|
if (api_get_configuration_value('save_titles_as_html')) { |
|
|
|
|
$form->addHtmlEditor( |
|
|
|
|
'title', |
|
|
|
|
get_lang('Title'), |
|
|
|
|
true, |
|
|
|
|
false, |
|
|
|
|
['ToolbarSet' => 'TitleAsHtml'] |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
$form->addText('title', get_lang('Title'), true, ['id' => 'idTitle', 'class' => 'learnpath_item_form']); |
|
|
|
|
$form->applyFilter('title', 'trim'); |
|
|
|
|
$form->applyFilter('title', 'html_filter'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
public function getItemsForForm($addParentCondition = false) |
|
|
|
|
{ |
|
|
|
|
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); |
|
|
|
|
$course_id = api_get_course_int_id(); |
|
|
|
|
|
|
|
|
|
$sql = "SELECT * FROM $tbl_lp_item |
|
|
|
|
WHERE c_id = $course_id AND lp_id = ".$this->lp_id; |
|
|
|
|
|
|
|
|
|
if ($addParentCondition) { |
|
|
|
|
$sql .= ' AND parent_item_id = 0 '; |
|
|
|
|
} |
|
|
|
|
$sql .= ' ORDER BY display_order ASC'; |
|
|
|
|
|
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
$arrLP = []; |
|
|
|
|
while ($row = Database::fetch_array($result)) { |
|
|
|
|
$arrLP[] = [ |
|
|
|
|
'iid' => $row['iid'], |
|
|
|
|
'id' => $row['iid'], |
|
|
|
|
'item_type' => $row['item_type'], |
|
|
|
|
'title' => $this->cleanItemTitle($row['title']), |
|
|
|
|
'path' => $row['path'], |
|
|
|
|
'description' => Security::remove_XSS($row['description']), |
|
|
|
|
'parent_item_id' => $row['parent_item_id'], |
|
|
|
|
'previous_item_id' => $row['previous_item_id'], |
|
|
|
|
'next_item_id' => $row['next_item_id'], |
|
|
|
|
'display_order' => $row['display_order'], |
|
|
|
|
'max_score' => $row['max_score'], |
|
|
|
|
'min_score' => $row['min_score'], |
|
|
|
|
'mastery_score' => $row['mastery_score'], |
|
|
|
|
'prerequisite' => $row['prerequisite'], |
|
|
|
|
'max_time_allowed' => $row['max_time_allowed'], |
|
|
|
|
'prerequisite_min_score' => $row['prerequisite_min_score'], |
|
|
|
|
'prerequisite_max_score' => $row['prerequisite_max_score'], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $arrLP; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get the depth level of LP item. |
|
|
|
|
* |
|
|
|
|
|