made a copy
[atutor.git] / admin / modules / add_new.php
1 <?php
2 /************************************************************************/
3 /* ATutor                                                                                                                               */
4 /************************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/
6 /* Adaptive Technology Resource Centre / University of Toronto                  */
7 /* http://atutor.ca                                                                                                             */
8 /*                                                                                                                                              */
9 /* This program is free software. You can redistribute it and/or                */
10 /* modify it under the terms of the GNU General Public License                  */
11 /* as published by the Free Software Foundation.                                                */
12 /************************************************************************/
13 // $Id$
14
15 define('AT_INCLUDE_PATH', '../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 admin_authenticate(AT_ADMIN_PRIV_ADMIN);
18 require(AT_INCLUDE_PATH.'classes/Module/ModuleParser.class.php');
19
20 if (isset($_GET['mod'])) {
21         $dir_name = str_replace(array('.','..'), '', $_GET['mod']);
22
23         if (isset($_GET['install'])) {
24                 header('Location: '.AT_BASE_HREF.'admin/modules/details.php?mod='.urlencode($dir_name).SEP.'new=1');
25                 exit;
26         }
27
28 } else if (isset($_GET['install'])) {
29         $msg->addError('NO_ITEM_SELECTED');
30 }
31
32 require(AT_INCLUDE_PATH.'header.inc.php'); 
33 $module_list = $moduleFactory->getModules(AT_MODULE_STATUS_UNINSTALLED | AT_MODULE_STATUS_MISSING | AT_MODULE_STATUS_PARTIALLY_UNINSTALLED, AT_MODULE_TYPE_EXTRA);
34 $keys = array_keys($module_list);
35 natsort($keys);
36
37 ?>
38
39 <div class="input-form">
40         <div class="row">
41                 <?php echo _AT('install_module_text', realpath('./../../mods')); ?>             
42         </div>
43 </div>
44
45 <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get" name="installform">
46 <table class="data" summary="" rules="cols" style="width:80%;">
47 <thead>
48 <tr>
49         <th scope="col">&nbsp;</th>
50         <th scope="col"><?php echo _AT('module_name'); ?></th>
51         <th scope="col"><?php echo _AT('directory_name'); ?></th>
52         <th scope="col"><?php echo _AT('description'); ?></th>
53 </tr>
54 </thead>
55 <tfoot>
56 <tr>
57         <td colspan="4">
58                 <input type="submit" name="install"  value="<?php echo _AT('install'); ?>" />
59         </td>
60 </tr>
61 </tfoot>
62 <tbody>
63 <?php if (!empty($keys)): ?>
64         <?php foreach($keys as $dir_name) : $module =& $module_list[$dir_name]; ?>
65                 <tr onmousedown="document.installform['m_<?php echo $dir_name; ?>'].checked = true; rowselect(this);" id="r_<?php echo $dir_name; ?>">
66                         <td valign="top"><input type="radio" id="m_<?php echo $dir_name; ?>" name="mod" value="<?php echo $dir_name; ?>" /></td>
67                         <td valign="top"><label for="m_<?php echo $row['dir_name']; ?>"><?php echo $module->getName(); ?></label></td>
68                         <td valign="top"><code><?php echo $dir_name; ?>/</code></td>
69                         <td valign="top"><?php echo $module->getDescription($_SESSION['lang']); ?></td>
70                 </tr>
71         <?php endforeach; ?>
72 <?php else: ?>
73         <tr>
74                 <td colspan="4"><?php echo _AT('none_found'); ?></td>
75         </tr>
76 <?php endif; ?>
77 </tbody>
78 </table>
79 </form>
80
81 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>