Commits

Nick Freear committed ebe40dc

Moving configuration for capret.js and capret-piwik.js out of views..

* ..Into Test controller, and config - $config[piwik_capret_id]

Comments (0)

Files changed (4)

application/config/trackoer_config.dist.php

 // Piwik analytics.
 #$config['piwik_default_id'] = N;
 
+// CaPReT-Piwik analytics.
+#$config['piwik_capret_id'] = M;
 
 
 /*

application/controllers/test.php

 	*/
 	public function capret($course = 'math', $page = 'course-view') {
 
+		$piwik_idsite = $this->config->item('piwik_capret_id');
+		if (! $piwik_idsite) {
+			$piwik_idsite = 2;
+		}
+
+		$view_data = array(
+			'jquery_js_url' => 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js',
+			'capret_js_url' => base_url() .'capret/js/',
+			##$capret_js_url = 'http://capret.mitoeit.org/js/';
+			'piwik_idsite' => $piwik_idsite,
+			'debug' => (bool) $this->input->get('debug'),
+		);
+	
 		if ('course-piwik' == $page) {
 			$this->_load_layout(self::LAYOUT);
 			
-			$this->layout->view("capret_test/labspace-acct-b2s-$course-$page-1");
+			$this->layout->view("capret_test/labspace-acct-b2s-$course-$page-1", $view_data);
 		} else {
-			$this->load->view("capret_test/labspace-acct-b2s-$course-$page-1");
+			$this->load->view("capret_test/labspace-acct-b2s-$course-$page-1", $view_data);
 		}
 	}
 

application/views/capret_test/labspace-acct-b2s-math-course-piwik-1.php

 <?php
-    $capret_js_url = base_url() .'capret/js/';
 	$which_capret = '-piwik';
-	$piwik_idsite = 2;
-	$debug = $this->input->get('debug');
-
 ?>
 
 
 <div id="cc-code" class="capret capret-piwik">
 
 <!--Capret-widget starts (src=// below is deliberate)-->
-<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
+<script src="<?php echo $jquery_js_url ?>"></script>
 <script src="<?php echo $capret_js_url ?>jquery.plugin.clipboard.js"></script>
 <script src="<?php echo $capret_js_url ?>oer_license_parser.js"></script>
 <!--[if lt IE 8]>

application/views/capret_test/labspace-acct-b2s-math-course-view-1.php

 
     $resource_url = 'http://labspaceacct.open.ac.uk/';
 
-    $jquery_js_url = 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js';
-    ##$capret_js_url = 'http://capret.mitoeit.org/js/';
-    $capret_js_url = base_url() .'capret/js/';
-
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html  xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
 <head>