[Hw4mdl-svn] SF.net SVN: hw4mdl: [242] branches/team/Thomas/integrations_common
Brought to you by:
jhlinder,
trollinger
From: <tro...@us...> - 2008-02-14 23:21:44
|
Revision: 242 http://hw4mdl.svn.sourceforge.net/hw4mdl/?rev=242&view=rev Author: trollinger Date: 2008-02-14 15:21:43 -0800 (Thu, 14 Feb 2008) Log Message: ----------- -add log to the common files -fix a couple of small issues Modified Paths: -------------- branches/team/Thomas/integrations_common/php/common/WimbaLib.php branches/team/Thomas/integrations_common/php/common/WimbaUI.php branches/team/Thomas/integrations_common/php/common/WimbaXml.php branches/team/Thomas/integrations_common/php/lc/lcapi.php branches/team/Thomas/integrations_common/php/vt/VtAction.php branches/team/Thomas/integrations_common/php/vt/WimbaVoicetoolsAPI.php branches/team/Thomas/integrations_common/web/js/verifForm.js Added Paths: ----------- branches/team/Thomas/integrations_common/web/pictures/items/voice_tools.png Modified: branches/team/Thomas/integrations_common/php/common/WimbaLib.php =================================================================== --- branches/team/Thomas/integrations_common/php/common/WimbaLib.php 2008-02-11 21:25:53 UTC (rev 241) +++ branches/team/Thomas/integrations_common/php/common/WimbaLib.php 2008-02-14 23:21:43 UTC (rev 242) @@ -8,6 +8,7 @@ /** * Returns the keys of the general parameters passed by GET or POST */ + function getKeysOfGeneralParameters() { return array( @@ -20,8 +21,8 @@ array("value" => "signature", "type" => PARAM_ALPHANUM, "default_value" => null), array("value" => "product", "type" => PARAM_ALPHA, "default_value" => null), array("value" => "type", "type" => PARAM_ALPHA, "default_value" => null), - array("value" => "studentView", "type" => PARAM_BOOL, "default_value" => null), - array("value" => "createWorkflow", "type" => PARAM_BOOL, "default_value" => null), + array("value" => "studentView", "type" => PARAM_ALPHA, "default_value" => "false"), + array("value" => "createWorkflow", "type" => PARAM_BOOL, "default_value" => false), array("value" => "action", "type" => PARAM_ALPHA, "default_value" => null), array("value" => "resource_id", "type" => PARAM_CLEAN, "default_value" => "0"), array("value" => "error", "type" => PARAM_CLEAN, "default_value" => ""), @@ -54,34 +55,34 @@ function getKeyWimbaVoiceForm() { return array ( - array("value" => "longname", "type" => PARAM_CLEAN, "default_value" => ""), + array("value" => "longname", "type" => PARAM_CLEAN, "default_value" => ""), array("value" => "description", "type" => PARAM_CLEAN, "default_value" => "dd"), - array("value" => "led", "type" => PARAM_ALPHA, "default_value" => "instructor"), + array("value" => "led", "type" => PARAM_ALPHA, "default_value" => "student"), array("value" => "audio_format", "type" => PARAM_CLEAN, "default_value" => "medium"), - array("value" => "max_length", "type" => PARAM_INT, "default_value" => "0"), - array("value" => "delay", "type" => PARAM_INT, "default_value" => "0"), + array("value" => "max_length", "type" => PARAM_INT, "default_value" => "0"), + array("value" => "delay", "type" => PARAM_INT, "default_value" => "0"), - array("value" => "short_title", "type" => PARAM_ALPHA, "default_value" => "false"), - array("value" => "chrono_order", "type" => PARAM_ALPHA, "default_value" => "false"), - array("value" => "show_reply", "type" => PARAM_ALPHA, "default_value" => "false"), - array("value" => "show_forward", "type" => PARAM_ALPHA, "default_value" => "false"), - array("value" => "show_compose", "type" => PARAM_ALPHA, "default_value" => "false"), - array("value" => "filter", "type" => PARAM_ALPHA, "default_value" => "false"), + array("value" => "short_title", "type" => PARAM_ALPHA, "default_value" => "false"), + array("value" => "chrono_order", "type" => PARAM_ALPHA, "default_value" => "false"), + array("value" => "show_reply", "type" => PARAM_ALPHA, "default_value" => "false"), + array("value" => "show_forward", "type" => PARAM_ALPHA, "default_value" => "false"), + array("value" => "show_compose", "type" => PARAM_ALPHA, "default_value" => "false"), + array("value" => "filter", "type" => PARAM_ALPHA, "default_value" => "false"), - array("value" => "accessAvailable", "type" => PARAM_BOOL, "default_value" => "0"), - array("value" => "start_date", "type" => PARAM_ALPHA, "default_value" => "false"), - array("value" => "start_month", "type" => PARAM_ALPHA, "default_value" => "0"), - array("value" => "start_day", "type" => PARAM_ALPHA, "default_value" => "0"), - array("value" => "start_year", "type" => PARAM_ALPHA, "default_value" => "0"), - array("value" => "start_hr", "type" => PARAM_ALPHA, "default_value" => "0"), - array("value" => "start_min", "type" => PARAM_ALPHA, "default_value" => "0"), - array("value" => "end_date", "type" => PARAM_ALPHA, "default_value" => "false"), - array("value" => "end_month", "type" => PARAM_ALPHA, "default_value" => "0"), - array("value" => "end_day", "type" => PARAM_ALPHA, "default_value" => "0"), - array("value" => "end_year", "type" => PARAM_ALPHA, "default_value" => "0"), - array("value" => "end_hr", "type" => PARAM_ALPHA, "default_value" => "0"), - array("value" => "end_min", "type" => PARAM_ALPHA, "default_value" => "0"), + array("value" => "accessAvailable", "type" => PARAM_BOOL, "default_value" => "0"), + array("value" => "start_date", "type" => PARAM_ALPHA, "default_value" => "false"), + array("value" => "start_month", "type" => PARAM_ALPHANUM, "default_value" => "0"), + array("value" => "start_day", "type" => PARAM_ALPHANUM, "default_value" => "0"), + array("value" => "start_year", "type" => PARAM_ALPHANUM, "default_value" => "0"), + array("value" => "start_hr", "type" => PARAM_ALPHANUM, "default_value" => "0"), + array("value" => "start_min", "type" => PARAM_ALPHANUM, "default_value" => "0"), + array("value" => "end_date", "type" => PARAM_ALPHA, "default_value" => "false"), + array("value" => "end_month", "type" => PARAM_ALPHANUM, "default_value" => "0"), + array("value" => "end_day", "type" => PARAM_ALPHANUM, "default_value" => "0"), + array("value" => "end_year", "type" => PARAM_ALPHANUM, "default_value" => "0"), + array("value" => "end_hr", "type" => PARAM_ALPHANUM, "default_value" => "0"), + array("value" => "end_min", "type" => PARAM_ALPHANUM, "default_value" => "0"), ); } @@ -273,6 +274,7 @@ function storeResource($rid,$course_id, $params) { + $voicetools = new Object(); $voicetools->rid = $rid; $voicetools->course = $course_id; @@ -289,7 +291,7 @@ { $start_hr = intval($params["start_hr"]); $start_min = intval($params["start_min"]); - $start_month = intval($params["start_months"]); + $start_month = intval($params["start_month"]); $start_day = intval($params["start_day"]); $start_year = intval($params["start_year"]); $voicetools->start_date = mktime($start_hr, $start_min, 0, $start_month, $start_day, $start_year); @@ -302,7 +304,7 @@ if ($params["end_date"] == "true") { $end_hr = intval($params["end_hr"]); $end_min = intval($params["end_min"]); - $end_month = intval($params["end_months"]); + $end_month = intval($params["end_month"]); $end_day = intval($params["end_day"]); $end_year = intval($params["end_year"]); $voicetools->end_date = mktime($end_hr, $end_min, 0, $end_month, $end_day, $end_year); @@ -327,7 +329,7 @@ { $start_hr = intval($params["start_hr"]); $start_min = intval($params["start_min"]); - $start_month = intval($params["start_months"]); + $start_month = intval($params["start_month"]); $start_day = intval($params["start_day"]); $start_year = intval($params["start_year"]); $voicetools->start_date = mktime($start_hr, $start_min, 0, $start_month, $start_day, $start_year); @@ -340,7 +342,7 @@ if ($params["end_date"] == "true") { $end_hr = intval($params["end_hr"]); $end_min = intval($params["end_min"]); - $end_month = intval($params["end_months"]); + $end_month = intval($params["end_month"]); $end_day = intval($params["end_day"]); $end_year = intval($params["end_year"]); $voicetools->end_date = mktime($end_hr, $end_min, 0, $end_month, $end_day, $end_year); Modified: branches/team/Thomas/integrations_common/php/common/WimbaUI.php =================================================================== --- branches/team/Thomas/integrations_common/php/common/WimbaUI.php 2008-02-11 21:25:53 UTC (rev 241) +++ branches/team/Thomas/integrations_common/php/common/WimbaUI.php 2008-02-14 23:21:43 UTC (rev 242) @@ -526,7 +526,7 @@ "javascript:launchAjaxRequest('getXmlListPanel.php','',true,'all')", "advanced_Ok"); - if ($createWorkflow == "true") + if ($createWorkflow == true) { $this->xml->createValidationButtonElement( get_string("validationElement_cancel", "voicetools"), @@ -556,7 +556,7 @@ $this->xml->createValidationButtonElement( get_string("validationElement_saveAll", "voicetools"), "action", - "javascript:submitForm('manageAction.php','update','" . $this->currentObject->getRid() . "')", + "javascript:submitForm('manageAction.php','update','" . $this->currentObject->getRid() . "','" . $createWorkflow . "')", "setting_Save"); } } @@ -603,15 +603,12 @@ "rows" => "4", "cols" => "30" ); - if ($this->currentObject != null) + $display = ""; + if (isset ($this->currentObject)) { - $parameters["value"] = $this->currentObject->getDescription(); + $display = $this->currentObject->getDescription(); } - else - { - $parameters["value"] = ""; - } - $this->xml->addTextAreaElement($parameters); + $this->xml->addTextAreaElement($parameters,$display); $this->xml->createLinePart(); $this->xml->createLine(); @@ -1625,14 +1622,13 @@ "rows" => "4", "cols" => "30" ); + + $display = ""; if (isset ($this->currentObject)) { - $parameters["value"] = $this->currentObject->getDescription(); + $display = $this->currentObject->getDescription(); } - else{ - $parameters["value"] = ""; - } - $this->xml->addTextAreaElement($parameters); + $this->xml->addTextAreaElement($parameters,$display); $this->xml->createLinePart(); $this->xml->createLine(); @@ -1681,7 +1677,7 @@ $parameters = array ( "type" => "checkbox", - "value" => "instructor", + "value" => "true", "id" => "show_compose", "name" => "show_compose" ); @@ -2072,7 +2068,7 @@ $optionsMonth); } //add space - $this->xml->addSimpleLineElement("space"); + $this->xml->addSimpleLineElement("label", " "); if ($this->currentObjectInformations != null) { $optionsDay = $this->createSelectDay( @@ -2099,7 +2095,7 @@ $optionsDay); } //add space - $this->xml->addSimpleLineElement("space"); + $this->xml->addSimpleLineElement("label", " "); if ($this->currentObjectInformations != null) { $optionsYear = $this->createSelectYear( @@ -2210,8 +2206,18 @@ $this->xml->createLine(); - if ($this->endSelect == false || $this->currentObject == null) + if ($this->currentObjectInformations != null) { + $optionsMonth = $this->createSelectMonth( + $this->endSelect, + date('m', $this->currentObjectInformations->end_date)); + } + else + { + $optionsMonth = $this->createSelectMonth(); + } + if ($this->endSelect == false || $this->currentObject == null) + { $this->xml->createOptionElement( "end_month", "end_month_field", @@ -2223,12 +2229,20 @@ $this->xml->createOptionElement( "end_month", "end_month_field", - $this->createSelectMonth( - $this->endSelect, - date('m', $this->currentObjectInformations->end_date))); + $optionsMonth); } $this->xml->addSimpleLineElement("label", " "); + if ($this->currentObjectInformations != null) + { + $optionsDay = $this->createSelectDay( + $this->endSelect, + date('d', $this->currentObjectInformations->end_date)); + } + else + { + $optionsDay = $this->createSelectDay(); + } if ($this->endSelect == false || $this->currentObject == null) { $this->xml->createOptionElement( @@ -2242,12 +2256,21 @@ $this->xml->createOptionElement( "end_day", "end_day_field", - $this->createSelectDay( - $this->endSelect, - date('d', $this->currentObjectInformations->end_date))); + $optionsDay); + } $this->xml->addSimpleLineElement("label", " "); + if ($this->currentObjectInformations != null) + { + $optionsYear = $this->createSelectYear( + $this->endSelect, + date('Y', $this->currentObjectInformations->end_date)); + } + else + { + $optionsYear = $this->createSelectYear(); + } if ($this->endSelect == false || $this->currentObject == null) { $this->xml->createOptionElement( @@ -2261,12 +2284,21 @@ $this->xml->createOptionElement( "end_year", "end_year_field", - $this->createSelectYear( - $this->endSelect, - date('Y', $this->currentObjectInformations->end_date))); + $optionsYear); + } $this->xml->createLinePart(array ("style" => "date")); + if ($this->currentObjectInformations != null) + { + $optionsHour = $this->createSelectHour( + $this->endSelect, + date('G', $this->currentObjectInformations->end_date)); + } + else + { + $optionsHour = $this->createSelectHour(); + } if ($this->endSelect == false || $this->currentObject == null) { $this->xml->createOptionElement( @@ -2280,12 +2312,21 @@ $this->xml->createOptionElement( "end_hr", "end_hr_field", - $this->createSelectHour( - $this->endSelect, - date('G', $this->currentObjectInformations->end_date))); + $optionsHour); } $this->xml->addSimpleLineElement("label", " "); + if ($this->currentObjectInformations != null) + { + $optionsMinute = $this->createSelectMin( + $this->endSelect, + date('i', $this->currentObjectInformations->end_date)); + } + else + { + $optionsMinute = $this->createSelectMin(); + } + if ($this->endSelect == false || $this->currentObject == null) { $this->xml->createOptionElement( @@ -2299,9 +2340,7 @@ $this->xml->createOptionElement( "end_min", "end_min_field", - $this->createSelectMin( - $this->endSelect, - date('i', $this->currentObjectInformations->end_date))); + $optionsMinute); } $this->xml->createLinePart(); @@ -2748,6 +2787,7 @@ $allVt = array (); $list = voicetools_get_voicetools_list($this->session->hparams["course_id"]); $vtResources = voicetools_api_get_resources($list["rid"]); + if ($vtResources == null) { return null; Modified: branches/team/Thomas/integrations_common/php/common/WimbaXml.php =================================================================== --- branches/team/Thomas/integrations_common/php/common/WimbaXml.php 2008-02-11 21:25:53 UTC (rev 241) +++ branches/team/Thomas/integrations_common/php/common/WimbaXml.php 2008-02-14 23:21:43 UTC (rev 242) @@ -484,9 +484,9 @@ * Add a new textarea element * @param parameters : array of attributes ( Key = name of the attribute, Value = value of the attribute) */ - function addTextAreaElement($parameters=NULL) + function addTextAreaElement($parameters=NULL,$display) { - $this->addSimpleLineElement("textarea","",$parameters); + $this->addSimpleLineElement("textarea",$display,$parameters); } function addDivLineElement($type, $displayContext,$parameters) Modified: branches/team/Thomas/integrations_common/php/lc/lcapi.php =================================================================== --- branches/team/Thomas/integrations_common/php/lc/lcapi.php 2008-02-11 21:25:53 UTC (rev 241) +++ branches/team/Thomas/integrations_common/php/lc/lcapi.php 2008-02-14 23:21:43 UTC (rev 242) @@ -175,7 +175,7 @@ if (!isset ($this->_lcapi_config)) { // $this->lcapi_error(self::LCAPI_ENOCONF); - error_log(__FUNCTION__ . ": LCAPI not configured in " . print_r(debug_backtrace(), true)); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": LCAPI not configured in " . print_r(debug_backtrace(), true)); return false; } $url = $this->_lcapi_config->server . LCAPI_COMMAND . LCAPI_FUNCTION_NOOP . "&AuthType=AuthCookieHandler" . "&AuthName=Horizon" . "&credential_0=" . $this->_lcapi_config->login . "&credential_1=" . $this->_lcapi_config->password; @@ -190,24 +190,21 @@ curl_setopt($ch, CURLOPT_TIMEOUT, 4); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": executing request: " . $url); - } - + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": executing request: " . $url); $data = curl_exec($ch); if (curl_errno($ch)) { $this->lcapi_error(LCAPI_EADDR); - error_log("HTTP Request failed: " . curl_error($ch)); + wimba_add_error(WIMBA_ERROR,WC,"HTTP Request failed: " . curl_error($ch)); return false; } preg_match("(\d*)", $data, $matches); $resp_code = $matches[0]; if ($resp_code == 204) { $this->lcapi_error(LCAPI_EAUTH); - error_log(__FUNCTION__ . ": Authentication failed (204)"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Authentication failed (204)"); return false; } else @@ -215,15 +212,13 @@ if ($resp_code != 100 && $resp_code != 301) { $this->lcapi_error(LCAPI_EAUTH); - error_log(__FUNCTION__ . ": Authentication Failed: $resp_code"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Authentication Failed: $resp_code"); return false; } } curl_close($ch); - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": Authentication successful"); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": Authentication successful"); return $ch; } @@ -242,7 +237,7 @@ if (!isset ($this->_lcapi_config)) { // $this->lcapi_error(self::LCAPI_ENOCONF); - error_log(__FUNCTION__ . ": LCAPI not configured in " . print_r(debug_backtrace(), true)); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": LCAPI not configured in " . print_r(debug_backtrace(), true)); return false; } // $this->cookie_tstamp = $this->_lcapi_config->tmppath.self::LCAPI_COOKIE_TSTAMP; //Open the temp file to check the last modification date @@ -253,18 +248,14 @@ // $this->tstamp = time(); // echo $tstamp; // } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": cookie timestamp:" . $this->tstamp); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": cookie timestamp:" . $this->tstamp); $this->valid = $this->tstamp + LCAPI_DELAY; // 1800 seconds = 30 minutes if ((!file_exists($this->cookie_file)) || time() > $this->valid) { - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": Timestamp too old (tstamp: $tstamp, valid: $valid), re-auth necessary."); - } + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": Timestamp too old (tstamp: $tstamp, valid: $valid), re-auth necessary."); + if (!$ch = $this->lcapi_authenticate()) { return false; @@ -281,22 +272,18 @@ curl_setopt($ch, CURLOPT_COOKIEJAR, $this->cookie_file); curl_setopt($ch, CURLOPT_COOKIEFILE, $this->cookie_file); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": executing request: " . $url); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": executing request: " . $url); $response = curl_exec($ch); if (curl_errno($ch)) { $this->lcapi_error(LCAPI_ECURL); - error_log("Curl error: " . curl_error($ch)); + wimba_add_error(WIMBA_ERROR,WC,"Curl error: " . curl_error($ch)); return false; } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": Request Returned: " . $response); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": Request Returned: " . $response); return $response; } /** @@ -317,24 +304,21 @@ if ($lc_respcode == 301) { $this->lcapi_error(LCAPI_EEXIST); - if (LCAPI_DEBUG) - { - error_log("User ($this->prefix.$userid, $firstname, $lastname) already exist, not created."); - } + + wimba_add_error(WIMBA_DEBUG,WC,"User ($this->prefix.$userid, $firstname, $lastname) already exist, not created."); return false; } if ($lc_respcode != 100) { $this->lcapi_error(LCAPI_ECRUD); - error_log(__FUNCTION__ . ": User Creation Failed for ($this->prefix.$userid, $firstname, $lastname) with $lc_respcode"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": User Creation Failed for ($this->prefix.$userid, $firstname, $lastname) with $lc_respcode"); return false; } - if (LCAPI_DEBUG) - { - error_log("User ($this->prefix.$userid, $firstname, $lastname) created."); - } + + wimba_add_error(WIMBA_DEBUG,WC,"User ($this->prefix.$userid, $firstname, $lastname) created."); return true; } + /** * Returns a session id (hzA) to be inserted in URLs to access the LC server * @@ -355,7 +339,7 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_ENOSESN); - error_log(__FUNCTION__ . ": Cannot Create Session ($respcode)."); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Cannot Create Session ($respcode)."); return false; } $currentline = strtok($response, "\n"); @@ -366,20 +350,18 @@ if (empty ($currentline)) { $this->lcapi_error(LCAPI_ENOSESN); - error_log(__FUNCTION__ . ": Session was returned with good code, but session not available ($enc_params => $response)"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Session was returned with good code, but session not available ($enc_params => $response)"); return false; } $authtoken = substr($currentline, 10); if (empty ($authtoken)) { $this->lcapi_error(LCAPI_ENOSESN); - error_log(__FUNCTION__ . ": Token empty, response: $response"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Token empty, response: $response"); return false; } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": Auth OK (hzA=$authtoken)"); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": Auth OK (hzA=$authtoken)"); return $authtoken; } /** @@ -405,10 +387,6 @@ */ function lcapi_create_class($roomid, $roomname, $attributes) { - if (LCAPI_DEBUG) - { - // error_log(__FUNCTION__ . ": invoked with:". $this->prefix.$roomid, $roomname, " . print_r($attributes, TRUE)); - } $params = ''; $this->lcapi_check_room_params($attributes); while (list ($key, $val) = each($attributes)) @@ -427,19 +405,17 @@ if ($respcode == 301) { $this->lcapi_error(LCAPI_EEXIST); - error_log(__FUNCTION__ . ": Class ($roomid, $roomname) already exist, not created"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Class ($roomid, $roomname) already exist, not created"); return false; } if ($respcode != 100) { $this->lcapi_error(LCAPI_ECRUD); - error_log(__FUNCTION__ . ": Cannot Create Class with id : $roomid, and name : $roomname."); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Cannot Create Class with id : $roomid, and name : $roomname."); return false; } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": Class ($roomid, $roomname) created with success."); - } + + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Class ($roomid, $roomname) created with success."); return true; } /** @@ -461,13 +437,11 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_ECRUD); - error_log(__FUNCTION__ . ": Cannot Add Role $role to userid $userid in Class with id:$roomid"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Cannot Add Role $role to userid $userid in Class with id:$roomid"); return false; } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": Role $role added for $userid in Class $roomid"); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": Role $role added for $userid in Class $roomid"); return true; } /** @@ -490,13 +464,11 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_ECRUD); - error_log(__FUNCTION__ . ": Cannot Removed Role $role from userid $this->prefix.$userid in Class with id:" . $roomid); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Cannot Removed Role $role from userid $this->prefix.$userid in Class with id:" . $roomid); return false; } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": Role $role removed from $userid in Class $roomid"); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": Role $role removed from $userid in Class $roomid"); return true; } /** @@ -513,7 +485,7 @@ if ($respcode == 302) { $this->lcapi_error(LCAPI_ECRUD); - error_log(__FUNCTION__ . ": $roomid suppression failed"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": $roomid suppression failed"); return false; } else @@ -521,14 +493,12 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_ECRUD); - error_log(__FUNCTION__ . ": $roomid suppression failed for an unknown reason (response: $response)"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": $roomid suppression failed for an unknown reason (response: $response)"); return false; } } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": $roomid deleted successfully."); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": $roomid deleted successfully."); return true; } /** @@ -556,13 +526,11 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_CRUD); - error_log(__FUNCTION__ . ": Room modification failed ($roomid): $response"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Room modification failed ($roomid): $response"); return false; } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . "$roomid has been modified with success"); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . "$roomid has been modified with success"); return true; } /** @@ -576,10 +544,7 @@ function lcapi_get_archives($userid, $roomid = '') { $result = $this->lcapi_get_rooms($this->prefix . $userid, $this->prefix . $roomid, 1); - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": returning archives for '$this->prefix.$userid' and '$this->prefix.$roomid': " . print_r($result, true)); - } + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": returning archives for '$this->prefix.$userid' and '$this->prefix.$roomid': " . print_r($result, true)); return $result; } /** @@ -603,7 +568,7 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_ECRUD); - error_log(__FUNCTION__ . ": List of room query failed"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": List of room query failed"); return false; } list (, $body) = explode("\n", $response, 2); @@ -631,10 +596,8 @@ $rooms[] = $room; } } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": retrieved Rooms for $userid and roomid '$roomid': " . print_r($rooms, true)); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": retrieved Rooms for $userid and roomid '$roomid': " . print_r($rooms, true)); return $rooms; } /** @@ -670,14 +633,14 @@ $response = $this->lcapi_send_query(LCAPI_FUNCTION_LIST_USER, $request); if (LCAPI_DEBUG) { - error_log(__FUNCTION__ . ": request '$request', response: $response"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": request '$request', response: $response"); } preg_match("(\d*)", $response, $matches); $respcode = $matches[0]; if ($respcode != 100) { $this->lcapi_error(LCAPI_EQRY); - error_log(__FUNCTION__ . ": Unable to query the server. request: '$request', response: '$response'"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Unable to query the server. request: '$request', response: '$response'"); return false; } list (, $body) = explode("\n", $response, 2); @@ -705,12 +668,11 @@ $answers[$answer[ LCAPI_ATTR_USERID]] = $answer; } } - if (LCAPI_DEBUG) { - error_log(__FUNCTION__ . ": returning answers: " . print_r($answers, true)); - } + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": returning answers: " . print_r($answers, true)); return $answer; } + /** * Give the role of the user on a given room * @@ -724,7 +686,9 @@ { $userid = $this->prefix . $userid; } - $params = "&attribute=" . LCAPI_ATTR_ROLEID . "&filter01=" . LCAPI_ATTR_USERID . "&filter01value=" . $userid . "&filter02=" . LCAPI_ATTR_OBJECTID . "&filter02value=" . $this->prefix . $roomid; + $params = "&attribute=" . LCAPI_ATTR_ROLEID . "&filter01=" . LCAPI_ATTR_USERID . + "&filter01value=" . $userid . "&filter02=" . LCAPI_ATTR_OBJECTID . + "&filter02value=" . $this->prefix . $roomid; $response = $this->lcapi_send_query(LCAPI_FUNCTION_LIST_ROLE, $params); preg_match("(\d*)", $response, $matches); @@ -732,7 +696,7 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_EQRY); - error_log(__FUNCTION__ . ": request '$params', response: $reponse"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": request '$params', response: $reponse"); return false; } // Some dichotomy to retreive the role name @@ -740,12 +704,11 @@ $records = explode(LCAPI_RECORD_SEPERATOR, $body); $result = explode(LCAPI_ATTR_ROLEID . "=", $records[0]); $result = explode("\n", $result[1]); - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": returning answer: " . $result[0]); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": returning answer: " . $result[0]); return $result[0]; } + /** * Check if the room is an archive * @@ -761,13 +724,14 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_EQRY); - error_log(__FUNCTION__ . ": Cannot perform query: $params, reponse: $response"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Cannot perform query: $params, reponse: $response"); return false; } list (, $body) = explode("\n", $response, 2); $records = explode(LCAPI_RECORD_SEPARATOR, $body); return (count($records) > 1); } + /** * Give the name of the room given * @@ -783,7 +747,7 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_EQRY); - error_log(__FUNCTION__ . ": cannot retrieve the room name"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": cannot retrieve the room name"); return false; } list (, $body) = explode("\n", $response, 2); @@ -794,19 +758,15 @@ list ($key, $value) = explode("=", $line); if ($key == LCAPI_ATTR_LONGNAME) { - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": $this->prefix.$roomid's room name is $value"); - } + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": $this->prefix.$roomid's room name is $value"); return $value; } } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": did not find name of room: $roomid"); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": did not find name of room: $roomid"); return false; } + /** * Give the media type of the room given * @@ -822,7 +782,7 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_EQRY); - error_log(__FUNCTION__ . ": Cannot query the media type of $roomid"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Cannot query the media type of $roomid"); return false; } list (, $body) = explode("\n", $response, 2); @@ -833,16 +793,11 @@ list ($key, $value) = explode("=", $line); if ($key == LCAPI_ATTR_MEDIATYPE) { - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": $roomid's media type is $value"); - } + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": $roomid's media type is $value"); return $value; } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": did not find media type for $roomid"); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": did not find media type for $roomid"); return false; } } @@ -863,7 +818,7 @@ if ($respcode != 100) { // $this->lcapi_error(self::LCAPIEQRY); - error_log(__FUNCTION__ . ": cannot query room info for $roomid"); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": cannot query room info for $roomid"); return false; } list (, $body) = explode("\n", $response, 2); @@ -877,14 +832,14 @@ $roominfo[$key] = $value; } } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": returning room info for $roomid: " . print_r($roominfo, true)); - } + $room = new LCRoom(); - $room->setByRecord($roominfo, $this->prefix); + $room->setByRecord($roominfo, $this->prefix);. + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": returning room info for $roomid: " . print_r($roominfo, true)); return $room; } + /** * Returns status information from the server * @@ -898,7 +853,7 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_EQRY); - error_log(__FUNCTION__ . ": Query failed: " . $response); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Query failed: " . $response); return false; } list (, $body) = explode("\n", $response, 2); @@ -909,12 +864,11 @@ list ($key, $value) = explode("=", $line); $answer[trim($key)] = trim($value); } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": returning server status: " . print_r($answer, true)); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": returning server status: " . print_r($answer, true)); return $answer; } + /** * Returns the system configuration * @@ -928,7 +882,7 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_EQRY); - error_log(__FUNCTION__ . ": Query failed: " . $response); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Query failed: " . $response); return false; } list (, $body) = explode("\n", $response, 2); @@ -940,12 +894,11 @@ list (, $value) = explode("=", $lines[1], 2); $answers[trim($key)] = trim($value); } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": returning server config: " . print_r($answers, true)); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": returning server config: " . print_r($answers, true)); return $answers; } + function lcapi_get_simulcast() { $response = $this->lcapi_send_query(LCAPI_FUNCTION_LIST_SIMULCAST, ''); @@ -954,7 +907,7 @@ if ($respcode != 100) { $this->lcapi_error(LCAPI_EQRY); - error_log(__FUNCTION__ . ": Query failed: " . $response); + wimba_add_error(WIMBA_ERROR,WC,__FUNCTION__ . ": Query failed: " . $response); return false; } list (, $body) = explode("\n", $response, 2); @@ -966,10 +919,8 @@ list (, $value) = explode("=", $lines[1], 2); $answers[trim($key)] = trim($value); } - if (LCAPI_DEBUG) - { - error_log(__FUNCTION__ . ": returning server config: " . print_r($answers, true)); - } + + wimba_add_error(WIMBA_DEBUG,WC,__FUNCTION__ . ": returning server config: " . print_r($answers, true)); return $answers; } } Modified: branches/team/Thomas/integrations_common/php/vt/VtAction.php =================================================================== --- branches/team/Thomas/integrations_common/php/vt/VtAction.php 2008-02-11 21:25:53 UTC (rev 241) +++ branches/team/Thomas/integrations_common/php/vt/VtAction.php 2008-02-14 23:21:43 UTC (rev 242) @@ -31,7 +31,7 @@ { $ressource->setTitle(stripslashes($this->params["longname"])); } - + if ($this->params["led"] == "student") { $options->setFilter("false"); @@ -59,10 +59,7 @@ //create the resource on the vt server $result = voicetools_api_create_resource($ressource->getResource()); - if (VTAPI_DEBUG) - { - error_log (__FUNCTION__ ." : Board Created , rid=".$result->getRid(), TRUE); - } + return $result; } @@ -128,13 +125,14 @@ $audio = new vtAudioFormat(NULL); $options = new VtOptions(NULL); // Info - $ressource->setType("presentation"); //Voice Baord + $ressource->setType("presentation"); //Voice Presentation if (isset($this->params["description"])) { $ressource->setDescription(stripslashes($this->params["description"])); } - if (isset($this->params["longname"])) { + if (isset($this->params["longname"])) + { $ressource->setTitle(stripslashes($this->params["longname"])); } Modified: branches/team/Thomas/integrations_common/php/vt/WimbaVoicetoolsAPI.php =================================================================== --- branches/team/Thomas/integrations_common/php/vt/WimbaVoicetoolsAPI.php 2008-02-11 21:25:53 UTC (rev 241) +++ branches/team/Thomas/integrations_common/php/vt/WimbaVoicetoolsAPI.php 2008-02-14 23:21:43 UTC (rev 242) @@ -1,44 +1,39 @@ -<?PHP -/****************************************************************************** -* * -* Copyright (c) 1999-2006 Horizon Wimba, All Rights Reserved. * -* * -* COPYRIGHT: * -* This software is the property of Horizon Wimba. * -* You can redistribute it and/or modify it under the terms of * -* the GNU General Public License as published by the * -* Free Software Foundation. * -* * -* WARRANTIES: * -* This software is distributed in the hope that it will be useful, * -* but WITHOUT ANY WARRANTY; without even the implied warranty of * -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * -* GNU General Public License for more details. * -* * -* You should have received a copy of the GNU General Public License * -* along with the Horizon Wimba Moodle Integration; * -* if not, write to the Free Software Foundation, Inc., * -* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * -* * -* Author: Hugues Pisapia * -* * -* Date: 15th April 2006 * -* * -******************************************************************************/ +<?php +/** + * Copyright (c) 1999-2006 Horizon Wimba, All Rights Reserved. * + * + * COPYRIGHT: * + * This software is the property of Horizon Wimba. * + * You can redistribute it and/or modify it under the terms of * + * the GNU General Public License as published by the * + * Free Software Foundation. * + * + * WARRANTIES: * + * This software is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * + * You should have received a copy of the GNU General Public License * + * along with the Horizon Wimba Moodle Integration; * + * if not, write to the Free Software Foundation, Inc., * + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * + * + * Author: Hugues Pisapia * + * + * Date: 15th April 2006 * + */ /* $Id: WimbaVoicetoolsAPI.php 50661 2007-06-28 20:33:11Z thomasr $ */ -error_reporting(E_ALL); +error_reporting(E_ALL); global $CFG; -//WebService Client. -require_once($CFG->libdir.'/soap/nusoap.php'); +// WebService Client. +require_once($CFG->libdir . '/soap/nusoap.php'); require_once("WimbaVoicetools.php"); - -define("VTAPI_DEBUG", false);//for the log - -/// Library of functions and constants for the voicetool API - +define("VTAPI_DEBUG", false); //for the log +// / Library of functions and constants for the voicetool API // Resources define("VT_API_VBOARD", 'board'); define("VT_API_VMAIL", 'vmail'); @@ -46,7 +41,6 @@ define("VT_API_VRECORDER", 'recorder'); define("VT_API_VPRESENTATION", 'presentation'); define("VT_API_PODCASTER", 'pc'); - // Qudio Qualities define("VT_API_QUALITY_BASIC", 'spx_8_q3'); define("VT_API_QUALITY_STANDARD", 'spx_16_q4'); @@ -55,7 +49,6 @@ // API calls define("VT_API_SERVICES", '/services/Broker?wsdl'); - define("VT_API_CREATE_RESOURCE", 'createResource'); define("VT_API_MODIFY_RESOURCE", 'modifyResource'); define("VT_API_DELETE_RESOURCE", 'deleteResource'); @@ -69,583 +62,601 @@ define("VT_API_GET_AUDIO", 'getAudio'); define("VT_API_AUDIO_EXISTS", 'audioExists'); define("VT_API_GET_VERSION", 'getVersion'); - -// Voice Tools Module Tables +// Voice Tools Module Tables define("VT_API_ACTIVITY", 'voicetools_activity'); define("VT_API_INSTANCE", 'voicetools_instance'); -set_time_limit(30); /** -* Send an SDK request to the VT server to create the resource. -* @uses CFG -* @uses VT_API_SERVICES -* @uses VT_API_CREATE_RESOURCE -* @param $resource_data - the resource to create -* @return - the object returned by the call, or false if something goes wrong -*/ -function voicetools_api_create_resource ($resource_data) { - global $CFG; + * Send an SDK request to the VT server to create the resource. + * + * @uses CFG + * @uses VT_API_SERVICES + * @uses VT_API_CREATE_RESOURCE + * @param $resource_data - the resource to create + * @return - the object returned by the call, or false if something goes wrong + */ +function voicetools_api_create_resource ($resource_data) +{ + global $CFG; + // Set the WebService URL + $soapclient = new soap_client($CFG->voicetools_servername . VT_API_SERVICES, true); + $err = $soapclient->getError(); + if ($err) + { + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . ' : Error to create the soap element : ' . $err); + return null; + } + // Set the parameters to send to the WebService + $resourceArray = array ($CFG->voicetools_adminusername, $CFG->voicetools_adminpassword, $resource_data); + // Call the WebService and store its result in $result. + $result = $soapclient->call(VT_API_CREATE_RESOURCE, $resourceArray); - // Set the WebService URL - $soapclient = new soap_client($CFG->voicetools_servername.VT_API_SERVICES,true); - $err = $soapclient->getError(); - if ($err) - { - error_log (__FUNCTION__ .' : Error to create the soap element : ' .$err, TRUE); - return NULL; - } - // Set the parameters to send to the WebService - $resourceArray = array ($CFG->voicetools_adminusername,$CFG->voicetools_adminpassword,$resource_data); + if ($soapclient->fault) + { + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . ' : Fault with the web service : ' . $soapclient->fault); + return null; + } + else + { + // Check for errors + $err = $soapclient->getError(); + if ($err) + { + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . ' : error with the web service : ' . $err); + return null; + } + } + $resource = new vtResource($result); - // Call the WebService and store its result in $result. - $result = $soapclient->call(VT_API_CREATE_RESOURCE, $resourceArray); + if ($resource->error == "error") + { + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . " : Resource not created because " . $resource->error_message); + } + + wimba_add_log (WIMBA_DEBUG, WV, __FUNCTION__ . " : Resource Created"); + return $resource; +} - if ($soapclient->fault) { - error_log (__FUNCTION__ .' : Fault with the web service : ' . $soapclient->fault , TRUE); - return NULL; - } - else - { - // Check for errors +/** + * Send an SDK request to the VT server to create the resource. + * + * @uses CFG + * @uses VT_API_SERVICES + * @uses VT_API_MODIFY_RESOURCE + * @param $resource_data - the resource to create + * @return - the object returned by the call, or false if something goes wrong + */ +function voicetools_api_modify_resource ($resource_data) +{ + global $CFG; + + $soapclient = new soap_client($CFG->voicetools_servername . VT_API_SERVICES, true); $err = $soapclient->getError(); if ($err) { - // Display the error - error_log (__FUNCTION__ .' : error with the web service : ' . $err , TRUE); - return NULL; - } - } - $resource=new vtResource($result); + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . ' : Error to create the soap element : ' . $err); + return null; + } + $resourceArray = array ($CFG->voicetools_adminusername, $CFG->voicetools_adminpassword, $resource_data); - if($resource->error=="error") - { - error_log (__FUNCTION__ ." : Resource not created because ".$resource->error_message, TRUE); - - } - if(VTAPI_DEBUG) - { - error_log (__FUNCTION__ ." : Resource Created", TRUE); - } - return $resource; -} + $result = $soapclient->call(VT_API_MODIFY_RESOURCE, $resourceArray); -/** -* Send an SDK request to the VT server to create the resource. -* @uses CFG -* @uses VT_API_SERVICES -* @uses VT_API_MODIFY_RESOURCE -* @param $resource_data - the resource to create -* @return - the object returned by the call, or false if something goes wrong -*/ -function voicetools_api_modify_resource ($resource_data) { - global $CFG; + if ($soapclient->fault) + { + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . ' : Fault with the web service : ' . $soapclient->fault); + return null; + } + else + { + // Check for errors + $err = $soapclient->getError(); + if ($err) { + // Display the error + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . ' : error with the web service : ' . $err); + return null; + } + } - $soapclient = new soap_client($CFG->voicetools_servername.VT_API_SERVICES,true); - $err = $soapclient->getError(); - if ($err) - { - error_log (__FUNCTION__ .' : Error to create the soap element : ' .$err, TRUE); - return NULL; - } - $resourceArray = array ($CFG->voicetools_adminusername,$CFG->voicetools_adminpassword,$resource_data); + $resource = new vtResource($result); - $result = $soapclient->call(VT_API_MODIFY_RESOURCE, $resourceArray); + if ($resource->error == "error") + { + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . " : Resource not modified because " . $resource->error_message); + return null; + } + + wimba_add_log (WIMBA_DEBUG, WV, __FUNCTION__ . " : Resource Modified"); + return $resource; +} - if ($soapclient->fault) { - error_log (__FUNCTION__ .' : Fault with the web service : ' . $soapclient->fault , TRUE); - return NULL; - } - else - { - // Check for errors +// To CHECK !!! +function voicetools_api_message_exists ($rid, $mid) +{ + global $CFG; + + $soapclient = new soap_client($CFG->voicetools_servername . VT_API_SERVICES, true); $err = $soapclient->getError(); if ($err) { - // Display the error - error_log (__FUNCTION__ .' : error with the web service : ' . $err , TRUE); - return NULL; - } - } + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . ' : Error to create the soap element : ' . $err); + return null; + } + $resource = array ($CFG->voicetools_adminusername, $CFG->voicetools_adminpassword, $rid, $mid); - $resource=new vtResource($result); + $result = $soapclient->call(VT_API_MESSAGE_EXISTS, $resource); - if($resource->error=="error") - { - error_log (__FUNCTION__ ." : Resource not modified because ".$resource->error_message, TRUE); - return NULL; - } - if(VTAPI_DEBUG) - { - error_log (__FUNCTION__ ." : Resource Modified", TRUE); - } - return $resource; -} + if ($soapclient->fault) + { + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . ' : Fault with the web service : ' . $soapclient->fault); + return null; + } + else + { + // Check for errors + $err = $soapclient->getError(); + if ($err) + { + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . ' : error with the web service : ' . $err); + return null; + } + } -// To CHECK !!! -function voicetools_api_message_exists ($rid, $mid) { + $res = false; + foreach ($result['values'] as $item) + { + if ($item['name'] == 'exists') + { + $res = $item['value']; + } + } + return $res; +} - global $CFG; +/** + * Send an SDK request to the VT server to delete a resource. + * + * @uses CFG + * @uses VT_API_SERVICES + * @uses VT_API_DELETE_RESOURCE + * @param $rid - the rid of the resource to delete + * @return - the object returned by the call, or false if something goes wrong + */ +function voicetools_api_delete_resource ($rid) +{ + global $CFG; - $soapclient = new soap_client($CFG->voicetools_servername.VT_API_SERVICES,true); - $err = $soapclient->getError(); - if ($err) - { - error_log (__FUNCTION__ .' : Error to create the soap element : ' .$err, TRUE); - return NULL; - } - $resource = array ($CFG->voicetools_adminusername,$CFG->voicetools_adminpassword,$rid,$mid); - - - $result = $soapclient->call(VT_API_MESSAGE_EXISTS, $resource); - - if ($soapclient->fault) { - error_log (__FUNCTION__ .' : Fault with the web service : ' . $soapclient->fault , TRUE); - return NULL; - } - else - { - // Check for errors + $soapclient = new soap_client($CFG->voicetools_servername . VT_API_SERVICES, true); $err = $soapclient->getError(); if ($err) { - // Display the error - error_log (__FUNCTION__ .' : error with the web service : ' . $err , TRUE); - return NULL; - } - } + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . ' : Error to create the soap element : ' . $err); + return null; + } + $resource = array ($CFG->voicetools_adminusername, $CFG->voicetools_adminpassword, $rid); - $res=false; - foreach ($result['values'] as $item) - { - if ($item['name'] == 'exists') + $result = $soapclient->call(VT_API_DELETE_RESOURCE, $resource); + + if ($soapclient->fault) { - $res = $item['value']; - } - } - return $res; - //return $result; -} + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . ' : Fault with the web service : ' . $soapclient->fault); + return null; + } + else + { + // Check for errors + $err = $soapclient->getError(); + if ($err) + { + // Display the error + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . ' : error with the web service : ' . $err); + return null; + } + } -/** -* Send an SDK request to the VT server to delete a resource. -* @uses CFG -* @uses VT_API_SERVICES -* @uses VT_API_DELETE_RESOURCE -* @param $rid - the rid of the resource to delete -* @return - the object returned by the call, or false if something goes wrong -*/ -function voicetools_api_delete_resource ($rid) { - global $CFG; + $resource = new vtResource($result); - $soapclient = new soap_client($CFG->voicetools_servername.VT_API_SERVICES,true); - $err = $soapclient->getError(); - if ($err) - { - error_log (__FUNCTION__ .' : Error to create the soap element : ' .$err, TRUE); - return NULL; - } - $resource = array ($CFG->voicetools_adminusername,$CFG->voicetools_adminpassword,$rid); + if ($resource->error == "error") + { + wimba_add_log (WIMBA_ERROR, WV, __FUNCTION__ . " : Resource not deleted because " . $resource->error_message); + } - $result = $soapclient->call(VT_API_DELETE_RESOURCE, $resource); + wimba_add_log (WIMBA_DEBUG, WV, __FUNCTION__ . " : Resource Deleted"); + return $resource; +} - if ($soapclient->fault) { - error_log (__FUNCTION__ .' : Fault with the web service : ' . $soapclient->fault , TRUE); - return NULL; - } - else - { - // Check for errors +/** + * Send an SDK request to the VT server to test if the resource exist. + * + * @uses CFG + * @uses VT_API_SERVICES + * @uses VT_API_RESOURCE_EXISTS + * @param $rid - the rid of the resource to find + * @return - a boolean. true if the resource exist, false elsewhere. + */ +function voicetools_api_resource_exists ($rid) +{ + global $CFG; + + $soapclient = new soap_client($CFG->voicetools_servername . VT_API_SERVICES, true); $err = $soa... [truncated message content] |