Minor - Format code, fix PHP warnings.

1.10.x
Julio Montoya 10 years ago
parent 260da1d439
commit 44f80c4e11
  1. 3
      main/document/document.php
  2. 70
      main/gradebook/gradebook.php
  3. 5
      main/gradebook/lib/fe/displaygradebook.php
  4. 20
      main/gradebook/lib/fe/gradebooktable.class.php
  5. 2
      main/inc/introductionSection.inc.php
  6. 8
      main/inc/lib/document.lib.php

@ -1676,9 +1676,6 @@ $actions .= '</div>';
$actions .= '</div>'; $actions .= '</div>';
$actions .= '</div>'; $actions .= '</div>';
$table_footer = ''; $table_footer = '';
$total_size = 0; $total_size = 0;
$sortable_data = array(); $sortable_data = array();

@ -310,24 +310,20 @@ if (isset ($_POST['action'])) {
$filter_confirm_msg = false; $filter_confirm_msg = false;
break; break;
case 'setvisible' : case 'setvisible' :
foreach ($_POST['id'] as $indexstr) foreach ($_POST['id'] as $indexstr) {
{ if (api_substr($indexstr, 0, 4) == 'CATE') {
if (api_substr($indexstr, 0, 4) == 'CATE') $cats = Category:: load(api_substr($indexstr, 4));
{
$cats= Category :: load(api_substr($indexstr, 4));
$cats[0]->set_visible(1); $cats[0]->set_visible(1);
$cats[0]->save(); $cats[0]->save();
$cats[0]->apply_visibility_to_children(); $cats[0]->apply_visibility_to_children();
} }
if (api_substr($indexstr, 0, 4) == 'EVAL') if (api_substr($indexstr, 0, 4) == 'EVAL') {
{ $eval = Evaluation:: load(api_substr($indexstr, 4));
$eval= Evaluation :: load(api_substr($indexstr, 4));
$eval[0]->set_visible(1); $eval[0]->set_visible(1);
$eval[0]->save(); $eval[0]->save();
} }
if (api_substr($indexstr, 0, 4) == 'LINK') if (api_substr($indexstr, 0, 4) == 'LINK') {
{ $link = LinkFactory:: load(api_substr($indexstr, 4));
$link= LinkFactory :: load(api_substr($indexstr, 4));
$link[0]->set_visible(1); $link[0]->set_visible(1);
$link[0]->save(); $link[0]->save();
} }
@ -336,24 +332,20 @@ if (isset ($_POST['action'])) {
$filter_confirm_msg = false; $filter_confirm_msg = false;
break; break;
case 'setinvisible' : case 'setinvisible' :
foreach ($_POST['id'] as $indexstr) foreach ($_POST['id'] as $indexstr) {
{ if (api_substr($indexstr, 0, 4) == 'CATE') {
if (api_substr($indexstr, 0, 4) == 'CATE') $cats = Category:: load(api_substr($indexstr, 4));
{
$cats= Category :: load(api_substr($indexstr, 4));
$cats[0]->set_visible(0); $cats[0]->set_visible(0);
$cats[0]->save(); $cats[0]->save();
$cats[0]->apply_visibility_to_children(); $cats[0]->apply_visibility_to_children();
} }
if (api_substr($indexstr, 0, 4) == 'EVAL') if (api_substr($indexstr, 0, 4) == 'EVAL') {
{ $eval = Evaluation:: load(api_substr($indexstr, 4));
$eval= Evaluation :: load(api_substr($indexstr, 4));
$eval[0]->set_visible(0); $eval[0]->set_visible(0);
$eval[0]->save(); $eval[0]->save();
} }
if (api_substr($indexstr, 0, 4) == 'LINK') if (api_substr($indexstr, 0, 4) == 'LINK') {
{ $link = LinkFactory:: load(api_substr($indexstr, 4));
$link= LinkFactory :: load(api_substr($indexstr, 4));
$link[0]->set_visible(0); $link[0]->set_visible(0);
$link[0]->save(); $link[0]->save();
} }
@ -446,6 +438,7 @@ if (isset ($move_form)) {
// LOAD DATA & DISPLAY TABLE - // LOAD DATA & DISPLAY TABLE -
$is_platform_admin= api_is_platform_admin(); $is_platform_admin= api_is_platform_admin();
$is_course_admin= api_is_allowed_to_edit(); $is_course_admin= api_is_allowed_to_edit();
//load data for category, evaluation and links //load data for category, evaluation and links
if (!isset ($_GET['selectcat']) || empty ($_GET['selectcat'])) { if (!isset ($_GET['selectcat']) || empty ($_GET['selectcat'])) {
$category= 0; $category= 0;
@ -454,7 +447,13 @@ if (!isset ($_GET['selectcat']) || empty ($_GET['selectcat'])) {
} }
// search form // search form
$simple_search_form= new UserForm(UserForm :: TYPE_SIMPLE_SEARCH, null, 'simple_search_form', null, api_get_self() . '?selectcat=' . $selectcat); $simple_search_form = new UserForm(
UserForm :: TYPE_SIMPLE_SEARCH,
null,
'simple_search_form',
null,
api_get_self().'?selectcat='.$selectcat
);
$values= $simple_search_form->exportValues(); $values= $simple_search_form->exportValues();
$keyword = ''; $keyword = '';
if (isset($_GET['search']) && !empty($_GET['search'])) { if (isset($_GET['search']) && !empty($_GET['search'])) {
@ -463,8 +462,8 @@ if (isset($_GET['search']) && !empty($_GET['search'])) {
if ($simple_search_form->validate() && (empty($keyword))) { if ($simple_search_form->validate() && (empty($keyword))) {
$keyword = $values['keyword']; $keyword = $values['keyword'];
} }
if (!empty($keyword)) {
if (!empty($keyword)) {
$cats= Category :: load($category); $cats= Category :: load($category);
$allcat= array (); $allcat= array ();
if ((isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search'])) { if ((isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search'])) {
@ -486,7 +485,13 @@ if (!empty($keyword)) {
$alllink= $cats[0]->get_links($stud_id, true); $alllink= $cats[0]->get_links($stud_id, true);
if (isset ($_GET['exportpdf'])) { if (isset ($_GET['exportpdf'])) {
$datagen = new GradebookDataGenerator ($allcat,$alleval, $alllink); $datagen = new GradebookDataGenerator ($allcat,$alleval, $alllink);
$header_names = array(get_lang('Name'),get_lang('Description'),get_lang('Weight'),get_lang('Date'),get_lang('Results')); $header_names = array(
get_lang('Name'),
get_lang('Description'),
get_lang('Weight'),
get_lang('Date'),
get_lang('Results'),
);
$data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME,0,null,true); $data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME,0,null,true);
$newarray = array(); $newarray = array();
foreach ($data_array as $data) { foreach ($data_array as $data) {
@ -500,7 +505,18 @@ if (!empty($keyword)) {
$pdf->line(50,790,550,790); $pdf->line(50,790,550,790);
$pdf->line(50,40,550,40); $pdf->line(50,40,550,40);
$pdf->ezSetY(750); $pdf->ezSetY(750);
$pdf->ezTable($newarray,$header_names,'',array('showHeadings'=>1,'shaded'=>1,'showLines'=>1,'rowGap'=>3,'width'=> 500)); $pdf->ezTable(
$newarray,
$header_names,
'',
array(
'showHeadings' => 1,
'shaded' => 1,
'showLines' => 1,
'rowGap' => 3,
'width' => 500,
)
);
$pdf->ezStream(); $pdf->ezStream();
exit; exit;
} }
@ -565,7 +581,7 @@ if (isset($_GET['search'])) {
if (isset ($_GET['studentoverview'])) { if (isset ($_GET['studentoverview'])) {
$addparams['studentoverview'] = ''; $addparams['studentoverview'] = '';
} }
if (count($allcat_info)>=0 && (isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search']) && strlen(trim($_GET['search']))>0 ) { if (isset($allcat_info) && count($allcat_info)>=0 && (isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search']) && strlen(trim($_GET['search']))>0 ) {
$allcat=$allcat_info; $allcat=$allcat_info;
} else { } else {
$allcat=$allcat; $allcat=$allcat;

@ -516,7 +516,10 @@ class DisplayGradebook
} else { } else {
$header .= '<td></td>'; $header .= '<td></td>';
} }
if ($is_course_admin && $message_resource === false && $_GET['selectcat'] != 0) { if ($is_course_admin &&
$message_resource === false &&
isset($_GET['selectcat']) && $_GET['selectcat'] != 0
) {
/* $header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?'.api_get_cidreq().'&selectcat=' . $catobj->get_id() . '"><img src="../img/view_list.gif" alt="' . get_lang('FlatView') . '" /> ' . get_lang('FlatView') . '</a>'; /* $header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?'.api_get_cidreq().'&selectcat=' . $catobj->get_id() . '"><img src="../img/view_list.gif" alt="' . get_lang('FlatView') . '" /> ' . get_lang('FlatView') . '</a>';
if ($is_course_admin && $message_resource===false) { if ($is_course_admin && $message_resource===false) {
$header .= '<td style="vertical-align: top;"><a href="gradebook_scoring_system.php?'.api_get_cidreq().'&selectcat=' . $catobj->get_id() .'"><img src="../img/acces_tool.gif" alt="' . get_lang('ScoreEdit') . '" /> ' . get_lang('ScoreEdit') . '</a>'; $header .= '<td style="vertical-align: top;"><a href="gradebook_scoring_system.php?'.api_get_cidreq().'&selectcat=' . $catobj->get_id() .'"><img src="../img/acces_tool.gif" alt="' . get_lang('ScoreEdit') . '" /> ' . get_lang('ScoreEdit') . '</a>';

@ -883,11 +883,11 @@ class GradebookTable extends SortableTable
switch ($item->get_item_type()) { switch ($item->get_item_type()) {
// category // category
case 'C' : case 'C' :
$prms_uri='?selectcat=' . $item->get_id() . '&amp;view='.$view; $prms_uri='?selectcat=' . $item->get_id() . '&view='.$view;
if (isset($_GET['isStudentView'])) { if (isset($_GET['isStudentView'])) {
if ( isset($is_student) || ( isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview') ) { if ( isset($is_student) || ( isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview') ) {
$prms_uri=$prms_uri.'&amp;isStudentView='.Security::remove_XSS($_GET['isStudentView']); $prms_uri=$prms_uri.'&isStudentView='.Security::remove_XSS($_GET['isStudentView']);
} }
} }
@ -897,22 +897,28 @@ class GradebookTable extends SortableTable
. $item->get_name() . $item->get_name()
. '</a>' . '</a>'
. ($item->is_course() ? ' &nbsp;[' . $item->get_course_code() . ']'.$show_message : ''); . ($item->is_course() ? ' &nbsp;[' . $item->get_course_code() . ']'.$show_message : '');
// evaluation // evaluation
case 'E' : case 'E' :
$cat = new Category(); $cat = new Category();
$course_id = CourseManager::get_course_by_category($_GET['selectcat']); $show_message = false;
$show_message = $cat->show_message_resource_delete($course_id); $course_id = 0;
if (isset($_GET['selectcat'])) {
$course_id = CourseManager::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 // course/platform admin can go to the view_results page
if (api_is_allowed_to_edit() && $show_message===false) { if (api_is_allowed_to_edit() && $show_message===false) {
if ($item->get_type() == 'presence') { if ($item->get_type() == 'presence') {
return '&nbsp;' return '&nbsp;'
. '<a href="gradebook_view_result.php?cidReq='.$course_id.'&amp;selecteval=' . $item->get_id() . '">' . '<a href="gradebook_view_result.php?cidReq='.$course_id.'&selecteval=' . $item->get_id() . '">'
. $item->get_name() . $item->get_name()
. '</a>'; . '</a>';
} else { } else {
return '&nbsp;' return '&nbsp;'
. '<a href="gradebook_view_result.php?cidReq='.$course_id.'&amp;selecteval=' . $item->get_id() . '">' . '<a href="gradebook_view_result.php?cidReq='.$course_id.'&selecteval=' . $item->get_id() . '">'
. $item->get_name() . $item->get_name()
. '</a>&nbsp;'.Display::label(get_lang('Evaluation')); . '</a>&nbsp;'.Display::label(get_lang('Evaluation'));
} }

@ -364,7 +364,7 @@ if ($intro_dispCommand) {
} }
} }
$introduction_section .= '<div class="col-md-12">'; $introduction_section .= '<div class="col-md-12">';
if ($intro_dispDefault) { if ($intro_dispDefault) {
if (!empty($intro_content)) { if (!empty($intro_content)) {

@ -3807,7 +3807,13 @@ class DocumentManager
if (!$visible) { if (!$visible) {
return false; return false;
} else { } else {
return self::check_visibility_tree($document_data['parent_id'], $course_code, $session_id, $user_id, $groupId); return self::check_visibility_tree(
$document_data['parent_id'],
$course_code,
$session_id,
$user_id,
$groupId
);
} }
} }
} else { } else {

Loading…
Cancel
Save