/** * Get document information */ private function get_information($course_id, $doc_id) { $course_information = api_get_course_info($course_id); $course_id = $course_information['real_id']; $course_path = $course_information['path']; if (!empty($course_information)) { $item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY); $doc_table = Database::get_course_table(TABLE_DOCUMENT); $doc_id = Database::escape_string($doc_id); $sql = "SELECT * FROM {$doc_table}\n WHERE {$doc_table}.id = {$doc_id} AND c_id = {$course_id}\n LIMIT 1"; $dk_result = Database::query($sql); $sql = "SELECT insert_user_id FROM {$item_property_table}\n WHERE ref = {$doc_id} AND tool = '" . TOOL_DOCUMENT . "' AND c_id = {$course_id}\n LIMIT 1"; $name = ''; if ($row = Database::fetch_array($dk_result)) { $name = $row['title']; $url = api_get_path(WEB_PATH) . 'courses/%s/document%s'; $url = sprintf($url, $course_path, $row['path']); // Get the image path $icon = FileManager::choose_image(basename($row['path'])); $thumbnail = api_get_path(WEB_IMG_PATH) . $icon; $image = $thumbnail; //FIXME: use big images // get author $author = ''; $item_result = Database::query($sql); if ($row = Database::fetch_array($item_result)) { $user_data = api_get_user_info($row['insert_user_id']); $author = api_get_person_name($user_data['firstName'], $user_data['lastName']); } } return array($thumbnail, $image, $name, $author, $url); // FIXME: is it posible to get an author here? } else { return array(); } }
/** * Generate and return an HTML list of resources based on a given array. * This list is used to show the course creator a list of available resources to choose from * when creating a learning path. * @param array Array of elements to add to the list * @param integer Enables the tree display by shifting the new elements a certain distance to the right * @return string The HTML list */ public static function write_resources_tree($course_info, $session_id, $resources_sorted, $num = 0, $lp_id = false, $target = '', $add_move_button = false, $overwrite_url = null) { $img_path = api_get_path(WEB_IMG_PATH); $img_sys_path = api_get_path(SYS_IMG_PATH); $web_code_path = api_get_path(WEB_CODE_PATH); $return = ''; if (count($resources_sorted) > 0) { foreach ($resources_sorted as $key => $resource) { $title = isset($resource['title']) ? $resource['title'] : null; if (empty($title)) { $title = $key; } if (isset($resource['id']) && is_int($resource['id'])) { // It's a folder. //hide some folders if (in_array($key, array('shared_folder', 'chat_files', 'HotPotatoes_files', 'css', 'certificates'))) { continue; } elseif (preg_match('/_groupdocs/', $key)) { continue; } elseif (preg_match('/sf_user_/', $key)) { continue; } elseif (preg_match('/shared_folder_session_/', $key)) { continue; } //trad some titles if ($key == 'images') { $key = get_lang('Images'); } elseif ($key == 'gallery') { $key = get_lang('Gallery'); } elseif ($key == 'flash') { $key = get_lang('Flash'); } elseif ($key == 'audio') { $key = get_lang('Audio'); } elseif ($key == 'video') { $key = get_lang('Video'); } $onclick = ''; if ($lp_id) { $onclick = 'onclick="javascript: testResources(\'res_' . $resource['id'] . '\',\'img_' . $resource['id'] . '\')"'; } $return .= '<ul class="lp_resource">'; $return .= '<li class="doc_folder" id="doc_id_' . $resource['id'] . '" style="margin-left:' . $num * 18 . 'px; ">'; if ($lp_id) { $return .= '<img style="cursor: pointer;" src="' . $img_path . 'nolines_plus.gif" align="absmiddle" id="img_' . $resource['id'] . '" ' . $onclick . ' >'; } else { $return .= '<span style="margin-left:16px"> </span>'; } $return .= '<img alt="" src="' . $img_path . 'lp_folder.gif" title="" align="absmiddle" /> '; $return .= '<span ' . $onclick . ' style="cursor: pointer;" >' . $title . '</span>'; $return .= '</li>'; $return .= '<div id="res_' . $resource['id'] . '" style="display: none;" >'; if (isset($resource['files'])) { $return .= self::write_resources_tree($course_info, $session_id, $resource['files'], $num + 1, $lp_id, $target, $add_move_button, $overwrite_url); } $return .= '</div>'; $return .= '</ul>'; } else { if (!is_array($resource)) { $resource = base64_decode($resource); // It's a file. $icon = FileManager::choose_image($resource); $position = strrpos($icon, '.'); $icon = substr($icon, 0, $position) . '_small.gif'; $file_info = explode('|@j@|', $resource); $my_file_title = $file_info[0]; //If title is empty we try to use the path if (empty($my_file_title)) { $my_file_title = $file_info[1]; } // Show the "image name" not the filename of the image. if ($lp_id) { //LP URL $url = api_get_self() . '?cidReq=' . $course_info['code'] . '&action=add_item&type=' . TOOL_DOCUMENT . '&file=' . $key . '&lp_id=' . $lp_id; if (!empty($overwrite_url)) { $url = $overwrite_url . '&document_id=' . $key; } } else { //Direct document URL $url = $web_code_path . 'document/document.php?cidReq=' . $course_info['code'] . '&id_session=' . $session_id . '&id=' . $key; if (!empty($overwrite_url)) { $url = $overwrite_url . '&document_id=' . $key; } } $img = $img_path . $icon; if (!file_exists($img_sys_path . $icon)) { $img = $img_path . 'icons/16/default_small.gif'; } $link = Display::url('<img alt="" src="' . $img . '" title="" /> ' . $my_file_title, $url, array('target' => $target)); if ($lp_id == false) { $return .= '<li class="doc_resource" data_id="' . $key . '" data_type="document" title="' . $my_file_title . '" >'; } else { $return .= '<li class="doc_resource lp_resource_element" data_id="' . $key . '" data_type="document" title="' . $my_file_title . '" >'; } $return .= '<div class="item_data" style="margin-left:' . ($num + 1) * 18 . 'px;margin-right:5px;">'; if ($add_move_button) { $return .= '<a class="moved" href="#">'; $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY); $return .= '</a> '; } $return .= $link; $return .= '</div></li>'; } } } } return $return; }
/** * Gets the name of a resource (generally used in learnpath when no name is provided) * * @author Yannick Warnier <*****@*****.**>, Dokeos - rebranding * @param string Course code * @param string The tool type (using constants declared in api.lib.php) * @param integer The resource ID */ function rl_get_resource_name($course_code, $learnpath_id, $id_in_path) { $_course = api_get_course_info($course_code); $course_id = $_course['real_id']; $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $sql_item = "SELECT item_type, title, ref FROM {$tbl_lp_item} WHERE c_id = {$course_id} AND lp_id = {$learnpath_id} AND id = {$id_in_path}"; $res_item = Database::query($sql_item); if (Database::num_rows($res_item) < 1) { return ''; //exit } $row_item = Database::fetch_array($res_item); $type = strtolower($row_item['item_type']); $id = $row_item['ref']; $output = ''; switch ($type) { case TOOL_CALENDAR_EVENT: $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA); $result = Database::query("SELECT * FROM {$TABLEAGENDA} WHERE c_id = {$course_id} AND id={$id}"); $myrow = Database::fetch_array($result); $output = $myrow['title']; break; case TOOL_ANNOUNCEMENT: $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); $result = Database::query("SELECT * FROM {$tbl_announcement} WHERE c_id = {$course_id} AND id={$id}"); $myrow = Database::fetch_array($result); $output = $myrow['title']; break; case TOOL_LINK: // Doesn't take $target into account. $TABLETOOLLINK = Database::get_course_table(TABLE_LINK); $result = Database::query("SELECT * FROM {$TABLETOOLLINK} WHERE c_id = {$course_id} AND id={$id}"); $myrow = Database::fetch_array($result); $output = $myrow['title']; break; case TOOL_QUIZ: $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST); $result = Database::query("SELECT * FROM {$TBL_EXERCICES} WHERE c_id = {$course_id} AND iid = {$id}"); $myrow = Database::fetch_array($result); $output = $myrow['title']; break; case TOOL_FORUM: $TBL_FORUMS = Database::get_course_table(TABLE_FORUM); $result = Database::query("SELECT * FROM {$TBL_FORUMS} WHERE c_id = {$course_id} AND forum_id={$id}"); $myrow = Database::fetch_array($result); $output = $myrow['forum_name']; break; case TOOL_THREAD: //=topics $tbl_post = Database::get_course_table(TABLE_FORUM_POST); // Grabbing the title of the post. $sql_title = "SELECT * FROM {$tbl_post} WHERE c_id = {$course_id} AND post_id=" . $id; $result_title = Database::query($sql_title); $myrow_title = Database::fetch_array($result_title); $output = $myrow_title['post_title']; break; case TOOL_POST: $tbl_post = Database::get_course_table(TABLE_FORUM_POST); //$tbl_post_text = Database::get_course_table(FORUM_POST_TEXT_TABLE); $sql = "SELECT * FROM {$tbl_post} p WHERE c_id = {$course_id} AND p.post_id = {$id}"; $result = Database::query($sql); $post = Database::fetch_array($result); $output = $post['post_title']; break; case 'dokeos_chapter': $title = $row_item['title']; if (!empty($title)) { $output = $title; } else { $output = '-'; } break; case TOOL_DOCUMENT: $title = $row_item['title']; if (!empty($title)) { $output = $title; } else { $output = '-'; } break; case 'hotpotatoes': $tbl_doc = Database::get_course_table(TABLE_DOCUMENT); $result = Database::query("SELECT * FROM {$tbl_doc} WHERE c_id = {$course_id} AND id={$id}"); $myrow = Database::fetch_array($result); $pathname = explode('/', $myrow['path']); // Making a correct name for the link. $last = count($pathname) - 1; // Making a correct name for the link. $filename = $pathname[$last]; // Making a correct name for the link. $image = FileManager::choose_image($filename); $ext = explode('.', $filename); $ext = strtolower($ext[sizeof($ext) - 1]); $myrow['path'] = rawurlencode($myrow['path']); $in_frames = in_array($ext, array('htm', 'html', 'gif', 'jpg', 'jpeg', 'png')); $output = $filename; break; /* case 'externallink': $output = '<img src="../img/links.gif" align="middle" /> <a href="'.$id.'"'.$styling.' '.$target.'>'.$id."</a><br />\n"; break; */ } return stripslashes($output); }
/** * Builds an img html tag for the filetype * * @param string $type (file/folder) * @param string $path * @return string img html tag */ function build_document_icon_tag($type, $path) { $basename = basename($path); $current_session_id = api_get_session_id(); $is_allowed_to_edit = api_is_allowed_to_edit(null, true); if ($type == 'file') { $icon = FileManager::choose_image($basename); if (preg_match('/_chnano_.wav$/i', $basename)) { $icon = "jplayer_play.png"; $basename = 'wav' . ' ' . '(Nanogong)'; } else { $basename = substr(strrchr($basename, '.'), 1); } } else { if ($path == '/shared_folder') { $icon = 'folder_users.gif'; if ($is_allowed_to_edit) { $basename = get_lang('HelpUsersFolder'); } else { $basename = get_lang('UserFolders'); } } elseif (strstr($basename, 'sf_user_')) { $userinfo = api_get_user_info(substr($basename, 8)); $image_path = UserManager::get_user_picture_path_by_id(substr($basename, 8), 'web', false, true); if ($image_path['file'] == 'unknown.jpg') { $icon = $image_path['file']; } else { $icon = '../upload/users/' . substr($basename, 8) . '/' . $image_path['file']; } $basename = get_lang('UserFolder') . ' ' . $userinfo['complete_name']; } elseif (strstr($path, 'shared_folder_session_')) { if ($is_allowed_to_edit) { $basename = '***(' . api_get_session_name($current_session_id) . ')*** ' . get_lang('HelpUsersFolder'); } else { $basename = get_lang('UserFolders') . ' (' . api_get_session_name($current_session_id) . ')'; } $icon = 'folder_users.gif'; } else { $icon = 'folder_document.gif'; if ($path == '/audio') { $icon = 'folder_audio.gif'; if (api_is_allowed_to_edit()) { $basename = get_lang('HelpDefaultDirDocuments'); } else { $basename = get_lang('Audio'); } } elseif ($path == '/flash') { $icon = 'folder_flash.gif'; if (api_is_allowed_to_edit()) { $basename = get_lang('HelpDefaultDirDocuments'); } else { $basename = get_lang('Flash'); } } elseif ($path == '/images') { $icon = 'folder_images.gif'; if (api_is_allowed_to_edit()) { $basename = get_lang('HelpDefaultDirDocuments'); } else { $basename = get_lang('Images'); } } elseif ($path == '/video') { $icon = 'folder_video.gif'; if (api_is_allowed_to_edit()) { $basename = get_lang('HelpDefaultDirDocuments'); } else { $basename = get_lang('Video'); } } elseif ($path == '/images/gallery') { $icon = 'folder_gallery.gif'; if (api_is_allowed_to_edit()) { $basename = get_lang('HelpDefaultDirDocuments'); } else { $basename = get_lang('Gallery'); } } elseif ($path == '/chat_files') { $icon = 'folder_chat.gif'; if (api_is_allowed_to_edit()) { $basename = get_lang('HelpFolderChat'); } else { $basename = get_lang('ChatFiles'); } } elseif ($path == '/learning_path') { $icon = 'folder_learningpath.gif'; if (api_is_allowed_to_edit()) { $basename = get_lang('HelpFolderLearningPaths'); } else { $basename = get_lang('LearningPaths'); } } } } return Display::return_icon($icon, $basename, array()); }
/** * This function is to display the added resources (lessons) in the learning path player and builder * this function is a modification of display_addedresource_link($type, $id) function * the two ids are a bit confusing, I admit, but I did not want to change Patrick's work, I was * building upon it. - Denes * * Parameters: * @param completed - if ="completed" then green presentation with checkbox * @param id_in_path - if onclick then this lesson will be considered completed, that is the unique index in the items table * @param id - that is the correspondent id in the mirror tool (like Agenda item 2) * @param type - that is the correspondent type in the mirror tool (like this is a Link item) * @param builder - if ="builder" then onclick shows in new window * @param icon - if ="icon" then the small icon will appear * if ="wrap" then wrapped settings are used (and no icon is displayed) * if ="nolink" then only the name is returned with no href and no icon (note:only in this case, the result is not displayed, but returned) * @todo this function is too long, rewrite */ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_path, $builder, $icon, $level = 0) { global $learnpath_id, $tbl_learnpath_item, $items; global $curDirPath, $_configuration, $enableDocumentParsing, $_user, $_cid; $_course = api_get_course_info(); $hyperlink_target_parameter = ''; //or e.g. 'target="_blank"' $length = ($builder == 'builder' and $icon == 'nolink') ? 65 : 32; if ($builder != 'builder') { $origin = 'learnpath'; } //origin = learnpath in student view $linktype = $type; if ($type == 'Link _self' or $type == 'Link _blank') { $type = 'Link'; } switch ($type) { case "Agenda": $TABLEAGENDA = Database::get_course_table(TABLE_AGENDA, $_course['dbName']); $result = Database::query("SELECT * FROM {$TABLEAGENDA} WHERE id={$id}"); $myrow = Database::fetch_array($result); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $myrow["title"] = $row['title']; } $desc = $row['description']; $agenda_id = $row['item_id']; echo str_repeat(" >", $level); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($myrow["title"] == '') { echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($myrow["title"], $length); } if ($icon == 'icon') { echo "<img src='../img/agenda.gif' align=\"absmiddle\" alt='agenda'>"; } if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Agenda&origin={$origin}&agenda_id={$agenda_id}#{$id_in_path}\" class='{$completed}'>" . shorten($myrow["title"], $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Agenda&origin={$origin}&agenda_id={$agenda_id}#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { echo "<a href=\"../calendar/agenda.php?origin={$origin}&agenda_id={$agenda_id}\" class='{$completed}' target='_blank'>" . shorten($myrow["title"], $length - 3 * $level) . "</a>"; } break; case "Ad_Valvas": $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT, $_course['dbName']); $result = Database::query("SELECT * FROM {$tbl_announcement} WHERE id={$id}"); $myrow = Database::fetch_array($result); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $myrow["content"] = $row['title']; } $desc = $row['description']; $ann_id = $row['item_id']; echo str_repeat(" >", $level); // the title and the text are in the content field and we only want to display the title list($title, $text) = split('<br>', $myrow['content']); if ($title == '') { $title = $myrow['content']; } $title = $myrow['title']; $text = $myrow['content']; if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($title == '') { $type = "Announcement"; echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($title, $length); } if ($icon == 'icon') { echo "<img src='../img/valves.gif' align=\"absmiddle\" alt='ad valvas'>"; } if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Ad_Valvas&origin={$origin}&ann_id={$ann_id}#{$id_in_path}\" class='{$completed}'>" . shorten($title, $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Ad_Valvas&origin={$origin}&ann_id={$ann_id}#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { echo "<a href=\"../announcements/announcements.php?origin={$origin}&ann_id={$ann_id}\" class='{$completed}' target='_blank'>" . shorten($title, $length - 3 * $level) . "</a>"; } break; case "Link": $TABLETOOLLINK = Database::get_course_table(TABLE_LINK, $_course['dbName']); $result = Database::query("SELECT * FROM {$TABLETOOLLINK} WHERE id={$id}"); $myrow = Database::fetch_array($result); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $myrow["title"] = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($myrow["title"] == '') { echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($myrow["title"], $length); } if ($icon == 'icon') { if ($linktype == 'Link _self') { echo "<img src='../img/links.gif' align=\"absmiddle\" alt='links'>"; } else { echo "<img src='../img/link_blank.gif' align=\"absmiddle\" alt='blank links'>"; } } $thelink = $myrow["url"]; if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type={$linktype}&origin={$origin}&thelink={$thelink}#{$id_in_path}\" class='{$completed}'>" . shorten($myrow["title"], $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type={$linktype}&origin={$origin}&thelink={$thelink}#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { echo "<a href=\"{$thelink}\" class='{$completed}' target='_blank'>" . shorten($myrow["title"], $length - 3 * $level) . "</a>"; } break; case "Exercise": $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST, $_course['dbName']); $result = Database::query("SELECT * FROM {$TBL_EXERCICES} WHERE id={$id}"); $myrow = Database::fetch_array($result); if ($builder == 'builder') { $origin = 'builder'; } //this is needed for the exercise_submit.php can delete the session info about tests $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $myrow["title"] = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($myrow["title"] == '') { echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($myrow["title"], $length); } if ($icon == 'icon') { echo "<img src='../img/quiz.gif' align=\"absmiddle\" alt='quizz'>"; } if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Exercise&origin={$origin}&exerciseId=" . $myrow["id"] . "#{$id_in_path}\" class='{$completed}'>" . shorten($myrow["title"], $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Exercise&origin={$origin}&exerciseId=" . $myrow["id"] . "#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { echo "<a href=\"../exercice/exercise_submit.php?origin={$origin}&exerciseId=" . $myrow["id"] . "\" class='{$completed}' target='_blank'>" . shorten($myrow["title"], $length - 3 * $level) . "</a>"; } break; case "HotPotatoes": $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT, $_course['dbName']); $documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document'; $result = Database::query("SELECT * FROM " . $TBL_DOCUMENT . " WHERE id={$id}"); $myrow = Database::fetch_array($result); $path = $myrow["path"]; $name = GetQuizName($path, $documentPath); if ($builder == 'builder') { $origin = 'builder'; } //this is needed for the exercise_submit.php can delete the session info about tests $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $name = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($name == '') { echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($name, $length); } if ($icon == 'icon') { echo "<img src='../img/jqz.gif' align=\"absmiddle\" alt='hot potatoes'>"; } $cid = $_course['official_code']; if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=HotPotatoes&origin={$origin}&id={$id}#{$id_in_path}\" class='{$completed}'>" . shorten($name, $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=HotPotatoes&origin={$origin}&id={$id}#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { echo " <a href=\"../exercice/showinframes.php?file={$path}&cid={$cid}&uid=" . $_user['user_id'] . "\" class='{$completed}' target='_blank'>" . shorten($name, $length - 3 * $level) . "</a>"; } break; case "Forum": $TBL_FORUMS = Database::get_course_table(TABLE_FORUM, $_course['dbName']); $result = Database::query("SELECT * FROM {$TBL_FORUMS} WHERE forum_id={$id}"); $myrow = Database::fetch_array($result); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $myrow["forum_name"] = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($myrow["forum_name"] == '') { $type = "Forum"; echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($myrow["forum_name"], $length); } if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } $forumparameters = "forum=" . $myrow["forum_id"] . "&md5=" . $myrow["md5"]; if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Forum&origin={$origin}&forumparameters={$forumparameters}#{$id_in_path}\" class='{$completed}'>" . shorten($myrow["forum_name"], $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Forum&origin={$origin}&forumparameters={$forumparameters}#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { echo "<a href=\"../phpbb/viewforum.php?{$forumparameters}\" class='{$completed}' target='_blank'>" . shorten($myrow["forum_name"], $length - 3 * $level) . "</a>"; } break; case "Thread": //forum post //deprecated $tbl_topics = $_course['dbNameGlu'] . 'bb_topics'; $tbl_posts = $_course['dbNameGlu'] . 'bb_posts'; $TBL_FORUMS = $_course['dbNameGlu'] . "bb_forums"; $sql = "SELECT * FROM {$tbl_topics} where topic_id={$id}"; $result = Database::query($sql); $myrow = Database::fetch_array($result); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $myrow["topic_title"] = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($myrow["topic_title"] == '') { $type = "Forum Post"; echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($myrow["topic_title"], $length); } if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Thread&origin={$origin}&topic=" . $myrow["topic_id"] . "&forum=" . $myrow["forum_id"] . "&md5=" . $myrow["md5"] . "#{$id_in_path}\" class='{$completed}'>" . shorten($myrow["topic_title"], $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Thread&origin={$origin}&topic=" . $myrow["topic_id"] . "&forum=" . $myrow["forum_id"] . "&md5=" . $myrow["md5"] . "#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { echo "<a href=\"../phpbb/viewtopic.php?topic=" . $myrow["topic_id"] . "&forum=" . $myrow["forum_id"] . "&md5=" . $myrow["md5"] . "\" class='{$completed}' target='_blank'>" . shorten($myrow["topic_title"], $length - 3 * $level) . "</a>"; } break; case "Post": //deprecated $tbl_posts = $_course['dbNameGlu'] . 'bb_posts'; $tbl_posts_text = $_course['dbNameGlu'] . 'bb_posts_text'; $TBL_FORUMS = $_course['dbNameGlu'] . "bb_forums"; $result = Database::query("SELECT * FROM {$tbl_posts} where post_id={$id}"); $myrow = Database::fetch_array($result); // grabbing the title of the post $sql_titel = "SELECT * FROM {$tbl_posts_text} WHERE post_id=" . $myrow["post_id"]; $result_titel = Database::query($sql_titel); $myrow_titel = Database::fetch_array($result_titel); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $myrow_titel["post_title"] = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); $posternom = $myrow['nom']; $posterprenom = $myrow['prenom']; $posttime = $myrow['post_time']; $posttext = $myrow_titel['post_text']; $posttitle = $myrow_titel['post_title']; $posttext = str_replace('"', "'", $posttext); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($myrow_titel["post_title"] == '') { $type = "Forum"; echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($myrow_titel["post_title"], $length); } if ($icon == 'icon') { echo "<img src='../img/forum.gif' align=\"absmiddle\" alt='forum'>"; } if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Post&origin={$origin}&posternom={$posternom}&posterprenom={$posterprenom}&posttime={$posttime}&posttext={$posttext}&posttitle={$posttitle}#{$id_in_path}\" class='{$completed}'>" . shorten($myrow_titel["post_title"], $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Post&origin={$origin}&posternom={$posternom}&posterprenom={$posterprenom}&posttime={$posttime}&posttext={$posttext}&posttitle={$posttitle}#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { echo "<a href=\"../phpbb/viewtopic.php?topic=" . $myrow["topic_id"] . "&forum=" . $myrow["forum_id"] . "&md5=" . $myrow["md5"] . "\" class='{$completed}' target='_blank'>" . shorten($myrow_titel["post_title"], $length - 3 * $level) . "</a>"; } break; case "Document": $dbTable = Database::get_course_table(TABLE_DOCUMENT, $_course['dbName']); $result = Database::query("SELECT * FROM {$dbTable} WHERE id={$id}"); $myrow = Database::fetch_array($result); $pathname = explode("/", $myrow["path"]); // making a correct name for the link $last = count($pathname) - 1; // making a correct name for the link $filename = $pathname[$last]; // making a correct name for the link if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } echo str_repeat(" >", $level); if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } $image = FileManager::choose_image($filename); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $filename = $row['title']; } $desc = $row['description']; if ($myrow["path"] == '' and $filename == '') { echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($filename, $length); } if ($icon == 'icon') { echo "<img src='../img/{$image}' align=\"absmiddle\" alt='{$image}'>"; } if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Document&origin={$origin}&docurl=" . $myrow["path"] . "#{$id_in_path}\" class='{$completed}'>" . shorten($filename, $length - 3 * $level) . "</a>"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Document&origin={$origin}&docurl=" . $myrow["path"] . "#{$id_in_path}"; } else { $enableDocumentParsing = 'yes'; if (!$enableDocumentParsing) { //this is the solution for the non-parsing version in the builder $file = urlencode($myrow["path"]); echo "<a href='../document/showinframes.php?file={$file}' class='{$completed}' {$hyperlink_target_parameter}>" . shorten($filename, $length - 3 * $level) . "</a>"; } else { echo "<a href=\"../document/download.php?doc_url=" . $myrow["path"] . "\" class='{$completed}' {$hyperlink_target_parameter}>" . shorten($filename, $length - 3 * $level) . "</a>"; } } break; case "Assignments": $name = get_lang('Assignments'); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $name = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($name == '') { echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($name, $length); } if ($icon == 'icon') { echo "<img src='../img/works.gif' align=\"absmiddle\">"; } if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Assignments&origin={$origin}#{$id_in_path}\" class='{$completed}'>" . shorten($name, $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Assignments&origin={$origin}#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { echo "<a href=\"../work/work.php\" class='{$completed}' target='_blank'>" . shorten($name, $length - 3 * $level) . "</a>"; } break; case "Dropbox": $name = get_lang('Dropbox'); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $name = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($name == '') { echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($name, $length); } if ($icon == 'icon') { echo "<img src='../img/dropbox.gif' align=\"absmiddle\">"; } if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Dropbox&origin={$origin}#{$id_in_path}\" class='{$completed}'>" . shorten($name, $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Dropbox&origin={$origin}#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { echo "<a href=\"../dropbox/index.php\" class='{$completed}' target='_blank'>" . shorten($name, $length - 3 * $level) . "</a>"; } break; case "Introduction_text": $name = get_lang('IntroductionText'); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $name = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($name == '') { echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($name, $length); } if ($icon == 'icon') { echo "<img src='../img/introduction.gif' align=\"absmiddle\" alt='introduction'>"; } if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Introduction_text&origin={$origin}#{$id_in_path}\" class='{$completed}'>" . shorten($name, $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Introduction_text&origin={$origin}#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { $s = api_get_path(WEB_COURSE_PATH) . "{$_cid}/index.php?intro_cmdEdit=1"; echo "<a href=\"{$s}\" class='{$completed}' target='_blank'>" . shorten($name, $length - 3 * $level) . "</a>"; } break; case "Course_description": $name = get_lang('CourseDescription'); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $name = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($name == '') { echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($name, $length); } if ($icon == 'icon') { echo "<img src='../img/info.gif' align=\"absmiddle\" alt='info'>"; } if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Course_description&origin={$origin}#{$id_in_path}\" class='{$completed}'>" . shorten($name, $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Course_description&origin={$origin}#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { $s = api_get_path(WEB_CODE_PATH) . "course_description"; echo "<a href=\"{$s}\" class='{$completed}' target='_blank'>" . shorten($name, $length - 3 * $level) . "</a>"; } break; case "Groups": $name = get_lang('Groups'); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $name = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($name == '') { echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($name, $length); } if ($icon == 'icon') { echo "<img src='../img/group.gif' align=\"absmiddle\" alt='group'>"; } if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Groups&origin={$origin}#{$id_in_path}\" class='{$completed}'>" . shorten($name, $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Groups&origin={$origin}#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { echo "<a href=\"../group/group.php?origin={$origin}\" class='{$completed}' target='_blank'>" . shorten($name, $length - 3 * $level) . "</a>"; } break; case "Users": $name = get_lang('Users'); $sql = "select * from {$tbl_learnpath_item} where id={$id_in_path}"; $result = Database::query($sql); $row = Database::fetch_array($result); if ($row['title'] != '') { $name = $row['title']; } $desc = $row['description']; echo str_repeat(" >", $level); if ($builder != 'builder' and $icon != 'wrap') { echo "<td>"; } if ($icon != 'nolink') { if ($completed == 'completed') { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on'>"; } else { echo "<img src='../img/checkbox_on2.gif' border='0' width='13' height='11' alt='on' style='visibility: hidden'>"; //echo " "; } } if ($builder != 'builder' and $icon != 'wrap') { echo "</td><td>"; } if ($name == '') { echo "<span class='messagesmall'>" . get_lang('StepDeleted1') . " {$type} " . get_lang('StepDeleted2') . "</span>"; return true; } if ($icon == 'nolink') { return shorten($name, $length); } if ($icon == 'icon') { echo "<img src='../img/members.gif' align=\"absmiddle\" alt='members'>"; } if ($builder != 'builder') { echo "<a href=\"" . api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Users&origin={$origin}#{$id_in_path}\" class='{$completed}'>" . shorten($name, $length - 3 * $level) . "</a>"; $items[] = api_get_self() . "?action=closelesson&source_forum=" . $_GET['source_forum'] . "&how=complete&id_in_path={$id_in_path}&learnpath_id={$learnpath_id}&type=Users&origin={$origin}#{$id_in_path}"; if ($desc != '') { if ($icon != 'wrap') { echo "</tr><tr><td></td><td></td><td><div class='description'> " . shorten($desc, $length - 3 * $level) . "</div></td></tr>"; } else { echo "<div class='description'> " . shorten($desc, $length - 3 * $level) . "</div>"; } } } else { echo "<a href=\"../user/user.php?origin={$origin}\" class='{$completed}' target='_blank'>" . shorten($name, $length - 3 * $level) . "</a>"; } break; } //end huge switch-statement }