2 /****************************************************************/
\r
3 /* Atutor-OpenCaps Module
\r
4 /****************************************************************/
\r
5 /* Copyright (c) 2010
\r
6 /* Written by Antonio Gamba
\r
7 /* Adaptive Technology Resource Centre / University of Toronto
\r
9 /* This program is free software. You can redistribute it and/or
\r
10 /* modify it under the terms of the GNU General Public License
\r
11 /* as published by the Free Software Foundation.
\r
12 /****************************************************************/
\r
15 include_once('../../include/config.inc.php');
\r
16 include_once('../../include/lib/mysql_connect.inc.php');
\r
18 // load ATutor-OpenCaps Module Vitals
\r
19 include_once('include/vitals.inc.php');
\r
22 //echo '<br/>AT_CONTENT_DIR: '.AT_CONTENT_DIR;
\r
23 //echo '<br/>AT_BASE_HREF: '.AT_BASE_HREF;
\r
25 // check if is GET or POST requet
\r
33 if($ocAtSettings['atWebPath'] == '')
\r
35 $atWebPath_replace = str_replace('mods/AtOpenCaps/service.php','',$_SERVER['SCRIPT_NAME']);
\r
36 $ocAtSettings['atWebPath'] = 'http://'.$_SERVER['HTTP_HOST'].''.$atWebPath_replace;
\r
39 if (isset($_GET['action']) && $_GET['action'] !='')
\r
41 $action = $_GET['action'];
\r
43 if (isset($_GET['id']) && $_GET['id'] !='')
\r
45 $projectId = $_GET['id'];
\r
49 if (isset($_POST['action']) && $_POST['action'] !='')
\r
51 $action = $_POST['action'];
\r
53 if (isset($_POST['id']) && $_POST['id'] !='')
\r
55 $projectId = $_POST['id'];
\r
59 // Get media data and return JSon
\r
61 if ($action=='getMedia' && $projectId !='')
\r
63 $myProjectManager = new ATOCProjectManager();
\r
65 $activeProjectJson = $myProjectManager->_getProjecDataJson($projectId,$ocAtSettings['atWebPath']);
\r
66 echo $activeProjectJson;
\r
68 // start OC Json class
\r
69 } else if ($action=='getMedia') {
\r
70 echo "Invalid request";
\r
75 // save caption data
\r
77 if ($action=='putCaps' && $projectId != '' && isset($_POST['cc']) && $_POST['cc']!='')
\r
79 $captionData = $_POST['cc'];
\r
81 if(isset($_POST['width']))
\r
83 $theWidth = $_POST['width'];
\r
87 if(isset($_POST['height']))
\r
89 $theHeight = $_POST['height'];
\r
93 $myProjectManager = new ATOCProjectManager();
\r
95 $saveMSG = $myProjectManager->_saveCaptionData($projectId,$captionData,$theWidth,$theHeight);
\r