2 define('AT_INCLUDE_PATH', '../../../../include/');
3 require(AT_INCLUDE_PATH.'vitals.inc.php');
4 admin_authenticate(AT_ADMIN_PRIV_BASICLTI);
6 require_once('forms.php');
8 // filter all POST data
9 $_POST['form_basiclti'] = $addslashes($_POST['form_basiclti']);
10 $_POST['title'] = $addslashes($_POST['title']);
11 $_POST['toolid'] = $addslashes($_POST['toolid']);
12 $_POST['description'] = $addslashes($_POST['description']);
13 $_POST['toolurl'] = $addslashes($_POST['toolurl']);
14 $_POST['resourcekey'] = $addslashes($_POST['resourcekey']);
15 $_POST['password'] = $addslashes($_POST['password']);
16 $_POST['preferheight'] = intval($_POST['preferheight']);
17 $_POST['allowpreferheight'] = intval($_POST['allowpreferheight']);
18 $_POST['launchinpopup'] = intval($_POST['launchinpopup']);
19 $_POST['debuglaunch'] = intval($_POST['debuglaunch']);
20 $_POST['sendname'] = intval($_POST['sendname']);
21 $_POST['sendemailaddr'] = intval($_POST['sendemailaddr']);
22 $_POST['acceptgrades'] = intval($_POST['acceptgrades']);
23 $_POST['allowroster'] = intval($_POST['allowroster']);
24 $_POST['allowsetting'] = intval($_POST['allowsetting']);
25 $_POST['allowcustomparameters'] = intval($_POST['allowcustomparameters']);
26 $_POST['customparameters'] = $addslashes($_POST['customparameters']);
27 $_POST['organizationid'] = $addslashes($_POST['organizationid']);
28 $_POST['organizationurl'] = $addslashes($_POST['organizationurl']);
29 // $_POST['organizationdescr'] = $addslashes($_POST['organizationdescr']);
30 $_POST['submit'] = $addslashes($_POST['submit']);
32 $tool = intval($_REQUEST['id']);
34 if (isset($_POST['cancel'])) {
35 $msg->addFeedback('CANCELLED');
36 header('Location: '.AT_BASE_HREF.'mods/_standard/basiclti/index_admin.php');
38 } else if (isset($_POST['form_basiclti'], $tool)) {
40 if ( at_form_validate($blti_admin_form, $msg) ) {
41 $sql = "SELECT count(*) cnt FROM ".TABLE_PREFIX."basiclti_tools WHERE toolid = '".
42 mysql_real_escape_string($_POST['toolid'])."' AND id != $tool;";
43 $result = mysql_query($sql, $db) or die(mysql_error());
44 $row = mysql_fetch_assoc($result);
46 if ($row["cnt"] != 0) {
47 $msg->addFeedback('NEED_UNIQUE_TOOLID');
49 $sql = at_form_update($_POST, $blti_admin_form);
50 $sql = 'UPDATE '.TABLE_PREFIX."basiclti_tools SET ".$sql." WHERE id = $tool;";
51 $result = mysql_query($sql, $db) or die(mysql_error());
52 write_to_log(AT_ADMIN_LOG_INSERT, 'basiclti_create', mysql_affected_rows($db), $sql);
53 $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
54 header('Location: '.AT_BASE_HREF.'mods/_standard/basiclti/index_admin.php');
60 $sql = "SELECT * FROM ".TABLE_PREFIX."basiclti_tools WHERE id = ".$tool.";";
61 $result = mysql_query($sql, $db) or die(mysql_error());
62 $toolrow = mysql_fetch_assoc($result);
63 if ( $toolrow['id'] != $tool ) {
64 $msg->addFeedback('COULD_NOT_LOAD_TOOL');
65 header('Location: '.AT_BASE_HREF.'mods/_standard/basiclti/index_admin.php');
69 include(AT_INCLUDE_PATH.'header.inc.php');
74 <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="basiclti_form" enctype="multipart/form-data">
75 <input type="hidden" name="form_basiclti" value="true" />
76 <input type="hidden" name="id" value="<?php echo $tool; ?>" />
77 <div class="input-form">
78 <fieldset class="group_form"><legend class="group_form"><?php echo _AT('properties'); ?></legend>
79 <?php at_form_generate($toolrow, $blti_admin_form); ?>
81 <input type="submit" name="submit" value="<?php echo _AT('save'); ?>" accesskey="s" />
82 <input type="submit" name="cancel" value="<?php echo _AT('cancel');?>" />
89 require(AT_INCLUDE_PATH.'footer.inc.php');