From 4f72175aee456a9367413696f5f1a1cd9c144df2 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 16 May 2012 11:04:27 +0200 Subject: [PATCH 01/18] Fixing possible bug when adding the complextype originalUsersList --- main/webservices/registration.soap.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main/webservices/registration.soap.php b/main/webservices/registration.soap.php index 812dcb3dad..0151f59d23 100644 --- a/main/webservices/registration.soap.php +++ b/main/webservices/registration.soap.php @@ -3367,8 +3367,9 @@ $server->wsdl->addComplexType( '', 'SOAP-ENC:Array', array(), -array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:originalUsersList[]')),'xsd:string' -); +array(array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:deleteSessionParams[]')), +'tns:originalUsersList' +); $server->wsdl->addComplexType( 'subscribeUserToCourseParams', @@ -3377,10 +3378,10 @@ $server->wsdl->addComplexType( 'all', '', array( - 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), - 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), - 'original_course_id_name' => array('name' => 'original_course_id_value', 'type' => 'xsd:string') + 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), + 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), + 'original_course_id_name' => array('name' => 'original_course_id_value', 'type' => 'xsd:string') ) ); From 3f1dfef29f113cb13083714597808f6a48c819ce Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 16 May 2012 11:14:52 +0200 Subject: [PATCH 02/18] Adding style changes in the PDF export see BT#4080 --- main/gradebook/gradebook_flatview.php | 2 + .../lib/flatview_data_generator.class.php | 118 ++++++++++++------ .../gradebook/lib/gradebook_functions.inc.php | 34 ++--- 3 files changed, 100 insertions(+), 54 deletions(-) diff --git a/main/gradebook/gradebook_flatview.php b/main/gradebook/gradebook_flatview.php index b3aec9d050..55b7caef25 100644 --- a/main/gradebook/gradebook_flatview.php +++ b/main/gradebook/gradebook_flatview.php @@ -105,6 +105,7 @@ if (isset($_GET['export_pdf']) && $_GET['export_pdf'] == 'category') { $params['only_total_category'] = true; $params['join_firstname_lastname'] = true; $params['show_official_code'] = true; + $params['export_pdf'] = true; if ($cat[0]->is_locked() == true || api_is_platform_admin()) { Display :: set_header(null, false, false); @@ -125,6 +126,7 @@ if (isset($_GET['exportpdf'])) { Display :: set_header(null, false, false); $params['join_firstname_lastname'] = true; $params['show_usercode'] = true; + $params['export_pdf'] = true; export_pdf_flatview($cat, $users, $alleval, $alllinks, $params); } else { Display :: display_header(get_lang('ExportPDF')); diff --git a/main/gradebook/lib/flatview_data_generator.class.php b/main/gradebook/lib/flatview_data_generator.class.php index eb98059c80..01ab8f0cc4 100644 --- a/main/gradebook/lib/flatview_data_generator.class.php +++ b/main/gradebook/lib/flatview_data_generator.class.php @@ -59,10 +59,13 @@ class FlatViewDataGenerator if (isset($this->params['show_official_code']) && $this->params['show_official_code']) { $headers[] = get_lang('OfficialCode'); - } - - if (isset($this->params['join_firstname_lastname']) && $this->params['join_firstname_lastname']) { - $headers[] = get_lang('Name'); + } + if (isset($this->params['join_firstname_lastname']) && $this->params['join_firstname_lastname']) { + if (api_is_western_name_order()) { + $headers[] = get_lang('FirstnameAndLastname'); + } else { + $headers[] = get_lang('LastnameAndFirstname'); + } } else { $headers[] = get_lang('LastName'); $headers[] = get_lang('FirstName'); @@ -233,18 +236,41 @@ class FlatViewDataGenerator $use_grade_model = false; } + $export_to_pdf = false; + if (isset($this->params['export_pdf']) && $this->params['export_pdf']) { + $export_to_pdf = true; + } + foreach ($selected_users as $user) { - $row = array(); - $row[] = $user_id = $user[0]; //user id + $row = array(); + if ($export_to_pdf) { + $row['user_id'] = $user_id = $user[0]; //user id + } else { + $row[] = $user_id = $user[0]; //user id + } if (isset($this->params['show_official_code']) && $this->params['show_official_code']) { - $row[] = $user[4]; //official code - } + if ($export_to_pdf) { + $row['official_code'] = $user[4]; //official code + } else { + $row[] = $user[4]; //official code + } + } + if (isset($this->params['join_firstname_lastname']) && $this->params['join_firstname_lastname']) { - $row[] = api_get_person_name($user[3], $user[2]); //last name + if ($export_to_pdf) { + $row['name'] = api_get_person_name($user[3], $user[2]); //last name + } else { + $row[] = api_get_person_name($user[3], $user[2]); //last name + } } else { - $row[] = $user[2]; //last name - $row[] = $user[3]; //first name + if ($export_to_pdf) { + $row['lastname'] = $user[2]; //last name + $row['firstname'] = $user[3]; //first name + } else { + $row[] = $user[2]; //last name + $row[] = $user[3]; //first name + } } $item_value = 0; @@ -279,10 +305,18 @@ class FlatViewDataGenerator $temp_score = $scoredisplay->display_score($score, SCORE_DIV_SIMPLE_WITH_CUSTOM); if (!isset($this->params['only_total_category'])) { - if (!$show_all) { - $row[] = $temp_score.' '; - } else { - $row[] = $temp_score; + if (!$show_all) { + if ($export_to_pdf) { + $row['score'] = $temp_score.' '; + } else { + $row[] = $temp_score.' '; + } + } else { + if ($export_to_pdf) { + $row['score'] = $temp_score; + } else { + $row[] = $temp_score; + } } } $item_value_total +=$item_value; @@ -309,48 +343,58 @@ class FlatViewDataGenerator $item_value = $item_value*$item->get_weight(); $item_value = $main_weight*$item_value/$item->get_weight(); } - //if ($debug) var_dump($item_value); $item_total += $item->get_weight(); - //SCORE_DIV, SCORE_PERCENT, SCORE_DIV_PERCENT, SCORE_AVERAGE - $temp_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE); //$temp_score = $scoredisplay->display_score($score, SCORE_DIV_SIMPLE_WITH_CUSTOM); - if (!isset($this->params['only_total_category'])) { - if (!$show_all) { - //$row[] = $scoredisplay->display_score($score,SCORE_DIV_PERCENT); + if (!$show_all) { if (in_array($item->get_type() , array(LINK_EXERCISE, LINK_DROPBOX, LINK_STUDENTPUBLICATION, LINK_LEARNPATH, LINK_FORUM_THREAD, LINK_ATTENDANCE,LINK_SURVEY))) { - if (!empty($score[0])) { - $row[] = $temp_score.' '; + if (!empty($score[0])) { + if ($export_to_pdf) { + $row['score'] = $temp_score.' '; + } else { + $row[] = $temp_score.' '; + } } else { - $row[] = ''; + $row['score'] = ''; + } + } else { + if ($export_to_pdf) { + $row['score'] = $temp_score.' '; + } else { + $row[] = $temp_score.' '; } - //$row[] = $scoredisplay->display_score($score,SCORE_DIV_PERCENT, SCORE_ONLY_SCORE); - } else { - //$row[] = $scoredisplay->display_score($score,SCORE_DIV_PERCENT); - //$row[] = $score[0]; - $row[] = $temp_score.' '; } - } else { - //$row[] = $scoredisplay->display_score($score, SCORE_DECIMAL); - $row[] = $temp_score; - //$row[] = $scoredisplay->display_score($score, SCORE_DIV_PERCENT); + } else { + if ($export_to_pdf) { + $row['score'] = $temp_score; + } else { + $row[] = $temp_score; + } } } $item_value_total +=$item_value; } $item_total = $main_weight; - } + } $item_total = round($item_total); $total_score = array($item_value_total, $item_total); if (!$show_all) { - $row[] = $scoredisplay->display_score($total_score); - } else { - $row[] = $scoredisplay->display_score($total_score, SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS); + if ($export_to_pdf) { + $row['total'] = $scoredisplay->display_score($total_score); + } else { + $row[] = $scoredisplay->display_score($total_score); + } + } else { + if ($export_to_pdf) { + $row['total'] = $scoredisplay->display_score($total_score, SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS); + } else { + $row[] = $scoredisplay->display_score($total_score, SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS); + } } unset($score); $data[] = $row; diff --git a/main/gradebook/lib/gradebook_functions.inc.php b/main/gradebook/lib/gradebook_functions.inc.php index 7e5df117c2..88b2365243 100644 --- a/main/gradebook/lib/gradebook_functions.inc.php +++ b/main/gradebook/lib/gradebook_functions.inc.php @@ -785,31 +785,22 @@ function export_pdf_flatview($cat, $users, $alleval, $alllinks, $params = array( $has_data = is_array($printable_data[1]) && count($printable_data[1]) > 0; if (api_is_western_name_order()) { - // Choosing the right person name order according to the current language. - $firstname_position = 0; - $lastname_position = 1; - if (!isset($params['join_firstname_lastname'])) { - - if (isset($params['show_usercode']) && $params['show_usercode'] ) { - $firstname_position ++; - $lastname_position ++; - } - list($printable_data[0][$firstname_position], $printable_data[0][$lastname_position]) = array($printable_data[0][$lastname_position], $printable_data[0][$firstname_position]); + // Choosing the right person name order according to the current language. + if (!isset($params['join_firstname_lastname'])) { + //list($printable_data[0][$firstname_position], $printable_data[0][$lastname_position]) = array($printable_data[0][$lastname_position], $printable_data[0][$firstname_position]); if ($has_data) { foreach ($printable_data[1] as &$printable_data_row) { - list($printable_data_row[$firstname_position], $printable_data_row[$lastname_position]) = array($printable_data_row[$lastname_position], $printable_data_row[$firstname_position]); + list($printable_data_row['firstname'], $printable_data_row['lastname']) = array($printable_data_row['lastname'], $printable_data_row['firstname']); } } - } - + } } - $table = new HTML_Table(array('class' => 'data_table')); $row = 0; $column = 0; - $table->setHeaderContents($row, $column, '#');$column++; + $table->setHeaderContents($row, $column, get_lang('NumberAbbreviation'));$column++; foreach ($printable_data[0] as $printable_data_cell) { $table->setHeaderContents($row, $column, $printable_data_cell); $column++; @@ -823,9 +814,17 @@ function export_pdf_flatview($cat, $users, $alleval, $alllinks, $params = array( $table->updateCellAttributes($row, $column, 'align="center"'); $column++; $counter++; - foreach ($printable_data_row as &$printable_data_cell) { + foreach ($printable_data_row as $key => &$printable_data_cell) { + $attributes = array(); + $attributes['align'] = 'center'; + if (in_array($key, array('name'))) { + $attributes['align'] = 'left'; + } + if (in_array($key, array('total'))) { + $attributes['style'] = 'font-weight:bold'; + } $table->setCellContents($row, $column, $printable_data_cell); - $table->updateCellAttributes($row, $column, 'align="center"'); + $table->updateCellAttributes($row, $column, $attributes); $column++; } $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); @@ -837,6 +836,7 @@ function export_pdf_flatview($cat, $users, $alleval, $alllinks, $params = array( $table->updateCellAttributes($row, $column, 'colspan="'.$columns.'" align="center" class="row_odd"'); } + Display::$global_template->assign('pdf_table', $table->toHtml()); unset($printable_data); From b98d6482f24ef3963aae54f70129f569f4203d22 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 16 May 2012 11:40:57 +0200 Subject: [PATCH 03/18] Updating lang variables --- main/lang/english/trad4all.inc.php | 7 +++++++ main/lang/spanish/admin.inc.php | 2 ++ main/lang/spanish/forum.inc.php | 2 +- main/lang/spanish/trad4all.inc.php | 7 +++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php index 5d667f1bec..d41920b9e2 100644 --- a/main/lang/english/trad4all.inc.php +++ b/main/lang/english/trad4all.inc.php @@ -1220,4 +1220,11 @@ $Reload = "Reload"; $TimeSpentLastXDays = "Time spent the last %s days"; $TimeSpentBetweenXAndY = "Time spent between %s and %s"; $GoToCourse = "Go to the course"; +$SubTotal = "Subtotal"; +$Configure = "Configure"; +$Regions = "Regions"; +$CourseList = "Course list"; +$NumberAbbreviation = "N°"; +$FirstnameAndLastname = "First Name and Last Name"; +$LastnameAndFirstname = "Last Name and First Name"; ?> \ No newline at end of file diff --git a/main/lang/spanish/admin.inc.php b/main/lang/spanish/admin.inc.php index ed4354351f..22e2c4bc0f 100644 --- a/main/lang/spanish/admin.inc.php +++ b/main/lang/spanish/admin.inc.php @@ -1541,4 +1541,6 @@ $AllowHRSkillsManagementTitle = "Permitir al perfil RRHH administrar las compete $AllowHRSkillsManagementComment = "El usuario podrá crear, editar competencias"; $GradebookDefaultWeightTitle = "Peso total por defecto en la herramienta \"Evaluaciones\""; $GradebookDefaultWeightComment = "Este peso será utilizado en todos los cursos"; +$TeachersCanChangeScoreSettingsTitle = "Los profesores pueden cambiar la configuración de puntuación de las Evaluaciones"; +$TeachersCanChangeScoreSettingsComment = "Al editar la configuración de las Evaluaciones"; ?> \ No newline at end of file diff --git a/main/lang/spanish/forum.inc.php b/main/lang/spanish/forum.inc.php index 8894c537f9..519b557479 100644 --- a/main/lang/spanish/forum.inc.php +++ b/main/lang/spanish/forum.inc.php @@ -104,7 +104,7 @@ $NumberOfPostsForThisUser = "Número de mensajes del usuario"; $AveragePostPerUser = "Promedio de mensajes por usuario"; $QualificationChangesHistory = "Historial de cambios en las calificaciones"; $MoreRecent = "mas reciente"; -$Older = "mas antiguio"; +$Older = "mas antiguo"; $OrderBy = "Ordenar por"; $WhoChanged = "Quien hizo el cambio"; $NoteChanged = "Nota cambiada"; diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index b2daef339b..02bca0d528 100644 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -1225,4 +1225,11 @@ $Reload = "Recargar"; $TimeSpentLastXDays = "Tiempo dedicado en los últimos %s días"; $TimeSpentBetweenXAndY = "Tiempo dedicado entre el %s y el %s"; $GoToCourse = "Ir al curso"; +$SubTotal = "Total parcial"; +$Configure = "Configurar"; +$Regions = "Regiones"; +$CourseList = "Lista de cursos"; +$NumberAbbreviation = "N°"; +$FirstnameAndLastname = "Nombres y Apellidos"; +$LastnameAndFirstname = "Apellidos y Nombres"; ?> \ No newline at end of file From a9a93ac9da22ee6490b7a8934c2cdbaf4c93cc39 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 16 May 2012 12:57:44 +0200 Subject: [PATCH 04/18] Adding more fixes to the PDF export see BT#4080 --- main/gradebook/gradebook_flatview.php | 3 +- .../lib/flatview_data_generator.class.php | 83 +++++++------- .../gradebook/lib/gradebook_functions.inc.php | 106 +++++++----------- main/lang/spanish/gradebook.inc.php | 8 +- main/lang/spanish/trad4all.inc.php | 27 ++--- 5 files changed, 104 insertions(+), 123 deletions(-) diff --git a/main/gradebook/gradebook_flatview.php b/main/gradebook/gradebook_flatview.php index 55b7caef25..336038dc1f 100644 --- a/main/gradebook/gradebook_flatview.php +++ b/main/gradebook/gradebook_flatview.php @@ -127,6 +127,7 @@ if (isset($_GET['exportpdf'])) { $params['join_firstname_lastname'] = true; $params['show_usercode'] = true; $params['export_pdf'] = true; + $params['only_total_category'] = false; export_pdf_flatview($cat, $users, $alleval, $alllinks, $params); } else { Display :: display_header(get_lang('ExportPDF')); @@ -134,7 +135,7 @@ if (isset($_GET['exportpdf'])) { } if (isset ($_GET['print'])) { - $printable_data = get_printable_data ($cat[0], $users, $alleval, $alllinks); + $printable_data = get_printable_data($cat[0], $users, $alleval, $alllinks); echo print_table($printable_data[1],$printable_data[0], get_lang('FlatView'), $cat[0]->get_name()); exit; } diff --git a/main/gradebook/lib/flatview_data_generator.class.php b/main/gradebook/lib/flatview_data_generator.class.php index 01ab8f0cc4..7a7d32ad0d 100644 --- a/main/gradebook/lib/flatview_data_generator.class.php +++ b/main/gradebook/lib/flatview_data_generator.class.php @@ -12,7 +12,6 @@ */ class FlatViewDataGenerator { - // Sorting types constants const FVDG_SORT_LASTNAME = 1; const FVDG_SORT_FIRSTNAME = 2; @@ -67,8 +66,13 @@ class FlatViewDataGenerator $headers[] = get_lang('LastnameAndFirstname'); } } else { - $headers[] = get_lang('LastName'); - $headers[] = get_lang('FirstName'); + if (api_is_western_name_order()) { + $headers[] = get_lang('FirstName'); + $headers[] = get_lang('LastName'); + } else { + $headers[] = get_lang('LastName'); + $headers[] = get_lang('FirstName'); + } } if (!isset($items_count)) { $items_count = count($this->evals_links) - $items_start; @@ -109,8 +113,12 @@ class FlatViewDataGenerator $allcat = $this->category->get_subcategories(null, $course_code, $session_id, 'ORDER BY id'); foreach ($allcat as $sub_cat) { - $sub_cat_weight = 100*$sub_cat->get_weight()/$main_weight; - $headers[] = Display::url($sub_cat->get_name(), api_get_self().'?selectcat='.$sub_cat->get_id()).' '.$sub_cat_weight.' % '; + $sub_cat_weight = 100*$sub_cat->get_weight()/$main_weight; + $add_weight = " $sub_cat_weight %"; + if (isset($this->params['export_pdf']) && $this->params['export_pdf']) { + $add_weight = null; + } + $headers[] = Display::url($sub_cat->get_name(), api_get_self().'?selectcat='.$sub_cat->get_id()).$add_weight; } } else { if (!isset($this->params['only_total_category'])) { @@ -122,7 +130,7 @@ class FlatViewDataGenerator } } } - $headers[] = get_lang('GradebookQualificationTotal').' 100%'; + $headers[] = api_strtoupper(get_lang('GradebookQualificationTotal')); return $headers; } @@ -178,12 +186,14 @@ class FlatViewDataGenerator if ($items_count < 0) { $items_count = 0; } + // copy users to a new array that we will sort // TODO - needed ? $usertable = array (); foreach ($this->users as $user) { $usertable[] = $user; } + // sort users array if ($users_sorting & self :: FVDG_SORT_LASTNAME) { usort($usertable, array ('FlatViewDataGenerator','sort_by_last_name')); @@ -240,7 +250,7 @@ class FlatViewDataGenerator if (isset($this->params['export_pdf']) && $this->params['export_pdf']) { $export_to_pdf = true; } - + foreach ($selected_users as $user) { $row = array(); if ($export_to_pdf) { @@ -265,11 +275,21 @@ class FlatViewDataGenerator } } else { if ($export_to_pdf) { - $row['lastname'] = $user[2]; //last name - $row['firstname'] = $user[3]; //first name + if (api_is_western_name_order()) { + $row['firstname'] = $user[3]; + $row['lastname'] = $user[2]; + } else { + $row['lastname'] = $user[2]; + $row['firstname'] = $user[3]; + } } else { - $row[] = $user[2]; //last name - $row[] = $user[3]; //first name + if (api_is_western_name_order()) { + $row[] = $user[3]; //first name + $row[] = $user[2]; //last name + } else { + $row[] = $user[2]; //last name + $row[] = $user[3]; //first name + } } } @@ -304,19 +324,11 @@ class FlatViewDataGenerator //$temp_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE); $temp_score = $scoredisplay->display_score($score, SCORE_DIV_SIMPLE_WITH_CUSTOM); - if (!isset($this->params['only_total_category'])) { + if (!isset($this->params['only_total_category']) || (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)) { if (!$show_all) { - if ($export_to_pdf) { - $row['score'] = $temp_score.' '; - } else { - $row[] = $temp_score.' '; - } + $row[] = $temp_score.' '; } else { - if ($export_to_pdf) { - $row['score'] = $temp_score; - } else { - $row[] = $temp_score; - } + $row[] = $temp_score; } } $item_value_total +=$item_value; @@ -347,32 +359,20 @@ class FlatViewDataGenerator $temp_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE); //$temp_score = $scoredisplay->display_score($score, SCORE_DIV_SIMPLE_WITH_CUSTOM); - if (!isset($this->params['only_total_category'])) { + if (!isset($this->params['only_total_category']) || (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)) { if (!$show_all) { if (in_array($item->get_type() , array(LINK_EXERCISE, LINK_DROPBOX, LINK_STUDENTPUBLICATION, LINK_LEARNPATH, LINK_FORUM_THREAD, LINK_ATTENDANCE,LINK_SURVEY))) { if (!empty($score[0])) { - if ($export_to_pdf) { - $row['score'] = $temp_score.' '; - } else { - $row[] = $temp_score.' '; - } + $row[] = $temp_score.' '; } else { - $row['score'] = ''; + $row[] = ''; } } else { - if ($export_to_pdf) { - $row['score'] = $temp_score.' '; - } else { - $row[] = $temp_score.' '; - } + $row[] = $temp_score.' '; } - } else { - if ($export_to_pdf) { - $row['score'] = $temp_score; - } else { - $row[] = $temp_score; - } + } else { + $row[] = $temp_score; } } $item_value_total +=$item_value; @@ -396,7 +396,8 @@ class FlatViewDataGenerator $row[] = $scoredisplay->display_score($total_score, SCORE_DIV_SIMPLE_WITH_CUSTOM_LETTERS); } } - unset($score); + unset($score); + //var_dump($row);exit; $data[] = $row; } return $data; diff --git a/main/gradebook/lib/gradebook_functions.inc.php b/main/gradebook/lib/gradebook_functions.inc.php index 88b2365243..ad18b3e9fa 100644 --- a/main/gradebook/lib/gradebook_functions.inc.php +++ b/main/gradebook/lib/gradebook_functions.inc.php @@ -30,16 +30,6 @@ require_once api_get_path(LIBRARY_PATH).'grade_model.lib.php'; * @return boolean True on success, false on failure */ function add_resource_to_course_gradebook($category_id, $course_code, $resource_type, $resource_id, $resource_name='', $weight=0, $max=0, $resource_description='', $visible=0, $session_id = 0) { - /* See defines in lib/be/linkfactory.class.php - define('LINK_EXERCISE',1); - define('LINK_DROPBOX',2); - define('LINK_STUDENTPUBLICATION',3); - define('LINK_LEARNPATH',4); - define('LINK_FORUM_THREAD',5), - define('LINK_WORK',6); - */ - require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be.inc.php'; - $link = LinkFactory :: create($resource_type); $link->set_user_id(api_get_user_id()); $link->set_course_code($course_code); @@ -72,17 +62,11 @@ function add_resource_to_course_gradebook($category_id, $course_code, $resource_ } function block_students() { - //if (!api_is_allowed_to_create_course()) { if (!api_is_allowed_to_edit()) { api_not_allowed(); } } -/** - * Returns the info header for the user result page - * @param $userid - */ - /** * Returns the course name from a given code * @param string $code @@ -95,6 +79,7 @@ function get_course_name_from_code($code) { return $col['title']; } } + /** * Builds an img tag for a gradebook item * @param string $type value returned by a gradebookitem's get_icon_name() @@ -157,7 +142,6 @@ function get_icon_file_name ($type) { return api_get_path(WEB_IMG_PATH).$icon; } - /** * Builds the course or platform admin icons to edit a category * @param object $cat category object @@ -211,11 +195,6 @@ function build_edit_icons_cat($cat, $selectcat) { } else { //$modify_icons .= ' '; } - - if (empty($grade_model_id) || $grade_model_id == -1) { - /*$modify_icons .= ' '. - Display::return_icon('percentage.png', get_lang('EditAllWeights'),'',ICON_SIZE_SMALL).' '; */ - } if ($cat->is_locked() && !api_is_platform_admin()) { $modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'),'',ICON_SIZE_SMALL); } else { @@ -371,8 +350,7 @@ function get_resource_from_course_gradebook($link_id) { * @return bool false on error, true on success */ function remove_resource_from_course_gradebook($link_id) { - if ( empty($link_id) ) { return false; } - require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be.inc.php'; + if ( empty($link_id) ) { return false; } // TODO find the corresponding category (the first one for this course, ordered by ID) $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $sql = "DELETE FROM $l WHERE id = ".(int)$link_id; @@ -409,8 +387,7 @@ function get_course_id_by_link_id($id_link) { return $array['id']; } -function get_table_type_course($type) { - global $_configuration; +function get_table_type_course($type) { global $table_evaluated; return Database::get_course_table($table_evaluated[$type][0]); } @@ -699,17 +676,18 @@ function load_gradebook_select_in_tool($form) { } } -function export_pdf_flatview($cat, $users, $alleval, $alllinks, $params = array()) { - // Beginning of PDF report creation - +/** + * PDF report creation + */ +function export_pdf_flatview($cat, $users, $alleval, $alllinks, $params = array()) { + //Getting data $printable_data = get_printable_data($cat[0], $users, $alleval, $alllinks, $params); // Reading report's CSS $css_file = api_get_path(SYS_CODE_PATH).'gradebook/print.css'; $css = file_exists($css_file) ? @file_get_contents($css_file) : ''; - // HTML report creation first - $time = time(); + // HTML report creation first $course_code = trim($cat[0]->get_course_code()); $organization = api_get_setting('Institution'); @@ -757,17 +735,20 @@ function export_pdf_flatview($cat, $users, $alleval, $alllinks, $params = array( } if ($use_grade_model) { - if ($parent_id == 0) { - $title = '

