diff --git a/main/lp/learnpath.class.php b/main/lp/learnpath.class.php index 7474e6faa9..3517390b67 100755 --- a/main/lp/learnpath.class.php +++ b/main/lp/learnpath.class.php @@ -1588,31 +1588,6 @@ class learnpath return true; } - /** - * Static admin function exporting a learnpath into a zip file - * @param string Export type (scorm, zip, cd) - * @param string Course code - * @param integer Learnpath ID - * @param string Zip file name - * @return string Zip file path (or false on error) - */ - public function export_lp($type, $course, $id, $zipname) - { - if (empty($type) || empty($course) || empty($id) || empty($zipname)) { - return false; - } - $url = ''; - switch ($type) { - case 'scorm': - break; - case 'zip': - break; - case 'cdrom': - break; - } - return $url; - } - /** * Gets all the chapters belonging to the same parent as the item/chapter given * Can also be called as abstract method @@ -1814,8 +1789,7 @@ class learnpath } /** - * Gets the first element URL. - * @return string URL to load into the viewer + * Sets the first element URL. */ public function first() { @@ -2835,7 +2809,11 @@ class learnpath foreach ($ids as $id) { $id = trim($id); if (isset ($this->refs_list[$id])) { - $prereq = preg_replace('/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', 'ITEM_'.$this->refs_list[$id], $prereq); + $prereq = preg_replace( + '/[^a-zA-Z_0-9]('.$id.')[^a-zA-Z_0-9]/', + 'ITEM_'.$this->refs_list[$id], + $prereq + ); } } @@ -3018,7 +2996,7 @@ class learnpath while ($row = Database::fetch_array($res)) { $list[] = array( 'order_id' => ($row['order_id'] + 1), - 'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F or stuff like that. + 'objective_id' => urldecode($row['objective_id']), // urldecode() because they often have %2F 'score_raw' => $row['score_raw'], 'score_max' => $row['score_max'], 'score_min' => $row['score_min'], @@ -3065,6 +3043,7 @@ class learnpath /** * Generate and return the table of contents for this learnpath. The JS * table returned is used inside of scorm_api.php + * @param strin $varname * @return string A JS array vairiable construction */ public function get_items_details_as_js($varname = 'olms.lms_item_types') @@ -3180,9 +3159,10 @@ class learnpath /** * Uses the table generated by get_toc() and returns an HTML-formatted string ready to display + * @param array $toc_list * @return string HTML TOC ready to display */ - public function getListArrayToc($toc_list = null) + public function getListArrayToc($toc_list = []) { if ($this->debug > 0) { error_log('In learnpath::get_html_toc()', 0); @@ -3289,8 +3269,8 @@ class learnpath } return $html; - } + /** * Gets the learnpath maker name - generally the editor's name * @return string Learnpath maker name @@ -3756,21 +3736,6 @@ class learnpath return $has; } - /** - * Logs a message into a file - * @param string Message to log - * @return boolean True on success, false on error or if msg empty - */ - public function log($msg) - { - if ($this->debug > 0) { - error_log('New LP - In learnpath::log()', 0); - } - // TODO - $this->error .= $msg; - return true; - } - /** * Moves an item up and down at its level * @param integer Item to move up and down @@ -4192,7 +4157,7 @@ class learnpath * to normal users. * Can be used as abstract * @param integer Learnpath ID - * @param string New visibility + * @param string $set_visibility New visibility * @return bool */ public static function toggle_visibility($lp_id, $set_visibility = 1) @@ -6546,7 +6511,7 @@ class learnpath * @param int $parentId * @param int $creatorId creator id * - * @return string + * @return int */ public function create_document( $courseInfo, @@ -6792,6 +6757,7 @@ class learnpath * Displays the selected item, with a panel for manipulating the item * @param int $item_id * @param string $msg + * @param bool $show_actions * @return string */ public function display_item($item_id, $msg = null, $show_actions = true) @@ -8110,9 +8076,7 @@ class learnpath if (is_array($arrLP)) { reset($arrLP); } - $arrHide = array(); - // POSITION for ($i = 0; $i < count($arrLP); $i++) { if ($arrLP[$i]['parent_item_id'] == $parent && $arrLP[$i]['id'] != $id) { @@ -8290,7 +8254,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 = array(); while ($row = Database::fetch_array($result)) { @@ -8505,7 +8468,9 @@ class learnpath if ($arrLP[$i]['id'] != $id && $arrLP[$i]['item_type'] != 'dir' && $arrLP[$i]['item_type'] !== TOOL_LP_FINAL_ITEM ) { - if (isset($extra_info['previous_item_id']) && $extra_info['previous_item_id'] == $arrLP[$i]['id']) { + if (isset($extra_info['previous_item_id']) && + $extra_info['previous_item_id'] == $arrLP[$i]['id'] + ) { $s_selected_position = $arrLP[$i]['id']; } elseif ($action == 'add') { $s_selected_position = $arrLP[$i]['id']; @@ -8517,7 +8482,9 @@ class learnpath if (!$no_display_add) { $item_type = isset($extra_info['item_type']) ? $extra_info['item_type'] : null; $edit = isset($_GET['edit']) ? $_GET['edit'] : null; - if ($extra_info == 'new' || $item_type == TOOL_DOCUMENT || $item_type == TOOL_LP_FINAL_ITEM || $edit == 'true') { + if ($extra_info == 'new' || $item_type == TOOL_DOCUMENT || + $item_type == TOOL_LP_FINAL_ITEM || $edit == 'true' + ) { if (isset ($_POST['content'])) { $content = stripslashes($_POST['content']); } elseif (is_array($extra_info)) { @@ -9511,7 +9478,6 @@ class learnpath { $course_info = api_get_course_info(); $sessionId = api_get_session_id(); - $documentTree = DocumentManager::get_document_preview( $course_info, $this->lp_id, @@ -9762,7 +9728,7 @@ class learnpath $linksHtmlCode = '