ATutor 2.0
[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: import.php 7208 2008-01-09 16:07:24Z greg $
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 <br />
57 <div class="input-form">
58
59         <div class="row">
60                 <?php echo _AT('tile_import_content_package_about'); ?>
61         </div>
62
63         <div class="row">
64         <strong><?php echo _AT('import_content_package_where'); ?>:</strong> 
65         <select name="cid">
66                 <option value="0"><?php echo _AT('import_content_package_bottom_subcontent'); ?></option>
67                 <option>--------------------------</option>
68                 <?php print_menu_sections($_main_menu); ?>
69         </select>
70         </div>
71
72         <div class="row">
73                 <strong><?php echo _AT('import_content_package'); ?>:</strong> <?php echo urldecode($stripslashes($_GET['title'])); ?>
74         </div>
75
76         <div class="row buttons">
77                 <input type="submit" name="submit" value="<?php echo _AT('import'); ?>" /> <input type="submit" name="cancel" value="<?php echo _AT('cancel'); ?>" />
78         </div>
79 </div>
80 </form>
81
82 <script language="javascript" type="text/javascript">
83 function openWindow(page) {
84         newWindow = window.open(page, "progWin", "width=400,height=200,toolbar=no,location=no");
85         newWindow.focus();
86 }
87 </script>
88
89 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>