Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent c839677b8c
commit 76633e45c4
  1. 7
      main/document/slideshow.php
  2. 16
      main/gradebook/gradebook_add_cat.php
  3. 30
      main/gradebook/gradebook_add_eval.php
  4. 27
      main/gradebook/gradebook_add_link.php
  5. 20
      main/gradebook/gradebook_add_link_select_course.php
  6. 18
      main/gradebook/gradebook_add_result.php
  7. 1
      main/gradebook/gradebook_display_certificate.php
  8. 4
      main/gradebook/index.php
  9. 290
      main/gradebook/lib/fe/gradebooktable.class.php
  10. 3
      main/gradebook/lib/gradebook_data_generator.class.php
  11. 27
      main/gradebook/lib/gradebook_functions.inc.php
  12. 2
      main/inc/ajax/course.ajax.php
  13. 17
      main/inc/ajax/session.ajax.php
  14. 7
      main/inc/lib/CoursesAndSessionsCatalog.class.php
  15. 16
      main/inc/lib/formvalidator/FormValidator.class.php
  16. 7
      main/newscorm/lp_controller.php
  17. 22
      main/social/search.php
  18. 3
      main/wiki/index.php

@ -48,6 +48,7 @@ if (isset($_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;
@ -64,9 +65,11 @@ function MM_openBrWindow(theURL,winName,features) { //v2.0
<?php
if ($slide_id != 'all') {
$image = $sys_course_path.$_course['path'].'/document'.$folder.$image_files_only[$slide];
$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

@ -57,7 +57,7 @@ $(document).ready(function () {
});
function check_skills() {
//selecting only selected users
// selecting only selected users
$("#skills option:selected").each(function() {
var skill_id = $(this).val();
if (skill_id != "" ) {
@ -76,7 +76,7 @@ function check_skills() {
}
});
}
},
}
});
}
});
@ -98,7 +98,6 @@ if ($_in_course) {
}
$catadd->set_course_code(api_get_course_id());
$form = new CatForm(
CatForm :: TYPE_ADD,
$catadd,
@ -140,14 +139,17 @@ if ($form->validate()) {
}
$cat->set_visible($visible);
$result = $cat->add();
header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?addcat=&selectcat=' . $cat->get_parent_id());
header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?addcat=&selectcat=' . $cat->get_parent_id().'&'.api_get_cidreq());
exit;
}
if ( !$_in_course ) {
$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$get_select_cat,'name' => get_lang('Gradebook'));
if (!$_in_course) {
$interbreadcrumb[] = array (
'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$get_select_cat.'&'.api_get_cidreq(),
'name' => get_lang('Gradebook')
);
}
$interbreadcrumb[]= array ( 'url' =>'index.php','name' => get_lang('ToolGradebook'));
$interbreadcrumb[]= array( 'url' =>'index.php','name' => get_lang('ToolGradebook'));
Display :: display_header(get_lang('NewCategory'));
$display_form = true;

