private function getExperiments()
 {
     $weblab_data = $this->getWeblabData();
     $weblab = new WebLabDeusto($weblab_data[0]);
     $sess_id = $weblab->login($weblab_data[1], $weblab_data[2]);
     $experiments = $weblab->list_experiments($sess_id);
     return $experiments;
 }
예제 #2
0
// $weblab = new WebLabDeusto("http://localhost/weblab/", WebLabHttpRequestGateway::$HTTPCLIENT);
//
// Using CURL: support for HTTPS; cookies stored in file: common to
// all requests. If the login cookie expires while another request
// is in process, this request fails
// $weblab = new WebLabDeusto("http://localhost/weblab/", WebLabHttpRequestGateway::$CURL); // additional optional argument: cookiefile
// Using CURL with different cookie file
// $weblab = new WebLabDeusto("http://localhost/weblab/", WebLabHttpRequestGateway::$CURL, "cookiefile");
echo "Using http gateway: " . $weblab->getGatewayName() . "<br/>\n";
$sess_id = $weblab->login("any", "password");
//////////////////////////////////////////////
//
// Ask for the available experiments (with session_id)
// (see "ExperimentPermission")
//
$experiments = $weblab->list_experiments($sess_id);
foreach ($experiments as $experiment) {
    echo "I have permission " . $experiment->name . " of category " . $experiment->category . " during " . $experiment->assigned_time . " seconds <br/>\n";
}
////////////////////////////////////////
//
// Create reservation (still with session_id)
//
$exp_name = "ud-dummy";
$cat_name = "Dummy experiments";
$consumer_data = array("external_user" => "moodle_student1");
$reservation_status = $weblab->reserve($sess_id, $exp_name, $cat_name, "{}", $consumer_data);
var_dump($reservation_status);
// Optional: check the reservation (now with reservation_id)
$reservation_status = $weblab->get_reservation_status($reservation_status->reservation_id);
var_dump($reservation_status);