changed git call from https to git readonly
[atutor.git] / mods / atutor_opencaps / opencaps / include / workflow.php
1 <?php
2 /*
3  * OpenCaps
4  * http://opencaps.atrc.utoronto.ca
5  * 
6  * Copyright 2009 Heidi Hazelton
7  * Adaptive Technology Resource Centre, University of Toronto
8  * 
9  * Licensed under the Educational Community License (ECL), Version 2.0. 
10  * You may not use this file except in compliance with this License.
11  * http://www.opensource.org/licenses/ecl2.php
12  * 
13  */
14
15
16 /*
17  * This file receives a request from the js and processes it using existing classes.
18  * It's the AJAX-request manager. Should it be a class too?
19  * 
20  * everything here should call object functions. no real code here.
21  * 
22  */
23
24 define('INCLUDE_PATH', '');
25 require(INCLUDE_PATH.'vitals.inc.php');
26
27 /* get a project loaded into the system: start new, open existing, load chosen */
28 if ($_GET['task'] == "print_projs") {
29         if (isset($_GET['page']))       
30                 $this_proj->printUserProjects($_GET['page']);
31         else
32                 $this_proj->printUserProjects(1);
33         
34 } else if ($_GET['task'] == "print_projs_remote") {     
35         if (isset($_GET['page']))
36                 $this_system->printProjects($_GET['page']);
37         else
38                 $this_system->printProjects();
39 } else if ($_GET['task'] == "open_proj") {
40         $this_proj->open($_GET['pid']);
41
42 } else if ($_GET['task'] == "open_proj_remote") {
43         $this_proj->openRemote($_GET['pid']);
44         
45 } else if ($_GET['task'] == "proj_delete") {
46         $this_proj->delete($_GET['pid']);
47
48
49
50 /*
51  * load json file into a project
52  */
53 if ($_GET['task'] == 'get_json') {
54         $json_path = '../projects/'.$this_proj->id.'/';
55         echo $stripslashes(@file_get_contents($json_path.'opencaps.json'));
56         
57 /*
58  * save project into json file
59  */     
60 } else if ($_POST['task'] == 'save_json') {
61         $this_proj->saveJson($_POST['json'], $_POST['pid']);    
62         
63 /*
64  * preview - create smil & qttext files based on layout
65  */     
66 } else if ($_GET['task'] == "preview") {
67         $this_proj->preview($_GET['layout']);
68         
69 /* export */    
70 } else if ($_GET['task'] == "export") {
71         $exfile = $this_proj->exportCaption($_GET['format']);
72         export_file($exfile);
73
74 /* start tabs */
75 } else if ($_GET['task'] == "get_tabs") {
76         
77         if (isset($systems)) { 
78                 echo '<ul>';
79                 if(!DISABLE_LOCAL)              
80                         echo '<li id="home"><a href="start.php">Home</a></li>'; 
81                         
82                 if (ACTIVE_SYSTEM)      
83                         echo'<li id="remote-'.ACTIVE_SYSTEM.'"><a href="start_remote.php?r='.ACTIVE_SYSTEM.'">'.$systems[ACTIVE_SYSTEM]['name'].'</a></li>';
84                         
85         /*      foreach ($systems as $key=>$remote) {
86                         echo'<li id="remote-'.$key.'"><a href="start_remote.php?r='.$key.'">'.$remote['name'].'</a></li>';
87                 }
88         */      
89                 echo '</ul>';           
90         }  
91 }
92
93
94 ?>