Minor - format code + update docs

pull/2487/head
jmontoyaa 8 years ago
parent 1c1c5b08d7
commit 220edcef29
  1. 627
      main/document/slideshow.php
  2. 586
      main/gradebook/lib/be/surveylink.class.php
  3. 234
      main/inc/lib/exercise_show_functions.lib.php
  4. 46
      main/inc/lib/thematic.lib.php
  5. 45
      main/lp/aicc.class.php
  6. 292
      plugin/dashboard/block_teacher/block_teacher.class.php

@ -15,15 +15,15 @@ $pathurl = urlencode($path);
$slide_id = isset($_GET['slide_id']) ? Security::remove_XSS($_GET['slide_id']) : null;
if (empty($slide_id)) {
$edit_slide_id = 1;
$edit_slide_id = 1;
} else {
$edit_slide_id = $slide_id;
$edit_slide_id = $slide_id;
}
if ($path != '/') {
$folder = $path.'/';
$folder = $path.'/';
} else {
$folder = '/';
$folder = '/';
}
$sys_course_path = api_get_path(SYS_COURSE_PATH);
@ -41,19 +41,19 @@ Display :: display_header($originaltoolname, 'Doc');
// Loading the slides from the session
if (isset($_SESSION['image_files_only'])) {
$image_files_only = $_SESSION['image_files_only'];
$image_files_only = $_SESSION['image_files_only'];
}
// Calculating the current slide, next slide, previous slide and the number of slides
$slide = null;
if ($slide_id != 'all') {
$slide = $slide_id ? $slide_id : 0;
$previous_slide = $slide - 1;
$next_slide = $slide + 1;
$slide = $slide_id ? $slide_id : 0;
$previous_slide = $slide - 1;
$next_slide = $slide + 1;
}
$total_slides = count($image_files_only);
?>
<script type="text/javascript">
<script>
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
@ -62,62 +62,62 @@ function MM_openBrWindow(theURL,winName,features) { //v2.0
<?php
if ($slide_id != 'all') {
$image = null;
if (isset($image_files_only[$slide])) {
$image = $sys_course_path.$_course['path'].'/document'.$folder.$image_files_only[$slide];
}
if (file_exists($image)) {
echo '<div class="actions-pagination">';
// Back forward buttons
if ($slide == 0) {
$imgp = 'action_prev_na.png';
$first = Display::return_icon('action_first_na.png');
} else {
$imgp = 'action_prev.png';
$first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'">
'.Display::return_icon('action_first.png', get_lang('FirstSlide')).'
</a>';
}
// First slide
echo $first;
// Previous slide
if ($slide > 0) {
echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">';
}
$image = null;
if (isset($image_files_only[$slide])) {
$image = $sys_course_path.$_course['path'].'/document'.$folder.$image_files_only[$slide];
}
if (file_exists($image)) {
echo '<div class="actions-pagination">';
// Back forward buttons
if ($slide == 0) {
$imgp = 'action_prev_na.png';
$first = Display::return_icon('action_first_na.png');
} else {
$imgp = 'action_prev.png';
$first = '<a href="slideshow.php?slide_id=0&curdirpath='.$pathurl.'">
'.Display::return_icon('action_first.png', get_lang('FirstSlide')).'
</a>';
}
// First slide
echo $first;
// Previous slide
if ($slide > 0) {
echo '<a href="slideshow.php?slide_id='.$previous_slide.'&curdirpath='.$pathurl.'">';
}
echo Display::return_icon($imgp, get_lang('Previous'));
if ($slide > 0) {
echo '</a>';
}
// Divider
echo ' [ '.$next_slide.'/'.$total_slides.' ] ';
// Next slide
if ($slide < $total_slides - 1) {
echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">';
}
if ($slide == $total_slides - 1) {
$imgn = 'action_next_na.png';
if ($slide > 0) {
echo '</a>';
}
// Divider
echo ' [ '.$next_slide.'/'.$total_slides.' ] ';
// Next slide
if ($slide < $total_slides - 1) {
echo '<a href="slideshow.php?slide_id='.$next_slide.'&curdirpath='.$pathurl.'">';
}
if ($slide == $total_slides - 1) {
$imgn = 'action_next_na.png';
$last = Display::return_icon('action_last_na.png', get_lang('LastSlide'));
} else {
$imgn = 'action_next.png';
$last = '<a href="slideshow.php?slide_id='.($total_slides - 1).'&curdirpath='.$pathurl.'">
'.Display::return_icon('action_last.png', get_lang('LastSlide')).'
} else {
$imgn = 'action_next.png';
$last = '<a href="slideshow.php?slide_id='.($total_slides - 1).'&curdirpath='.$pathurl.'">
'.Display::return_icon('action_last.png', get_lang('LastSlide')).'
</a>';
}
}
echo Display::return_icon($imgn, get_lang('Next'));
if ($slide > 0) {
echo '</a>';
}
// Last slide
echo $last;
echo '</div>';
}
if ($slide > 0) {
echo '</a>';
}
// Last slide
echo $last;
echo '</div>';
}
}
// Exit the slideshow
@ -126,10 +126,10 @@ echo '<a href="document.php?action=exit_slideshow&curdirpath='.$pathurl.'&'.api_
// Show thumbnails
if ($slide_id != 'all') {
echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
echo '<a href="slideshow.php?slide_id=all&curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
Display::return_icon('thumbnails.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM).'</a>';
} else {
echo Display::return_icon('thumbnails_na.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM);
echo Display::return_icon('thumbnails_na.png', get_lang('ShowThumbnails'), '', ICON_SIZE_MEDIUM);
}
// Slideshow options
echo '<a href="slideshowoptions.php?curdirpath='.$pathurl.'&'.api_get_cidreq().'">'.
@ -142,24 +142,24 @@ echo '<br />';
// If we come from slideshowoptions.php we sessionize (new word !!! ;-) the options
if (isset($_POST['Submit'])) {
// We come from slideshowoptions.php
//$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']);
$_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']);
if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') {
//echo "resizing";
$_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']);
$_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']);
} else {
//echo "unsetting the session heighte and width";
$_SESSION["image_resizing_width"] = null;
$_SESSION["image_resizing_height"] = null;
}
// We come from slideshowoptions.php
//$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']);
$_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']);
if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') {
//echo "resizing";
$_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']);
$_SESSION["image_resizing_height"] = Security::remove_XSS($_POST['height']);
} else {
//echo "unsetting the session heighte and width";
$_SESSION["image_resizing_width"] = null;
$_SESSION["image_resizing_height"] = null;
}
}
$target_width = $target_height = null;
// The target height and width depends if we choose resizing or no resizing
if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizing") {
$target_width = $_SESSION["image_resizing_width"];
$target_height = $_SESSION["image_resizing_height"];
$target_width = $_SESSION["image_resizing_width"];
$target_height = $_SESSION["image_resizing_height"];
}
/* THUMBNAIL VIEW */
@ -168,60 +168,60 @@ if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == "resizi
$image_tag = array();
$html = '';
if ($slide_id == 'all') {
// Config for make thumbnails
// Config for make thumbnails
$allowed_thumbnail_types = array('jpg', 'jpeg', 'gif', 'png');
$max_thumbnail_width = 250;
$max_thumbnail_height = 250;
$png_compression = 0; //0(none)-9
$jpg_quality = 75; //from 0 to 100 (default is 75). More quality less compression
$max_thumbnail_width = 250;
$max_thumbnail_height = 250;
$png_compression = 0; //0(none)-9
$jpg_quality = 75; //from 0 to 100 (default is 75). More quality less compression
$directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/';
$directory_thumbnails = $sys_course_path.$_course['path'].'/document'.$folder.'.thumbs/';
//Other parameters only for show tumbnails
$row_items = 4; //only in slideshow.php
$number_image = 7; //num icons cols to show
$thumbnail_width_frame = $max_thumbnail_width; //optional $max_thumbnail_width+x
$thumbnail_height_frame = $max_thumbnail_height;
//Other parameters only for show tumbnails
$row_items = 4; //only in slideshow.php
$number_image = 7; //num icons cols to show
$thumbnail_width_frame = $max_thumbnail_width; //optional $max_thumbnail_width+x
$thumbnail_height_frame = $max_thumbnail_height;
// Create the template_thumbnails folder (if no exist)
// Create the template_thumbnails folder (if no exist)
if (!file_exists($directory_thumbnails)) {
@mkdir($directory_thumbnails, api_get_permissions_for_new_directories());
if (!file_exists($directory_thumbnails)) {
@mkdir($directory_thumbnails, api_get_permissions_for_new_directories());
}
// 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;
// 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;
if (file_exists($image)) {
//check thumbnail
$imagetype = explode(".", $image);
if (file_exists($image)) {
//check thumbnail
$imagetype = explode(".", $image);
//or check $imagetype = image_type_to_extension(exif_imagetype($image), false);
$imagetype = strtolower($imagetype[count($imagetype) - 1]);
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
$original_image_size = api_getimagesize($image);
switch ($imagetype) {
case 'gif':
$source_img = imagecreatefromgif($image);
break;
case 'jpg':
$source_img = imagecreatefromjpeg($image);
break;
case 'jpeg':
$source_img = imagecreatefromjpeg($image);
break;
case 'png':
$source_img = imagecreatefrompng($image);
break;
}
$imagetype = strtolower($imagetype[count($imagetype) - 1]);
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
$original_image_size = api_getimagesize($image);
switch ($imagetype) {
case 'gif':
$source_img = imagecreatefromgif($image);
break;
case 'jpg':
$source_img = imagecreatefromjpeg($image);
break;
case 'jpeg':
$source_img = imagecreatefromjpeg($image);
break;
case 'png':
$source_img = imagecreatefrompng($image);
break;
}
$new_thumbnail_size = api_calculate_image_size(
$original_image_size['width'],
@ -230,33 +230,35 @@ if ($slide_id == 'all') {
$max_thumbnail_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'];
}
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'];
}
$crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
$crop = imagecreatetruecolor($new_thumbnail_size['width'], $new_thumbnail_size['height']);
// preserve transparency
if ($imagetype == "png") {
imagesavealpha($crop, true);
$color = imagecolorallocatealpha($crop, 0x00, 0x00, 0x00, 127);
imagefill($crop, 0, 0, $color);
}
// preserve transparency
if ($imagetype == "png") {
imagesavealpha($crop, true);
$color = imagecolorallocatealpha($crop, 0x00, 0x00, 0x00, 127);
imagefill($crop, 0, 0, $color);
}
if ($imagetype == "gif") {
$transindex = imagecolortransparent($source_img);
if ($imagetype == "gif") {
$transindex = imagecolortransparent($source_img);
$palletsize = imagecolorstotal($source_img);
//GIF89a for transparent and anim (first clip), either GIF87a
if ($transindex >= 0 && $transindex < $palletsize) {
$transcol = imagecolorsforindex($source_img, $transindex);
$transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
imagefill($crop, 0, 0, $transindex);
imagecolortransparent($crop, $transindex);
}
}
//resampled image
//GIF89a for transparent and anim (first clip), either GIF87a
if ($transindex >= 0 && $transindex < $palletsize) {
$transcol = imagecolorsforindex($source_img, $transindex);
$transindex = imagecolorallocatealpha($crop, $transcol['red'], $transcol['green'], $transcol['blue'], 127);
imagefill($crop, 0, 0, $transindex);
imagecolortransparent($crop, $transindex);
}
}
//resampled image
imagecopyresampled(
$crop,
$source_img,
@ -270,84 +272,81 @@ if ($slide_id == 'all') {
$original_image_size['height']
);
switch ($imagetype) {
case 'gif':
imagegif($crop, $image_thumbnail);
break;
case 'jpg':
imagejpeg($crop, $image_thumbnail, $jpg_quality);
break;
case 'jpeg':
imagejpeg($crop, $image_thumbnail, $jpg_quality);
break;
case 'png':
imagepng($crop, $image_thumbnail, $png_compression);
break;
}
//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.'">';
} else {
//if images aren't support by gd (not gif, jpg, jpeg, png)
if ($imagetype == "bmp") {
switch ($imagetype) {
case 'gif':
imagegif($crop, $image_thumbnail);
break;
case 'jpg':
imagejpeg($crop, $image_thumbnail, $jpg_quality);
break;
case 'jpeg':
imagejpeg($crop, $image_thumbnail, $jpg_quality);
break;
case 'png':
imagepng($crop, $image_thumbnail, $png_compression);
break;
}
//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.'">';
} else {
//if images aren't support by gd (not gif, jpg, jpeg, png)
if ($imagetype == "bmp") {
// use getimagesize instead api_getimagesize($image); becasuse api_getimagesize doesn't support bmp files. Put here for each show, only for a few bmp files isn't heavy
$original_image_size = getimagesize($image);
if ($max_thumbnail_width < $original_image_size[0] || $max_thumbnail_height < $original_image_size[1]) {
$thumbnail_size = api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height); //don't use resize_image because doesn't run with bmp files
$image_height = $thumbnail_size['height'];
$image_width = $thumbnail_size['width'];
} else {
$image_height = $original_image_size[0];
$image_width = $original_image_size[1];
}
} else {
//example for svg files,...
$image_width = $max_thumbnail_width;
$image_height = $max_thumbnail_height;
}
$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
}//end image files only
// Creating the table
$html_table = '';
$i = 0;
$count_image = count($image_tag);
$number_iteration = ceil($count_image / $number_image);
$p = 0;
$original_image_size = getimagesize($image);
if ($max_thumbnail_width < $original_image_size[0] || $max_thumbnail_height < $original_image_size[1]) {
$thumbnail_size = api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height); //don't use resize_image because doesn't run with bmp files
$image_height = $thumbnail_size['height'];
$image_width = $thumbnail_size['width'];
} else {
$image_height = $original_image_size[0];
$image_width = $original_image_size[1];
}
} else {
//example for svg files,...
$image_width = $max_thumbnail_width;
$image_height = $max_thumbnail_height;
}
$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
}//end image files only
// Creating the table
$html_table = '';
$i = 0;
$count_image = count($image_tag);
$number_iteration = ceil($count_image / $number_image);
$p = 0;
$html = '';
$html .= '<div class="gallery">';
for ($k = 0; $k < $number_iteration; $k++) {
for ($i = 0; $i < $number_image; $i++) {
if (isset($image_tag[$p])) {
$html .= '<div class="col-xs-6 col-sm-3 col-md-2">';
$html .= '<div class="canvas-one">';
$html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">';
$html .= '<div class="frame">';
$html .= '<div class="photo">';
$html .= $image_tag[$p];
$html .= '</div>';
$html .= '</div>';
$html .= '</a>';
$html .= '</div>';
$html .= '</div>';
}
$p++;
}
}
for ($k = 0; $k < $number_iteration; $k++) {
for ($i = 0; $i < $number_image; $i++) {
if (isset($image_tag[$p])) {
$html .= '<div class="col-xs-6 col-sm-3 col-md-2">';
$html .= '<div class="canvas-one">';
$html .= '<a class="canvas-two" href="slideshow.php?slide_id='.$p.'&curdirpath='.$pathurl.'">';
$html .= '<div class="frame">';
$html .= '<div class="photo">';
$html .= $image_tag[$p];
$html .= '</div>';
$html .= '</div>';
$html .= '</a>';
$html .= '</div>';
$html .= '</div>';
}
$p++;
}
}
$html .= '</div>';
}//end slide==all
@ -358,110 +357,107 @@ $course_id = api_get_course_int_id();
// This is for viewing all the images in the slideshow one at a time.
if ($slide_id != 'all' && !empty($image_files_only)) {
if (file_exists($image) && is_file($image)) {
$image_height_width = resize_image($image, $target_width, $target_height);
$image_height = $image_height_width[0];
$image_width = $image_height_width[1];
$height_width_tags = null;
if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
$height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"';
}
// This is done really quickly and should be cleaned up a little bit using the API functions
$tbl_documents = Database::get_course_table(TABLE_DOCUMENT);
if ($path == '/') {
$pathpart = '/';
} else {
$pathpart = $path.'/';
}
$sql = "SELECT * FROM $tbl_documents
WHERE c_id = $course_id AND path='".Database::escape_string($pathpart.$image_files_only[$slide])."'";
$result = Database::query($sql);
$row = Database::fetch_array($result);
if (file_exists($image) && is_file($image)) {
$image_height_width = resize_image($image, $target_width, $target_height);
echo '<div class="thumbnail">';
if ($slide < $total_slides - 1 && $slide_id != 'all') {
echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>";
} else {
echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>";
}
if ($path == '/') {
$path = '';
}
$image_height = $image_height_width[0];
$image_width = $image_height_width[1];
list($width, $height) = getimagesize($image);
// Auto resize
if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') {
?>
<script type="text/javascript">
var initial_width='<?php echo $width; ?>';
var initial_height='<?php echo $height; ?>';
var height = window.innerHeight -320;
var width = window.innerWidth -360;
$height_width_tags = null;
if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
$height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"';
}
if (initial_height>height || initial_width>width) {
start_width=width;
start_height=height;
} else {
start_width=initial_width;
start_height=initial_height;
}
// This is done really quickly and should be cleaned up a little bit using the API functions
$tbl_documents = Database::get_course_table(TABLE_DOCUMENT);
if ($path == '/') {
$pathpart = '/';
} else {
$pathpart = $path.'/';
}
$sql = "SELECT * FROM $tbl_documents
WHERE c_id = $course_id AND path='".Database::escape_string($pathpart.$image_files_only[$slide])."'";
$result = Database::query($sql);
$row = Database::fetch_array($result);
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]; ?>">');
echo '<div class="thumbnail">';
if ($slide < $total_slides - 1 && $slide_id != 'all') {
echo "<a href='slideshow.php?slide_id=".$next_slide."&curdirpath=$pathurl'>";
} else {
echo "<a href='slideshow.php?slide_id=0&curdirpath=$pathurl'>";
}
if ($path == '/') {
$path = '';
}
function resizeImage() {
list($width, $height) = getimagesize($image);
// Auto resize
if (isset($_SESSION["image_resizing"]) && $_SESSION["image_resizing"] == 'resizing') {
?>
<script>
var initial_width='<?php echo $width; ?>';
var initial_height='<?php echo $height; ?>';
var height = window.innerHeight -320;
var width = window.innerWidth -360;
if (initial_height>height || initial_width>width) {
start_width=width;
start_height=height;
} else {
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]; ?>">');
var resize_factor_width = width / initial_width;
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;
var delta_height = height - initial_height * resize_factor_width;
if (delta_width > delta_height) {
width = Math.ceil(initial_width * resize_factor_height);
height= Math.ceil(initial_height * resize_factor_height);
}
else if(delta_width < delta_height) {
width = Math.ceil(initial_width * resize_factor_width);
height = Math.ceil(initial_height * resize_factor_width);
}
else {
width = Math.ceil(width);
height = Math.ceil(height);
}
document.getElementById('image').style.height = height +"px";
document.getElementById('image').style.width = width +"px";
document.getElementById('td_image').style.background='none';
document.getElementById('image').style.visibility='visible';
};
if (initial_height>height || initial_width>width) {
document.getElementById('image').style.visibility='hidden';
document.getElementById('td_image').style.background='url(<?php echo Display::returnIconPath('loadingAnimation.gif'); ?>) center no-repeat';
document.getElementById('image').onload = resizeImage;
window.onresize = resizeImage;
}
</script>
var delta_height = height - initial_height * resize_factor_width;
if (delta_width > delta_height) {
width = Math.ceil(initial_width * resize_factor_height);
height= Math.ceil(initial_height * resize_factor_height);
}
else if(delta_width < delta_height) {
width = Math.ceil(initial_width * resize_factor_width);
height = Math.ceil(initial_height * resize_factor_width);
}
else {
width = Math.ceil(width);
height = Math.ceil(height);
}
document.getElementById('image').style.height = height +"px";
document.getElementById('image').style.width = width +"px";
document.getElementById('td_image').style.background='none';
document.getElementById('image').style.visibility='visible';
};
if (initial_height>height || initial_width>width) {
document.getElementById('image').style.visibility='hidden';
document.getElementById('td_image').style.background='url(<?php echo Display::returnIconPath('loadingAnimation.gif'); ?>) center no-repeat';
document.getElementById('image').onload = resizeImage;
window.onresize = resizeImage;
}
</script>
<?php
} else {
echo "<img class=\"img-responsive\" src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">";
}
} else {
echo "<img class=\"img-responsive\" src='download.php?doc_url=$path/".$image_files_only[$slide]."' alt='".$image_files_only[$slide]."' border='0'".$height_width_tags.">";
}
echo '</a>';
echo '</a>';
echo '<div class="caption text-center">';
echo Display::tag('h3', $row['title']);
echo '<p>'.$row['comment'].'</p>';
echo '</div>';
echo '</div>';
if (api_is_allowed_to_edit(null, true)) {
if (api_is_allowed_to_edit(null, true)) {
echo '<ul class="list-unstyled">';
$aux = explode('.', htmlspecialchars($image_files_only[$slide]));
$ext = $aux[count($aux) - 1];
$aux = explode('.', htmlspecialchars($image_files_only[$slide]));
$ext = $aux[count($aux) - 1];
if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') {
$resize_info = get_lang('Resizing').'<br />';
@ -473,8 +469,8 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
$resize_height = get_lang('Auto');
} else {
$resize_info = get_lang('NoResizing').'<br />';
$resize_width = '';
$resize_height = '';
$resize_width = '';
$resize_height = '';
}
echo '<li class="text-center">';
@ -494,16 +490,15 @@ if ($slide_id != 'all' && !empty($image_files_only)) {
);
echo '</li>';
echo '<li class="text-center">'.$width.' x '.$height.'</li>';
echo '<li class="text-center">'.round((filesize($image) / 1024), 2).' KB - '.$ext.'</li>';
echo '<li class="text-center">'.round((filesize($image) / 1024), 2).' KB - '.$ext.'</li>';
echo '<li class="text-center">'.$resize_info.'</li>';
echo '<li class="text-center">'.$resize_width.'</li>';
echo '<li class="text-center">'.$resize_height.'</li>';
echo '<li class="text-center">'.$resize_width.'</li>';
echo '<li class="text-center">'.$resize_height.'</li>';
echo '</ul>';
}
} else {
Display::display_warning_message(get_lang('FileNotFound'));
}
}
} else {
Display::display_warning_message(get_lang('FileNotFound'));
}
} else {
if ($slide_id != 'all') {
Display::display_warning_message(get_lang('NoDataAvailable'));

@ -8,300 +8,300 @@
*/
class SurveyLink extends AbstractLink
{
private $survey_table = null;
private $survey_data = [];
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->set_type(LINK_SURVEY);
}
/**
* @return string
*/
public function get_name()
{
$this->get_survey_data();
return $this->survey_data['code'].': '.self::html_to_text($this->survey_data['title']);
}
public function get_description()
{
$this->get_survey_data();
return $this->survey_data['subtitle'];
}
public function get_type_name()
{
return get_lang('Survey');
}
public function is_allowed_to_change_name()
{
return false;
}
public function needs_name_and_description()
{
return false;
}
public function needs_max()
{
return false;
}
public function needs_results()
{
return false;
}
/**
* Generates an array of all surveys available.
* @return array 2-dimensional array - every element contains 2 subelements (id, name)
*/
public function get_all_links()
{
if (empty($this->course_code)) {
die('Error in get_all_links() : course code not set');
}
$tbl_survey = $this->get_survey_table();
$session_id = api_get_session_id();
$course_id = api_get_course_int_id();
$sql = 'SELECT survey_id, title, code FROM '.$tbl_survey.'
WHERE c_id = '.$course_id.' AND session_id = '.intval($session_id);
$result = Database::query($sql);
while ($data = Database::fetch_array($result)) {
$links[] = array(
$data['survey_id'],
api_trunc_str(
$data['code'] . ': ' . self::html_to_text($data['title']),
80
)
);
}
return isset($links) ? $links : null;
}
/**
* Generates an array of surveys that a teacher hasn't created a link for.
* @return array 2-dimensional array - every element contains 2 subelements (id, name)
*/
public function get_not_created_links()
{
if (empty($this->course_code)) {
die('Error in get_not_created_links() : course code not set');
}
$tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = 'SELECT survey_id, title, code
FROM '.$this->get_survey_table().' AS srv
WHERE survey_id NOT IN
(
SELECT ref_id FROM '.$tbl_grade_links.'
WHERE
type = '.LINK_SURVEY.' AND
course_code = "'.$this->get_course_code().'"
)
AND srv.session_id = '.api_get_session_id();
$result = Database::query($sql);
$links = array();
while ($data = Database::fetch_array($result)) {
$links[] = array(
$data['survey_id'],
api_trunc_str($data['code'].': '.self::html_to_text($data['title']), 80)
);
}
return $links;
}
/**
* Has anyone done this survey yet?
private $survey_table = null;
private $survey_data = [];
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->set_type(LINK_SURVEY);
}
/**
* @return string
*/
public function get_name()
{
$this->get_survey_data();
return $this->survey_data['code'].': '.self::html_to_text($this->survey_data['title']);
}
public function get_description()
{
$this->get_survey_data();
return $this->survey_data['subtitle'];
}
public function get_type_name()
{
return get_lang('Survey');
}
public function is_allowed_to_change_name()
{
return false;
}
public function needs_name_and_description()
{
return false;
}
public function needs_max()
{
return false;
}
public function needs_results()
{
return false;
}
/**
* Generates an array of all surveys available.
* @return array 2-dimensional array - every element contains 2 subelements (id, name)
*/
public function get_all_links()
{
if (empty($this->course_code)) {
die('Error in get_all_links() : course code not set');
}
$tbl_survey = $this->get_survey_table();
$session_id = api_get_session_id();
$course_id = api_get_course_int_id();
$sql = 'SELECT survey_id, title, code FROM '.$tbl_survey.'
WHERE c_id = '.$course_id.' AND session_id = '.intval($session_id);
$result = Database::query($sql);
while ($data = Database::fetch_array($result)) {
$links[] = array(
$data['survey_id'],
api_trunc_str(
$data['code'] . ': ' . self::html_to_text($data['title']),
80
)
);
}
return isset($links) ? $links : null;
}
/**
* Generates an array of surveys that a teacher hasn't created a link for.
* @return array 2-dimensional array - every element contains 2 subelements (id, name)
*/
public function get_not_created_links()
{
if (empty($this->course_code)) {
die('Error in get_not_created_links() : course code not set');
}
$tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = 'SELECT survey_id, title, code
FROM '.$this->get_survey_table().' AS srv
WHERE survey_id NOT IN
(
SELECT ref_id FROM '.$tbl_grade_links.'
WHERE
type = '.LINK_SURVEY.' AND
course_code = "'.$this->get_course_code().'"
)
AND srv.session_id = '.api_get_session_id();
$result = Database::query($sql);
$links = array();
while ($data = Database::fetch_array($result)) {
$links[] = array(
$data['survey_id'],
api_trunc_str($data['code'].': '.self::html_to_text($data['title']), 80)
);
}
return $links;
}
/**
* Has anyone done this survey yet?
* Implementation of the AbstractLink class, mainly used dynamically in gradebook/lib/fe
*/
public function has_results()
{
$ref_id = intval($this->get_ref_id());
$session_id = api_get_session_id();
$tbl_survey = Database::get_course_table(TABLE_SURVEY);
$tbl_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
$sql = "SELECT
COUNT(i.answered)
FROM $tbl_survey AS s
JOIN $tbl_survey_invitation AS i ON s.code = i.survey_code
WHERE
s.c_id = {$this->course_id} AND
i.c_id = {$this->course_id} AND
s.survey_id = $ref_id AND
i.session_id = $session_id";
$sql_result = Database::query($sql);
$data = Database::fetch_array($sql_result);
return ($data[0] != 0);
}
/**
* Calculate score for a student (to show in the gradebook)
*/
public function has_results()
{
$ref_id = intval($this->get_ref_id());
$session_id = api_get_session_id();
$tbl_survey = Database::get_course_table(TABLE_SURVEY);
$tbl_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
$sql = "SELECT
COUNT(i.answered)
FROM $tbl_survey AS s
JOIN $tbl_survey_invitation AS i ON s.code = i.survey_code
WHERE
s.c_id = {$this->course_id} AND
i.c_id = {$this->course_id} AND
s.survey_id = $ref_id AND
i.session_id = $session_id";
$sql_result = Database::query($sql);
$data = Database::fetch_array($sql_result);
return ($data[0] != 0);
}
/**
* Calculate score for a student (to show in the gradebook)
* @param int $stud_id
* @param string $type Type of result we want (best|average|ranking)
* @return array|null
*/
public function calc_score($stud_id = null, $type = null)
{
// Note: Max score is assumed to be always 1 for surveys,
// only student's participation is to be taken into account.
$max_score = 1;
$ref_id = intval($this->get_ref_id());
$session_id = api_get_session_id();
$tbl_survey = Database::get_course_table(TABLE_SURVEY);
$tbl_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
$get_individual_score = !is_null($stud_id);
$sql = "SELECT i.answered
FROM $tbl_survey AS s
JOIN $tbl_survey_invitation AS i
ON s.code = i.survey_code
WHERE
s.c_id = {$this->course_id} AND
i.c_id = {$this->course_id} AND
s.survey_id = $ref_id AND
i.session_id = $session_id
";
if ($get_individual_score) {
$sql .= ' AND i.user = '.intval($stud_id);
}
$sql_result = Database::query($sql);
if ($get_individual_score) {
// for 1 student
if ($data = Database::fetch_array($sql_result)) {
return array($data['answered'] ? $max_score : 0, $max_score);
}
return array(0, $max_score);
} else {
// for all the students -> get average
$rescount = 0;
$sum = 0;
$bestResult = 0;
while ($data = Database::fetch_array($sql_result)) {
$sum += $data['answered'] ? $max_score : 0;
$rescount++;
if ($data['answered'] > $bestResult) {
$bestResult = $data['answered'];
}
}
$sum = $sum / $max_score;
if ($rescount == 0) {
return null;
}
switch ($type) {
case 'best':
return array($bestResult, $rescount);
break;
case 'average':
return array($sum, $rescount);
break;
case 'ranking':
return null;
break;
default:
return array($sum, $rescount);
break;
}
}
}
/**
* Lazy load function to get the database table of the surveys
*/
private function get_survey_table()
{
$this->survey_table = Database::get_course_table(TABLE_SURVEY);
return $this->survey_table;
}
/**
* Check if this still links to a survey
*/
public function is_valid_link()
{
$session_id = api_get_session_id();
$sql = 'SELECT count(survey_id) FROM '.$this->get_survey_table().'
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id = '.intval($session_id);
$result = Database::query($sql);
$number = Database::fetch_row($result);
return ($number[0] != 0);
}
public function get_test_id()
{
return 'DEBUG:ID';
}
public function get_link()
{
if (api_is_allowed_to_edit()) { // Let students make access only through "Surveys" tool.
$tbl_name = $this->get_survey_table();
$session_id = api_get_session_id();
if ($tbl_name != '') {
$sql = 'SELECT survey_id FROM '.$this->get_survey_table().'
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id = '.intval($session_id).' ';
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
$survey_id = $row['survey_id'];
return api_get_path(WEB_PATH).'main/survey/reporting.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&survey_id='.$survey_id;
}
}
return null;
}
private function get_survey_data()
{
$tbl_name = $this->get_survey_table();
$session_id = api_get_session_id();
if ($tbl_name == '') {
return false;
} elseif (!isset($this->survey_data)) {
$sql = 'SELECT * FROM '.$tbl_name.'
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id='.intval($session_id);
$query = Database::query($sql);
$this->survey_data = Database::fetch_array($query);
}
return $this->survey_data;
}
public function get_icon_name()
{
return 'survey';
}
private static function html_to_text($string)
{
return strip_tags($string);
//return trim(api_html_entity_decode(strip_tags(str_ireplace(array('<p>', '</p>', '<br />', '<br/>', '<br>'), array('', ' ', ' ', ' ', ' '), $string)), ENT_QUOTES));
}
* @return array|null
*/
public function calc_score($stud_id = null, $type = null)
{
// Note: Max score is assumed to be always 1 for surveys,
// only student's participation is to be taken into account.
$max_score = 1;
$ref_id = intval($this->get_ref_id());
$session_id = api_get_session_id();
$tbl_survey = Database::get_course_table(TABLE_SURVEY);
$tbl_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
$get_individual_score = !is_null($stud_id);
$sql = "SELECT i.answered
FROM $tbl_survey AS s
JOIN $tbl_survey_invitation AS i
ON s.code = i.survey_code
WHERE
s.c_id = {$this->course_id} AND
i.c_id = {$this->course_id} AND
s.survey_id = $ref_id AND
i.session_id = $session_id
";
if ($get_individual_score) {
$sql .= ' AND i.user = '.intval($stud_id);
}
$sql_result = Database::query($sql);
if ($get_individual_score) {
// for 1 student
if ($data = Database::fetch_array($sql_result)) {
return array($data['answered'] ? $max_score : 0, $max_score);
}
return array(0, $max_score);
} else {
// for all the students -> get average
$rescount = 0;
$sum = 0;
$bestResult = 0;
while ($data = Database::fetch_array($sql_result)) {
$sum += $data['answered'] ? $max_score : 0;
$rescount++;
if ($data['answered'] > $bestResult) {
$bestResult = $data['answered'];
}
}
$sum = $sum / $max_score;
if ($rescount == 0) {
return null;
}
switch ($type) {
case 'best':
return array($bestResult, $rescount);
break;
case 'average':
return array($sum, $rescount);
break;
case 'ranking':
return null;
break;
default:
return array($sum, $rescount);
break;
}
}
}
/**
* Lazy load function to get the database table of the surveys
*/
private function get_survey_table()
{
$this->survey_table = Database::get_course_table(TABLE_SURVEY);
return $this->survey_table;
}
/**
* Check if this still links to a survey
*/
public function is_valid_link()
{
$session_id = api_get_session_id();
$sql = 'SELECT count(survey_id) FROM '.$this->get_survey_table().'
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id = '.intval($session_id);
$result = Database::query($sql);
$number = Database::fetch_row($result);
return ($number[0] != 0);
}
public function get_test_id()
{
return 'DEBUG:ID';
}
public function get_link()
{
if (api_is_allowed_to_edit()) { // Let students make access only through "Surveys" tool.
$tbl_name = $this->get_survey_table();
$session_id = api_get_session_id();
if ($tbl_name != '') {
$sql = 'SELECT survey_id FROM '.$this->get_survey_table().'
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id = '.intval($session_id).' ';
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
$survey_id = $row['survey_id'];
return api_get_path(WEB_PATH).'main/survey/reporting.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&survey_id='.$survey_id;
}
}
return null;
}
private function get_survey_data()
{
$tbl_name = $this->get_survey_table();
$session_id = api_get_session_id();
if ($tbl_name == '') {
return false;
} elseif (!isset($this->survey_data)) {
$sql = 'SELECT * FROM '.$tbl_name.'
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id='.intval($session_id);
$query = Database::query($sql);
$this->survey_data = Database::fetch_array($query);
}
return $this->survey_data;
}
public function get_icon_name()
{
return 'survey';
}
private static function html_to_text($string)
{
return strip_tags($string);
//return trim(api_html_entity_decode(strip_tags(str_ireplace(array('<p>', '</p>', '<br />', '<br/>', '<br>'), array('', ' ', ' ', ' ', ' '), $string)), ENT_QUOTES));
}
}

@ -17,25 +17,26 @@
*/
class ExerciseShowFunctions
{
/**
* Shows the answer to a fill-in-the-blanks question, as HTML
/**
* Shows the answer to a fill-in-the-blanks question, as HTML
* @param int $feedbackType
* @param string $answer
* @param int $id Exercise ID
* @param int $questionId Question ID
* @param string $answer
* @param int $id Exercise ID
* @param int $questionId Question ID
* @param int $resultsDisabled
* @param string $originalStudentAnswer
* @param bool $showTotalScoreAndUserChoices
*
* @return void
*/
public static function display_fill_in_blanks_answer(
$feedbackType,
$answer,
$id,
$questionId,
$resultsDisabled,
$originalStudentAnswer = '',
$showTotalScoreAndUserChoices
* @return void
*/
public static function display_fill_in_blanks_answer(
$feedbackType,
$answer,
$id,
$questionId,
$resultsDisabled,
$originalStudentAnswer = '',
$showTotalScoreAndUserChoices
) {
$answerHTML = FillBlanks::getHtmlDisplayForAnswer($answer, $feedbackType, $resultsDisabled, $showTotalScoreAndUserChoices);
if (strpos($originalStudentAnswer, 'font color') !== false) {
@ -64,7 +65,7 @@ class ExerciseShowFunctions
</tr>
<?php
}
}
}
/**
* Shows the answer to a calculated question, as HTML
@ -105,20 +106,20 @@ class ExerciseShowFunctions
}
}
/**
* Shows the answer to a free-answer question, as HTML
* @param string Answer text
* @param int Exercise ID
* @param int Question ID
* @return void
*/
public static function display_free_answer(
$feedback_type,
$answer,
$exe_id,
$questionId,
$questionScore = null,
$results_disabled = 0
/**
* Shows the answer to a free-answer question, as HTML
* @param string Answer text
* @param int Exercise ID
* @param int Question ID
* @return void
*/
public static function display_free_answer(
$feedback_type,
$answer,
$exe_id,
$questionId,
$questionScore = null,
$results_disabled = 0
) {
$comments = Event::get_comments($exe_id, $questionId);
@ -136,7 +137,7 @@ class ExerciseShowFunctions
echo '</tr>';
}
}
}
}
/**
* @param $feedback_type
@ -146,7 +147,7 @@ class ExerciseShowFunctions
* @param null $nano
* @param int $results_disabled
*/
public static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $fileUrl = null, $results_disabled = 0)
public static function display_oral_expression_answer($feedback_type, $answer, $id, $questionId, $fileUrl = null, $results_disabled = 0)
{
if (isset($fileUrl)) {
echo '
@ -184,8 +185,8 @@ class ExerciseShowFunctions
}
}
/**
* Displays the answer to a hotspot question
/**
* Displays the answer to a hotspot question
* @param int $feedback_type
* @param int $answerId
* @param string $answer
@ -194,7 +195,7 @@ class ExerciseShowFunctions
* @param int $resultsDisabled
* @param int $orderColor
*/
public static function display_hotspot_answer(
public static function display_hotspot_answer(
$feedback_type,
$answerId,
$answer,
@ -217,7 +218,7 @@ class ExerciseShowFunctions
}
}
$hotspot_colors = array(
$hotspot_colors = array(
"", // $i starts from 1 on next loop (ugly fix)
"#4271B5",
"#FE8E16",
@ -234,37 +235,37 @@ class ExerciseShowFunctions
"#F7BDE2"
);
?>
<table class="data_table">
<tr>
?>
<table class="data_table">
<tr>
<td class="text-center" width="5%">
<span class="fa fa-square fa-fw fa-2x" aria-hidden="true" style="color: <?php echo $hotspot_colors[$orderColor]; ?>"></span>
</td>
<td class="text-left" width="25%">
<td class="text-left" width="25%">
<?php echo "$answerId - $answer"; ?>
</td>
<td class="text-left" width="10%">
<?php
</td>
<td class="text-left" width="10%">
<?php
if (!$hide_expected_answer) {
$my_choice = $studentChoice ? get_lang('Correct') : get_lang('Fault');
echo $my_choice;
$my_choice = $studentChoice ? get_lang('Correct') : get_lang('Fault');
echo $my_choice;
}
?>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td class="text-left" width="60%">
<?php
?>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td class="text-left" width="60%">
<?php
if ($studentChoice) {
echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>';
}
?>
</td>
<?php } else { ?>
<td class="text-left" width="60%">&nbsp;</td>
<?php } ?>
</tr>
<?php
}
?>
</td>
<?php } else { ?>
<td class="text-left" width="60%">&nbsp;</td>
<?php } ?>
</tr>
<?php
}
/**
* Display the answers to a multiple choice question
@ -282,7 +283,7 @@ class ExerciseShowFunctions
*
* @return void
*/
public static function display_unique_or_multiple_answer(
public static function display_unique_or_multiple_answer(
$feedback_type,
$answerType,
$studentChoice,
@ -309,59 +310,59 @@ class ExerciseShowFunctions
}
$icon = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox';
$icon .= $studentChoice?'_on':'_off';
$icon .= '.gif';
$iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox';
$iconAnswer .= $answerCorrect?'_on':'_off';
$iconAnswer .= '.gif';
?>
<tr>
<td width="5%">
<?php echo Display::return_icon($icon); ?>
</td>
<td width="5%">
$icon .= $studentChoice?'_on':'_off';
$icon .= '.gif';
$iconAnswer = in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION)) ? 'radio':'checkbox';
$iconAnswer .= $answerCorrect?'_on':'_off';
$iconAnswer .= '.gif';
?>
<tr>
<td width="5%">
<?php echo Display::return_icon($icon); ?>
</td>
<td width="5%">
<?php if (!$hide_expected_answer) {
echo Display::return_icon($iconAnswer);
} else {
echo "-";
} ?>
</td>
<td width="40%">
<?php
echo $answer;
?>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td width="20%">
<?php
</td>
<td width="40%">
<?php
echo $answer;
?>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
<td width="20%">
<?php
if ($studentChoice) {
if ($answerCorrect) {
if ($answerCorrect) {
$color = 'green';
//echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>';
} else {
//echo '<span style="font-weight: bold; color: #008000;">'.nl2br($answerComment).'</span>';
} else {
$color = 'black';
//echo '<span style="font-weight: bold; color: #FF0000;">'.nl2br($answerComment).'</span>';
}
if ($hide_expected_answer) {
$color = '';
}
}
if ($hide_expected_answer) {
$color = '';
}
echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>';
}
?>
</td>
<?php
if ($ans == 1) {
$comm = Event::get_comments($id, $questionId);
}
?>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
}
}
?>
</td>
<?php
if ($ans == 1) {
$comm = Event::get_comments($id, $questionId);
}
?>
<?php } else { ?>
<td>&nbsp;</td>
<?php } ?>
</tr>
<?php
}
/**
* Display the answers to a multiple choice question
@ -414,7 +415,7 @@ class ExerciseShowFunctions
if (isset($new_options[$studentChoice])) {
echo get_lang($new_options[$studentChoice]['name']);
} else {
echo '-';
echo '-';
}
?>
@ -422,7 +423,7 @@ class ExerciseShowFunctions
<td width="5%">
<?php
//Expected choice
//Expected choice
if (!$hide_expected_answer) {
if (isset($new_options[$answerCorrect])) {
echo get_lang($new_options[$answerCorrect]['name']);
@ -435,7 +436,7 @@ class ExerciseShowFunctions
?>
</td>
<td width="40%">
<?php echo $answer; ?>
<?php echo $answer; ?>
</td>
<?php if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) { ?>
@ -448,8 +449,8 @@ class ExerciseShowFunctions
}
if ($hide_expected_answer) {
$color = '';
}
$color = '';
}
echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>';
}
@ -510,7 +511,7 @@ class ExerciseShowFunctions
<tr>
<td width="5%">
<?php
//Your choice
//Your choice
$question = new MultipleAnswerCombinationTrueFalse();
if (isset($question->options[$studentChoice])) {
echo $question->options[$studentChoice];
@ -521,7 +522,7 @@ class ExerciseShowFunctions
</td>
<td width="5%">
<?php
//Expected choice
//Expected choice
if (!$hide_expected_answer) {
if (isset($question->options[$answerCorrect])) {
echo $question->options[$answerCorrect];
@ -550,10 +551,10 @@ class ExerciseShowFunctions
if ($studentChoice == $answerCorrect) {
$color = "green";
}
//echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>';
//echo '<span style="font-weight: bold; color: #000;">'.nl2br($answerComment).'</span>';
if ($hide_expected_answer) {
$color = '';
}
}
echo '<span style="font-weight: bold; color: '.$color.';">'.nl2br($answerComment).'</span>';
}
?>
@ -572,12 +573,11 @@ class ExerciseShowFunctions
public static function displayAnnotationAnswer(
$feedback_type,
$exe_id,
$questionId,
$questionScore = null,
$results_disabled = 0
)
{
$exe_id,
$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)
@ -177,8 +178,8 @@ class Thematic
/**
* Move a thematic
*
* @param string $direction (up, down)
* @param int $thematic_id
* @param string $direction (up, down)
* @param int $thematic_id
*/
public function move_thematic($direction, $thematic_id)
{
@ -241,11 +242,11 @@ class Thematic
/**
* get thematic list
* @param int Thematic id (optional), get list by id
* @param int Thematic id (optional), get list by id
* @param integer $thematic_id
* @param string $course_code
* @param integer $session_id
* @return array Thematic data
* @return array Thematic data
*/
public static function get_thematic_list(
$thematic_id = null,
@ -365,8 +366,8 @@ class Thematic
/**
* Delete logically (set active field to 0) a thematic
* @param int|array One or many thematic ids
* @return int Affected rows
* @param int|array One or many thematic ids
* @return int Affected rows
*/
public function thematic_destroy($thematic_id)
{
@ -394,8 +395,8 @@ class Thematic
);
}
}
} else {
$thematic_id = intval($thematic_id);
} else {
$thematic_id = intval($thematic_id);
$sql = "UPDATE $tbl_thematic SET active = 0
WHERE c_id = $course_id AND id = $thematic_id";
$result = Database::query($sql);
@ -432,8 +433,8 @@ class Thematic
$new_thematic_id = $thematic_copy->thematic_save();
if (!empty($new_thematic_id)) {
$thematic_advanced = self::get_thematic_advance_by_thematic_id($thematic_id);
if(!empty($thematic_advanced)) {
foreach($thematic_advanced as $item) {
if (!empty($thematic_advanced)) {
foreach ($thematic_advanced as $item) {
$thematic = new Thematic();
$thematic->set_thematic_advance_attributes(
0,
@ -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;

@ -5,8 +5,8 @@
* Class aicc
* Defines the AICC class, which is meant to contain the aicc items (nuclear elements)
* @package chamilo.learnpath
* @author Yannick Warnier <ywarnier@beeznest.org>
* @license GNU/GPL
* @author Yannick Warnier <ywarnier@beeznest.org>
* @license GNU/GPL
* @package chamilo.learnpath
*/
class aicc extends learnpath
@ -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.
}
@ -132,7 +134,7 @@ class aicc extends learnpath
//echo '<pre>des:'.print_r($des_params, true).'</pre>';
if ($this->debug > 1) { error_log('New LP - In aicc::parse_config_files() - '.$des_file.' has been parsed', 0); }
// Distribute des params into the aicc object.
foreach ($des_params as $des){
foreach ($des_params as $des) {
// One AU in AICC is equivalent to one SCO in SCORM (scormItem class).
$oDes = new aiccResource('config', $des);
$this->deslist[$oDes->identifier] = $oDes;
@ -215,8 +217,8 @@ class aicc extends learnpath
/**
* Import the aicc object (as a result from the parse_config_files function) into the database structure
* @param string $course_code
* @return bool Returns -1 on error
* @param string $course_code
* @return bool Returns -1 on error
*/
public function import_aicc($course_code)
{
@ -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,12 +562,13 @@ class aicc extends learnpath
} else {
return '';
}
return $course_sys_dir.$new_dir.$config_dir;
}
/**
* Sets the proximity setting in the database
* @param string $proxy Proximity setting
* @param string $proxy Proximity setting
*/
function set_proximity($proxy = '')
{
@ -586,7 +587,7 @@ class aicc extends learnpath
/**
* Sets the theme setting in the database
* @param string Theme setting
* @param string Theme setting
*/
function set_theme($theme = '')
{
@ -605,7 +606,7 @@ class aicc extends learnpath
/**
* Sets the image LP in the database
* @param string $preview_image Theme setting
* @param string $preview_image Theme setting
*/
function set_preview_image($preview_image = '')
{
@ -624,7 +625,7 @@ class aicc extends learnpath
/**
* Sets the Author LP in the database
* @param string $author
* @param string $author
*/
function set_author($author = '')
{
@ -643,7 +644,7 @@ class aicc extends learnpath
/**
* Sets the content maker setting in the database
* @param string $maker
* @param string $maker
*/
function set_maker($maker = '')
{
@ -662,7 +663,7 @@ class aicc extends learnpath
/**
* Exports the current AICC object's files as a zip. Excerpts taken from learnpath_functions.inc.php::exportpath()
* @param integer Learnpath ID (optional, taken from object context if not defined)
* @param integer Learnpath ID (optional, taken from object context if not defined)
*/
function export_zip($lp_id = null)
{
@ -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,54 +16,54 @@
*/
class BlockTeacher extends Block
{
private $user_id;
private $teachers;
private $path;
private $permission = array(DRH);
/**
* Controller
*/
public function __construct ($user_id)
/**
* Controller
*/
public function __construct($user_id)
{
$this->user_id = $user_id;
$this->path = 'block_teacher';
if ($this->is_block_visible_for_user($user_id)) {
$this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER);
}
$this->user_id = $user_id;
$this->path = 'block_teacher';
if ($this->is_block_visible_for_user($user_id)) {
$this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER);
}
}
/**
* This method check if a user is allowed to see the block inside dashboard interface
* @param int User id
* @return bool Is block visible for user
*/
* This method check if a user is allowed to see the block inside dashboard interface
* @param int User id
* @return bool Is block visible for user
*/
public function is_block_visible_for_user($user_id)
{
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = false;
if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
$is_block_visible_for_user = true;
}
return $is_block_visible_for_user;
$user_info = api_get_user_info($user_id);
$user_status = $user_info['status'];
$is_block_visible_for_user = false;
if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) {
$is_block_visible_for_user = true;
}
return $is_block_visible_for_user;
}
/**
* 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();
$teacher_content_html = $this->get_teachers_content_html_for_drh();
global $charset;
$column = 1;
$data = array();
$teacher_content_html = $this->get_teachers_content_html_for_drh();
$html = '
$html = '
<div class="panel panel-default" id="intro">
<div class="panel-heading">
'.get_lang('TeachersInformationsList').'
@ -77,133 +75,131 @@ class BlockTeacher extends Block
'.$teacher_content_html.'
</div>
</div>
';
$data['column'] = $column;
$data['content_html'] = $html;
';
return $data;
$data['column'] = $column;
$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
* @return string content html
*/
* 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 = $this->teachers;
$content = '<h4>'.get_lang('YourTeachers').'</h4>';
$teachers_table = null;
if (count($teachers) > 0) {
$teachers_table .= '<table class="data_table" width:"95%">';
$teachers_table .= '
<tr>
<th>'.get_lang('User').'</th>
<th>'.get_lang('TimeSpentOnThePlatform').'</th>
<th>'.get_lang('LastConnexion').'</th>
</tr>
';
$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));
$last_connection = Tracking::get_last_connection_date($teacher_id);
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>
<td align="right">'.$last_connection.'</td>
</tr>
';
$i++;
}
$teachers_table .= '</table>';
} 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/index.php?view=admin">'.get_lang('SeeMore').'</a></div>';
}
//$content .= '</div>';
return $content;
}
public function get_teachers_content_html_for_drh()
if (count($teachers) > 0) {
$teachers_table .= '<table class="data_table" width:"95%">';
$teachers_table .= '
<tr>
<th>'.get_lang('User').'</th>
<th>'.get_lang('TimeSpentOnThePlatform').'</th>
<th>'.get_lang('LastConnexion').'</th>
</tr>
';
$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));
$last_connection = Tracking::get_last_connection_date($teacher_id);
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>
<td align="right">'.$last_connection.'</td>
</tr>
';
$i++;
}
$teachers_table .= '</table>';
} 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/index.php?view=admin">'.get_lang('SeeMore').'</a></div>';
}
//$content .= '</div>';
return $content;
}
public function get_teachers_content_html_for_drh()
{
$teachers = $this->teachers;
//$content = '<div style="margin:10px;">';
$content = '<h4>'.get_lang('YourTeachers').'</h4>';
$teachers = $this->teachers;
$content = '<h4>'.get_lang('YourTeachers').'</h4>';
$teachers_table = null;
if (count($teachers) > 0) {
$a_last_week = get_last_week();
$last_week = date('Y-m-d',$a_last_week[0]).' '.get_lang('To').' '.date('Y-m-d', $a_last_week[6]);
$teachers_table .= '<table class="data_table" width:"95%">';
$teachers_table .= '
<tr>
<th>'.get_lang('User').'</th>
<th>'.get_lang('TimeSpentLastWeek').'<br />'.$last_week.'</th>
</tr>
';
$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));
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>
</tr>';
$i++;
}
$teachers_table .= '</table>';
} 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;
}
if (count($teachers) > 0) {
$a_last_week = get_last_week();
$last_week = date('Y-m-d',$a_last_week[0]).' '.get_lang('To').' '.date('Y-m-d', $a_last_week[6]);
$teachers_table .= '<table class="data_table" width:"95%">';
$teachers_table .= '
<tr>
<th>'.get_lang('User').'</th>
<th>'.get_lang('TimeSpentLastWeek').'<br />'.$last_week.'</th>
</tr>
';
$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)
);
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>
</tr>';
$i++;
}
$teachers_table .= '</table>';
} 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>';
}
return $content;
}
/**
* Get number of teachers
* @return int
*/
function get_number_of_teachers()
* Get number of teachers
* @return int
*/
public function get_number_of_teachers()
{
return count($this->teachers);
}
return count($this->teachers);
}
}

Loading…
Cancel
Save