lessons); $files = json_decode($course->fileDownloadLink)->files; $app = JFactory::getApplication('site'); $user = JFactory::getUser(); $courseApp = Course::getCourseApplication($course->id, $user->id); $completedCourses = (array)json_decode($courseApp['completedCourses'])->courses; $percentage = Course::getApplicationPercentage($course->id, $user->id); $courseArray = (array)$lessons->courses; $firstCourse = key($courseArray); $nextLesson = ''; $nextCourse = ''; if ($id == $lang['download_link']) { $table = $_SERVER['HTTP_HOST'] == 'www.archline.hu' ? 'jml_content' : 'eng_content'; $query = "SELECT * FROM `" . JMLADATBAZIS . "`.`{$table}` WHERE id = ?"; Database::getInstance()->query($query, array('i', $files->article[0])); $article = Database::getInstance()->fetchNext(); $moduleStr = Course::get_string_between($article['introtext'], '{loadmodule ', '}'); $module = explode(",", $moduleStr); $phoca = Course::get_string_between($article['introtext'], '{phocadownload ', '}'); $introText = str_replace("{loadmodule " . $module[0] . "," . $module[1] . "}", JModuleHelper::renderModule(JModuleHelper::getModule($module[0], $module[1])), $article['introtext']); $introText = str_replace("{phocadownload " . $phoca . "}", "", $introText); } if ($lessonID != '' && $lessonID < 0 && $id != $lang['download_link'] || ($id == $lang['download_link'] && $course->fileDownloadLink == '')) { $newUrl = 'https://' . $_SERVER['HTTP_HOST'] . '/' . $url . '/'; if ($lessonID < 0) { if ($course->fileDownloadLink == '') { $newUrl .= $firstCourse . '/1'; } else { $newUrl .= $lang['download_link']; } } else { $newUrl .= $firstCourse . '/1'; } header("Location: {$newUrl}"); exit(); } $freeLesson = $course->need_login == 0; if ($id != '' && $id != $lang['download_link'] && $lessonID >= 0) { $selectedCourse = $courseArray[$id]; $selectedLessonName = $selectedCourse->lessons->name[$lessonID]; $selectedLessonYt = $selectedCourse->lessons->yt_link[$lessonID]; $lastLesson = count($selectedCourse->lessons->name); if ($lessonID > $lastLesson - 1) { $newUrl = 'https://' . $_SERVER['HTTP_HOST'] . '/' . $url . '/'; $newUrl .= $firstCourse . '/1'; header("Location: {$newUrl}"); exit(); } if (!$freeLesson && count($courseArray[$id]->lessons->name) > 1) $freeLesson = $lessonID == 0; $freeLesson = true; $YtId = substr(strrchr(rtrim($selectedLessonYt, '/'), '/'), 1); //$key = 'AIzaSyAAvKsDP6AF5XseRIDIezkFrrRwy-BwoeE'; $key = 'AIzaSyDmEK6HMS1-tPIVZDXwleeTST_fi6Z9TaE'; $json = file_get_contents("https://www.googleapis.com/youtube/v3/videos?part=statistics&id=" . $YtId . "&key=" . $key); $jsonData = json_decode($json); $views = $jsonData->items[0]->statistics->viewCount; } else { $nextLesson = 1; if (current($courseArray)->lessons == null) { next($courseArray); $nextCourse = key($courseArray); } else { $nextCourse = $firstCourse; } } ?> <?= strip_tags($course->title) ?>

fileDownloadLink != '') : ?>

name); $i++) : ?>
id > 0) : ?>
id <= 0) : ?>