Supporting each other

Community forums

Welcome, Guest
Username: Password: Remember me
Questions on getting Xerte Toolkits installed on your server and questions about authentication and user logins.
  • Page:
  • 1
  • 2

TOPIC:

XOT - MOODLE INTEGRATION 7 years 9 months ago #4298

  • epikinon
  • epikinon's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 17
  • Thank you received: 1
Hi all,

I have XOT installed on a shared host outside the moodle folder. I would like to integrate the two but the support provided in the documentation to tweak the xerte config.php is not as clear to me.

I'm including here the moodle integration instructions file found in documentations along with the confing.php, hoping that someone will instruct me to implement the changes to the config.php.

Thank you very much!!

MOODLE INTEGRATION README TEXT
moodle authentication integration for Xerte toolkits updated for use with version 3.1 and later
updated December 2015

This method of authentication integration has been tested with XOT 3.x and enables authentication integration with the moodle installation on the same server. Specifically it enables integration with the moodle authentication system allowing seamless login from moodle to toolkits. This is achieved by using the moodle session data so at the moment this will not work if moodle and toolkits are installed on separate servers.

Note: this latest integration will only work with XOT 1.8 and above and is not backwards compatible with XOT versions prior to 1.8. It should however work with any version of Moodle e.g. 1.9x as well as 2.x, 3.x.

/////////////////////////////////////////////////////
How this works
Once applied and configured this patch works in the following ways:

1. A user logs in to moodle and then follows a link from that moodle to an installation of toolkits on the same server. The user is automatically logged in to their own workspace in toolkits seeing any previous LO's they have created. If this is their first visit to the toolkits installation their firstname, lastname and username are added to the xerte toolkits database. (This then also allows other users to share learning objects with the new toolkits user via properties > shared settings or to give learning objects via properties > give this project ) This also means that any existing moodle user, or new users registering on moodle, also has access to the linked toolkits installation.

2. A user visits the toolkits installation without first logging in to moodle. They are automatically redirected to login to moodle.

If the toolkits installation is installed as a subdirectory of the moodle directory the user is then automatically redirected back to their own workspace in toolkits.

If the toolkits installation is installed in a separate directory to the moodle directory the user will not be automatically directed back to toolkits but can follow a link to toolkits from the moodle installation or revisit the toolkits url with the same browser to be automatically logged in.

/////////////////////////////////////////////////////
Installation/Configuration
Please follow these steps carefully.

Step 1.
Test your XOT installation before trying to use the moodle integration e.g. install toolkits and use the guest authentication to make sure everything is working - creating, viewing, exporting an LO etc

Note: from version 3.1 onwards the different authentication options are set via the management area.

Step 2.
Either by using the management page or by editing sitedetails in the database add the path to your moodle installation to the integration config path field
e.g. this might be something like the following:

/home/youraccountname/public_html/config.php
or
/home/youraccountname/public_html/moodle/config.php
or
for a xampp/maxos install this should be something like:
/xampp/htdocs/moodle/config.php

Step 3.
Via the management area Authentication Settings set authentication to Moodle and save.

Step 4.
View http://yourmoodle/yourxot/ and ensure everything still works. You should be forced to login to Moodle and then returned back to XOT if installed inside the moodle directory. (see how this works above)

Step 5 (optional): If you wish to restrict authoring access to XOT e.g. not allow all moodle users to author you can easily do so by creating a custom profile field in moodle - see the commented out code in moodle_restrictions.php


/////////////////////////////////////////////////////
After installation/configuration
You can verify you have configured the moodle path correctly by visiting your toolkits installation which should redirect you to login to moodle. (see the 'how this works' info above)

/////////////////////////////////////////////////////

Bugs/feedback
Please send reports of bugs, success or any other feedback to the Xerte mailing list: This email address is being protected from spambots. You need JavaScript enabled to view it.

CONFIG.PHP
<?php
/**
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.

* The Apereo Foundation licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at:
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

* See the License for the specific language governing permissions and
* limitations under the License.
*/

//moodle integration (please view moodle_integration_readme.txt before use)

/**
*
* Config page, sets up the site variable from the database
*
* @author Patrick Lockley
* @version 1.0
*/

/**
* $xerte_toolkits_site variable
* Variable used to hold database settings
* @global object $xerte_toolkits_site
*/
global $xerte_toolkits_site;

// Change this to FALSE for production sites.
// While set to true, PHP error reporting to the browser
// and logging (to /tmp/debug.log) are turned on; either of these may help you
// diagnose installation and integration issues.
global $development;
$development = false;

ini_set('error_reporting', 0);
if ($development) {
ini_set('error_reporting', E_ALL);
// Change this to where you want the XOT log file to go;
// the webserver will need to be able to write to it.
define('XOT_DEBUG_LOGFILE', '/tmp/debug.log');
}

if (version_compare(PHP_VERSION, '5.1.0', '<')) {
// perhaps we should die at this point instead?
trigger_error("You are running an unsupported version of PHP/XerteOnlineToolkits. Please run PHP v5.1 or above");
}

