30dcafcf68151021d5ede99b72120b0f97aede7e
[atutor.git] / mods / marratech / marratech.php
1 <?php\r
2 /*\r
3 This is the ATutor Marratech module page. It allows an admin user\r
4 to set or edit  the URL for the Marratech installation for ATutor, and define an optional guest password.\r
5 \r
6 */\r
7 define('AT_INCLUDE_PATH', '../../include/');\r
8 require (AT_INCLUDE_PATH.'vitals.inc.php');\r
9 admin_authenticate(AT_ADMIN_PRIV_MARRATECH);\r
10 \r
11 if (isset($_POST['submit'])) {\r
12         $_POST['uri'] = trim($_POST['uri']);\r
13 \r
14         if (!$_POST['uri']){\r
15                 $msg->addError('MARRATECHURL_ADD_EMPTY');\r
16         }\r
17                         \r
18         if (!$msg->containsErrors()) {\r
19                 $_POST['uri'] = $addslashes($_POST['uri']);\r
20                 $sql = "REPLACE INTO ".TABLE_PREFIX."config VALUES ('marratech', '$_POST[uri]')";\r
21                 mysql_query($sql, $db);\r
22                 $msg->addFeedback('MARRATECHURL_ADD_SAVED');\r
23 \r
24                 header('Location: '.$_SERVER['PHP_SELF']);\r
25                 exit;\r
26         }\r
27 }\r
28 \r
29 require (AT_INCLUDE_PATH.'header.inc.php');\r
30 \r
31 ?>\r
32 \r
33 <?php if ($_config['marratech']): ?>\r
34         <div class="input-form">\r
35                 <div class="row">\r
36                         <p><?php echo _AT('marratech_text'); ?></p>\r
37                 </div>\r
38                 <div class="row buttons">\r
39                         <form  action="" method="get">\r
40                                 <input type="submit" value="<?php echo _AT('marratech_open'); ?>" onclick="window.open('<?php echo $_config['marratech']; ?>/admin/','mywindow','width=800,height=600,scrollbars=yes, resizable=yes', 'false');false;" />\r
41                         </form>\r
42                 </div>\r
43         </div>\r
44 <?php else: ?>\r
45         <div class="input-form">\r
46                 <div class="row">\r
47                         <p><?php echo _AT('marratech_missing_url');  ?></p>\r
48                 </div>\r
49         </div>\r
50 <?php endif; ?>\r
51 \r
52 <form action="<?php  $_SERVER['PHP_SELF']; ?>" method="post">\r
53         <div class="input-form">\r
54                 <div class="row">\r
55                         <p><label for="uri"><?php echo _AT('marratech_location'); ?></label></p>\r
56         \r
57                         <input type="text" name="uri" value="<?php echo $_config['marratech']; ?>" id="uri" size="80" style="min-width: 95%;" />\r
58                 </div>\r
59                 <div class="row buttons">\r
60                         <input type="submit" name="submit" value="<?php echo _AT('save'); ?>"  />\r
61                 </div>\r
62         </div>\r
63 </form>\r
64 <div>\r
65 <a href="<?php echo $_SERVER['PHP_SELF']; ?>" onclick="window.open('<?php echo $_config['marratech']; ?>','marratechwin','width=800,height=720,scrollbars=yes, resizable=yes'); return false"><?php echo  _AT('marratech_own_window'); ?></a> </li>\r
66 \r
67 <iframe name="marratech" id="marratech" title="Marratech" frameborder="1" scrolling="auto" src="<?php echo $_config['marratech']; ?>/index.jsp" height="500" width="90%" align="center" style="border:thin white solid; align:center;" allowautotransparency="true"></iframe>\r
68 \r
69 </div>\r
70 <?php  require (AT_INCLUDE_PATH.'footer.inc.php'); ?>