4 * This class contains the callback functions that are called in the core scripts to manipulate content etc.
7 * 1. CHANGE the class name and ensure its uniqueness by prefixing with the module name
8 * 2. DO NOT change the script name. Leave as "ModuleCallbacks.class.php"
9 * 3. DO NOT change the names of the methods.
10 * 4. REGISTER the unique class name in module.php
14 if (!defined('AT_INCLUDE_PATH')) exit;
16 class BasicLTICallbacks {
18 * To append output onto course content page
20 * @return: a string, plain or html, to be appended to course content page
22 public static function appendContent($cid) {
23 if ( !is_int($_SESSION['course_id']) || $_SESSION['course_id'] < 1 ) return;
24 $sql = "SELECT * FROM ".TABLE_PREFIX."basiclti_content
25 WHERE content_id=".$cid." AND course_id = ".$_SESSION['course_id'];
27 $instanceresult = mysql_query($sql, $db);
28 if ( $instanceresult == false ) return;
29 $basiclti_content_row = mysql_fetch_assoc($instanceresult);
30 if ( $basiclti_content_row === false ) return;
31 $toolid = $basiclti_content_row['toolid'];
32 $sql = "SELECT * FROM ".TABLE_PREFIX."basiclti_tools
33 WHERE toolid='".$toolid."'";
34 $contentresult = mysql_query($sql, $db);
35 $basiclti_tool_row = mysql_fetch_assoc($contentresult);
36 if ( ! $basiclti_tool_row ) {
37 return _AT('blti_missing_tool').$toolid;
41 if ( isset($basiclti_tool_row['preferheight']) && $basiclti_tool_row['preferheight'] > 0 ) {
42 $height = $basiclti_tool_row['preferheight'];
44 if ( $basiclti_tool_row['allowpreferheight'] == 2 && isset($basiclti_content_row['preferheight']) && $basiclti_content_row['preferheight'] > 0 ) {
45 $height = $basiclti_content_row['preferheight'];
48 $myurl = AT_BASE_HREF.'mods/_standard/basiclti/launch/launch.php?cid='.$cid;
49 if ( $basiclti_tool_row['launchinpopup'] == 1 ||
50 ( $basiclti_tool_row['launchinpopup'] == 2 && $basiclti_content_row['launchinpopup'] == 1 ) ) {
51 // return '<script type="text/javascript">window.open("'.$myurl.'");</script>'."\n";
53 * The ID in the next bit is temporary until we can add the box style to ATutor and
54 * change the ID value to content-tool. In the meantime this will fail validation if tools and
55 * tests or forums are also present for the content page
56 **********************/
57 return '<div class="input-form" id="content-test"><ol><strong>'._AT('proxy').'</strong><ul class="tools"><li><a href="" onclick="ATutor.poptastic(\''.$myurl.'\'); return false;"'.'>'.$basiclti_tool_row['title'].'</a> ('._AT('new_window').')</li></ul></ol></div>'."\n";
59 return '<iframe src="'.$myurl.'" height="'.$height.'" width="100%"></iframe>'."\n";