require_once(dirname(__FILE__) . '/functions.php');
require_once(dirname(__FILE__) . '/library/autoloader.php');

if (isset($xerte_toolkits_site)) {
return;
}


// create new generic object to hold all our config stuff in....
$xerte_toolkits_site = new stdClass();


/**
* Comment/uncomment the below to suit.
*/

/**
* Note, if you choose sqlite (the default) an empty sqlite db will be
* created in your system's temp dir unless you've edited the below.
* This will probably not survive a server reboot.
*/
//$xerte_toolkits_site->database_type = 'sqlite';
//$xerte_toolkits_site->database_location = sys_get_temp_dir() . '/xerte.sqlite';

$xerte_toolkits_site->database_type = 'mysql';

if(file_exists(dirname(__FILE__) . '/database.php')) {
require_once(dirname(__FILE__) .'/database.php');
}

require_once(dirname(__FILE__) . '/website_code/php/database_library.php');


$ok = database_is_setup($xerte_toolkits_site);

if(!$ok) {
if($xerte_toolkits_site->database_type == 'mysql' && is_dir(dirname(__FILE__) . '/setup')) {
header("Location: {$_SERVER}setup/");
exit(0);
}

/* run the magical sqlite auto-installer */
if($xerte_toolkits_site->database_type == 'sqlite') {
require_once(dirname(__FILE__) . '/website_code/php/database_library_sqlite.php');
$ok = database_setup($xerte_toolkits_site->database_location);
}
}

if(!$ok) {
die("Database setup failed");
}

/* test database access */
if (!database_connect($xerte_toolkits_site)) {
die("database.php isn't correctly configured; or we cannot connect to database");
}


$row = db_query_one("SELECT * FROM {$xerte_toolkits_site->database_table_prefix}sitedetails");

if ($row != "") {
require_once($row);
}

unset($row);
foreach ($row as $key => $value) {
$xerte_toolkits_site->$key = $value;
}

// awkward ones.
$xerte_toolkits_site->mimetypes = explode(",", $row);
$xerte_toolkits_site->name = $row;
$xerte_toolkits_site->demonstration_page = $xerte_toolkits_site->site_url . $row;
$xerte_toolkits_site->news_text = base64_decode($row);
$xerte_toolkits_site->pod_one = base64_decode($row);
$xerte_toolkits_site->pod_two = base64_decode($row);
//$xerte_toolkits_site->copyright = utf8_decode($row);

$site_texts = explode("~~~", $row);
if (count($site_texts) > 1) {
$xerte_toolkits_site->site_text = $site_texts[0];
$xerte_toolkits_site->tutorial_text = $site_texts[1];
} else {
$xerte_toolkits_site->site_text = $site_texts[0];
$xerte_toolkits_site->tutorial_text = "";
}


/**
* Set up the string for the password protected play page
*/
$xerte_toolkits_site->form_string = base64_decode($row);

/**
* Set up the string for the peer review page
*/
$xerte_toolkits_site->peer_form_string = base64_decode($row);


$xerte_toolkits_site->basic_template_path = $xerte_toolkits_site->root_file_path . $xerte_toolkits_site->module_path;
$xerte_toolkits_site->users_file_area_full = $xerte_toolkits_site->root_file_path . $xerte_toolkits_site->users_file_area_short;

/**
* SQL query string used by play,edit and preview pages
*/
$xerte_toolkits_site->play_edit_preview_query = base64_decode($row);

/**
* Error handling settings
*/
$xerte_toolkits_site->error_log_path = $xerte_toolkits_site->root_file_path . $row;

$xerte_toolkits_site->flash_flv_skin = $xerte_toolkits_site->site_url . $row;


$dir = opendir(dirname(__FILE__) . "/modules/");

// I'm not sure why we allow this path to be set via the DB. It'd make more sense to fix it to dirname(__FILE__), which will cope with the site moving.
$xerte_toolkits_site->root_file_path = dirname(__FILE__) . '/';

$learning_objects = new StdClass();

foreach (glob(dirname(__FILE__) . "/modules/**/templates/**/*.info") as $infoFile) {

if (preg_match('!/modules/(\w+)/templates/(\w+)/!', $infoFile, $matches)) {

$attributeName = $matches[1] . '_' . $matches[2];

$templateProperties = new StdClass();
$learning_objects->{$attributeName} = $templateProperties;

$info = file($infoFile, FILE_SKIP_EMPTY_LINES);
if ($info === FALSE || empty($info)) {
die("Invalid template info file - check $infoFile is valid.");
}
foreach ($info as $line) {
$attr_data = explode(":", $line, 2);
if (empty($attr_data) || sizeof($attr_data) != 2) {
continue;
}
switch (trim(strtolower($attr_data[0]))) {
case "editor size" : $templateProperties->editor_size = trim($attr_data[1]);
break;
case "preview size" : $templateProperties->preview_size = trim($attr_data[1]);
break;
case "preview filename" : $templateProperties->preview_file = trim($attr_data[1]);
break;
case "public filename" : $templateProperties->public_file = trim($attr_data[1]);
break;
case "supports" : $templateProperties->supports = explode(",", trim($attr_data[1]));
break;
}
}
} else {
die("Invalid template name : $infoFile");
}
}
$xerte_toolkits_site->learning_objects = $learning_objects;

