move code up one directory
[atutor.git] / mods / _standard / tile_search / import.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2010                                      */
6 /* Inclusive Design Institute                                   */
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 authenticate(AT_PRIV_CONTENT);
18
19 require(AT_INCLUDE_PATH.'header.inc.php');
20
21 if (!isset($_main_menu)) {
22         $_main_menu = $contentManager->getContent();
23 }
24
25 function print_menu_sections(&$menu, $parent_content_id = 0, $depth = 0, $ordering = '') {
26         $my_children = $menu[$parent_content_id];
27         $cid = $_GET['cid'];
28
29         if (!is_array($my_children)) {
30                 return;
31         }
32         foreach ($my_children as $children) {
33                 echo '<option value="'.$children['content_id'].'"';
34                 if ($cid == $children['content_id']) {
35                         echo ' selected="selected"';
36                 }
37                 echo '>';
38                 echo str_pad('', $depth, '-') . ' ';
39                 if ($parent_content_id == 0) {
40                         $new_ordering = $children['ordering'];
41                         echo $children['ordering'];
42                 } else {
43                         $new_ordering = $ordering.'.'.$children['ordering'];
44                         echo $ordering . '.'. $children['ordering'];
45                 }
46                 echo ' '.$children['title'].'</option>';
47
48                 print_menu_sections($menu, $children['content_id'], $depth+1, $new_ordering);
49         }
50 }
51 ?>
52
53 <form name="form1" method="post" action="mods/_core/imscp/ims_import.php?tile=1" onsubmit="openWindow('<?php echo AT_BASE_HREF; ?>tools/prog.php?tile=1');">
54         <input type="hidden" name="url" value="<?php echo AT_TILE_EXPORT_CC_URL.$_GET['tile_course_id']; ?>" />
55         <input type="hidden" name="allow_a4a_import" value="1" />
56 <div class="input-form">
57
58         <div class="row">
59                 <?php echo _AT('tile_import_content_package_about'); ?>
60         </div>
61
62         <div class="row">
63         <strong><?php echo _AT('import_content_package_where'); ?>:</strong> 
64         <select name="cid">
65                 <option value="0"><?php echo _AT('import_content_package_bottom_subcontent'); ?></option>
66                 <option>--------------------------</option>
67                 <?php print_menu_sections($_main_menu); ?>
68         </select>
69         </div>
70
71         <div class="row">
72                 <strong><?php echo _AT('import_content_package'); ?>:</strong> <?php echo urldecode($stripslashes($_GET['title'])); ?>
73         </div>
74
75         <div class="row buttons">
76                 <input type="submit" name="submit" value="<?php echo _AT('import'); ?>" /> <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
77         </div>
78 </div>
79 </form>
80
81 <script language="javascript" type="text/javascript">
82 function openWindow(page) {
83         newWindow = window.open(page, "progWin", "width=400,height=200,toolbar=no,location=no");
84         newWindow.focus();
85 }
86 </script>
87
88 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>