manual merge

1.9.x
Yannick Warnier 11 years ago
commit 840e0c2532
  1. 6
      main/gradebook/gradebook_add_link.php
  2. 7
      main/gradebook/gradebook_edit_link.php
  3. 44
      main/gradebook/index.php
  4. 24
      main/gradebook/lib/be/category.class.php

@ -29,8 +29,12 @@ $tbl_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$session_id = api_get_session_id();
$typeSelected = isset($_GET['typeselected']) ? intval($_GET['typeselected']) : null;
$all_categories = Category :: load(null, null, api_get_course_id(), null, null, $session_id);
if ($session_id == 0) {
$all_categories = Category :: load(null, null, api_get_course_id(), null, null, $session_id);
} else {
$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();
$typeform = new LinkForm(LinkForm :: TYPE_CREATE, $category[0], null, 'create_link', null, $url, $typeSelected);

@ -33,7 +33,12 @@ if ($link->is_locked() && !api_is_platform_admin()) {
$linkcat = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']):'';
$linkedit = isset($_GET['editlink']) ? Security::remove_XSS($_GET['editlink']):'';
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false); //already init
$session_id = api_get_session_id();
if ($session_id == 0) {
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false); //already init
} else {
$cats = Category :: load_session_categories(null, $session_id);
}
$form = new LinkAddEditForm(LinkAddEditForm :: TYPE_EDIT, $cats, null, $link, 'edit_link_form', api_get_self() . '?selectcat=' . $linkcat. '&editlink=' . $linkedit);
if ($form->validate()) {

@ -119,11 +119,19 @@ $filter_confirm_msg = true;
$filter_warning_msg = true;
///direct access to one evaluation
$cats = Category :: load(null, null, $course_code, null, null, $session_id, false); //already init
$catsResult = array();
if ( api_get_session_id() != 0) {
$session_id = api_get_session_id();
$cats = Category :: load_session_categories(null, $session_id); //already init
$catsResult = $cats;
} else {
$cats = Category :: load(null, null, $course_code, null, null, null, false);
}
$first_time = null;
if (empty($cats)) {
$cats = Category :: load(0, null, $course_code, null, null, $session_id, false);//first time
$first_time=1;
$first_time = 1;
}
$_GET['selectcat'] = $cats[0]->get_id();
@ -819,20 +827,28 @@ if (isset($first_time) && $first_time==1 && api_is_allowed_to_edit(null,true)) {
}
}
$i = 0;
/** @var Category $cat **/
$i = 0;
$allcat = array();
foreach ($cats as $cat) {
$allcat = $cat->get_subcategories($stud_id, $course_code, $session_id);
$alleval = $cat->get_evaluations($stud_id);
$alllink = $cat->get_links($stud_id);
if ($cat->get_parent_id() != 0) {
$i++;
} else {
// This is the father
// Create gradebook/add gradebook links.
if ($session_id != 0) {
$allcatSession = $catsResult;
foreach ($allcatSession as $catSession) {
if ($catSession->get_parent_id() == 0) {
continue;
}
$allcat[] = $catSession;
}
} else {
$allcat = $cat->get_subcategories($stud_id, $course_code, $session_id);
}
$alleval = $cat->get_evaluations($stud_id);
$alllink = $cat->get_links($stud_id,true);
if ($cat->get_parent_id() != 0) {
$i++;
} else {
// This is the father
// Create gradebook/add gradebook links.
DisplayGradebook::display_header_gradebook(
$cat,
0,

@ -169,18 +169,28 @@ class Category implements GradebookItem
$cats[] = Category::create_root_category();
return $cats;
}
$cat = array();
$courseCode = api_get_course_info(api_get_course_id());
$courseCode = $courseCode['code'];
$cats = array();
if (!empty ($session_id)) {
$tbl_grade_categories = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
$sql_session = 'SELECT id FROM '.$tbl_grade_categories. ' WHERE session_id = '.$session_id;
$sql_session = 'SELECT id, course_code FROM '.$tbl_grade_categories. ' WHERE session_id = '.(int) $session_id;
$result_session = Database::query($sql_session);
if (Database::num_rows($result_session) > 0) {
$data_session = Database::fetch_array($result_session);
$parent_id = $data_session['id'];
$cat = Category::load($parent_id);
$cats = Category::load(null, null, null, $parent_id, null, null, $order);
return array_merge($cat,$cats);
$cat = array();
while ($data_session = Database::fetch_array($result_session)) {
$parent_id = $data_session['id'];
if ($data_session['course_code'] == $courseCode) {
$cat = Category::load($parent_id);
$cats = Category::load(null,null,null,$parent_id,null,null,null);
//$cat = array_merge($cat,$cats);
}
}
return array_merge($cat,$cats);
}
}
}

Loading…
Cancel
Save