Exemple #1
0
        }
    }
    $smarty->assign("T_USER_LESSONS", $userLessons);
    $smarty->assign("T_COURSE_LESSONS", $courseLessons);
    if (sizeof($userCourses) > 0) {
        $averages['courses'] = formatScore(round(array_sum($coursesScores) / sizeof($coursesScores), 2));
        $averages['ceus'] = array_sum($coursesCEUS);
    }
    if (sizeof($userLessons) > 0) {
        $averages['lessons'] = formatScore(round(array_sum($lessonsScores) / sizeof($lessonsScores), 2));
    }
    $smarty->assign("T_AVERAGES", $averages);
}
$smarty->assign("T_EMPLOYEE_FORM_CAPTION", _USERFORM . ": " . formatLogin($editedUser->user['login']));
if (isset($_GET['pdf'])) {
    $pdf = new EfrontPdf(_EMPLOYEEFORM . ": " . formatLogin($editedUser->user['login']));
    try {
        $avatarFile = new EfrontFile($infoUser->user['avatar']);
    } catch (Exception $e) {
        $avatarFile = new EfrontFile(G_SYSTEMAVATARSPATH . "unknown_small.png");
    }
    $info = array(array(_NAME, formatLogin($editedUser->user['login'])), array(_BIRTHDAY, formatTimestamp($editedEmployee->employee['birthday'])), array(_ADDRESS, $editedEmployee->employee['address']), array(_CITY, $editedEmployee->employee['city']), array(_HIREDON, formatTimestamp($editedEmployee->employee['hired_on'])), array(_LEFTON, formatTimestamp($editedEmployee->employee['left_on'])));
    $pdf->printInformationSection(_GENERALUSERINFO, $info, $avatarFile);
    $info = array();
    foreach ($jobs as $value) {
        $info[] = array($value['name'], strip_tags($value['description']) . ($value['supervisor'] ? _SUPERVISOR : ''));
    }
    $pdf->printInformationSection(_PLACEMENTS, $info);
    $info = array();
    foreach ($evaluations as $value) {
        $info[] = array(formatLogin($value['author']) . ' ' . formatTimestamp($value['timestamp']), strip_tags($value['specification']));
     if ($user['user_type'] == "student") {
         $students[$user['login']] = $user;
     } else {
         if ($user['user_type'] == "professor") {
             $professors[$user['login']] = $user;
         }
     }
 }
 if ($groupname || $branchName) {
     $studentsSize = sizeof($students);
     $professorsSize = sizeof($professors);
 } else {
     $studentsSize = sizeof($infoLesson->getUsers('student'));
     $professorsSize = sizeof($infoLesson->getUsers('professor'));
 }
 $pdf = new EfrontPdf($reportTitle);
 $info = array(array(_LESSON, $infoLesson->lesson['name']), array(_CATEGORY, $directionsPaths[$infoLesson->lesson['directions_ID']]), array(_STUDENTS, $studentsSize), array(_PROFESSORS, $professorsSize), array(_LANGUAGE, $languages[$infoLesson->lesson['languages_NAME']]), array(_ACTIVENEUTRAL, $infoLesson->lesson['active'] ? _YES : _NO));
 $pdf->printInformationSection(_BASICINFO, $info);
 if ($lessonInfo['comments'] || $lessonInfo['messages']) {
     $info = array(array(_COMMENTS, $lessonInfo['comments']), array(_MESSAGES, $lessonInfo['messages']));
     $pdf->printInformationSection(_LESSONPARTICIPATIONINFO, $info);
 }
 $info = array(array(_THEORY, $lessonInfo['theory']), array(_EXAMPLES, $lessonInfo['examples']));
 if (EfrontUser::isOptionVisible('projects')) {
     $info[] = array(_PROJECTS, $lessonInfo['projects']);
 }
 if (EfrontUser::isOptionVisible('tests')) {
     $info[] = array(_TESTS, $lessonInfo['tests']);
 }
 $pdf->printInformationSection(_LESSONCONTENTINFO, $info);
 $formatting = array(_USER => array('width' => '20%', 'fill' => false), _TIMEINLESSON => array('width' => '10%', 'fill' => false), _REGISTRATIONDATE => array('width' => '10%', 'fill' => false), _CONTENT => array('width' => '10%', 'fill' => false, 'align' => 'C'), _TESTS => array('width' => '10%', 'fill' => false, 'align' => 'C'), _PROJECTS => array('width' => '10%', 'fill' => false, 'align' => 'C'), _COMPLETED => array('width' => '10%', 'fill' => false), _SCORE => array('width' => '10%', 'fill' => false, 'align' => 'R'), _LASTLOGIN => array('width' => '10%', 'fill' => false));
                foreach ($assignedProjects[$id][$infoUser->user['login']] as $project) {
                    $workSheet->write($row, 0, $project['title'], $fieldCenterFormat);
                    $workSheet->write($row++, 1, formatScore($project['grade']) . "%", $fieldCenterFormat);
                    $avgScore += $project['grade'];
                }
                $workSheet->write($row, 0, _AVERAGESCORE, $titleCenterFormat);
                $workSheet->write($row++, 1, formatScore($avgScore / sizeof($assignedProjects[$id][$infoUser->user['login']])) . "%", $titleCenterFormat);
            }
        }
    }
    $workBook->send('export_' . $infoUser->user['login'] . '.xls');
    $workBook->close();
    exit;
} else {
    if (isset($_GET['pdf']) && $_GET['pdf'] == 'user') {
        $pdf = new EfrontPdf(_REPORT . ": " . formatLogin($infoUser->user['login']));
        try {
            $avatarFile = new EfrontFile($infoUser->user['avatar']);
        } catch (Exception $e) {
            $avatarFile = new EfrontFile(G_SYSTEMAVATARSPATH . "unknown_small.png");
        }
        $info = array(array(_USERNAME, $userInfo['general']['fullname']), array(_USERTYPE, $userInfo['general']['user_types_ID'] ? $userInfo['general']['user_types_ID'] : $roles[$userInfo['general']['user_type']]), array(_ACTIVE, $userInfo['general']['active'] ? _YES : _NO), array(_JOINED, $userInfo['general']['joined_str']), array(_TOTALLOGINTIME, $userInfo['general']['total_login_time']['time_string']));
        $pdf->printInformationSection(_GENERALUSERINFO, $info, $avatarFile);
        $info = array(array(_FORUMPOSTS, sizeof($userInfo['communication']['forum_messages'])), array(_FORUMLASTMESSAGE, formatTimestamp($userInfo['communication']['last_message']['timestamp'])), array(_PERSONALMESSAGES, sizeof($userInfo['communication']['personal_messages'])), array(_MESSAGESFOLDERS, sizeof($userInfo['communication']['personal_folders'])), array(_FILES, sizeof($userInfo['communication']['files'])), array(_FOLDERS, sizeof($userInfo['communication']['folders'])), array(_TOTALSIZE, $userInfo['communication']['total_size'] . _KB), array(_COMMENTS, sizeof($userInfo['communication']['comments'])));
        if (!EfrontUser::isOptionVisible('forum')) {
            unset($info[_FORUMPOSTS]);
            unset($info[_FORUMLASTMESSAGE]);
        }
        if (!EfrontUser::isOptionVisible('messages')) {
            unset($info[_PERSONALMESSAGES]);
            unset($info[_MESSAGESFOLDERS]);
         $branchName = $branch->branch['name'];
     } catch (Exception $e) {
         /*Do nothing if branch filters are not specified*/
     }
 }
 #cpp#endif
 $reportTitle = _REPORT . ": " . $infoCourse->course['name'];
 if ($groupname) {
     $reportTitle .= " " . _FORGROUP . ": " . $groupname;
     !$branchName or $reportTitle .= _ANDBRANCH . ": " . $branchName;
 } elseif ($branchName) {
     $reportTitle .= " " . _FORBRANCH . ": " . $branchName;
 }
 //	$directionName = eF_getTableData("directions", "name", "id=".$infoLesson -> lesson['directions_ID']);
 $languages = EfrontSystem::getLanguages(true);
 $pdf = new EfrontPdf($reportTitle);
 $info = array(array(_COURSE, $infoCourse->course['name']), array(_CATEGORY, str_replace(" → ", " -> ", $directionsPaths[$infoCourse->course['directions_ID']])), array(_LESSONS, $infoCourse->course['num_lessons']), array(_LANGUAGE, $languages[$infoCourse->course['languages_NAME']]));
 $pdf->printInformationSection(_BASICINFO, $info);
 $roles = EfrontLessonUser::getLessonsRoles(true);
 $formatting = array(_USER => array('width' => '20%', 'fill' => false), _COURSEROLE => array('width' => '20%', 'fill' => false), _PERCENTAGE => array('width' => '20%', 'fill' => false), _ENROLLEDON => array('width' => '10%', 'fill' => false), _COMPLETED => array('width' => '10%', 'fill' => false), _SCORE => array('width' => '20%', 'fill' => false, 'align' => 'R'));
 $data = array();
 $constraints = array('table_filters' => $stats_filters);
 $constraints['return_objects'] = false;
 $users = $infoCourse->getCourseUsersAggregatingResults($constraints);
 $courseLessons = $infoCourse->getCourseLessons(array('active' => 1, 'archive' => 0, 'return_objects' => false));
 foreach ($courseLessons as $lesson) {
     $lesson_ids[] = $lesson['id'];
 }
 $status = array();
 $result = eF_getTableData("users_to_lessons", "users_LOGIN,lessons_ID,completed", "lessons_ID in (" . implode(",", $lesson_ids) . ")");
 foreach ($result as $value) {