2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2006 by Greg Gay & Joel Kronenberg */
6 /* Adaptive Technology Resource Centre / University of Toronto */
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 /****************************************************************/
15 define('AT_INCLUDE_PATH', '../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
18 if (!authenticate(AT_PRIV_CONTENT, AT_PRIV_RETURN)) {
19 require (AT_INCLUDE_PATH.'html/frameset/header.inc.php');
20 $msg->printErrors('TLE_ACCESS_DENIED');
21 require (AT_INCLUDE_PATH.'html/frameset/footer.inc.php');
25 if (isset($_POST['submit'])) {
26 $cid = intval($_POST['cid']);
27 $_POST['name'] = stripslashes($addslashes($_POST['name']));
28 $_POST['summary'] = stripslashes($addslashes($_POST['summary']));
29 $_POST['reference'] = stripslashes($addslashes($_POST['reference']));
31 $body = '<p>'.nl2br($_POST['summary']).'</p>';
32 $body .= '<p><a href="'.$_POST['reference'].'" target="_new">Open in New Window</a></p>';
34 $title = addslashes($_POST['name']);
35 $body = addslashes($body);
37 $sql = "SELECT MAX(ordering) AS ordering FROM ".TABLE_PREFIX."content WHERE course_id=$_SESSION[course_id] AND content_parent_id=$cid";
38 $result = mysql_query($sql, $db);
39 $row = mysql_fetch_assoc($result);
40 $order = intval($row['ordering']) + 1;
42 $sql= 'INSERT INTO '.TABLE_PREFIX.'content VALUES
44 .$_SESSION['course_id'].','
46 .$order.', NOW(),0,1,NOW(),"","", "'.$title.'", "'.$body.'")';
48 $result = mysql_query($sql, $db);
49 header('Location: '.$_base_href.'index.php');
54 $_REQUEST['framed'] = TRUE;
55 require(AT_INCLUDE_PATH.'header.inc.php');
57 if (!isset($_main_menu)) {
58 $_main_menu = $contentManager->getContent();
61 function print_menu_sections(&$menu, $parent_content_id = 0, $depth = 0, $ordering = '') {
62 $my_children = $menu[$parent_content_id];
65 if (!is_array($my_children)) {
68 foreach ($my_children as $children) {
69 echo '<option value="'.$children['content_id'].'"';
70 if ($cid == $children['content_id']) {
71 echo ' selected="selected"';
74 echo str_pad('', $depth, '-') . ' ';
75 if ($parent_content_id == 0) {
76 $new_ordering = $children['ordering'];
77 echo $children['ordering'];
79 $new_ordering = $ordering.'.'.$children['ordering'];
80 echo $ordering . '.'. $children['ordering'];
82 echo ' '.$children['title'].'</option>';
84 print_menu_sections($menu, $children['content_id'], $depth+1, $new_ordering);
91 <form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" target="_top">
92 <input type="hidden" name="name" value="<?php echo htmlentities(stripslashes($addslashes($_GET['tlename']))); ?>" />
93 <input type="hidden" name="summary" value="<?php echo htmlentities(stripslashes($addslashes($_GET['tledescription']))); ?>" />
94 <input type="hidden" name="reference" value="<?php echo htmlentities(stripslashes($addslashes($_GET['tleurl']))); ?>?preview=true" />
96 <div class="input-form">
98 <?php echo _AT('tile_import_content_package_about'); ?>
102 <strong><?php echo _AT('import_content_package_where'); ?>:</strong> <select name="cid">
103 <option value="0"><?php echo _AT('import_content_package_bottom_subcontent'); ?></option>
104 <option>--------------------------</option>
106 print_menu_sections($_main_menu);
112 <strong><?php echo _AT('import_content_package'); ?>:</strong> <?php echo htmlentities(stripslashes($addslashes($_GET['tlename']))); ?>
115 <div class="row buttons">
116 <input type="submit" name="submit" value="<?php echo _AT('import'); ?>" />