-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·54 lines (41 loc) · 1.26 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
//------------------------------------------------------------------------------
/// Filename: index.php
/// Description: Examfilter Mainfile
/// Authors: Tommy Sparber
///
/// Created: 14.10.2012
//------------------------------------------------------------------------------
error_reporting(E_ALL|E_STRICT);
require_once('./classes/template.class.php');
require_once('./classes/tools.class.php');
require_once('./classes/form.class.php');
require_once('./classes/caltools.class.php');
main();
//------------------------------------------------------------------------------
function main()
{
$template = new Template();
$template->setTitle("ExamFilter - TUGRAZ");
$form = new Form('generatedid');
$form->addSubmit('submit', 'Generate new personal calendar');
if($form->isReady())
{
//$fields = $form->getFields();
$ids = CalTools::loadIds();
$id = 0;
do
{
$id = CalTools::generateId();
}while(in_array($id, $ids));
$handle = fopen("storage/cal_$id.txt", 'w') or die("can't open file");
fclose($handle);
$template->addContent('<a href="'.CalTools::getCalURL($id).'">' . CalTools::getCalURL($id) . '</a>');
}
else
{
$template->addContent($form->getFormHTML());
}
print $template->out();
}
?>