[moodle] / contrib / plugins / grade / report / visual / flex.php Repository:

View of /contrib/plugins/grade/report/visual/flex.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (annotate)
Tue Jul 15 03:27:17 2008 WST (16 months, 1 week ago) by dservos
Branch: MAIN
Changes since 1.1: +28 -0 lines
CONTRIB-497
Cleaned up some of the code for report/visual and the flex based application for viewing the visualizations.

Improved the UI of the visualization.

Added documentation to both the php and actionscript 3 (flex) code.

Removed some unneeded files.

TODO:
*Add more visualizations.
*Add printer firendly version.
*Make flex appplications settings less hardcoded and loaded from moodle.
*Load lang files from moodle to flex for full language support.
*Add a settings page for the report.
<?php
///////////////////////////////////////////////////////////////////////////
//                                                                       //
// NOTICE OF COPYRIGHT                                                   //
//                                                                       //
// Moodle - Modular Object-Oriented Dynamic Learning Environment         //
//          http://moodle.org                                            //
//                                                                       //
// Copyright (C) 1999 onwards  Martin Dougiamas  http://moodle.com       //
//                                                                       //
// This program is free software; you can redistribute it and/or modify  //
// it under the terms of the GNU General Public License as published by  //
// the Free Software Foundation; either version 2 of the License, or     //
// (at your option) any later version.                                   //
//                                                                       //
// This program is distributed in the hope that it will be useful,       //
// but WITHOUT ANY WARRANTY; without even the implied warranty of        //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         //
// GNU General Public License for more details:                          //
//                                                                       //
//          http://www.gnu.org/copyleft/gpl.html                         //
//                                                                       //
///////////////////////////////////////////////////////////////////////////

/**
* generates HTML for the visual report.
* This still needs work.
*/

require_once '../../../config.php';

if(!isset($courseid) || is_null($courseid)) {
    $courseid = required_param('id');
}

if(!isset($course) || is_null($course)) {
    if(isset($DB) && !is_null($DB)) {
        $course = $DB->get_record('course', array('id' => $courseid));
    } else {
        $course = get_record('course', 'id', $courseid);
    }
}

$flashvars = array();
$flashvars['username'] = $USER->username;
$flashvars['userid'] = $USER->id;
$flashvars['courseid'] = $courseid;
$flashvars['coursefullname'] = $course->fullname;
$flashvars['courseshortname'] = $course->shortname;
$flashvars['sessionid'] = session_id();
$flashvars['sessioncookie'] = $CFG->sessioncookie;
$flashvars['sessiontest'] = $SESSION->session_test;
$flashvars['dirroot'] = $CFG->dirroot;
$flashvars['wwwroot'] = $CFG->wwwroot;
$flashvars['langmodulename'] = get_string('modulename', 'gradereport_visual');
$flashvars['langgrade'] =get_string('grades');

$flashvarstext = '';
foreach($flashvars as $key=>$val) {
	$flashvarstext .= $key. '=' . addslashes(urlencode(strip_tags($val))) . '&';
}
$flashvarstext = substr($flashvarstext, 0, strlen($flashvarstext) - 1);

?>
<div style="vertical-align: top; text-align: center;">
<script src="AC_OETags.js" language="javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
// -----------------------------------------------------------------------------
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 28;
// -----------------------------------------------------------------------------


// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);

// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

if ( hasProductInstall && !hasRequestedVersion ) {
	// DO NOT MODIFY THE FOLLOWING FOUR LINES
	// Location visited after installation is complete if installation is required
	var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
	var MMredirectURL = window.location;
    document.title = document.title.slice(0, 47) + " - Flash Player Installation";
    var MMdoctitle = document.title;

	AC_FL_RunContent(
        "flashVars", "<?php echo $flashvarstext; ?>",
		
		"src", "playerProductInstall",
		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
		"width", "800",
		"height", "600",
		"align", "middle",
		"id", "flare_visualization",
		"quality", "high",
		"bgcolor", "#FFFFFF",
		"name", "flare_visualization",
		"allowScriptAccess","sameDomain",
		"type", "application/x-shockwave-flash",
		"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
} else if (hasRequestedVersion) {
	// if we've detected an acceptable version
	// embed the Flash Content SWF when all tests are passed
	AC_FL_RunContent(
            "flashVars", "<?php echo $flashvarstext; ?>",
			
			"src", "flare_visualization",
			"width", "800",
			"height", "600",
			"align", "middle",
			"id", "flare_visualization",
			"quality", "high",
			"bgcolor", "#FFFFFF",
			"name", "flare_visualization",
			"allowScriptAccess","sameDomain",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
	);
  } else {  // flash is too old or we can't detect the plugin
    var alternateContent = 'Alternate HTML content should be placed here. '
  	+ 'This content requires the Adobe Flash Player. '
   	+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
    document.write(alternateContent);  // insert non-flash content
  }
// -->
</script>
<noscript>
  	<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="flare_visualization" width="800" height="600"
			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
            <param name="flashVars" value="<?php echo $flashvarstext;?>" />
			
            <param name="movie" value="flare_visualization.swf" />
			<param name="quality" value="high" />
			<param name="bgcolor" value="#FFFFFF" />
			<param name="allowScriptAccess" value="sameDomain" />
			<embed src="flare_visualization.swf" quality="high" bgcolor="#ffffff"
			    flashVars="<?php echo $flashvarstext; ?>" 
				width="800" height="600" name="flare_visualization" align="middle"
				play="true"
				loop="false"
				quality="high"
				allowScriptAccess="sameDomain"
				type="application/x-shockwave-flash"
				pluginspage="http://www.adobe.com/go/getflashplayer">
			</embed>
	</object>
</noscript>
</div>

Moodle CVS Admin
ViewVC Help
Powered by ViewVC 1.0.7