path2wsdl = $this->limeUrl.$this->wsdl; // $this->user = $user; // $this->pass = $pass; $this->sid = $sid; //print_r(get_declared_classes()); ini_set("allow_url_fopen", 1); $file = fopen($this->path2wsdl,"r"); if(class_exists('SoapClient') && $file!=FALSE) { try { $this->soapClient = new SoapClient($this->path2wsdl, array('soap_version' => SOAP_1_1, 'trace' => 1)); return 1; } catch (SoapFault $fault) { throw new SoapFault($fault->faultcode, $fault->faultstring); } } else { return 0; } } /** * Used in the testclient to show if the SOAP class is available, libXML is there in the minimum version and if the wsdl can be reached * @return HTML String */ public function soapCheck () { $soapCheck ='
'; $return .= $func; $return .= '
'; } } return $return; } /** * Used by testclient to show the Request and Response. This is valuable information for debugging. * @return HTML String */ public function getResponse() { $sOutput .=""
.$this->soapClient->__getLastRequestHeaders()."";
$sOutput .="Dumping request:".htmlentities($this->soapClient->__getLastRequest())."";
$sOutput .=""
.$this->soapClient->__getLastResponseHeaders()."";
$sOutput .="".htmlentities($this->soapClient->__getLastResponse())."";
return $sOutput;
}
/**
* Used to get the available module names for other functions like importQuestion, importGroup, createSurvey and so on
* @param $mode - can be 'core'(surveys), 'mod'(groups) or 'que'(questions)
* @return modules csv
*/
public function getAvailableModules ($mode = 'mod')
{
try
{
return $this->soapClient->sAvailableModules($this->user, $this->pass, $mode);
}
catch (SoapFault $fault)
{
throw new SoapFault($fault->faultcode, $fault->faultstring);
}
}
/**
* Sends a statistic of a particular survey, to the given E-Mail adress
* @param $email - E-Mail adress of the reciever
* @param $type - 'pdf', 'xls' or 'html' is possible... the Format in which the statistic is delivered. pdf and xls will be an attachment
* @param $graph - '0' or '1' ... have only an effect on pdf statistics. If '1' graphs will be embedded in the pdf, '0' will embed no images in the pdf
* @return 'PDF send', 'HTML send, 'XLS send' or throws a SoapFault
*/
public function sendStatistics ( $email, $type = 'pdf', $graph)
{
try
{
$sReturn = $this->soapClient->fSendStatistic($this->user, $this->pass, $this->sid, $email, $type, $graph);
}
catch (SoapFault $fault)
{
throw new SoapFault($fault->faultcode, $fault->faultstring);
}
return $sReturn;
}
/**
* returns the fieldmap of a particular survey
* @return fieldmap as csv
*/
public function getFieldmap()
{
try
{
$sReturn = $this->soapClient->sGetFieldmap($this->user, $this->pass, $this->sid);
}
catch (SoapFault $fault)
{
throw new SoapFault($fault->faultcode, $fault->faultstring);
}
return $sReturn;
}
/**
* sends invitation, reminder or custom Mails to participants in the token list of a particular survey
* @param $type - custom, remind, invite
* @param $maxmails - set the maximum amount of mails to be send in one go. repeat until all mails are send
* @param $subject - set the subject for custom mails
* @param $message - set the message for custom mails
* @return String ('No Mails to send', 'XX Mails send', 'XX Mails send, XX Mails left to send')
*/
public function sendMail( $type, $maxmails, $subject, $message)
{
try
{
$sReturn = $this->soapClient->sSendEmail($this->user, $this->pass, $this->sid, $type, $maxmails, $subject, $message);
}
catch (SoapFault $fault)
{
throw new SoapFault($fault->faultcode, $fault->faultstring);
}
return $sReturn;
}
/**
* deletes a particular survey
* @return String 'Survey XX deleted' or a SoapFault
*/
public function deleteSurvey()
{
try
{
$sReturn = $this->soapClient->sDeleteSurvey($this->user, $this->pass, $this->sid);
}
catch (SoapFault $fault)
{
throw new SoapFault($fault->faultcode, $fault->faultstring);
}
return $sReturn;
}
/**
* imports a Matrix 5scale question. Normally there is a "Matrix5.csv" in directory 'que' which is used for this. But you can use an own exported Matrix 5 question with any other name of course
* @param $title - Question Code
* @param $question - The Question text
* @param $help - Help Text for this question
* @param $items - Items to rate on the 5scale, Comma seperated
* @param $module - optional Parameter, if not given, he tries with Matrix5, which should be OK
* @param $mandatory - optional paramter. If not given, the question will not be mandatory. Use 'Y' to make the question mandatory
* @return String 'OK' or throws a SoapFault
*/
public function importMatrix ($title, $question, $help, $items, $module = "Matrix5", $mandatory='N' )
{
try
{
$sReturn = $this->soapClient->sImportMatrix($this->user, $this->pass, $this->sid, $title, $question, $help, $items, $module, $mandatory);
}
catch (SoapFault $fault)
{
throw new SoapFault($fault->faultcode, $fault->faultstring);
}
return $sReturn;
}
/**
* imports a Freetext Question. Normally there is a "Freitext.csv" in the directory 'que' which is used for this.
* @param $title - Question Code
* @param $question - The Question text
* @param $help - Help Text for this question
* @param $module - optional Parameter, if not given, he tries with 'Freitext', which should be OK
* @param $mandatory - optional paramter. If not given, the question will not be mandatory. Use 'Y' to make the question mandatory
* @return String "OK" or throws SoapFault
*/
public function importFreetext ($title, $question, $help, $module = "Freitext", $mandatory='N' )
{
try
{
$sReturn = $this->soapClient->sImportFreetext($this->user, $this->pass, $this->sid, $title, $question, $module, $mandatory);
}
catch (SoapFault $fault)
{
throw new SoapFault($fault->faultcode, $fault->faultstring);
}
return $sReturn;
}
/**
* Imports a Question in questions directory. Use getAvailableModules('que') to get all available question.csv's to import.
* @param $module - name of the question file, without the filesuffix
* @param $mandatory - optional paramter. If not given, the question will not be mandatory. Use 'Y' to make the question mandatory
* @return String "OK" or throws SoapFault
*/
public function importQuestion ($module, $mandatory='N')
{
try
{
$sReturn = $this->soapClient->sImportQuestion($this->user, $this->pass, $this->sid, $module, $mandatory);
}
catch (SoapFault $fault)
{
throw new SoapFault($fault->faultcode, $fault->faultstring);
}
$sOutput .= "