From c66bad105fceab34be0a584d23d74787b44658f0 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 10:45:55 -0500 Subject: [PATCH 01/15] Bugfix : take into account the quota of the course instead of 1G harcoded value in scorm upload changeset 2b4abcdf7fc3 from Dokeos --- main/newscorm/scorm.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main/newscorm/scorm.class.php b/main/newscorm/scorm.class.php index 0303726d06..b3dc078ecf 100755 --- a/main/newscorm/scorm.class.php +++ b/main/newscorm/scorm.class.php @@ -1,4 +1,6 @@ debug>0){error_log('In scorm::import_package('.print_r($zip_file_info,true).',"'.$current_dir.'") method',0);} - $maxFilledSpace = 1000000000; + require_once(api_get_path(LIBRARY_PATH).'document.lib.php'); + $maxFilledSpace = DocumentManager :: get_course_quota(); + //$maxFilledSpace = 1000000000; + $zip_file_path = $zip_file_info['tmp_name']; $zip_file_name = $zip_file_info['name']; if($this->debug>1){error_log('New LP - import_package() - zip file path = '.$zip_file_path.', zip file name = '.$zip_file_name,0);} From 46de3c488fac1efbcf63cc5bfbeab6605dff8dca Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 11:42:39 -0500 Subject: [PATCH 02/15] Time tracking control bugfixing (changeset 9253 80db44ddea7d, changeset 9249 91ad8a066ba8, changeset 9248 46b5f24dab7e from D okeos) --- main/inc/global.inc.php | 17 ++++++- main/inc/lib/events.lib.inc.php | 35 +++++--------- main/inc/lib/main_api.lib.php | 18 +++++-- main/inc/local.inc.php | 85 +++++++++++++++------------------ 4 files changed, 80 insertions(+), 75 deletions(-) diff --git a/main/inc/global.inc.php b/main/inc/global.inc.php index eeae6c9c69..6b8560fb70 100755 --- a/main/inc/global.inc.php +++ b/main/inc/global.inc.php @@ -513,12 +513,27 @@ if ($_configuration['tracking_enabled'] && !isset($_SESSION['login_as']) && isse // if $_SESSION['login_as'] is set, then the user is an admin logged as the user $tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); - $sql_last_connection = "SELECT login_id, login_date FROM $tbl_track_login WHERE login_user_id='".$_user["user_id"]."' ORDER BY login_date DESC LIMIT 0,1"; $q_last_connection = Database::query($sql_last_connection); if (Database::num_rows($q_last_connection) > 0) { $i_id_last_connection = Database::result($q_last_connection, 0, 'login_id'); + + // is the latest logout_date still relevant? + $sql_logout_date = "SELECT logout_date FROM $tbl_track_login WHERE login_id=$i_id_last_connection"; + $q_logout_date = Database::query($sql_logout_date); + $res_logout_date = convert_mysql_date(Database::result($q_logout_date,0,'logout_date')); + + if ($res_logout_date < time() - $_configuration['session_lifetime']) { + // it isn't, we should create a fresh entry + event_login(); + // now that it's created, we can get its ID and carry on + $q_last_connection = Database::query($sql_last_connection); + $i_id_last_connection = Database::result($q_last_connection, 0, 'login_id'); + } + + + $s_sql_update_logout_date = "UPDATE $tbl_track_login SET logout_date=NOW() WHERE login_id='$i_id_last_connection'"; Database::query($s_sql_update_logout_date); } diff --git a/main/inc/lib/events.lib.inc.php b/main/inc/lib/events.lib.inc.php index 66c4d04f9c..b0b19dfe11 100755 --- a/main/inc/lib/events.lib.inc.php +++ b/main/inc/lib/events.lib.inc.php @@ -91,14 +91,12 @@ function event_login() return 0; } $reallyNow = time(); - $sql = "INSERT INTO ".$TABLETRACK_LOGIN." - (login_user_id, - login_ip, - login_date) - VALUES - ('".$_user['user_id']."', + $sql = "INSERT INTO ".$TABLETRACK_LOGIN." (login_user_id, login_ip, login_date, logout_date) + VALUES ('".$_user['user_id']."', '".Database::escape_string($_SERVER['REMOTE_ADDR'])."', - FROM_UNIXTIME(".$reallyNow."))"; + FROM_UNIXTIME(".$reallyNow."), + FROM_UNIXTIME(".$reallyNow.") + )"; $res = Database::query($sql); } @@ -116,20 +114,11 @@ function event_access_course() global $TABLETRACK_LASTACCESS; //for "what's new" notification // if tracking is disabled record nothing - if (!$_configuration['tracking_enabled']) - { + if (!$_configuration['tracking_enabled']){ return 0; } - - if(api_get_setting('use_session_mode')=='true' && isset($_SESSION['id_session'])) - { - $id_session = intval($_SESSION['id_session']); - } - else - { - $id_session = 0; - } - + $id_session = api_get_session_id(); + $reallyNow = time(); if ($_user['user_id']) { $user_id = "'".$_user['user_id']."'"; @@ -148,12 +137,11 @@ function event_access_course() '".$id_session."')"; $res = Database::query($sql); // added for "what's new" notification - $sql = " UPDATE $TABLETRACK_LASTACCESS + $sql = " UPDATE $TABLETRACK_LASTACCESS SET access_date = FROM_UNIXTIME($reallyNow) WHERE access_user_id = ".$user_id." AND access_cours_code = '".$_cid."' AND access_tool IS NULL AND access_session_id=".$id_session; $res = Database::query($sql); - if (Database::affected_rows() == 0) - { + if (Database::affected_rows() == 0) { $sql = " INSERT INTO $TABLETRACK_LASTACCESS (access_user_id,access_cours_code,access_date, access_session_id) VALUES @@ -209,8 +197,7 @@ function event_access_tool($tool, $id_session=0) // added for "what's new" notification $pos2 = strpos(strtolower($_SERVER['HTTP_REFERER']), strtolower($_configuration['root_web']."index")); // end "what's new" notification - if ($_configuration['tracking_enabled'] && ($pos !== false || $pos2 !== false)) - { + if ($_configuration['tracking_enabled'] && ($pos !== false || $pos2 !== false)) { $sql = "INSERT INTO ".$TABLETRACK_ACCESS." (access_user_id, access_cours_code, diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php index cef5d4d930..6f8e6e754c 100755 --- a/main/inc/lib/main_api.lib.php +++ b/main/inc/lib/main_api.lib.php @@ -1019,7 +1019,8 @@ function api_get_course_info($course_code = null) { function api_session_start($already_installed = true) { global $storeSessionInDb; global $_configuration; - + + /* causes too many problems and is not configurable dynamically if ($already_installed) { $session_lifetime = 360000; if (isset($_configuration['session_lifetime'])) { @@ -1027,7 +1028,8 @@ function api_session_start($already_installed = true) { } //session_set_cookie_params($session_lifetime,api_get_path(REL_PATH)); } - + */ + if (is_null($storeSessionInDb)) { $storeSessionInDb = false; } @@ -1038,15 +1040,23 @@ function api_session_start($already_installed = true) { } session_name('ch_sid'); session_start(); + + if (!isset($_SESSION['starttime'])) { + $_SESSION['starttime'] = time(); + } + if ($already_installed) { if (empty($_SESSION['checkDokeosURL'])) { $_SESSION['checkDokeosURL'] = api_get_path(WEB_PATH); - $_SESSION['session_expiry'] = time() + $session_lifetime; + //$_SESSION['session_expiry'] = time() + $session_lifetime; //useless at the moment } elseif ($_SESSION['checkDokeosURL'] != api_get_path(WEB_PATH)) { api_session_clear(); - $_SESSION['session_expiry'] = time() + $session_lifetime; + //$_SESSION['session_expiry'] = time() + $session_lifetime; } } + if ( isset($_SESSION['starttime']) && $_SESSION['starttime'] < time() - $_configuration['session_lifetime'] ) { + $_SESSION['starttime'] = time(); + } } /** diff --git a/main/inc/local.inc.php b/main/inc/local.inc.php index 9b590b6a49..4f51dcdc78 100755 --- a/main/inc/local.inc.php +++ b/main/inc/local.inc.php @@ -826,52 +826,45 @@ if (isset($cidReset) && $cidReset) { // course session data refresh requested or } if ($_configuration['tracking_enabled'] && !isset($_SESSION['login_as'])) { - $course_tracking_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); - $time = api_get_datetime(); - //We select the last record for the current course in the course tracking table - - $sql="SELECT course_access_id, logout_course_date FROM $course_tracking_table WHERE user_id=".intval($_user ['user_id'])." ORDER BY login_course_date DESC LIMIT 0,1"; - $result=Database::query($sql); - $update_course_access = false; - $i_course_access_id = array(); - $timeout_course_access = 0; - if (Database::num_rows($result)>0) { - $i_course_access_id = Database::fetch_array($result); - // calculate time spent between last logout course date and current date - $timeout_course_access = (time() - strtotime($i_course_access_id['logout_course_date'])); - $update_course_access = true; - } - - if ($update_course_access && $timeout_course_access < 1800) { - // if time spent between last logout course date and current date is less 30 minutes update the logout_course_date - $sql="UPDATE $course_tracking_table - SET logout_course_date = '$time', counter = counter+1 - WHERE course_access_id=".intval($i_course_access_id['course_access_id']); - Database::query($sql); - } else { - $sql="INSERT INTO $course_tracking_table(course_code, user_id, login_course_date, logout_course_date, counter) - VALUES('".$_course['sysCode']."', '".$_user['user_id']."', '$time', '$time', '1')"; - Database::query($sql); - } - - /* - $result=Database::query($sql); - if (Database::num_rows($result)>0 ) { - $i_course_access_id = Database::fetch_array($result); - //We update the course tracking table - $sql="UPDATE $course_tracking_table " . - "SET logout_course_date = '$time', " . - "counter = counter+1 " . - "WHERE course_access_id=".intval($i_course_access_id['course_access_id']); - - Database::query($sql); - } else { - $sql="INSERT INTO $course_tracking_table(course_code, user_id, login_course_date, logout_course_date, counter)" . - "VALUES('".$_course['sysCode']."', '".$_user['user_id']."', '$time', '$time', '1')"; - Database::query($sql); - } - */ - } + + $course_tracking_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); + if (isset($_configuration['session_lifetime'])) { + $session_lifetime=$_configuration['session_lifetime']; + } else { + $session_lifetime=3600; + } + + $course_code=$_course['sysCode']; + $time = api_get_datetime(); + + //We select the last record for the current course in the course tracking table + // But only if the login date is < thant now + max_life_time + + $sql="SELECT course_access_id FROM $course_tracking_table + + WHERE user_id=".intval($_user ['user_id'])." + AND course_code='$course_code' + AND login_course_date > now() - INTERVAL $session_lifetime SECOND + ORDER BY login_course_date DESC LIMIT 0,1"; + $result=Database::query($sql,__FILE__,__LINE__); + + if (Database::num_rows($result)>0) { + + $i_course_access_id = Database::result($result,0,0); + //We update the course tracking table + + $sql="UPDATE $course_tracking_table " . + "SET logout_course_date = '$time', " . + "counter = counter+1 " . + "WHERE course_access_id=".intval($i_course_access_id); + Database::query($sql,__FILE__,__LINE__); + } else { + $sql="INSERT INTO $course_tracking_table + (course_code, user_id, login_course_date, logout_course_date, counter)" . + "VALUES('".$course_code."', '".$_user['user_id']."', '$time', '$time', '1')"; + Database::query($sql,__FILE__,__LINE__); + } + } } } From 5a15c7d8f4d11fe623975f47b1036b23ec94e049 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 11:43:14 -0500 Subject: [PATCH 03/15] fix the bug with huge time stored when browsing learnpaths it changeset 9260 cbd9a443d5b1 from Dokeos --- main/newscorm/learnpathItem.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main/newscorm/learnpathItem.class.php b/main/newscorm/learnpathItem.class.php index f135867546..74ed3dd69e 100755 --- a/main/newscorm/learnpathItem.class.php +++ b/main/newscorm/learnpathItem.class.php @@ -1206,10 +1206,13 @@ function get_terms() } else { - if($this->current_start_time == 0) + /*if($this->current_start_time == 0) { //small exception for start time, to avoid amazing values $this->current_start_time = time(); - } + }*/ + // if we don't init start time here, the time is sometimes calculated from the las start time + $this->current_start_time = time(); + //error_log('New LP - reinit blocked by setting',0); } } From f308c0c5b2aaff9e9f5cd705806a84ae1f3e48aa Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 13:14:02 -0500 Subject: [PATCH 04/15] Adding extended class for the pChart library to use Horizontal bars --- main/inc/lib/pchart/MyHorBar.class.php | 450 +++++++++++++++++++++++++ 1 file changed, 450 insertions(+) create mode 100644 main/inc/lib/pchart/MyHorBar.class.php diff --git a/main/inc/lib/pchart/MyHorBar.class.php b/main/inc/lib/pchart/MyHorBar.class.php new file mode 100644 index 0000000000..fd7742c819 --- /dev/null +++ b/main/inc/lib/pchart/MyHorBar.class.php @@ -0,0 +1,450 @@ +. + Draw methods : + drawHorBarGraph($Data,$DataDescription,$Shadow=TRUE,$Alpha=100) + drawHorScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$RightScale=FALSE) + drawHorGrid($LineWidth,$Mosaic,$R=220,$G=220,$B=220,$Alpha=100) + drawTreshold($Value,$R,$G,$B,$ShowLabel=FALSE,$ShowOnBottom=FALSE,$TickWidth=4,$FreeText=NULL,$Angle=0) +*/ + +class MyHorBar extends pChart + { + + + /* This function draw a bar graph */ + function drawHorBarGraph($Data,$DataDescription,$Shadow=TRUE,$Alpha=100) + { + /* Validate the Data and DataDescription array */ + $this->validateDataDescription("drawBarGraph",$DataDescription); + $this->validateData("drawBarGraph",$Data); + + $GraphID = 0; + $Series = count($DataDescription["Values"]); + $SeriesWidth = $this->DivisionWidth / ($Series+1); + + $SerieYOffset = $this->DivisionWidth / 2 - $SeriesWidth * $Series / 2; + + $XZero = $this->GArea_X1 + ((0-$this->VMin) * $this->DivisionRatio); + if ( $XZero < $this->GArea_X1 ) { $XZero = $this->GArea_X1; } + + $SerieID = 0; + foreach ( $DataDescription["Values"] as $Key2 => $ColName ) + { + $ID = 0; + foreach ( $DataDescription["Description"] as $keyI => $ValueI ) + { if ( $keyI == $ColName ) { $ColorID = $ID; }; $ID++; } + + $YPos = $this->GArea_Y1 + $this->GAreaXOffset + $SerieYOffset + $SeriesWidth * $SerieID; + + $XLast = -1; + foreach ( $Data as $Key => $Values ) + { + if ( isset($Data[$Key][$ColName])) + { + if ( is_numeric($Data[$Key][$ColName]) ) + { + $Value = $Data[$Key][$ColName]; + + $XPos = $this->GArea_X1 + (($Value-$this->VMin) * $this->DivisionRatio); + + /* Save point into the image map if option activated */ + if ( $this->BuildMap ) + { + $this->addToImageMap(min($XZero,$XPos),$YPos+1,max($XZero,$XPos), $YPos+$SeriesWidth-1,$DataDescription["Description"][$ColName],$Data[$Key][$ColName].$DataDescription["Unit"]["Y"],"Bar"); + } + + if ( $Shadow && $Alpha == 100 ) + $this->drawRectangle($XZero,$YPos+1,$XPos,$YPos+$SeriesWidth-1,25,25,25,TRUE,$Alpha); + + $this->drawFilledRectangle($XZero,$YPos+1,$XPos,$YPos+$SeriesWidth-1,$this->Palette[$ColorID]["R"],$this->Palette[$ColorID]["G"],$this->Palette[$ColorID]["B"],TRUE,$Alpha); + } + } + $YPos = $YPos + $this->DivisionWidth; + } + $SerieID++; + } + } + + +/* Compute and draw the scale */ + function drawHorScale($Data,$DataDescription,$ScaleMode,$R,$G,$B,$DrawTicks=TRUE,$Angle=0,$Decimals=1,$WithMargin=FALSE,$SkipLabels=1,$RightScale=FALSE) + { + /* Validate the Data and DataDescription array */ + $this->validateData("drawScale",$Data); + + $C_TextColor =$this->AllocateColor($this->Picture,$R,$G,$B); + + $this->drawLine($this->GArea_X1,$this->GArea_Y1,$this->GArea_X2,$this->GArea_Y1,$R,$G,$B); + $this->drawLine($this->GArea_X1,$this->GArea_Y1,$this->GArea_X1,$this->GArea_Y2,$R,$G,$B); + + if ( $this->VMin == NULL && $this->VMax == NULL) + { + if (isset($DataDescription["Values"][0])) + { + $this->VMin = $Data[0][$DataDescription["Values"][0]]; + $this->VMax = $Data[0][$DataDescription["Values"][0]]; + } + else { $this->VMin = 2147483647; $this->VMax = -2147483647; } + + /* Compute Min and Max values */ + if ( $ScaleMode == SCALE_NORMAL || $ScaleMode == SCALE_START0 ) + { + if ( $ScaleMode == SCALE_START0 ) { $this->VMin = 0; } + + foreach ( $Data as $Key => $Values ) + { + foreach ( $DataDescription["Values"] as $Key2 => $ColName ) + { + if (isset($Data[$Key][$ColName])) + { + $Value = $Data[$Key][$ColName]; + + if ( is_numeric($Value) ) + { + if ( $this->VMax < $Value) { $this->VMax = $Value; } + if ( $this->VMin > $Value) { $this->VMin = $Value; } + } + } + } + } + } + elseif ( $ScaleMode == SCALE_ADDALL || $ScaleMode == SCALE_ADDALLSTART0 ) /* Experimental */ + { + if ( $ScaleMode == SCALE_ADDALLSTART0 ) { $this->VMin = 0; } + + foreach ( $Data as $Key => $Values ) + { + $Sum = 0; + foreach ( $DataDescription["Values"] as $Key2 => $ColName ) + { + if (isset($Data[$Key][$ColName])) + { + $Value = $Data[$Key][$ColName]; + if ( is_numeric($Value) ) + $Sum += $Value; + } + } + if ( $this->VMax < $Sum) { $this->VMax = $Sum; } + if ( $this->VMin > $Sum) { $this->VMin = $Sum; } + } + } + + if ( $this->VMax > preg_replace('/\.[0-9]+/','',$this->VMax) ) + $this->VMax = preg_replace('/\.[0-9]+/','',$this->VMax)+1; + + /* If all values are the same */ + if ( $this->VMax == $this->VMin ) + { + if ( $this->VMax >= 0 ) { $this->VMax++; } + else { $this->VMin--; } + } + + $DataRange = $this->VMax - $this->VMin; + if ( $DataRange == 0 ) { $DataRange = .1; } + + /* Compute automatic scaling */ + $ScaleOk = FALSE; $Factor = 1; + $MinDivHeight = 25; + + $MaxDivs = ($this->GArea_X2 - $this->GArea_X1) / $MinDivHeight; + + if ( $this->VMin == 0 && $this->VMax == 0 ) + { $this->VMin = 0; $this->VMax = 2; $Scale = 1; $Divisions = 2;} + elseif ($MaxDivs > 1) + { + while(!$ScaleOk) + { + $Scale1 = ( $this->VMax - $this->VMin ) / $Factor; + $Scale2 = ( $this->VMax - $this->VMin ) / $Factor / 2; + $Scale4 = ( $this->VMax - $this->VMin ) / $Factor / 4; + + if ( $Scale1 > 1 && $Scale1 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale1); $Scale = 1;} + if ( $Scale2 > 1 && $Scale2 <= $MaxDivs && !$ScaleOk) { $ScaleOk = TRUE; $Divisions = floor($Scale2); $Scale = 2;} + if (!$ScaleOk) + { + if ( $Scale2 > 1 ) { $Factor = $Factor * 10; } + if ( $Scale2 < 1 ) { $Factor = $Factor / 10; } + } + } + + if ( floor($this->VMax / $Scale / $Factor) != $this->VMax / $Scale / $Factor) + { + $GridID = floor ( $this->VMax / $Scale / $Factor) + 1; + $this->VMax = $GridID * $Scale * $Factor; + $Divisions++; + } + + if ( floor($this->VMin / $Scale / $Factor) != $this->VMin / $Scale / $Factor) + { + $GridID = floor( $this->VMin / $Scale / $Factor); + $this->VMin = $GridID * $Scale * $Factor; + $Divisions++; + } + } + else /* Can occurs for small graphs */ + $Scale = 1; + + if ( !isset($Divisions) ) + $Divisions = 2; + + if ($Scale == 1 && $Divisions%2 == 1) + $Divisions--; + } + else + $Divisions = $this->Divisions; + + $this->DivisionCount = $Divisions; + + $DataRange = $this->VMax - $this->VMin; + if ( $DataRange == 0 ) { $DataRange = .1; } + + $this->DivisionHeight = ( $this->GArea_X2 - $this->GArea_X1 ) / $Divisions; + $this->DivisionRatio = ( $this->GArea_X2 - $this->GArea_X1 ) / $DataRange; + + $this->GAreaYOffset = 0; + if ( count($Data) > 1 ) + { + if ( $WithMargin == FALSE ) + $this->DivisionWidth = ( $this->GArea_Y2 - $this->GArea_Y1 ) / (count($Data)-1); + else + { + $this->DivisionWidth = ( $this->GArea_Y2 - $this->GArea_Y1 ) / (count($Data)); + $this->GAreaYOffset = $this->DivisionWidth / 2; + } + } + else + { + $this->DivisionWidth = $this->GArea_Y2 - $this->GArea_Y1; + $this->GAreaYOffset = $this->DivisionWidth / 2; + } + + $this->DataCount = count($Data); + + if ( $DrawTicks == FALSE ) + return(0); + + $XPos = $this->GArea_X1; + $YMin = NULL; + + for($i=1;$i<=$Divisions+1;$i++) + { + $this->drawLine($XPos,$this->GArea_Y1,$XPos,$this->GArea_Y1-5,$R,$G,$B); + + $Value = $this->VMin + ($i-1) * (( $this->VMax - $this->VMin ) / $Divisions); + $Value = round($Value * pow(10,$Decimals)) / pow(10,$Decimals); + if ( $DataDescription["Format"]["Y"] == "number" ) + $Value = $Value.$DataDescription["Unit"]["Y"]; + if ( $DataDescription["Format"]["Y"] == "time" ) + $Value = $this->ToTime($Value); + if ( $DataDescription["Format"]["Y"] == "date" ) + $Value = $this->ToDate($Value); + if ( $DataDescription["Format"]["Y"] == "metric" ) + $Value = $this->ToMetric($Value); + if ( $DataDescription["Format"]["Y"] == "currency" ) + $Value = $this->ToCurrency($Value); + + $Position = imageftbbox($this->FontSize,0,$this->FontName,$Value); + $TextWidth = $Position[2]-$Position[0]; + + imagettftext($this->Picture,$this->FontSize,0,$XPos-($this->FontSize/2),$this->GArea_Y1-10,$C_TextColor,$this->FontName,$Value); + + if ( $YMin > $this->GArea_Y1-10-$TextWidth || $YMin == NULL ) { $YMin = $this->GArea_Y1-10-$TextWidth; } + + $XPos = $XPos + $this->DivisionHeight; + } + + /* Write the Y Axis caption if set */ + if ( isset($DataDescription["Axis"]["Y"]) ) + { + $Position = imageftbbox($this->FontSize,90,$this->FontName,$DataDescription["Axis"]["Y"]); + $TextHeight = abs($Position[1])+abs($Position[3]); + $TextTop = (($this->GArea_X2 - $this->GArea_X1) / 2) + $this->GArea_X1 + ($TextHeight/2); + + imagettftext($this->Picture,$this->FontSize,90,$YMin-$this->FontSize,$TextTop,$C_TextColor,$this->FontName,$DataDescription["Axis"]["Y"]); + } + + /* Horizontal Axis */ + $YPos = $this->GArea_Y1 + $this->GAreaYOffset; + $ID = 1; + $XMax = NULL; + foreach ( $Data as $Key => $Values ) + { + if ( $ID % $SkipLabels == 0 ) + { + + $this->drawLine($this->GArea_X1,floor($YPos),$this->GArea_X1-5,floor($YPos),$R,$G,$B); + $Value = $Data[$Key][$DataDescription["Position"]]; + if ( $DataDescription["Format"]["X"] == "number" ) + $Value = $Value.$DataDescription["Unit"]["X"]; + if ( $DataDescription["Format"]["X"] == "time" ) + $Value = $this->ToTime($Value); + if ( $DataDescription["Format"]["X"] == "date" ) + $Value = $this->ToDate($Value); + if ( $DataDescription["Format"]["X"] == "metric" ) + $Value = $this->ToMetric($Value); + if ( $DataDescription["Format"]["X"] == "currency" ) + $Value = $this->ToCurrency($Value); + + $Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Value); + $TextWidth = abs($Position[2])+abs($Position[0]); + $TextHeight = abs($Position[1])+abs($Position[3]); + + if ( $Angle == 0 ) + { + $XPos = $this->GArea_Y2+18; imagettftext($this->Picture,$this->FontSize,$Angle,$this->GArea_X1-10-floor($TextWidth),floor($YPos)+5-floor($TextHeight/2),$C_TextColor,$this->FontName,$Value); + + } + else + { + $XPos = $this->GArea_Y2+10+$TextHeight; + if ( $Angle <= 90 ) + imagettftext($this->Picture,$this->FontSize,$Angle,$XPos,floor($YPos)-$TextWidth+5,$C_TextColor,$this->FontName,$Value); + else + imagettftext($this->Picture,$this->FontSize,$Angle,$XPos,floor($YPos)+$TextWidth+5,$C_TextColor,$this->FontName,$Value); + } + if ( $XMax < $XPos || $XMax == NULL ) { $XMax = $XPos; } + } + + $YPos = $YPos + $this->DivisionWidth; + $ID++; + } + + /* Write the X Axis caption if set */ + if ( isset($DataDescription["Axis"]["Y"]) ) + { + $Position = imageftbbox($this->FontSize,90,$this->FontName,$DataDescription["Axis"]["Y"]); + $TextWidth = abs($Position[2])+abs($Position[0]); + $TextLeft = (($this->GArea_Y2 - $this->GArea_Y1) / 2) + $this->GArea_Y1 + ($TextWidth/2); + + imagettftext($this->Picture,$this->FontSize,0,$TextLeft,$XMax+$this->FontSize+5,$C_TextColor,$this->FontName,$DataDescription["Axis"]["Y"]); + } + } + + + /* Compute and draw the scale */ + function drawHorGrid($LineWidth,$Mosaic=TRUE,$R=220,$G=220,$B=220,$Alpha=100) + { + /* Draw mosaic */ + if ( $Mosaic ) + { + $LayerWidth = $this->GArea_Y2-$this->GArea_Y1; + $LayerHeight = $this->GArea_X2-$this->GArea_X1; + + $this->Layers[0] = imagecreatetruecolor($LayerWidth,$LayerHeight); + $C_White =$this->AllocateColor($this->Layers[0],255,255,255); + imagefilledrectangle($this->Layers[0],0,0,$LayerWidth,$LayerHeight,$C_White); + imagecolortransparent($this->Layers[0],$C_White); + + $C_Rectangle =$this->AllocateColor($this->Layers[0],250,250,250); + $XPos = $LayerHeight; + $LastX = $XPos; + + for($i=0;$i<=$this->DivisionCount;$i++) + { + $LastX = $XPos; + $XPos = $XPos - $this->DivisionHeight; + + if ( $XPos <= 0 ) { $XPos = 1; } + + if ( $i % 2 == 0 ) + { + imagefilledrectangle($this->Layers[0],$XPos,1,$LastX,$LayerWidth-1,$C_Rectangle); + } + } + imagecopymerge($this->Picture,$this->Layers[0],$this->GArea_X1,$this->GArea_Y1,0,0,$LayerWidth,$LayerHeight,$Alpha); + imagedestroy($this->Layers[0]); + } + + /* Vertical lines */ + $XPos = $this->GArea_X2 - $this->DivisionHeight; + for($i=1;$i<=$this->DivisionCount;$i++) + { + if ( $XPos > $this->GArea_X1 && $XPos < $this->GArea_X2 ) + $this->drawDottedLine($XPos,$this->GArea_Y1,$XPos,$this->GArea_Y2,$LineWidth,$R,$G,$B); + $XPos = $XPos - $this->DivisionHeight; + } + + /* Horizontal lines */ + if ( $this->GAreaYOffset == 0 ) + { $YPos = $this->GArea_Y1 + $this->DivisionWidth + $this->GAreaYOffset; + $ColCount = $this->DataCount-2; } + else + { $YPos = $this->GArea_Y1 + $this->GAreaYOffset; + //$ColCount = floor( ($this->GArea_X2 - $this->GArea_X1) / $this->DivisionWidth ); + $ColCount = $this->DataCount; + } + + for($i=1;$i<=$ColCount;$i++) + { + if ( $YPos > $this->GArea_Y1 && $YPos < $this->GArea_Y2 ) + $this->drawDottedLine($this->GArea_X1,floor($YPos),$this->GArea_X2,floor($YPos),$LineWidth,$R,$G,$B); + + $YPos = $YPos + $this->DivisionWidth; + } + } + + +/* Compute and draw the scale */ + function drawTreshold($Value,$R,$G,$B,$ShowLabel=FALSE,$ShowOnBottom=FALSE,$TickWidth=4,$FreeText=NULL,$Angle=0) + { + if ( $R < 0 ) { $R = 0; } if ( $R > 255 ) { $R = 255; } + if ( $G < 0 ) { $G = 0; } if ( $G > 255 ) { $G = 255; } + if ( $B < 0 ) { $B = 0; } if ( $B > 255 ) { $B = 255; } + + $C_TextColor =$this->AllocateColor($this->Picture,$R,$G,$B); + $X = $this->GArea_X1 + ($Value - $this->VMin) * $this->DivisionRatio; + + if ( $X <= $this->GArea_X1 || $X >= $this->GArea_X2 ) + return(-1); + + if ( $TickWidth == 0 ) + $this->drawLine($X,$this->GArea_Y1,$X,$this->GArea_Y2,$R,$G,$B); + else + $this->drawDottedLine($X,$this->GArea_Y1,$X,$this->GArea_Y2,$TickWidth,$R,$G,$B); + + if ( $ShowLabel ) + { + if ( $FreeText == NULL ) + { $Label = $Value; } else { $Label = $FreeText; } + + $Position = imageftbbox($this->FontSize,$Angle,$this->FontName,$Label); + $TextWidth = abs($Position[2])-abs($Position[0]); + $TextLeft = abs($Position[3])-abs($Position[1]); + + if ( $ShowOnBottom ) + imagettftext($this->Picture,$this->FontSize,$Angle,$X+9,$this->GArea_Y2,$C_TextColor,$this->FontName,$Label); + else + imagettftext($this->Picture,$this->FontSize,$Angle,$X+9,$this->GArea_Y1+$TextLeft,$C_TextColor,$this->FontName,$Label); + } + } + + + } +?> From 9985cb1de6608fdf19865224534fe4d82b741779 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 13:16:42 -0500 Subject: [PATCH 05/15] Minor - cosmetic changes --- main/mySpace/access_details.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/main/mySpace/access_details.php b/main/mySpace/access_details.php index 5181a9625a..3f8e1bc2f9 100755 --- a/main/mySpace/access_details.php +++ b/main/mySpace/access_details.php @@ -1,42 +1,43 @@ +* */ // name of the language file that needs to be included $language_file = array ('registration', 'index', 'tracking'); // including the global Dokeos file -require '../inc/global.inc.php'; +require_once '../inc/global.inc.php'; // including additional libraries require_once api_get_path(LIBRARY_PATH).'pchart/pData.class.php'; require_once api_get_path(LIBRARY_PATH).'pchart/pChart.class.php'; require_once api_get_path(LIBRARY_PATH).'pchart/pCache.class.php'; + require_once 'myspace.lib.php'; // the section (for the tabs) -$this_section = "session_my_space"; +$this_section = SECTION_TRACKING; /* MAIN */ $user_id = intval($_REQUEST['student']); -$course_code = Security::remove_XSS($_REQUEST['course']); $session_id = intval($_GET['id_session']); - +$course_code = Security::remove_XSS($_REQUEST['course']); $connections = MySpace::get_connections_to_course($user_id, $course_code, $session_id); + if (api_is_xml_http_request()) { $type = Security::remove_XSS($_GET['type']); $main_year = $main_month_year = $main_day = array(); From 7c1439e8ea09c1056a4d5b1bb3b969be423cf71b Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 13:20:49 -0500 Subject: [PATCH 06/15] Adding the CourseList link --- main/newscorm/learnpath.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index bf8127b405..ae35beaad9 100755 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -2760,10 +2760,12 @@ class learnpath { if ($this->get_lp_session_id()==api_get_session_id()) { $html .= '
'; if ($display_action_links_with_icons) { + $html .= ''. get_lang('CourseList') . ''; $html .= "" . Display :: return_icon('learnpath_build.gif', get_lang('Build')) . ' ' . get_lang('Build') . ""; $html .= "" . Display :: return_icon('learnpath_organize.gif', get_lang('BasicOverview')) . ' ' . get_lang('BasicOverview') . ""; $html .= '' . Display :: return_icon('learnpath_view_na.gif', get_lang("Display")) . ' ' . get_lang("Display") . ''; } else { + $html .= ''. get_lang('CourseList') . ''; $html .= "" . get_lang('Build') . ""; $html .= "" . get_lang('BasicOverview') . ""; $html .= '' . get_lang('Display') . ''; From 0e17f68bdf76d94b7ac570d4fdd15b7301f57288 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 13:22:04 -0500 Subject: [PATCH 07/15] Adding session id to the \"event_access_course\" function in events.lib --- main/inc/lib/events.lib.inc.php | 50 +++++++++++++++------------------ 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/main/inc/lib/events.lib.inc.php b/main/inc/lib/events.lib.inc.php index b0b19dfe11..49c4d72250 100755 --- a/main/inc/lib/events.lib.inc.php +++ b/main/inc/lib/events.lib.inc.php @@ -143,9 +143,9 @@ function event_access_course() $res = Database::query($sql); if (Database::affected_rows() == 0) { $sql = " INSERT INTO $TABLETRACK_LASTACCESS - (access_user_id,access_cours_code,access_date, access_session_id) - VALUES - (".$user_id.", '".$_cid."', FROM_UNIXTIME($reallyNow), ".$id_session.")"; + (access_user_id,access_cours_code,access_date, access_session_id) + VALUES + (".$user_id.", '".$_cid."', FROM_UNIXTIME($reallyNow), ".$id_session.")"; $res = Database::query($sql); } // end "what's new" notification @@ -177,16 +177,8 @@ function event_access_tool($tool, $id_session=0) global $_configuration; global $_course; global $TABLETRACK_LASTACCESS; //for "what's new" notification - - if(api_get_setting('use_session_mode')=='true' && isset($_SESSION['id_session'])) - { - $id_session = intval($_SESSION['id_session']); - } - else - { - $id_session = 0; - } - + + $id_session = api_get_session_id(); $reallyNow = time(); $user_id = $_user['user_id'] ? "'".$_user['user_id']."'" : "0"; // no one // record information @@ -198,29 +190,33 @@ function event_access_tool($tool, $id_session=0) $pos2 = strpos(strtolower($_SERVER['HTTP_REFERER']), strtolower($_configuration['root_web']."index")); // end "what's new" notification if ($_configuration['tracking_enabled'] && ($pos !== false || $pos2 !== false)) { - $sql = "INSERT INTO ".$TABLETRACK_ACCESS." - (access_user_id, - access_cours_code, - access_tool, - access_date) - VALUES - (".$user_id.",".// Don't add ' ' around value, it's already done. + + $sql = "INSERT INTO ".$TABLETRACK_ACCESS." + (access_user_id, + access_cours_code, + access_tool, + access_date, + access_session_id + ) + VALUES + (".$user_id.",".// Don't add ' ' around value, it's already done. "'".$_cid."' , '".htmlspecialchars($tool, ENT_QUOTES)."', - FROM_UNIXTIME(".$reallyNow."))"; + FROM_UNIXTIME(".$reallyNow."), + '".$id_session."')"; $res = Database::query($sql); } // "what's new" notification - $sql = " UPDATE $TABLETRACK_LASTACCESS - SET access_date = FROM_UNIXTIME($reallyNow) - WHERE access_user_id = ".$user_id." AND access_cours_code = '".$_cid."' AND access_tool = '".htmlspecialchars($tool, ENT_QUOTES)."' AND access_session_id=".$id_session; + $sql = "UPDATE $TABLETRACK_LASTACCESS + SET access_date = FROM_UNIXTIME($reallyNow) + WHERE access_user_id = ".$user_id." AND access_cours_code = '".$_cid."' AND access_tool = '".htmlspecialchars($tool, ENT_QUOTES)."' AND access_session_id=".$id_session; $res = Database::query($sql); if (Database::affected_rows() == 0) { $sql = "INSERT INTO $TABLETRACK_LASTACCESS - (access_user_id,access_cours_code,access_tool, access_date, access_session_id) - VALUES - (".$user_id.", '".$_cid."' , '".htmlspecialchars($tool, ENT_QUOTES)."', FROM_UNIXTIME($reallyNow), $id_session)"; + (access_user_id,access_cours_code,access_tool, access_date, access_session_id) + VALUES + (".$user_id.", '".$_cid."' , '".htmlspecialchars($tool, ENT_QUOTES)."', FROM_UNIXTIME($reallyNow), $id_session)"; $res = Database::query($sql); } return 1; From 55ba1336de7a40da748a90e03cec96902a06179a Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 13:23:13 -0500 Subject: [PATCH 08/15] Saving well the session id --- main/inc/local.inc.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/main/inc/local.inc.php b/main/inc/local.inc.php index 4f51dcdc78..911929b207 100755 --- a/main/inc/local.inc.php +++ b/main/inc/local.inc.php @@ -769,18 +769,8 @@ if (isset($cidReset) && $cidReset) { // course session data refresh requested or api_session_register('_course'); //@TODO real_cid should be cid, for working with numeric course id api_session_register('_real_cid'); - - if ($_configuration['tracking_enabled'] && !isset($_SESSION['login_as'])) { - //We add a new record in the course tracking table - $course_tracking_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); - $time = api_get_datetime(); - $sql="INSERT INTO $course_tracking_table(course_code, user_id, login_course_date, logout_course_date, counter, session_id)" . - "VALUES('".$_course['sysCode']."', '".$_user['user_id']."', '$time', '$time', '1', ".intval($_SESSION['id_session']).")"; - - Database::query($sql); - } - - // if a session id has been given in url, we store the session + + // if a session id has been given in url, we store the session if (api_get_setting('use_session_mode')=='true') { // Database Table Definitions $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); @@ -798,6 +788,16 @@ if (isset($cidReset) && $cidReset) { // course session data refresh requested or api_session_unregister('id_session'); } } + + if ($_configuration['tracking_enabled'] && !isset($_SESSION['login_as'])) { + //We add a new record in the course tracking table + $course_tracking_table = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); + $time = api_get_datetime(); + $sql="INSERT INTO $course_tracking_table(course_code, user_id, login_course_date, logout_course_date, counter, session_id)" . + "VALUES('".$_course['sysCode']."', '".$_user['user_id']."', '$time', '$time', '1', ".api_get_session_id().")"; + Database::query($sql); + } + } else { //exit("WARNING UNDEFINED CID !! "); header('location:'.api_get_path(WEB_PATH)); From 264a8726b363ea5d7ec281320b20c6d581783ca3 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 13:39:22 -0500 Subject: [PATCH 09/15] Improving UI when showing sessions --- user_portal.php | 52 ++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/user_portal.php b/user_portal.php index 896daafbdb..d704ec1f43 100644 --- a/user_portal.php +++ b/user_portal.php @@ -729,21 +729,21 @@ function get_logged_user_course_html($course, $session_id = 0, $class='courses') // Table definitions //$statistic_database = Database::get_statistic_database(); - $main_user_table = Database :: get_main_table(TABLE_MAIN_USER); - $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); - $tbl_session_category = Database :: get_main_table(TABLE_MAIN_SESSION_CATEGORY); - $course_database = $my_course['db']; + $main_user_table = Database :: get_main_table(TABLE_MAIN_USER); + $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); + $tbl_session_category = Database :: get_main_table(TABLE_MAIN_SESSION_CATEGORY); + $course_database = $my_course['db']; $course_tool_table = Database :: get_course_table(TABLE_TOOL_LIST, $course_database); $tool_edit_table = Database :: get_course_table(TABLE_ITEM_PROPERTY, $course_database); $course_group_user_table = Database :: get_course_table(TOOL_USER, $course_database); - $user_id = api_get_user_id(); - $course_system_code = $my_course['k']; - $course_visual_code = $my_course['c']; - $course_title = $my_course['i']; - $course_directory = $my_course['d']; - $course_teacher = $my_course['t']; - $course_teacher_email = isset($my_course['email'])?$my_course['email']:''; + $user_id = api_get_user_id(); + $course_system_code = $my_course['k']; + $course_visual_code = $my_course['c']; + $course_title = $my_course['i']; + $course_directory = $my_course['d']; + $course_teacher = $my_course['t']; + $course_teacher_email = isset($my_course['email'])?$my_course['email']:''; $course_info = Database :: get_course_info($course_system_code); $course_access_settings = CourseManager :: get_access_settings($course_system_code); $course_id = isset($course_info['course_id'])?$course_info['course_id']:null; @@ -950,6 +950,11 @@ function get_logged_user_course_html($course, $session_id = 0, $class='courses') */ function get_session_title_box($session_id) { global $nosession; + + if (api_get_setting('use_session_mode')=='true' && !$nosession) { + global $now, $date_start, $date_end; + } + $output = array(); if (api_get_setting('use_session_mode')=='true' && !$nosession) { $main_user_table = Database :: get_main_table(TABLE_MAIN_USER); @@ -957,18 +962,18 @@ function get_session_title_box($session_id) { $tbl_session_category = Database :: get_main_table(TABLE_MAIN_SESSION_CATEGORY); $active = false; // Request for the name of the general coach - $sql = - 'SELECT tu.lastname, tu.firstname, ts.name, ts.date_start, ts.date_end, ts.session_category_id - FROM '.$tbl_session.' ts - LEFT JOIN '.$main_user_table .' tu - ON ts.id_coach = tu.user_id - WHERE ts.id='.intval($session_id); + $sql ='SELECT tu.lastname, tu.firstname, ts.name, ts.date_start, ts.date_end, ts.session_category_id + FROM '.$tbl_session.' ts + LEFT JOIN '.$main_user_table .' tu + ON ts.id_coach = tu.user_id + WHERE ts.id='.intval($session_id); $rs = Database::query($sql); $session_info = Database::store_result($rs); $session_info = $session_info[0]; $session = array(); $session['title'] = $session_info[2]; $session['coach'] = ''; + if ( $session_info[3]=='0000-00-00' ) { $session['dates'] = get_lang('WithoutTimeLimits'); if ( api_get_setting('show_session_coach') === 'true' ) { @@ -1332,9 +1337,16 @@ if ( is_array($courses_tree) ) { if ($count_courses_session > 0) { echo '
    '; echo '
  • '; - echo Display::return_icon('div_hide.gif', get_lang('Expand').'/'.get_lang('Hide'), array('align' => 'absmiddle', 'id' => 'session_img_'.$session['details']['id'])) . ' '; + echo Display::return_icon('div_hide.gif', get_lang('Expand').'/'.get_lang('Hide'), array('align' => 'absmiddle', 'id' => 'session_img_'.$session['details']['id'])) . ' '; $s = get_session_title_box($session['details']['id']); - echo get_lang('SessionName') . ': ' . $s['title']. ' - '.(!empty($s['coach'])?$s['coach'].' - ':'').$s['dates']; + //var_dump($s); + //echo get_lang('SessionName') . ': ' . $s['title']. ' - '.(!empty($s['coach'])?$s['coach'].' - ':'').$s['dates']; + echo '' . $s['title']. ' '; + if (api_is_platform_admin()) { + echo ''.Display::return_icon('edit.gif', get_lang('Edit'), array('align' => 'absmiddle')).''; + } + + echo '
    '.(!empty($s['coach'])?$s['coach'].' | ':'').$s['dates']; echo '
  • '; echo $html_courses_session; echo '