'.get_lang('FlatView').'

'; + if ($parent_id == 0) { + $title = '

'.api_strtoupper(get_lang('Average')).'
'.get_lang('Detailed').'

'; } else { - $title = '

'.$cat[0]->get_description().' - ('.$cat[0]->get_name().')

'; + $title = '

'.api_strtoupper(get_lang('Average')).'
'.$cat[0]->get_description().' - ('.$cat[0]->get_name().')

'; } } else { - $title = '

'.get_lang('FlatView').'

'; + if ($parent_id == 0) { + $title = '

'.api_strtoupper(get_lang('Average')).'
'.get_lang('Detailed').'

'; + } else { + $title = '

'.api_strtoupper(get_lang('Average')).'

'; + } } Display::$global_template->assign('pdf_title', $title); - //Showing only the current teacher/admin instead the all teacherlist name see BT#4080 //$teacher_list = CourseManager::get_teacher_list_from_course_code_to_string($course_code); $user_info = api_get_user_info(); @@ -783,59 +764,55 @@ function export_pdf_flatview($cat, $users, $alleval, $alllinks, $params = array( $columns = count($printable_data[0]); $has_data = is_array($printable_data[1]) && count($printable_data[1]) > 0; - - if (api_is_western_name_order()) { - // Choosing the right person name order according to the current language. - if (!isset($params['join_firstname_lastname'])) { - //list($printable_data[0][$firstname_position], $printable_data[0][$lastname_position]) = array($printable_data[0][$lastname_position], $printable_data[0][$firstname_position]); - if ($has_data) { - foreach ($printable_data[1] as &$printable_data_row) { - list($printable_data_row['firstname'], $printable_data_row['lastname']) = array($printable_data_row['lastname'], $printable_data_row['firstname']); - } - } - } - } - + $table = new HTML_Table(array('class' => 'data_table')); $row = 0; $column = 0; - $table->setHeaderContents($row, $column, get_lang('NumberAbbreviation'));$column++; + $table->setHeaderContents($row, $column, get_lang('NumberAbbreviation')); + $column++; foreach ($printable_data[0] as $printable_data_cell) { + $printable_data_cell = strip_tags($printable_data_cell); $table->setHeaderContents($row, $column, $printable_data_cell); $column++; } $row++; + if ($has_data) { $counter = 1; + //var_dump($printable_data);exit; foreach ($printable_data[1] as &$printable_data_row) { $column = 0; $table->setCellContents($row, $column, $counter); $table->updateCellAttributes($row, $column, 'align="center"'); - $column++; $counter++; - + $column++; + $counter++; + foreach ($printable_data_row as $key => &$printable_data_cell) { $attributes = array(); $attributes['align'] = 'center'; - if (in_array($key, array('name'))) { + $attributes['style'] = null; + + if ($key === 'name') { $attributes['align'] = 'left'; } - if (in_array($key, array('total'))) { - $attributes['style'] = 'font-weight:bold'; - } + if ($key === 'total') { + $attributes['style'] = 'font-weight:bold'; + } + //var_dump($key, $printable_data_cell, $attributes); $table->setCellContents($row, $column, $printable_data_cell); $table->updateCellAttributes($row, $column, $attributes); $column++; } $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); $row++; - } + } + //exit; } else { $column = 0; $table->setCellContents($row, $column, get_lang('NoResults')); $table->updateCellAttributes($row, $column, 'colspan="'.$columns.'" align="center" class="row_odd"'); - } - + } Display::$global_template->assign('pdf_table', $table->toHtml()); @@ -849,16 +826,17 @@ function export_pdf_flatview($cat, $users, $alleval, $alllinks, $params = array( //Header $html = $gradebook_flatview; - $html = api_utf8_encode($html); + $html = api_utf8_encode($html); $page_format = $params['orientation'] == 'landscape' ? 'A4-L' : 'A4'; $pdf = new PDF($page_format, $params['orientation']); - // Sending the created PDF report to the client - $file_name = date('YmdHi_', $time); + // Sending the created PDF report to the client + $file_name = null; if (!empty($course_code)) { - $file_name .= $course_code.'_'; + $file_name .= $course_code; } - $file_name .= get_lang('FlatView').'.pdf'; + $file_name = api_get_utc_datetime(); + $file_name = get_lang('FlatView').'_'.$file_name.'.pdf'; $pdf->content_to_pdf($html, $css, $file_name, api_get_course_id()); exit; } \ No newline at end of file diff --git a/main/lang/spanish/gradebook.inc.php b/main/lang/spanish/gradebook.inc.php index 06ddb6b4a9..ca07ab6745 100644 --- a/main/lang/spanish/gradebook.inc.php +++ b/main/lang/spanish/gradebook.inc.php @@ -80,7 +80,7 @@ $LinkDeleted = "El componente de evaluación ha sido eliminado"; $EditEvaluation = "Modificar componente de evaluación"; $DeleteResult = "Eliminar resultados"; $Display = "Nivel"; -$Average = "Media"; +$Average = "Promedio"; $ViewStatistics = "Ver estadísticas"; $ResultAdded = "Resultado añadido"; $EvaluationStatistics = "Estadísticas de evaluación"; @@ -103,9 +103,9 @@ $OverMax = "El valor que ha intentado guardar es superior al límite máximo est $MoreInfo = "Más información"; $ResultsPerUser = "Resultados por usuario"; $TotalUser = "Total por usuario"; -$AverageTotal = "Media total"; +$AverageTotal = "Promedio total"; $Evaluation = "Componente de evaluación"; -$EvaluationAverage = "Media de la evaluación"; +$EvaluationAverage = "Promedio de la evaluación"; $EditCategory = "Editar sus propiedades"; $EditAllWeights = "Editar ponderaciones"; $GradebookQualificationTotal = "Total"; @@ -133,7 +133,7 @@ $NoResultsAvailable = "No hay resultados disponibles"; $CannotChangeTheMaxNote = "No se puede cambiar la nota máxima"; $GradebookWeightUpdated = "Peso(s) modificado(s) correctamente"; $ChooseItem = "Seleccione un item"; -$AverageResultsVsResource = "Media de resultados por componente de evaluación"; +$AverageResultsVsResource = "Promedio de resultados por componente de evaluación"; $ToViewGraphScoreRuleMustBeEnabled = "Para ver el gráfico las reglas de puntuación deben haberse definido"; $GradebookPreviousWeight = "Ponderación previa"; $AddAssessment = "Crear"; diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index 02bca0d528..fc516c9648 100644 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -817,7 +817,7 @@ $AssignSessions = "Asignar sesiones de formación"; $Timezone = "Zona horaria"; $DashboardPluginsHaveBeenUpdatedSucesslly = "Los plugins del panel de control han sido actualizados correctamente"; $LoginEnter = "Entrar"; -$AttendanceSheetDescription = "Las listas de asistencia permiten registrar las faltas de asistencia de los estudiantes. En caso de ausencia de un estudiante, el profesor deberá registrarlo manualmente en la casilla correspondiente. +$AttendanceSheetDescription = "Las listas de asistencia permiten registrar las faltas de asistencia de los estudiantes. En caso de ausencia de un estudiante, el profesor deberá registrarlo manualmente en la casilla correspondiente. Es posible crear más de una lista de asistencia por cada curso; así por ejemplo, podrá registrar separadamente la asistencia a las clases teóricas y prácticas."; $ThereAreNoRegisteredLearnersInsidetheCourse = "No hay estudiantes inscritos en este curso"; $GoToAttendanceCalendarList = "Ir al calendario de asistencia"; @@ -928,14 +928,14 @@ $SendInformation = "Enviar la información"; $YouMustAcceptLicence = "Debe aceptar la licencia para poder usar este software"; $SelectOne = "Seleccione uno"; $ContactInformationHasBeenSent = "Información de contacto enviada"; -$ContactInformationDescription = "Estimado usuario, - -está a punto de instalar una de las mejores plataformas e-learning de código abierto que existen en el mercado. Al igual de muchos otros proyectos de código abierto, Chamilo está respaldado por una amplia comunidad de profesores, estudiantes, desarrolladores y creadores de contenido. - -Si sabemos algo más de quien va a gestionar este sistema e-learning, podremos dar a conocer a otros que nuestro software lo utiliza y a usted podremos informarle sobre eventos que pueden ser de su interés. - -Cumplimentar este formulario, implica la aceptación de que la asociación Chamilo o sus miembros puedan enviarle información por correo electrónico sobre eventos importantes o actualizaciones en el software Chamilo. Esto ayudará a crecer a la comunidad como una entidad organizada, donde el flujo de información, se haga con respeto permanente a su tiempo y su privacidad. - +$ContactInformationDescription = "Estimado usuario, + +está a punto de instalar una de las mejores plataformas e-learning de código abierto que existen en el mercado. Al igual de muchos otros proyectos de código abierto, Chamilo está respaldado por una amplia comunidad de profesores, estudiantes, desarrolladores y creadores de contenido. + +Si sabemos algo más de quien va a gestionar este sistema e-learning, podremos dar a conocer a otros que nuestro software lo utiliza y a usted podremos informarle sobre eventos que pueden ser de su interés. + +Cumplimentar este formulario, implica la aceptación de que la asociación Chamilo o sus miembros puedan enviarle información por correo electrónico sobre eventos importantes o actualizaciones en el software Chamilo. Esto ayudará a crecer a la comunidad como una entidad organizada, donde el flujo de información, se haga con respeto permanente a su tiempo y su privacidad. + De cualquier forma, tenga en cuenta que no tiene la obligación de rellenar este formulario. Si desea permanecer en el anonimato, perderemos la oportunidad de ofrecerle todos los privilegios de ser un administrador de portal registrado, pero respetaremos su decisión. Basta con dejar vacío este formulario y hacer clic en \"Siguiente\" para seguir instalando Chamilo."; $CompanyActivity = "Sector"; $DateUnLock = "Desbloquear fecha"; @@ -1133,11 +1133,11 @@ $CertificateOnlineLink = "Vínculo al certificado en línea"; $NewExercises = "Nuevo ejercicio"; $MyAverage = "Mi promedio"; $AllAttempts = "Todos los intentos"; -$NoCookies = "Las cookies no están activadas en su navegador. +$NoCookies = "Las cookies no están activadas en su navegador. Chamilo utiliza \"cookies\" para almacenar sus datos de conexión, por lo que no le será posible entrar si las cookies no están habilitadas. Por favor, cambie la configuración de su navegador y recargue esta página."; -$NoJavascript = "Su navegador no tiene activado JavaScript. +$NoJavascript = "Su navegador no tiene activado JavaScript. Chamilo se sirve de JavaScript para proporcionar un interfaz más dinámico. Es probable que muchas prestaciones sigan funcionando pero otras no lo harán, especialmente las relacionadas con la usabilidad. Le recomendamos que cambie la configuración de su navegador y recargue esta página."; -$NoFlash = "Su navegador no tiene activado el soporte de Flash. +$NoFlash = "Su navegador no tiene activado el soporte de Flash. Chamilo sólo se apoya en Flash para algunas de sus funciones por lo que su ausencia no le impedirá continuar. Pero si quiere beneficiarse del conjunto de las herramientas de Chamilo, le recomendamos que instale-active el plugin de Flash y reinicialice su navegador."; $Attempt = "Intento"; $SaveForNow = "Guardar y continuar más tarde"; @@ -1217,7 +1217,7 @@ $LoginX = "Nombre de usuario: %s"; $ChatConnected = "Chat (Conectado)"; $ChatDisconnected = "Chat (Desconectado)"; $ThingsToDo = "Actividades por realizar"; -$WamiFlashDialog = "Se mostrará un cuadro de diálogo en el que se le pedirá permiso para poder acceder al micrófono, responda afirmativamente y cierre el cuadro de diálogo (si no desea que vuelva a aparecer, antes de cerrar marque la opción +$WamiFlashDialog = "Se mostrará un cuadro de diálogo en el que se le pedirá permiso para poder acceder al micrófono, responda afirmativamente y cierre el cuadro de diálogo (si no desea que vuelva a aparecer, antes de cerrar marque la opción recordar)"; $WamiStartRecorder = "Inicie la grabación pulsando el micrófono y deténgala pulsándolo de nuevo. Cada vez que haga esto se generará un archivo."; $InputNameHere = "Escriba el nombre aquí"; @@ -1232,4 +1232,5 @@ $CourseList = "Lista de cursos"; $NumberAbbreviation = "N°"; $FirstnameAndLastname = "Nombres y Apellidos"; $LastnameAndFirstname = "Apellidos y Nombres"; +$Detailed = "Detallado"; ?> \ No newline at end of file From 0af91f72e6f4876a7339adb5edf94905a1dd315b Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 16 May 2012 13:02:49 +0200 Subject: [PATCH 05/18] More PDF fixes see BT#4080 --- main/gradebook/lib/gradebook_functions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/gradebook/lib/gradebook_functions.inc.php b/main/gradebook/lib/gradebook_functions.inc.php index ad18b3e9fa..39524a4992 100644 --- a/main/gradebook/lib/gradebook_functions.inc.php +++ b/main/gradebook/lib/gradebook_functions.inc.php @@ -836,7 +836,7 @@ function export_pdf_flatview($cat, $users, $alleval, $alllinks, $params = array( $file_name .= $course_code; } $file_name = api_get_utc_datetime(); - $file_name = get_lang('FlatView').'_'.$file_name.'.pdf'; + $file_name = get_lang('FlatView').'_'.$file_name; $pdf->content_to_pdf($html, $css, $file_name, api_get_course_id()); exit; } \ No newline at end of file From 7bb6adaba0d1e67a62e28987ef9fb69974584484 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 16 May 2012 13:55:55 +0200 Subject: [PATCH 06/18] Adding nice badges in gradebook see BT#8040 --- main/css/base.css | 34 +++++++++++++++++++ main/gradebook/gradebook_flatview.php | 11 +++--- .../gradebook/lib/fe/gradebooktable.class.php | 11 +++--- .../lib/flatview_data_generator.class.php | 2 +- .../gradebook/lib/gradebook_functions.inc.php | 18 ++++++++++ main/inc/lib/display.lib.php | 13 +++++-- 6 files changed, 74 insertions(+), 15 deletions(-) diff --git a/main/css/base.css b/main/css/base.css index da845e1f50..7cf8bd87a8 100644 --- a/main/css/base.css +++ b/main/css/base.css @@ -57,6 +57,40 @@ label, input, button, select, textarea, p { font-size: inherit; } +.badge-group { + width: 200px; + position: relative; +} + +.badge-group .badge { + float:left; + position:relative; +} + +.badge-group > :first-child { + z-index: 1000; +} + +.badge-group > :nth-child(2) { + z-index: 900; +} + +.badge-group > :nth-child(3) { + z-index: 800; +} +.badge-group > :nth-child(4) { + z-index: 700; +} +.badge-group > :nth-child(5) { + z-index: 600; +} + + +.badge-group .badge:not(:first-child) { + margin-left: -13px; + padding-left: 15px; +} + /* button with image */ button.add, button.save, button.cancel, button.refresh, button.upload, button.search, button.login, button.plus, button.minus, button.next, button.back { padding-left:30px; diff --git a/main/gradebook/gradebook_flatview.php b/main/gradebook/gradebook_flatview.php index 336038dc1f..85f4e3fd40 100644 --- a/main/gradebook/gradebook_flatview.php +++ b/main/gradebook/gradebook_flatview.php @@ -105,8 +105,7 @@ if (isset($_GET['export_pdf']) && $_GET['export_pdf'] == 'category') { $params['only_total_category'] = true; $params['join_firstname_lastname'] = true; $params['show_official_code'] = true; - $params['export_pdf'] = true; - + $params['export_pdf'] = true; if ($cat[0]->is_locked() == true || api_is_platform_admin()) { Display :: set_header(null, false, false); export_pdf_flatview($cat, $users, $alleval, $alllinks, $params); @@ -122,10 +121,11 @@ if (isset($_GET['exportpdf'])) { $export_pdf_form = new DataForm(DataForm::TYPE_EXPORT_PDF, 'export_pdf_form', null, api_get_self().'?exportpdf=&offset='.intval($_GET['offset']).'&selectcat='.intval($_GET['selectcat']), '_blank', ''); if ($export_pdf_form->validate()) { + $params = array(); $params = $export_pdf_form->exportValues(); Display :: set_header(null, false, false); - $params['join_firstname_lastname'] = true; - $params['show_usercode'] = true; + $params['join_firstname_lastname'] = true; + $params['show_official_code'] = true; $params['export_pdf'] = true; $params['only_total_category'] = false; export_pdf_flatview($cat, $users, $alleval, $alllinks, $params); @@ -138,8 +138,7 @@ if (isset ($_GET['print'])) { $printable_data = get_printable_data($cat[0], $users, $alleval, $alllinks); echo print_table($printable_data[1],$printable_data[0], get_lang('FlatView'), $cat[0]->get_name()); exit; -} - +} if (!empty($_GET['export_report']) && $_GET['export_report'] == 'export_report') { if (api_is_platform_admin() || api_is_course_admin() || api_is_course_coach()) { diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php index 0dea59e162..61c0fb3ef6 100644 --- a/main/gradebook/lib/fe/gradebooktable.class.php +++ b/main/gradebook/lib/fe/gradebooktable.class.php @@ -319,13 +319,12 @@ class GradebookTable extends SortableTable { if (!empty($data_array)) { if (api_is_allowed_to_edit()) { $main_weight = intval($main_cat[0]->get_weight()); - if (intval($total_weight) == $main_weight) { - //$label = Display::return_icon('accept.png', get_lang('Ok')); + if (intval($total_weight) == $main_weight) { $label = null; - $total = Display::badge($total_weight.' / '.$main_weight, 'success'); + $total = score_badges(array($total_weight.' / '.$main_weight, '100%')); } else { $label = Display::return_icon('warning.png', sprintf(get_lang('TotalWeightMustBeX'), $main_weight) ); - $total = Display::badge($total_weight.' / '.$main_weight, 'warning'); + $total = Display::badge($total_weight.' / '.$main_weight, 'warning'); } $row = array(null, null, "     
".get_lang('SubTotal').'
',null, $total.' '.$label, 'child_of' =>$parent_id); $sortable_data[] = $row; @@ -337,8 +336,8 @@ class GradebookTable extends SortableTable { if (api_is_allowed_to_edit()) { if (count($main_cat) > 1) { $main_weight = intval($main_cat[0]->get_weight()); - if (intval($total_categories_weight) == $main_weight) { - $total = Display::badge($total_categories_weight.' / '.$main_weight, 'success'); + if (intval($total_categories_weight) == $main_weight) { + $total = score_badges(array($total_categories_weight.' / '.$main_weight, '100%')); } else { $total = Display::badge($total_categories_weight.' / '.$main_weight, 'warning'); } diff --git a/main/gradebook/lib/flatview_data_generator.class.php b/main/gradebook/lib/flatview_data_generator.class.php index 7a7d32ad0d..a31b48143c 100644 --- a/main/gradebook/lib/flatview_data_generator.class.php +++ b/main/gradebook/lib/flatview_data_generator.class.php @@ -121,7 +121,7 @@ class FlatViewDataGenerator $headers[] = Display::url($sub_cat->get_name(), api_get_self().'?selectcat='.$sub_cat->get_id()).$add_weight; } } else { - if (!isset($this->params['only_total_category'])) { + if (!isset($this->params['only_total_category']) || (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)) { for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) { $item = $this->evals_links[$count + $items_start]; $sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()]; diff --git a/main/gradebook/lib/gradebook_functions.inc.php b/main/gradebook/lib/gradebook_functions.inc.php index 39524a4992..2e865823ae 100644 --- a/main/gradebook/lib/gradebook_functions.inc.php +++ b/main/gradebook/lib/gradebook_functions.inc.php @@ -839,4 +839,22 @@ function export_pdf_flatview($cat, $users, $alleval, $alllinks, $params = array( $file_name = get_lang('FlatView').'_'.$file_name; $pdf->content_to_pdf($html, $css, $file_name, api_get_course_id()); exit; +} + +function score_badges($list_values) { + $counter = 1; + $badges = array(); + foreach ($list_values as $value) { + $class = 'info'; + if ($counter == 1) { + $class = 'success'; + } + $counter++; + $badges[] = Display::badge($value, $class); + + } + return Display::badge_group($badges); + + + } \ No newline at end of file diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 6573a4bfaf..7302810570 100644 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -1383,7 +1383,7 @@ class Display { return $div; } - function badge($count, $type ="warning") { + function badge($count, $type ="warning") { $class = ''; switch ($type) { @@ -1404,12 +1404,21 @@ class Display { break; } - if (!empty($count)) { + if (!empty($count)) { return ' '.$count.''; } return null; } + function badge_group($badge_list) { + $html = '
'; + foreach ($badge_list as $badge) { + $html .= $badge; + } + $html .= '
'; + return $html; + } + function label($content, $type = null) { $class = ''; switch ($type) { From de6eb28b0722ff204f048cb37114111d9fefe1f5 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 16 May 2012 14:35:28 +0200 Subject: [PATCH 07/18] Updating lang var english/spanish --- main/lang/english/admin.inc.php | 4 +++- main/lang/english/gradebook.inc.php | 1 + main/lang/english/trad4all.inc.php | 3 +++ main/lang/spanish/admin.inc.php | 2 ++ main/lang/spanish/gradebook.inc.php | 1 + main/lang/spanish/trad4all.inc.php | 28 +++++++++++++++------------- 6 files changed, 25 insertions(+), 14 deletions(-) diff --git a/main/lang/english/admin.inc.php b/main/lang/english/admin.inc.php index 28784639b6..8db0a1d276 100644 --- a/main/lang/english/admin.inc.php +++ b/main/lang/english/admin.inc.php @@ -2,7 +2,7 @@ /* for more information: see languages.txt in the lang folder. */ -$CasMainActivateComment = "Enabling CAS authentication will allow users to authenticate with their CAS credentials"; +$CasMainActivateComment = "Enabling CAS authentication will allow users to authenticate with their CAS credentials.
Go to Plugin to add a configurable 'CAS Login' button for your Chamilo campus."; $AdminBy = "Administration by"; $AdministrationTools = "Administration"; $State = "Portal status"; @@ -1540,4 +1540,6 @@ $GradebookDefaultWeightTitle = "Default weight in Gradebook"; $GradebookDefaultWeightComment = "This weight will be use in all courses by default"; $TeachersCanChangeScoreSettingsTitle = "Teachers can change the Gradebook score settings"; $TeachersCanChangeScoreSettingsComment = "When editing the Gradebook settings"; +$GradebookEnableLockingTitle = "Enable locking of assessments by teachers"; +$GradebookEnableLockingComment = "Once enabled, this option will enable locking of any assessment by the teachers of the corresponding course. This, in turn, will prevent any modification of results by the teacher inside the resources used in the assessment: exams, learning paths, tasks, etc. The only role authorized to unlock a locked assessment is the administrator. The teacher will be informed of this possibility. The locking and unlocking of gradebooks will be registered in the system's report of important activities"; ?> \ No newline at end of file diff --git a/main/lang/english/gradebook.inc.php b/main/lang/english/gradebook.inc.php index b6965f727a..2806bdf65f 100644 --- a/main/lang/english/gradebook.inc.php +++ b/main/lang/english/gradebook.inc.php @@ -232,4 +232,5 @@ $SelectGradeModel = "Select a calification model"; $AllMustWeight100 = "The sum of all values must be 100"; $Components = "Components"; $OnlyActiveWhenThereAreAnyComponents = "This option is enabled if you have any evaluations or categories"; +$GradebookLockedAlert = "This assessment has been locked. You cannot unlock it. If you really need to unlock it, please contact the platform administrator, explaining the reason why you would need to do that (it might otherwise be considered as fraud attempt)."; ?> \ No newline at end of file diff --git a/main/lang/english/trad4all.inc.php b/main/lang/english/trad4all.inc.php index d41920b9e2..1b9ce2111a 100644 --- a/main/lang/english/trad4all.inc.php +++ b/main/lang/english/trad4all.inc.php @@ -1227,4 +1227,7 @@ $CourseList = "Course list"; $NumberAbbreviation = "N°"; $FirstnameAndLastname = "First Name and Last Name"; $LastnameAndFirstname = "Last Name and First Name"; +$Plugins = "Plugins"; +$Detailed = "Detailed"; +$ResourceLockedByGradebook = "This option is not available because this activity is contained by an assessment, which is currently locked. To unlock the assessment, ask your platform administrator."; ?> \ No newline at end of file diff --git a/main/lang/spanish/admin.inc.php b/main/lang/spanish/admin.inc.php index 22e2c4bc0f..ccd7e901b5 100644 --- a/main/lang/spanish/admin.inc.php +++ b/main/lang/spanish/admin.inc.php @@ -1543,4 +1543,6 @@ $GradebookDefaultWeightTitle = "Peso total por defecto en la herramienta \"Evalu $GradebookDefaultWeightComment = "Este peso será utilizado en todos los cursos"; $TeachersCanChangeScoreSettingsTitle = "Los profesores pueden cambiar la configuración de puntuación de las Evaluaciones"; $TeachersCanChangeScoreSettingsComment = "Al editar la configuración de las Evaluaciones"; +$GradebookEnableLockingTitle = "Activar bloqueo de Evaluaciones por los profesores"; +$GradebookEnableLockingComment = "Una vez activada, esta opción permitirá a los profesores bloquear cualquier evaluación dentro de su curso. Esto prohibirá al profesor cualquier modificación posterior de los resultados de sus alumnos en los recursos usados para esta evaluación: exámenes, lecciones, tareas, etc. El único rol autorizado a desbloquear una evaluación es el administrador. El profesor estará informado de esta posibilidad al intentar desbloquear la evaluación. El bloqueo como el desbloqueo estarán guardados en el registro de actividades importantes del sistema."; ?> \ No newline at end of file diff --git a/main/lang/spanish/gradebook.inc.php b/main/lang/spanish/gradebook.inc.php index ca07ab6745..d6a4df1bdf 100644 --- a/main/lang/spanish/gradebook.inc.php +++ b/main/lang/spanish/gradebook.inc.php @@ -232,4 +232,5 @@ $SelectGradeModel = "Seleccionar un modelo de calificación"; $AllMustWeight100 = "La suma debe ser de 100"; $Components = "Componentes"; $OnlyActiveWhenThereAreAnyComponents = "Esta opción está habilitada si tiene evaluaciones o categorías"; +$GradebookLockedAlert = "Esta evaluación ha sido bloqueada y no puede ser desbloqueada. Si necesita realmente desbloquearla, por favor contacte el administrador de la plataforma, explicando su razón (sino podría ser considerado como un intento de fraude)."; ?> \ No newline at end of file diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index fc516c9648..eb526a741e 100644 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -817,7 +817,7 @@ $AssignSessions = "Asignar sesiones de formación"; $Timezone = "Zona horaria"; $DashboardPluginsHaveBeenUpdatedSucesslly = "Los plugins del panel de control han sido actualizados correctamente"; $LoginEnter = "Entrar"; -$AttendanceSheetDescription = "Las listas de asistencia permiten registrar las faltas de asistencia de los estudiantes. En caso de ausencia de un estudiante, el profesor deberá registrarlo manualmente en la casilla correspondiente. +$AttendanceSheetDescription = "Las listas de asistencia permiten registrar las faltas de asistencia de los estudiantes. En caso de ausencia de un estudiante, el profesor deberá registrarlo manualmente en la casilla correspondiente. Es posible crear más de una lista de asistencia por cada curso; así por ejemplo, podrá registrar separadamente la asistencia a las clases teóricas y prácticas."; $ThereAreNoRegisteredLearnersInsidetheCourse = "No hay estudiantes inscritos en este curso"; $GoToAttendanceCalendarList = "Ir al calendario de asistencia"; @@ -928,14 +928,14 @@ $SendInformation = "Enviar la información"; $YouMustAcceptLicence = "Debe aceptar la licencia para poder usar este software"; $SelectOne = "Seleccione uno"; $ContactInformationHasBeenSent = "Información de contacto enviada"; -$ContactInformationDescription = "Estimado usuario, - -está a punto de instalar una de las mejores plataformas e-learning de código abierto que existen en el mercado. Al igual de muchos otros proyectos de código abierto, Chamilo está respaldado por una amplia comunidad de profesores, estudiantes, desarrolladores y creadores de contenido. - -Si sabemos algo más de quien va a gestionar este sistema e-learning, podremos dar a conocer a otros que nuestro software lo utiliza y a usted podremos informarle sobre eventos que pueden ser de su interés. - -Cumplimentar este formulario, implica la aceptación de que la asociación Chamilo o sus miembros puedan enviarle información por correo electrónico sobre eventos importantes o actualizaciones en el software Chamilo. Esto ayudará a crecer a la comunidad como una entidad organizada, donde el flujo de información, se haga con respeto permanente a su tiempo y su privacidad. - +$ContactInformationDescription = "Estimado usuario, + +está a punto de instalar una de las mejores plataformas e-learning de código abierto que existen en el mercado. Al igual de muchos otros proyectos de código abierto, Chamilo está respaldado por una amplia comunidad de profesores, estudiantes, desarrolladores y creadores de contenido. + +Si sabemos algo más de quien va a gestionar este sistema e-learning, podremos dar a conocer a otros que nuestro software lo utiliza y a usted podremos informarle sobre eventos que pueden ser de su interés. + +Cumplimentar este formulario, implica la aceptación de que la asociación Chamilo o sus miembros puedan enviarle información por correo electrónico sobre eventos importantes o actualizaciones en el software Chamilo. Esto ayudará a crecer a la comunidad como una entidad organizada, donde el flujo de información, se haga con respeto permanente a su tiempo y su privacidad. + De cualquier forma, tenga en cuenta que no tiene la obligación de rellenar este formulario. Si desea permanecer en el anonimato, perderemos la oportunidad de ofrecerle todos los privilegios de ser un administrador de portal registrado, pero respetaremos su decisión. Basta con dejar vacío este formulario y hacer clic en \"Siguiente\" para seguir instalando Chamilo."; $CompanyActivity = "Sector"; $DateUnLock = "Desbloquear fecha"; @@ -1133,11 +1133,11 @@ $CertificateOnlineLink = "Vínculo al certificado en línea"; $NewExercises = "Nuevo ejercicio"; $MyAverage = "Mi promedio"; $AllAttempts = "Todos los intentos"; -$NoCookies = "Las cookies no están activadas en su navegador. +$NoCookies = "Las cookies no están activadas en su navegador. Chamilo utiliza \"cookies\" para almacenar sus datos de conexión, por lo que no le será posible entrar si las cookies no están habilitadas. Por favor, cambie la configuración de su navegador y recargue esta página."; -$NoJavascript = "Su navegador no tiene activado JavaScript. +$NoJavascript = "Su navegador no tiene activado JavaScript. Chamilo se sirve de JavaScript para proporcionar un interfaz más dinámico. Es probable que muchas prestaciones sigan funcionando pero otras no lo harán, especialmente las relacionadas con la usabilidad. Le recomendamos que cambie la configuración de su navegador y recargue esta página."; -$NoFlash = "Su navegador no tiene activado el soporte de Flash. +$NoFlash = "Su navegador no tiene activado el soporte de Flash. Chamilo sólo se apoya en Flash para algunas de sus funciones por lo que su ausencia no le impedirá continuar. Pero si quiere beneficiarse del conjunto de las herramientas de Chamilo, le recomendamos que instale-active el plugin de Flash y reinicialice su navegador."; $Attempt = "Intento"; $SaveForNow = "Guardar y continuar más tarde"; @@ -1217,7 +1217,7 @@ $LoginX = "Nombre de usuario: %s"; $ChatConnected = "Chat (Conectado)"; $ChatDisconnected = "Chat (Desconectado)"; $ThingsToDo = "Actividades por realizar"; -$WamiFlashDialog = "Se mostrará un cuadro de diálogo en el que se le pedirá permiso para poder acceder al micrófono, responda afirmativamente y cierre el cuadro de diálogo (si no desea que vuelva a aparecer, antes de cerrar marque la opción +$WamiFlashDialog = "Se mostrará un cuadro de diálogo en el que se le pedirá permiso para poder acceder al micrófono, responda afirmativamente y cierre el cuadro de diálogo (si no desea que vuelva a aparecer, antes de cerrar marque la opción recordar)"; $WamiStartRecorder = "Inicie la grabación pulsando el micrófono y deténgala pulsándolo de nuevo. Cada vez que haga esto se generará un archivo."; $InputNameHere = "Escriba el nombre aquí"; @@ -1232,5 +1232,7 @@ $CourseList = "Lista de cursos"; $NumberAbbreviation = "N°"; $FirstnameAndLastname = "Nombres y Apellidos"; $LastnameAndFirstname = "Apellidos y Nombres"; +$Plugins = "Plugins"; $Detailed = "Detallado"; +$ResourceLockedByGradebook = "Esta opción no está disponible porque la actividad está incluida en una evaluación que se encuentra bloqueada. Para desbloquear esta evaluación, comuníquese con el administrador de la plataforma."; ?> \ No newline at end of file From 2328b4ed1dc4d3e7e3ae36b102bf462882b10250 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 16 May 2012 14:35:47 +0200 Subject: [PATCH 08/18] Minor - Adding Database::escape_string --- main/inc/lib/main_api.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/inc/lib/main_api.lib.php b/main/inc/lib/main_api.lib.php index 62aac76513..5cb5814cbf 100644 --- a/main/inc/lib/main_api.lib.php +++ b/main/inc/lib/main_api.lib.php @@ -5736,13 +5736,14 @@ function api_resource_is_locked_by_gradebook($item_id, $link_type, $course_code if (api_is_platform_admin()) { return false; } - if (api_get_setting('gradebook_locking_enabled') == 'true') { + if (api_get_setting('gradebook_locking_enabled') == 'true') { if (empty($course_code)) { $course_code = api_get_course_id(); } $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); $item_id = intval($item_id); $link_type = intval($link_type); + $course_code = Database::escape_string($course_code); $sql = "SELECT locked FROM $table WHERE locked = 1 AND ref_id = $item_id AND type = $link_type AND course_code = '$course_code' "; $result = Database::query($sql); if (Database::num_rows($result)) { From 50e5a253ec92cf9aa8a1856b1adf1432b6a44917 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 16 May 2012 16:09:15 +0200 Subject: [PATCH 09/18] Fixes js not found when using wiris --- main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/lang/en.js | 0 main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/lang/es.js | 0 main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/lang/fr.js | 0 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/lang/en.js create mode 100644 main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/lang/es.js create mode 100644 main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/lang/fr.js diff --git a/main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/lang/en.js b/main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/lang/en.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/lang/es.js b/main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/lang/es.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/lang/fr.js b/main/inc/lib/fckeditor/editor/plugins/fckeditor_wiris/lang/fr.js new file mode 100644 index 0000000000..e69de29bb2 From bfe9b2d8597ed9f9caef6cf2fd4d8303fc32bebe Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 16 May 2012 16:40:00 +0200 Subject: [PATCH 10/18] Fixes PHP warnings --- main/inc/lib/grade_model.lib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/inc/lib/grade_model.lib.php b/main/inc/lib/grade_model.lib.php index b1a4c9e7b2..a786e70634 100644 --- a/main/inc/lib/grade_model.lib.php +++ b/main/inc/lib/grade_model.lib.php @@ -157,8 +157,8 @@ class GradeModel extends Model { return null; } - public function save($params) { - $id = parent::save($params); + public function save($params, $show_query = false) { + $id = parent::save($params, $show_query); if (!empty($id)) { foreach ($params['components'] as $component) { if (!empty($component['title']) && !empty($component['percentage']) && !empty($component['acronym'])) { @@ -203,8 +203,8 @@ class GradeModelComponents extends Model { $this->table = Database::get_main_table(TABLE_GRADE_MODEL_COMPONENTS); } - public function save($params) { - $id = parent::save($params); + public function save($params, $show_query = false) { + $id = parent::save($params, $show_query); return $id; } } \ No newline at end of file From 6c91506111b13ea7f9bd7bdc8debbbf1ccbe2a6b Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 16 May 2012 17:06:30 +0200 Subject: [PATCH 11/18] Minor code style changes --- main/exercice/fill_blanks.class.php | 36 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/main/exercice/fill_blanks.class.php b/main/exercice/fill_blanks.class.php index 25f69e60f2..cc2e3222eb 100644 --- a/main/exercice/fill_blanks.class.php +++ b/main/exercice/fill_blanks.class.php @@ -43,11 +43,10 @@ class FillBlanks extends Question * function which redifines Question::createAnswersForm * @param the formvalidator instance */ - function createAnswersForm ($form) - { + function createAnswersForm ($form) { $defaults = array(); - if(!empty($this->id)) { + if (!empty($this->id)) { $objAnswer = new answer($this->id); // the question is encoded like this @@ -78,31 +77,32 @@ class FillBlanks extends Question } // javascript - echo '