@ -1,6 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
@ -29,7 +29,14 @@ if (isset($_GET['selectcat']) && (!empty($_GET['selectcat']))) {
$evaladd->set_category_id(0);
}
$form = new EvalForm(EvalForm :: TYPE_ADD, $evaladd, null, 'add_eval_form', null, api_get_self() . '?selectcat=' . $select_cat);
$form = new EvalForm(
EvalForm :: TYPE_ADD,
$evaladd,
null,
'add_eval_form',
null,
api_get_self() . '?selectcat=' . $select_cat.'&'.api_get_cidreq()
);
if ($form->validate()) {
$values = $form->exportValues();
@ -51,7 +58,6 @@ if ($form->validate()) {
//$values['weight'] = $values['weight_mask']/$global_weight*$parent_cat[0]->get_weight();
$values['weight'] = $values['weight_mask'];
$eval->set_weight($values['weight']);
$eval->set_max($values['max']);
@ -68,32 +74,30 @@ if ($form->validate()) {
//header('Location: gradebook_add_user.php?selecteval=' . $eval->get_id());
exit;
} else {
header('Location: ' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $eval->get_category_id());
header('Location: ' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $eval->get_category_id().'&'.api_get_cidreq());
exit;
}
} else {
$val_addresult = isset($values['addresult']) ? $values['addresult'] : null;
if ($val_addresult == 1) {
header('Location: gradebook_add_result.php?selecteval=' . $eval->get_id());
header('Location: gradebook_add_result.php?selecteval=' . $eval->get_id().'&'.api_get_cidreq());
exit;
} else {
header('Location: ' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $eval->get_category_id());
header('Location: ' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $eval->get_category_id().'&'.api_get_cidreq());
exit;
}
}
}
$interbreadcrumb[] = array(
'url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $select_cat,
'name' => get_lang('Gradebook'
));
'url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $select_cat.'&'.api_get_cidreq(),
'name' => get_lang('Gradebook'))
;
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = '<script type="text/javascript">
$(document).ready( function() {
$("#hid_category_id").change(function(){
$("#hid_category_id").change(function() {
$("#hid_category_id option:selected").each(function () {
var cat_id = $(this).val();
$.ajax({
@ -103,7 +107,7 @@ $(document).ready( function() {
if (return_value != 0 ) {
$("#max_weight").html(return_value);
}
},
}
});
});
});

@ -34,7 +34,7 @@ if ($session_id == 0) {
$all_categories = Category::load_session_categories(null, $session_id);
}
$category = Category :: load($_GET['selectcat']);
$url = api_get_self().'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&newtypeselected='.$typeSelected.'&course_code='.api_get_course_id();
$url = api_get_self().'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&newtypeselected='.$typeSelected.'&course_code='.api_get_course_id().'&'.api_get_cidreq();
$typeform = new LinkForm(LinkForm :: TYPE_CREATE, $category[0], null, 'create_link', null, $url, $typeSelected);
// if user selected a link type
@ -87,8 +87,10 @@ if (isset($typeSelected) && $typeSelected != '0') {
$link->set_visible(empty($addvalues['visible']) ? 0 : 1);
// Update view_properties
if (isset($typeSelected) && 5 == $typeSelected && (isset($addvalues['select_link']) && $addvalues['select_link'] <> "")) {
if (isset($typeSelected) &&
5 == $typeSelected &&
(isset($addvalues['select_link']) && $addvalues['select_link'] <> "")
) {
$sql1 = 'SELECT thread_title from '.$tbl_forum_thread.'
WHERE c_id = '.$course_info['real_id'].' AND thread_id='.$addvalues['select_link'];
$res1 = Database::query($sql1);
@ -100,32 +102,35 @@ if (isset($typeSelected) && $typeSelected != '0') {
$row = Database::fetch_row($res_l);
if ($row[0] == 0) {
$link->add();
$sql = 'UPDATE '.$tbl_forum_thread.' SET thread_qualify_max='.$addvalues['weight'].',thread_weight='.$addvalues['weight'].',thread_title_qualify="'.$rowtit[0].'"
$sql = 'UPDATE '.$tbl_forum_thread.' SET
thread_qualify_max='.$addvalues['weight'].',
thread_weight='.$addvalues['weight'].',
thread_title_qualify="'.$rowtit[0].'"
WHERE thread_id='.$addvalues['select_link'].' AND c_id = '.$course_info['real_id'].' ';
Database::query($sql);
}
}
$link->add();
$addvalue_result = !empty($addvalues['addresult']) ? $addvalues['addresult'] : array();
if ($addvalue_result == 1) {
header('Location: gradebook_add_result.php?selecteval='.$link->get_ref_id());
header('Location: gradebook_add_result.php?selecteval='.$link->get_ref_id().'&'.api_get_cidreq());
exit;
} else {
header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?linkadded=&selectcat='.Security::remove_XSS($_GET['selectcat']));
header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?linkadded=&selectcat='.Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq());
exit;
}
}
}
$interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'].'?selectcat='.Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array(
'url' => $_SESSION['gradebook_dest'].'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq(),
'name' => get_lang('Gradebook')
);
$this_section = SECTION_COURSES;
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
$("#hide_category_id").change(function() {
$("#hide_category_id option:selected").each(function () {
var cat_id = $(this).val();
@ -136,7 +141,7 @@ $(document).ready( function() {
if (return_value != 0 ) {
$("#max_weight").html(return_value);
}
},
}
});
});
});

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook
@ -18,25 +19,30 @@ api_block_anonymous_users();
block_students();
$catadd = new Category();
$catadd->set_user_id($_user['user_id']);
$catadd->set_user_id(api_get_user_id());
$catadd->set_parent_id($_GET['selectcat']);
$catcourse = Category :: load ($_GET['selectcat']);
//$catadd->set_course_code($catcourse[0]->get_course_code());
$form = new CatForm(CatForm :: TYPE_SELECT_COURSE, $catadd, 'add_cat_form', null, api_get_self().'?selectcat=' . Security::remove_XSS($_GET['selectcat']));
$form = new CatForm(
CatForm :: TYPE_SELECT_COURSE,
$catadd,
'add_cat_form',
null,
api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq()
);
if ($form->validate()) {
$values = $form->exportValues();
$cat = new Category();
$cat->set_course_code($values['select_course']);
$cat->set_name($values['name']);
header('location: gradebook_add_link.php?selectcat=' .Security::remove_XSS($_GET['selectcat']).'&course_code='.Security::remove_XSS($values['select_course']));
header('location: gradebook_add_link.php?selectcat=' .Security::remove_XSS($_GET['selectcat']).'&course_code='.Security::remove_XSS($values['select_course']).'&'.api_get_cidreq());
exit;
}
$interbreadcrumb[] = array (
'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']),
'name' => get_lang('Gradebook'
));
'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq(),
'name' => get_lang('Gradebook')
);
Display :: display_header(get_lang('NewCategory'));
$form->display();
Display :: display_footer();