'; @@ -1375,7 +1387,7 @@ if ( is_array($courses_tree) ) { $html_sessions .= '
    '; $html_sessions .= '
  • '; $html_sessions .= Display::return_icon('div_hide.gif', get_lang('Expand').'/'.get_lang('Hide'), array('align' => 'absmiddle', 'id' => 'session_img_'.$session['details']['id'])) . ' '; - $html_sessions .= get_lang('SessionName') . ': ' . $s['title']. ' - '.(!empty($s['coach'])?$s['coach'].' - ':'').$s['dates']; + $html_sessions .= get_lang('SessionName') . ': ' . $s['title']. ' | '.(!empty($s['coach'])?$s['coach'].' - ':'').$s['dates']; $html_sessions .= '
  • '; $html_sessions .= $html_courses_session; $html_sessions .= '
'; From ced5a95afc8545ee60019699b911a0332b2f2237 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 14:01:44 -0500 Subject: [PATCH 10/15] Setting to false the \"display_coursecode_in_courselist\" variable in order to have a cleaner UI in user_portal.php --- main/install/db_main.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/install/db_main.sql b/main/install/db_main.sql index 4b3da1fc2a..61408f79d0 100644 --- a/main/install/db_main.sql +++ b/main/install/db_main.sql @@ -612,7 +612,7 @@ VALUES ('course_create_active_tools','online_conference','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'OnlineConference', 0), ('course_create_active_tools','student_publications','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'StudentPublications', 0), ('allow_personal_agenda',NULL,'radio','User','false','AllowPersonalAgendaTitle','AllowPersonalAgendaComment',NULL,NULL, 0), -('display_coursecode_in_courselist',NULL,'radio','Platform','true','DisplayCourseCodeInCourselistTitle','DisplayCourseCodeInCourselistComment',NULL,NULL, 0), +('display_coursecode_in_courselist',NULL,'radio','Platform','false','DisplayCourseCodeInCourselistTitle','DisplayCourseCodeInCourselistComment',NULL,NULL, 0), ('display_teacher_in_courselist',NULL,'radio','Platform','true','DisplayTeacherInCourselistTitle','DisplayTeacherInCourselistComment',NULL,NULL, 0), ('use_document_title',NULL,'radio','Tools','true','UseDocumentTitleTitle','UseDocumentTitleComment',NULL,NULL, 0), ('permanently_remove_deleted_files',NULL,'radio','Tools','false','PermanentlyRemoveFilesTitle','PermanentlyRemoveFilesComment',NULL,NULL, 0), From 6ef5ebee5594c20b9d0f6eb2d5372a95bb2af3d9 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 14:03:20 -0500 Subject: [PATCH 11/15] Update --- documentation/changelog.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/documentation/changelog.html b/documentation/changelog.html index c37b5bfe28..b572b05bcf 100755 --- a/documentation/changelog.html +++ b/documentation/changelog.html @@ -31,6 +31,8 @@
  • Upgraded PHPMailer library to version 5.1 (Feature #272)
  • Exercise tool: Copy exercise feature added
  • Exercise tool: Teachers can delete students results of an exercise (NOT LP results)
  • +
  • pChart Horizontal bars library added
  • + From e0a01d83ddacae9a17be09fae03f21fe38f93b46 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 14:06:31 -0500 Subject: [PATCH 12/15] Improving UI when showing sessions --- user_portal.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/user_portal.php b/user_portal.php index d704ec1f43..bc78d18c9b 100644 --- a/user_portal.php +++ b/user_portal.php @@ -818,12 +818,11 @@ function get_logged_user_course_html($course, $session_id = 0, $class='courses') if (api_get_setting('display_coursecode_in_courselist') == 'true' || api_get_setting('display_teacher_in_courselist') == 'true') { $result .= '
    '; } + if (api_get_setting('display_coursecode_in_courselist') == 'true') { $result .= $course_display_code; - } - if (api_get_setting('display_coursecode_in_courselist') == 'true' && api_get_setting('display_teacher_in_courselist') == 'true') { - $result .= ' – '; - } + } + if (api_get_setting('display_teacher_in_courselist') == 'true') { if (api_get_setting('use_session_mode')=='true' && !$nosession) { $coachs_course = api_get_coachs_from_course($my_course['id_session'],$course['code']); @@ -839,7 +838,12 @@ function get_logged_user_course_html($course, $session_id = 0, $class='courses') } if (($s_course_status == 5 && !empty($my_course['id_session'])) || ($is_coach && $s_course_status != 1)) { - $result .= get_lang('Coachs').': '.implode(', ',$course_coachs); + if (is_array($course_coachs) && count($course_coachs)> 0 ) { + if (api_get_setting('display_coursecode_in_courselist') == 'true' && api_get_setting('display_teacher_in_courselist') == 'true') { + $result .= ' – '; + } + $result .= get_lang('Coachs').': '.implode(', ',$course_coachs); + } } From e0b63d8a0e609bf92e7b8d7011025b0f2bbba506 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 15:03:56 -0500 Subject: [PATCH 13/15] Update --- documentation/changelog.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/changelog.html b/documentation/changelog.html index b572b05bcf..d5481cae46 100755 --- a/documentation/changelog.html +++ b/documentation/changelog.html @@ -31,7 +31,7 @@
  • Upgraded PHPMailer library to version 5.1 (Feature #272)
  • Exercise tool: Copy exercise feature added
  • Exercise tool: Teachers can delete students results of an exercise (NOT LP results)
  • -
  • pChart Horizontal bars library added
  • +
  • pChart Horizontal bars library added thanks to gferri see (Feature #790)
  • From 8c5fd4e9cb16923cd6833f066d06c46579218147 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 15:05:33 -0500 Subject: [PATCH 14/15] Improving UI when showing sessions (partial) still in construction --- user_portal.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/user_portal.php b/user_portal.php index bc78d18c9b..d679bc4e2f 100644 --- a/user_portal.php +++ b/user_portal.php @@ -1391,7 +1391,13 @@ if ( is_array($courses_tree) ) { $html_sessions .= '
      '; $html_sessions .= '
    • '; $html_sessions .= Display::return_icon('div_hide.gif', get_lang('Expand').'/'.get_lang('Hide'), array('align' => 'absmiddle', 'id' => 'session_img_'.$session['details']['id'])) . ' '; - $html_sessions .= get_lang('SessionName') . ': ' . $s['title']. ' | '.(!empty($s['coach'])?$s['coach'].' - ':'').$s['dates']; + + $html_sessions .= '' . $s['title']. ' '; + if (api_is_platform_admin()) { + $html_sessions .= ''.Display::return_icon('edit.gif', get_lang('Edit'), array('align' => 'absmiddle')).''; + } + + $html_sessions .= '
      '.(!empty($s['coach'])?$s['coach'].' - ':'').$s['dates']; $html_sessions .= '
    • '; $html_sessions .= $html_courses_session; $html_sessions .= '
    '; @@ -1400,7 +1406,14 @@ if ( is_array($courses_tree) ) { if ($count_courses_session > 0) { echo '
    '; - echo '
    '. Display::return_icon('div_hide.gif', get_lang('Expand').'/'.get_lang('Hide'), array('align' => 'absmiddle', 'id' => 'category_img_'.$category['details']['id'])) . ' ' . get_lang('SessionCategory') . ': ' . $category['details']['name'].' - '.get_lang('From').' '.$category['details']['date_start'].' '.get_lang('Until').' '.$category['details']['date_end'].'
    '; + echo '
    '; + echo Display::return_icon('div_hide.gif', get_lang('Expand').'/'.get_lang('Hide'), array('align' => 'absmiddle', 'id' => 'category_img_'.$category['details']['id'])); + + echo Display::return_icon('folder_document.gif', get_lang('algo')); + echo ''; + echo $category['details']['name']; + echo ''; + echo '
    '.get_lang('From').' '.$category['details']['date_start'].' '.get_lang('Until').' '.$category['details']['date_end'].'
    '; echo $html_sessions; echo '
    '; } From 20a33a561017f1b9c19d590ffb510a7772d415e6 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 11 Mar 2010 15:05:52 -0500 Subject: [PATCH 15/15] Update --- main/css/chamilo/default.css | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/main/css/chamilo/default.css b/main/css/chamilo/default.css index 31dee1d083..01727b8586 100644 --- a/main/css/chamilo/default.css +++ b/main/css/chamilo/default.css @@ -4024,3 +4024,20 @@ div.attendance-calendar-add div.row div.formw,div.attendance-calendar-edit div.r #columns ul, #columns ol {margin:0; padding:0; list-style:none; border:none;} + + +/* To add in 1.8.7*/ + +.session_box_title span { + font-size: 130%; + font-weight: bold; +} + +#session_category_title { + font-size: 140%; + font-weight: bold; + padding: 2px 0px 5px 5px; + +} + +/* */ \ No newline at end of file