Minor - format code + update docs

pull/2487/head
jmontoyaa 8 years ago
parent 1c1c5b08d7
commit 220edcef29
  1. 21
      main/document/slideshow.php
  2. 4
      main/inc/lib/exercise_show_functions.lib.php
  3. 26
      main/inc/lib/thematic.lib.php
  4. 23
      main/lp/aicc.class.php
  5. 48
      plugin/dashboard/block_teacher/block_teacher.class.php

@ -53,7 +53,7 @@ if ($slide_id != 'all') {
}
$total_slides = count($image_files_only);
?>
<script type="text/javascript">
<script>
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
@ -168,7 +168,6 @@ if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizi
$image_tag = array();
$html = '';
if ($slide_id == 'all') {
// Config for make thumbnails
$allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png');
$max_thumbnail_width = 250;
@ -192,7 +191,6 @@ if ($slide_id == 'all') {
// check files and thumbnails
if (is_array($image_files_only)) {
foreach ($image_files_only as $one_image_file) {
$image = $sys_course_path.$_course['path'].'/document'.$folder.$one_image_file;
$image_thumbnail = $directory_thumbnails.'.'.$one_image_file;
@ -205,7 +203,9 @@ if ($slide_id == 'all') {
if (in_array($imagetype, $allowed_thumbnail_types)) {
if (!file_exists($image_thumbnail)) {
//run each once we view thumbnails is too heavy, then need move into !file_exists($image_thumbnail, and only run when haven't the thumbnail
//run each once we view thumbnails is too heavy,
// then need move into !file_exists($image_thumbnail,
// and only run when haven't the thumbnail
$original_image_size = api_getimagesize($image);
switch ($imagetype) {
@ -230,7 +230,9 @@ if ($slide_id == 'all') {
$max_thumbnail_height
);
if ($max_thumbnail_width > $original_image_size['width'] && $max_thumbnail_height > $original_image_size['height']) {
if ($max_thumbnail_width > $original_image_size['width'] &&
$max_thumbnail_height > $original_image_size['height']
) {
$new_thumbnail_size['width'] = $original_image_size['width'];
$new_thumbnail_size['height'] = $original_image_size['height'];
}
@ -288,9 +290,7 @@ if ($slide_id == 'all') {
//clean memory
imagedestroy($crop);
}//end !exist thumbnail
//show thumbnail and link
$one_image_thumbnail_file = '.thumbs/.'.$one_image_file; //get path thumbnail
$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_thumbnail_file : $path.$one_image_thumbnail_file;
$image_tag[] = '<img class="img-gallery" src="download.php?doc_url='.$doc_url.'" border="0" title="'.$one_image_file.'">';
@ -315,7 +315,6 @@ if ($slide_id == 'all') {
$doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file;
$image_tag[] = '<img src="download.php?doc_url='.$doc_url.'" border="0" width="'.$image_width.'" height="'.$image_height.'" title="'.$one_image_file.'">';
}//end allowed image types
}//end if exist file image
}//end foreach
@ -395,8 +394,7 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
// Auto resize
if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') {
?>
<script type="text/javascript">
<script>
var initial_width='<?php echo $width; ?>';
var initial_height='<?php echo $height; ?>';
var height = window.innerHeight -320;
@ -409,11 +407,9 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
start_width=initial_width;
start_height=initial_height;
}
document.write('<img id="image" src="<?php echo 'download.php?doc_url='.$path.'/'.$image_files_only[$slide]; ?>" width="'+start_width+'" height="'+start_height+'" border="0" alt="<?php echo $image_files_only[$slide]; ?>">');
function resizeImage() {
var resize_factor_width = width / initial_width;
var resize_factor_height = height / initial_height;
var delta_width = width - initial_width * resize_factor_height;
@ -500,7 +496,6 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
echo '<li class="text-center">'.$resize_height.'</li>';
echo '</ul>';
}
} else {
Display::display_warning_message(get_lang('FileNotFound'));
}

@ -25,6 +25,7 @@ class ExerciseShowFunctions
* @param int $questionId Question ID
* @param int $resultsDisabled
* @param string $originalStudentAnswer
* @param bool $showTotalScoreAndUserChoices
*
* @return void
*/
@ -576,8 +577,7 @@ class ExerciseShowFunctions
$questionId,
$questionScore = null,
$results_disabled = 0
)
{
) {
$comments = Event::get_comments($exe_id, $questionId);
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {

@ -61,6 +61,7 @@ class Thematic
* @param int Number of users to get
* @param int Column to sort on
* @param string Order (ASC,DESC)
* @return array
* @see SortableTable#get_table_data($from)
*/
public function get_thematic_data($from, $number_of_items, $column, $direction)
@ -481,13 +482,13 @@ class Thematic
return $obj->total_number_of_items;
}
/**
* Get the thematic advances to display on the current page (fill the sortable-table)
* @param int offset of first user to recover
* @param int Number of users to get
* @param int Column to sort on
* @param string Order (ASC,DESC)
* @return array
* @see SortableTable#get_table_data($from)
*/
public static function get_thematic_advance_data($from, $number_of_items, $column, $direction)
@ -501,11 +502,8 @@ class Thematic
$direction = 'ASC';
}
$data = array();
$course_id = api_get_course_int_id();
if (api_is_allowed_to_edit(null, true)) {
$sql = "SELECT id AS col0, start_date AS col1, duration AS col2, content AS col3
FROM $tbl_thematic_advance
WHERE c_id = $course_id AND thematic_id = $thematic_id
@ -592,7 +590,6 @@ class Thematic
foreach ($data as $thematic_id => $thematic_advance_data) {
foreach ($thematic_advance_data as $key => $thematic_advance) {
$session_star = '';
if (api_is_allowed_to_edit(null, true)) {
if ($thematic_advance['session_id'] !=0) {
@ -654,11 +651,6 @@ class Thematic
}
}
$final_return[$thematic_id] = $return;
/*
if ($no_data) {
$return .= '<div><em>'.get_lang('StillDoNotHaveAThematicPlan').'</em></div>';
}
*/
}
return $final_return;
@ -671,7 +663,10 @@ class Thematic
* @param bool $force_session_id Force to have a session id
* @return array $data
*/
public function get_thematic_advance_list($thematic_advance_id = null, $course_code = null, $force_session_id = false
public function get_thematic_advance_list(
$thematic_advance_id = null,
$course_code = null,
$force_session_id = false
) {
$course_info = api_get_course_info($course_code);
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
@ -734,7 +729,6 @@ class Thematic
public function thematic_advance_save()
{
$_course = api_get_course_info();
// definition database table
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
@ -846,7 +840,6 @@ class Thematic
// definition database table
$tbl_thematic_plan = Database::get_course_table(TABLE_THEMATIC_PLAN);
$tbl_thematic = Database::get_course_table(TABLE_THEMATIC);
$course_id = api_get_course_int_id();
$data = array();
@ -967,7 +960,6 @@ class Thematic
if (Database::num_rows($rs) > 0) {
$row_thematic_plan = Database::fetch_array($rs);
$thematic_plan_id = $row_thematic_plan['id'];
$update = false;
if (in_array($thematic_plan_id, $elements_to_show)) {
$update = true;
@ -1128,7 +1120,11 @@ class Thematic
{
$_course = api_get_course_info();
$thematic_data = $this->get_thematic_list(null, api_get_course_id());
$thematic_advance_data = $this->get_thematic_advance_list(null, api_get_course_id(), true);
$thematic_advance_data = $this->get_thematic_advance_list(
null,
api_get_course_id(),
true
);
$tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
$affected_rows = 0;

@ -58,7 +58,9 @@ class aicc extends learnpath
*/
public function open($id)
{
if ($this->debug > 0) { error_log('In aicc::open()', 0); }
if ($this->debug > 0) {
error_log('In aicc::open()', 0);
}
// Redefine parent method.
}
@ -376,9 +378,7 @@ class aicc extends learnpath
}
*/
$zipFile = new PclZip($zip_file_path);
// Check the zip content (real size and file extension).
$zipContentArray = $zipFile->listContent();
$package_type = ''; // The type of the package. Should be 'aicc' after the next few lines.
@ -562,6 +562,7 @@ class aicc extends learnpath
} else {
return '';
}
return $course_sys_dir.$new_dir.$config_dir;
}
@ -758,7 +759,8 @@ class aicc extends learnpath
* Gets the default organisation's title
* @return string The organization's title
*/
function get_title(){
function get_title()
{
if ($this->debug > 0) { error_log('In aicc::get_title() method', 0); }
$title = '';
if (isset($this->config['organizations']['default'])) {
@ -778,7 +780,8 @@ class aicc extends learnpath
* updating the existing table... This will prove very useful in case initial data
* from config files were not imported well enough.
*/
function reimport_aicc() {
function reimport_aicc()
{
if ($this->debug > 0) { error_log('In aicc::reimport_aicc() method', 0); }
//query current items list
//get the identifiers
@ -794,7 +797,8 @@ class aicc extends learnpath
* @param string File path
* @return array Structured array
*/
function parse_ini_file_quotes_safe($f) {
function parse_ini_file_quotes_safe($f)
{
$null = '';
$r = $null;
$sec = $null;
@ -845,7 +849,8 @@ class aicc extends learnpath
* @param array List of names of sections that should be considered as containing only hard string data (no variables), provided in lower case
* @return array Structured array
*/
function parse_ini_string_quotes_safe($s, $pure_strings = array()) {
function parse_ini_string_quotes_safe($s, $pure_strings = array())
{
$null = '';
$r = $null;
$sec = $null;
@ -908,7 +913,8 @@ class aicc extends learnpath
* @param boolean Might one field name happen more than once on the same line? (then split by comma in the values)
* @return array Simple structured array
*/
function parse_csv_file($f, $delim = ',', $enclosure = '"', $multiples = false) {
function parse_csv_file($f, $delim = ',', $enclosure = '"', $multiples = false)
{
$data = @file_get_contents($f);
$data = api_convert_encoding($data, api_get_system_encoding(), $this->config_encoding);
$enclosed = false;
@ -982,6 +988,7 @@ class aicc extends learnpath
}
}
}
return $ret_ret_array;
}
}

@ -1,4 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This file is part of teacher block plugin for dashboard,
* it should be required inside dashboard controller for showing it into dashboard interface from plattform
@ -6,10 +8,6 @@
* @author Christian Fasanando
*/
/**
* required files for getting data
*/
/**
* This class is used like controller for teacher block plugin,
* the class name must be registered inside path.info file
@ -18,7 +16,6 @@
*/
class BlockTeacher extends Block
{
private $user_id;
private $teachers;
private $path;
@ -53,13 +50,14 @@ class BlockTeacher extends Block
}
/**
* This method return content html containing information about teachers and its position for showing it inside dashboard interface
* it's important to use the name 'get_block' for beeing used from dashboard controller
* This method return content html containing information about
* teachers and its position for showing it inside dashboard interface
* it's important to use the name 'get_block' for beeing used from
* dashboard controller
* @return array column and content html
*/
public function get_block()
{
global $charset;
$column = 1;
$data = array();
@ -83,17 +81,16 @@ class BlockTeacher extends Block
$data['content_html'] = $html;
return $data;
}
/**
* This method return a content html, it's used inside get_block method for showing it inside dashboard interface
* This method return a content html, it's used inside get_block method
* for showing it inside dashboard interface
* @return string content html
*/
public function get_teachers_content_html_for_platform_admin()
{
$teachers = $this->teachers;
//$content = '<div style="margin:10px;">';
$content = '<h4>'.get_lang('YourTeachers').'</h4>';
$teachers_table = null;
@ -106,10 +103,8 @@ class BlockTeacher extends Block
<th>'.get_lang('LastConnexion').'</th>
</tr>
';
$i = 1;
foreach ($teachers as $teacher) {
$teacher_id = $teacher['user_id'];
$firstname = $teacher['firstname'];
$lastname = $teacher['lastname'];
@ -118,9 +113,11 @@ class BlockTeacher extends Block
$time_on_platform = api_time_to_hms(Tracking::get_time_spent_on_the_platform($teacher_id));
$last_connection = Tracking::get_last_connection_date($teacher_id);
if ($i%2 == 0) $class_tr = 'row_odd';
else $class_tr = 'row_even';
if ($i % 2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$teachers_table .= '
<tr class="'.$class_tr.'">
<td>'.api_get_person_name($firstname, $lastname).' ('.$username.')</td>
@ -150,7 +147,6 @@ class BlockTeacher extends Block
public function get_teachers_content_html_for_drh()
{
$teachers = $this->teachers;
//$content = '<div style="margin:10px;">';
$content = '<h4>'.get_lang('YourTeachers').'</h4>';
$teachers_table = null;
if (count($teachers) > 0) {
@ -167,15 +163,19 @@ class BlockTeacher extends Block
$i = 1;
foreach ($teachers as $teacher) {
$teacher_id = $teacher['user_id'];
$firstname = $teacher['firstname'];
$lastname = $teacher['lastname'];
$username = $teacher['username'];
$time_on_platform = api_time_to_hms(Tracking::get_time_spent_on_the_platform($teacher_id,true));
$time_on_platform = api_time_to_hms(
Tracking::get_time_spent_on_the_platform($teacher_id, true)
);
if ($i%2 == 0) $class_tr = 'row_odd';
else $class_tr = 'row_even';
if ($i % 2 == 0) {
$class_tr = 'row_odd';
} else {
$class_tr = 'row_even';
}
$teachers_table .= '<tr class="'.$class_tr.'">
<td>'.api_get_person_name($firstname, $lastname).' ('.$username.')</td>
<td align="right">'.$time_on_platform.'</td>
@ -187,14 +187,10 @@ class BlockTeacher extends Block
} else {
$teachers_table .= get_lang('ThereIsNoInformationAboutYourTeachers');
}
$content .= $teachers_table;
if (count($teachers) > 0) {
$content .= '<div style="text-align:right;margin-top:10px;"><a href="'.api_get_path(WEB_CODE_PATH).'mySpace/teachers.php">'.get_lang('SeeMore').'</a></div>';
}
//$content .= '</div>';
return $content;
}
@ -202,7 +198,7 @@ class BlockTeacher extends Block
* Get number of teachers
* @return int
*/
function get_number_of_teachers()
public function get_number_of_teachers()
{
return count($this->teachers);
}

Loading…
Cancel
Save