function list_videos() { global $id, $tool_content, $themeimg, $course_id, $langTitle, $langDescr, $langDate, $langChoice, $langCatVideoDirectory, $langAddModulesButton, $langNoVideo, $course_code; $count = 0; $video_found = FALSE; $cnt1 = Database::get()->querySingle("SELECT COUNT(*) AS cnt FROM video WHERE course_id = ?d", $course_id)->cnt; $cnt2 = Database::get()->querySingle("SELECT COUNT(*) AS cnt FROM videolink WHERE course_id = ?d", $course_id)->cnt; $count = $cnt1 + $cnt2; if ($count > 0) { $video_found = TRUE; $tool_content .= "<form action='insert.php?course={$course_code}' method='post'><input type='hidden' name='id' value='{$id}' />"; $tool_content .= "<table class='table-default'>"; $tool_content .= "<tr>" . "<th width='200' class='text-left'> {$langTitle}</th>" . "<th class='text-left'>{$langDescr}</th>" . "<th width='100'>{$langDate}</th>" . "<th width='80'>{$langChoice}</th>" . "</tr>"; foreach (array('video', 'videolink') as $table) { $result = Database::get()->queryArray("SELECT * FROM {$table} WHERE (category IS NULL OR category = 0) AND course_id = ?d", $course_id); foreach ($result as $row) { $row->course_id = $course_id; if ($table == 'video') { $vObj = MediaResourceFactory::initFromVideo($row); $videolink = MultimediaHelper::chooseMediaAhref($vObj); } else { $vObj = MediaResourceFactory::initFromVideoLink($row); $videolink = MultimediaHelper::chooseMedialinkAhref($vObj); } $tool_content .= "<td> " . icon('fa-film') . " " . $videolink . "</td>" . "<td>" . q($row->description) . "</td>" . "<td class='text-center'>" . nice_format($row->date, true, true) . "</td>" . "<td class='text-center'><input type='checkbox' name='video[]' value='{$table}:{$row->id}' /></td>" . "</tr>"; } } $sql = Database::get()->queryArray("SELECT * FROM video_category WHERE course_id = ?d ORDER BY name", $course_id); if ($sql) { $tool_content .= "<tr><td colspan='3' class='bold'> {$langCatVideoDirectory}</td></tr>"; foreach ($sql as $videocat) { $tool_content .= "<tr>"; $tool_content .= "<td>" . icon('fa-folder-o') . " " . q($videocat->name) . "</td>"; $tool_content .= "<td colspan='2'>" . standard_text_escape($videocat->description) . "</td>"; $tool_content .= "<td align='center'><input type='checkbox' name='videocatlink[]' value='{$videocat->id}' /></td>"; $tool_content .= "</tr>"; foreach (array('video', 'videolink') as $table) { $sql2 = Database::get()->queryArray("SELECT * FROM {$table} WHERE category = ?d", $videocat->id); foreach ($sql2 as $linkvideocat) { $tool_content .= "<tr>"; $tool_content .= "<td> <img src='{$themeimg}/links_on.png' /> <a href='" . q($linkvideocat->url) . "' target='_blank'>" . q($linkvideocat->title == '' ? $linkvideocat->url : $linkvideocat->title) . "</a></td>"; $tool_content .= "<td>" . standard_text_escape($linkvideocat->description) . "</td>"; $tool_content .= "<td class='text-center'>" . nice_format($linkvideocat->date, true, true) . "</td>"; $tool_content .= "<td class='text-center'><input type='checkbox' name='video[]' value='{$table}:{$linkvideocat->id}' /></td>"; $tool_content .= "</tr>"; } } } } $tool_content .= "<tr><th colspan='4'><div align='right'><input class='btn btn-primary' type='submit' name='submit_video' value='" . q($langAddModulesButton) . "' /> </div></th></tr></table></form>"; } if (!$video_found) { $tool_content .= "<div class='alert alert-warning'>{$langNoVideo}</div>"; } }
function select_proper_filters($requestDocsFilter) { $filter = ''; $compatiblePlugin = true; switch ($requestDocsFilter) { case 'image': $ors = ''; foreach (MultimediaHelper::getSupportedImages() as $imgfmt) { $ors .= " OR format LIKE '{$imgfmt}'"; } $filter = "AND (format LIKE '.dir' {$ors})"; break; case 'eclmedia': $ors = ''; foreach (MultimediaHelper::getSupportedMedia() as $mediafmt) { $ors .= " OR format LIKE '{$mediafmt}'"; } $filter = "AND (format LIKE '.dir' {$ors})"; break; case 'media': $compatiblePlugin = false; $ors = ''; foreach (MultimediaHelper::getSupportedMedia() as $mediafmt) { $ors .= " OR format LIKE '{$mediafmt}'"; } $filter = "AND (format LIKE '.dir' {$ors})"; break; case 'zip': $filter = "AND (format LIKE '.dir' OR FORMAT LIKE 'zip')"; break; case 'file': $filter = ''; break; default: break; } return array($filter, $compatiblePlugin); }
* For a full list of contributors, see "credits.txt". * * Open eClass is an open platform distributed in the hope that it will * be useful (without any warranty), under the terms of the GNU (General * Public License) as published by the Free Software Foundation. * The full license can be read in "/info/license/license_gpl.txt". * * Contact address: GUnet Asynchronous eLearning Group, * Network Operations Center, University of Athens, * Panepistimiopolis Ilissia, 15784, Athens, Greece * e-mail: info@openeclass.org * ======================================================================== */ $require_current_course = true; require_once '../../../include/init.php'; require_once 'include/lib/multimediahelper.class.php'; require_once 'include/lib/mediaresource.factory.php'; $nameTools = $langMediaTypeDesc; if (isset($_GET['id'])) { $id = q($_GET['id']); $row = Database::get()->querySingle("SELECT * FROM videolink WHERE course_id = ?d AND url = ?s", $course_id, $id); if ($row) { $vObj = MediaResourceFactory::initFromVideoLink($row); echo MultimediaHelper::medialinkIframeObject($vObj); } }
/** * Create the imsmanifest.xml file. * * @return False on error, true otherwise. * @author Thanos Kyritsis <*****@*****.**> * @author Amand Tihon <*****@*****.**> */ function createManifest() { /** * Create a simple <metadata> * * * @param $title The resource title * @param $description The resource description * @return A string containing the metadata block. * @author Thanos Kyritsis <*****@*****.**> * @author Amand Tihon <*****@*****.**> */ function makeMetaData($title, $description, $identifier) { if (empty($title) and empty($description)) { return ' '; } $out = "<metadata>" . "\n" . "<lom:lom>" . "\n" . "<lom:general>" . "\n" . "<lom:identifier>" . "\n" . "<lom:entry>" . $identifier . "</lom:entry>" . "\n" . "</lom:identifier>" . "\n"; if (empty($title)) { $title = "null"; } $out .= "<lom:title>" . "\n" . "<lom:string>" . htmlspecialchars($title) . "</lom:string>" . "\n" . "</lom:title>" . "\n"; if (empty($description)) { $description = "null"; $keyword = "null"; } $out .= "<lom:description>" . "\n" . "<lom:string>" . htmlspecialchars($description) . "</lom:string>" . "\n" . "</lom:description>" . "\n"; $out .= "<lom:keyword>" . "\n" . "<lom:string>" . htmlspecialchars($description) . "</lom:string>" . "\n" . "</lom:keyword>" . "\n"; $out .= "</lom:general>" . "\n" . "<lom:lifeCycle>" . "\n" . "<lom:version>" . "\n" . "<lom:string>1.0</lom:string>" . "\n" . "</lom:version>" . "\n" . "<lom:status>" . "\n" . "<lom:source>LOMv1.0</lom:source>" . "\n" . "<lom:value>final</lom:value>" . "\n" . "</lom:status>" . "\n" . "</lom:lifeCycle>" . "\n" . "<lom:metaMetadata>" . "\n" . "<lom:identifier>" . "\n" . "<lom:entry>" . $identifier . "</lom:entry>" . "\n" . "</lom:identifier>" . "\n" . "<lom:metadataSchema>LOMv1.0</lom:metadataSchema>" . "\n" . "<lom:metadataSchema>SCORM_CAM_v1.3</lom:metadataSchema>" . "\n" . "</lom:metaMetadata>" . "\n" . "<lom:technical>" . "\n" . "<lom:format>text/html</lom:format>" . "\n" // TODO . "</lom:technical>" . "\n" . "<lom:rights>" . "\n" . "<lom:cost>" . "\n" . "<lom:source>LOMv1.0</lom:source>" . "\n" . "<lom:value>no</lom:value>" . "\n" . "</lom:cost>" . "\n" . "<lom:copyrightAndOtherRestrictions>" . "\n" . "<lom:source>LOMv1.0</lom:source>" . "\n" . "<lom:value>no</lom:value>" . "\n" . "</lom:copyrightAndOtherRestrictions>" . "\n" . "</lom:rights>" . "\n" . "</lom:lom>" . "\n" . "</metadata>" . "\n"; return $out; } /** * Create a <metadata> for the whole CAM model package * * * @param $title The resource title * @param $description The resource description * @return A string containing the metadata block. * * @author Thanos Kyritsis <*****@*****.**> */ function makeCAMetaData($title, $description) { if (empty($title) and empty($description)) { return ' '; } $out = "<metadata>" . "\n" . "<schema>ADL SCORM</schema>" . "\n" . "<schemaversion>CAM 1.3</schemaversion>" . "\n" . "<lom:lom>" . "\n" . "<lom:general>" . "\n"; if (empty($title)) { $title = "null"; } $out .= "<lom:title>" . "\n" . "<lom:string>" . htmlspecialchars($title) . "</lom:string>" . "\n" . "</lom:title>" . "\n"; if (empty($description)) { $description = "null"; } $out .= "<lom:description>" . "\n" . "<lom:string>" . htmlspecialchars($description) . "</lom:string>" . "\n" . "</lom:description>" . "\n"; $out .= "</lom:general>" . "\n" . "<lom:metaMetadata>" . "\n" . "<lom:metadataSchema>LOMv1.0</lom:metadataSchema>" . "\n" . "<lom:metadataSchema>SCORM_CAM_v1.3</lom:metadataSchema>" . "\n" . "</lom:metaMetadata>" . "\n" . "</lom:lom>" . "\n" . "</metadata>" . "\n"; return $out; } /** * Recursive function to deal with the tree representation of the items * * @param $itemlist the subtree to build * @param $depth indentation level. Is it really useful ? * @return the (sub-)tree representation * * @author Thanos Kyritsis <*****@*****.**> * @author Amand Tihon <*****@*****.**> */ $blocking = ""; function createItemList($itemlist, $depth = 0) { global $blocking; $out = ""; $ident = ""; for ($i = 0; $i < $depth; $i++) { $ident .= " "; } foreach ($itemlist as $item) { $identifier = "I_" . $item['ID']; $out .= $ident . '<item identifier="' . $identifier . '" isvisible="true" '; if ($item['contentType'] != 'LABEL') { $out .= 'identifierref="R_' . $item['ID'] . '" '; } $out .= '>' . "\n"; $out .= $ident . ' <title>' . htmlspecialchars($item['name']) . '</title>' . "\n"; // Check if previous was blocking // not valid for scorm 2004 /* if (!empty($blocking) && ($item['contentType'] != 'LABEL')) { $out .= ' <adlcp:prerequisites type="aicc_script"><![CDATA[I_'.$blocking.']]></adlcp:prerequisites>'."\n"; } */ // Add metadata, except for LABELS if ($item['contentType'] != 'LABEL') { $out .= makeMetaData($item['name'], $item['itemComment'], $identifier); } if (!isset($item['children'])) { // change only if we do not recurse. $blocking = ($item['lock'] == 'CLOSE') ? $item['ID'] : ''; } else { $out .= createItemList($item['children'], $depth + 1); } $out .= $ident . '</item>' . "\n"; } return $out; } /** * Create the frame file that'll hold the document. This frame is supposed to * set the SCO's status * @param $filename string: the name of the file to create, absolute. * @param $targetPath string: The actual document path, relative to the scorm * @return False on error, true otherwise. * * @author Thanos Kyritsis <*****@*****.**> * @author Amand Tihon <*****@*****.**> */ function createFrameFile($fileName, $targetPath) { global $langErrorCreatingFrame, $langErrorCreatingManifest, $charset; if (!($f = fopen($fileName, 'w'))) { $this->error[] = $langErrorCreatingFrame; return false; } fwrite($f, '<html><head> <meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '"> <script src="APIWrapper.js" type="text/javascript" language="JavaScript"></script> <title>Default Title</title> </head> <frameset border="0" rows="100%" onload="immediateComplete()"> <frame src="' . $targetPath . '" scrolling="auto"> </frameset> </html>'); fclose($f); return true; } /** * Create the frame file that'll hold the course description. * This frame sets the SCO's status * @param $filename string: the name of the file to create, absolute. * @return False on error, true otherwise. * * @author Thanos Kyritsis <*****@*****.**> */ function createDescFrameFile($fileName) { global $langErrorCreatingFrame, $course_id, $langThisCourseDescriptionIsEmpty, $charset; if (!($f = fopen($fileName, 'w'))) { $this->error[] = $langErrorCreatingFrame; return false; } $course_description = ""; $blocs = Database::get()->queryArray("SELECT `id`, `title`, `comments` FROM `course_description` WHERE course_id = ?d ORDER BY `order`", $course_id); if (count($blocs) > 0) { $course_description .= " <hr noshade size=\"1\">"; foreach ($blocs as $bloc) { $course_description .= " <H4> " . $bloc->title . " </H4> <font size=2 face='arial, helvetica'> " . make_clickable(nl2br($bloc->comments)) . " </font>"; } } else { $course_description .= "<br><h4>$langThisCourseDescriptionIsEmpty</h4>"; } fwrite($f, '<html>' . "\n" . '<head>' . "\n" . '<meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '">' . "\n" . '<script src="APIWrapper.js" type="text/javascript" language="JavaScript"></script>' . "\n" . '</head>' . "\n" . '<body onload="immediateComplete()">' . "\n" . '<table width="99%" border="0">' . "\n" . '<tr>' . "\n" . '<td colspan="2">' . "\n" . $course_description . "\n" . '</td>' . "\n" . '</tr>' . "\n" . '<tr name="bottomLine">' . "\n" . '<td colspan="2">' . "\n" . '<br>' . "\n" . '<hr noshade size="1">' . "\n" . '</td>' . "\n" . '</tr>' . "\n" . '</table>' . "\n" . '</body>' . "\n" . '</html>' . "\n" ); fclose($f); return true; } // Start creating sections for items and resources // First the items... $manifest_itemTree = '<organizations default="A1"><organization identifier="A1">' . "\n" . '<title>' . $this->name . '</title>' . "\n" . createItemList($this->itemTree) . '</organization></organizations>' . "\n"; // ...Then the resources $manifest_resources = "<resources>\n"; foreach ($this->resourceMap as $module) { if ($module['contentType'] == 'LABEL') { continue; } switch ($module['contentType']) { case 'DOCUMENT': case 'MEDIA': $framefile = $this->destDir . '/frame_for_' . $module['ID'] . '.html'; $targetfile = 'Documents' . $module['path']; // Create an html file with a frame for the document. if (!createFrameFile($framefile, $targetfile)) { return false; } // Add the resource to the manifest $ridentifier = "R_" . $module['ID']; $manifest_resources .= '<resource identifier="' . $ridentifier . '" type="webcontent" adlcp:scormType="sco" ' . ' href="' . basename($framefile) . '">' . "\n" . ' <file href="' . basename($framefile) . '" />' . "\n" . ' <file href="' . $targetfile . '">' . "\n" . makeMetaData($module['name'], $module['resourceComment'], $ridentifier) . "</file>\n" . "</resource>\n"; break; case 'EXERCISE': $targetfile = $module['fileName']; // Add the resource to the manifest $ridentifier = "R_" . $module['ID']; $manifest_resources .= '<resource identifier="' . $ridentifier . '" type="webcontent" adlcp:scormType="sco" ' . ' href="' . $targetfile . '" >' . "\n" . ' <file href="' . $targetfile . '">' . "\n" . makeMetaData($module['name'], $module['resourceComment'], $ridentifier) . "</file>\n" . "</resource>\n"; break; case 'SCORM_ASSET' : // Add the resource to the manifest $path = 'OrigScorm'; $ridentifier = "R_" . $module['ID']; $manifest_resources .= '<resource identifier="' . $ridentifier . '" type="webcontent" ' . ' href="OrigScorm' . $module['path'] . '">' . "\n" . ' <file href="OrigScorm' . $module['path'] . '">' . "\n" . makeMetaData($module['name'], $module['resourceComment'], $ridentifier) . "</file>\n" . "</resource>\n"; break; case 'SCORM' : // Add the resource to the manifest $path = 'OrigScorm'; $ridentifier = "R_" . $module['ID']; $manifest_resources .= '<resource identifier="' . $ridentifier . '" type="webcontent" adlcp:scormType="sco" ' . ' href="OrigScorm' . $module['path'] . '">' . "\n" . ' <file href="OrigScorm' . $module['path'] . '">' . "\n" . makeMetaData($module['name'], $module['resourceComment'], $ridentifier) . "</file>\n" . "</resource>\n"; break; case 'COURSE_DESCRIPTION': $framefile = $this->destDir . '/frame_for_' . $module['ID'] . '.html'; // Create an html file with a frame for the document. if (!createDescFrameFile($framefile)) { return false; } // Add the resource to the manifest $ridentifier = "R_" . $module['ID']; $manifest_resources .= '<resource identifier="' . $ridentifier . '" type="webcontent" adlcp:scormType="sco" ' . ' href="' . basename($framefile) . '">' . "\n" . ' <file href="' . basename($framefile) . '">' . "\n" . makeMetaData($module['name'], $module['resourceComment'], $ridentifier) . "</file>\n" . "</resource>\n"; break; case 'LINK': case 'MEDIALINK': $framefile = $this->destDir . '/frame_for_' . $module['ID'] . '.html'; if ($module['contentType'] == 'MEDIALINK') { $targetfile = urldecode(MultimediaHelper::makeEmbeddableMedialink($module['path'])); } else { $targetfile = $module['path']; } // Create an html file with a frame for the document. if (!createFrameFile($framefile, $targetfile)) { return false; } // Add the resource to the manifest $ridentifier = "R_" . $module['ID']; $manifest_resources .= '<resource identifier="' . $ridentifier . '" type="webcontent" adlcp:scormType="sco" ' . ' href="' . basename($framefile) . '">' . "\n" . ' <file href="' . basename($framefile) . '">' . "\n" . makeMetaData($module['name'], $module['resourceComment'], $ridentifier) . "</file>\n" . "</resource>\n"; break; default : break; } } $manifest_resources .= '</resources>' . "\n"; $manifestPath = $this->destDir . '/imsmanifest.xml'; if (!$f = fopen($manifestPath, 'w')) { $this->error[] = $GLOBALS['langErrorCreatingManifest']; return false; } // Prepare Metadata $metadata = makeCAMetaData($this->name, $this->comment); // Write header global $charset; fwrite($f, '<?xml version="1.0" encoding="' . $charset . '" ?> <manifest identifier="SingleCourseManifest" version="1.1" xmlns="http://www.imsglobal.org/xsd/imscp_v1p1" xmlns:lom="http://ltsc.ieee.org/xsd/LOM" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_v1p3" xmlns:imsss="http://www.imsglobal.org/xsd/imsss" xmlns:adlseq="http://www.adlnet.org/xsd/adlseq_v1p3" xmlns:adlnav="http://www.adlnet.org/xsd/adlnav_v1p3" xsi:schemaLocation="http://www.imsglobal.org/xsd/imscp_v1p1 imscp_v1p1.xsd http://ltsc.ieee.org/xsd/LOM lom.xsd http://www.adlnet.org/xsd/adlcp_v1p3 adlcp_v1p3.xsd http://www.imsglobal.org/xsd/imsss imsss_v1p0.xsd http://www.adlnet.org/xsd/adlseq_v1p3 adlseq_v1p3.xsd http://www.adlnet.org/xsd/adlnav_v1p3 adlnav_v1p3.xsd">' . "\n"); fwrite($f, $metadata); fwrite($f, $manifest_itemTree); fwrite($f, $manifest_resources); fwrite($f, "</manifest>\n"); fclose($f); return true; }
/** * @brief display resource video category * @global type $is_editor * @global type $course_id * @global type $langInactiveModule * @param array $table * @param type $title * @param type $comments * @param type $resource_id * @param type $videolinkcat_id * @param type $visibility * @return string */ function show_videocat($table, $title, $comments, $resource_id, $videolinkcat_id, $visibility) { global $is_editor, $course_id, $langInactiveModule; $content = $linkcontent = ''; $module_visible = visible_module(MODULE_ID_VIDEO); // checks module visibility if (!$module_visible and !$is_editor) { return ''; } $comment_box = $class_vis = $imagelink = $link = ''; $class_vis = ($visibility == 0 or !$module_visible) ? ' class="not_visible"' : ' '; $title = q($title); $sql = Database::get()->queryArray("SELECT * FROM video_category WHERE id = ?d AND course_id = ?d", $videolinkcat_id, $course_id); foreach ($sql as $vlcat) { $content .= "\n <tr{$class_vis}>\n <td width='1'>" . icon('fa-folder-o') . "</td>\n <td>" . q($vlcat->name); if (!empty($vlcat->description)) { $comment_box = "<br />{$vlcat->description}"; } else { $comment_box = ''; } foreach (array('video', 'videolink') as $table) { $sql2 = Database::get()->queryArray("SELECT * FROM {$table} WHERE category = ?d AND course_id = ?d", $vlcat->id, $course_id); foreach ($sql2 as $row) { if (!$is_editor and !resource_access(1, $row->public)) { return ''; } $status = $row->public; if ($table == 'video') { $vObj = MediaResourceFactory::initFromVideo($row); $videolink = MultimediaHelper::chooseMediaAhref($vObj); } else { $vObj = MediaResourceFactory::initFromVideoLink($row); $videolink = MultimediaHelper::chooseMedialinkAhref($vObj); } if (!$module_visible) { $videolink .= " <i>({$langInactiveModule})</i>"; } if (!empty($comments)) { $comment_box = "<br />{$comments}"; } else { $comment_box = ""; } $class_vis = ($visibility == 0 or !$module_visible or $status == 'del') ? ' class="not_visible"' : ' '; $ltitle = q($row->title == '' ? $row->url : $row->title); $linkcontent .= "<br />" . icon('fa-film') . " {$videolink}</a>"; if (!$module_visible) { $linkcontent .= " <i>({$langInactiveModule})</i>"; } } } } return $content . $comment_box . $linkcontent . ' </td>' . actions('videolinkcategory', $resource_id, $visibility) . '</tr>'; }
function display_my_documents($dialogBox, $style) { global $curDirName; global $curDirPath; global $parentDir; global $langUp; global $langName; global $langSize; global $langDate; global $langAddModulesButton; global $fileList; global $themeimg; global $langSelection, $langDirectory, $course_code; $output = ''; /* * DISPLAY */ $dspCurDirName = htmlspecialchars($curDirName); // $cmdCurDirPath = rawurlencode($curDirPath); $cmdParentDir = rawurlencode($parentDir); $output .= '<form action="' . $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '" method="POST">'; /* -------------------------------------- DIALOG BOX SECTION -------------------------------------- */ $colspan = 5; if (!empty($dialogBox)) { $output .= disp_message_box($dialogBox, $style) . "<br />"; } /* -------------------------------------- CURRENT DIRECTORY LINE -------------------------------------- */ /* CURRENT DIRECTORY */ if ($curDirName) { $output .= ' <table class="table-default"> <tr> <td width="1" class="right">' . icon('fa-folder-o') . '</td> <td>' . $langDirectory . ': <b>' . $dspCurDirName . '</b></td>'; /* GO TO PARENT DIRECTORY */ if ($curDirName) { $linkup = "<a href='{$_SERVER['SCRIPT_NAME']}?course={$course_code}&openDir={$cmdParentDir}'>"; $output .= "<td width='1'>{$linkup}<img src='{$themeimg}/folder_up.png' " . "hspace='5' alt='{$langUp}' title='langUp' /></a></td>" . "<td width='10' class='right'><small>{$linkup}{$langUp}</a></small></td>"; } $output .= '</tr></table>'; } $output .= ' <div class="table-responsive"> <table class="table-default" >'; $output .= "\n <tr class='list-header'>\n <th colspan='2'><div align='left'> {$langName}</div></th>\n <th>{$langSize}</th>\n <th>{$langDate}</th>\n <th>{$langSelection}</th>\n </tr>"; /* -------------------------------------- DISPLAY FILE LIST -------------------------------------- */ if ($fileList) { $iterator = 0; $ind = 1; while (list($fileKey, $fileName) = each($fileList['name'])) { if ($ind % 2 == 0) { $style = 'class="even"'; } else { $style = 'class="odd"'; } $dspFileName = htmlspecialchars($fileList['filename'][$fileKey]); $cmdFileName = str_replace("%2F", "/", rawurlencode($curDirPath . "/" . $fileName)); if ($fileList['visible'][$fileKey] == 0) { continue; // skip the display of this file } if ($fileList['type'][$fileKey] == A_FILE) { $image = choose_image($fileName); $size = format_file_size($fileList['size'][$fileKey]); $date = nice_format($fileList['date'][$fileKey]); $file_url = file_url($fileList['path'][$fileKey], $dspFileName); $play_url = file_playurl($fileList['path'][$fileKey], $dspFileName); $urlFileName = MultimediaHelper::chooseMediaAhrefRaw($file_url, $play_url, $dspFileName, $dspFileName); } elseif ($fileList['type'][$fileKey] == A_DIRECTORY) { $image = 'fa-folder'; $size = ' '; $date = ' '; $urlFileName = '<a href="' . $_SERVER['SCRIPT_NAME'] . '?course=' . $course_code . '&openDir=' . $cmdFileName . '">' . $dspFileName . '</a>'; } $output .= ' <tr ' . $style . '> <td class="center" width="1">' . icon($image, '') . '</td> <td align="left">' . $urlFileName . '</td> <td width="80" class="center">' . $size . '</td> <td width="80" class="center">' . $date . '</td>'; if ($fileList['type'][$fileKey] == A_FILE) { $iterator++; $output .= ' <td width="10" class="center"> <input type="checkbox" name="insertDocument_' . $iterator . '" id="insertDocument_' . $iterator . '" value="' . $curDirPath . "/" . $fileName . '" /> <input type="hidden" name="filenameDocument_' . $iterator . '" id="filenameDocument_' . $iterator . '" value="' . $dspFileName . '" /> </td>'; } else { $output .= '<td> </td>'; } $output .= '</tr>'; /* COMMENTS */ if ($fileList['comment'][$fileKey] != "") { $fileList['comment'][$fileKey] = htmlspecialchars($fileList['comment'][$fileKey]); $fileList['comment'][$fileKey] = parse_user_text($fileList['comment'][$fileKey]); $output .= ' <tr class="even"> <td> </td> <td colspan="' . $colspan . '"><span class="comment">' . $fileList['comment'][$fileKey] . '</span></td> </tr>'; } $ind++; } // end each ($fileList) // form button $output .= ' <tr> <th colspan="' . $colspan . '"><div class="pull-right"> <input type="hidden" name="openDir" value="' . $curDirPath . '" /> <input type="hidden" name="maxDocForm" value ="' . $iterator . '" /> <input class="btn btn-primary" type="submit" name="submitInsertedDocument" value="' . $langAddModulesButton . '"> </th> </tr>'; } else { $output .= '<tr><td colspan="4"> </td></tr>'; } $output .= '</table></div></form>'; return $output; }
break; case CTMEDIA_: if ($uid) { directly_pass_lp_module($TABLEUSERMODULEPROGRESS, (int) $uid, (int) $learnPathModuleId); } if (MultimediaHelper::isSupportedFile($assetPath)) { $moduleStartAssetPage = "showMedia.php?course={$course_code}&id=" . $assetPath; } else { $moduleStartAssetPage = htmlspecialchars($urlServer . "modules/video/index.php?course={$course_code}&action=download&id=" . $assetPath, ENT_QUOTES); } break; case CTMEDIALINK_: if ($uid) { directly_pass_lp_module($TABLEUSERMODULEPROGRESS, (int) $uid, (int) $learnPathModuleId); } if (MultimediaHelper::isEmbeddableMedialink($assetPath)) { $moduleStartAssetPage = "showMediaLink.php?course={$course_code}&id=" . $assetPath; } else { $moduleStartAssetPage = $assetPath; } break; } // end switch echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Frameset//EN''http://www.w3.org/TR/html4/frameset.dtd'>\n<html><head>"; // add the update frame if this is a SCORM module if ($module->contentType == CTSCORM_ || $module->contentType == CTSCORMASSET_) { require_once "scormAPI.inc.php"; echo "<frameset border='0' rows='0,56,*' frameborder='0'>\n\t\t<frame src='updateProgress.php?course={$course_code}' name='upFrame'>"; } else { echo "<frameset border='0' rows='85,*' frameborder='0'>"; }
/** * @brief display multimedia files * @global type $langName * @global type $langSelection * @global type $langAddModulesButton * @global type $course_code * @return string */ function showmedia() { global $langName, $langSelection, $langAddModulesButton, $course_code, $course_id; $output = "<form action='$_SERVER[SCRIPT_NAME]?course=$course_code' method='POST'> <div class='table-responsive'> <table class='table-default'> <thead> <tr class='list-header'> <th>$langName</th> <th width='50'>$langSelection</th> </tr> </thead> <tbody>"; $i = 1; $resultMedia = Database::get()->queryArray("SELECT * FROM video WHERE visible = 1 AND course_id = ?d ORDER BY title", $course_id); foreach ($resultMedia as $myrow) { $vObj = MediaResourceFactory::initFromVideo($myrow); $output .= "<tr> <td align='text-left'>" . MultimediaHelper::chooseMediaAhref($vObj) . " <br /> <small class='comments'>" . q($myrow->description) . "</small></td>"; $output .= "<td><div align='center'><input type='checkbox' name='insertMedia_" . $i . "' id='insertMedia_" . $i . "' value='" . $myrow->id . "' /></div></td></tr>"; $i++; } $j = 1; $resultMediaLinks = Database::get()->queryArray("SELECT * FROM videolink WHERE visible = 1 AND course_id = ?d ORDER BY title", $course_id); foreach ($resultMediaLinks as $myrow) { $vObj = MediaResourceFactory::initFromVideoLink($myrow); $output .= "<tr> <td align='left' valign='top'>" . MultimediaHelper::chooseMedialinkAhref($vObj) . " <br /> <small class='comments'>" . q($myrow->description) . "</small></td>"; $output .= "<td><div align='center'><input type='checkbox' name='insertMediaLink_" . $j . "' id='insertMediaLink_" . $j . "' value='" . $myrow->id . "' /></div></td></tr>"; $j++; } $output .= " </tbody> <tfooter> <tr> <th colspan='3'> <div align='right'> <input type='hidden' name='maxMediaForm' value ='" . ($i + $j - 2) . "' /> <input class='btn btn-primary' type='submit' name='submitInsertedMedia' value='$langAddModulesButton'/> </div></th> </tr> </tfooter> </table> </div> </form>"; return $output; }
if ($show_orphan_file and $file_path) { if (!preg_match('/\.html?$/i', $file_path)) { if (!$is_in_playmode) send_file_by_url_file_path($file_path); else { require_once 'include/lib/multimediahelper.class.php'; $path_components = explode('/', str_replace('//', chr(1), $file_path)); $file_info = public_path_to_disk_path($path_components, ''); $mediaPath = file_url($file_info->path, $file_info->filename); $mediaURL = $urlServer . 'modules/ebook/document.php?course=' . $course_code . '&ebook_id=' . $ebook_id . '&download=' . $file_info->path; $token = token_generate($file_info->path, true); $mediaAccess = $mediaPath . '?token=' . $token; echo MultimediaHelper::mediaHtmlObjectRaw($mediaAccess, $mediaURL, $mediaPath); exit(); } } } $pageName = $langEBook; if ($unit !== false) { $exit_fullscreen_link = $urlAppend . "modules/units/index.php?course=$course_code&id=$unit"; $unit_parameter = 'unit=' . $unit; } else { $exit_fullscreen_link = $urlAppend . "modules/ebook/index.php?course_code=$course_code"; $unit_parameter = ''; } $q = Database::get()->queryArray("SELECT ebook_section.id AS sid, ebook_section.public_id AS psid,
/** * list documents while inserting them in course unit * @global type $id * @global type $webDir * @global type $course_code * @global type $tool_content * @global type $group_sql * @global type $langDirectory * @global type $langUp * @global type $langName * @global type $langSize * @global type $langDate * @global type $langType * @global type $langAddModulesButton * @global type $langChoice * @global type $langNoDocuments * @global type $course_code */ function list_docs() { global $id, $webDir, $course_code, $tool_content, $group_sql, $langDirectory, $langUp, $langName, $langSize, $langDate, $langType, $langAddModulesButton, $langChoice, $langNoDocuments, $course_code, $langCommonDocs, $pageName; $basedir = $webDir . '/courses/' . $course_code . '/document'; $path = get_dir_path('path'); $dir_param = get_dir_path('dir'); $dir_setter = $dir_param ? ('&dir=' . $dir_param) : ''; $dir_html = $dir_param ? "<input type='hidden' name='dir' value='$dir_param'>" : ''; if ($id == -1) { $common_docs = true; $pageName = $langCommonDocs; $group_sql = "course_id = -1 AND subsystem = " . COMMON . ""; $basedir = $webDir . '/courses/commondocs'; $visible_sql = 'visible = 1 AND'; } else { $common_docs = false; $visible_sql = ''; } $result = Database::get()->queryArray("SELECT id, course_id, path, filename, format, title, extra_path, date_modified, visible, copyrighted, comment, IF(title = '', filename, title) AS sort_key FROM document WHERE $group_sql AND $visible_sql path LIKE ?s AND path NOT LIKE ?s ORDER BY sort_key COLLATE utf8_unicode_ci", "$path/%", "$path/%/%"); $fileinfo = array(); $urlbase = $_SERVER['SCRIPT_NAME'] . "?course=$course_code$dir_setter&type=doc&id=$id&path="; foreach ($result as $row) { $fullpath = $basedir . $row->path; if ($row->extra_path) { $size = 0; } else { $size = file_exists($fullpath)? filesize($fullpath): 0; } $fileinfo[] = array( 'id' => $row->id, 'is_dir' => is_dir($fullpath), 'size' => $size, 'title' => $row->title, 'name' => htmlspecialchars($row->filename), 'format' => $row->format, 'path' => $row->path, 'visible' => $row->visible, 'comment' => $row->comment, 'copyrighted' => $row->copyrighted, 'date' => $row->date_modified, 'object' => MediaResourceFactory::initFromDocument($row)); } if (count($fileinfo) == 0) { $tool_content .= "<div class='alert alert-warning'>$langNoDocuments</div>"; } else { if (!empty($path)) { $dirname = Database::get()->querySingle("SELECT filename FROM document WHERE $group_sql AND path = ?s", $path); $parentpath = dirname($path); $dirname = htmlspecialchars($dirname->filename); $parentlink = $urlbase . $parentpath; $parenthtml = "<span class='pull-right'><a href='$parentlink'>$langUp " . icon('fa-level-up') . "</a></span>"; $colspan = 4; } $tool_content .= "<form action='insert.php?course=$course_code' method='post'><input type='hidden' name='id' value='$id' />" . "<table class='table-default'>"; if( !empty($path)) { $tool_content .= "<tr>" . "<th colspan='$colspan'><div class='text-left'>$langDirectory: $dirname$parenthtml</div></th>" . "</tr>" ; } $tool_content .= "<tr class='list-header'>" . "<th class='text-left'>$langName</th>" . "<th class='text-center'>$langSize</th>" . "<th class='text-center'>$langDate</th>" . "<th style='width:20px;' class='text-center'>$langChoice</th>" . "</tr>"; $counter = 0; foreach (array(true, false) as $is_dir) { foreach ($fileinfo as $entry) { if ($entry['is_dir'] != $is_dir) { continue; } $dir = $entry['path']; if ($is_dir) { $image = 'fa-folder-o'; $file_url = $urlbase . $dir; $link_text = $entry['name']; $link_href = "<a href='$file_url'>$link_text</a>"; } else { $image = choose_image('.' . $entry['format']); $file_url = file_url($entry['path'], $entry['name'], $common_docs ? 'common' : $course_code); $dObj = $entry['object']; $dObj->setAccessURL($file_url); $dObj->setPlayURL(file_playurl($entry['path'], $entry['name'], $common_docs ? 'common' : $course_code)); $link_href = MultimediaHelper::chooseMediaAhref($dObj); } if ($entry['visible'] == 'i') { $vis = 'invisible'; } else { $vis = ''; } $tool_content .= "<tr class='$vis'>"; $tool_content .= "<td>" . icon($image, '')." $link_href"; /* * * comments ** */ if (!empty($entry['comment'])) { $tool_content .= "<br /><div class='comment'>" . standard_text_escape($entry['comment']) . "</div>"; } $tool_content .= "</td>"; if ($is_dir) { // skip display of date and time for directories $tool_content .= "<td> </td><td> </td>"; } else { $size = format_file_size($entry['size']); $date = nice_format($entry['date'], true, true); $tool_content .= "<td class='text-right'>$size</td><td class='text-center'>$date</td>"; } $tool_content .= "<td class='text-center'><input type='checkbox' name='document[]' value='$entry[id]' /></td>"; $tool_content .= "</tr>"; $counter++; } } $tool_content .= "</table>"; $tool_content .= "<div class='text-right'>"; $tool_content .= "<input class='btn btn-primary' type='submit' name='submit_doc' value='$langAddModulesButton' /></div>$dir_html</form>"; } }
function showmedia() { global $langName, $langSelection, $langAddModulesButton, $course_code, $themeimg; $sqlMedia = "SELECT * FROM video WHERE visible = 1 ORDER BY title"; $sqlMediaLinks = "SELECT * FROM videolink WHERE visible = 1 ORDER BY title"; $output = "<form action='{$_SERVER['SCRIPT_NAME']}?course={$course_code}' method='POST'>\n <table width='100%' class='tbl_alt'>\n <tr>\n <th colspan='2'>{$langName}</th>\n <th width='50'>{$langSelection}</th>\n </tr>\n <tbody>"; $i = 1; $resultMedia = Database::get()->queryArray($sqlMedia); foreach ($resultMedia as $myrow) { $vObj = MediaResourceFactory::initFromVideo($myrow); $output .= "<tr>\n <td width='1' valign='top'><img src='{$themeimg}/arrow.png' border='0'></td>\n <td align='left' valign='top'>" . MultimediaHelper::chooseMediaAhref($vObj) . "\n <br />\n <small class='comments'>" . q($myrow->description) . "</small></td>"; $output .= "<td><div align='center'><input type='checkbox' name='insertMedia_" . $i . "' id='insertMedia_" . $i . "' value='" . $myrow->id . "' /></div></td></tr>"; $i++; } $j = 1; $resultMediaLinks = Database::get()->queryArray($sqlMediaLinks); foreach ($resultMediaLinks as $myrow) { $vObj = MediaResourceFactory::initFromVideoLink($myrow); $output .= "<tr>\n <td width='1' valign='top'><img src='{$themeimg}/arrow.png' border='0'></td>\n <td align='left' valign='top'>" . MultimediaHelper::chooseMedialinkAhref($vObj) . "\n <br />\n <small class='comments'>" . q($myrow->description) . "</small></td>"; $output .= "<td><div align='center'><input type='checkbox' name='insertMediaLink_" . $j . "' id='insertMediaLink_" . $j . "' value='" . $myrow->id . "' /></div></td></tr>"; $j++; } $output .= "<tr>\n <th colspan='3'>\n <div align='right'>\n <input type='hidden' name='maxMediaForm' value ='" . ($i + $j - 2) . "' />\n <input class='btn btn-primary' type='submit' name='submitInsertedMedia' value='{$langAddModulesButton}'/>\n </div></th>\n </tr>\n </tbody>\n </table>\n </form>"; return $output; }
/** * @brief display links of category (if category is defined) else display all * @global type $is_in_tinymce * @global type $themeimg * @global type $tool_content * @global type $is_editor * @global type $course_id * @global type $course_code * @global type $langDelete * @global type $langViewHide * @global type $langViewShow * @global type $langPreview * @global type $langDownload * @global type langResourceAccessLock * @global type langResourceAccessUnlock * @global type $langEditChange * @global type $langConfirmDelete * @global type $filterv * @global type $filterl * @param type $cat_id */ function showlinksofcategory($cat_id = 0) { global $course_id, $is_in_tinymce, $tool_content, $is_editor, $course_code, $langDelete, $langViewHide, $langViewShow, $langConfirmDelete, $display_tools, $is_in_tinymce, $langDownload, $langResourceAccessLock, $langResourceAccessUnlock, $langEditChange, $filterv, $filterl, $order, $compatiblePlugin, $langcreator, $langpublisher; if ($is_editor) { $vis_q = ''; } else { $vis_q = "AND visible = 1"; } if ($cat_id > 0) { $results['video'] = Database::get()->queryArray("SELECT * FROM video $filterv AND course_id = ?d AND category = ?d $vis_q $order", $course_id, $cat_id); $results['videolink'] = Database::get()->queryArray("SELECT * FROM videolink $filterl AND course_id = ?d AND category = ?d $vis_q $order", $course_id, $cat_id); } else { $results['video'] = Database::get()->queryArray("SELECT * FROM video $filterv AND course_id = ?d AND (category IS NULL OR category = 0) $vis_q $order", $course_id); $results['videolink'] = Database::get()->queryArray("SELECT * FROM videolink $filterl AND course_id = ?d AND (category IS NULL OR category = 0) $vis_q $order", $course_id); } foreach ($results as $table => $result) { foreach ($result as $myrow) { $myrow->course_id = $course_id; if (resource_access($myrow->visible, $myrow->public) || $is_editor) { switch ($table) { case 'video': $vObj = MediaResourceFactory::initFromVideo($myrow); if ($is_in_tinymce && !$compatiblePlugin) { // use Access/DL URL for non-modable tinymce plugins $vObj->setPlayURL($vObj->getAccessURL()); } $link_href = MultimediaHelper::chooseMediaAhref($vObj); $link_to_save = $vObj->getAccessURL() . '&attachment'; break; case "videolink": $vObj = MediaResourceFactory::initFromVideoLink($myrow); $link_href = MultimediaHelper::chooseMedialinkAhref($vObj); $link_to_save = $vObj->getPath(); break; default: exit; } $row_class = !$myrow->visible ? "class='not_visible'" : ""; $tool_content .= "<tr $row_class><td class='nocategory-link'>" . $link_href; if (!$is_in_tinymce and ( !empty($myrow->creator) or ! empty($myrow->publisher))) { $tool_content .= '<br><small>'; if ($myrow->creator == $myrow->publisher) { $tool_content .= "$langcreator: " . q($myrow->creator); } else { $emit = false; if (!empty($myrow->creator)) { $tool_content .= "$langcreator: " . q($myrow->creator); $emit = true; } if (!empty($myrow->publisher)) { $tool_content .= ($emit ? ', ' : '') . "$langpublisher: " . q($myrow->publisher); } } $tool_content .= "</small>"; } $tool_content .= "</td> <td class='text-center'>" . nice_format(date('Y-m-d', strtotime($myrow->date))) . "</td>"; if (!$is_in_tinymce) { if ($display_tools) { $tool_content .= "<td class='option-btn-cell'>" . action_button(array( array('title' => $langEditChange, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&id=$myrow->id&table_edit=$table", 'icon' => 'fa-edit', 'show' => !$is_in_tinymce and $is_editor), array('title' => $myrow->visible ? $langViewHide : $langViewShow, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&vid=$myrow->id&table=$table&vis=" . ($myrow->visible ? '0' : '1'), 'icon' => $myrow->visible ? 'fa-eye-slash' : 'fa-eye'), array('title' => $myrow->public ? $langResourceAccessLock : $langResourceAccessUnlock, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&vid=$myrow->id&table=$table&" . ($myrow->public ? 'limited=1' : 'public=1'), 'icon' => $myrow->public ? 'fa-lock' : 'fa-unlock', 'show' => !$is_in_tinymce and $is_editor and course_status($course_id) == COURSE_OPEN), array('title' => $langDownload, 'url' => $link_to_save, 'icon' => 'fa-download'), array('title' => $langDelete, 'url' => "$_SERVER[SCRIPT_NAME]?course=$course_code&id=$myrow->id&delete=yes&table=$table", 'icon' => 'fa-times', 'confirm' => $langConfirmDelete, 'class' => 'delete'))) . "</td>"; } else { $tool_content .= "<td class='text-center'>" . ($table == 'video'? icon('fa-download', $langDownload, $link_to_save): ' ') . '</td>'; } } $tool_content .= "</tr>"; } // end of check resource access } // foreach row } // foreach table }
/** * list documents while inserting them in course unit * @global type $id * @global type $webDir * @global type $course_code * @global type $tool_content * @global type $group_sql * @global type $langDirectory * @global type $langUp * @global type $langName * @global type $langSize * @global type $langDate * @global type $langType * @global type $langAddModulesButton * @global type $langChoice * @global type $langNoDocuments * @global type $course_code */ function list_docs() { global $id, $webDir, $course_code, $tool_content, $group_sql, $langDirectory, $langUp, $langName, $langSize, $langDate, $langType, $langAddModulesButton, $langChoice, $langNoDocuments, $course_code, $langCommonDocs, $pageName; $basedir = $webDir . '/courses/' . $course_code . '/document'; $path = get_dir_path('path'); $dir_param = get_dir_path('dir'); $dir_setter = $dir_param ? '&dir=' . $dir_param : ''; $dir_html = $dir_param ? "<input type='hidden' name='dir' value='{$dir_param}'>" : ''; if ($id == -1) { $common_docs = true; $pageName = $langCommonDocs; $group_sql = "course_id = -1 AND subsystem = " . COMMON . ""; $basedir = $webDir . '/courses/commondocs'; $result = Database::get()->queryArray("SELECT * FROM document\n WHERE {$group_sql} AND\n visible = 1 AND\n path LIKE ?s AND\n path NOT LIKE ?s", "{$path}/%", "{$path}/%/%"); } else { $common_docs = false; $result = Database::get()->queryArray("SELECT * FROM document\n WHERE {$group_sql} AND\n path LIKE ?s AND\n path NOT LIKE ?s", "{$path}/%", "{$path}/%/%"); } $fileinfo = array(); $urlbase = $_SERVER['SCRIPT_NAME'] . "?course={$course_code}{$dir_setter}&type=doc&id={$id}&path="; foreach ($result as $row) { $fullpath = $basedir . $row->path; if ($row->extra_path) { $size = 0; } else { $size = file_exists($fullpath) ? filesize($fullpath) : 0; } $fileinfo[] = array('id' => $row->id, 'is_dir' => is_dir($fullpath), 'size' => $size, 'title' => $row->title, 'name' => htmlspecialchars($row->filename), 'format' => $row->format, 'path' => $row->path, 'visible' => $row->visible, 'comment' => $row->comment, 'copyrighted' => $row->copyrighted, 'date' => $row->date_modified, 'object' => MediaResourceFactory::initFromDocument($row)); } if (count($fileinfo) == 0) { $tool_content .= "<div class='alert alert-warning'>{$langNoDocuments}</div>"; } else { if (empty($path)) { $dirname = ''; $parenthtml = ''; $colspan = 5; } else { $dirname = Database::get()->querySingle("SELECT filename FROM document\n WHERE {$group_sql} AND path = ?s", $path); $parentpath = dirname($path); $dirname = "/" . htmlspecialchars($dirname); $parentlink = $urlbase . $parentpath; $parenthtml = "<th class='right'><a href='{$parentlink}'>{$langUp}</a> " . icon('fa-upload', $langUp, $parentlink) . "</th>"; $colspan = 4; } $tool_content .= "<form action='insert.php?course={$course_code}' method='post'><input type='hidden' name='id' value='{$id}' />" . "<table class='table-default'>" . "<tr>" . "<th colspan='{$colspan}'><div align='left'>{$langDirectory}: {$dirname}</div></th>" . $parenthtml . "</tr>" . "<tr>" . "<th>{$langType}</th>" . "<th><div align='left'>{$langName}</div></th>" . "<th width='100'>{$langSize}</th>" . "<th width='80'>{$langDate}</th>" . "<th width='80'>{$langChoice}</th>" . "</tr>"; $counter = 0; foreach (array(true, false) as $is_dir) { foreach ($fileinfo as $entry) { if ($entry['is_dir'] != $is_dir) { continue; } $dir = $entry['path']; if ($is_dir) { $image = 'fa-folder-o'; $file_url = $urlbase . $dir; $link_text = $entry['name']; $link_href = "<a href='{$file_url}'>{$link_text}</a>"; } else { $image = choose_image('.' . $entry['format']); $file_url = file_url($entry['path'], $entry['name'], $common_docs ? 'common' : $course_code); $dObj = $entry['object']; $dObj->setAccessURL($file_url); $dObj->setPlayURL(file_playurl($entry['path'], $entry['name'], $common_docs ? 'common' : $course_code)); $link_href = MultimediaHelper::chooseMediaAhref($dObj); } if ($entry['visible'] == 'i') { $vis = 'invisible'; } else { $vis = ''; } $tool_content .= "<tr class='{$vis}'>"; $tool_content .= "<td width='1' class='center'>" . icon($image, '') . "</td>"; $tool_content .= "<td>{$link_href}"; /* * * comments ** */ if (!empty($entry['comment'])) { $tool_content .= "<br /><div class='comment'>" . standard_text_escape($entry['comment']) . "</div>"; } $tool_content .= "</td>"; if ($is_dir) { // skip display of date and time for directories $tool_content .= "<td> </td><td> </td>"; } else { $size = format_file_size($entry['size']); $date = nice_format($entry['date'], true, true); $tool_content .= "<td class='center'>{$size}</td><td class='center'>{$date}</td>"; } $tool_content .= "<td class='center'><input type='checkbox' name='document[]' value='{$entry['id']}' /></td>"; $tool_content .= "</tr>"; $counter++; } } $tool_content .= "<tr><th colspan={$colspan}><div align='right'>"; $tool_content .= "<input class='btn btn-primary' type='submit' name='submit_doc' value='{$langAddModulesButton}' /></div></th>"; $tool_content .= "</tr></table>{$dir_html}</form>"; } }
* Contact address: GUnet Asynchronous eLearning Group, * Network Operations Center, University of Athens, * Panepistimiopolis Ilissia, 15784, Athens, Greece * e-mail: info@openeclass.org * ======================================================================== */ $require_current_course = true; $guest_allowed = true; require_once '../../include/baseTheme.php'; require_once 'include/lib/multimediahelper.class.php'; require_once 'include/lib/mediaresource.factory.php'; require_once 'include/action.php'; $action = new action(); $action->record(MODULE_ID_VIDEO); // ---------------------- // play video // ---------------------- $row = Database::get()->querySingle("SELECT * FROM video WHERE course_id = ?d AND id = ?d", $course_id, $_GET['id']); if ($row) { $vObj = MediaResourceFactory::initFromVideo($row); $token = token_generate($row->path, true); // generate new token $vObj->setAccessURL($vObj->getAccessURL() . '&token=' . $token); // append token to accessurl echo MultimediaHelper::mediaHtmlObject($vObj); } else { header("Location: ${urlServer}modules/video/index.php?course=$course_code"); }
/** * @brief get user documents newer than one month * @global type $langNoDocsExist * @param type $param * @return string */ function getUserDocuments($lesson_id) { global $langNoDocsExist, $group_sql; $last_month = strftime('%Y-%m-%d', strtotime('now -1 month')); $found = false; $doc_content = '<table width="100%">'; foreach ($lesson_id as $lid) { $q = Database::get()->queryArray("SELECT document.path, document.course_id, document.filename,\n document.title, document.date_modified,\n document.format, document.visible,\n document.id\n FROM document, course_module\n WHERE document.course_id = ?d AND \n subsystem = " . MAIN . " AND\n document.visible = 1 AND\n date_modified >= '{$last_month}' AND\n format <> '.dir' AND\n course_module.module_id = " . MODULE_ID_DOCS . " AND\n course_module.visible = 1 AND\n course_module.course_id = ?d\n ORDER BY date_modified DESC", $lid, $lid); if ($q) { $found = true; $doc_content .= "<tr><td class='sub_title1'>" . q(ellipsize(course_id_to_title($lid), 70)) . "</td></tr>"; foreach ($q as $course_file) { $group_sql = "course_id = " . $lid . " AND subsystem = " . MAIN; $url = file_url($course_file->path, $course_file->filename, course_id_to_code($lid)); $dObj = MediaResourceFactory::initFromDocument($course_file); $dObj->setAccessURL($url); $dObj->setPlayURL(file_playurl($course_file->path, $course_file->filename, course_id_to_code($lid))); $href = MultimediaHelper::chooseMediaAhref($dObj); $doc_content .= "<tr><td class='smaller'><ul class='custom_list'><li>" . $href . ' - (' . nice_format(date('Y-m-d', strtotime($course_file->date_modified))) . ")</li></ul></td></tr>"; } } } $doc_content .= "</table>"; if ($found) { return $doc_content; } else { return "<div class='alert alert-warning'>{$langNoDocsExist}</div>"; } }
/** * @brief display links of category (if category is defined) else display all * @global type $is_in_tinymce * @global type $themeimg * @global type $tool_content * @global type $is_editor * @global type $course_id * @global type $course_code * @global type $langDelete * @global type $langVisible * @global type $langPreview * @global type $langSave * @global type $langResourceAccess * @global type $langResourceAccess * @global type $langModify * @global type $langConfirmDelete * @global type $filterv * @global type $filterl * @param type $cat_id */ function showlinksofcategory($cat_id = 0) { global $course_id, $is_in_tinymce, $themeimg, $tool_content, $is_editor, $course_code; global $langDelete, $langVisible, $langConfirmDelete; global $langPreview, $langSave, $langResourceAccess, $langResourceAccess, $langModify; global $filterv, $filterl, $compatiblePlugin, $langcreator, $langpublisher; if ($is_editor) { $vis_q = ''; } else { $vis_q = "AND visible = 1"; } if ($cat_id > 0) { $results['video'] = Database::get()->queryArray("SELECT * FROM video {$filterv} AND course_id = ?d AND category = ?d {$vis_q} ORDER BY title", $course_id, $cat_id); $results['videolink'] = Database::get()->queryArray("SELECT * FROM videolink {$filterl} AND course_id = ?d AND category = ?d {$vis_q} ORDER BY title", $course_id, $cat_id); } else { $results['video'] = Database::get()->queryArray("SELECT * FROM video {$filterv} AND course_id = ?d AND (category IS NULL OR category = 0) {$vis_q} ORDER BY title", $course_id); $results['videolink'] = Database::get()->queryArray("SELECT * FROM videolink {$filterl} AND course_id = ?d AND (category IS NULL OR category = 0) {$vis_q} ORDER BY title", $course_id); } $i = 0; foreach ($results as $table => $result) { foreach ($result as $myrow) { $myrow->course_id = $course_id; if (resource_access($myrow->visible, $myrow->public) || $is_editor) { switch ($table) { case 'video': $vObj = MediaResourceFactory::initFromVideo($myrow); if ($is_in_tinymce && !$compatiblePlugin) { // use Access/DL URL for non-modable tinymce plugins $vObj->setPlayURL($vObj->getAccessURL()); } $link_href = MultimediaHelper::chooseMediaAhref($vObj); $link_to_save = $vObj->getAccessURL(); break; case "videolink": $vObj = MediaResourceFactory::initFromVideoLink($myrow); $link_href = MultimediaHelper::chooseMedialinkAhref($vObj); $link_to_save = $vObj->getPath(); break; default: exit; } $row_class = !$myrow->visible ? "class='not_visible'" : ""; $tool_content .= "<tr {$row_class}><td>" . $link_href; if (!$is_in_tinymce and (!empty($myrow->creator) or !empty($myrow->publisher))) { $tool_content .= '<br><small>'; if ($myrow->creator == $myrow->publisher) { $tool_content .= "{$langcreator}: " . q($myrow->creator); } else { $emit = false; if (!empty($myrow->creator)) { $tool_content .= "{$langcreator}: " . q($myrow->creator); $emit = true; } if (!empty($myrow->publisher)) { $tool_content .= ($emit ? ', ' : '') . "{$langpublisher}: " . q($myrow->publisher); } } $tool_content .= '</small>'; } $tool_content .= "</td><td class='text-center'>" . nice_format(date('Y-m-d', strtotime($myrow->date))) . "</td><td class='option-btn-cell'>" . action_button(array(array('title' => $langDelete, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&id={$myrow->id}&delete=yes&table={$table}", 'icon' => 'fa-times', 'confirm' => $langConfirmDelete, 'class' => 'delete'), array('title' => $langSave, 'url' => $link_to_save, 'icon' => 'fa-floppy-o'), array('title' => $langModify, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&id={$myrow->id}&table_edit={$table}", 'icon' => 'fa-edit', 'show' => !$is_in_tinymce and $is_editor), array('title' => $langVisible, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&vid={$myrow->id}&table={$table}&vis=" . ($myrow->visible ? '0' : '1'), 'icon' => $myrow->visible ? 'fa-eye-slash' : 'fa-eye'), array('title' => $langResourceAccess, 'url' => "{$_SERVER['SCRIPT_NAME']}?course={$course_code}&vid={$myrow->id}&table={$table}&" . ($myrow->public ? 'limited=1' : 'public=1'), 'icon' => $myrow->public ? 'fa-unlock' : 'fa-lock', 'show' => !$is_in_tinymce and $is_editor and course_status($course_id) == COURSE_OPEN))) . "</td></tr>"; } // end of check resource access } // foreach row } // foreach table }