Each plugin is in a subfolder here.
-Except for the configuration methods, most methods
+Except for the configuration methods, most methods
defined in the API are optional -- callers will use
method_exists() to determine whether your plugin offers
the functionality they are after.
get_student_courses()
get_teacher_courses()
-
+
You probably will want to offer at least get_student_courses().
-
+
These methods are triggered when a user logs in successfully,
- and they are expected to populate $USER->student and
+ and they are expected to populate $USER->student and
$USER->teacher arrays and maintain (add/delete) entries from
user_students and user_teachers.
-
+
These methods are relevant for most plugins, and are the main
interest for plugins that work with a read-only backend such
as LDAP or a database.
-
- Note that with the multi-enrol infrastructure two things have
- changed. We now have an 'enrol' field in those tables, and
- each plugin must maintain only its own enrolment records.
+
+ Note that with the multi-enrol infrastructure two things have
+ changed. We now have an 'enrol' field in those tables, and
+ each plugin must maintain only its own enrolment records.
Conversely, the $USER->student and ->teacher arrays have the
enrolment type as value, like
-
+
$USER->student = array ( $courseid => $plugintype );
-
+
Moodle 1.7 and later
--------------------
setup_enrolments()
- With the advent of roles, there could well not be students and
+ With the advent of roles, there could well not be students and
teachers any more, so enrolment plugins have to be more flexible
about how they map outside data to the internal roles.
-
- This one method should do everything, calling functions from
+
+ This one method should do everything, calling functions from
lib/accesslib.php as necessary to set up relationships.
-
-
+
+
Interactive enrolment methods
=============================
get_access_icons()
These methods are for enrolment plugins that allow for user
-driven enrolment. These methods are relevant for plugins
+driven enrolment. These methods are relevant for plugins
that implement payment gateways (credit card, paypal),
-as well as "magic password" schemes.
+as well as "magic password" schemes.
Only one interactive enrolment method can be active for
a given course. The site default can be set from
For really heavy cron processing, an alternative is to have
a separate script to be called separately. Currently the LDAP
-and DB plugins have external scripts.
+and DB plugins have external scripts.
Guilty Parties
-<?php // $Id$
+<?php
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.');
}
}
-?>
+
-<?php // $Id$
+<?php
if (!isset($frm->enrol_cost)) $frm->enrol_cost = '5';
if (!isset($frm->enrol_currency)) $frm->enrol_currency = 'USD';
<tr valign="top">
<td align="right">enrol_currency:</td>
- <td><?php
+ <td><?php
$select = html_select::make(get_list_of_currencies(), "enrol_currency", $frm->enrol_currency, false);
$select->nothingvalue = '';
echo $OUTPUT->select($select);
-<?php // $Id$
+<?php
/**#@+
* Authorize.net payment methods.
define('AN_REVIEW', 4);
/**#@-*/
-?>
+
-<?php // $Id$
+<?php
$enrol_authorize_capabilities = array(
);
-?>
+
-<?php //$Id$
+<?php
// This file keeps track of upgrades to
// the authorize enrol plugin
return $result;
}
-?>
+
-<?php // $Id$
+<?php
require_once($CFG->dirroot.'/enrol/enrol.class.php');
require_once($CFG->dirroot.'/enrol/authorize/const.php');
$rs->close();
}
}
-?>
+
-<?php // $Id$
+<?php
require_once($CFG->libdir.'/formslib.php');
$mform->setType('ccexpireyyyy', PARAM_INT);
$mform->setDefault('ccexpiremm', '');
$mform->setDefault('ccexpireyyyy', '');
-
+
$creditcardsmenu = array('' => get_string('choose')) + get_list_of_creditcards();
$mform->addElement('select', 'cctype', get_string('cctype', 'enrol_authorize'), $creditcardsmenu);
$mform->setType('cctype', PARAM_ALPHA);
$mform->addRule('cctype', get_string('missingcctype', 'enrol_authorize'), 'required', null, 'client');
$mform->setDefault('cctype', '');
-
+
$mform->addElement('text', 'cvv', get_string('ccvv', 'enrol_authorize'), 'size="4"');
$mform->setHelpButton('cvv', array('authorize/cvv',get_string('ccvv', 'enrol_authorize'),'enrol'), true);
$mform->setType('cvv', PARAM_ALPHANUM);
$ccauthgrp[] = &$mform->createElement('text', 'ccauthcode', '', 'size="8"');
$mform->addGroup($ccauthgrp, 'ccauthgrp', get_string('authcode', 'enrol_authorize'), ' ', false);
$mform->setHelpButton('ccauthgrp', array('authorize/authcode',get_string('authcode', 'enrol_authorize'),'enrol'), true);
-
+
$ccauthgrprules = array();
$ccauthgrprules['ccauthcode'][] = array(get_string('missingccauthcode', 'enrol_authorize'), 'numeric', null, 'client');
$mform->addGroupRule('ccauthgrp', $ccauthgrprules);
}
}
-?>
+
else {
authorize_print_order($orderid);
}
-?>
+
-<?php // $Id$
+<?php
require_once($CFG->libdir.'/eventslib.php');
return $ret;
}
-?>
+
-<?php // $Id$
+<?php
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.');
AN_STATUS_REVIEWFAILED => $authstrs->reviewfailed,
AN_STATUS_TEST => $authstrs->tested
);
-
+
$popupmenu .= $OUTPUT->select(html_select::make_popup_form($baseurl.'&course='.$courseid, 'status', $statusmenu, 'statusmenu', $status));
if ($canmanagepayments) {
$popupmenu .= '<br />';
}
return $ret;
}
-?>
+
/// Send email to admin
if (!empty($ignoredlines)) {
$admin = get_admin();
-
+
$eventdata = new object();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $admin;
$eventdata->fullmessage = $ignoredlines;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
- $eventdata->smallmessage = '';
+ $eventdata->smallmessage = '';
events_trigger('message_send', $eventdata);
}
notice("<b>Done...</b><br />Imported: $imported<br />Updated: $updated<br />Ignored: $ignored");
}
-?>
+
-<?php // $Id$
+<?php
$plugin->version = 2009042700;
$plugin->requires = 2007101507;
-?>
+
<tr>
<td align="right">enrol_dbtype:</td>
<td>
- <?php
+ <?php
$dbtypes = array("access","ado_access", "ado", "ado_mssql", "borland_ibase", "csv", "db2", "fbsql", "firebird", "ibase", "informix72", "informix", "mssql", "mssql_n", "mysql", "mysqlt", "oci805", "oci8", "oci8po", "odbc", "odbc_mssql", "odbc_oracle", "oracle", "postgres64", "postgres7", "postgres", "proxy", "sqlanywhere", "sybase", "vfp");
foreach ($dbtypes as $dbtype) {
$dboptions[$dbtype] = $dbtype;
$select->nothingvalue = '';
echo $OUTPUT->select($select);
?>
-
+
</td>
<td>
<?php print_string("dbtype","enrol_database") ?>
<tr>
<td align="right">enrol_dbhost:</td>
<td>
- <?php
+ <?php
if (!isset($frm->enrol_dbhost)) {
$frm->enrol_dbhost = '';
- }
+ }
?>
<input size="15" type="text" name="enrol_dbhost" value="<?php p($frm->enrol_dbhost) ?>" />
</td>
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
$assignableroles = get_assignable_roles($sitecontext);
$assignableroles = array('' => get_string('default')) + $assignableroles;
-
+
echo $OUTPUT->select(html_select::make($assignableroles, 'enrol_db_defaultcourseroleid', $frm->enrol_db_defaultcourseroleid, false));
- if (isset($err['enrol_db_defaultcourseroleid'])) echo $OUTPUT->error_text($err['enrol_db_defaultcourseroleid']);
+ if (isset($err['enrol_db_defaultcourseroleid'])) echo $OUTPUT->error_text($err['enrol_db_defaultcourseroleid']);
?>
</td>
<td>
<td>
<?php
echo $OUTPUT->select(html_select::make($yesno, "enrol_db_autocreate", $frm->enrol_db_autocreate, false));
- if (isset($err["enrol_db_autocreate"])) echo $OUTPUT->error_text($err["enrol_db_autocreate"]);
+ if (isset($err["enrol_db_autocreate"])) echo $OUTPUT->error_text($err["enrol_db_autocreate"]);
?>
</td>
<td>
$parentlist = array();
make_categories_list($displaylist, $parentlist);
echo $OUTPUT->select(html_select::make($displaylist, "enrol_db_category", $frm->enrol_db_category, false));
-
+
?>
<?php if (isset($err["enrol_db_category"])) echo $OUTPUT->error_text($err["enrol_db_category"]); ?>
</td><td>
-<?php // $Id$
+<?php
require_once($CFG->dirroot.'/enrol/enrol.class.php');
continue;
}
- // slurp results into an array
+ // slurp results into an array
while ($crs_obj = (object)$crs->FetchRow()) {
$crs_obj = (object)array_change_key_case((array)$crs_obj , CASE_LOWER);
array_push($extenrolments, $crs_obj->{strtolower($CFG->enrol_remoteuserfield)});
} // end of class
-?>
+
-<?php // $Id$
+<?php
if(!empty($_SERVER['GATEWAY_INTERFACE'])){
error_log("should not be called from apache!");
exit;
}
error_reporting(E_ALL);
-
+
require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file.
require_once($CFG->dirroot . '/course/lib.php');
$roles = !empty($CFG->enrol_db_remoterolefield) && !empty($CFG->enrol_db_localrolefield)
? get_all_roles()
: array(null);
-
+
foreach ($roles as $role) {
$enrol->sync_enrolments($role);
}
-
+
// sync metacourses
if (function_exists('sync_metacourses')) {
sync_metacourses();
}
-
-?>
+
+
class enrolment_plugin_flatfile {
- var $log;
+ var $log;
/// Override the base config_form() function
function config_form($frm) {
foreach ($vars as $var) {
if (!isset($frm->$var)) {
$frm->$var = '';
- }
+ }
}
$roles = $DB->get_records('role', null, '', 'id, name, shortname');
isset($ffconfig->{"map_{$record->shortname}"}) ? $ffconfig->{"map_{$record->shortname}"} : $record->shortname
);
}
-
- include ("$CFG->dirroot/enrol/flatfile/config.html");
+
+ include ("$CFG->dirroot/enrol/flatfile/config.html");
}
}
if ( file_exists($filename) ) {
-
+
$this->log = userdate(time()) . "\n";
$this->log .= "Flatfile enrol cron found file: $filename\n\n";
if (($fh = fopen($filename, "r")) != false) {
list($roles, $rolemap) = $this->get_roles();
-
+
$line = 0;
while (!feof($fh)) {
-
+
$line++;
$fields = explode( ",", str_replace( "\r", "", fgets($fh) ) );
}
continue;
}
-
+
$fields[0] = trim(strtolower($fields[0]));
$fields[1] = trim(strtolower($fields[1]));
$fields[2] = trim($fields[2]);
$fields[3] = trim($fields[3]);
-
+
$this->log .= "$line: $fields[0] $fields[1] $fields[2] $fields[3] ";
-
+
if (!empty($fields[5])) {
$fields[4] = (int)trim($fields[4]);
$fields[5] = (int)trim($fields[5]);
} else {
$fields[4] = 0;
$fields[5] = 0;
- }
+ }
$this->log .= ":";
// Create/resurrect a context object
$context = get_context_instance(CONTEXT_COURSE, $course->id);
-
+
if ($fields[0] == 'add') {
role_assign($roleid, $user->id, null, $context->id, $fields[4], $fields[5], 0, 'flatfile');
} else {
role_unassign($roleid, $user->id, null, $context->id);
}
-
+
if ( empty($elog) and ($fields[0] == "add") ) {
-
+
if ($fields[1] == "student") {
if ($teachers = get_users_by_capability($context, 'moodle/course:update', 'u.*,ra.hidden', 'ra.sortorder ASC')) {
$teacher = get_admin();
}
-
+
if (!empty($CFG->enrol_mailstudents)) {
$a->coursename = "$course->fullname";
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id&course=$course->id";
-
+
$eventdata = new object();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $teacher;
if (!empty($CFG->enrol_mailteachers) && $teachers) {
foreach($teachers as $teacher) {
-
+
if (!$u->hidden || has_capability('moodle/role:viewhiddenassigns', $context)) {
$a->course = "$course->fullname";
$a->user = fullname($user);
-
+
$eventdata = new object();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $user;
$eventdata->fullmessage = get_string('enrolmentnewuser', '', $a);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
- $eventdata->smallmessage = '';
+ $eventdata->smallmessage = '';
events_trigger('message_send', $eventdata);
}
}
} // end of class
-?>
+
DESCRIPTION
-This enrolment script will repeatedly read an XML file from a
+This enrolment script will repeatedly read an XML file from a
specified location. The XML file should conform to the IMS Enterprise
-1.1 specification, containing <person>, <group>, and <membership>
-elements to specify which students/teachers should be added/removed
-from the course. User accounts and/or Moodle courses can be created
-by the script if they aren't yet registered (this is an option which
+1.1 specification, containing <person>, <group>, and <membership>
+elements to specify which students/teachers should be added/removed
+from the course. User accounts and/or Moodle courses can be created
+by the script if they aren't yet registered (this is an option which
can be turned on/off).
(The IMS 1.0 specification is significantly different from the 1.1
-spec. This code has been made flexible so it should in theory be
+spec. This code has been made flexible so it should in theory be
able to handle IMS 1.0 as well, but I haven't directly tested it
with v1.0 Enterprise data.
The one restriction that may be important is that the plugin assumes
HOW USERS/COURSES ARE MATCHED AGAINST MOODLE'S DATABASE
-IMS Enterprise data typically contains a "sourcedid" for each person
-or group (course) record, which represents the canonical identifier
-used by the source system. This is separate from the "userid" for a
-person, which is also present in the data and should represent the
-login userid which a person is intended to use in Moodle. (In some
+IMS Enterprise data typically contains a "sourcedid" for each person
+or group (course) record, which represents the canonical identifier
+used by the source system. This is separate from the "userid" for a
+person, which is also present in the data and should represent the
+login userid which a person is intended to use in Moodle. (In some
systems these may have the same value.)
-This script uses the "sourcedid" as the lookup to determine if the
-user/course exists in the database, in both cases looking at the
-"idnumber" field. This "idnumber" is not typically displayed in
-Moodle. When creating a user, the "userid" field must not be blank,
+This script uses the "sourcedid" as the lookup to determine if the
+user/course exists in the database, in both cases looking at the
+"idnumber" field. This "idnumber" is not typically displayed in
+Moodle. When creating a user, the "userid" field must not be blank,
because it is stored as the user's Moodle login ID.
TECHNICAL NOTE
-The script uses an optimised pattern-matching (regex) method for
+The script uses an optimised pattern-matching (regex) method for
processing the XML, rather than any built-in XML handling. This is for
-two reasons: firstly, because some systems produce very sloppy
-(even invalid) XML and we'd like to be able to process it anyway; and
-secondly, because PHP 4 and PHP 5 handle XML differently, and we'd
+two reasons: firstly, because some systems produce very sloppy
+(even invalid) XML and we'd like to be able to process it anyway; and
+secondly, because PHP 4 and PHP 5 handle XML differently, and we'd
like to be independent of that changeover.
- Support for enrolling using multiple files? At present only one filename
is supported. Some systems may wish/need to do multiple. This may be tricky
- since multiple filepaths may be too long for a single moodle config
+ since multiple filepaths may be too long for a single moodle config
variable (255 chars max)
- Process group's "relationship"?
-- Activate <photo> handling, dependent upon acceptance of
+- Activate <photo> handling, dependent upon acceptance of
modification to Moodle's gdlib.php
v0.6:
-- Reduce processing from two passes to one pass (dependent on <membership> tags
+- Reduce processing from two passes to one pass (dependent on <membership> tags
coming after any person/group tags to which they refer)
- The log data should NOT contain any personal information! NO STUDENT NAMES
<input type="checkbox" value="1" name="enrol_mailadmins" <?php if ($frm->enrol_mailadmins) echo "checked=\"checked\"" ?> />
</td>
<td>
-
+
</td>
</tr>
<input type="checkbox" value="1" name="enrol_fixcaseusernames" <?php if ($frm->enrol_fixcaseusernames) echo "checked=\"checked\"" ?> />
</td>
<td>
-
+
</td>
</tr>
<input type="checkbox" value="1" name="enrol_fixcasepersonalnames" <?php if ($frm->enrol_fixcasepersonalnames) echo "checked=\"checked\"" ?> />
</td>
<td>
-
+
</td>
</tr>
<input type="checkbox" value="1" name="enrol_imssourcedidfallback" <?php if ($frm->enrol_imssourcedidfallback) echo "checked=\"checked\"" ?> />
</td>
<td>
- <?php echo $OUTPUT->help_icon(moodle_help_icon::make('sourceddidfallback', 'More detail about this option', 'enrol/imsenterprise')); ?>
+ <?php echo $OUTPUT->help_icon(moodle_help_icon::make('sourceddidfallback', 'More detail about this option', 'enrol/imsenterprise')); ?>
</td>
</tr>
<!--
<td align="right">"<?php echo $imsrolename ?>" (<?php echo $imsrolenum ?>):</td>
<td>
<?php
-
+
$configref = "enrol_imse_imsrolemap" . $imsrolenum;
-
- echo $OUTPUT->select(html_select::make($assignableroles, 'enrol_imse_imsrolemap'.$imsrolenum,
+
+ echo $OUTPUT->select(html_select::make($assignableroles, 'enrol_imse_imsrolemap'.$imsrolenum,
strlen($frm->$configref) ? $frm->$configref : $this->determine_default_rolemapping($imsrolenum), false));
?>
</td>
}else{
$msg .= "Logging is currently not active.";
}
-
+
$eventdata = new object();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = get_admin();
$eventdata->fullmessage = $msg;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
- $eventdata->smallmessage = '';
+ $eventdata->smallmessage = '';
events_trigger('message_send', $eventdata);
$this->log_line('Notification email sent to administrator.');
} // end of class
-?>
+
<dl>
<dt><a name="Enterprise Conformance Summary for v1.1"></a>Enterprise Conformance Summary for v1.1</dt>
<dd>
- <p>This table gives a summmary of the elements that may be found in an IMS Enterprise 1.1 data file,
+ <p>This table gives a summmary of the elements that may be found in an IMS Enterprise 1.1 data file,
and Moodle's suppport for those elements via this enrolment plugin.</p>
<table border='1' cellspacing='0' cellpadding='2'>
<tr>
<tr>
<td> photo</td>
<td>Y?</td>
- <td>This currently is possible but requires a small modification to one of Moodle's
+ <td>This currently is possible but requires a small modification to one of Moodle's
library files, so for a standard simple installation, the import of user photos is
not supported.</td>
</tr>
<?xml version="1.0" encoding="ISO-8859-1"?>
-<enterprise>
+<enterprise>
<properties lang="EN"><!-- ccc -->
<datasource>sits:vision</datasource>
<datetime>28/Oct/2005</datetime>
<sourcedid>
<source>sits:vision</source>
<id>90078058</id>
- </sourcedid>
+ </sourcedid>
<userid>IMGBY26</userid>
<name>
<fn>Chloe Eva Piotrowska </fn>
<id> 90078058 </id>
</sourcedid>
<idtype idtype="1"/>
- <role roletype="01" recstatus="3">
+ <role roletype="01" recstatus="3">
<userid>IMGBY26</userid>
<status>1</status>
<extension><cohort>green team</cohort></extension>
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<enterprise>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<enterprise>
<properties lang="EN"><!-- c -->
<datasource>sits:vision</datasource>
<datetime>28/Oct/2005</datetime>
// autocreate
if (!isset($frm->enrol_ldap_autocreate)) {
- $frm->enrol_ldap_autocreate = false;
+ $frm->enrol_ldap_autocreate = false;
}
if (!isset($frm->enrol_ldap_category)) {
- $frm->enrol_ldap_category = 1;
+ $frm->enrol_ldap_category = 1;
}
if (!isset($frm->enrol_ldap_template)) {
- $frm->enrol_ldap_template = '';
+ $frm->enrol_ldap_template = '';
}
?>
$versions[2] = "2";
$versions[3] = "3";
echo $OUTPUT->select(html_select::make($versions, "enrol_ldap_version", $frm->enrol_ldap_version, false));
- if (isset($err["enrol_ldap_version"])) echo $OUTPUT->error_text($err["enrol_ldap_version"]);
+ if (isset($err["enrol_ldap_version"])) echo $OUTPUT->error_text($err["enrol_ldap_version"]);
?>
</td>
<td>
</tr>
<?php foreach ($roles as $role) { ?>
<tr>
- <td><?php echo htmlspecialchars($role->name, ENT_COMPAT, 'UTF-8'); ?></td>
- <td><input type="text" size="30" name="enrol_ldap_contexts_role<?php echo $role->id; ?>" value="<?php echo htmlspecialchars($frm->{'enrol_ldap_contexts_role'.$role->id}); ?>" /></td>
- <td><input type="text" size="30" name="enrol_ldap_memberattribute_role<?php echo $role->id; ?>" value="<?php echo htmlspecialchars($frm->{'enrol_ldap_memberattribute_role'.$role->id}); ?>" /></td>
+ <td><?php echo htmlspecialchars($role->name, ENT_COMPAT, 'UTF-8'); ?></td>
+ <td><input type="text" size="30" name="enrol_ldap_contexts_role<?php echo $role->id; ?>" value="<?php echo htmlspecialchars($frm->{'enrol_ldap_contexts_role'.$role->id}); ?>" /></td>
+ <td><input type="text" size="30" name="enrol_ldap_memberattribute_role<?php echo $role->id; ?>" value="<?php echo htmlspecialchars($frm->{'enrol_ldap_memberattribute_role'.$role->id}); ?>" /></td>
</tr>
<?php } ?>
</table>
<?php print_string("no") ?></option>
<option value="1" <?php echo ($frm->enrol_ldap_course_idnumber_editlock ? 'selected="selected"' : '') ?> >
<?php print_string("yes") ?></option>
- </select></div>
+ </select></div>
</td><td>
<?php print_string("enrol_ldap_course_idnumber","enrol_ldap") ?>
</td>
<tr>
<td align="right">enrol_ldap_course_summary:</td>
<td>
- <input name="enrol_ldap_course_summary" type="text" size="30" value="<?php echo $frm->enrol_ldap_course_summary?>"/>
+ <input name="enrol_ldap_course_summary" type="text" size="30" value="<?php echo $frm->enrol_ldap_course_summary?>"/>
<?php if (isset($err["enrol_ldap_course_summary"])) echo $OUTPUT->error_text($err["enrol_ldap_course_summary"]); ?>
<div style="text-align:right;margin-left:auto;margin-right:0">
<?php print_string("enrol_ldap_updatelocal", "enrol_ldap") ?>
<td>
<?php
echo $OUTPUT->select(html_select::make(array('0'=>'no','1'=>'yes'), "enrol_ldap_autocreate", $frm->enrol_ldap_autocreate, false));
- if (isset($err["enrol_ldap_autocreate"])) echo $OUTPUT->error_text($err["enrol_ldap_autocreate"]);
+ if (isset($err["enrol_ldap_autocreate"])) echo $OUTPUT->error_text($err["enrol_ldap_autocreate"]);
?>
</td>
<td>
$parentlist = array();
make_categories_list($displaylist, $parentlist);
echo $OUTPUT->select(html_select::make($displaylist, "enrol_ldap_category", $frm->enrol_ldap_category, false));
-
+
?>
<?php if (isset($err["enrol_ldap_category"])) echo $OUTPUT->error_text($err["enrol_ldap_category"]); ?>
</td><td>
class enrolment_plugin_ldap {
- var $log;
-
+ var $log;
+
var $enrol_localcoursefield = 'idnumber';
/**
echo $OUTPUT->notification("[ENROL_LDAP] LDAP-module cannot connect to server: {$CFG->enrol_ldap_host_url}");
return false;
}
-
+
// we are connected OK, continue...
// Get all the possible roles
if (!$roleassignments) {
$roleassignments = array();
}
-
+
// Get the ones that came from LDAP
$ldap_assignments = array_filter($roleassignments, create_function('$x', 'return $x->enrol == \'ldap\';'));
// Get enrolments for each type of role from LDAP.
foreach($roles as $role) {
$enrolments = $this->find_ext_enrolments(
- $ldap_connection,
- $user->idnumber ,
+ $ldap_connection,
+ $user->idnumber ,
$role);
//error_log('[ENROL_LDAP] LDAP reports ' . count($enrolments) . ' enrolments of type ' . $role->shortname . '.');
foreach ($enrolments as $enrol){
-
+
$course_ext_id = $enrol[$CFG->enrol_ldap_course_idnumber][0];
if(empty($course_ext_id)){
error_log("[ENROL_LDAP] The course external id is invalid!\n");
continue; // next; skip this one!
}
-
+
// create the course ir required
$course_obj = $DB->get_record('course', array($this->enrol_localcoursefield, $course_ext_id));
error_log("[ENROL_LDAP] User $user->username enrolled to a nonexistant course $course_ext_id \n");
}
}
-
+
// deal with enrolment in the moodle db
- if (!empty($course_obj)) { // does course exist now?
-
+ if (!empty($course_obj)) { // does course exist now?
+
$context = get_context_instance(CONTEXT_COURSE, $course_obj->id);
//$courseroles = get_user_roles($context, $user->id);
-
+
if (!$DB->get_record('role_assignments', array('roleid'=>$role->id, 'userid'=>$user->id, 'contextid'=>$context->id))) {
//error_log("[ENROL_LDAP] Assigning role '{$role->name}' to {$user->id} ({$user->username}) in course {$course_obj->id} ({$course_obj->shortname})");
if (!role_assign($role->id, $user->id, 0, $context->id, 0, 0, 0, 'ldap')){
error_log("[ENROL_LDAP] Failed to assign role '{$role->name}' to $user->id ($user->username) into course $course_obj->id ($course_obj->shortname)");
- }
+ }
} else {
//error_log("[ENROL_LDAP] Role '{$role->name}' already assigned to {$user->id} ({$user->username}) in course {$course_obj->id} ({$course_obj->shortname})");
}
@ldap_close($ldap_connection);
//error_log('[ENROL_LDAP] finished with setup_enrolments');
-
+
return true;
}
echo $OUTPUT->notification("LDAP-module cannot connect to server: $CFG->ldap_host_url");
return false;
}
-
+
// we are connected OK, continue...
$this->enrol_ldap_bind($ldap_connection);
$ldap_contexts = explode(";",$CFG->{'enrol_ldap_contexts_role'.$role->id});
// get all the fields we will want for the potential course creation
- // as they are light. don't get membership -- potentially a lot of data.
+ // as they are light. don't get membership -- potentially a lot of data.
$ldap_fields_wanted = array( 'dn', $CFG->enrol_ldap_course_idnumber);
if (!empty($CFG->enrol_ldap_course_fullname)){
array_push($ldap_fields_wanted, $CFG->enrol_ldap_course_fullname);
}
// define the search pattern
- if (!empty($CFG->enrol_ldap_objectclass)){
+ if (!empty($CFG->enrol_ldap_objectclass)){
$ldap_search_pattern='(objectclass='.$CFG->enrol_ldap_objectclass.')';
} else {
$ldap_search_pattern="(objectclass=*)";
-
+
}
// first, pack the sortorder...
$context = trim($context);
if ($CFG->enrol_ldap_search_sub){
//use ldap_search to find first user from subtree
- $ldap_result = @ldap_search($ldap_connection,
- $context,
+ $ldap_result = @ldap_search($ldap_connection,
+ $context,
$ldap_search_pattern,
$ldap_fields_wanted);
} else {
//search only in this context
- $ldap_result = @ldap_list($ldap_connection,
- $context,
+ $ldap_result = @ldap_list($ldap_connection,
+ $context,
$ldap_search_pattern,
$ldap_fields_wanted,0,0);
}
-
+
// check and push results
$records = $ldap_result
? ldap_get_entries($ldap_connection,$ldap_result)
// ldap libraries return an odd array, really. fix it:
$flat_records=array();
for ($c=0;$c<$records['count'];$c++) {
- array_push($flat_records, $records["$c"]);
+ array_push($flat_records, $records["$c"]);
}
- // free mem -- is there a leak?
+ // free mem -- is there a leak?
$records=0; $ldap_result=0;
if (count($flat_records)) {
foreach($flat_records as $course){
$idnumber = $course{$CFG->enrol_ldap_course_idnumber}[0];
print "== Synching $idnumber\n";
- // does the course exist in moodle already?
+ // does the course exist in moodle already?
$course_obj = false;
$course_obj = $DB->get_record('course', array($this->enrol_localcoursefield=>$idnumber));
if (!is_object($course_obj)) {
$context = get_context_instance(CONTEXT_COURSE, $course_obj->id);
// pull the ldap membership into a nice array
- // this is an odd array -- mix of hash and array --
+ // this is an odd array -- mix of hash and array --
$ldapmembers=array();
if(array_key_exists('enrol_ldap_memberattribute_role'.$role->id, $CFG)
&& !empty($CFG->{'enrol_ldap_memberattribute_role'.$role->id})
&& !empty($course[strtolower($CFG->{'enrol_ldap_memberattribute_role'.$role->id} ) ])){ // may have no membership!
- $ldapmembers = $course[strtolower($CFG->{'enrol_ldap_memberattribute_role'.$role->id} )];
+ $ldapmembers = $course[strtolower($CFG->{'enrol_ldap_memberattribute_role'.$role->id} )];
unset($ldapmembers['count']); // remove oddity ;)
}
-
+
// prune old ldap enrolments
// hopefully they'll fit in the max buffer size for the RDBMS
$sql = '
}
}
}
-
- // insert current enrolments
+
+ // insert current enrolments
// bad we can't do INSERT IGNORE with postgres...
foreach ($ldapmembers as $ldapmember) {
$sql = 'SELECT id,1 FROM {user} '
." WHERE idnumber=?";
- $member = $DB->get_record_sql($sql, array($ldapmember));
-// print "sql: $sql \nidnumber = ".$ldapmember." \n".var_dump($member);
+ $member = $DB->get_record_sql($sql, array($ldapmember));
+// print "sql: $sql \nidnumber = ".$ldapmember." \n".var_dump($member);
if(empty($member) || empty($member->id)){
print "Could not find user $ldapmember, skipping\n";
continue;
}
$member = $member->id;
- if (!$DB->get_record('role_assignments', array('roleid'=>$role->id,
+ if (!$DB->get_record('role_assignments', array('roleid'=>$role->id,
'contextid'=>$context->id, 'userid'=>$member, 'enrol'=>'ldap'))){
if (role_assign($role->id, $member, 0, $context->id, 0, 0, 0, 'ldap')){
print "Assigned role $type to $member ($ldapmember) for course $course_obj->id ($course_obj->shortname)\n";
}
}
}
-
+
// we are done now, a bit of housekeeping
fix_course_sortorder();
-
+
@ldap_close($ldap_connection);
return true;
}
global $CFG;
$this->check_legacy_config();
-
+
include("$CFG->dirroot/enrol/ldap/config.html");
}
$config->enrol_ldap_version = '';
}
set_config('enrol_ldap_version', $config->enrol_ldap_version);
-
+
if (!isset ($config->enrol_ldap_bind_dn)) {
$config->enrol_ldap_bind_dn = '';
}
if (!isset ($config->enrol_ldap_bind_pw)) {
$config->enrol_ldap_bind_pw = '';
}
- set_config('enrol_ldap_bind_pw', $config->enrol_ldap_bind_pw);
-
+ set_config('enrol_ldap_bind_pw', $config->enrol_ldap_bind_pw);
+
if (!isset ($config->enrol_ldap_objectclass)) {
$config->enrol_ldap_objectclass = '';
}
- set_config('enrol_ldap_objectclass', $config->enrol_ldap_objectclass);
-
+ set_config('enrol_ldap_objectclass', $config->enrol_ldap_objectclass);
+
if (!isset ($config->enrol_ldap_category)) {
$config->enrol_ldap_category = '';
}
- set_config('enrol_ldap_category', $config->enrol_ldap_category);
-
+ set_config('enrol_ldap_category', $config->enrol_ldap_category);
+
if (!isset ($config->enrol_ldap_template)) {
$config->enrol_ldap_template = '';
}
- set_config('enrol_ldap_template', $config->enrol_ldap_template);
-
+ set_config('enrol_ldap_template', $config->enrol_ldap_template);
+
if (!isset ($config->enrol_ldap_course_fullname)) {
$config->enrol_ldap_course_fullname = '';
}
- set_config('enrol_ldap_course_fullname', $config->enrol_ldap_course_fullname);
+ set_config('enrol_ldap_course_fullname', $config->enrol_ldap_course_fullname);
if (!isset ($config->enrol_ldap_course_shortname)) {
$config->enrol_ldap_course_shortname = '';
}
- set_config('enrol_ldap_course_shortname', $config->enrol_ldap_course_shortname);
-
+ set_config('enrol_ldap_course_shortname', $config->enrol_ldap_course_shortname);
+
if (!isset ($config->enrol_ldap_course_summary)) {
$config->enrol_ldap_course_summary = '';
}
- set_config('enrol_ldap_course_summary', $config->enrol_ldap_course_summary);
-
+ set_config('enrol_ldap_course_summary', $config->enrol_ldap_course_summary);
+
if (!isset ($config->enrol_ldap_course_idnumber)) {
$config->enrol_ldap_course_idnumber = '';
}
- set_config('enrol_ldap_course_idnumber', $config->enrol_ldap_course_idnumber);
-
+ set_config('enrol_ldap_course_idnumber', $config->enrol_ldap_course_idnumber);
+
if (!isset ($config->enrol_localcoursefield)) {
$config->enrol_localcoursefield = '';
}
set_config('enrol_localcoursefield', $config->enrol_localcoursefield);
-
+
if (!isset ($config->enrol_ldap_user_memberfield)) {
$config->enrol_ldap_user_memberfield = '';
}
- set_config('enrol_ldap_user_memberfield', $config->enrol_ldap_user_memberfield);
-
+ set_config('enrol_ldap_user_memberfield', $config->enrol_ldap_user_memberfield);
+
if (!isset ($config->enrol_ldap_search_sub)) {
$config->enrol_ldap_search_sub = '0';
}
- set_config('enrol_ldap_search_sub', $config->enrol_ldap_search_sub);
-
+ set_config('enrol_ldap_search_sub', $config->enrol_ldap_search_sub);
+
if (!isset ($config->enrol_ldap_autocreate)) {
$config->enrol_ldap_autocreate = '0';
}
if (!isset($config->{'enrol_ldap_contexts_role'.$role->id})) {
$config->{'enrol_ldap_contexts_role'.$role->id} = '';
}
-
+
if (!isset($config->{'enrol_ldap_memberattribute_role'.$role->id})) {
$config->{'enrol_ldap_memberattribute_role'.$role->id} = '';
}
-
+
set_config('enrol_ldap_contexts_role'.$role->id, $config->{'enrol_ldap_contexts_role'.$role->id});
set_config('enrol_ldap_memberattribute_role'.$role->id, $config->{'enrol_ldap_memberattribute_role'.$role->id});
}
if (!empty($CFG->enrol_ldap_bind_dn)) {
$bind = ldap_bind( $result,
- $CFG->enrol_ldap_bind_dn,
+ $CFG->enrol_ldap_bind_dn,
$CFG->enrol_ldap_bind_pw );
if (!$bind) {
echo $OUTPUT->notification("Error in binding to LDAP server");
}
} else {
- //bind anonymously
+ //bind anonymously
if ( !ldap_bind($ldap_connection)){
echo $OUTPUT->notification("Error: could not bind ldap anonymously");
return false;
- }
+ }
}
return true;
function find_ext_enrolments ($ldap_connection, $memberuid, $role){
/// role is a record from the mdl_role table
/// return multidimentional array array with of courses (at least dn and idnumber)
-///
+///
global $CFG;
if(empty($memberuid)) { // No "idnumber" stored for this user, so no LDAP enrolments
return array();
- }
+ }
//default return value
$courses = array();
$ldap_contexts = explode(";",$CFG->{'enrol_ldap_contexts_role'.$role->id});
// get all the fields we will want for the potential course creation
- // as they are light. don't get membership -- potentially a lot of data.
+ // as they are light. don't get membership -- potentially a lot of data.
$ldap_fields_wanted = array( 'dn', $CFG->enrol_ldap_course_idnumber);
if (!empty($CFG->enrol_ldap_course_fullname)){
array_push($ldap_fields_wanted, $CFG->enrol_ldap_course_fullname);
// define the search pattern
$ldap_search_pattern = "(".$CFG->{'enrol_ldap_memberattribute_role'.$role->id}."=".$memberuid.")";
- if (!empty($CFG->enrol_ldap_objectclass)){
+ if (!empty($CFG->enrol_ldap_objectclass)){
$ldap_search_pattern='(&(objectclass='.$CFG->enrol_ldap_objectclass.')'.$ldap_search_pattern.')';
}
if (empty($context)) {
continue; // next;
}
-
+
if ($CFG->enrol_ldap_search_sub){
//use ldap_search to find first user from subtree
- $ldap_result = ldap_search($ldap_connection,
- $context,
+ $ldap_result = ldap_search($ldap_connection,
+ $context,
$ldap_search_pattern,
$ldap_fields_wanted);
} else {
//search only in this context
- $ldap_result = ldap_list($ldap_connection,
- $context,
+ $ldap_result = ldap_list($ldap_connection,
+ $context,
$ldap_search_pattern,
$ldap_fields_wanted);
}
-
+
// check and push results
- $records = ldap_get_entries($ldap_connection,$ldap_result);
+ $records = ldap_get_entries($ldap_connection,$ldap_result);
// ldap libraries return an odd array, really. fix it:
$flat_records=array();
for ($c=0;$c<$records['count'];$c++) {
- array_push($flat_records, $records["$c"]);
+ array_push($flat_records, $records["$c"]);
}
-
+
if (count($flat_records)) {
$courses = array_merge($courses, $flat_records);
}
// will create the moodle course from the template
// course_ext is an array as obtained from ldap -- flattened somewhat
-// NOTE: if you pass true for $skip_fix_course_sortorder
+// NOTE: if you pass true for $skip_fix_course_sortorder
// you will want to call fix_course_sortorder() after your are done
// with course creation
function create_course ($course_ext,$skip_fix_course_sortorder=0){
$course->shortname = $course_ext[$CFG->enrol_ldap_course_shortname][0];
if ( empty($course->idnumber)
|| empty($course->fullname)
- || empty($course->shortname) ) {
+ || empty($course->shortname) ) {
// we are in trouble!
error_log("Cannot create course: missing required data from the LDAP record!");
error_log(var_export($course, true));
$course = $DB->get_record('course', array('id' => $newcourseid));
blocks_add_default_course_blocks($course);
- if (!$skip_fix_course_sortorder){
- fix_course_sortorder();
+ if (!$skip_fix_course_sortorder){
+ fix_course_sortorder();
}
add_to_log($newcourseid, "course", "new", "view.php?id=$newcourseid", "enrol/ldap auto-creation");
} else {
echo $OUTPUT->notification("Serious Error! Could not create the new course!");
return false;
}
-
+
return $newcourseid;
}
unset_config('enrol_ldap_teacher_contexts');
}
-
+
if (isset($CFG->enrol_ldap_teacher_memberattribute)) {
if (isset($teacher_role)
or $teacher_role = $DB->get_record('role', array('shortname'=>'teacher'))) {
exit;
}
error_reporting(E_ALL);
-
+
require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file.
require_once($CFG->dirroot . '/course/lib.php');
foreach ($roles as $role) {
$enrol->sync_enrolments($role->shortname, true);
}
-
+
// sync metacourses
if (function_exists('sync_metacourses')) {
sync_metacourses();
}
-
-?>
+
+
<tr valign="top">
<td align="right">enrol_manual_keyholderrole:</td>
<td>
- <?php
+ <?php
$roles = get_all_roles();
$rolenames = array();
foreach ($roles as $id=>$role) {
$rolenames[$id]=$role->name;
}
- echo $OUTPUT->select(html_select::make($rolenames, 'enrol_manual_keyholderrole', $frm->enrol_manual_keyholderrole));
+ echo $OUTPUT->select(html_select::make($rolenames, 'enrol_manual_keyholderrole', $frm->enrol_manual_keyholderrole));
?>
</td>
<td>
-<?php /// $Id$
+<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
$eventdata->fullmessage = $strexpirynotifystudentsemail;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
- $eventdata->smallmessage = '';
+ $eventdata->smallmessage = '';
events_trigger('message_send', $eventdata);
}
}
$eventdata->fullmessage = $strexpirynotifyemail;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
- $eventdata->smallmessage = '';
+ $eventdata->smallmessage = '';
events_trigger('message_send', $eventdata);
}
}
} /// end of class
-?>
+
echo $OUTPUT->box_start();
?>
- <div class="allowedcoursesdiv">
+ <div class="allowedcoursesdiv">
<form id="allowedcoursesform" method="post">
<input type="hidden" name="sesskey" value="<?php echo $sesskey; ?>" />
<?php
***
***/
function mnet_publishes() {
-
+
$enrol = array();
$enrol['name'] = 'mnet_enrol'; // Name & Description go in lang file
$enrol['apiversion'] = 1;
co.cost,
co.currency,
co.defaultrole AS defaultroleid,
- r.name AS defaultrolename
+ r.name AS defaultrolename
FROM
{course_categories} ca
JOIN
}
/**
- *
+ *
*/
function user_enrolments($userid) {
return array();
*
* @param int $courseid The Course ID
* @param string $roles Comma-separated list of role shortnames
- * @return array Array of usernames who are homed on the
+ * @return array Array of usernames who are homed on the
* client machine
*/
function course_enrolments($courseid, $roles = '') {
// $default_role = get_default_course_role($course); ???
$sql .= " AND
a.roleid in ('".str_replace(',', "', '", $roles)."')";
- }
+ }
$enrolments = $DB->get_records_sql($sql);
$returnarray = array();
foreach($enrolments as $user) {
- $returnarray[$user->username] = array('enrol' => $user->enrol,
- 'timemodified' => $user->timemodified,
- 'shortname' => $user->shortname,
+ $returnarray[$user->username] = array('enrol' => $user->enrol,
+ 'timemodified' => $user->timemodified,
+ 'shortname' => $user->shortname,
'username' => $user->username,
'name' => $user->name);
}
global $CFG, $DB;
$sql = "
- SELECT DISTINCT
- h.id,
+ SELECT DISTINCT
+ h.id,
h.name
- FROM
+ FROM
{mnet_host} h,
{mnet_host2service} h2s,
{mnet_service} s
$course = &$courses[$n];
// add/update cached data in mnet_enrol_courses
- // sanitise data
+ // sanitise data
$course = (object)$course;
$course->remoteid = (int)$course->remoteid;
$course->hostid = $mnethostid;
} // end of class
-?>
+
<tr valign="top">
<td align="right">enrol_currency:</td>
<td>
- <?php
+ <?php
global $OUTPUT;
$select = html_select::make($paypalcurrencies, "enrol_currency", $frm->enrol_currency, false);
$select->nothingvalue = '';
-<?php //$Id$
+<?php
-// This file keeps track of upgrades to
+// This file keeps track of upgrades to
// the paypal enrol plugin
//
// Sometimes, changes between versions involve
$dbman = $DB->get_manager();
$result = true;
-/// And upgrade begins here. For each one, you'll need one
-/// block of code similar to the next one. Please, delete
+/// And upgrade begins here. For each one, you'll need one
+/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
return $result;
}
-?>
+
-<?php // $Id$
+<?php
// Implements all the main code for the PayPal plugin
require_once("$CFG->dirroot/enrol/enrol.class.php");
} // end of class definition
-?>
+
-<?php // $Id$
+<?php
/**
* Listens for Instant Payment Notification from PayPal
die;
}
- // If currency is incorrectly set then someone maybe trying to cheat the system
+ // If currency is incorrectly set then someone maybe trying to cheat the system
if ($data->mc_currency != $course->currency) {
email_paypal_error_to_admin("Currency does not match course settings, received: ".addslashes($data->mc_currency), $data);
if (!empty($CFG->enrol_mailstudents)) {
$a->coursename = $course->fullname;
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id";
-
+
$eventdata = new object();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $teacher;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
events_trigger('message_send', $eventdata);
-
+
}
if (!empty($CFG->enrol_mailteachers)) {
$a->course = $course->fullname;
$a->user = fullname($user);
-
+
$eventdata = new object();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $user;
$eventdata->fullmessage = get_string('enrolmentnewuser', '', $a);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
- $eventdata->smallmessage = '';
- events_trigger('message_send', $eventdata);
+ $eventdata->smallmessage = '';
+ events_trigger('message_send', $eventdata);
}
if (!empty($CFG->enrol_mailadmins)) {
$a->course = $course->fullname;
$a->user = fullname($user);
$admins = get_admins();
- foreach ($admins as $admin) {
+ foreach ($admins as $admin) {
$eventdata = new object();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $user;
events_trigger('message_send', $eventdata);
}
-?>
+
-<?php // $Id$
+<?php
require("../../config.php");
require_once("$CFG->dirroot/enrol/paypal/enrol.php");
} else {
$destination = "$CFG->wwwroot/course/view.php?id=$course->id";
}
-
+
if (has_capability('moodle/course:view', $context)) {
redirect($destination, get_string('paymentthanks', '', $course->fullname));
notice(get_string('paymentsorry', '', get_string('defaultcourseteacher')), $destination);
}
-?>
+
-<?PHP // $Id$
+<?php
/////////////////////////////////////////////////////////////////////////////////
/// Code fragment to define the version of this enrolment module
$plugin->requires = 2007101000; // Requires this Moodle version
-?>
+
-<?php // $Id$
+<?php
//This function provides automatic linking to
//activities when its name (title) is found inside every Moodle text
//It's based in the glosssary filter by Williams Castillo
// Initialise/invalidate our trivial cache if dealing with a different course
if (!isset($this->cachedcourseid) || $this->cachedcourseid !== (int)$this->courseid) {
$this->activitylist = null;
- }
+ }
$this->cachedcourseid = (int)$this->courseid;
/// It may be cached
usort($modinfo, 'comparemodulenamesbylength');
foreach ($modinfo as $activity) {
- //Exclude labels, hidden activities and activities for group members only
+ //Exclude labels, hidden activities and activities for group members only
if ($activity->mod != "label" and $activity->visible and empty($activity->groupmembersonly)) {
$title = s(trim(strip_tags(urldecode($activity->name))));
$currentname = trim(urldecode($activity->name));
}
return (strlen($a->name) < strlen($b->name)) ? 1 : -1;
}
-?>
+
</form> <br /> <br />
<center>
<iframe name="inlineframe" align="middle" width="80%" height="200">
- <p>Something is wrong...</p>
+ <p>Something is wrong...</p>
</iframe>
</center> <br />
<hr />
http://www.forkosh.com/mimetex.zip</a>, or looking for an appropriate
binary at <a href="http://moodle.org/download/mimetex/">
http://moodle.org/download/mimetex/</a>. You may then also need to
-edit your moodle/filter/algebra/pix.php file to add
+edit your moodle/filter/algebra/pix.php file to add
<br /><?PHP echo "case "" . PHP_OS . "":" ;?><br ?> to the list of operating systems
in the switch (PHP_OS) statement. Windows users may have a problem properly
unzipping mimetex.exe. Make sure that mimetex.exe is is <b>PRECISELY</b>
// disable moodle specific debug messages and any errors in output
define('NO_DEBUG_DISPLAY', true);
define('NO_MOODLE_COOKIES', true); // Because it interferes with caching
-
+
require_once('../../config.php');
if (!filter_is_enabled('filter/algebra')) {
// //
//////////////////////////
-This is a very simple Text Filter that searches text
-being output to the screen, replacing "bad" words
+This is a very simple Text Filter that searches text
+being output to the screen, replacing "bad" words
with other words.
To customise the word list, use the censor settings page
-<?php // $id$
+<?php
//////////////////////////////////////////////////////////////
// Censorship filtering
-//
+//
// This very simple example of a Text Filter will parse
// printed text, blacking out words perceived to be bad
-//
+//
// The list of words is in the lang/xx/moodle.php
//
//////////////////////////////////////////////////////////////
-/// This is the filtering class. It accepts the courseid and
+/// This is the filtering class. It accepts the courseid and
/// options to be filtered (In HTML form).
class censor_filter extends moodle_text_filter {
private function _canseecensor() {
$cansee = false;
$context = get_context_instance(CONTEXT_SYSTEM, SITEID);
if (has_capability('moodle/site:doanything', $context)) {
- $cansee = true;
+ $cansee = true;
}
return $cansee;
}
}
}
-?>
+
-<?php //$Id$
+<?php
$settings->add(new admin_setting_configtextarea('filter_censor_badwords', get_string('badwordslist','admin'),
get_string('badwordsconfig', 'admin').'<br />'.get_string('badwordsdefault', 'admin'), ''));
-?>
+
-<?PHP // $Id$
- // This class looks for email addresses in Moodle text and
- // hides them using the Moodle obfuscate_text function.
+<?php
+ // This class looks for email addresses in Moodle text and
+ // hides them using the Moodle obfuscate_text function.
// Original code by Mike Churchward
class emailprotect_filter extends moodle_text_filter {
return obfuscate_mailto($matches[2], $matches[4]);
}
-?>
+
-<?php // $Id$
+<?php
///////////////////////////////////////////////////////////////////////////
// //
}
}
}
-?>
\ No newline at end of file
-<?php // $Id$
+<?php
///////////////////////////////////////////////////////////////////////////
// //
}
echo $OUTPUT->footer();
-?>
+
while (childNode = elm.childNodes[z++])
HTML += childNode[outerHTML];
- // create a 'dummy' element
+ // create a 'dummy' element
dummy = doc.createElement('i');
// inject it next to `elm`,
elm[parentNode].insertBefore(dummy, elm);
-<?php // $Id$
+<?php
//////////////////////////////////////////////////////////////
// Media plugin filtering
//
$url = addslashes_js($link[2]);
$info = addslashes_js($link[3]);
- return '<object title="'.$info.'"
- class="mediaplugin mediaplugin_youtube" type="application/x-shockwave-flash"
+ return '<object title="'.$info.'"
+ class="mediaplugin mediaplugin_youtube" type="application/x-shockwave-flash"
data="'.$site.'youtube.com/v/'.$url.'&fs=1&rel=0" width="425" height="344">'.
'<param name="movie" value="'.$site.'youtube.com/v/'.$url.'&fs=1&rel=0" />'.
'<param name="FlashVars" value="playerMode=embedded" />'.
</object></span>';
}
-?>
+
-<?php //$Id$
+<?php
$settings->add(new admin_setting_configcheckbox('filter_mediaplugin_enable_mp3', get_string('mediapluginmp3','admin'), '', 1));
$settings->add(new admin_setting_configcheckbox('filter_mediaplugin_enable_img', get_string('mediapluginimg','admin'), '', 1));
-?>
+
-The FLV player is by Jeroen Wijering - www.jeroenwijering.com
+The FLV player is by Jeroen Wijering - www.jeroenwijering.com
and included in Moodle by his permission under the GNU GPL version 2 or later.
Thanks, Jeroen!
-$Id$
-
To Install it:
- Enable if from "Administration/Filters".
-
+
To Use it:
- Create your contents in multiple languages.
- Enclose every language content between:
Hola!
This text is common for every language because it's out from any lang block.
Bye!
-
+
Ciao, Eloy :-)
stronk7@moodle.org
-<?php //$Id$
+<?php
///////////////////////////////////////////////////////////////////////////
// //
// [pj] I don't know about you but I find this new implementation funny :P
// [skodak] I was laughing while rewriting it ;-)
// [nicolasconnault] Should support inverted attributes: <span class="multilang" lang="en"> (Doesn't work curently)
- // [skodak] it supports it now, though it is slower - any better idea?
+ // [skodak] it supports it now, though it is slower - any better idea?
if (empty($text) or is_numeric($text)) {
return $text;
}
}
-?>
+
-<?php //$Id$
+<?php
$settings->add(new admin_setting_configcheckbox('filter_multilang_force_old', 'filter_multilang_force_old',
get_string('multilangforceold', 'admin'), 0));
-?>
+
-<?php // $Id$
+<?php
// This script displays tex source code.
require_once('../../config.php');
$tex = str_replace('"','"',$tex);
$tex = str_replace("\'",''',$tex);
// Note that we retain the title tag as TeX format rather than using
- // the alt text, even if supplied. The alt text is intended for blind
- // users (to provide a text equivalent to the equation) while the title
- // is there as a convenience for sighted users who want to see the TeX
- // code.
+ // the alt text, even if supplied. The alt text is intended for blind
+ // users (to provide a text equivalent to the equation) while the title
+ // is there as a convenience for sighted users who want to see the TeX
+ // code.
$title = "title=\"$tex\"";
}
}
}
-?>
+
-<?php //$Id$
+<?php
require_once($CFG->dirroot.'/filter/tex/lib.php');
$item->set_updatedcallback('filter_tex_updatedcallback');
$settings->add($item);
}
-?>
+
-<?php // $Id$
+<?php
// latex.php
// render TeX stuff using latex - this will not work on all platforms
- // or configurations. Only works on Linux and Mac with appropriate
- // software installed.
+ // or configurations. Only works on Linux and Mac with appropriate
+ // software installed.
// Much of this inspired/copied from Benjamin Zeiss' work
class latex {
* Other platforms could/should be added
*/
function latex() {
- global $CFG;
-
+ global $CFG;
+
// construct directory structure
$this->temp_dir = $CFG->dataroot . "/temp/latex";
if (!file_exists("$CFG->dataroot/temp")) {
}
/**
- * Accessor function for support_platform field.
+ * Accessor function for support_platform field.
* @return boolean value of supported_platform
*/
function supported() {
$formula = tex_sanitize_formula($formula);
// $fontsize don't affects to formula's size. $density can change size
- $doc = "\\documentclass[{$fontsize}pt]{article}\n";
+ $doc = "\\documentclass[{$fontsize}pt]{article}\n";
$doc .= $CFG->filter_tex_latexpreamble;
$doc .= "\\pagestyle{empty}\n";
$doc .= "\\begin{document}\n";
return $doc;
}
- /**
+ /**
* execute an external command, with optional logging
* @param string $command command to execute
* @param file $log valid open file handle - log info will be written to this file
* @return bool true if successful
*/
function render( $formula, $filename, $fontsize=12, $density=240, $background='', $log=null ) {
-
+
global $CFG;
-
+
// quick check - will this work?
if (empty($CFG->filter_tex_pathlatex)) {
return false;
chdir( $this->temp_dir );
if ($this->execute($command, $log)) { // It allways False on Windows
// return false;
- }
+ }
// run dvips (.dvi to .ps)
$command = "{$CFG->filter_tex_pathdvips} -E $dvi -o $ps";
}
-?>
+
-<?php //$Id$
+<?php
function tex_filter_get_executable($debug=false) {
global $CFG;
$DB->delete_records('cache_filters', array('filter'=>'algebra'));
}
-?>
+
-<?php // $Id$
+<?php
// This function fetches math. images from the data directory
// If not, it obtains the corresponding TeX expression from the cache_tex db table
// and uses mimeTeX to create the image file
</form> <br /> <br />
<center>
<iframe name="inlineframe" align="middle" width="80%" height="200">
- <p>Something is wrong...</p>
+ <p>Something is wrong...</p>
</iframe>
</center> <br />
<hr />
appropriate gif image file for that expression and to create one if it doesn't exist.
It will then use either the LaTex/Ghostscript renderer (using external executables
on your system) or the bundled Mimetex executable. The full Latex/Ghostscript
-renderer produces better results and is tried first.
+renderer produces better results and is tried first.
Here are a few common things that can go wrong and some suggestions on how
you might try to fix them.</p>
<ol>
process this expression. Then the database entry for that expression contains
a bad TeX expression in the rawtext field (usually blank). You can fix this
by clicking on "Delete DB Entry"</li>
-<li>The TeX to gif image conversion process does not work.
+<li>The TeX to gif image conversion process does not work.
If paths are specified in the filter configuation screen for the three
executables these will be tried first. Note that they still must be correctly
-installed and have the correct permissions. In particular make sure that you
+installed and have the correct permissions. In particular make sure that you
have all the packages installed (e.g., on Debian/Ubuntu you need to install
the 'tetex-extra' package). Running the 'show command execution' test should
give a big clue.
-If this fails or is not available, the Mimetex executable is tried. If this
+If this fails or is not available, the Mimetex executable is tried. If this
fails a likely cause is that the mimetex binary you are using is
incompatible with your operating system. You can try compiling it from the
C sources downloaded from <a href="http://www.forkosh.com/mimetex.zip">
http://www.forkosh.com/mimetex.zip</a>, or looking for an appropriate
binary at <a href="http://moodle.org/download/mimetex/">
http://moodle.org/download/mimetex/</a>. You may then also need to
-edit your moodle/filter/tex/pix.php file to add
+edit your moodle/filter/tex/pix.php file to add
<br /><?PHP echo "case "" . PHP_OS . "":" ;?><br ?> to the list of operating systems
in the switch (PHP_OS) statement. Windows users may have a problem properly
unzipping mimetex.exe. Make sure that mimetex.exe is is <b>PRECISELY</b>
433152 bytes in size. If not, download a fresh copy from
<a href="http://moodle.org/download/mimetex/windows/mimetex.exe">
-http://moodle.org/download/mimetex/windows/mimetex.exe</a>.
+http://moodle.org/download/mimetex/windows/mimetex.exe</a>.
Another possible problem which may affect
both Unix and Windows servers is that the web server doesn't have execute permission
on the mimetex binary. In that case change permissions accordingly</li>
-<?PHP // $Id$
+<?php
// This function fetches math. images from the data directory
// If not, it obtains the corresponding TeX expression from the cache_tex db table
// and uses mimeTeX to create the image file
<?php
-
+
// This class looks for text including markup and
// applies tidy's repair function to it.
// Tidy is a HTML clean and
// repair utility, which is currently available for PHP 4.3.x and PHP 5 as a
// PECL extension from http://pecl.php.net/package/tidy, in PHP 5 you need only
// to compile using the --with-tidy option.
-// If you don't have the tidy extension installed or don't know, you can enable
+// If you don't have the tidy extension installed or don't know, you can enable
// or disable this filter, it just won't have any effect.
// If you want to know what you can set in $tidyoptions and what their default
// values are, see http://php.net/manual/en/function.tidy-get-config.php.
-
+
class tidy_filter extends moodle_text_filter {
/**
* @author Hannes Gassert <hannes at mediagonal dot ch>
* @param string text to be filtered
*/
function filter($text) {
-
+
/// Configuration for tidy. Feel free to tune for your needs, e.g. to allow
/// proprietary markup.
- $tidyoptions = array(
+ $tidyoptions = array(
'output-xhtml' => true,
'show-body-only' => true,
'tidy-mark' => false,
'indent' => true,
'quiet' => true,
);
-
+
/// Do a quick check using strpos to avoid unnecessary work
if (strpos($text, '<') === false) {
return $text;
}
-
+
/// If enabled: run tidy over the entire string
if (function_exists('tidy_repair_string')){
$text = tidy_repair_string($text, $tidyoptions, 'utf8');
return $text;
}
}
-?>
+
// actually do the work now..
$exporter->process_stage($stage, $alreadystolen);
-?>
+
echo $OUTPUT->footer();
-?>
+
$exporter->get('instance')->send_file();
$exporter->process_stage_cleanup(true);
exit;
-?>
+
-<?php // $Id$
+<?php
require_once("$CFG->libdir/simpletest/testportfoliolib.php");
require_once("$CFG->dirroot/portfolio/type/boxnet/lib.php");
require_once("$CFG->dirroot/$CFG->admin/generator.php");
$this->assertTrue($this->plugin->send_package());
}
}
-?>
+
$plugin->requires = 2008072500;
$plugin->cron = 0;
-?>
+
echo $OUTPUT->footer();
-?>
+
-<?php // $Id$
+<?php
require_once($CFG->libdir.'/simpletest/testportfoliolib.php');
require_once($CFG->dirroot.'/portfolio/type/download/lib.php');
}
}
-?>
+
$plugin->requires = 2008072500;
$plugin->cron = 0;
-?>
+
$plugin->requires = 2008072500;
$plugin->cron = 0;
-?>
+
-<?php // $Id$
+<?php
$handlers = array (
'user_deleted' => array (
'handlerfile' => '/portfolio/type/googledocs/lib.php',
- 'handlerfunction' => 'portfolio_googledocs_user_deleted',
+ 'handlerfunction' => 'portfolio_googledocs_user_deleted',
'schedule' => 'cron'
),
);
-?>
+
-<?php
+<?php
/**
* Google Documents Portfolio Plugin
*
* @author Dan Poltawski <talktodan@gmail.com>
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
require_once($CFG->libdir.'/googleapi.php');
public function prepare_package() {
// we send the files as they are, no prep required
- return true;
+ return true;
}
public function get_continue_url(){
}
/**
- * Registers to the user_deleted event to revoke any
+ * Registers to the user_deleted event to revoke any
* subauth tokens we have from them
*
* @param $user user object
}
}
- return true;
+ return true;
}
-<?php // $Id$
+<?php
$plugin->version = 2008072505;
$plugin->requires = 2008072500;
$plugin->cron = 0;
-?>
+
-<?php //$Id$
+<?php
// This file keeps track of upgrades to
// the portfolio/mahara plugin
$exporter->get('instance')->send_intent();
redirect($CFG->wwwroot . '/portfolio/add.php?postcontrol=1&id=' . $exporter->get('id'));
}
-?>
+
$plugin->requires = 2008072500;
$plugin->cron = 0;
-?>
+
-<?php // $Id$
+<?php
$handlers = array (
'user_deleted' => array (
'handlerfile' => '/portfolio/type/picasa/lib.php',
- 'handlerfunction' => 'portfolio_picasa_user_deleted',
+ 'handlerfunction' => 'portfolio_picasa_user_deleted',
'schedule' => 'cron'
),
);
-?>
+
-<?php
+<?php
/**
* Picasa Portfolio Plugin
*
* @author Dan Poltawski <talktodan@gmail.com>
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
public function prepare_package() {
// we send the files as they are, no prep required
- return true;
+ return true;
}
public function get_continue_url(){
}
/**
- * Registers to the user_deleted event to revoke any
+ * Registers to the user_deleted event to revoke any
* subauth tokens we have from them
*
* @param $user user object
}
}
- return true;
+ return true;
}
-<?php // $Id$
+<?php
$plugin->version = 2008072505;
$plugin->requires = 2008072500;
$plugin->cron = 0;
-?>
+
/**
* repository_alfresco class
*
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
$user_field->id = 'alfresco_username';
$user_field->type = 'text';
$user_field->name = 'al_username';
-
+
$passwd_field->label = get_string('password', 'repository_alfresco').': ';
$passwd_field->id = 'alfresco_password';
$passwd_field->type = 'password';
}
}
}
-?>
+
* This is a subclass of repository class
*
* @author Dongsheng Cai
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
class repository_boxnet extends repository {
if(!empty($options['username']) && !empty($options['password']) && !empty($options['ticket']) ) {
$this->box = new boxclient($this->api_key);
try {
- $SESSION->$sess_name = $this->box->getAuthToken($options['ticket'],
+ $SESSION->$sess_name = $this->box->getAuthToken($options['ticket'],
$options['username'], $options['password']);
} catch (repository_exception $e) {
throw $e;
$fileicon = $tree['thumbnail'];
foreach ($filenames as $n=>$v){
if(strstr(strtolower($v), strtolower($search_text)) !== false) {
- $list[] = array('title'=>$v,
+ $list[] = array('title'=>$v,
'size'=>$filesizes[$n],
'date'=>$filedates[$n],
'source'=>'http://box.net/api/1.0/download/'
$user_field->type = 'text';
$user_field->name = 'boxusername';
$user_field->value = $ret->username;
-
+
$passwd_field->label = get_string('password', 'repository_boxnet').': ';
$passwd_field->id = 'box_password';
$passwd_field->type = 'password';
$mform->addElement('static', null, '', get_string('information','repository_boxnet'));
}
}
-?>
+
* repository_draft class
* This is a subclass of repository class
*
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
class repository_draft extends repository {
return get_string('repositoryname', 'repository_draft');;
}
}
-?>
+
-<?php // $Id$
+<?php
/**
* repository_filesystem class
* This plugin is used to access user's private flickr repository
*
* @author Dongsheng Cai <dongsheng@moodle.com>
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
$format = '.'.$format;
// append extensions to the files
if (substr($p['title'], strlen($p['title'])-strlen($format)) != $format) {
- $p['title'] .= $format;
+ $p['title'] .= $format;
}
$ret['list'][] = array('title'=>$p['title'],'source'=>$p['id'],
'id'=>$p['id'],'thumbnail'=>$this->flickr->buildPhotoURL($p, 'Square'),
case 'image/png':
$this->image = imagecreatefrompng($this->imagepath);
break;
- case 'image/gif':
- $this->image = imagecreatefromgif($this->imagepath);
+ case 'image/gif':
+ $this->image = imagecreatefromgif($this->imagepath);
break;
default:
break;
case 'image/png':
return imagepng($this->image, $imagepath);
break;
- case 'image/gif':
+ case 'image/gif':
return imagegif($this->image, $imagepath);
break;
default:
* access photos in this public account
*
* @author Dongsheng Cai <dongsheng@moodle.com>
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
if (!empty($SESSION->{$this->sess_tag}) // use tag to search
or !empty($SESSION->{$this->sess_text}) // use keyword to search
- or !empty($this->nsid)/*use pre-defined accound*/) {
+ or !empty($this->nsid)/*use pre-defined accound*/) {
$photos = $this->flickr->photos_search(array(
'tags'=>$SESSION->{$this->sess_tag},
'page'=>$page,
// append author id
// $p['title'] .= '-'.$p['owner'];
// append file extension
- $p['title'] .= $format;
+ $p['title'] .= $format;
}
$ret['list'][] = array('title'=>$p['title'], 'source'=>$p['id'],
'id'=>$p['id'],'thumbnail'=>$this->flickr->buildPhotoURL($p, 'Square'),
* Google Docs Plugin
*
* @author Dan Poltawski <talktodan@gmail.com>
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
return false;
}
- public function print_login($ajax = true){
+ public function print_login($ajax = true){
global $CFG;
if($ajax){
- $ret = array();
- $popup_btn = new stdclass;
- $popup_btn->type = 'popup';
+ $ret = array();
+ $popup_btn = new stdclass;
+ $popup_btn->type = 'popup';
$returnurl = $CFG->wwwroot.'/repository/ws.php?callback=yes&repo_id='.$this->id;
$popup_btn->url = google_authsub::login_url($returnurl, google_docs::REALM);
- $ret['login'] = array($popup_btn);
- return $ret;
+ $ret['login'] = array($popup_btn);
+ return $ret;
}
}
* repository_local class
* This is a subclass of repository class
*
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
return get_string('repositoryname', 'repository_local');;
}
}
-?>
+
//set session
$SESSION->loginmahara = true;
-
+
$ret = array();
$popup_btn = new stdclass;
$popup_btn->type = 'popup';
} else {
$client->add_param($search);
}
-
+
///call the method and manage host error
if (!$client->send($mnet_peer)) {
$message =" ";
$list[] = array( 'title'=>$file['title'], 'date'=>$file['mtime'], 'source'=>$file['id'], 'thumbnail' => $thumbnail);
}
}
-
+
$filepickerlisting = array(
'path' => $newpath,
return array('peer');
}
}
-?>
+
-<?php // $Id$
+<?php
require_once(dirname(dirname(__FILE__)) . '/config.php');
require_once($CFG->dirroot . '/repository/lib.php');
* Picasa Repository Plugin
*
* @author Dan Poltawski <talktodan@gmail.com>
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
return false;
}
- public function print_login(){
+ public function print_login(){
global $CFG;
$returnurl = $CFG->wwwroot.'/repository/ws.php?callback=yes&repo_id='.$this->id;
$authurl = google_authsub::login_url($returnurl, google_picasa::REALM);
if($this->options['ajax']){
- $ret = array();
- $popup_btn = new stdclass;
- $popup_btn->type = 'popup';
+ $ret = array();
+ $popup_btn = new stdclass;
+ $popup_btn->type = 'popup';
$popup_btn->url = $authurl;
- $ret['login'] = array($popup_btn);
- return $ret;
+ $ret['login'] = array($popup_btn);
+ return $ret;
} else {
echo '<a target="_blank" href="'.$authurl.'">Login</a>';
}
* This plugin allowed to connect a retrieve a file from another Moodle site
* This is a subclass of repository class
* @author Jerome Mouneyrac
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
return array('peer');
}
}
-?>
+
.ygtvlph { background: url(../pix/y/lph.gif) 0 0 no-repeat; width:34px; height:22px; cursor:pointer }
/* Loading icon */
.ygtvloading { background: url(../pix/y/loading.gif) 0 0 no-repeat; width:16px; height:22px; }
-/* the style for the empty cells that are used for rendering the depth
+/* the style for the empty cells that are used for rendering the depth
* of the node */
.ygtvdepthcell { background: url(../pix/y/vline.gif) 0 0 no-repeat; width:17px; height:22px; }
.ygtvblankdepthcell { width:17px; height:22px; }
/* the style of the div around each node */
-.ygtvitem { }
+.ygtvitem { }
.ygtvitem table{ margin-bottom:0; }
-.ygtvitem td { border:none;padding:0; }
+.ygtvitem td { border:none;padding:0; }
/* the style of the div around each node's collection of children */
-.ygtvchildren { }
-* html .ygtvchildren { height:1%; }
+.ygtvchildren { }
+* html .ygtvchildren { height:1%; }
/* the style of the text label in ygTextNode */
.ygtvlabel, .ygtvlabel:link, .ygtvlabel:visited, .ygtvlabel:hover { margin-left:2px; text-decoration: none; }
// //
///////////////////////////////////////////////////////////////////////////
/**
- * repository_client is a javascript class, it contains several static
+ * repository_client is a javascript class, it contains several static
* methods you can call it directly without creating an instance.
* If you are going to create a file picker, you need create an instance
* repo = new repository_client();
var container = new YAHOO.util.Element('repo-list-'+this.client_id);
container.set('innerHTML', '');
container.on('contentReady', function() {
- this.init_search();
+ this.init_search();
for(var i in repository_listing[this.client_id]) {
var repo = repository_listing[this.client_id][i];
var support = false;
repository_client.req_cb = {
success: function(o){
- var data = repository_client.parse_json(o.responseText, 'req_cb');
+ var data = repository_client.parse_json(o.responseText, 'req_cb');
var repo = repository_client.fp[data.client_id];
repo.viewbar.set('disabled', false);
var panel = new YAHOO.util.Element('panel-'+data.client_id);
str += '<td align="left">';
for(var item in list) {
str +='<input type="'+login[k].type+'"'+' name="'+login[k].name+'"'+
- field_id+' value="'+list[item]+'" />'+labels[item]+'<br />';
+ field_id+' value="'+list[item]+'" />'+labels[item]+'<br />';
}
str += '</td>';
}else{
// from viewfiles
list = repository_client.fp[client_id].fs.list;
}else{
- // from callback
+ // from callback
list = data;
}
var panel = new YAHOO.util.Element('panel-'+client_id);
tree.dynload = function (node, fnLoadComplete) {
var callback = {
success: function(o) {
- var json = repository_client.parse_json(o.responseText, 'dynload');
+ var json = repository_client.parse_json(o.responseText, 'dynload');
for(k in json.list) {
repository_client.buildtree(json.client_id, json.list[k], node);
}
if (repository_client.files[client_id] == undefined) {
repository_client.files[client_id] = 0;
}
- if (repository_client.files[client_id] >= repository_client.fp[client_id].maxfiles &&
+ if (repository_client.files[client_id] >= repository_client.fp[client_id].maxfiles &&
repository_client.fp[client_id].maxfiles != -1)
{
alert('Only '+repository_client.fp[client_id].maxfiles+' files are allowed!');
delbtn.innerHTML = "[X]";
delbtn.id = 'del-id-'+String(count);
el.appendChild(delbtn);
- delbtn.itemid=fp.itemid;
+ delbtn.itemid=fp.itemid;
delbtn.client_id=client_id;
delbtn.title=list[k].title;
delbtn.repo_id=fp.fs.repo_id;
this.on('click', function(){
this.folder.fireEvent('click');
});
- });
+ });
el_title.folder = folder;
} else {
var el_title = new YAHOO.util.Element(title.id);
el_title.repo_id = file.repo_id = list[k].repo_id;
}else{
el_title.repo_id = file.repo_id = '';
- }
+ }
file.on('contentReady', function() {
this.on('click', function() {
repository_client.select_file(this.filename, this.value, this.icon, client_id, this.repo_id);
}
repository_client.download_cb = {
success: function(o) {
- var data = repository_client.parse_json(o.responseText, 'download_cb');
+ var data = repository_client.parse_json(o.responseText, 'download_cb');
var panel = new YAHOO.util.Element('panel-'+data.client_id);
if(data && data.e) {
panel.get('element').innerHTML = data.e;
}
repository_client.upload_cb = {
upload: function(o) {
- var ret = repository_client.parse_json(o.responseText, 'upload');
+ var ret = repository_client.parse_json(o.responseText, 'upload');
client_id = ret.client_id;
if(ret && ret.e) {
var panel = new YAHOO.util.Element('panel-'+client_id);
<?php
/**
-* $Id$
-*
* Copyright (c) 2008, Donovan Schönknecht. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
-<?php // $Id$
+<?php
require_once('S3.php');
class repository_s3 extends repository {
$this->s->getObject($bucket, $filename, $path);
return $path;
}
- // login
+ // login
public function check_login() {
return true;
}
* repository_upload class
* A subclass of repository, which is used to upload file
*
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
return get_string('repositoryname', 'repository_upload');
}
}
-?>
+
// @import "..."
foreach ( $matches[3] as $match )
if ( !empty($match) )
- $urls['import'][] =
+ $urls['import'][] =
preg_replace( '/\\\\(.)/u', '\\1', $match );
// @import url(...)
// @import url("...")
foreach ( $matches[7] as $match )
if ( !empty($match) )
- $urls['import'][] =
+ $urls['import'][] =
preg_replace( '/\\\\(.)/u', '\\1', $match );
// url(...)
// url("...")
foreach ( $matches[11] as $match )
if ( !empty($match) )
- $urls['property'][] =
+ $urls['property'][] =
preg_replace( '/\\\\(.)/u', '\\1', $match );
return $urls;
* repository_url class
* A subclass of repository, which is used to download a file from a specific url
*
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
return get_string('repositoryname', 'repository_url');;
}
}
-?>
+
* repository_webdav class
*
* @author Dongsheng Cai
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
}
public function get_listing($path = '', $page = '') {
global $OUTPUT;
- $client = new wikimedia;
+ $client = new wikimedia;
$result = $client->search_images($this->keyword);
$list = array();
$list['list'] = array();
}
return $list;
}
- // login
+ // login
public function check_login() {
return !empty($this->keyword);
}
$search_result['list'] = array();
return $search_result;
}
- // when logout button on file picker is clicked, this function will be
+ // when logout button on file picker is clicked, this function will be
// called.
public function logout() {
return true;
-<?php // $Id$
+<?php
/// The Web service script that is called from the filepicker front end
* repository_youtube class
*
* @author Dongsheng Cai <dongsheng@moodle.com>
- * @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
'date'=>'',
'source'=>$source
);
- }
+ }
return $list;
}