Ejemplo n.º 1
0
/**
 * reportingservice.php - Functions for receiving reports from Ephorus
 *
 * @package    Ephoruscomms
 * @subpackage Reporting Service
 * @author     Guido Bonnet
 * @copyright  2012 onwards Ephorus  {@link http://ephorus.com}
 */
error_reporting(-1);
ini_set("error_reporting", E_ALL);
ini_set("display_errors", 1);
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class.EphorusApi.php';
if (isset($_GET['ephorus_version'])) {
    echo '--------------- Ephorus Version ---------------' . "\n";
    $status = new EphorusStatus();
    $status->versions();
    echo '-----------------------------------------------';
    exit;
}
if (isset($_GET['wsdl'])) {
    header("Content-Type:text/xml");
    echo file_get_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'ReportingService.wsdl');
    exit;
}
$reporting_service = new EphorusService();
function report($report)
{
    global $reporting_service;
    $reporting_service->reportingService($report);
}
 /**
  * Save form input (currently does not save anything to db)
  *
  */
 public function save()
 {
     global $tpl, $lng, $ilCtrl, $ilDB;
     $pl = $this->getPluginObject();
     $form = $this->initConfigurationForm();
     if ($form->checkInput()) {
         // Get submitted data
         $ephorus_logging = $form->getInput("ephorus_logging");
         $handin_code = $form->getInput("handin_code");
         $handin_address = $form->getInput("handin_address");
         $index_address = $form->getInput("index_address");
         $processtype = $form->getInput("processtype");
         $disclosure = $form->getInput("disclosure");
         // Saving to the database.
         $ilDB->manipulate($up = "UPDATE settings SET" . " value = " . $ilDB->quote($ephorus_logging, "integer") . " WHERE module = " . $ilDB->quote("rep_robj_xeph", "text") . " AND keyword = " . $ilDB->quote("ephorus_logging", "text"));
         $ilDB->manipulate($up = "UPDATE settings SET" . " value = " . $ilDB->quote($handin_code, "text") . " WHERE module = " . $ilDB->quote("rep_robj_xeph", "text") . " AND keyword = " . $ilDB->quote("handin_code", "text"));
         $ilDB->manipulate($up = "UPDATE settings SET" . " value = " . $ilDB->quote($handin_address, "text") . " WHERE module = " . $ilDB->quote("rep_robj_xeph", "text") . " AND keyword = " . $ilDB->quote("handin_address", "text"));
         $ilDB->manipulate($up = "UPDATE settings SET" . " value = " . $ilDB->quote($index_address, "text") . " WHERE module = " . $ilDB->quote("rep_robj_xeph", "text") . " AND keyword = " . $ilDB->quote("index_address", "text"));
         $ilDB->manipulate($up = "UPDATE settings SET" . " value = " . $ilDB->quote($processtype, "integer") . " WHERE module = " . $ilDB->quote("rep_robj_xeph", "text") . " AND keyword = " . $ilDB->quote("processtype", "text"));
         $ilDB->manipulate($up = "UPDATE settings SET" . " value = " . $ilDB->quote($disclosure, "text") . " WHERE module = " . $ilDB->quote("rep_robj_xeph", "text") . " AND keyword = " . $ilDB->quote("disclosure", "text"));
         ilUtil::sendInfo($pl->txt("saving_invoked"), true);
         include "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus/include/class.EphorusApi.php";
         $status = new EphorusStatus();
         $connection = $status->connectivityTest();
         if ($connection["handin"] && $connection["index"]) {
             ilUtil::sendSuccess($pl->txt("handin_index_okay"), true);
         } elseif ($connection["handin"]) {
             ilUtil::sendSuccess($pl->txt("handin_okay"), true);
             ilUtil::sendFailure($pl->txt("index_not_okay"), true);
         } elseif ($connection["index"]) {
             ilUtil::sendSuccess($pl->txt("index_okay"), true);
             ilUtil::sendFailure($pl->txt("handin_not_okay"), true);
         } else {
             ilUtil::sendFailure($pl->txt("handin_index_not_okay"), true);
         }
         $ilCtrl->redirect($this, "configure");
     } else {
         $form->setValuesByPost();
         $tpl->setContent($form->getHtml());
     }
 }