@@ -48,7 +48,9 @@ discard block |
||
| 48 | 48 | foreach ($dashboard_blocks as $block) { |
| 49 | 49 | |
| 50 | 50 | // display only user blocks |
| 51 | - if (!in_array($block['id'], $user_blocks_id)) continue; |
|
| 51 | + if (!in_array($block['id'], $user_blocks_id)) { |
|
| 52 | + continue; |
|
| 53 | + } |
|
| 52 | 54 | |
| 53 | 55 | $path = $block['path']; |
| 54 | 56 | $controller_class = $block['controller']; |
@@ -61,7 +63,9 @@ discard block |
||
| 61 | 63 | // check if user is allowed to see the block |
| 62 | 64 | if (method_exists($obj, 'is_block_visible_for_user')) { |
| 63 | 65 | $is_block_visible_for_user = $obj->is_block_visible_for_user($user_id); |
| 64 | - if (!$is_block_visible_for_user) continue; |
|
| 66 | + if (!$is_block_visible_for_user) { |
|
| 67 | + continue; |
|
| 68 | + } |
|
| 65 | 69 | } |
| 66 | 70 | |
| 67 | 71 | $data_block[$path] = $obj->get_block(); |
@@ -23,19 +23,19 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | switch ($action) { |
| 25 | 25 | case 'add': |
| 26 | - $interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('Timeline')); |
|
| 27 | - $interbreadcrumb[]=array('url' => '#','name' => get_lang('Add')); |
|
| 26 | + $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Timeline')); |
|
| 27 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add')); |
|
| 28 | 28 | break; |
| 29 | 29 | case 'edit': |
| 30 | - $interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('Timeline')); |
|
| 31 | - $interbreadcrumb[]=array('url' => '#','name' => get_lang('Edit')); |
|
| 30 | + $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Timeline')); |
|
| 31 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit')); |
|
| 32 | 32 | break; |
| 33 | 33 | case 'add_item': |
| 34 | - $interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('Timeline')); |
|
| 35 | - $interbreadcrumb[]=array('url' => '#','name' => get_lang('TimelineItem')); |
|
| 34 | + $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Timeline')); |
|
| 35 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('TimelineItem')); |
|
| 36 | 36 | break; |
| 37 | 37 | default: |
| 38 | - $interbreadcrumb[]=array('url' => '#','name' => get_lang('Timeline')); |
|
| 38 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Timeline')); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | //jqgrid will use this URL to do the selects |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | //Column config |
| 48 | 48 | $column_model = array( |
| 49 | - array('name'=>'name', 'index'=>'name', 'width'=>'120', 'align'=>'left'), |
|
| 50 | - array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left', 'sortable'=>'false') |
|
| 49 | + array('name'=>'name', 'index'=>'name', 'width'=>'120', 'align'=>'left'), |
|
| 50 | + array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left', 'sortable'=>'false') |
|
| 51 | 51 | ); |
| 52 | 52 | //Autowidth |
| 53 | 53 | $extra_params['autowidth'] = 'true'; |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | $extra_params['height'] = 'auto'; |
| 56 | 56 | |
| 57 | 57 | //With this function we can add actions to the jgrid (edit, delete, etc) |
| 58 | -$htmlHeadXtra[] =' |
|
| 58 | +$htmlHeadXtra[] = ' |
|
| 59 | 59 | <script> |
| 60 | 60 | $(function() { |
| 61 | 61 | // grid definition see the $timeline->display() function |
| 62 | - '.Display::grid_js('timelines', $url,$columns,$column_model,$extra_params, array(), null,true).' |
|
| 62 | + '.Display::grid_js('timelines', $url, $columns, $column_model, $extra_params, array(), null, true).' |
|
| 63 | 63 | }); |
| 64 | 64 | </script>'; |
| 65 | 65 | |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | $values = $form->exportValues(); |
| 81 | 81 | $res = $timeline->save($values); |
| 82 | 82 | if ($res) { |
| 83 | - $message = Display::return_message(get_lang('ItemAdded'),'success'); |
|
| 83 | + $message = Display::return_message(get_lang('ItemAdded'), 'success'); |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | $content = $timeline->listing(); |
| 87 | 87 | } else { |
| 88 | - $actions .= '<a href="'.api_get_self().'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 88 | + $actions .= '<a href="'.api_get_self().'">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 89 | 89 | $form->addElement('hidden', 'sec_token'); |
| 90 | 90 | $form->setConstants(array('sec_token' => $token)); |
| 91 | 91 | $content = $form->return_form(); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | $timeline->display(); |
| 108 | 108 | } else { |
| 109 | - $actions = '<a href="'.api_get_self().'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 109 | + $actions = '<a href="'.api_get_self().'">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 110 | 110 | $form->addElement('hidden', 'sec_token'); |
| 111 | 111 | $form->setConstants(array('sec_token' => $token)); |
| 112 | 112 | $content = $form->return_form(); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | $timeline->display(); |
| 130 | 130 | } else { |
| 131 | - $actions = '<a href="'.api_get_self().'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 131 | + $actions = '<a href="'.api_get_self().'">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 132 | 132 | $form->addElement('hidden', 'sec_token'); |
| 133 | 133 | $form->setConstants(array('sec_token' => $token)); |
| 134 | 134 | $content = $form->return_form(); |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | array('name'=>'certificate', 'index'=>'certificate', 'width'=>'25', 'align'=>'left', 'sortable'=>'false'), |
| 51 | 51 | array('name'=>'skills', 'index'=>'skills', 'width'=>'300', 'align'=>'left', 'sortable'=>'false'), |
| 52 | 52 | array('name'=>'actions', 'index'=>'actions', 'width'=>'30', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false') |
| 53 | - ); |
|
| 53 | + ); |
|
| 54 | 54 | //Autowidth |
| 55 | 55 | $extra_params['autowidth'] = 'true'; |
| 56 | 56 | //height auto |
@@ -6,8 +6,8 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | require_once '../inc/global.inc.php'; |
| 8 | 8 | |
| 9 | -$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('Timeline')); |
|
| 10 | -$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('Listing')); |
|
| 9 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Timeline')); |
|
| 10 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('Listing')); |
|
| 11 | 11 | |
| 12 | 12 | $timeline = new Timeline(); |
| 13 | 13 | if (empty($_GET['id'])) { |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | } |
| 16 | 16 | $url = $timeline->get_url($_GET['id']); |
| 17 | 17 | $item = $timeline->get($_GET['id']); |
| 18 | -$interbreadcrumb[]=array('url' => '#','name' => $item['headline']); |
|
| 18 | +$interbreadcrumb[] = array('url' => '#', 'name' => $item['headline']); |
|
| 19 | 19 | |
| 20 | 20 | $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_PATH).'javascript/timeline/timeline.css'); |
| 21 | 21 | $htmlHeadXtra[] = api_get_js('timeline/timeline-min.js'); |
@@ -33,18 +33,18 @@ |
||
| 33 | 33 | $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url; |
| 34 | 34 | |
| 35 | 35 | if (! isset($_course)) { |
| 36 | - api_not_allowed(true); |
|
| 36 | + api_not_allowed(true); |
|
| 37 | 37 | } |
| 38 | 38 | $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/blog/'.$doc_url; |
| 39 | 39 | |
| 40 | 40 | //if the rewrite rule asks for a directory, we redirect to the course view |
| 41 | 41 | if (is_dir($full_file_name)) { |
| 42 | - //remove last slash if present |
|
| 43 | - while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
|
| 44 | - //create the path |
|
| 45 | - $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
|
| 46 | - //redirect |
|
| 47 | - header('Location: '.$document_explorer); |
|
| 42 | + //remove last slash if present |
|
| 43 | + while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
|
| 44 | + //create the path |
|
| 45 | + $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
|
| 46 | + //redirect |
|
| 47 | + header('Location: '.$document_explorer); |
|
| 48 | 48 | exit; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | session_cache_limiter('public'); |
| 16 | 16 | |
| 17 | 17 | require_once '../inc/global.inc.php'; |
| 18 | -$this_section=SECTION_COURSES; |
|
| 18 | +$this_section = SECTION_COURSES; |
|
| 19 | 19 | |
| 20 | 20 | // IMPORTANT to avoid caching of documents |
| 21 | 21 | header('Expires: Wed, 01 Jan 1990 00:00:00 GMT'); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $doc_url = str_replace(' ', '+', $doc_url); |
| 33 | 33 | $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url; |
| 34 | 34 | |
| 35 | -if (! isset($_course)) { |
|
| 35 | +if (!isset($_course)) { |
|
| 36 | 36 | api_not_allowed(true); |
| 37 | 37 | } |
| 38 | 38 | $full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/blog/'.$doc_url; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | //if the rewrite rule asks for a directory, we redirect to the course view |
| 41 | 41 | if (is_dir($full_file_name)) { |
| 42 | 42 | //remove last slash if present |
| 43 | - while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
|
| 43 | + while ($doc_url{$dul = strlen($doc_url) - 1} == '/') $doc_url = substr($doc_url, 0, $dul); |
|
| 44 | 44 | //create the path |
| 45 | 45 | $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
| 46 | 46 | //redirect |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | exit; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -$tbl_blogs_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 51 | +$tbl_blogs_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 52 | 52 | $course_id = api_get_course_int_id(); |
| 53 | 53 | |
| 54 | 54 | // launch event |
@@ -40,7 +40,9 @@ |
||
| 40 | 40 | //if the rewrite rule asks for a directory, we redirect to the course view |
| 41 | 41 | if (is_dir($full_file_name)) { |
| 42 | 42 | //remove last slash if present |
| 43 | - while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul); |
|
| 43 | + while ($doc_url{$dul = strlen($doc_url)-1}=='/') { |
|
| 44 | + $doc_url = substr($doc_url,0,$dul); |
|
| 45 | + } |
|
| 44 | 46 | //create the path |
| 45 | 47 | $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path |
| 46 | 48 | //redirect |
@@ -379,9 +379,10 @@ discard block |
||
| 379 | 379 | $result = Database::query($sql); |
| 380 | 380 | $row = Database::fetch_array($result); |
| 381 | 381 | |
| 382 | - if ($row['number'] == 1) |
|
| 383 | - $user_task = true; |
|
| 384 | -} |
|
| 382 | + if ($row['number'] == 1) { |
|
| 383 | + $user_task = true; |
|
| 384 | + } |
|
| 385 | + } |
|
| 385 | 386 | |
| 386 | 387 | switch ($action) { |
| 387 | 388 | case 'new_post': |
@@ -468,16 +469,17 @@ discard block |
||
| 468 | 469 | echo '<br /><br />'; |
| 469 | 470 | Blog :: display_assigned_task_list($blog_id); |
| 470 | 471 | echo '<br /><br />'; |
| 472 | + } else { |
|
| 473 | + api_not_allowed(); |
|
| 471 | 474 | } |
| 472 | - else |
|
| 473 | - api_not_allowed(); |
|
| 474 | 475 | |
| 475 | 476 | break; |
| 476 | 477 | case 'execute_task' : |
| 477 | - if (isset ($_GET['post_id'])) |
|
| 478 | - Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
| 479 | - else |
|
| 480 | - Blog :: display_select_task_post($blog_id, intval($_GET['task_id'])); |
|
| 478 | + if (isset ($_GET['post_id'])) { |
|
| 479 | + Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
| 480 | + } else { |
|
| 481 | + Blog :: display_select_task_post($blog_id, intval($_GET['task_id'])); |
|
| 482 | + } |
|
| 481 | 483 | |
| 482 | 484 | break; |
| 483 | 485 | case 'view_search_result' : |
@@ -41,181 +41,181 @@ discard block |
||
| 41 | 41 | $safe_task_description = isset($_POST['task_description']) ? Security::remove_XSS($_POST['task_description']) : null; |
| 42 | 42 | |
| 43 | 43 | if (!empty($_POST['new_post_submit'])) { |
| 44 | - Blog:: create_post( |
|
| 45 | - $_POST['title'], |
|
| 46 | - $_POST['full_text'], |
|
| 47 | - $_POST['post_file_comment'], |
|
| 48 | - $blog_id |
|
| 49 | - ); |
|
| 50 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogAdded')); |
|
| 44 | + Blog:: create_post( |
|
| 45 | + $_POST['title'], |
|
| 46 | + $_POST['full_text'], |
|
| 47 | + $_POST['post_file_comment'], |
|
| 48 | + $blog_id |
|
| 49 | + ); |
|
| 50 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogAdded')); |
|
| 51 | 51 | } |
| 52 | 52 | if (!empty($_POST['edit_post_submit'])) { |
| 53 | - Blog:: edit_post( |
|
| 54 | - $_POST['post_id'], |
|
| 55 | - $_POST['title'], |
|
| 56 | - $_POST['full_text'], |
|
| 57 | - $blog_id |
|
| 58 | - ); |
|
| 59 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogEdited')); |
|
| 53 | + Blog:: edit_post( |
|
| 54 | + $_POST['post_id'], |
|
| 55 | + $_POST['title'], |
|
| 56 | + $_POST['full_text'], |
|
| 57 | + $blog_id |
|
| 58 | + ); |
|
| 59 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogEdited')); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | if (!empty($_POST['new_comment_submit'])) { |
| 63 | - Blog:: create_comment( |
|
| 64 | - $_POST['title'], |
|
| 65 | - $_POST['comment'], |
|
| 66 | - $_POST['post_file_comment'], |
|
| 67 | - $blog_id, |
|
| 68 | - $_GET['post_id'], |
|
| 69 | - $_POST['comment_parent_id'] |
|
| 70 | - ); |
|
| 71 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentAdded')); |
|
| 63 | + Blog:: create_comment( |
|
| 64 | + $_POST['title'], |
|
| 65 | + $_POST['comment'], |
|
| 66 | + $_POST['post_file_comment'], |
|
| 67 | + $blog_id, |
|
| 68 | + $_GET['post_id'], |
|
| 69 | + $_POST['comment_parent_id'] |
|
| 70 | + ); |
|
| 71 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentAdded')); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | if (!empty($_POST['new_task_submit'])) { |
| 75 | 75 | |
| 76 | - Blog:: create_task( |
|
| 77 | - $blog_id, |
|
| 78 | - $safe_task_name, |
|
| 79 | - $safe_task_description, |
|
| 80 | - (isset($_POST['chkArticleDelete']) ? $_POST['chkArticleDelete'] : null), |
|
| 81 | - (isset($_POST['chkArticleEdit']) ? $_POST['chkArticleEdit'] : null), |
|
| 82 | - (isset($_POST['chkCommentsDelete']) ? $_POST['chkCommentsDelete'] : null), |
|
| 83 | - (isset($_POST['task_color']) ? $_POST['task_color'] : null) |
|
| 84 | - ); |
|
| 85 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskCreated')); |
|
| 76 | + Blog:: create_task( |
|
| 77 | + $blog_id, |
|
| 78 | + $safe_task_name, |
|
| 79 | + $safe_task_description, |
|
| 80 | + (isset($_POST['chkArticleDelete']) ? $_POST['chkArticleDelete'] : null), |
|
| 81 | + (isset($_POST['chkArticleEdit']) ? $_POST['chkArticleEdit'] : null), |
|
| 82 | + (isset($_POST['chkCommentsDelete']) ? $_POST['chkCommentsDelete'] : null), |
|
| 83 | + (isset($_POST['task_color']) ? $_POST['task_color'] : null) |
|
| 84 | + ); |
|
| 85 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskCreated')); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | if (isset($_POST['edit_task_submit'])) { |
| 89 | - Blog:: edit_task( |
|
| 90 | - $_POST['blog_id'], |
|
| 91 | - $_POST['task_id'], |
|
| 92 | - $safe_task_name, |
|
| 93 | - $safe_task_description, |
|
| 94 | - $_POST['chkArticleDelete'], |
|
| 95 | - $_POST['chkArticleEdit'], |
|
| 96 | - $_POST['chkCommentsDelete'], |
|
| 97 | - $_POST['task_color'] |
|
| 98 | - ); |
|
| 99 | - $return_message = array( |
|
| 100 | - 'type' => 'confirmation', |
|
| 101 | - 'message' => get_lang('TaskEdited') |
|
| 102 | - ); |
|
| 89 | + Blog:: edit_task( |
|
| 90 | + $_POST['blog_id'], |
|
| 91 | + $_POST['task_id'], |
|
| 92 | + $safe_task_name, |
|
| 93 | + $safe_task_description, |
|
| 94 | + $_POST['chkArticleDelete'], |
|
| 95 | + $_POST['chkArticleEdit'], |
|
| 96 | + $_POST['chkCommentsDelete'], |
|
| 97 | + $_POST['task_color'] |
|
| 98 | + ); |
|
| 99 | + $return_message = array( |
|
| 100 | + 'type' => 'confirmation', |
|
| 101 | + 'message' => get_lang('TaskEdited') |
|
| 102 | + ); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | if (!empty($_POST['assign_task_submit'])) { |
| 106 | - Blog:: assign_task( |
|
| 107 | - $blog_id, |
|
| 108 | - $_POST['task_user_id'], |
|
| 109 | - $_POST['task_task_id'], |
|
| 110 | - $_POST['task_day'] |
|
| 111 | - ); |
|
| 112 | - $return_message = array( |
|
| 113 | - 'type' => 'confirmation', |
|
| 114 | - 'message' => get_lang('TaskAssigned') |
|
| 115 | - ); |
|
| 106 | + Blog:: assign_task( |
|
| 107 | + $blog_id, |
|
| 108 | + $_POST['task_user_id'], |
|
| 109 | + $_POST['task_task_id'], |
|
| 110 | + $_POST['task_day'] |
|
| 111 | + ); |
|
| 112 | + $return_message = array( |
|
| 113 | + 'type' => 'confirmation', |
|
| 114 | + 'message' => get_lang('TaskAssigned') |
|
| 115 | + ); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (isset($_POST['assign_task_edit_submit'])) { |
| 119 | - Blog:: edit_assigned_task( |
|
| 120 | - $blog_id, |
|
| 121 | - $_POST['task_user_id'], |
|
| 122 | - $_POST['task_task_id'], |
|
| 123 | - $_POST['task_day'], |
|
| 124 | - $_POST['old_user_id'], |
|
| 125 | - $_POST['old_task_id'], |
|
| 126 | - $_POST['old_target_date'] |
|
| 127 | - ); |
|
| 128 | - $return_message = array( |
|
| 129 | - 'type' => 'confirmation', |
|
| 130 | - 'message' => get_lang('AssignedTaskEdited') |
|
| 131 | - ); |
|
| 119 | + Blog:: edit_assigned_task( |
|
| 120 | + $blog_id, |
|
| 121 | + $_POST['task_user_id'], |
|
| 122 | + $_POST['task_task_id'], |
|
| 123 | + $_POST['task_day'], |
|
| 124 | + $_POST['old_user_id'], |
|
| 125 | + $_POST['old_task_id'], |
|
| 126 | + $_POST['old_target_date'] |
|
| 127 | + ); |
|
| 128 | + $return_message = array( |
|
| 129 | + 'type' => 'confirmation', |
|
| 130 | + 'message' => get_lang('AssignedTaskEdited') |
|
| 131 | + ); |
|
| 132 | 132 | } |
| 133 | 133 | if (!empty($_POST['new_task_execution_submit'])) { |
| 134 | - Blog:: create_comment( |
|
| 135 | - $safe_comment_title, |
|
| 136 | - $safe_comment_text, |
|
| 137 | - $blog_id, |
|
| 138 | - (int)$_GET['post_id'], |
|
| 139 | - $_POST['comment_parent_id'], |
|
| 140 | - $_POST['task_id'] |
|
| 141 | - ); |
|
| 142 | - $return_message = array( |
|
| 143 | - 'type' => 'confirmation', |
|
| 144 | - 'message' => get_lang('CommentCreated') |
|
| 145 | - ); |
|
| 134 | + Blog:: create_comment( |
|
| 135 | + $safe_comment_title, |
|
| 136 | + $safe_comment_text, |
|
| 137 | + $blog_id, |
|
| 138 | + (int)$_GET['post_id'], |
|
| 139 | + $_POST['comment_parent_id'], |
|
| 140 | + $_POST['task_id'] |
|
| 141 | + ); |
|
| 142 | + $return_message = array( |
|
| 143 | + 'type' => 'confirmation', |
|
| 144 | + 'message' => get_lang('CommentCreated') |
|
| 145 | + ); |
|
| 146 | 146 | } |
| 147 | 147 | if (!empty($_POST['register'])) { |
| 148 | - if (is_array($_POST['user'])) { |
|
| 149 | - foreach ($_POST['user'] as $index => $user_id) { |
|
| 150 | - Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id); |
|
| 151 | - } |
|
| 152 | - } |
|
| 148 | + if (is_array($_POST['user'])) { |
|
| 149 | + foreach ($_POST['user'] as $index => $user_id) { |
|
| 150 | + Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id); |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | 153 | } |
| 154 | 154 | if (!empty($_POST['unregister'])) { |
| 155 | - if (is_array($_POST['user'])) { |
|
| 156 | - foreach ($_POST['user'] as $index => $user_id) { |
|
| 157 | - Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id); |
|
| 158 | - } |
|
| 159 | - } |
|
| 155 | + if (is_array($_POST['user'])) { |
|
| 156 | + foreach ($_POST['user'] as $index => $user_id) { |
|
| 157 | + Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id); |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | 160 | } |
| 161 | 161 | if (!empty($_GET['register'])) { |
| 162 | - Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
| 163 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered')); |
|
| 164 | - $flag = 1; |
|
| 162 | + Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
| 163 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered')); |
|
| 164 | + $flag = 1; |
|
| 165 | 165 | } |
| 166 | 166 | if (!empty($_GET['unregister'])) { |
| 167 | - Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
| 167 | + Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') { |
| 171 | - if (isset($_GET['do']) && $_GET['do'] == 'delete') { |
|
| 172 | - Blog :: delete_task($blog_id, (int)$_GET['task_id']); |
|
| 173 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted')); |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment') { |
|
| 177 | - Blog :: delete_assigned_task($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); |
|
| 178 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssignmentDeleted')); |
|
| 179 | - } |
|
| 171 | + if (isset($_GET['do']) && $_GET['do'] == 'delete') { |
|
| 172 | + Blog :: delete_task($blog_id, (int)$_GET['task_id']); |
|
| 173 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted')); |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment') { |
|
| 177 | + Blog :: delete_assigned_task($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); |
|
| 178 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssignmentDeleted')); |
|
| 179 | + } |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | if (isset($_GET['action']) && $_GET['action'] == 'view_post') { |
| 183 | - $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
|
| 184 | - |
|
| 185 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') { |
|
| 186 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) { |
|
| 187 | - Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']); |
|
| 188 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted')); |
|
| 189 | - } else { |
|
| 190 | - $error = true; |
|
| 191 | - $message = get_lang('ActionNotAllowed'); |
|
| 192 | - } |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_article') { |
|
| 196 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) { |
|
| 197 | - Blog :: delete_post($blog_id, (int)$_GET['article_id']); |
|
| 198 | - $action = ''; // Article is gone, go to blog home |
|
| 199 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted')); |
|
| 200 | - } else { |
|
| 201 | - $error = true; |
|
| 202 | - $message = get_lang('ActionNotAllowed'); |
|
| 203 | - } |
|
| 204 | - } |
|
| 205 | - if (isset($_GET['do']) && $_GET['do'] == 'rate') { |
|
| 206 | - if (isset($_GET['type']) && $_GET['type'] == 'post') { |
|
| 207 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) { |
|
| 208 | - Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']); |
|
| 209 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
|
| 210 | - } |
|
| 211 | - } |
|
| 212 | - if (isset($_GET['type']) && $_GET['type'] == 'comment') { |
|
| 213 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) { |
|
| 214 | - Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']); |
|
| 215 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
|
| 216 | - } |
|
| 217 | - } |
|
| 218 | - } |
|
| 183 | + $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
|
| 184 | + |
|
| 185 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') { |
|
| 186 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) { |
|
| 187 | + Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']); |
|
| 188 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted')); |
|
| 189 | + } else { |
|
| 190 | + $error = true; |
|
| 191 | + $message = get_lang('ActionNotAllowed'); |
|
| 192 | + } |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_article') { |
|
| 196 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) { |
|
| 197 | + Blog :: delete_post($blog_id, (int)$_GET['article_id']); |
|
| 198 | + $action = ''; // Article is gone, go to blog home |
|
| 199 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted')); |
|
| 200 | + } else { |
|
| 201 | + $error = true; |
|
| 202 | + $message = get_lang('ActionNotAllowed'); |
|
| 203 | + } |
|
| 204 | + } |
|
| 205 | + if (isset($_GET['do']) && $_GET['do'] == 'rate') { |
|
| 206 | + if (isset($_GET['type']) && $_GET['type'] == 'post') { |
|
| 207 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) { |
|
| 208 | + Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']); |
|
| 209 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
|
| 210 | + } |
|
| 211 | + } |
|
| 212 | + if (isset($_GET['type']) && $_GET['type'] == 'comment') { |
|
| 213 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) { |
|
| 214 | + Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']); |
|
| 215 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
|
| 216 | + } |
|
| 217 | + } |
|
| 218 | + } |
|
| 219 | 219 | } |
| 220 | 220 | /* |
| 221 | 221 | DISPLAY |
@@ -223,67 +223,67 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | // Set breadcrumb |
| 225 | 225 | switch ($action) { |
| 226 | - case 'new_post' : |
|
| 227 | - $nameTools = get_lang('NewPost'); |
|
| 226 | + case 'new_post' : |
|
| 227 | + $nameTools = get_lang('NewPost'); |
|
| 228 | 228 | $interbreadcrumb[] = array( |
| 229 | 229 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
| 230 | 230 | "name" => Blog:: get_blog_title($blog_id), |
| 231 | 231 | ); |
| 232 | - Display :: display_header($nameTools, 'Blogs'); |
|
| 233 | - break; |
|
| 234 | - case 'manage_tasks' : |
|
| 235 | - $nameTools = get_lang('TaskManager'); |
|
| 232 | + Display :: display_header($nameTools, 'Blogs'); |
|
| 233 | + break; |
|
| 234 | + case 'manage_tasks' : |
|
| 235 | + $nameTools = get_lang('TaskManager'); |
|
| 236 | 236 | $interbreadcrumb[] = array( |
| 237 | 237 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
| 238 | 238 | "name" => Blog:: get_blog_title($blog_id), |
| 239 | 239 | ); |
| 240 | - Display :: display_header($nameTools, 'Blogs'); |
|
| 241 | - break; |
|
| 242 | - case 'manage_members' : |
|
| 243 | - $nameTools = get_lang('MemberManager'); |
|
| 240 | + Display :: display_header($nameTools, 'Blogs'); |
|
| 241 | + break; |
|
| 242 | + case 'manage_members' : |
|
| 243 | + $nameTools = get_lang('MemberManager'); |
|
| 244 | 244 | $interbreadcrumb[] = array( |
| 245 | 245 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
| 246 | 246 | "name" => Blog:: get_blog_title($blog_id), |
| 247 | 247 | ); |
| 248 | - Display :: display_header($nameTools, 'Blogs'); |
|
| 249 | - break; |
|
| 250 | - case 'manage_rights' : |
|
| 251 | - $nameTools = get_lang('RightsManager'); |
|
| 248 | + Display :: display_header($nameTools, 'Blogs'); |
|
| 249 | + break; |
|
| 250 | + case 'manage_rights' : |
|
| 251 | + $nameTools = get_lang('RightsManager'); |
|
| 252 | 252 | $interbreadcrumb[] = array( |
| 253 | 253 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
| 254 | 254 | 'name' => Blog:: get_blog_title($blog_id), |
| 255 | 255 | ); |
| 256 | - Display :: display_header($nameTools, 'Blogs'); |
|
| 257 | - break; |
|
| 258 | - case 'view_search_result' : |
|
| 259 | - $nameTools = get_lang('SearchResults'); |
|
| 256 | + Display :: display_header($nameTools, 'Blogs'); |
|
| 257 | + break; |
|
| 258 | + case 'view_search_result' : |
|
| 259 | + $nameTools = get_lang('SearchResults'); |
|
| 260 | 260 | $interbreadcrumb[] = array( |
| 261 | 261 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
| 262 | 262 | 'name' => Blog:: get_blog_title($blog_id), |
| 263 | 263 | ); |
| 264 | - Display :: display_header($nameTools, 'Blogs'); |
|
| 265 | - break; |
|
| 266 | - case 'execute_task' : |
|
| 267 | - $nameTools = get_lang('ExecuteThisTask'); |
|
| 264 | + Display :: display_header($nameTools, 'Blogs'); |
|
| 265 | + break; |
|
| 266 | + case 'execute_task' : |
|
| 267 | + $nameTools = get_lang('ExecuteThisTask'); |
|
| 268 | 268 | $interbreadcrumb[] = array( |
| 269 | 269 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
| 270 | 270 | 'name' => Blog:: get_blog_title($blog_id), |
| 271 | 271 | ); |
| 272 | - Display :: display_header($nameTools, 'Blogs'); |
|
| 273 | - break; |
|
| 274 | - default : |
|
| 275 | - $nameTools = Blog :: get_blog_title($blog_id); |
|
| 276 | - Display :: display_header($nameTools, 'Blogs'); |
|
| 272 | + Display :: display_header($nameTools, 'Blogs'); |
|
| 273 | + break; |
|
| 274 | + default : |
|
| 275 | + $nameTools = Blog :: get_blog_title($blog_id); |
|
| 276 | + Display :: display_header($nameTools, 'Blogs'); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | // feedback messages |
| 280 | 280 | if (!empty($return_message)) { |
| 281 | - if ($return_message['type'] == 'confirmation') { |
|
| 282 | - Display::display_confirmation_message($return_message['message']); |
|
| 283 | - } |
|
| 284 | - if ($return_message['type'] == 'error') { |
|
| 285 | - Display::display_error_message($return_message['message']); |
|
| 286 | - } |
|
| 281 | + if ($return_message['type'] == 'confirmation') { |
|
| 282 | + Display::display_confirmation_message($return_message['message']); |
|
| 283 | + } |
|
| 284 | + if ($return_message['type'] == 'error') { |
|
| 285 | + Display::display_error_message($return_message['message']); |
|
| 286 | + } |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // actions |
@@ -350,12 +350,12 @@ discard block |
||
| 350 | 350 | <?php |
| 351 | 351 | |
| 352 | 352 | if (isset($error)) { |
| 353 | - Display :: display_error_message($message); |
|
| 353 | + Display :: display_error_message($message); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | if (isset($flag) && $flag == '1') { |
| 357 | - $action = "manage_tasks"; |
|
| 358 | - Blog :: display_assign_task_form($blog_id); |
|
| 357 | + $action = "manage_tasks"; |
|
| 358 | + Blog :: display_assign_task_form($blog_id); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | $user_task = false; |
@@ -363,12 +363,12 @@ discard block |
||
| 363 | 363 | $course_id = api_get_course_int_id(); |
| 364 | 364 | |
| 365 | 365 | if (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) { |
| 366 | - $task_id = (int)$_GET['task_id']; |
|
| 366 | + $task_id = (int)$_GET['task_id']; |
|
| 367 | 367 | } else { |
| 368 | - $task_id = 0; |
|
| 369 | - $tbl_blogs_tasks_rel_user = Database :: get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 368 | + $task_id = 0; |
|
| 369 | + $tbl_blogs_tasks_rel_user = Database :: get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
| 370 | 370 | |
| 371 | - $sql = "SELECT COUNT(*) as number |
|
| 371 | + $sql = "SELECT COUNT(*) as number |
|
| 372 | 372 | FROM ".$tbl_blogs_tasks_rel_user." |
| 373 | 373 | WHERE |
| 374 | 374 | c_id = $course_id AND |
@@ -376,120 +376,120 @@ discard block |
||
| 376 | 376 | user_id = ".api_get_user_id()." AND |
| 377 | 377 | task_id = ".$task_id; |
| 378 | 378 | |
| 379 | - $result = Database::query($sql); |
|
| 380 | - $row = Database::fetch_array($result); |
|
| 379 | + $result = Database::query($sql); |
|
| 380 | + $row = Database::fetch_array($result); |
|
| 381 | 381 | |
| 382 | - if ($row['number'] == 1) |
|
| 383 | - $user_task = true; |
|
| 382 | + if ($row['number'] == 1) |
|
| 383 | + $user_task = true; |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | switch ($action) { |
| 387 | - case 'new_post': |
|
| 388 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_add', $user_task ? $task_id : 0)) { |
|
| 389 | - // we show the form if |
|
| 390 | - // 1. no post data |
|
| 391 | - // 2. there is post data and the required field is empty |
|
| 392 | - if (!$_POST OR (!empty($_POST) AND empty($_POST['title']))) { |
|
| 393 | - // if there is post data there is certainly an error in the form |
|
| 394 | - if ($_POST) { |
|
| 395 | - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
|
| 396 | - } |
|
| 397 | - Blog :: display_form_new_post($blog_id); |
|
| 398 | - } else { |
|
| 399 | - if (isset($_GET['filter']) && !empty($_GET['filter'])) { |
|
| 400 | - Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
| 401 | - } else { |
|
| 402 | - Blog :: display_blog_posts($blog_id); |
|
| 403 | - } |
|
| 404 | - } |
|
| 405 | - } else { |
|
| 406 | - api_not_allowed(); |
|
| 407 | - } |
|
| 408 | - break; |
|
| 409 | - case 'view_post' : |
|
| 410 | - Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
| 411 | - break; |
|
| 412 | - case 'edit_post' : |
|
| 413 | - $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
|
| 414 | - |
|
| 415 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) { |
|
| 416 | - // we show the form if |
|
| 417 | - // 1. no post data |
|
| 418 | - // 2. there is post data and the required field is empty |
|
| 419 | - if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title']))) { |
|
| 420 | - // if there is post data there is certainly an error in the form |
|
| 421 | - if ($_POST) { |
|
| 422 | - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
|
| 423 | - } |
|
| 387 | + case 'new_post': |
|
| 388 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_add', $user_task ? $task_id : 0)) { |
|
| 389 | + // we show the form if |
|
| 390 | + // 1. no post data |
|
| 391 | + // 2. there is post data and the required field is empty |
|
| 392 | + if (!$_POST OR (!empty($_POST) AND empty($_POST['title']))) { |
|
| 393 | + // if there is post data there is certainly an error in the form |
|
| 394 | + if ($_POST) { |
|
| 395 | + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
|
| 396 | + } |
|
| 397 | + Blog :: display_form_new_post($blog_id); |
|
| 398 | + } else { |
|
| 399 | + if (isset($_GET['filter']) && !empty($_GET['filter'])) { |
|
| 400 | + Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
| 401 | + } else { |
|
| 402 | + Blog :: display_blog_posts($blog_id); |
|
| 403 | + } |
|
| 404 | + } |
|
| 405 | + } else { |
|
| 406 | + api_not_allowed(); |
|
| 407 | + } |
|
| 408 | + break; |
|
| 409 | + case 'view_post' : |
|
| 410 | + Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
| 411 | + break; |
|
| 412 | + case 'edit_post' : |
|
| 413 | + $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
|
| 414 | + |
|
| 415 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) { |
|
| 416 | + // we show the form if |
|
| 417 | + // 1. no post data |
|
| 418 | + // 2. there is post data and the required field is empty |
|
| 419 | + if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title']))) { |
|
| 420 | + // if there is post data there is certainly an error in the form |
|
| 421 | + if ($_POST) { |
|
| 422 | + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
|
| 423 | + } |
|
| 424 | 424 | Blog :: display_form_edit_post($blog_id, intval($_GET['post_id'])); |
| 425 | - } else { |
|
| 426 | - if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { |
|
| 427 | - Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
| 428 | - } else { |
|
| 429 | - Blog :: display_blog_posts($blog_id); |
|
| 430 | - } |
|
| 431 | - } |
|
| 432 | - } else { |
|
| 433 | - api_not_allowed(); |
|
| 434 | - } |
|
| 435 | - |
|
| 436 | - break; |
|
| 437 | - case 'manage_members' : |
|
| 438 | - if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) { |
|
| 439 | - Blog :: display_form_user_subscribe($blog_id); |
|
| 440 | - echo '<br /><br />'; |
|
| 441 | - Blog :: display_form_user_unsubscribe($blog_id); |
|
| 442 | - } else { |
|
| 443 | - api_not_allowed(); |
|
| 425 | + } else { |
|
| 426 | + if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { |
|
| 427 | + Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
| 428 | + } else { |
|
| 429 | + Blog :: display_blog_posts($blog_id); |
|
| 430 | + } |
|
| 431 | + } |
|
| 432 | + } else { |
|
| 433 | + api_not_allowed(); |
|
| 434 | + } |
|
| 435 | + |
|
| 436 | + break; |
|
| 437 | + case 'manage_members' : |
|
| 438 | + if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) { |
|
| 439 | + Blog :: display_form_user_subscribe($blog_id); |
|
| 440 | + echo '<br /><br />'; |
|
| 441 | + Blog :: display_form_user_unsubscribe($blog_id); |
|
| 442 | + } else { |
|
| 443 | + api_not_allowed(); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - break; |
|
| 447 | - case 'manage_rights' : |
|
| 448 | - Blog :: display_form_user_rights($blog_id); |
|
| 449 | - break; |
|
| 450 | - case 'manage_tasks' : |
|
| 451 | - if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) { |
|
| 452 | - if (isset($_GET['do']) && $_GET['do'] == 'add') { |
|
| 453 | - Blog:: display_new_task_form($blog_id); |
|
| 454 | - } |
|
| 455 | - if (isset($_GET['do']) && $_GET['do'] == 'assign') { |
|
| 456 | - Blog:: display_assign_task_form($blog_id); |
|
| 457 | - } |
|
| 458 | - if (isset($_GET['do']) && $_GET['do'] == 'edit') { |
|
| 459 | - Blog:: display_edit_task_form( |
|
| 460 | - $blog_id, |
|
| 461 | - intval($_GET['task_id']) |
|
| 462 | - ); |
|
| 463 | - } |
|
| 464 | - if (isset($_GET['do']) && $_GET['do'] == 'edit_assignment') { |
|
| 465 | - Blog :: display_edit_assigned_task_form($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); |
|
| 466 | - } |
|
| 467 | - Blog :: display_task_list($blog_id); |
|
| 468 | - echo '<br /><br />'; |
|
| 469 | - Blog :: display_assigned_task_list($blog_id); |
|
| 470 | - echo '<br /><br />'; |
|
| 471 | - } |
|
| 472 | - else |
|
| 473 | - api_not_allowed(); |
|
| 474 | - |
|
| 475 | - break; |
|
| 476 | - case 'execute_task' : |
|
| 477 | - if (isset ($_GET['post_id'])) |
|
| 478 | - Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
| 479 | - else |
|
| 480 | - Blog :: display_select_task_post($blog_id, intval($_GET['task_id'])); |
|
| 481 | - |
|
| 482 | - break; |
|
| 483 | - case 'view_search_result' : |
|
| 484 | - Blog :: display_search_results($blog_id, Database::escape_string($_GET['q'])); |
|
| 485 | - break; |
|
| 486 | - case '' : |
|
| 487 | - default : |
|
| 488 | - if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { |
|
| 489 | - Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
| 490 | - } else { |
|
| 491 | - Blog :: display_blog_posts($blog_id); |
|
| 492 | - } |
|
| 446 | + break; |
|
| 447 | + case 'manage_rights' : |
|
| 448 | + Blog :: display_form_user_rights($blog_id); |
|
| 449 | + break; |
|
| 450 | + case 'manage_tasks' : |
|
| 451 | + if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) { |
|
| 452 | + if (isset($_GET['do']) && $_GET['do'] == 'add') { |
|
| 453 | + Blog:: display_new_task_form($blog_id); |
|
| 454 | + } |
|
| 455 | + if (isset($_GET['do']) && $_GET['do'] == 'assign') { |
|
| 456 | + Blog:: display_assign_task_form($blog_id); |
|
| 457 | + } |
|
| 458 | + if (isset($_GET['do']) && $_GET['do'] == 'edit') { |
|
| 459 | + Blog:: display_edit_task_form( |
|
| 460 | + $blog_id, |
|
| 461 | + intval($_GET['task_id']) |
|
| 462 | + ); |
|
| 463 | + } |
|
| 464 | + if (isset($_GET['do']) && $_GET['do'] == 'edit_assignment') { |
|
| 465 | + Blog :: display_edit_assigned_task_form($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); |
|
| 466 | + } |
|
| 467 | + Blog :: display_task_list($blog_id); |
|
| 468 | + echo '<br /><br />'; |
|
| 469 | + Blog :: display_assigned_task_list($blog_id); |
|
| 470 | + echo '<br /><br />'; |
|
| 471 | + } |
|
| 472 | + else |
|
| 473 | + api_not_allowed(); |
|
| 474 | + |
|
| 475 | + break; |
|
| 476 | + case 'execute_task' : |
|
| 477 | + if (isset ($_GET['post_id'])) |
|
| 478 | + Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
| 479 | + else |
|
| 480 | + Blog :: display_select_task_post($blog_id, intval($_GET['task_id'])); |
|
| 481 | + |
|
| 482 | + break; |
|
| 483 | + case 'view_search_result' : |
|
| 484 | + Blog :: display_search_results($blog_id, Database::escape_string($_GET['q'])); |
|
| 485 | + break; |
|
| 486 | + case '' : |
|
| 487 | + default : |
|
| 488 | + if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { |
|
| 489 | + Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
| 490 | + } else { |
|
| 491 | + Blog :: display_blog_posts($blog_id); |
|
| 492 | + } |
|
| 493 | 493 | } |
| 494 | 494 | ?> |
| 495 | 495 | </div> |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | api_protect_course_script(true); |
| 22 | 22 | |
| 23 | 23 | $lib_path = api_get_path(LIBRARY_PATH); |
| 24 | -$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 24 | +$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT); |
|
| 25 | 25 | |
| 26 | 26 | $nameTools = get_lang('Blogs'); |
| 27 | 27 | $DaysShort = api_get_week_days_short(); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $safe_comment_title, |
| 135 | 135 | $safe_comment_text, |
| 136 | 136 | $blog_id, |
| 137 | - (int)$_GET['post_id'], |
|
| 137 | + (int) $_GET['post_id'], |
|
| 138 | 138 | $_POST['comment_parent_id'], |
| 139 | 139 | $_POST['task_id'] |
| 140 | 140 | ); |
@@ -146,29 +146,29 @@ discard block |
||
| 146 | 146 | if (!empty($_POST['register'])) { |
| 147 | 147 | if (is_array($_POST['user'])) { |
| 148 | 148 | foreach ($_POST['user'] as $index => $user_id) { |
| 149 | - Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id); |
|
| 149 | + Blog :: set_user_subscribed((int) $_GET['blog_id'], $user_id); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | if (!empty($_POST['unregister'])) { |
| 154 | 154 | if (is_array($_POST['user'])) { |
| 155 | 155 | foreach ($_POST['user'] as $index => $user_id) { |
| 156 | - Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id); |
|
| 156 | + Blog :: set_user_unsubscribed((int) $_GET['blog_id'], $user_id); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | if (!empty($_GET['register'])) { |
| 161 | - Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
| 161 | + Blog :: set_user_subscribed((int) $_GET['blog_id'], (int) $_GET['user_id']); |
|
| 162 | 162 | $return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered')); |
| 163 | 163 | $flag = 1; |
| 164 | 164 | } |
| 165 | 165 | if (!empty($_GET['unregister'])) { |
| 166 | - Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
| 166 | + Blog :: set_user_unsubscribed((int) $_GET['blog_id'], (int) $_GET['user_id']); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') { |
| 170 | 170 | if (isset($_GET['do']) && $_GET['do'] == 'delete') { |
| 171 | - Blog :: delete_task($blog_id, (int)$_GET['task_id']); |
|
| 171 | + Blog :: delete_task($blog_id, (int) $_GET['task_id']); |
|
| 172 | 172 | $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted')); |
| 173 | 173 | } |
| 174 | 174 | |
@@ -181,9 +181,9 @@ discard block |
||
| 181 | 181 | if (isset($_GET['action']) && $_GET['action'] == 'view_post') { |
| 182 | 182 | $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
| 183 | 183 | |
| 184 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') { |
|
| 184 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') { |
|
| 185 | 185 | if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) { |
| 186 | - Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']); |
|
| 186 | + Blog :: delete_comment($blog_id, (int) $_GET['post_id'], (int) $_GET['comment_id']); |
|
| 187 | 187 | $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted')); |
| 188 | 188 | } else { |
| 189 | 189 | $error = true; |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_article') { |
|
| 194 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_article') { |
|
| 195 | 195 | if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) { |
| 196 | - Blog :: delete_post($blog_id, (int)$_GET['article_id']); |
|
| 196 | + Blog :: delete_post($blog_id, (int) $_GET['article_id']); |
|
| 197 | 197 | $action = ''; // Article is gone, go to blog home |
| 198 | 198 | $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted')); |
| 199 | 199 | } else { |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | if (isset($_GET['do']) && $_GET['do'] == 'rate') { |
| 205 | 205 | if (isset($_GET['type']) && $_GET['type'] == 'post') { |
| 206 | 206 | if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) { |
| 207 | - Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']); |
|
| 207 | + Blog :: add_rating('post', $blog_id, (int) $_GET['post_id'], (int) $_GET['rating']); |
|
| 208 | 208 | $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | if (isset($_GET['type']) && $_GET['type'] == 'comment') { |
| 212 | 212 | if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) { |
| 213 | - Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']); |
|
| 213 | + Blog :: add_rating('comment', $blog_id, (int) $_GET['comment_id'], (int) $_GET['rating']); |
|
| 214 | 214 | $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
| 215 | 215 | } |
| 216 | 216 | } |
@@ -289,16 +289,16 @@ discard block |
||
| 289 | 289 | echo '<div class=actions>'; |
| 290 | 290 | ?> |
| 291 | 291 | <a href="<?php echo api_get_self(); ?>?blog_id=<?php echo $blog_id ?>&<?php echo api_get_cidreq(); ?>" title="<?php echo get_lang('Home') ?>"> |
| 292 | - <?php echo Display::return_icon('blog.png', get_lang('Home'),'',ICON_SIZE_MEDIUM); ?></a> |
|
| 293 | - <?php if(api_is_allowed('BLOG_'.$blog_id, 'article_add')) { ?> |
|
| 292 | + <?php echo Display::return_icon('blog.png', get_lang('Home'), '', ICON_SIZE_MEDIUM); ?></a> |
|
| 293 | + <?php if (api_is_allowed('BLOG_'.$blog_id, 'article_add')) { ?> |
|
| 294 | 294 | <a href="<?php echo api_get_self(); ?>?action=new_post&blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('NewPost') ?>"> |
| 295 | - <?php echo Display::return_icon('new_article.png', get_lang('NewPost'),'',ICON_SIZE_MEDIUM); ?></a><?php } ?> |
|
| 296 | - <?php if(api_is_allowed('BLOG_'.$blog_id, 'task_management')) { ?> |
|
| 295 | + <?php echo Display::return_icon('new_article.png', get_lang('NewPost'), '', ICON_SIZE_MEDIUM); ?></a><?php } ?> |
|
| 296 | + <?php if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) { ?> |
|
| 297 | 297 | <a href="<?php echo api_get_self(); ?>?action=manage_tasks&blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageTasks') ?>"> |
| 298 | - <?php echo Display::return_icon('blog_tasks.png', get_lang('TaskManager'),'',ICON_SIZE_MEDIUM); ?></a><?php } ?> |
|
| 299 | - <?php if(api_is_allowed('BLOG_'.$blog_id, 'member_management')) { ?> |
|
| 298 | + <?php echo Display::return_icon('blog_tasks.png', get_lang('TaskManager'), '', ICON_SIZE_MEDIUM); ?></a><?php } ?> |
|
| 299 | + <?php if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) { ?> |
|
| 300 | 300 | <a href="<?php echo api_get_self(); ?>?action=manage_members&blog_id=<?php echo $blog_id ?>" title="<?php echo get_lang('ManageMembers') ?>"> |
| 301 | - <?php echo Display::return_icon('blog_admin_users.png', get_lang('MemberManager'),'',ICON_SIZE_MEDIUM); ?></a><?php } ?> |
|
| 301 | + <?php echo Display::return_icon('blog_admin_users.png', get_lang('MemberManager'), '', ICON_SIZE_MEDIUM); ?></a><?php } ?> |
|
| 302 | 302 | <?php |
| 303 | 303 | echo '</div>'; |
| 304 | 304 | |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | <div class="panel-heading"><?php echo get_lang('Calendar') ?></div> |
| 317 | 317 | <div class="panel-body"> |
| 318 | 318 | <?php |
| 319 | - $month = isset($_GET['month']) ? (int)$_GET['month'] : (int) date('m'); |
|
| 320 | - $year = isset($_GET['year']) ? (int)$_GET['year'] : date('Y'); |
|
| 319 | + $month = isset($_GET['month']) ? (int) $_GET['month'] : (int) date('m'); |
|
| 320 | + $year = isset($_GET['year']) ? (int) $_GET['year'] : date('Y'); |
|
| 321 | 321 | Blog::display_minimonthcalendar($month, $year, $blog_id); |
| 322 | 322 | ?> |
| 323 | 323 | </div> |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | $course_id = api_get_course_int_id(); |
| 363 | 363 | |
| 364 | 364 | if (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) { |
| 365 | - $task_id = (int)$_GET['task_id']; |
|
| 365 | + $task_id = (int) $_GET['task_id']; |
|
| 366 | 366 | } else { |
| 367 | 367 | $task_id = 0; |
| 368 | 368 | $tbl_blogs_tasks_rel_user = Database :: get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
@@ -9,15 +9,15 @@ discard block |
||
| 9 | 9 | api_block_anonymous_users(); |
| 10 | 10 | GradebookUtils::block_students(); |
| 11 | 11 | |
| 12 | -$interbreadcrumb[] = array ( |
|
| 12 | +$interbreadcrumb[] = array( |
|
| 13 | 13 | 'url' => $_SESSION['gradebook_dest'].'?', |
| 14 | 14 | 'name' => get_lang('Gradebook' |
| 15 | 15 | )); |
| 16 | -$interbreadcrumb[] = array ( |
|
| 16 | +$interbreadcrumb[] = array( |
|
| 17 | 17 | 'url' => $_SESSION['gradebook_dest'].'?selectcat='.Security::remove_XSS($_GET['selectcat']), |
| 18 | 18 | 'name' => get_lang('Details' |
| 19 | 19 | )); |
| 20 | -$interbreadcrumb[] = array ( |
|
| 20 | +$interbreadcrumb[] = array( |
|
| 21 | 21 | 'url' => 'gradebook_showlog_eval.php?visiblelog='.Security::remove_XSS($_GET['visiblelog']).'&selectcat='.Security::remove_XSS($_GET['selectcat']), |
| 22 | 22 | 'name' => get_lang('GradebookQualifyLog') |
| 23 | 23 | ); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | $t_linkeval_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); |
| 30 | 30 | $t_user = Database :: get_main_table(TABLE_MAIN_USER); |
| 31 | -$visible_log=Security::remove_XSS($_GET['visiblelog']); |
|
| 31 | +$visible_log = Security::remove_XSS($_GET['visiblelog']); |
|
| 32 | 32 | |
| 33 | 33 | $evaledit = Evaluation :: load($visible_log); |
| 34 | 34 | $sql = "SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | $list_info[] = $row; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | -foreach($list_info as $key => $info_log) { |
|
| 46 | - $list_info[$key][5]=($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A'; |
|
| 47 | - $list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible'); |
|
| 45 | +foreach ($list_info as $key => $info_log) { |
|
| 46 | + $list_info[$key][5] = ($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A'; |
|
| 47 | + $list_info[$key][3] = ($info_log[3] == 1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible'); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $parameters = array( |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $cat->setGenerateCertificates(false); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if ($values['hid_parent_id'] == 0 ) { |
|
| 65 | + if ($values['hid_parent_id'] == 0) { |
|
| 66 | 66 | $cat->set_certificate_min_score($values['certif_min_score']); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -81,12 +81,12 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | $cat->save(); |
| 84 | - header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?editcat=&selectcat=' . $cat->get_parent_id().'&'.api_get_cidreq()); |
|
| 84 | + header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?editcat=&selectcat='.$cat->get_parent_id().'&'.api_get_cidreq()); |
|
| 85 | 85 | exit; |
| 86 | 86 | } |
| 87 | 87 | $selectcat = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : ''; |
| 88 | 88 | $interbreadcrumb[] = array( |
| 89 | - 'url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $selectcat . '&' . api_get_cidreq(), |
|
| 89 | + 'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$selectcat.'&'.api_get_cidreq(), |
|
| 90 | 90 | 'name' => get_lang('Gradebook') |
| 91 | 91 | ); |
| 92 | 92 | $this_section = SECTION_COURSES; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | null, |
| 21 | 21 | 'edit_eval_form', |
| 22 | 22 | null, |
| 23 | - api_get_self() . '?editeval=' . Security::remove_XSS($_GET['editeval']) |
|
| 23 | + api_get_self().'?editeval='.Security::remove_XSS($_GET['editeval']) |
|
| 24 | 24 | ); |
| 25 | 25 | if ($form->validate()) { |
| 26 | 26 | $values = $form->exportValues(); |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | $eval->set_visible($visible); |
| 47 | 47 | $eval->save(); |
| 48 | - header('Location: '.$_SESSION['gradebook_dest'].'?editeval=&selectcat=' . $eval->get_category_id()); |
|
| 48 | + header('Location: '.$_SESSION['gradebook_dest'].'?editeval=&selectcat='.$eval->get_category_id()); |
|
| 49 | 49 | exit; |
| 50 | 50 | } |
| 51 | -$selectcat_inter=isset($_GET['selectcat'])?Security::remove_XSS($_GET['selectcat']):''; |
|
| 52 | -$interbreadcrumb[] = array ( |
|
| 51 | +$selectcat_inter = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : ''; |
|
| 52 | +$interbreadcrumb[] = array( |
|
| 53 | 53 | 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat_inter, |
| 54 | 54 | 'name' => get_lang('Gradebook' |
| 55 | 55 | )); |
@@ -162,17 +162,17 @@ |
||
| 162 | 162 | |
| 163 | 163 | if ($form->validate()) { |
| 164 | 164 | $officialCode = $form->getSubmitValue('filter'); |
| 165 | - if ($officialCode == 'all') { |
|
| 165 | + if ($officialCode == 'all') { |
|
| 166 | 166 | $certificate_list = GradebookUtils::get_list_users_certificates($cat_id); |
| 167 | 167 | } else { |
| 168 | - $userList = UserManager::getUsersByOfficialCode($officialCode); |
|
| 169 | - if (!empty($userList)) { |
|
| 170 | - $certificate_list = GradebookUtils::get_list_users_certificates( |
|
| 171 | - $cat_id, |
|
| 172 | - $userList |
|
| 173 | - ); |
|
| 174 | - } |
|
| 175 | - } |
|
| 168 | + $userList = UserManager::getUsersByOfficialCode($officialCode); |
|
| 169 | + if (!empty($userList)) { |
|
| 170 | + $certificate_list = GradebookUtils::get_list_users_certificates( |
|
| 171 | + $cat_id, |
|
| 172 | + $userList |
|
| 173 | + ); |
|
| 174 | + } |
|
| 175 | + } |
|
| 176 | 176 | } else { |
| 177 | 177 | $certificate_list = GradebookUtils::get_list_users_certificates($cat_id); |
| 178 | 178 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package chamilo.gradebook |
| 7 | 7 | */ |
| 8 | 8 | require_once '../inc/global.inc.php'; |
| 9 | -$current_course_tool = TOOL_GRADEBOOK; |
|
| 9 | +$current_course_tool = TOOL_GRADEBOOK; |
|
| 10 | 10 | |
| 11 | 11 | if (!api_is_student_boss()) { |
| 12 | 12 | api_protect_course_script(true); |
@@ -16,9 +16,9 @@ discard block |
||
| 16 | 16 | ini_set('max_execution_time', 0); |
| 17 | 17 | |
| 18 | 18 | //extra javascript functions for in html head: |
| 19 | -$htmlHeadXtra[] ="<script> |
|
| 19 | +$htmlHeadXtra[] = "<script> |
|
| 20 | 20 | function confirmation() { |
| 21 | - if (confirm(\" " . trim(get_lang('AreYouSureToDelete')) . " ?\")) { |
|
| 21 | + if (confirm(\" " . trim(get_lang('AreYouSureToDelete'))." ?\")) { |
|
| 22 | 22 | return true; |
| 23 | 23 | } else { |
| 24 | 24 | return false; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | api_not_allowed(true); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -$cat_id = isset($_GET['cat_id']) ? (int)$_GET['cat_id'] : null; |
|
| 34 | +$cat_id = isset($_GET['cat_id']) ? (int) $_GET['cat_id'] : null; |
|
| 35 | 35 | $action = isset($_GET['action']) && $_GET['action'] ? $_GET['action'] : null; |
| 36 | 36 | $filterOfficialCode = isset($_POST['filter']) ? Security::remove_XSS($_POST['filter']) : null; |
| 37 | 37 | $filterOfficialCodeGet = isset($_GET['filter']) ? Security::remove_XSS($_GET['filter']) : null; |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | $course_code = api_get_course_id(); |
| 74 | 74 | |
| 75 | -$interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?', 'name' => get_lang('Gradebook')); |
|
| 76 | -$interbreadcrumb[] = array('url' => '#','name' => get_lang('GradebookListOfStudentsCertificates')); |
|
| 75 | +$interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?', 'name' => get_lang('Gradebook')); |
|
| 76 | +$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('GradebookListOfStudentsCertificates')); |
|
| 77 | 77 | |
| 78 | 78 | $this_section = SECTION_COURSES; |
| 79 | 79 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $certificate = new Certificate($_GET['certificate_id']); |
| 86 | 86 | $result = $certificate->delete(true); |
| 87 | 87 | Security::clear_token(); |
| 88 | - if ($result ==true) { |
|
| 88 | + if ($result == true) { |
|
| 89 | 89 | Display::display_confirmation_message(get_lang('CertificateRemoved')); |
| 90 | 90 | } else { |
| 91 | 91 | Display::display_error_message(get_lang('CertificateNotRemoved')); |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | //with this fix the teacher only can view 1 gradebook |
| 106 | 106 | if (api_is_platform_admin()) { |
| 107 | - $stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id()); |
|
| 107 | + $stud_id = (api_is_allowed_to_edit() ? null : api_get_user_id()); |
|
| 108 | 108 | } else { |
| 109 | - $stud_id= api_get_user_id(); |
|
| 109 | + $stud_id = api_get_user_id(); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $total_weight = $cats[0]->get_weight(); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $alleval = $cats[0]->get_evaluations($stud_id); |
| 116 | 116 | $alllink = $cats[0]->get_links($stud_id); |
| 117 | 117 | |
| 118 | - $datagen = new GradebookDataGenerator ($allcat,$alleval, $alllink); |
|
| 118 | + $datagen = new GradebookDataGenerator($allcat, $alleval, $alllink); |
|
| 119 | 119 | |
| 120 | 120 | $total_resource_weight = 0; |
| 121 | 121 | if (!empty($datagen)) { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $newarray[] = array_slice($data, 1); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - foreach($newarray as $item) { |
|
| 135 | + foreach ($newarray as $item) { |
|
| 136 | 136 | $total_resource_weight = $total_resource_weight + $item['2']; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | if ($filter === 'true') { |
| 151 | 151 | echo '<br />'; |
| 152 | 152 | $options = UserManager::getOfficialCodeGrouped(); |
| 153 | - $options =array_merge(array('all' => get_lang('All')), $options); |
|
| 153 | + $options = array_merge(array('all' => get_lang('All')), $options); |
|
| 154 | 154 | $form = new FormValidator( |
| 155 | 155 | 'official_code_filter', |
| 156 | 156 | 'POST', |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | echo $filterForm; |
| 198 | 198 | |
| 199 | -if (count($certificate_list) == 0 ) { |
|
| 199 | +if (count($certificate_list) == 0) { |
|
| 200 | 200 | echo Display::display_warning_message(get_lang('NoResultsAvailable')); |
| 201 | 201 | } else { |
| 202 | 202 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $certificates = Display::url(get_lang('Certificate'), $url, array('target'=>'_blank', 'class' => 'btn btn-default')); |
| 220 | 220 | echo $certificates; |
| 221 | 221 | echo '<a onclick="return confirmation();" href="gradebook_display_certificate.php?sec_token='.$token.'&cidReq='.$course_code.'&action=delete&cat_id='.$cat_id.'&certificate_id='.$value_certificate['id'].'"> |
| 222 | - '.Display::return_icon('delete.png',get_lang('Delete')).' |
|
| 222 | + '.Display::return_icon('delete.png', get_lang('Delete')).' |
|
| 223 | 223 | </a>'; |
| 224 | 224 | echo '</td></tr>'; |
| 225 | 225 | } |