瀏覽代碼

Modify company reports for student boss role - refs BT#9441

Angel Fernando Quiroz Campos 10 年之前
父節點
當前提交
ea6e20a6e1
共有 4 個文件被更改,包括 92 次插入6 次删除
  1. 4 0
      main/inc/ajax/model.ajax.php
  2. 41 3
      main/mySpace/company_reports.php
  3. 43 3
      main/mySpace/company_reports_resumed.php
  4. 4 0
      main/mySpace/student.php

+ 4 - 0
main/inc/ajax/model.ajax.php

@@ -186,6 +186,10 @@ switch ($action) {
             if (empty($userIdList) || empty($courseCodeList)) {
                 exit;
             }
+        } else if(api_is_student_boss()) {
+            $users = UserManager::getUsersFollowedByStudentBoss(api_get_user_id());
+            
+            $userIdList = array_keys($users);
         }
         if ($action == 'get_user_course_report') {
             $count = CourseManager::get_count_user_list_from_course_code(false, null, $courseCodeList, $userIdList);

+ 41 - 3
main/mySpace/company_reports.php

@@ -12,8 +12,10 @@ $language_file = array('admin', 'gradebook', 'tracking');
 $cidReset = true;
 require_once '../inc/global.inc.php';
 
-if (!(api_is_platform_admin(false, true))) {
-    api_not_allowed();
+$userNotAllowed = !api_is_student_boss() && !api_is_platform_admin(false, true);
+
+if ($userNotAllowed) {
+    api_not_allowed(true);
 }
 
 $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace'));
@@ -88,7 +90,43 @@ $(function() {
     });
 });
 </script>';
-$content = Display::grid_html('user_course_report');
+
+$actions = null;
+
+if (api_is_student_boss()) {
+    $actions .= Display::url(
+        Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
+        api_get_path(WEB_CODE_PATH) . "auth/my_progress.php"
+    );
+    $actions .= Display::url(
+        Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
+        api_get_path(WEB_CODE_PATH) . "mySpace/student.php"
+    );
+    $actions .= Display::url(
+        Display::return_icon("statistics.png", get_lang("CompanyReport"), array(), ICON_SIZE_MEDIUM),
+        "#"
+    );
+}
+
+$content = '<div class="actions">';
+
+if (!empty($actions)) {
+    $content .= $actions;
+}
+
+$content .= '<div class="pull-right">';
+$content .= Display::url(
+    get_lang("CompanyReportResumed"),
+    api_get_path(WEB_CODE_PATH) . "mySpace/company_reports_resumed.php",
+    array(
+        'class' => 'btn btn-info'
+    )
+);
+
+$content .= '</div>';
+$content .= '</div>';
+$content .= '<h1 class="page-header">' . get_lang('CompanyReport') . '</h1>';
+$content .= Display::grid_html('user_course_report');
 
 $tpl = new Template($tool_name);
 $tpl->assign('content', $content);

+ 43 - 3
main/mySpace/company_reports_resumed.php

@@ -12,8 +12,10 @@ $cidReset = true;
 
 require_once '../inc/global.inc.php';
 
-if (!(api_is_platform_admin(false, true))) {
-    api_not_allowed();
+$userNotAllowed = !api_is_student_boss() && !api_is_platform_admin(false, true);
+
+if ($userNotAllowed) {
+    api_not_allowed(true);
 }
 
 $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('MySpace'));
@@ -83,7 +85,45 @@ $(function() {
     });
 });
 </script>';
-$content = Display::grid_html('user_course_report');
+
+$actions = null;
+
+if (api_is_student_boss()) {
+    $actions .= Display::url(
+        Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
+        api_get_path(WEB_CODE_PATH) . "auth/my_progress.php"
+    );
+    $actions .= Display::url(
+        Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
+        api_get_path(WEB_CODE_PATH) . "mySpace/student.php"
+    );
+    $actions .= Display::url(
+        Display::return_icon("statistics.png", get_lang("CompanyReport"), array(), ICON_SIZE_MEDIUM),
+        api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php"
+    );
+}
+
+$content = '<div class="actions">';
+
+if (!empty($actions)) {
+    $content .= $actions;
+}
+
+if (!api_is_student_boss()) {
+    $content .= '<div class="pull-right">';
+    $content .= Display::url(
+        get_lang("CompanyReport"),
+        api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php",
+        array(
+            'class' => 'btn btn-info'
+        )
+    );
+    $content .= '</div>';   
+}
+
+$content .= '</div>';
+$content .= '<h1 class="page-header">' . get_lang('CompanyReportResumed') . '</h1>';
+$content .= Display::grid_html('user_course_report');
 
 $tpl = new Template($tool_name);
 $tpl->assign('content', $content);

+ 4 - 0
main/mySpace/student.php

@@ -212,6 +212,10 @@ if (api_is_drh()) {
         Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
         '#'
     );
+    $actions .= Display::url(
+        Display::return_icon("statistics.png", get_lang("CompanyReport"), array(), ICON_SIZE_MEDIUM),
+        api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php"
+    );
 }
 
 $actions .= '<span style="float:right">';