Exemple #1
0
        $data = $subSections = array();
        foreach ($userLessons as $lessonId => $value) {
            $data[$lessonId] = array(_NAME => $value['name'], _CATEGORY => str_replace(" → ", " -> ", $directionsPathStrings[$value['directions_ID']]), _REGISTRATIONDATE => formatTimestamp($value['active_in_lesson']), _COMPLETED => $value['completed'] ? _YES . ($value['timestamp_completed'] ? ', ' . _ON . ' ' . formatTimestamp($value['timestamp_completed']) : '') : '-', _SCORE => formatScore($value['score']) . '%');
            /*
            			if (isset($userDoneTests[$value['id']])) {
            				$subsectionFormatting = array(_TESTNAME	=> array('width' => '78%', 'fill' => true),
            											  _STATUS	=> array('width' => '13%', 'fill' => true, 'align' => 'C'),
            											  _SCORE	=> array('width' => '9%',  'fill' => true, 'align' => 'R'));
            				$subSectionData = array();
            				foreach ($userDoneTests[$value['id']] as $test) {
            					$subSectionData[] = array(_TESTNAME	=> $test['name'],
            											  _STATUS   => $test['status'],
            											  _SCORE 	=> formatScore($test['score']).'%');
            				}
            				$subSections[$lessonId] = array('data' => $subSectionData, 'formatting' => $subsectionFormatting, 'title' => _TESTSFORLESSON.': '.$value['name']);
            			}
            */
        }
        $pdf->printDataSection(_TRAINING . ': ' . _LESSONS, $data, $formatting, $subSections);
        $info = array();
        if (isset($averages['courses'])) {
            $info[] = array(_COURSESAVERAGE, $averages['courses'] . '%');
        }
        if (isset($averages['lessons'])) {
            $info[] = array(_LESSONSAVERAGE, $averages['lessons'] . '%');
        }
        $pdf->printInformationSection(_OVERALL, $info);
    }
    $pdf->OutputPdf('user_form_' . $editedUser->user['login'] . '.pdf');
    exit;
}
        $data = array();
        foreach ($professors as $user) {
            $data[] = array(_USER => formatLogin($user['login']), _REGISTRATIONDATE => formatTimestamp($user['timestamp']));
        }
        $pdf->printDataSection(_PROFESSORSINFO, $data, $formatting);
        if (EfrontUser::isOptionVisible('tests')) {
            $formatting = array(_USER => array('width' => '25%', 'fill' => false), _SCORE => array('width' => '15%', 'fill' => false));
            foreach ($testsInfo as $id => $info) {
                $data = array();
                foreach ($info['done'] as $results) {
                    $avgScore[] = $results['active_score'] ? $results['active_score'] : $results['score'];
                    $data[] = array(_USER => formatLogin($results['users_LOGIN']), _SCORE => formatScore(round($results['active_score'] ? $results['active_score'] : $results['score'], 2)) . "%");
                }
                if (!empty($data)) {
                    $data[] = array(_USER => _AVERAGESCORE, _SCORE => formatScore(round(array_sum($avgScore) / sizeof($avgScore), 2)) . "%");
                }
                $pdf->printDataSection(_TESTSINFORMATION . ': ' . $info['general']['name'], $data, $formatting);
            }
            if (sizeof($lessonQuestions) > 0) {
                $formatting = array(_QUESTION => array('width' => '50%', 'fill' => false), _QUESTIONTYPE => array('width' => '20%', 'fill' => false), _DIFFICULTY => array('width' => '10%', 'fill' => false, 'align' => 'C'), _TIMESDONE => array('width' => '10%', 'fill' => false, 'align' => 'C'), _AVERAGESCORE => array('width' => '10%', 'fill' => false, 'align' => 'C'));
                $data = array();
                foreach ($questionsInfo as $id => $questionInfo) {
                    $data[] = array(_QUESTION => $questionInfo['text'], _QUESTIONTYPE => Question::$questionTypes[$questionInfo['type']], _DIFFICULTY => Question::$questionDifficulties[$questionInfo['difficulty']], _TIMESDONE => $questionInfo['times_done'], _AVERAGESCORE => formatScore($questionInfo['avg_score']) . "%");
                }
                $pdf->printDataSection(_QUESTIONSINFORMATION, $data, $formatting);
            }
        }
        $pdf->OutputPdf('lesson_form_' . $infoLesson->lesson['name'] . '.pdf');
        exit;
    }
}
                $lessonsAvgScore = round(array_sum($completedScores) / sizeof($completedScores), 2);
            }
            /*
            		$testsAvgScoreNum = 0;
            		$testsAvgScore    = 0; 
            		foreach ($userDoneTests as $lessonId => $tests) {
            				foreach ($tests as $test) {
            					$testsAvgScore += $test['active_score'];
            					$testsAvgScoreNum++;
            				}
            		}
            */
            $info = array(array(_COURSESAVERAGE, $coursesAvgScore . '%'), array(_STANDALONELESSONSAVERAGE, $lessonsAvgScore . '%'));
            $pdf->printInformationSection(_OVERALL, $info);
        }
        $pdf->OutputPdf('user_form_' . $infoUser->user['login'] . '.pdf');
        exit;
    }
}
function eF_local_shouldDisplaySelectBox()
{
    global $currentUser;
    global $isSupervisor;
    if ($currentUser->user['user_type'] == 'administrator' || $isSupervisor) {
        return true;
    } else {
        if (sizeof($currentUser->getLessons(false, 'professor')) > 0) {
            return true;
        } else {
            return false;
        }
            foreach ($result as $value) {
                $userBranches[$value['users_login']][] = $value['name'];
            }
            foreach ($userBranches as $login => $value) {
                $userBranches[$login] = implode(",", $value);
            }
            $formatting = array(_USER => array('width' => '16%', 'fill' => false), _COURSEROLE => array('width' => '16%', 'fill' => false), _BRANCH => array('width' => '16%', 'fill' => false), _PERCENTAGE => array('width' => '16%', 'fill' => false), _ENROLLEDON => array('width' => '10%', 'fill' => false), _COMPLETED => array('width' => '11%', 'fill' => false), _SCORE => array('width' => '11%', 'fill' => false, 'align' => 'R'));
        }
        #cpp#endif
        foreach ($users as $login => $info) {
            if ($info['completed'] && $info['to_timestamp']) {
                $completedString = _YES . ', ' . _ON . ' ' . formatTimestamp($info['to_timestamp']);
            } elseif ($info['completed']) {
                $completedString = _YES;
            } else {
                $completedString = _NO;
            }
            if (G_VERSIONTYPE == 'enterprise') {
                #cpp#ifdef ENTERPRISE
                $data[] = array(_USER => formatLogin($info['login']), _COURSEROLE => $roles[$info['role']], _BRANCH => $userBranches[$login], _PERCENTAGE => $rolesBasic[$info['user_type']] == 'student' ? $info['lesson_percentage'] . "%" : "", _ENROLLEDON => formatTimestamp($info['enrolled_on']), _COMPLETED => $completedString, _SCORE => formatScore($info['score']) . "%");
            } else {
                #cpp#else
                $data[] = array(_USER => formatLogin($info['login']), _COURSEROLE => $roles[$info['role']], _PERCENTAGE => $rolesBasic[$info['user_type']] == 'student' ? $info['lesson_percentage'] . "%" : "", _ENROLLEDON => formatTimestamp($info['enrolled_on']), _COMPLETED => $completedString, _SCORE => formatScore($info['score']) . "%");
            }
            #cpp#endif
        }
        $pdf->printDataSection(_USERSINFO, $data, $formatting);
        $pdf->OutputPdf('course_form_' . $infoCourse->course['name'] . '.pdf');
        exit;
    }
}