Minor - format code

pull/2487/head
jmontoyaa 7 years ago
parent 2ca2d64415
commit 05a3c9cff3
  1. 68
      main/lp/openoffice_text.class.php
  2. 218
      main/tracking/course_log_tools.php
  3. 68
      plugin/jcapture/applet.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('<BODY', $content);
@ -93,19 +101,19 @@ class OpenofficeText extends OpenofficeDocument
switch ($this->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)
{

@ -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 '<div class="report_section">
'.Display::page_subheader(
Display::return_icon(
'scorms.gif',
get_lang('AverageProgressInLearnpath')
).get_lang('AverageProgressInLearnpath')
).'
<table class="data_table">';
echo '<div class="report_section">';
echo Display::page_subheader(
Display::return_icon(
'scorms.gif',
get_lang('AverageProgressInLearnpath')
).get_lang('AverageProgressInLearnpath')
);
echo '<table class="data_table">';
if ($export_csv) {
$temp = array(get_lang('AverageProgressInLearnpath', ''), '');
$csv_content[] = array('', '');
@ -204,19 +206,16 @@ if ($lpReporting) {
}
if ($exerciseReporting) {
// Exercices tracking.
echo '<div class="report_section">
'.Display::page_subheader(
Display::return_icon(
'quiz.png',
get_lang('AverageResultsToTheExercices')
).get_lang('AverageResultsToTheExercices')
).'
<table class="data_table">';
echo '<div class="report_section">';
echo Display::page_subheader(
Display::return_icon(
'quiz.png',
get_lang('AverageResultsToTheExercices')
).get_lang('AverageResultsToTheExercices')
);
echo '<table class="data_table">';
$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 '<tr><td>'.Display::url(
$quiz['title'],
$url
).'</td><td align="right">'.$quiz_avg_score.'</td></tr>';
$url = api_get_path(WEB_CODE_PATH).'exercise/overview.php?exerciseId='.$quiz['id'].$course_path_params;
echo '<tr><td>';
echo Display::url(
$quiz['title'],
$url
);
echo '</td><td align="right">'.$quiz_avg_score.'</td></tr>';
if ($export_csv) {
$temp = array($quiz['title'], $quiz_avg_score);
$csv_content[] = $temp;
@ -267,13 +264,11 @@ if ($exerciseReporting) {
$csv_content[] = $temp;
}
}
echo '</table></div>';
echo '<div class="clear"></div>';
}
$filterByUsers = array();
if (!empty($groupId)) {
$filterByUsers = $student_ids;
}
@ -304,15 +299,13 @@ if ($export_csv) {
}
// Forums tracking.
echo '<div class="report_section">
'.Display::page_subheader(
Display::return_icon('forum.gif', get_lang('Forum')).
get_lang('Forum').'&nbsp;-&nbsp;<a href="../forum/index.php?'.api_get_cidreq().'">'.
get_lang('SeeDetail').'</a>'
).
'<table class="data_table">';
echo '<div class="report_section">';
echo Display::page_subheader(
Display::return_icon('forum.gif', get_lang('Forum')).
get_lang('Forum').'&nbsp;-&nbsp;<a href="../forum/index.php?'.api_get_cidreq().'">'.
get_lang('SeeDetail').'</a>'
);
echo '<table class="data_table">';
echo '<tr><td>'.get_lang('ForumForumsNumber').'</td><td align="right">'.$count_number_of_forums_by_course.'</td></tr>';
echo '<tr><td>'.get_lang('ForumThreadsNumber').'</td><td align="right">'.$count_number_of_threads_by_course.'</td></tr>';
echo '<tr><td>'.get_lang('ForumPostsNumber').'</td><td align="right">'.$count_number_of_posts_by_course.'</td></tr>';
@ -321,11 +314,12 @@ echo '<div class="clear"></div>';
// Chat tracking.
if ($showChatReporting) {
echo '<div class="report_section">
'.Display::page_subheader(
Display::return_icon('chat.gif', get_lang('Chat')).get_lang('Chat')
).'
<table class="data_table">';
echo '<div class="report_section">';
echo Display::page_subheader(
Display::return_icon('chat.gif', get_lang('Chat')).get_lang('Chat')
);
echo '<table class="data_table">';
$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 '<tr><td>'.sprintf(
get_lang('ChatConnectionsDuringLastXDays'),
'7'
).'</td><td align="right">'.$chat_connections_during_last_x_days_by_course.'</td></tr>';
echo '<tr><td>';
echo sprintf(
get_lang('ChatConnectionsDuringLastXDays'),
'7'
);
echo '</td><td align="right">'.$chat_connections_during_last_x_days_by_course.'</td></tr>';
echo '</table></div>';
echo '<div class="clear"></div>';
@ -352,14 +348,14 @@ if ($showChatReporting) {
// Tools tracking.
if ($showTrackingReporting) {
echo '<div class="report_section">
'.Display::page_subheader(
Display::return_icon(
'acces_tool.gif',
get_lang('ToolsMostUsed')
).get_lang('ToolsMostUsed')
).'
<table class="data_table">';
echo '<div class="report_section">';
echo Display::page_subheader(
Display::return_icon(
'acces_tool.gif',
get_lang('ToolsMostUsed')
).get_lang('ToolsMostUsed')
);
echo '<table class="data_table">';
$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 ' <tr>
echo '<tr>
<td>'.get_lang(ucfirst($row['access_tool'])).'</td>
<td align="right">'.$row['count_access_tool'].' '.get_lang(
'Clicks'
).'</td>
</tr>';
<td align="right">'.$row['count_access_tool'].' '.get_lang('Clicks').'</td>
</tr>';
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 = '&nbsp;-&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq(
).'&num=1#documents_tracking">'.get_lang('SeeDetail').'</a>';
$link = '&nbsp;-&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&num=1#documents_tracking">'.get_lang('SeeDetail').'</a>';
} else {
$num = 1000;
$link = '&nbsp;-&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq(
).'&num=0#documents_tracking">'.get_lang('ViewMinus').'</a>';
$link = '&nbsp;-&nbsp;<a href="'.api_get_self().'?'.api_get_cidreq().'&num=0#documents_tracking">'.get_lang('ViewMinus').'</a>';
}
echo '<a name="documents_tracking" id="a"></a><div class="report_section">
'.Display::page_subheader(
Display::return_icon(
'documents.gif',
get_lang('DocumentsMostDownloaded')
).'&nbsp;'.get_lang('DocumentsMostDownloaded').$link
).'
<table class="data_table">';
echo '<a name="documents_tracking" id="a"></a><div class="report_section">';
echo Display::page_subheader(
Display::return_icon(
'documents.gif',
get_lang('DocumentsMostDownloaded')
).'&nbsp;'.get_lang('DocumentsMostDownloaded').$link
);
echo '<table class="data_table">';
$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 '<tr>
<td>'.Display::url(
$row['down_doc_path'],
api_get_path(
WEB_CODE_PATH
).'document/show_content.php?file='.$row['down_doc_path'].$course_path_params
).'</td>
<td align="right">'.$row['count_down'].' '.get_lang(
'Clicks'
).'</td>
<td>';
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 '</td>
<td align="right">'.$row['count_down'].' '.get_lang('Clicks').'</td>
</tr>';
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 '</table></div>';
echo '<div class="clear"></div>';
}
if ($linkReporting) {
// links tracking
echo '<div class="report_section">
'.Display::page_subheader(
Display::return_icon(
'link.gif',
get_lang('LinksMostClicked')
).'&nbsp;'.get_lang('LinksMostClicked')
).'
<table class="data_table">';
echo '<div class="report_section">';
echo Display::page_subheader(
Display::return_icon(
'link.gif',
get_lang('LinksMostClicked')
).'&nbsp;'.get_lang('LinksMostClicked')
);
echo '<table class="data_table">';
$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 ' <tr>
<td>'.Display::url(
$row['title'].' ('.$row['url'].')',
$row['url']
).'</td>
<td align="right">'.$row['count_visits'].' '.get_lang(
'Clicks'
).'</td>
</tr>';
echo '<tr><td>';
echo Display::url(
$row['title'].' ('.$row['url'].')',
$row['url']
);
echo '</td><td align="right">'.$row['count_visits'].' '.get_lang('Clicks').'</td></tr>';
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;
}

