8535919709b7ae21129ed9e0d04c97d47a3c4795
[atutor.git] / mods / photo_album / index_admin.php
1 <?php\r
2 /*==============================================================\r
3   Photo Album\r
4  ==============================================================\r
5   Copyright (c) 2006 by Dylan Cheon & Kelvin Wong\r
6   Institute for Assistive Technology / University of Victoria\r
7   http://www.canassist.ca/                                    \r
8                                                                \r
9   This program is free software. You can redistribute it and/or\r
10   modify it under the terms of the GNU General Public License  \r
11   as published by the Free Software Foundation.                \r
12  ==============================================================\r
13  */\r
14 // $Id:\r
15 \r
16 /**\r
17  * @desc        This file generates the index page in the administrator panel\r
18  * @author      Dylan Cheon & Kelvin Wong\r
19  * @copyright   2006, Institute for Assistive Technology / University of Victoria \r
20  * @link        http://www.canassist.ca/                                    \r
21  * @license GNU\r
22  */\r
23  \r
24 define('AT_INCLUDE_PATH', '../../include/');\r
25 require (AT_INCLUDE_PATH.'vitals.inc.php');\r
26 admin_authenticate(AT_ADMIN_PRIV_PHOTO_ALBUM);\r
27 require (AT_INCLUDE_PATH.'header.inc.php');\r
28 ?>\r
29 \r
30 <?php\r
31 require_once('define.php');\r
32 require_once('HTML/Template/ITX.php');\r
33 require_once('include/data_func.php');\r
34 require_once('include/general_func.php');\r
35 \r
36 $courses=get_course_list();\r
37 if (empty($courses)){\r
38         $msg->addError('pa_var_course_empty');\r
39         redirect('../../admin/index.php');\r
40 } else {\r
41         $link=$base_path.'mods/photo_album/admin_image_list.php';\r
42         $template=new HTML_Template_ITX("./Template");\r
43         $template->loadTemplatefile("index_admin.tpl.php", true, true);\r
44 \r
45         $template->setVariable("TITLE", _AT('pa_title_admin_index'));   \r
46         $template->setVariable("MESSAGE", _AT('pa_note_admin'));\r
47         $template->setVariable("FORM_NAME", "photo_form");\r
48         $template->setVariable("FORM_ACTION", $link);\r
49         $template->setVariable("SELECT_NAME", "course_id");\r
50         \r
51         for ($i=0; $i<count($courses); $i++){\r
52                 $template->setCurrentBlock("OPTION_VALUE");\r
53                 $template->setVariable("TABINDEX", $i);\r
54                 $template->setVariable("VALUE", $courses[$i]['id']);\r
55                 $template->setVariable("TEXT", $courses[$i]['title']);\r
56                 $template->parseCurrentBlock("OPTION_VALUE");\r
57         }\r
58 \r
59         $template->setVariable("SUBMIT_NAME", "submit");\r
60         $template->setVariable("SUBMIT_VALUE", _AT('pa_tag_go'));\r
61         \r
62         $template->parseCurrentBlock();\r
63         $template->show();      \r
64 }\r
65 ?>\r
66 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>