@ -24,13 +24,20 @@ $resultadd = new Result();
$resultadd->set_evaluation_id($_GET['selecteval']);
$evaluation = Evaluation :: load($_GET['selecteval']);
$category = !empty($_GET['selectcat']) ? $_GET['selectcat'] : "";
$add_result_form = new EvalForm(EvalForm :: TYPE_RESULT_ADD, $evaluation[0], $resultadd, 'add_result_form', null, api_get_self() . '?selectcat=' . Security::remove_XSS($category) . '&selecteval=' . Security::remove_XSS($_GET['selecteval']));
$add_result_form = new EvalForm(
EvalForm :: TYPE_RESULT_ADD,
$evaluation[0],
$resultadd,
'add_result_form',
null,
api_get_self() . '?selectcat=' . Security::remove_XSS($category) . '&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq()
);
$table = $add_result_form->toHtml();
if ($add_result_form->validate()) {
$values = $add_result_form->exportValues();
$nr_users = $values['nr_users'];
if ($nr_users == '0') {
header('Location: gradebook_view_result.php?addresultnostudents=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
header('Location: gradebook_view_result.php?addresultnostudents=&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq());
exit;
}
$scores = ($values['score']);
@ -43,10 +50,13 @@ if ($add_result_form->validate()) {
$res->add();
next($scores);
}
header('Location: gradebook_view_result.php?addresult=&selecteval=' . Security::remove_XSS($_GET['selecteval']));
header('Location: gradebook_view_result.php?addresult=&selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq());
exit;
}
$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('Gradebook'));
$interbreadcrumb[] = array(
'url' => Security::remove_XSS($_SESSION['gradebook_dest']),
'name' => get_lang('Gradebook')
);
Display :: display_header(get_lang('AddResult'));
DisplayGradebook :: display_header_result ($evaluation[0], null, 0,0);
echo $table;

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script
* @package chamilo.gradebook

@ -9,7 +9,7 @@ $language_file = array('gradebook', 'exercice');
// $cidReset : This is the main difference with gradebook.php, here we say,
// basically, that we are inside a course, and many things depend from that
$cidReset= false;
//$cidReset = false;
$_in_course = true;
require_once '../inc/global.inc.php';
$current_course_tool = TOOL_GRADEBOOK;
@ -702,7 +702,7 @@ if (isset($_GET['studentoverview'])) {
}
unset($cats);
}
$cats = Category :: load ($category, null, null, null, null, null, false);
$cats = Category::load($category, null, null, null, null, null, false);
//with this fix the teacher only can view 1 gradebook
if (api_is_platform_admin()) {

@ -20,10 +20,15 @@ class GradebookTable extends SortableTable
/**
* Constructor
* @param Category $currentcat
* @param array $cats
* @param array $evals
* @param array $links
* @param null $addparams
*/
public function GradebookTable($currentcat, $cats = array(), $evals = array(), $links = array(), $addparams = null)
{
parent::__construct ('gradebooklist', null, null, (api_is_allowed_to_edit()?1:0));
parent::__construct('gradebooklist', null, null, (api_is_allowed_to_edit()?1:0));
$this->evals_links = array_merge($evals, $links);
$this->currentcat = $currentcat;
$this->cats = $cats;
@ -40,7 +45,6 @@ class GradebookTable extends SortableTable
$this->set_header($column++, get_lang('Type'), '', 'width="35px"');
$this->set_header($column++, get_lang('Name'), false);
$this->set_header($column++, get_lang('Description'), false);
if (api_is_allowed_to_edit(null, true)) {
@ -60,18 +64,18 @@ class GradebookTable extends SortableTable
}
// Deactivates the odd/even alt rows in order that the +/- buttons work see #4047
$this->odd_even_rows_enabled = false;
// Admins get an edit column.
if (api_is_allowed_to_edit(null, true)) {
$this->set_header($column++, get_lang('Modify'), false, 'width="195px"');
// Actions on multiple selected documents.
$this->set_form_actions(array (
'setvisible' => get_lang('SetVisible'),
'setinvisible' => get_lang('SetInvisible'),
'deleted' => get_lang('DeleteSelected')
));
$this->set_form_actions(array(
'setvisible' => get_lang('SetVisible'),
'setinvisible' => get_lang('SetInvisible'),
'deleted' => get_lang('DeleteSelected')
)
);
} else {
if (empty($_GET['selectcat']) && !api_is_allowed_to_edit()) {
$this->set_header($column++, get_lang('Certificates'), false);
@ -87,14 +91,14 @@ class GradebookTable extends SortableTable
return $this->datagen;
}
/**
* Function used by SortableTable to get total number of items in the table
/**
* Function used by SortableTable to get total number of items in the table
* @return int
*/
*/
public function get_total_number_of_items()
{
return $this->datagen->get_total_items_count();
}
return $this->datagen->get_total_items_count();
}
/**
* Function used by SortableTable to generate the data to display
@ -142,19 +146,21 @@ class GradebookTable extends SortableTable
}
// Status of user in course.
$user_id = api_get_user_id();
$course_code = api_get_course_id();
$session_id = api_get_session_id();
$status_user = api_get_status_of_user_in_course($user_id, $course_code);
$data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
$user_id = api_get_user_id();
$course_code = api_get_course_id();
$session_id = api_get_session_id();
$status_user = api_get_status_of_user_in_course($user_id, $course_code);
$data_array = $this->datagen->get_data(
$sorting,
$from,
$this->per_page
);
// generate the data to display
$sortable_data = array();
$weight_total_links = 0;
$main_categories = array();
$main_cat = Category::load(null, null, $course_code, null, null, $session_id, false);
$total_categories_weight = 0;
$scoredisplay = ScoreDisplay :: instance();
@ -204,6 +210,7 @@ class GradebookTable extends SortableTable
true
);
// Weight
if (api_is_allowed_to_edit(null, true)) {
$row[] = $invisibility_span_open .Display::tag('h4', $average).$invisibility_span_close;
} else {
@ -258,14 +265,11 @@ class GradebookTable extends SortableTable
$sortable_data[] = $row;
// Loading children
if (get_class($item) == 'Category') {
$stud_id = api_get_user_id();
$course_code = api_get_course_id();
$session_id = api_get_session_id();
$parent_id = $item->get_id();
$stud_id = api_get_user_id();
$course_code = api_get_course_id();
$session_id = api_get_session_id();
$parent_id = $item->get_id();
$cats = Category::load($parent_id, null, null, null, null, null);
if (isset($cats[0])) {
@ -275,13 +279,11 @@ class GradebookTable extends SortableTable
$sub_cat_info = new GradebookDataGenerator($allcat, $alleval, $alllink);
$data_array = $sub_cat_info->get_data($sorting, $from, $this->per_page);
$total_weight = 0;
// Links.
foreach ($data_array as $data) {
$row = array();
$row = array();
$item = $data[0];
//if the item is invisible, wrap it in a span with class invisible
@ -341,7 +343,6 @@ class GradebookTable extends SortableTable
}
}
$row['child_of'] = $parent_id;
$sortable_data[] = $row;
}
@ -406,7 +407,8 @@ class GradebookTable extends SortableTable
$weight_total_links > $weight_category
) {
$warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category);
$modify_icons = '<a class="right_link" href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'">'.Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL).'</a>';
$modify_icons = '<a class="right_link" href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'">'.
Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL).'</a>';
$warning_message .= $modify_icons;
Display::display_warning_message($warning_message, false);
}
@ -493,7 +495,7 @@ class GradebookTable extends SortableTable
*/
private function build_course_code ($item)
{
return $item->get_course_code();
return $item->get_course_code();
}
/**
@ -502,18 +504,18 @@ class GradebookTable extends SortableTable
*/
private function build_id_column ($item)
{
switch ($item->get_item_type()) {
// category
case 'C' :
return 'CATE' . $item->get_id();
// evaluation
case 'E' :
return 'EVAL' . $item->get_id();
// link
case 'L' :
return 'LINK' . $item->get_id();
}
}
switch ($item->get_item_type()) {
// category
case 'C' :
return 'CATE' . $item->get_id();
// evaluation
case 'E' :
return 'EVAL' . $item->get_id();
// link
case 'L' :
return 'LINK' . $item->get_id();
}
}
/**
* @param $item
@ -522,95 +524,95 @@ class GradebookTable extends SortableTable
*/
private function build_type_column ($item, $attributes = array())
{
return build_type_icon_tag($item->get_icon_name(), $attributes);
}
/**
* Generate name column
* @param unknown_type $item
* @return string
*/
private function build_name_link($item)
return build_type_icon_tag($item->get_icon_name(), $attributes);
}
/**
* Generate name column
* @param unknown_type $item
* @return string
*/
private function build_name_link($item)
{
$view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null;
switch ($item->get_item_type()) {
// category
case 'C' :
$prms_uri='?selectcat=' . $item->get_id() . '&amp;view='.$view;
if (isset($_GET['isStudentView'])) {
if ( isset($is_student) || ( isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview') ) {
$prms_uri=$prms_uri.'&amp;isStudentView='.Security::remove_XSS($_GET['isStudentView']);
}
}
$cat = new Category();
$show_message=$cat->show_message_resource_delete($item->get_course_code());
return '&nbsp;<a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).$prms_uri.'">'
. $item->get_name()
. '</a>'
. ($item->is_course() ? ' &nbsp;[' . $item->get_course_code() . ']'.$show_message : '');
// evaluation
case 'E' :
$cat = new Category();
$course_id = Database::get_course_by_category($_GET['selectcat']);
$show_message = $cat->show_message_resource_delete($course_id);
// course/platform admin can go to the view_results page
if (api_is_allowed_to_edit() && $show_message===false) {
if ($item->get_type() == 'presence') {
return '&nbsp;'
. '<a href="gradebook_view_result.php?cidReq='.$course_id.'&amp;selecteval=' . $item->get_id() . '">'
. $item->get_name()
. '</a>';
} else {
return '&nbsp;'
. '<a href="gradebook_view_result.php?cidReq='.$course_id.'&amp;selecteval=' . $item->get_id() . '">'
. $item->get_name()
. '</a>&nbsp;'.Display::label(get_lang('Evaluation'));
}
} elseif (ScoreDisplay :: instance()->is_custom() && $show_message===false) {
// students can go to the statistics page (if custom display enabled)
return '&nbsp;'
. '<a href="gradebook_statistics.php?selecteval=' . $item->get_id() . '">'
. $item->get_name()
. '</a>';
} elseif ($show_message===false && !api_is_allowed_to_edit() && !(ScoreDisplay :: instance()->is_custom())) {
return '&nbsp;'
. '<a href="gradebook_statistics.php?selecteval=' . $item->get_id() . '">'
. $item->get_name()
. '</a>';
} else {
return '['.get_lang('Evaluation').']&nbsp;&nbsp;'.$item->get_name().$show_message;
}
// link
case 'L' :
$cat = new Category();
$course_id = Database::get_course_by_category($_GET['selectcat']);
$show_message = $cat->show_message_resource_delete($course_id);
$url = $item->get_link();
if (isset($url) && $show_message===false) {
$text = '&nbsp;<a href="' . $item->get_link() . '">'
. $item->get_name()
. '</a>';
} else {
$text = $item->get_name();
}
$text .= "&nbsp;".Display::label($item->get_type_name(), 'info').$show_message;
$cc = $this->currentcat->get_course_code();
if (empty($cc)) {
$text .= '&nbsp;[<a href="'.api_get_path(REL_COURSE_PATH).$item->get_course_code().'/">'.$item->get_course_code().'</a>]';
}
return $text;
}
}
switch ($item->get_item_type()) {
// category
case 'C' :
$prms_uri='?selectcat=' . $item->get_id() . '&amp;view='.$view;
if (isset($_GET['isStudentView'])) {
if ( isset($is_student) || ( isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview') ) {
$prms_uri=$prms_uri.'&amp;isStudentView='.Security::remove_XSS($_GET['isStudentView']);
}
}
$cat = new Category();
$show_message=$cat->show_message_resource_delete($item->get_course_code());
return '&nbsp;<a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).$prms_uri.'">'
. $item->get_name()
. '</a>'
. ($item->is_course() ? ' &nbsp;[' . $item->get_course_code() . ']'.$show_message : '');
// evaluation
case 'E' :
$cat = new Category();
$course_id = Database::get_course_by_category($_GET['selectcat']);
$show_message = $cat->show_message_resource_delete($course_id);
// course/platform admin can go to the view_results page
if (api_is_allowed_to_edit() && $show_message===false) {
if ($item->get_type() == 'presence') {
return '&nbsp;'
. '<a href="gradebook_view_result.php?cidReq='.$course_id.'&amp;selecteval=' . $item->get_id() . '">'
. $item->get_name()
. '</a>';
} else {
return '&nbsp;'
. '<a href="gradebook_view_result.php?cidReq='.$course_id.'&amp;selecteval=' . $item->get_id() . '">'
. $item->get_name()
. '</a>&nbsp;'.Display::label(get_lang('Evaluation'));
}
} elseif (ScoreDisplay :: instance()->is_custom() && $show_message===false) {
// students can go to the statistics page (if custom display enabled)
return '&nbsp;'
. '<a href="gradebook_statistics.php?selecteval=' . $item->get_id() . '">'
. $item->get_name()
. '</a>';
} elseif ($show_message===false && !api_is_allowed_to_edit() && !(ScoreDisplay :: instance()->is_custom())) {
return '&nbsp;'
. '<a href="gradebook_statistics.php?selecteval=' . $item->get_id() . '">'
. $item->get_name()
. '</a>';
} else {
return '['.get_lang('Evaluation').']&nbsp;&nbsp;'.$item->get_name().$show_message;
}
// link
case 'L' :
$cat = new Category();
$course_id = Database::get_course_by_category($_GET['selectcat']);
$show_message = $cat->show_message_resource_delete($course_id);
$url = $item->get_link();
if (isset($url) && $show_message===false) {
$text = '&nbsp;<a href="' . $item->get_link() . '">'
. $item->get_name()
. '</a>';
} else {
$text = $item->get_name();
}
$text .= "&nbsp;".Display::label($item->get_type_name(), 'info').$show_message;
$cc = $this->currentcat->get_course_code();
if (empty($cc)) {
$text .= '&nbsp;[<a href="'.api_get_path(REL_COURSE_PATH).$item->get_course_code().'/">'.$item->get_course_code().'</a>]';
}
return $text;
}
}
/**
* @param $item
@ -618,16 +620,16 @@ class GradebookTable extends SortableTable
*/
private function build_edit_column($item)
{
switch ($item->get_item_type()) {
// category
case 'C' :
return build_edit_icons_cat($item, $this->currentcat);
// evaluation
case 'E' :
return build_edit_icons_eval($item, $this->currentcat->get_id());
// link
case 'L' :
return build_edit_icons_link($item, $this->currentcat->get_id());
}
}
switch ($item->get_item_type()) {
// category
case 'C' :
return build_edit_icons_cat($item, $this->currentcat);
// evaluation
case 'E' :
return build_edit_icons_eval($item, $this->currentcat->get_id());
// link
case 'L' :
return build_edit_icons_link($item, $this->currentcat->get_id());
}
}
}

