Fixes bug MDL-8234, "New groups code & AS keyword"
[moodle-pu.git] / mod / lams / list.php
blobfde3fdd0bdd584c9127a7326df4f080548b91a38
1 <?php // $Id$
3 /// send LAMS learning deisgn list as a string seperated by ":" to client
5 include_once("lib.php");
7 $result = lams_get_sequences($USER->username,$courseid);
8 if(is_string($result)){//some exception happened!
9 $auth_exception = "AuthenticateException";
10 $server_not_found_exception = "ServerNotFoundException";
11 if(strpos($result,$auth_exception)){//found AuthenticationException in the error message
12 header("HTTP/1.1 401 Unauthenticated");
13 die;
14 }else if (strpos($result,$server_not_found_exception)){
15 header("HTTP/1.1 417 Expectation Failed");
16 die;
17 }else if ($result=="NOT_SET_UP"){
18 header("HTTP/1.1 402 Setup Required");
19 die;
20 }else{
21 header("HTTP/1.1 502 Bad Gateway");
22 echo $result;
23 die;
26 $list_str = "";
27 foreach($result as $design){
28 $list_str .= $design['sid'].",".$design['workspace'].",".$design['title'].":";
30 if (strlen($list_str)==0){
31 header("HTTP/1.1 504 Gateway Timeout");
32 }else{
33 echo $list_str;