/* Optional :
require_once("session_handler.php");

$session_handle = new toolkits_session_handler();

session_set_save_handler(
array($session_handle,'xerte_session_open'),
array($session_handle,'xerte_session_close'),
array($session_handle,'xerte_session_read'),
array($session_handle,'xerte_session_write'),
array($session_handle,'xerte_session_destroy'),
array($session_handle,'xerte_session_clean'));
*/
require_once(dirname(__FILE__) . '/auth_config.php');

Please Log in or Create an account to join the conversation.

XOT - MOODLE INTEGRATION 7 years 9 months ago #4299

  • ronm
  • ronm's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 850
  • Thank you received: 261
Not sure why you would share the contents of those files here and the xerte config.php is completely irrelevant in what you describe here. You certainly don't need to edit that or any php file.
Read the instructions again carefully.
If you already have your installation running and tested without Moodle integration then all you need to do is access the management page and put the full path to your moodle config.php file in the integration_path field and then change the authentication setting to Moodle and save. Then logout, refresh and you should be prompted to login to Moodle.
Be careful to get that integration path right. On shared hosting it will usually be something like /home/yourusername/public_html/moodle/config.php if your Moodle is in a subdirectory of public_html and it can be important to have /home/yourusername/ at the beginning of that path
HTH
Ron
Xerte developer & trainer
e-learning & m-learning consultant
mitchellmedia.co.uk | xerteacademy.com | learningapps.co.uk
Note: Support here is voluntary and meant for users to support each other.
Need direct commercial support with Xerte? mitchellmedia.co.uk/contact/

Please Log in or Create an account to join the conversation.

XOT - MOODLE INTEGRATION 7 years 9 months ago #4300

  • epikinon
  • epikinon's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 17
  • Thank you received: 1
Hi Ron,

I followed your instructions to the t but...no cigar.
I tried it on two installations:
1. public_html/xerte34
2. public_html/moodle31/xerte34

Both installations worked before integration. Not after.

I used the same integration path /public_html/moodle/config.php and I did change the authentication setting to moodle and saved.

I understand that the moodle integration on either of the above installations is a little different. Not clear as to how they are different. I understand though how the outcomes are different.

Thank you for your time!!

Alex

Please Log in or Create an account to join the conversation.

XOT - MOODLE INTEGRATION 7 years 9 months ago #4301

  • ronm
  • ronm's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 850
  • Thank you received: 261
Alex
You've said that you followed my instruction to the t but it doesn't sound like it! ;-)

Try /home/yourusername/public_html/moodle34/config.php
Obviously replace the yourusername bit and keep the first forward slash.
With either xerte the integration path would be the same but will work best if the xerte install is inside the Moodle install so that login redirects.

For others finding and reading this thread later please confirm that this resolves your issue.
HTH
Ron
Xerte developer & trainer
e-learning & m-learning consultant
mitchellmedia.co.uk | xerteacademy.com | learningapps.co.uk
Note: Support here is voluntary and meant for users to support each other.
Need direct commercial support with Xerte? mitchellmedia.co.uk/contact/

Please Log in or Create an account to join the conversation.

Last edit: by ronm.

XOT - MOODLE INTEGRATION 7 years 9 months ago #4302

  • epikinon
  • epikinon's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 17
  • Thank you received: 1
Ron,
tried it again. The same. epikinonia.net/xerte34 becomes inaccessible after the changes.

I had to reinstall xerte34 in the same location. It works now because I haven't repeated the process.

SO..
epikinonia.net/moodle31 works
epikinonia.net/xerte34 works (haven't changed authenticaion yet)

thank you!

Please Log in or Create an account to join the conversation.

XOT - MOODLE INTEGRATION 7 years 9 months ago #4303

  • ronm
  • ronm's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 850
  • Thank you received: 261
Alex
I'm confused now so have you got Moodle authentication working or not?
Did you close all browser windows and re-open or at least refresh after making the changes?
You shouldn't need to reinstall Xerte just because you can't get the moodle authentication to work.
exactly what did you use for integration path?
If you have either FTP access or control panel and file manager access to your server or even access to phpinfo you should be able to verify the correct path and if it's not working I suspect you need to re-check the /home/yourusername/ bit of the path.
You could also try the following:
For your epikinonia.net/xerte34 xerte installation try an integration path of ../moodle31/config.php

and if you still have a xerte inside moodle then for that installation try ../config.php

If you do have cpanel open file manager and view the directory structure and verify what /home/yourusername/ is and then try /home/yourusername/public_html/moodle31/config.php

HTH
Ron
Xerte developer & trainer
e-learning & m-learning consultant
mitchellmedia.co.uk | xerteacademy.com | learningapps.co.uk
Note: Support here is voluntary and meant for users to support each other.
Need direct commercial support with Xerte? mitchellmedia.co.uk/contact/

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Time to create page: 0.052 seconds
Copyright © 2024 The Xerte Project.
Xerte logo Apereo logo OSI Logo

Search