@ -57,6 +57,7 @@ class GradebookDataGenerator
/**
* Get total number of items (rows)
* @return int
*/
public function get_total_items_count()
{
@ -196,7 +197,7 @@ class GradebookDataGenerator
} else {
$date = $item1->get_date();
if (!empty($date)) {
$timestamp1 = api_strtotime($date, 'UTC');
$timestamp1 = api_strtotime($date, 'UTC');
} else {
$timestamp1 = null;
}

@ -199,8 +199,8 @@ function get_icon_file_name($type)
/**
* Builds the course or platform admin icons to edit a category
* @param object $cat category object
* @param int $selectcat id of selected category
* @param Category $cat category
* @param Category $selectcat id of selected category
*/
function build_edit_icons_cat($cat, $selectcat)
{
@ -213,11 +213,12 @@ function build_edit_icons_cat($cat, $selectcat)
$visibility_icon = ($cat->is_visible() == 0) ? 'invisible' : 'visible';
$visibility_command = ($cat->is_visible() == 0) ? 'set_visible' : 'set_invisible';
$modify_icons .= '<a class="view_children" data-cat-id="' . $cat->get_id() . '" href="javascript:void(0);">' . Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>';
$modify_icons .= '<a class="view_children" data-cat-id="' . $cat->get_id() . '" href="javascript:void(0);">' .
Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>';
if (api_is_allowed_to_edit(null, true)) {
//Locking button
// Locking button
if (api_get_setting('gradebook_locking_enabled') == 'true') {
if ($cat->is_locked()) {
@ -240,9 +241,7 @@ function build_edit_icons_cat($cat, $selectcat)
if ($cat->is_locked() && !api_is_platform_admin()) {
$modify_icons .= Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
} else {
$modify_icons .= '<a href="gradebook_edit_cat.php?' .
'editcat=' . $cat->get_id() . '&cidReq=' .
$cat->get_course_code() . '">' .
$modify_icons .= '<a href="gradebook_edit_cat.php?' .'editcat=' . $cat->get_id() . '&cidReq=' .$cat->get_course_code() . '">' .
Display::return_icon(
'edit.png',
get_lang('Modify'),
@ -252,26 +251,21 @@ function build_edit_icons_cat($cat, $selectcat)
}
}
$modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .
$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '">' .
$modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '">' .
Display::return_icon(
'percentage.png',
get_lang('EditAllWeights'),
'',
ICON_SIZE_SMALL
) . '</a>';
$modify_icons .= '<a href="gradebook_flatview.php?selectcat=' .
$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '">' .
$modify_icons .= '<a href="gradebook_flatview.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '">' .
Display::return_icon(
'stats.png',
get_lang('FlatView'),
'',
ICON_SIZE_SMALL
) . '</a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() .
'?visiblecat=' . $cat->get_id() . '&' .
$visibility_command . '=&selectcat=' . $selectcat .
'&cidReq=' . $cat->get_course_code() . '">' .
$modify_icons .= '&nbsp;<a href="' . api_get_self() .'?visiblecat=' . $cat->get_id() . '&' .$visibility_command . '=&selectcat=' . $selectcat .'&cidReq=' . $cat->get_course_code() . '">' .
Display::return_icon(
$visibility_icon . '.png',
get_lang('Visible'),
@ -289,7 +283,8 @@ function build_edit_icons_cat($cat, $selectcat)
if ($cat->is_locked() && !api_is_platform_admin()) {
$modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL);
} else {
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletecat=' . $cat->get_id() . '&amp;selectcat=' . $selectcat . '&amp;cidReq=' . $cat->get_course_code() . '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . '</a>';
$modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletecat=' . $cat->get_id() . '&amp;selectcat=' . $selectcat . '&amp;cidReq=' . $cat->get_course_code() . '" onclick="return confirmation();">' .
Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . '</a>';
}
}

@ -104,8 +104,6 @@ switch ($action) {
case 'search_course_by_session':
if (api_is_platform_admin()) {
$results = SessionManager::get_course_list_by_session_id($_GET['session_id'], $_GET['q']);
//$results = SessionManager::get_sessions_list(array('s.name LIKE' => "%".$_REQUEST['q']."%"));
$results2 = array();
if (!empty($results)) {
foreach ($results as $item) {

@ -26,9 +26,8 @@ switch ($action) {
break;
case 'search_session':
if (api_is_platform_admin()) {
//$results = SessionManager::get_sessions_list(array('s.name LIKE' => "%".$_REQUEST['q']."%"));
$results = SessionManager::get_sessions_list(
array('s.name LIKE' => "%".$_REQUEST['q']."%")
array('s.name' => array('operator' => 'LIKE', 'value' => "%".$_REQUEST['q']."%"))
);
$results2 = array();
if (!empty($results)) {
@ -52,7 +51,12 @@ switch ($action) {
break;
case 'search_session_all':
if (api_is_platform_admin()) {
$results = SessionManager::get_sessions_list(array('s.name LIKE' => "%".$_REQUEST['q']."%", 'c.id ='=>$_REQUEST['course_id']));
$results = SessionManager::get_sessions_list(
array(
's.name' => array('operator' => 'like', 'value' => "%".$_REQUEST['q']."%"),
'c.id' => array('operator' => '=', 'value' => $_REQUEST['course_id'])
)
);
$results2 = array();
if (!empty($results)) {
foreach ($results as $item) {
@ -76,7 +80,12 @@ switch ($action) {
break;
case 'search_session_by_course':
if (api_is_platform_admin()) {
$results = SessionManager::get_sessions_list(array('s.name LIKE' => "%".$_REQUEST['q']."%", 'c.id ='=>$_REQUEST['course_id']));
$results = SessionManager::get_sessions_list(
array(
's.name' => array('operator' => 'like', 'value' => "%".$_REQUEST['q']."%"),
'c.id' => array('operator' => '=', 'value' => $_REQUEST['course_id'])
)
);
$results2 = array();
if (!empty($results)) {
foreach ($results as $item) {

@ -1,5 +1,9 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Class CoursesAndSessionsCatalog
*/
class CoursesAndSessionsCatalog
{
@ -7,6 +11,7 @@ class CoursesAndSessionsCatalog
* Check the configuration for the courses and sessions catalog
* @global array $_configuration Configuration
* @param int $value The value to check
*
* @return boolean Whether the configuration is $value
*/
public static function is($value = CATALOG_COURSES)
@ -25,6 +30,7 @@ class CoursesAndSessionsCatalog
/**
* Check whether to display the sessions list
* @global array $_configuration Configuration
*
* @return boolean whether to display
*/
public static function showSessions()
@ -47,6 +53,7 @@ class CoursesAndSessionsCatalog
/**
* Check whether to display the courses list
* @global array $_configuration Configuration
*
* @return boolean whether to display
*/
public static function showCourses()

@ -18,7 +18,7 @@ define('TEACHER_HTML_FULLPAGE', 5);
*/
class FormValidator extends HTML_QuickForm
{
public $with_progress_bar = false;
/**
* Create a form validator based on an array of form data:
*
@ -47,10 +47,11 @@ class FormValidator extends HTML_QuickForm
* )
* );
*
* @param array form_data
* @param array $form_data
*
* @return FormValidator
*/
static function create($form_data)
public static function create($form_data)
{
if (empty($form_data)) {
return null;
@ -98,11 +99,10 @@ class FormValidator extends HTML_QuickForm
}
}
$result->setDefaults($defaults);
return $result;
}
var $with_progress_bar = false;
/**
* Constructor
* @param string $form_name Name of the form
@ -113,7 +113,7 @@ class FormValidator extends HTML_QuickForm
* @param bool $track_submit (optional) Whether to track if the form was
* submitted by adding a special hidden field (default = true)
*/
function __construct($form_name, $method = 'post', $action = '', $target = '', $attributes = null, $track_submit = true)
public function __construct($form_name, $method = 'post', $action = '', $target = '', $attributes = null, $track_submit = true)
{
// Default form class.
if (is_array($attributes) && !isset($attributes['class']) || empty($attributes)) {
@ -646,7 +646,7 @@ function html_filter_student_fullpage($html)
* @return string The cleaned mobile phone number
*/
function mobile_phone_number_filter($mobilePhoneNumber)
{
{
$mobilePhoneNumber = str_replace(array('+', '(', ')'), '', $mobilePhoneNumber);
return ltrim($mobilePhoneNumber,'0');
}
}

@ -1060,8 +1060,11 @@ switch ($action) {
break;
case 'content':
if ($debug > 0) error_log('New LP - content action triggered', 0);
if ($debug > 0) error_log('New LP - Item id is '.$_GET['item_id'], 0);
if (!$lp_found) { error_log('New LP - No learnpath given for content', 0); require 'lp_list.php'; }
if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
if (!$lp_found) {
error_log('New LP - No learnpath given for content', 0);
require 'lp_list.php';
}
else {
$_SESSION['oLP']->save_last();
$_SESSION['oLP']->set_current_item($_GET['item_id']);

@ -4,12 +4,11 @@
* @package chamilo.social
* @author Julio Montoya <gugli100@gmail.com>
*/
/**
* Initialization
*/
// name of the language file that needs to be included
$language_file = array('registration', 'admin', 'userInfo');
$cidReset = true;
$cidReset = true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
require_once api_get_path(LIBRARY_PATH).'magpierss/rss_fetch.inc';
@ -140,22 +139,23 @@ $query = isset($_GET['q']) ? Database::escape_string($_GET['q']) : null;
$query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0','1','2')) ? $_GET['search_type'] : null;
$extra_fields = UserManager::get_extra_filtrable_fields();
$query_vars = array('q' => $query, 'search_type' => $query_search_type);
foreach ($extra_fields as $extra_field) {
$field_name = 'field_'.$extra_field['variable'];
if (isset($_GET[$field_name]) && $_GET[$field_name]!='0') {
$query_vars[$field_name]=$_GET[$field_name];
if (!empty($extra_fields)) {
foreach ($extra_fields as $extra_field) {
$field_name = 'field_' . $extra_field['variable'];
if (isset($_GET[$field_name]) && $_GET[$field_name] != '0') {
$query_vars[$field_name] = $_GET[$field_name];
}
}
}
$social_avatar_block = SocialManager::show_social_avatar_block('search');
$social_menu_block = SocialManager::show_social_menu('search');
$social_right_content = '<div class="span9">'.UserManager::get_search_form($query).'</div>';
// I'm searching something
if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) ) {
$itemPerPage = 9;
if ($_GET['search_type']=='0' || $_GET['search_type']=='1') {
$page = isset($_GET['users_page_nr']) ? intval($_GET['users_page_nr']) : 1;
$totalUsers = UserManager::get_all_user_tags($_GET['q'], 0, 0, $itemPerPage, true);
@ -216,9 +216,7 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2) )
}
$tag = isset($user['tag']) ? ' <br /><br />'.$user['tag'] : null;
$user_info['complete_name'] = Display::url($status_icon.$user_info['complete_name'], $url);
$invitations = $user['tag'].$send_inv.$send_msg;
$results .= '<li class="span3">

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University, Belgium
* @author Juan Carlos Raña <herodoto@telefonica.net>
@ -7,8 +8,6 @@
* @package chamilo.wiki
*/
use \ChamiloSession as Session;
// name of the language file that needs to be included
$language_file = 'wiki';

Loading…
Cancel
Save