From 05a3c9cff3facd4d139e60858e5110b9bc80e534 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Mon, 16 Oct 2017 13:40:34 +0200 Subject: [PATCH] Minor - format code --- main/lp/openoffice_text.class.php | 68 +++++---- main/tracking/course_log_tools.php | 218 ++++++++++++++--------------- plugin/jcapture/applet.php | 68 +++++---- 3 files changed, 177 insertions(+), 177 deletions(-) diff --git a/main/lp/openoffice_text.class.php b/main/lp/openoffice_text.class.php index bbf2fac0f1..185bea6433 100755 --- a/main/lp/openoffice_text.class.php +++ b/main/lp/openoffice_text.class.php @@ -19,18 +19,20 @@ if (api_get_setting('search_enabled') == 'true') { require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php'; require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php'; } + /** * @package chamilo.learnpath.OpenofficeDocument */ class OpenofficeText extends OpenofficeDocument { public $split_steps; + /** * Class constructor. Calls the parent class and initialises the local attribute split_steps - * @param boolean Whether to split steps (true) or make one large page (false) - * @param string Course code - * @param integer Resource ID - * @param integer Creator user id + * @param boolean Whether to split steps (true) or make one large page (false) + * @param string Course code + * @param integer Resource ID + * @param integer Creator user id */ public function __construct( $split_steps = false, @@ -38,20 +40,22 @@ class OpenofficeText extends OpenofficeDocument $resource_id = null, $user_id = null ) { - $this -> split_steps = $split_steps; + $this->split_steps = $split_steps; parent::__construct($course_code, $resource_id, $user_id); } /** * Gets html pages and compose them into a learning path - * @param array The files that will compose the generated learning path. Unused so far. - * @return boolean False if file does not exit. Nothing otherwise. + * @param array The files that will compose the generated learning path. Unused so far. + * @return boolean False if file does not exit. Nothing otherwise. */ public function make_lp($files = array()) { $_course = api_get_course_info(); // We get a content where ||page_break|| indicates where the page is broken. - if (!file_exists($this->base_work_dir.'/'.$this->created_dir.'/'.$this->file_name.'.html')) { return false; } + if (!file_exists($this->base_work_dir.'/'.$this->created_dir.'/'.$this->file_name.'.html')) { + return false; + } $content = file_get_contents($this->base_work_dir.'/'.$this->created_dir.'/'.$this->file_name.'.html'); unlink($this->base_work_dir.'/'.$this->file_path); @@ -67,7 +71,11 @@ class OpenofficeText extends OpenofficeDocument $content = api_html_entity_decode($content, ENT_COMPAT, $charset); // Set the path to pictures to absolute (so that it can be modified in fckeditor). - $content = preg_replace("|src=\"([^\"]*)|i", "src=\"".api_get_path(REL_COURSE_PATH).$_course['path'].'/document'.$this->created_dir."/\\1", $content); + $content = preg_replace( + "|src=\"([^\"]*)|i", + "src=\"".api_get_path(REL_COURSE_PATH).$_course['path'].'/document'.$this->created_dir."/\\1", + $content + ); list($header, $body) = explode('split_steps) { case 'per_page': - $this -> dealPerPage($header, $body); + $this->dealPerPage($header, $body); break; case 'per_chapter': - $this -> dealPerChapter($header, $body); + $this->dealPerChapter($header, $body); break; } } /** * Manages dir/chapter splitting - * @param string Chapter header - * @param string Content - * @return void + * @param string Chapter header + * @param string Content + * @return void */ public function dealPerChapter($header, $content) { @@ -200,9 +208,9 @@ class OpenofficeText extends OpenofficeDocument /** * Manages page splitting - * @param string Page header - * @param string Page body - * @return void + * @param string Page header + * @param string Page body + * @return void */ public function dealPerPage($header, $body) { @@ -255,7 +263,9 @@ class OpenofficeText extends OpenofficeDocument if (isset($_POST['index_document']) && $_POST['index_document']) { //echo Display::return_message(print_r($_POST)); $di = new ChamiloIndexer(); - isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english'; + isset($_POST['language']) ? $lang = Database::escape_string( + $_POST['language'] + ) : $lang = 'english'; $di->connectDb(null, null, $lang); $ic_slide = new IndexableChunk(); $ic_slide->addValue('title', $slide_name); @@ -283,8 +293,8 @@ class OpenofficeText extends OpenofficeDocument $xapian_data = array( SE_COURSE_ID => $courseid, SE_TOOL_ID => TOOL_LEARNPATH, - SE_DATA => array('lp_id' => $lp_id, 'lp_item'=> $previous, 'document_id' => $document_id), - SE_USER => (int) api_get_user_id(), + SE_DATA => array('lp_id' => $lp_id, 'lp_item' => $previous, 'document_id' => $document_id), + SE_USER => (int)api_get_user_id(), ); $ic_slide->xapian_data = serialize($xapian_data); $di->addChunk($ic_slide); @@ -295,7 +305,15 @@ class OpenofficeText extends OpenofficeDocument $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); $sql = 'INSERT INTO %s (id, course_code, tool_id, ref_id_high_level, ref_id_second_level, search_did) VALUES (NULL , \'%s\', \'%s\', %s, %s, %s)'; - $sql = sprintf($sql, $tbl_se_ref, api_get_course_id(), TOOL_LEARNPATH, $lp_id, $previous, $did); + $sql = sprintf( + $sql, + $tbl_se_ref, + api_get_course_id(), + TOOL_LEARNPATH, + $lp_id, + $previous, + $did + ); Database::query($sql); } } @@ -306,7 +324,7 @@ class OpenofficeText extends OpenofficeDocument /** * Returns additional Java command parameters - * @return string The additional parameters to be used in the Java call + * @return string The additional parameters to be used in the Java call */ public function add_command_parameters() { @@ -315,9 +333,9 @@ class OpenofficeText extends OpenofficeDocument /** * Formats a page content by reorganising the HTML code a little - * @param string Page header - * @param string Page content - * @return string Formatted page content + * @param string Page header + * @param string Page content + * @return string Formatted page content */ public function format_page_content($header, $content) { diff --git a/main/tracking/course_log_tools.php b/main/tracking/course_log_tools.php index 8a983a57b8..4736a530f1 100755 --- a/main/tracking/course_log_tools.php +++ b/main/tracking/course_log_tools.php @@ -4,7 +4,7 @@ use ChamiloSession as Session; /** - * @package chamilo.tracking + * @package chamilo.tracking */ require_once __DIR__.'/../inc/global.inc.php'; @@ -12,8 +12,6 @@ $current_course_tool = TOOL_TRACKING; $course_info = api_get_course_info(); $groupId = isset($_REQUEST['gidReq']) ? intval($_REQUEST['gidReq']) : 0; -//$groupId = api_get_group_id(); - $from_myspace = false; $from = isset($_GET['from']) ? $_GET['from'] : null; @@ -66,7 +64,10 @@ $csv_content = array(); if (isset($_GET['origin']) && $_GET['origin'] == 'resume_session') { $interbreadcrumb[] = array('url' => '../admin/index.php', 'name' => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => '../session/session_list.php', 'name' => get_lang('SessionList')); - $interbreadcrumb[] = array('url' => '../session/resume_session.php?id_session='.api_get_session_id(), 'name' => get_lang('SessionOverview')); + $interbreadcrumb[] = array( + 'url' => '../session/resume_session.php?id_session='.api_get_session_id(), + 'name' => get_lang('SessionOverview'), + ); } $view = (isset($_REQUEST['view']) ? $_REQUEST['view'] : ''); @@ -114,7 +115,10 @@ if (empty($groupId)) { Display::return_icon('group.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM), 'course_log_groups.php?'.api_get_cidreq() ); - echo Display::url(Display::return_icon('course_na.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM), '#'); + echo Display::url( + Display::return_icon('course_na.png', get_lang('CourseTracking'), array(), ICON_SIZE_MEDIUM), + '#' + ); } else { echo Display::url( Display::return_icon('group_na.png', get_lang('GroupReporting'), array(), ICON_SIZE_MEDIUM), @@ -149,17 +153,15 @@ if ($lpReporting) { $flat_list = $list->get_flat_list(); if (count($flat_list) > 0) { - // learning path tracking - echo '
- '.Display::page_subheader( - Display::return_icon( - 'scorms.gif', - get_lang('AverageProgressInLearnpath') - ).get_lang('AverageProgressInLearnpath') - ).' - '; - + echo '
'; + echo Display::page_subheader( + Display::return_icon( + 'scorms.gif', + get_lang('AverageProgressInLearnpath') + ).get_lang('AverageProgressInLearnpath') + ); + echo '
'; if ($export_csv) { $temp = array(get_lang('AverageProgressInLearnpath', ''), ''); $csv_content[] = array('', ''); @@ -204,19 +206,16 @@ if ($lpReporting) { } if ($exerciseReporting) { - // Exercices tracking. - echo '
- '.Display::page_subheader( - Display::return_icon( - 'quiz.png', - get_lang('AverageResultsToTheExercices') - ).get_lang('AverageResultsToTheExercices') - ).' -
'; - + echo '
'; + echo Display::page_subheader( + Display::return_icon( + 'quiz.png', + get_lang('AverageResultsToTheExercices') + ).get_lang('AverageResultsToTheExercices') + ); + echo '
'; $course_id = api_get_course_int_id(); - $sql = "SELECT id, title FROM $TABLEQUIZ WHERE c_id = $course_id AND active <> -1 AND session_id = $session_id"; $rs = Database::query($sql); @@ -243,18 +242,16 @@ if ($exerciseReporting) { $quiz_avg_score += $avg_student_score; } } - $studentCount = ($studentCount == 0 || is_null( - $studentCount - ) || $studentCount == '') ? 1 : $studentCount; + $studentCount = ($studentCount == 0 || is_null($studentCount) || $studentCount == '') ? 1 : $studentCount; $quiz_avg_score = round(($quiz_avg_score / $studentCount), 2).'%'; - $url = api_get_path( - WEB_CODE_PATH - ).'exercise/overview.php?exerciseId='.$quiz['id'].$course_path_params; - - echo ''; + $url = api_get_path(WEB_CODE_PATH).'exercise/overview.php?exerciseId='.$quiz['id'].$course_path_params; + + echo ''; if ($export_csv) { $temp = array($quiz['title'], $quiz_avg_score); $csv_content[] = $temp; @@ -267,13 +264,11 @@ if ($exerciseReporting) { $csv_content[] = $temp; } } - echo '
'.Display::url( - $quiz['title'], - $url - ).''.$quiz_avg_score.'
'; + echo Display::url( + $quiz['title'], + $url + ); + echo ''.$quiz_avg_score.'
'; echo '
'; } $filterByUsers = array(); - if (!empty($groupId)) { $filterByUsers = $student_ids; } @@ -304,15 +299,13 @@ if ($export_csv) { } // Forums tracking. -echo '
- '.Display::page_subheader( - Display::return_icon('forum.gif', get_lang('Forum')). - get_lang('Forum').' - '. - get_lang('SeeDetail').'' - ). - ''; - - +echo '
'; +echo Display::page_subheader( + Display::return_icon('forum.gif', get_lang('Forum')). + get_lang('Forum').' - '. + get_lang('SeeDetail').'' +); +echo '
'; echo ''; echo ''; echo ''; @@ -321,11 +314,12 @@ echo '
'; // Chat tracking. if ($showChatReporting) { - echo '
- '.Display::page_subheader( - Display::return_icon('chat.gif', get_lang('Chat')).get_lang('Chat') - ).' -
'.get_lang('ForumForumsNumber').''.$count_number_of_forums_by_course.'
'.get_lang('ForumThreadsNumber').''.$count_number_of_threads_by_course.'
'.get_lang('ForumPostsNumber').''.$count_number_of_posts_by_course.'
'; + echo '
'; + echo Display::page_subheader( + Display::return_icon('chat.gif', get_lang('Chat')).get_lang('Chat') + ); + + echo '
'; $chat_connections_during_last_x_days_by_course = Tracking::chat_connections_during_last_x_days_by_course( $course_code, 7, @@ -338,13 +332,15 @@ if ($showChatReporting) { get_lang('ChatConnectionsDuringLastXDays', ''), '7' ), - $chat_connections_during_last_x_days_by_course + $chat_connections_during_last_x_days_by_course, ); } - echo ''; + echo ''; echo '
'.sprintf( - get_lang('ChatConnectionsDuringLastXDays'), - '7' - ).''.$chat_connections_during_last_x_days_by_course.'
'; + echo sprintf( + get_lang('ChatConnectionsDuringLastXDays'), + '7' + ); + echo ''.$chat_connections_during_last_x_days_by_course.'
'; echo '
'; @@ -352,14 +348,14 @@ if ($showChatReporting) { // Tools tracking. if ($showTrackingReporting) { - echo '
- '.Display::page_subheader( - Display::return_icon( - 'acces_tool.gif', - get_lang('ToolsMostUsed') - ).get_lang('ToolsMostUsed') - ).' - '; + echo '
'; + echo Display::page_subheader( + Display::return_icon( + 'acces_tool.gif', + get_lang('ToolsMostUsed') + ).get_lang('ToolsMostUsed') + ); + echo '
'; $tools_most_used = Tracking::get_tools_most_used_by_course( $course_id, @@ -373,16 +369,14 @@ if ($showTrackingReporting) { if (!empty($tools_most_used)) { foreach ($tools_most_used as $row) { - echo ' + echo ' - - '; + + '; if ($export_csv) { $temp = array( get_lang(ucfirst($row['access_tool']), ''), - $row['count_access_tool'].' '.get_lang('Clicks', '') + $row['count_access_tool'].' '.get_lang('Clicks', ''), ); $csv_content[] = $temp; } @@ -397,23 +391,21 @@ if ($documentReporting) { // Documents tracking. if (!isset($_GET['num']) || empty($_GET['num'])) { $num = 3; - $link = ' - '.get_lang('SeeDetail').''; + $link = ' - '.get_lang('SeeDetail').''; } else { $num = 1000; - $link = ' - '.get_lang('ViewMinus').''; + $link = ' - '.get_lang('ViewMinus').''; } - echo '
- '.Display::page_subheader( - Display::return_icon( - 'documents.gif', - get_lang('DocumentsMostDownloaded') - ).' '.get_lang('DocumentsMostDownloaded').$link - ).' -
'.get_lang(ucfirst($row['access_tool'])).''.$row['count_access_tool'].' '.get_lang( - 'Clicks' - ).'
'.$row['count_access_tool'].' '.get_lang('Clicks').'
'; + echo '
'; + echo Display::page_subheader( + Display::return_icon( + 'documents.gif', + get_lang('DocumentsMostDownloaded') + ).' '.get_lang('DocumentsMostDownloaded').$link + ); + echo '
'; $documents_most_downloaded = Tracking::get_documents_most_downloaded_by_course( $course_code, $session_id, @@ -429,20 +421,20 @@ if ($documentReporting) { if (!empty($documents_most_downloaded)) { foreach ($documents_most_downloaded as $row) { echo ' - - + + '; if ($export_csv) { $temp = array( $row['down_doc_path'], - $row['count_down'].' '.get_lang('Clicks', '') + $row['count_down'].' '.get_lang('Clicks', ''), ); $csv_content[] = $temp; } @@ -455,22 +447,19 @@ if ($documentReporting) { } } echo '
'.Display::url( - $row['down_doc_path'], - api_get_path( - WEB_CODE_PATH - ).'document/show_content.php?file='.$row['down_doc_path'].$course_path_params - ).''.$row['count_down'].' '.get_lang( - 'Clicks' - ).''; + echo Display::url( + $row['down_doc_path'], + api_get_path( + WEB_CODE_PATH + ).'document/show_content.php?file='.$row['down_doc_path'].$course_path_params + ); + echo ''.$row['count_down'].' '.get_lang('Clicks').'
'; - echo '
'; } if ($linkReporting) { - // links tracking - echo '
- '.Display::page_subheader( - Display::return_icon( - 'link.gif', - get_lang('LinksMostClicked') - ).' '.get_lang('LinksMostClicked') - ).' - '; - + echo '
'; + echo Display::page_subheader( + Display::return_icon( + 'link.gif', + get_lang('LinksMostClicked') + ).' '.get_lang('LinksMostClicked') + ); + echo '
'; $links_most_visited = Tracking::get_links_most_visited_by_course( $course_code, $session_id @@ -484,19 +473,16 @@ if ($linkReporting) { if (!empty($links_most_visited)) { foreach ($links_most_visited as $row) { - echo ' - - - '; + echo ''; if ($export_csv) { $temp = array( $row['title'], - $row['count_visits'].' '.get_lang('Clicks', '') + $row['count_visits'].' '.get_lang('Clicks', ''), ); $csv_content[] = $temp; } @@ -515,7 +501,7 @@ if ($linkReporting) { // send the csv file if asked if ($export_csv) { ob_end_clean(); - Export :: arrayToCsv($csv_content, 'reporting_course_tools'); + Export:: arrayToCsv($csv_content, 'reporting_course_tools'); exit; } diff --git a/plugin/jcapture/applet.php b/plugin/jcapture/applet.php index 7f0807f64a..bcde54d987 100755 --- a/plugin/jcapture/applet.php +++ b/plugin/jcapture/applet.php @@ -1,46 +1,42 @@ - +if (!defined('DOKU_INC')) { + define('DOKU_INC', __DIR__.'/../../../'); +} +require_once(DOKU_INC.'inc/init.php'); +require_once(DOKU_INC.'inc/common.php'); +require_once(DOKU_INC.'inc/pageutils.php'); +require_once(DOKU_INC.'inc/auth.php'); +//close sesseion +session_write_close(); +header('Content-Type: text/html; charset=utf-8'); +$hostName = "http".($_SERVER['HTTPS'] ? 's' : null).'://'.$_SERVER['HTTP_HOST']; +$imageFormat = "PNG"; +$cookies; +foreach (array_keys($_COOKIE) as $cookieName) { + $cookies .= bin2hex($cookieName)."=".bin2hex($_COOKIE[$cookieName]).";"; +} - - - - - + + + +
'.Display::url( - $row['title'].' ('.$row['url'].')', - $row['url'] - ).''.$row['count_visits'].' '.get_lang( - 'Clicks' - ).'
'; + echo Display::url( + $row['title'].' ('.$row['url'].')', + $row['url'] + ); + echo ''.$row['count_visits'].' '.get_lang('Clicks').'