2 /// Classification 2 Playground ///
11 require('bootstrap.php');
13 function microtime_float() {
14 list($usec, $sec) = explode(' ', microtime());
15 return ((float)$usec +
(float)$sec);
18 function echo_datatype($var) {
19 $r = '<div style="background: #b0ff81">';
20 $r .= Debug
::datatype($var);
25 $time_start = microtime_float();
28 $col = new Entities\Column;
29 $col->validValues('1,2,3,4,7');
30 //$col->validValues(array('1','2,','3','4','7'));
31 $col->validRegex('/^[0-9]$/');
32 $col->validRange('-10');
33 Debug::debug($col->isValid(7));
34 Debug::debug($col->isValid(3));
35 Debug::debug($col->isValid(1));
36 Debug::debug($col->isValid('a'));
37 Debug::debug($col->isValid(0));
39 //$students = Students::getStudentByLogin('alexaluk');
40 //$students = Students::getStudentsByLogins(array('adameji4','aletibha','arletjir'));
41 //$students = Students::getStudentsByCourseAndLesson('BI-UOS','101');
42 //$students = Students::getStudentsByLesson('109');
43 //$students = Students::getStudentsByCoursesAndLesson(array('A4B39WA1','A7B39WA1'),'102');
44 //$students = Students::getStudentsByCoursesAndLesson(array('BI-UOS'),'101');
45 $students = Students
::getStudentsByCoursesAndLesson(array('BI-WMM'),'101');
46 //$students = Students::getStudentsByLessonTypeAndNumber('tutorial','102');
47 //$students = Students::getStudentsByLecture('1');
48 //$students = Students::getStudentsByTutorial('102');
49 //$students = Students::getStudentsByLaboratory('1102');
50 //$students = Students::getStudentsByTeam('Beta');
51 //$students = Students::getStudentsByActionOrigId('263993314205');
52 foreach($students as $student) {
53 echo $student->name().':'.$student->login().':'.($student->tutorial() ?
$student->tutorial()->course()->code() : "N/A").'<br />';
55 //echo_datatype($students);
56 //$courses = Courses::getAllCourses();
57 //$courses = Courses::getCourseByCode('Y39TW1');
58 //$courses = Courses::getCoursesByCodes(array('BI-UOS','BIE-UOS'));
59 $courses = Courses
::getCoursesByCodes(array('BI-WMM'));
60 //$courses = Courses::getCourseByLangType('cs','fulltime');
61 //$courses = Courses::getCourseByStudent('adameji4');
62 echo_datatype($courses);
63 //$lessons = Lessons::getLessonsByCourse('BI-WMM');
64 //$lessons = Lessons::getLessonByCourseAndNumber('Y39TW1','101');
65 //$lessons = Lessons::getLessonsByCoursesAndNumber(array('Y39TW1','A4B39WA1'),'101');
66 //$lessons = Lessons::getLessonsByCourseAndType('BI-UOS','P');
67 //$lessons = Lessons::getLessonsByCourseAndType(NULL,'P');
68 //$lessons = Lessons::getLessonsByType('P');
69 //echo_datatype($lessons);
70 //$result = Results::getResult('alexaluk','tutorial','zapocet');
71 //echo_datatype($result);
72 //$teams = Teams::getAllTeams();
73 //$teams = Teams::getTeamByName('Alpha');
74 //$teams = Teams::getTeamsByStudent('zelenja9');
75 //echo_datatype($teams);
76 //$actions = Actions::getAllActions();
77 //$actions = Actions::getAllSingleshotActions();
78 //$actions = Actions::getAllExams();
79 //$actions = Actions::getActionsByType('JA');
80 //$actions = Actions::getActionsByStudent('hanykkla');
81 //$actions = Actions::getActionsByTypeAndStudent('JA','hanykkla');
82 //$actions = Actions::getSingleshotActionsByStudent('hanykkla');
83 //$actions = Actions::getExamsByStudent('hanykkla');
84 //echo_datatype($actions);
88 echo '<h2>courses</h2>';
90 $courses = Courses
::getAllCourses();
91 echo_datatype($courses);
92 foreach($courses as $course) {
93 echo $course->code().' - '.$course->name().'<br />';
96 echo '<h2>students</h2>';
98 $students = Students
::getStudentsByLecture(1);
99 echo_datatype($students);
102 $students = array_filter($students,function($i) { return substr($i->login(),0,1) == 'a'; });
103 echo_datatype($students);
105 foreach($students as $student) {
106 echo $student->name().':'.$student->login().':'.($student->tutorial() ?
$student->tutorial()->course()->code() : 'N/A').'<br />';
107 foreach($student->results() as $result) {
108 echo $result->part()->name().':'.$result->column().':'.$result->value().':'.$result->teacher()->name().'<br />';
110 foreach($student->results('tutorial') as $result) {
111 echo $result->part()->name().':'.$result->column().':'.$result->value().':'.$result->teacher()->name().'<br />';
114 foreach($student->results('tutorial','a1') as $result) {
115 echo $result->part()->name().':'.$result->column().':'.$result->value().'<br />';
120 echo '<h2>students II</h2>';
122 $students = Students
::getStudentsByLogins(array('adameji4','fialamat'));
123 echo_datatype($students);
126 $students = array_filter($students,function($i) { return substr($i->login(),0,1) == 'a'; });
127 echo_datatype($students);
129 foreach($students as $student) {
130 echo $student->name().':'.$student->login().':'.($student->tutorial() ?
$student->tutorial()->course()->code() : "N/A").'<br />';
131 foreach($student->results() as $result) {
132 echo $result->part()->name().':'.$result->column().':'.$result->value().':'.$result->teacher()->name().'<br />';
134 foreach($student->results('tutorial') as $result) {
135 echo $result->part()->name().':'.$result->column().':'.$result->value().':'.$result->teacher()->name().'<br />';
137 /* foreach($student->results('tutorial','a1') as $result) {
138 echo $result->part()->name().':'.$result->column().':'.$result->value().'<br />';
143 $time_end = microtime_float();
144 $time = $time_end - $time_start;
145 echo "working time: $time<br />";
147 $time_start = microtime_float();
149 if($result = Results
::getResult('alexaluk','tutorial','zapocet')) {
150 echo_datatype($result);
151 echo $result->value().'<br />';
153 echo 'No result<br />';
156 $time_end = microtime_float();
157 $time = $time_end - $time_start;
158 echo "working time: $time<br />";