@ -1,46 +1,42 @@
<?php
<?php
//fix for Opera XMLHttpRequests
if (!count($_POST) && $HTTP_RAW_POST_DATA) {
parse_str($HTTP_RAW_POST_DATA, $_POST);
}
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";
//fix for Opera XMLHttpRequests
if (!count($_POST) && $HTTP_RAW_POST_DATA) {
parse_str($HTTP_RAW_POST_DATA, $_POST);
}
$cookies;
foreach (array_keys($_COOKIE) as $cookieName) {
$cookies .= bin2hex($cookieName)."=".bin2hex($_COOKIE[$cookieName]).";";
}
$pageName = $_GET["pageName"];
$edid = $_GET["edid"];
?>
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]).";";
}
<script language="JavaScript" type="text/javascript"><!--
$pageName = $_GET["pageName"];
$edid = $_GET["edid"];
?>
<script language="JavaScript" type="text/javascript">
var _info = navigator.userAgent;
var _ns = false;
var _ns6 = false;
var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
//--></script>
<comment>
<script language="JavaScript" type="text/javascript"><!--
var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0)));
var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
//--></script>
</comment>
</script>
<comment>
<script language="JavaScript" type="text/javascript">
var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0) || (_info.indexOf("AIX") > 0) || (_info.indexOf("OS/2") > 0) || (_info.indexOf("IRIX") > 0)));
var _ns6 = ((_ns == true) && (_info.indexOf("Mozilla/5") >= 0));
</script>
</comment>
<script language="JavaScript" type="text/javascript"><!--
if (_ie == true) document.writeln('<object classid="clsid:CAFEEFAC-0017-0000-0020-ABCDEFFEDCBA" NAME = "jCapture" WIDTH = "1" HEIGHT = "1" codebase="http://java.sun.com/update/1.7.0/jinstall-1_7_0-windows-i586.cab#Version=7,0,0,0"><xmp>');
else if (_ns == true && _ns6 == false) document.writeln('<embed ' +

Loading…
Cancel
Save