diff options
| author | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
|---|---|---|
| committer | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
| commit | 4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch) | |
| tree | 5c07151ae61276d334e88f6309c30d439a85c12e /lib/elearning/PmWikiConnectedCMS.php | |
| parent | da0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff) | |
| parent | 97a188592c679890a25c37ab78463add76a52ff7 (diff) | |
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'lib/elearning/PmWikiConnectedCMS.php')
| -rw-r--r-- | lib/elearning/PmWikiConnectedCMS.php | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/lib/elearning/PmWikiConnectedCMS.php b/lib/elearning/PmWikiConnectedCMS.php new file mode 100644 index 0000000..d890126 --- /dev/null +++ b/lib/elearning/PmWikiConnectedCMS.php @@ -0,0 +1,86 @@ +<?php +# Lifter002: TODO +# Lifter007: TODO +# Lifter003: TODO +# Lifter010: TODO + +/* + * PmWikiConnectedCMS.php - Provides search capabilities + * to search WikiFarm + * + * Copyright (C) 2006 - Marco Diedrich (mdiedric@uos.de) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + */ + +require_once 'clients/xml_rpc_webservice_client.php'; +require_once 'clients/soap_webservice_client.php'; +require_once 'clients/webservice_client.php'; + +/** +* main-class for connection to PmWiki +* +* This class contains the main methods of the elearning-interface to connect to PmWiki. Extends ConnectedCMS. +* +* @author Marco Diedrich <mdiedric@uos.de> +* @access public +* @modulegroup elearning_interface_modules +* @module PmWikiConnectedCMS +* @package ELearning-Interface +*/ + +class PmWikiConnectedCMS extends ConnectedCMS +{ + public $client; + public $api_key; + public $field_script; + + function __construct($cms) + { + parent::__construct($cms); + $this->client = WebserviceClient::instance( $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['ABSOLUTE_PATH_SOAP'] . + '?' . $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['URL_PARAMS'], + $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['WEBSERVICE_CLASS']); + + $this->api_key = $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['soap_data']['api-key']; + } + + function init($cms) + { + parent::init($cms); + $this->field_script = $GLOBALS['ELEARNING_INTERFACE_MODULES'][$cms]["field_script"]; + } + + /** + * search for content modules + * + * returns found content modules + * @param string $key keyword + * @return array list of content modules + */ + public function searchContentModules($key) + { + $fields_found = $this->client->call("search_content_modules", [ + $GLOBALS['ELEARNING_INTERFACE_MODULES'][$this->cms_type]['soap_data']['api-key'], + $key + ]); + + $result = []; + foreach ($fields_found as $field) { + $result[$field['field_id']] = [ + 'ref_id' => $field['field_id'], + 'type' => $field['field_type'], + 'obj_id' => null, + 'create_date' => $field['create_date'], + 'last_update' => $field['change_date'], + 'title' => $field['field_title'], + 'description' => $field['field_description'], + ]; + } + return $result; + } + +} |
