• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

webservice/soap/classes/class.ilSoapUtils.php

Go to the documentation of this file.
00001 <?php
00002   /*
00003    +-----------------------------------------------------------------------------+
00004    | ILIAS open source                                                           |
00005    +-----------------------------------------------------------------------------+
00006    | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007    |                                                                             |
00008    | This program is free software; you can redistribute it and/or               |
00009    | modify it under the terms of the GNU General Public License                 |
00010    | as published by the Free Software Foundation; either version 2              |
00011    | of the License, or (at your option) any later version.                      |
00012    |                                                                             |
00013    | This program is distributed in the hope that it will be useful,             |
00014    | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016    | GNU General Public License for more details.                                |
00017    |                                                                             |
00018    | You should have received a copy of the GNU General Public License           |
00019    | along with this program; if not, write to the Free Software                 |
00020    | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021    +-----------------------------------------------------------------------------+
00022   */
00023 
00024 
00033 include_once './webservice/soap/classes/class.ilSoapAdministration.php';
00034 
00035 class ilSoapUtils extends ilSoapAdministration
00036 {
00037         function ilSoapUtils()
00038         {
00039                 parent::ilSoapAdministration();
00040         }
00041 
00042         function ignoreUserAbort()
00043         {
00044                 ignore_user_abort();
00045         }
00046 
00047         function disableSOAPCheck()
00048         {
00049                 $this->sauth->disableSOAPCheck();
00050         }
00051 
00052         function sendMail($sid,$to,$cc,$bcc,$sender,$subject,$message,$attach)
00053         {
00054                 if(!$this->__checkSession($sid))
00055                 {
00056                         return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
00057                 }                       
00058 
00059                 // Include main header
00060                 include_once './include/inc.header.php';
00061                 
00062 
00063                 include_once './classes/class.ilMimeMail.php';
00064 
00065                 $mmail = new ilMimeMail();
00066                 $mmail->autoCheck(false);
00067                 $mmail->From($sender);
00068                 $mmail->To(explode(',',$to));
00069                 $mmail->Subject($subject);
00070                 $mmail->Body($message);
00071 
00072                 if($cc)
00073                 {
00074                         $mmail->Cc(explode(',',$cc));
00075                 }
00076 
00077                 if($bcc)
00078                 {
00079                         $mmail->Bcc(explode(',',$bcc));
00080                 }
00081                 if($attach)
00082                 {
00083                         $attachments = explode(',',$attach);
00084                         foreach ($attachments as $attachment)
00085                         {
00086                                 $mmail->Attach($attachment);
00087                         }
00088                 }
00089 
00090                 $mmail->Send();
00091                 $ilLog->write('SOAP: sendMail(): '.$to.', '.$cc.', '.$bcc);
00092 
00093                 return true;
00094         }
00095         function saveQuestionResult($sid,$user_id,$test_id,$question_id,$pass,$solution)
00096         {
00097                 if(!$this->__checkSession($sid))
00098                 {
00099                         return $this->__raiseError($this->sauth->getMessage(),$this->sauth->getMessageCode());
00100                 }                       
00101 
00102                 // Include main header
00103                 include_once './include/inc.header.php';
00104                 $ilDB = $GLOBALS['ilDB'];
00105                 for($i = 0; $i < count($solution); $i += 3)
00106                 {
00107                         if (($user_id > 0) && ($test_id > 0) && ($question_id > 0) && (strlen($pass) > 0))
00108                         {
00109                                 $deletequery = sprintf("DELETE FROM tst_solutions WHERE user_fi = %s AND test_fi = %s AND question_fi = %s AND pass = %s",
00110                                         $ilDB->quote($user_id . ""),
00111                                         $ilDB->quote($test_id . ""),
00112                                         $ilDB->quote($question_id . ""),
00113                                         $ilDB->quote($pass . "")
00114                                 );
00115                                 $ilDB->query($deletequery);
00116                         }
00117                         $query = sprintf("INSERT INTO tst_solutions ".
00118                                 "SET user_fi = %s, ".
00119                                 "test_fi = %s, ".
00120                                 "question_fi = %s, ".
00121                                 "value1 = %s, ".
00122                                 "value2 = %s, ".
00123                                 "points = %s, ".
00124                                 "pass = %s",
00125                                 $ilDB->quote($user_id . ""),
00126                                 $ilDB->quote($test_id . ""),
00127                                 $ilDB->quote($question_id . ""),
00128                                 $ilDB->quote($solution[$i]),
00129                                 $ilDB->quote($solution[$i+1]),
00130                                 $ilDB->quote($solution[$i+2]),
00131                                 $ilDB->quote($pass . "")
00132                         );
00133 
00134                         $ilDB->query($query);
00135                 }
00136                 return true;
00137         }
00138 }
00139 ?>

Generated on Fri Dec 13 2013 11:58:04 for ILIAS Release_3_6_x_branch .rev 46809 by  doxygen 1.7.1