File: list.php

package info (click to toggle)
moodle 1.6.3-2%2Betch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 37,172 kB
  • ctags: 51,688
  • sloc: php: 231,916; sql: 5,631; xml: 2,688; sh: 1,185; perl: 638; makefile: 48; pascal: 36
file content (36 lines) | stat: -rw-r--r-- 1,094 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php // $Id: list.php,v 1.2 2005/11/19 11:08:51 gustav_delius Exp $

/// send LAMS learning deisgn list as a string seperated by ":" to client

include_once("lib.php");

$result = lams_get_sequences($USER->username,$courseid);
if(is_string($result)){//some exception happened!
    $auth_exception = "AuthenticateException";
    $server_not_found_exception = "ServerNotFoundException";
    if(strpos($result,$auth_exception)){//found AuthenticationException in the error message
        header("HTTP/1.1 401 Unauthenticated");
        die;
    }else if (strpos($result,$server_not_found_exception)){
        header("HTTP/1.1 417 Expectation Failed");
        die;
    }else if ($result=="NOT_SET_UP"){
        header("HTTP/1.1 402 Setup Required");
        die;
    }else{
        header("HTTP/1.1 502 Bad Gateway");
        echo $result;
        die;
    }
}
$list_str = "";
foreach($result as $design){
    $list_str .= $design['sid'].",".$design['workspace'].",".$design['title'].":";
}
if (strlen($list_str)==0){
    header("HTTP/1.1 504 Gateway Timeout");
}else{
    echo $list_str;
}

?>