function get_success_happy_drop_down($arg_success_item_id, $arg_share_id) { if (strlen($arg_success_item_id)) { // Gimme rafl happy results $query = "SELECT DISTINCT {$_SESSION['RealS_prefix']}members.mb_firstname, {$_SESSION['RealS_prefix']}members.mb_surmame\r\n\t\t\t\t FROM {$_SESSION['RealS_prefix']}items\r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}webcells ON {$_SESSION['RealS_prefix']}webcells.webcell_id = {$_SESSION['RealS_prefix']}items.item_webcell\r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}rafl_res ON {$_SESSION['RealS_prefix']}items.item_id = {$_SESSION['RealS_prefix']}rafl_res.rafl_res_item \r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}items AS successes ON successes.item_id = {$_SESSION['RealS_prefix']}items.item_parent_item \r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}items AS tasks ON tasks.item_id = successes.item_parent_item \r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}items AS units ON units.item_id = tasks.item_parent_item \r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}share ON {$_SESSION['RealS_prefix']}share.share_item = units.item_id \r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}share_cohort_members ON ({$_SESSION['RealS_prefix']}share_cohort_members.s_c_m_share = {$_SESSION['RealS_prefix']}share.share_id AND {$_SESSION['RealS_prefix']}webcells.webcell_member = {$_SESSION['RealS_prefix']}share_cohort_members.s_c_m_member)\r\n\t\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}members ON {$_SESSION['RealS_prefix']}members.mb_id = {$_SESSION['RealS_prefix']}share_cohort_members.s_c_m_member\r\n\t\t\t\t WHERE {$_SESSION['RealS_prefix']}items.item_parent_item = " . GetSQLValueString($arg_success_item_id, "int") . "\r\n\t\t\t\t \tAND {$_SESSION['RealS_prefix']}share.share_id = " . GetSQLValueString($arg_share_id, 'int') . "\r\n\t\t\t\t \tAND {$_SESSION['RealS_prefix']}members.mb_type != 'cohort'\r\n\t\t\t\t \tAND {$_SESSION['RealS_prefix']}items.item_default_type = 6\r\n\t\t\t\t \tAND rafl_res_rate = 2\r\n\t\t\t\t ORDER BY {$_SESSION['RealS_prefix']}members.mb_firstname, {$_SESSION['RealS_prefix']}members.mb_surmame"; // Debugging //echo $query; $mysql = new mysqlquery(); $rows = $mysql->getrows($query); if (count($rows)) { $drop_down = '<select size="1" class="who_is">'; //$drop_down .= ' <option>who is happy?</option>'; foreach ($rows as $row) { $drop_down .= ' <option>' . trim($row['mb_firstname'] . ' ' . $row['mb_surmame']) . '</option>'; } $drop_down .= '</select>'; return $drop_down; } else { return ' '; } } else { return ' '; } }
/** * Displays rafl main page, i.e. learner and mentor view with unit and task pies. * This page contains an AJAX page that is called by the flash to display a task's success criteria. * @author Daniel Dammann <*****@*****.**> */ function display_rafl_component($course_id, $country_item_id, $arg_cfg) { // Debugging //error_reporting(E_ALL); // Set up session variables for the rafl pages // Only one school, so hard-coded $_SESSION['RealS_schoolid'] = RAFL_SCHOOL; // WORKAROUND: have to pass it, cos inside this function we loose scope with the configuration $CFG = $arg_cfg; // WORKAROUND: Define moodle module table namespace and web path $_SESSION['RealS_prefix'] = $CFG->prefix . RAFL_DBASE_PREFIX; //$_SESSION['RealS_raflroot'] = $CFG->wwwroot . '/mod/rafl/'; print_simple_box_start('center'); // Disable login check for now, cos this share may be public. In checkSharedRights() we will know and do another login check. $RL_disablelogincheck = 1; // Gimme libraries require_once "../config.php"; require_once "includes/rlsmart/header.php"; require_once "includes/rlsmart/general.php"; require_once 'includes/common/KT_common.php'; require_once 'includes/tng/tNG.inc.php'; require_once 'userviews_class.php'; require_once 'classes/class_skin_data.php'; require_once "includes/top_menu/top_menu.php"; require_once "classes/item/Comments.class.php"; require_once 'classes/class_comment_evidence_count.php'; require_once 'classes/class_text_editor.php'; // Gimme the text editor $editor = new textEditor(); $editor->setFormField('evidence_text'); $editor->setEditorType('full'); $editor->setContent(''); $editor->setWidth('571px'); $editor->setHeight('225px'); $editor->setCssPath($CFG->wwwroot . '/mod/rafl/layouts/rafl_css.php'); $userview = new userviews(); $parent_data = $userview->findParent($country_item_id, "rafl"); //print_r($parent_data); // Check viewing rights if (!isset($course_id) || $course_id == "") { $userview->checkViewRights(); //$userview->viewRight =1; } else { $userview->checkSharedRights($course_id); //$userview->sharedRight=1; } $mysql = new mysqlquery(); /* // Learner or mentor view //if (strlen($_GET['view'])) { //$view = $_GET['view']; //} elseif (strlen($_SESSION['USER']->id)) { // If this user is the item creator or a share mentor, default to mentor view if (($_SESSION['USER']->id == $parent_data['webcell_member']) || $userview->shareMentor==1) { $view = 'mentor'; } //} */ // Learner or mentor view $view = 'learner'; if ($_SESSION['USER']->id == $parent_data['webcell_member'] || $userview->shareMentor == 1) { $view = 'mentor'; } // Gimme user id $user_id = $_SESSION['USER']->id; //$user_id = $userview->getMemberId($_SESSION['USER']->id, $_GET['mb_id'], $view); // Get tasks // INNER JOIN share ON {$_SESSION['RealS_prefix']}share.share_item = {$_SESSION['RealS_prefix']}items.item_parent_item // AND {$_SESSION['RealS_prefix']}share.share_id = " . GetSQLValueString($course_id, "int") . " // CASE share_unread_evidence_count WHEN 0 THEN webcell_title ELSE CONCAT(webcell_title, ' (', share_unread_evidence_count, ')') END AS webcell_title $query = "SELECT\n \t \t{$_SESSION['RealS_prefix']}webcells.webcell_title,\n \t \t{$_SESSION['RealS_prefix']}webcells.webcell_text,\n \t \t{$_SESSION['RealS_prefix']}items.item_id\n \t FROM {$_SESSION['RealS_prefix']}items\n \t \tINNER JOIN {$_SESSION['RealS_prefix']}webcells ON {$_SESSION['RealS_prefix']}webcells.webcell_id={$_SESSION['RealS_prefix']}items.item_webcell\n \t \tINNER JOIN {$_SESSION['RealS_prefix']}rafl ON {$_SESSION['RealS_prefix']}rafl.rafl_item={$_SESSION['RealS_prefix']}items.item_id\n \t \tINNER JOIN {$_SESSION['RealS_prefix']}members ON {$_SESSION['RealS_prefix']}webcells.webcell_member = {$_SESSION['RealS_prefix']}members.mb_id\n \t WHERE {$_SESSION['RealS_prefix']}items.item_parent_item = " . $parent_data['item_id'] . "\n \t \tAND {$_SESSION['RealS_prefix']}items.item_default_type = 1\n \t ORDER BY {$_SESSION['RealS_prefix']}rafl.rafl_order ASC"; $top_menu = $mysql->getrows($query); if (count($top_menu) == 0) { echo '<script type="text/javascript">alert(\'This page does not exist.\')</script>'; exit; } //$query = "SELECT tags.*, item_2_tag.item_tag_item FROM (item_2_tag LEFT JOIN tags ON tags.tag_id=item_2_tag.item_tag_tag) WHERE item_2_tag.item_tag_item=" . $parent_data [ 'item_id' ] ; //$tags = $mysql->getrows ( $query ) ; // User's skin require_once "classes/class_skin_data.php"; $member_logged_in = $userview->getMemberData($_SESSION['USER']->id); $skin_data = new SkinData("main/xml/skins/", $member_logged_in["mb_school"], $member_logged_in["mb_theme"]); //$skin_path = $skin_data->getSkinPath(); // TAOC: Configure this when used in a location outside of the rafl mod directory $skin_path = $CFG->wwwroot . '/mod/rafl/main/skins/AfL%20Default/'; //echo "<pre>"; //echo 'Background colour: ' . $skin_data->getSkinColour("pieChartBackgroundColour") ."\n"; //echo 'Complete colour: ' . $skin_data->getSkinColour("pieChartCompleteColour") ."\n"; //echo "skin path is '$skin_path'\n"; //echo "</pre>"; function strip_bad_tags($html) { $s = preg_replace("@</?[^>]*>*@", "", $html); return $s; } $taskArray = array(); $idArray = array(); $ta_help = array(); $ta_helpData = array(); if (count($top_menu) > 0) { foreach ($top_menu as $row_top_menu) { array_push($taskArray, urlencode($row_top_menu['webcell_title'])); array_push($idArray, $row_top_menu['item_id']); array_push($ta_help, $row_top_menu['webcell_text'] != '' ? '1' : '0'); $ta_helpData[$row_top_menu['item_id']] = $row_top_menu['webcell_text']; } } if (isset($user_id)) { include "count_rating.php"; } ?> <link href="<?php echo $CFG->wwwroot; ?> /mod/rafl/layouts/rafl_css.php" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- .style1 { font-size: 10px; } #loading { display: none; text-align: center; margin-bottom: 20px; } #topbar { background-color: #AB1B15; height: 19px; width: 500px; display: none; position: absolute; z-index: 100; } #topbar p { font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold; color: #FFFFFF; padding-left: 5px; padding-top: 2px; margin: 0; } #topbar img { float: right; padding: 2px 4px; margin: 0px; cursor: pointer; } --> </style> <script type="text/javascript" src="<?php echo $CFG->wwwroot; ?> /mod/rafl/javascripts/swfobject.js"></script> <script type="text/javascript" src="<?php echo $CFG->wwwroot; ?> /mod/rafl/includes/kore/kore.js"></script> <script src="<?php echo $CFG->wwwroot; ?> /mod/rafl/includes/common/js/base.js" type="text/javascript"></script> <script src="<?php echo $CFG->wwwroot; ?> /mod/rafl/includes/common/js/utility.js" type="text/javascript"></script> <script src="<?php echo $CFG->wwwroot; ?> /mod/rafl/javascripts/util.js" type="text/javascript"></script> <script type="text/javascript" src="<?php echo $CFG->wwwroot; ?> /mod/rafl/ajax/jquery/jquery-1.2.6.min.js"></script> <script type="text/javascript"> var resultId = 0; var successId = 0; var myWidth = 0, myHeight = 0, myScroll = 0; myScrollWidth = 0; myScrollHeight = 0; /** * */ function getSize() { if (document.all) { // IE4+ or IE6+ in standards compliant myWidth = (document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth; myHeight = (document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight; myScroll = (document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop; } else { // Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; myScroll = window.pageYOffset; } // Core code from - quirksmode.org if (window.innerHeight && window.scrollMaxY) { myScrollWidth = document.body.scrollWidth; myScrollHeight = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac myScrollWidth = document.body.scrollWidth; myScrollHeight = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari myScrollWidth = document.body.offsetWidth; myScrollHeight = document.body.offsetHeight; } } /** * Displays the guidance for the unit being viewed. * Called from within the flash. */ function displayUnitGuide () { reset_all_sections(''); document.getElementById('unitGuide').style.display='block'; } /** * Displays the guidance for the supplied task ID. * Called from within the flash. */ function displayTaskGuide (taskId) { reset_all_sections(taskId); document.getElementById('taskGuide'+taskId).style.display='block'; } /** * Displays the guidance for a piece of success criteria. * Called when the guidance button on the criteria entry is clicked. */ function displaySuccessGuide (successId) { document.getElementById('successGuide'+successId).style.display='block'; } /** * */ function showSuccessRow(showThisRowId) { reset_all_sections(showThisRowId); document.getElementById('successTableRow' + showThisRowId).style.display = 'block'; document.getElementById('commentDiv').style.display='block'; } /** * Closes the evidence panel */ function close_evidence() { document.getElementById('evidence').style.display='none'; document.getElementById('commentDiv').style.display='none'; document.getElementById('commentDiv').innerHTML = ''; open_success_table(); } /** * Displays the succes table */ function open_success_table() { reset_all_sections(''); if (document.getElementById('successTable')) { document.getElementById('successTable').style.display='block'; } } /** * Hides panels with exception of guidance id provided */ function reset_all_sections(exceptId) { if (document.getElementById('unitGuide')) { document.getElementById('unitGuide').style.display='none'; } if (document.getElementById('successTable')) { //document.getElementById('successTable').innerHTML = ''; document.getElementById('successTable').style.display='none'; } if (document.getElementById('evidence')) { document.getElementById('evidence').style.display='none'; } if (document.getElementById('commentDiv')) { document.getElementById('commentDiv').innerHTML = ''; document.getElementById('commentDiv').style.display='none'; } for(var i = 0; i < document.getElementsByTagName('div').length; i++) { thisTag = document.getElementsByTagName('div')[i]; if (thisTag.id.substring(0, 9) == 'taskGuide') { if (thisTag.id != document.getElementById('taskGuide' + exceptId)) { thisTag.style.display= 'none'; } } if (thisTag.id.substring(0, 12) == 'successGuide') { if (thisTag.id != document.getElementById('successGuide' + exceptId)) { thisTag.style.display= 'none'; } } } for(var i = 0; i < document.getElementsByTagName('table').length; i++) { thisTag = document.getElementsByTagName('table')[i]; if (thisTag.id.substring(0, 15) == 'successTableRow') { if (thisTag.id != document.getElementById('successTableRow' + exceptId)) { thisTag.style.display= 'none'; } } } } /** * Gets a reference to the supplied swf movie id */ function thisMovie(movieName) { if (navigator.appName.indexOf("Microsoft") != -1) { return window[movieName] } else { return document[movieName] } } /** * Displays the success criteria for the supplied task ID. * Called from within the flash. */ function displayTask(taskId) { document.getElementById('loading').style.display = 'block'; $.ajax({ type: 'GET', url: '<?php echo $CFG->wwwroot; ?> /mod/rafl/getSuccess.php', data: 'item_id=' + taskId + '&share_id=<?php echo $course_id; ?> &shareComment=<?php echo $userview->shareComment; ?> &view=<?php echo $view; ?> ', timeout: 20000, success: function(arg_content) { document.getElementById('loading').style.display = 'none'; reset_all_sections(''); // Fill DIV with content result = arg_content.split('##'); document.getElementById('success').innerHTML = result[0]; // Evaluate javascript string eval(result[1]); }, error: function(request, errorType, errorThrown) { // Go back to the listing alert('Unfortunately, the guidance could not be retrieved. Please check your Internet connection. Should this keep happening even with a live Internet connection, please contact support@smartassess.com and quote: \n\n1. Error time: <?php echo gmdate(DATE_RFC822); ?> \n2. Error type: ' + errorType + ' \n3. Error: ' + errorThrown + ' \n4. User id: <?php echo $_SESSION['USER']->id; ?> \n5. Web page: http://<?php echo $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?> '); document.getElementById('loading').style.display = 'none'; } }); } /** * Opens the evidence (content) panel */ function displayEvidence (thesuccessId) { if (<?php echo $editor->getEditorReadyToUseJavascriptVariable(); ?> ) { document.getElementById('loading').style.display = 'block'; successId = thesuccessId; $.ajax({ type: 'GET', url: '<?php echo $CFG->wwwroot; ?> /mod/rafl/evidence.php', data: 'item_id=<?php echo $country_item_id; ?> &success_id=' + successId + '&share_id=<?php echo $course_id; ?> ', timeout: 20000, success: function(content) { //alert(content); document.getElementById('loading').style.display = 'none'; // Fill editor with content <?php if ($userview->shareMentor == 1) { ?> var evidence_content; evidence_content = '<div class="popupHead">'; evidence_content += '<img src="<?php echo $CFG->wwwroot; ?> /mod/rafl/images/close.gif" alt="close" onclick="close_evidence();" />'; evidence_content += ' <p>HERE IS THE EVIDENCE</p>'; evidence_content += '</div>'; evidence_content += '<div id="commentText">'; evidence_content += content; evidence_content += '</div>'; evidence_content += '<br /><br />'; document.getElementById("evidence").innerHTML = evidence_content; <?php } else { echo $editor->setContentViaJavascript('content') . ';'; } ?> // Show comment section if (content.length > 0) { displayEvidenceComment(successId); } document.getElementById("evidence").style.display = "block"; }, error: function(request, errorType, errorThrown) { // Go back to the listing alert('Unfortunately, the evidence could not be retrieved. Please check your Internet connection. Should this keep happening even with a live Internet connection, please contact support@smartassess.com and quote: \n\n1. Error time: <?php echo gmdate(DATE_RFC822); ?> \n2. Error type: ' + errorType + ' \n3. Error: ' + errorThrown + ' \n4. User id: <?php echo $_SESSION['USER']->id; ?> \n5. Web page: http://<?php echo $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?> '); document.getElementById('loading').style.display = 'none'; close_evidence(); <?php echo $editor->setContentViaJavascript(''); ?> ; } }); } else if(confirm('The web editor doesn\'t seem to have loaded properly. Do you want to refresh the page?')) { window.location.reload(); } } /** * */ function displayEvidenceComment (thesuccessId) { document.getElementById('loading').style.display = 'block'; successId = thesuccessId; $.ajax({ type: 'GET', url: '<?php echo $CFG->wwwroot; ?> /mod/rafl/get_evidence_comment.php', data: 'item_id=<?php echo $country_item_id; ?> &success_id=' + successId + '&share_id=<?php echo $course_id; ?> ', timeout: 20000, success: function(arg_content) { document.getElementById('loading').style.display = 'none'; // Remove star, when being viewed if (document.getElementById("glass" + successId).src.indexOf("evidence_colour_unread.gif") != -1) { document.getElementById("glass" + successId).src = "<?php echo $CFG->wwwroot; ?> /mod/rafl/images/evidence_colour.gif"; } // Fill DIV with content if (arg_content.length > 0) { var comment_content; comment_content = '<div class="popupHead">'; comment_content += ' <p>COMMENTS ON THE EVIDENCE</p>'; comment_content += '</div>'; comment_content += '<div id="commentText">'; comment_content += arg_content; comment_content += '</div>'; comment_content += '<br /><br />'; document.getElementById('commentDiv').innerHTML = comment_content; document.getElementById('commentDiv').style.display='block'; } }, error: function(request, errorType, errorThrown) { // Go back to the listing alert('Unfortunately, the comment could not be retrieved. Please check your Internet connection. Should this keep happening even with a live Internet connection, please contact support@smartassess.com and quote: \n\n1. Error time: <?php echo gmdate(DATE_RFC822); ?> \n2. Error type: ' + errorType + ' \n3. Error: ' + errorThrown + ' \n4. User id: <?php echo $_SESSION['USER']->id; ?> \n5. Web page: http://<?php echo $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?> '); document.getElementById('loading').style.display = 'none'; } }); } /** * Saves evidence entered byt the user * Called when save button clicked. */ function saveEvidence(webcellText) { //alert(webcellText); document.getElementById('loading').style.display = 'block'; $.ajax({ type: 'POST', url: '<?php echo $CFG->wwwroot; ?> /mod/rafl/store_evidence.php', data: 'unit_item_id=<?php echo $parent_data['item_id']; ?> &success_item_id=' + successId + '&webcelltext=' + encodeURIComponent(webcellText) + '&share_id=<?php echo $course_id; ?> &taskArray=<?php echo implode("||", $idArray); ?> ', timeout: 20000, success: function(arg_content) { //alert(arg_content); document.getElementById('loading').style.display = 'none'; close_evidence(); <?php echo $editor->setContentViaJavascript(''); ?> ; if (webcellText!='') { document.getElementById('glass'+successId).src = '<?php echo $CFG->wwwroot; ?> /mod/rafl/images/evidence_colour.gif'; } else { document.getElementById('glass'+successId).src = '<?php echo $CFG->wwwroot; ?> /mod/rafl/images/evidence_ghost.gif'; } // Capture return value and send to pies result = arg_content.split("##"); sendToWidget(successId,result[0]); sendToFlash(result[1],result[2],result[3],result[4]); }, error: function(request, errorType, errorThrown) { // Open editor back up with current content document.getElementById('loading').style.display = 'none'; alert('Unfortunately, your evidence might not have saved correctly. Please check your Internet connection. Should this keep happening even with a live Internet connection, please contact support@smartassess.com and quote: \n\n1. Error time: <?php echo gmdate(DATE_RFC822); ?> \n2. Error type: ' + errorType + ' \n3. Error: ' + errorThrown + ' \n4. User id: <?php echo $_SESSION['USER']->id; ?> \n5. Web page: http://<?php echo $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?> '); displayEvidence(successId); } }); } /** * Sends data to the flash */ function sendToFlash (overall,doneArray,rate,rateArray) { //var txt = document.getElementById("inputField").value; //thisMovie("foo").UpdatePie(); thisMovie("foo").setRating(overall,doneArray,rate,rateArray); } /** * Sends data to a flash widget (success criteria button) */ function sendToWidget(widgetid,value) { //alert(widgetid); window.setTimeout("sendToWidgetNow(" + widgetid + "," + value + ")", 1000); } function sendToWidgetNow(widgetid,value) { //alert(widgetid); thisMovie("fooq"+widgetid).setRating(value); } /** * Sets a new rating for an item of success criteria * Called when a smiley / medal / etc is clicked on */ function receivedFromFlash(txt, success_id) { document.getElementById('loading').style.display = 'block'; $.ajax({ type: 'GET', url: '<?php echo $CFG->wwwroot; ?> /mod/rafl/store_rating.php', data: 'parent_id=' + success_id + '&rating=' + txt + '&share_id=<?php echo $course_id; ?> ' + '&view=<?php echo $view; ?> &taskArray=<?php echo implode("||", $idArray); ?> ', timeout: 20000, success: function(arg_content) { document.getElementById('loading').style.display = 'none'; // Capture return value and send to pies result = arg_content.split("##"); //alert("reset Overall: "+result[1]+" doneArray: "+result[2]+" Rate Total:"+result[3]+" rateArray:"+result[4]); sendToFlash(result[1],result[2],result[3],result[4]); }, error: function(request, errorType, errorThrown) { // Go back to the listing alert('Unfortunately, your rating might not have saved correctly. Please check your Internet connection. Should this keep happening even with a live Internet connection, please contact support@smartassess.com and quote: \n\n1. Error time: <?php echo gmdate(DATE_RFC822); ?> \n2. Error type: ' + errorType + ' \n3. Error: ' + errorThrown + ' \n4. User id: <?php echo $_SESSION['USER']->id; ?> \n5. Web page: http://<?php echo $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?> '); document.getElementById('loading').style.display = 'none'; } }); } </script> <div id="raflWrapper"> <div id="foo3"> <p><strong>You need to upgrade your Flash Player</strong></p> <p><a href="#?detectflash=false">click here</a> to bypass Flash detection</p> </div> <script type="text/javascript"> // <![CDATA[ var so = new SWFObject("<?php echo $CFG->wwwroot; ?> /mod/rafl/main/flash/afl_unitDisplay.swf", "foo", "595", "300", "8", "#FFFFFF"); so.addParam("wmode","transparent"); so.addVariable("skin_path", "<?php echo $skin_path; ?> "); // the current skin path so.addVariable("un_help", "<?php echo $parent_data['webcell_text'] != '' ? '1' : '0'; ?> "); // unit help so.addVariable("ta_id", "0"); // task id selected so.addVariable("pic", "<?php echo rawurlencode($member_logged_in['mb_pic']); ?> "); // users picture so.addVariable("colours", "<?php echo $member_logged_in['mb_colour']; ?> "); // the colour scheme selected (traffic light / smiley / etc) so.addVariable("taskArray", "<?php echo implode("||", $taskArray); ?> "); // array of the task descriptions so.addVariable("idArray", "<?php echo implode("||", $idArray); ?> "); // array of the task item ids so.addVariable("ta_help", "<?php echo implode("||", $ta_help); ?> "); // array of the task help status Boolean // $rateTotal, $rateArray & $doneArray are defined in "count_rating.php" so.addVariable("rate", "<?php if (isset($user_id)) { echo $rateTotal; } ?> "); so.addVariable("rateArray", "<?php if (isset($user_id)) { echo implode("||", $rateArray); } ?> "); so.addVariable("overall", "<?php if (isset($user_id) && count($doneArray) > 0) { echo array_sum($doneArray) / count($doneArray); } ?> "); so.addVariable("percentArray", "<?php if (isset($user_id)) { echo implode("||", $doneArray); } ?> "); // write the flash content to the page so.write("foo3"); // ]]> </script> <div id="loading"><img src="/mod/rafl/main/images/loading.gif" alt="loading" /></div> <div id="success"> </div> <div id="evidence" style="display: none;"> <div class="popupHead" style="width: 557px;"> <img src="/mod/rafl/images/close.gif" alt="close" onclick="close_evidence(); <?php echo $editor->setContentViaJavascript(''); ?> ;" /> <p>HERE IS MY EVIDENCE</p> </div> <?php // Only logged in users can contribute if (strlen($_SESSION['USER']->id)) { echo $editor->getEditor(); } ?> <input type="button" name="KT_Insert1" id="KT_Insert1" value="Save Evidence" onclick="saveEvidence(<?php echo $editor->getContentViaJavascript(); ?> );" /> <input type="button" name="cancel" id="cancel" value="Cancel" onclick="close_evidence(); <?php echo $editor->setContentViaJavascript(''); ?> ;" /> <br /><br /><br /> </div> <div id="commentDiv" style="display:none;"></div> <div id="unitGuide" style="display:none;"> <div class="popupHead"> <img src="/mod/rafl/images/close.gif" alt="close" onclick="open_success_table();" /> <p>HERE IS YOUR GUIDANCE</p> </div> <div id="unitGuideText"> <?php echo $parent_data['webcell_text']; ?> </div> <br /><br /> </div> <?php foreach ($ta_helpData as $key => $value) { ?> <div id="taskGuide<?php echo $key; ?> " style="display:none;"> <div class="popupHead"> <img src="/mod/rafl/images/close.gif" alt="close" onclick="open_success_table();" /> <p>HERE IS YOUR GUIDANCE</p> </div> <div id="taskText"> <?php echo '<div class="guidanceContainer">' . $value . '</div>'; ?> </div> <br /><br /> </div> <?php } ?> <br><br> </div> <?php // Do comments $obj_comment = new rs_itemComments($mysql, 1, 'rafl', $course_id, $parent_data['item_id'], '', '/mod/rafl/layouts/rafl_css.php'); $obj_comment->renderSupportingJavascript(); // Display the comments form if (strlen($course_id)) { $obj_comment->renderCommentSubmissionForms(); } print_simple_box_end(); }
public function increaseEvidenceCounter($argUnitItemId, $argEvidenceItemId, $argShareId) { // Notify request mentors UNION with share mentors (but not other share members) // Don't set a status for the current user, cos that's not very informative $sql = "SELECT DISTINCT {$_SESSION['RealS_prefix']}members.mb_id\r\n\t\t\t FROM {$_SESSION['RealS_prefix']}share\r\n\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}members ON ({$_SESSION['RealS_prefix']}members.mb_id = {$_SESSION['RealS_prefix']}share.share_member OR {$_SESSION['RealS_prefix']}members.mb_id = {$_SESSION['RealS_prefix']}share.share_permission)\r\n\t\t\t WHERE {$_SESSION['RealS_prefix']}members.mb_type = 'mentor'\r\n\t\t\t \tAND {$_SESSION['RealS_prefix']}share.share_id = " . GetSQLValueString($argShareId, "int") . "\r\n\t\t\t \tAND {$_SESSION['RealS_prefix']}members.mb_id != " . $_SESSION['USER']->id . "\r\n\t\t\t UNION\r\n\t\t\t\tSELECT DISTINCT {$_SESSION['RealS_prefix']}members.mb_id\r\n\t\t\t FROM {$_SESSION['RealS_prefix']}share\r\n\t\t\t \tINNER JOIN {$_SESSION['RealS_prefix']}share_mentor ON share_mentor_share = share_id\r\n\t\t\t\t\tINNER JOIN {$_SESSION['RealS_prefix']}members ON {$_SESSION['RealS_prefix']}members.mb_id = share_mentor_mentor\r\n\t\t\t WHERE {$_SESSION['RealS_prefix']}members.mb_type = 'mentor'\r\n\t\t\t \tAND {$_SESSION['RealS_prefix']}share.share_id = " . GetSQLValueString($argShareId, "int") . "\r\n\t\t\t \tAND {$_SESSION['RealS_prefix']}members.mb_id != " . $_SESSION['USER']->id; $mysql = new mysqlquery(); $members = $mysql->getrows($sql); // Debugging //echo($sql); foreach ($members as $member) { // Avoid duplicates, cos evidences can get updated $sql = "SELECT NULL\r\n\t\t\t\t FROM {$_SESSION['RealS_prefix']}item_view_status\r\n\t\t\t\t WHERE mb_id_writer = " . $_SESSION['USER']->id . "\r\n\t\t\t\t \tAND mb_id_viewer = " . $member['mb_id'] . "\r\n\t\t\t\t \tAND item_id_comment_evidence = " . GetSQLValueString($argEvidenceItemId, "int"); $mysql = new mysqlquery(); $duplicates = $mysql->getrows($sql); if (!$duplicates) { // Insert mentor status $sql = "INSERT INTO {$_SESSION['RealS_prefix']}item_view_status (\r\n\t\t\t\t\t \titem_view_status_id,\r\n\t\t\t\t\t \titem_type_id,\r\n\t\t\t\t\t \tmb_id_writer,\r\n\t\t\t\t\t \tmb_id_viewer,\r\n\t\t\t\t\t \titem_id_comment_evidence,\r\n\t\t\t\t\t \titem_id,\r\n\t\t\t\t\t \tshare_id,\r\n\t\t\t\t\t \tdate_created\r\n\t\t\t\t\t ) VALUES (\r\n\t\t\t\t\t \tNULL,\r\n\t\t\t\t\t \t'6',\r\n\t\t\t\t\t \t'" . $_SESSION['USER']->id . "',\r\n\t\t\t\t\t \t'" . $member['mb_id'] . "',\r\n\t\t\t\t\t \t'" . $argEvidenceItemId . "',\r\n\t\t\t\t\t \t'" . $argUnitItemId . "',\r\n\t\t\t\t\t \t" . $argShareId . ",\r\n\t\t\t\t\t \tNOW()\r\n\t\t\t\t\t )"; $mysql->query($sql); } } }