remove old readme
[atutor.git] / mods / _core / imscp / export.php
1 <?php\r
2 /****************************************************************/\r
3 /* ATutor                                                                                                               */\r
4 /****************************************************************/\r
5 /* Copyright (c) 2002-2010                                      */\r
6 /* Inclusive Design Institute                                   */\r
7 /* http://atutor.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 // $Id$\r
14 \r
15 define('AT_INCLUDE_PATH', '../../../include/');\r
16 require(AT_INCLUDE_PATH.'vitals.inc.php');\r
17 \r
18 if (isset($_POST['cancel'])) {\r
19         $msg->addFeedback('CANCELLED');\r
20         header('Location: index.php');\r
21         exit;\r
22 } else if (isset($_POST['submit'])) {\r
23         header('Location: '.$_base_href.'mods/_core/imscp/ims_export.php?cid=' . intval($_POST['cid']));\r
24         exit;\r
25 }\r
26 \r
27 require(AT_INCLUDE_PATH.'header.inc.php');\r
28 \r
29 if (!isset($_main_menu)) {\r
30         $_main_menu = $contentManager->getContent();\r
31 }\r
32 \r
33 function print_menu_sections(&$menu, $parent_content_id = 0, $depth = 0, $ordering = '') {\r
34         $my_children = $menu[$parent_content_id];\r
35         $cid = $_GET['cid'];\r
36 \r
37         if (!is_array($my_children)) {\r
38                 return;\r
39         }\r
40         foreach ($my_children as $children) {\r
41                 echo '<option value="'.$children['content_id'].'"';\r
42                 if ($cid == $children['content_id']) {\r
43                         echo ' selected="selected"';\r
44                 }\r
45                 echo '>';\r
46                 echo str_pad('', $depth, '-') . ' ';\r
47                 if ($parent_content_id == 0) {\r
48                         $new_ordering = $children['ordering'];\r
49                         echo $children['ordering'];\r
50                 } else {\r
51                         $new_ordering = $ordering.'.'.$children['ordering'];\r
52                         echo $ordering . '.'. $children['ordering'];\r
53                 }\r
54                 echo ' '.$children['title'].'</option>';\r
55 \r
56                 print_menu_sections($menu, $children['content_id'], $depth+1, $new_ordering);\r
57         }\r
58 }\r
59 \r
60         if (!authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) && ($_SESSION['packaging'] == 'none')) {\r
61                 echo '<p>'._AT('content_packaging_disabled').'</p>';\r
62                 require (AT_INCLUDE_PATH.'footer.inc.php'); \r
63                 exit;\r
64         } else if (!authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN) && ($_SESSION['packaging'] == 'top')) {\r
65                 $_main_menu = array($_main_menu[0]);\r
66         }\r
67 ?>\r
68 \r
69 \r
70 <form method="post" action="<?php $_SERVER['PHP_SELF']?>">\r
71 <div class="input-form">\r
72         <div class="row">\r
73                 <h3><?php echo _AT('export_content'); ?></h3>\r
74                 <p><?php echo _AT('export_content_info'); ?></p>\r
75         </div>\r
76 \r
77         <div class="row">\r
78                 <label for="select_cid"><?php echo _AT('export_content_package_what'); ?></label><br />\r
79                 <select name="cid" id="select_cid">\r
80                         <option value="0"><?php echo _AT('export_entire_course_or_chap'); ?></option>\r
81                         <option>--------------------------</option>\r
82                         <?php\r
83                                 print_menu_sections($_main_menu);\r
84                         ?>\r
85                 </select>\r
86         </div>\r
87 \r
88         <div class="row buttons">\r
89                 <input type="submit" name="submit" value="<?php echo _AT('export'); ?>" />\r
90                 <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />\r
91         </div>\r
92 </div>\r
93 </form>\r
94 \r
95 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>