MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trailing whitespace cleanup

This commit is contained in:
Petr Skoda 2009-11-01 12:51:40 +00:00
parent 6bfe7aac8b
commit 4317f92f3f
106 changed files with 437 additions and 457 deletions

View File

@ -9,7 +9,7 @@ of a complete class, take a look at the 'manual' class.
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.
@ -30,40 +30,40 @@ Login-time methods
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
=============================
@ -73,9 +73,9 @@ 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
@ -93,7 +93,7 @@ execute, perhaps offering a config option.
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

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.');
@ -397,4 +397,4 @@ class AuthorizeNet
}
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
if (!isset($frm->enrol_cost)) $frm->enrol_cost = '5';
if (!isset($frm->enrol_currency)) $frm->enrol_currency = 'USD';
@ -64,7 +64,7 @@ if (!isset($frm->acceptechecktypes)) {
<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);

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
/**#@+
* Authorize.net payment methods.
@ -89,4 +89,4 @@ define('AN_ERROR', 3);
define('AN_REVIEW', 4);
/**#@-*/
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
$enrol_authorize_capabilities = array(
@ -22,4 +22,4 @@ $enrol_authorize_capabilities = array(
);
?>

View File

@ -1,4 +1,4 @@
<?php //$Id$
<?php
// This file keeps track of upgrades to
// the authorize enrol plugin
@ -97,4 +97,4 @@ function xmldb_enrol_authorize_upgrade($oldversion) {
return $result;
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once($CFG->dirroot.'/enrol/enrol.class.php');
require_once($CFG->dirroot.'/enrol/authorize/const.php');
@ -902,4 +902,4 @@ class enrolment_plugin_authorize
$rs->close();
}
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once($CFG->libdir.'/formslib.php');
@ -74,13 +74,13 @@ class enrol_authorize_form extends moodleform
$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);
@ -95,7 +95,7 @@ class enrol_authorize_form extends moodleform
$ccauthgrp[] = &$mform->createElement('text', 'ccauthcode', '', 'size="8"');
$mform->addGroup($ccauthgrp, 'ccauthgrp', get_string('authcode', 'enrol_authorize'), '&nbsp;', 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);
@ -345,4 +345,4 @@ class enrol_authorize_form extends moodleform
}
}
?>

View File

@ -50,4 +50,4 @@
else {
authorize_print_order($orderid);
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once($CFG->libdir.'/eventslib.php');
@ -261,4 +261,4 @@ function authorize_verify_account()
return $ret;
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
if (!defined('MOODLE_INTERNAL')) {
die('Direct access to this script is forbidden.');
@ -67,7 +67,7 @@ function authorize_print_orders($courseid, $userid) {
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 />';
@ -682,4 +682,4 @@ function authorize_print_action_button($orderid, $do, $suborderid=0, $confirm=fa
}
return $ret;
}
?>

View File

@ -231,7 +231,7 @@ function authorize_process_csv($filename)
/// Send email to admin
if (!empty($ignoredlines)) {
$admin = get_admin();
$eventdata = new object();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $admin;
@ -240,7 +240,7 @@ function authorize_process_csv($filename)
$eventdata->fullmessage = $ignoredlines;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
$eventdata->smallmessage = '';
events_trigger('message_send', $eventdata);
}
@ -253,4 +253,4 @@ function authorize_process_csv($filename)
notice("<b>Done...</b><br />Imported: $imported<br />Updated: $updated<br />Ignored: $ignored");
}
?>

View File

@ -1,6 +1,6 @@
<?php // $Id$
<?php
$plugin->version = 2009042700;
$plugin->requires = 2007101507;
?>

View File

@ -11,7 +11,7 @@
<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;
@ -23,7 +23,7 @@
$select->nothingvalue = '';
echo $OUTPUT->select($select);
?>
</td>
<td>
<?php print_string("dbtype","enrol_database") ?>
@ -33,10 +33,10 @@
<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>
@ -161,9 +161,9 @@
$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>
@ -181,7 +181,7 @@
<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>
@ -197,7 +197,7 @@
$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>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once($CFG->dirroot.'/enrol/enrol.class.php');
@ -276,7 +276,7 @@ function sync_enrolments($role = null) {
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)});
@ -675,4 +675,4 @@ function role_fields($enroldb, $role) {
} // end of class
?>

View File

@ -1,11 +1,11 @@
<?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');
@ -28,14 +28,14 @@
$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();
}
?>

View File

@ -10,7 +10,7 @@ require_once($CFG->libdir.'/eventslib.php');
class enrolment_plugin_flatfile {
var $log;
var $log;
/// Override the base config_form() function
function config_form($frm) {
@ -20,7 +20,7 @@ function config_form($frm) {
foreach ($vars as $var) {
if (!isset($frm->$var)) {
$frm->$var = '';
}
}
}
$roles = $DB->get_records('role', null, '', 'id, name, shortname');
@ -34,8 +34,8 @@ function config_form($frm) {
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");
}
@ -102,17 +102,17 @@ function get_access_icons($course) {
}
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) ) );
@ -124,15 +124,15 @@ function get_access_icons($course) {
}
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]);
@ -140,7 +140,7 @@ function get_access_icons($course) {
} else {
$fields[4] = 0;
$fields[5] = 0;
}
}
$this->log .= ":";
@ -185,16 +185,16 @@ function get_access_icons($course) {
// 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')) {
@ -213,11 +213,11 @@ function get_access_icons($course) {
$teacher = get_admin();
}
if (!empty($CFG->enrol_mailstudents)) {
$a->coursename = "$course->fullname";
$a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id&amp;course=$course->id";
$eventdata = new object();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = $teacher;
@ -233,11 +233,11 @@ function get_access_icons($course) {
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;
@ -246,7 +246,7 @@ function get_access_icons($course) {
$eventdata->fullmessage = get_string('enrolmentnewuser', '', $a);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
$eventdata->smallmessage = '';
events_trigger('message_send', $eventdata);
}
}
@ -323,4 +323,4 @@ function get_access_icons($course) {
} // end of class
?>

View File

@ -12,16 +12,16 @@ Please see INSTALL.txt.
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
@ -31,27 +31,27 @@ demands this, but the 1.0 spec does not make this restriction.)
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.

View File

@ -8,12 +8,12 @@ TO DO:
- 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
@ -22,7 +22,7 @@ DONE:
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

View File

@ -24,7 +24,7 @@
<input type="checkbox" value="1" name="enrol_mailadmins" <?php if ($frm->enrol_mailadmins) echo "checked=\"checked\"" ?> />
</td>
<td>
</td>
</tr>
@ -58,7 +58,7 @@
<input type="checkbox" value="1" name="enrol_fixcaseusernames" <?php if ($frm->enrol_fixcaseusernames) echo "checked=\"checked\"" ?> />
</td>
<td>
</td>
</tr>
@ -68,7 +68,7 @@
<input type="checkbox" value="1" name="enrol_fixcasepersonalnames" <?php if ($frm->enrol_fixcasepersonalnames) echo "checked=\"checked\"" ?> />
</td>
<td>
</td>
</tr>
@ -78,7 +78,7 @@
<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>
<!--
@ -114,10 +114,10 @@ foreach($this->imsroles as $imsrolenum=>$imsrolename){
<td align="right">&quot;<?php echo $imsrolename ?>&quot;&nbsp;(<?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>

View File

@ -379,7 +379,7 @@ function cron() {
}else{
$msg .= "Logging is currently not active.";
}
$eventdata = new object();
$eventdata->modulename = 'moodle';
$eventdata->userfrom = get_admin();
@ -388,7 +388,7 @@ function cron() {
$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.');
@ -876,4 +876,4 @@ function load_role_mappings() {
} // end of class
?>

View File

@ -19,7 +19,7 @@ td.n {background-color: rgb(255, 230, 230);}
<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>
@ -85,7 +85,7 @@ td.n {background-color: rgb(255, 230, 230);}
<tr>
<td>&nbsp;&nbsp;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>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<enterprise>
<enterprise>
<properties lang="EN"><!-- ccc -->
<datasource>sits:vision</datasource>
<datetime>28/Oct/2005</datetime>
@ -26,7 +26,7 @@
<sourcedid>
<source>sits:vision</source>
<id>90078058</id>
</sourcedid>
</sourcedid>
<userid>IMGBY26</userid>
<name>
<fn>Chloe Eva Piotrowska </fn>
@ -126,7 +126,7 @@
<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>

View File

@ -1,5 +1,5 @@
<?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>

View File

@ -1 +1 @@

View File

@ -75,13 +75,13 @@ foreach($roles as $role) {
// 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 = '';
}
?>
@ -109,7 +109,7 @@ if (!isset($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>
@ -219,9 +219,9 @@ if (!isset($frm->enrol_ldap_template)) {
</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>
@ -262,7 +262,7 @@ if (!isset($frm->enrol_ldap_template)) {
<?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>
@ -320,7 +320,7 @@ if (!isset($frm->enrol_ldap_template)) {
<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") ?>
@ -352,7 +352,7 @@ if (!isset($frm->enrol_ldap_template)) {
<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>
@ -367,7 +367,7 @@ if (!isset($frm->enrol_ldap_template)) {
$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>

View File

@ -4,8 +4,8 @@ require_once("$CFG->dirroot/enrol/enrol.class.php");
class enrolment_plugin_ldap {
var $log;
var $log;
var $enrol_localcoursefield = 'idnumber';
/**
@ -23,7 +23,7 @@ function setup_enrolments(&$user) {
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
@ -37,7 +37,7 @@ function setup_enrolments(&$user) {
if (!$roleassignments) {
$roleassignments = array();
}
// Get the ones that came from LDAP
$ldap_assignments = array_filter($roleassignments, create_function('$x', 'return $x->enrol == \'ldap\';'));
@ -46,20 +46,20 @@ function setup_enrolments(&$user) {
// 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));
@ -72,18 +72,18 @@ function setup_enrolments(&$user) {
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})");
}
@ -113,7 +113,7 @@ function setup_enrolments(&$user) {
@ldap_close($ldap_connection);
//error_log('[ENROL_LDAP] finished with setup_enrolments');
return true;
}
@ -135,7 +135,7 @@ function sync_enrolments($type, $enrol = false) {
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);
@ -143,7 +143,7 @@ function sync_enrolments($type, $enrol = false) {
$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);
@ -159,11 +159,11 @@ function sync_enrolments($type, $enrol = false) {
}
// 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...
@ -174,19 +174,19 @@ function sync_enrolments($type, $enrol = false) {
$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)
@ -195,9 +195,9 @@ function sync_enrolments($type, $enrol = false) {
// 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)) {
@ -206,7 +206,7 @@ function sync_enrolments($type, $enrol = false) {
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)) {
@ -228,17 +228,17 @@ function sync_enrolments($type, $enrol = false) {
$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 = '
@ -267,20 +267,20 @@ function sync_enrolments($type, $enrol = false) {
}
}
}
// 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";
@ -293,10 +293,10 @@ function sync_enrolments($type, $enrol = false) {
}
}
}
// we are done now, a bit of housekeeping
fix_course_sortorder();
@ldap_close($ldap_connection);
return true;
}
@ -312,7 +312,7 @@ function config_form($frm) {
global $CFG;
$this->check_legacy_config();
include("$CFG->dirroot/enrol/ldap/config.html");
}
@ -331,7 +331,7 @@ function process_config($config) {
$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 = '';
}
@ -340,58 +340,58 @@ function process_config($config) {
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';
}
@ -402,11 +402,11 @@ function process_config($config) {
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});
}
@ -427,7 +427,7 @@ function enrol_ldap_connect(){
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");
@ -456,11 +456,11 @@ function enrol_ldap_bind($ldap_connection){
}
} else {
//bind anonymously
//bind anonymously
if ( !ldap_bind($ldap_connection)){
echo $OUTPUT->notification("Error: could not bind ldap anonymously");
return false;
}
}
}
return true;
@ -469,13 +469,13 @@ function enrol_ldap_bind($ldap_connection){
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();
@ -485,7 +485,7 @@ function find_ext_enrolments ($ldap_connection, $memberuid, $role){
$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);
@ -499,7 +499,7 @@ function find_ext_enrolments ($ldap_connection, $memberuid, $role){
// 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.')';
}
@ -508,31 +508,31 @@ function find_ext_enrolments ($ldap_connection, $memberuid, $role){
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);
}
@ -543,7 +543,7 @@ function find_ext_enrolments ($ldap_connection, $memberuid, $role){
// 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){
@ -566,7 +566,7 @@ 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));
@ -596,8 +596,8 @@ function create_course ($course_ext,$skip_fix_course_sortorder=0){
$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 {
@ -605,7 +605,7 @@ function create_course ($course_ext,$skip_fix_course_sortorder=0){
echo $OUTPUT->notification("Serious Error! Could not create the new course!");
return false;
}
return $newcourseid;
}
@ -642,7 +642,7 @@ function check_legacy_config () {
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'))) {

View File

@ -5,7 +5,7 @@
exit;
}
error_reporting(E_ALL);
require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); // global moodle config file.
require_once($CFG->dirroot . '/course/lib.php');
@ -26,10 +26,10 @@
foreach ($roles as $role) {
$enrol->sync_enrolments($role->shortname, true);
}
// sync metacourses
if (function_exists('sync_metacourses')) {
sync_metacourses();
}
?>

View File

@ -3,13 +3,13 @@
<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>

View File

@ -1,4 +1,4 @@
<?php /// $Id$
<?php
///////////////////////////////////////////////////////////////////////////
// //
// NOTICE OF COPYRIGHT //
@ -329,7 +329,7 @@ function cron() {
$eventdata->fullmessage = $strexpirynotifystudentsemail;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
$eventdata->smallmessage = '';
events_trigger('message_send', $eventdata);
}
}
@ -354,7 +354,7 @@ function cron() {
$eventdata->fullmessage = $strexpirynotifyemail;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
$eventdata->smallmessage = '';
events_trigger('message_send', $eventdata);
}
}
@ -455,4 +455,4 @@ function print_enrolmentkeyfrom($course) {
} /// end of class
?>

View File

@ -124,7 +124,7 @@ if ($courses = $DB->get_records('course', null, 'shortname', 'id, shortname')) {
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

View File

@ -66,7 +66,7 @@ class enrolment_plugin_mnet {
***
***/
function mnet_publishes() {
$enrol = array();
$enrol['name'] = 'mnet_enrol'; // Name & Description go in lang file
$enrol['apiversion'] = 1;
@ -102,7 +102,7 @@ class enrolment_plugin_mnet {
co.cost,
co.currency,
co.defaultrole AS defaultroleid,
r.name AS defaultrolename
r.name AS defaultrolename
FROM
{course_categories} ca
JOIN
@ -225,7 +225,7 @@ class enrolment_plugin_mnet {
}
/**
*
*
*/
function user_enrolments($userid) {
return array();
@ -236,7 +236,7 @@ class enrolment_plugin_mnet {
*
* @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 = '') {
@ -272,15 +272,15 @@ class enrolment_plugin_mnet {
// $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);
}
@ -385,10 +385,10 @@ class enrolment_plugin_mnet {
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
@ -443,7 +443,7 @@ class enrolment_plugin_mnet {
$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;
@ -592,4 +592,4 @@ class enrolment_plugin_mnet {
} // end of class
?>

View File

@ -13,7 +13,7 @@
<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 = '';

View File

@ -1,6 +1,6 @@
<?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
@ -26,8 +26,8 @@ function xmldb_enrol_paypal_upgrade($oldversion) {
$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.
@ -38,4 +38,4 @@ function xmldb_enrol_paypal_upgrade($oldversion) {
return $result;
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
// Implements all the main code for the PayPal plugin
require_once("$CFG->dirroot/enrol/enrol.class.php");
@ -218,4 +218,4 @@ function print_enrolmentkeyfrom($course) {
} // end of class definition
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
/**
* Listens for Instant Payment Notification from PayPal
@ -98,7 +98,7 @@
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);
@ -193,7 +193,7 @@
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;
@ -204,13 +204,13 @@
$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;
@ -219,15 +219,15 @@
$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;
@ -280,4 +280,4 @@ function message_paypal_error_to_admin($subject, $data) {
events_trigger('message_send', $eventdata);
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require("../../config.php");
require_once("$CFG->dirroot/enrol/paypal/enrol.php");
@ -24,7 +24,7 @@
} else {
$destination = "$CFG->wwwroot/course/view.php?id=$course->id";
}
if (has_capability('moodle/course:view', $context)) {
redirect($destination, get_string('paymentthanks', '', $course->fullname));
@ -34,4 +34,4 @@
notice(get_string('paymentsorry', '', get_string('defaultcourseteacher')), $destination);
}
?>

View File

@ -1,4 +1,4 @@
<?PHP // $Id$
<?php
/////////////////////////////////////////////////////////////////////////////////
/// Code fragment to define the version of this enrolment module
@ -9,4 +9,4 @@ $plugin->version = 2006092200; // This module's version
$plugin->requires = 2007101000; // Requires this Moodle version
?>

View File

@ -1,4 +1,4 @@
<?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
@ -18,7 +18,7 @@ class activitynames_filter extends moodle_text_filter {
// 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
@ -47,7 +47,7 @@ class activitynames_filter extends moodle_text_filter {
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));
@ -82,4 +82,4 @@ function comparemodulenamesbylength($a, $b) {
}
return (strlen($a->name) < strlen($b->name)) ? 1 : -1;
}
?>

View File

@ -300,7 +300,7 @@ function slasharguments($texexp, $md5) {
</form> <br /> <br />
<center>
<iframe name="inlineframe" align="middle" width="80%" height="200">
&lt;p&gt;Something is wrong...&lt;/p&gt;
&lt;p&gt;Something is wrong...&lt;/p&gt;
</iframe>
</center> <br />
<hr />
@ -340,7 +340,7 @@ 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/algebra/pix.php file to add
edit your moodle/filter/algebra/pix.php file to add
<br /><?PHP echo "case &quot;" . PHP_OS . "&quot;:" ;?><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>

View File

@ -233,4 +233,4 @@ class algebra_filter extends moodle_text_filter {
}
}
?>

View File

@ -6,7 +6,7 @@
// 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')) {

View File

@ -4,8 +4,8 @@
// //
//////////////////////////
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

View File

@ -1,22 +1,22 @@
<?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;
}
@ -59,4 +59,4 @@ class censor_filter extends moodle_text_filter {
}
}
?>

View File

@ -1,6 +1,6 @@
<?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'), ''));
?>

View File

@ -1,6 +1,6 @@
<?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 {
@ -36,4 +36,4 @@ function alter_mailto($matches) {
return obfuscate_mailto($matches[2], $matches[4]);
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
///////////////////////////////////////////////////////////////////////////
// //
@ -88,4 +88,3 @@ abstract class filter_local_settings_form extends moodleform {
}
}
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
///////////////////////////////////////////////////////////////////////////
// //
@ -214,4 +214,4 @@ if (!$isfrontpage && ($url = get_context_url($context))) {
}
echo $OUTPUT->footer();
?>

View File

@ -35,7 +35,7 @@
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);

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
//////////////////////////////////////////////////////////////
// Media plugin filtering
//
@ -257,8 +257,8 @@ function mediaplugin_filter_youtube_callback($link, $autostart=false) {
$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.'&amp;fs=1&amp;rel=0" width="425" height="344">'.
'<param name="movie" value="'.$site.'youtube.com/v/'.$url.'&amp;fs=1&amp;rel=0" />'.
'<param name="FlashVars" value="playerMode=embedded" />'.
@ -358,4 +358,4 @@ function mediaplugin_filter_qt_callback($link, $autostart=false) {
</object></span>';
}
?>

View File

@ -1,4 +1,4 @@
<?php //$Id$
<?php
$settings->add(new admin_setting_configcheckbox('filter_mediaplugin_enable_mp3', get_string('mediapluginmp3','admin'), '', 1));
@ -24,4 +24,4 @@ $settings->add(new admin_setting_configcheckbox('filter_mediaplugin_enable_youtu
$settings->add(new admin_setting_configcheckbox('filter_mediaplugin_enable_img', get_string('mediapluginimg','admin'), '', 1));
?>

View File

@ -1,4 +1,4 @@
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!

View File

@ -1,8 +1,6 @@
$Id$
To Install it:
- Enable if from "Administration/Filters".
To Use it:
- Create your contents in multiple languages.
- Enclose every language content between:
@ -36,7 +34,7 @@ One example in action:
Hola!
This text is common for every language because it's out from any lang block.
Bye!
Ciao, Eloy :-)
stronk7@moodle.org

View File

@ -1,4 +1,4 @@
<?php //$Id$
<?php
///////////////////////////////////////////////////////////////////////////
// //
@ -43,7 +43,7 @@ class multilang_filter extends moodle_text_filter {
// [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;
@ -105,4 +105,4 @@ function multilang_filter_impl($langblock) {
}
}
?>

View File

@ -1,6 +1,6 @@
<?php //$Id$
<?php
$settings->add(new admin_setting_configcheckbox('filter_multilang_force_old', 'filter_multilang_force_old',
get_string('multilangforceold', 'admin'), 0));
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
// This script displays tex source code.
require_once('../../config.php');

View File

@ -68,10 +68,10 @@ function string_file_picture_tex($imagefile, $tex= "", $height="", $width="", $a
$tex = str_replace('"','&quot;',$tex);
$tex = str_replace("\'",'&#39;',$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\"";
}
@ -172,4 +172,4 @@ class tex_filter extends moodle_text_filter {
}
}
?>

View File

@ -1,4 +1,4 @@
<?php //$Id$
<?php
require_once($CFG->dirroot.'/filter/tex/lib.php');
@ -42,4 +42,4 @@ foreach ($items as $item) {
$item->set_updatedcallback('filter_tex_updatedcallback');
$settings->add($item);
}
?>

View File

@ -1,8 +1,8 @@
<?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 {
@ -16,8 +16,8 @@
* 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")) {
@ -30,7 +30,7 @@
}
/**
* Accessor function for support_platform field.
* Accessor function for support_platform field.
* @return boolean value of supported_platform
*/
function supported() {
@ -49,7 +49,7 @@
$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";
@ -63,7 +63,7 @@
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
@ -92,9 +92,9 @@
* @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;
@ -118,7 +118,7 @@
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";
@ -158,4 +158,4 @@
}
?>

View File

@ -1,4 +1,4 @@
<?php //$Id$
<?php
function tex_filter_get_executable($debug=false) {
global $CFG;
@ -86,4 +86,4 @@ function filter_tex_updatedcallback($name) {
$DB->delete_records('cache_filters', array('filter'=>'algebra'));
}
?>

View File

@ -1,4 +1,4 @@
<?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
@ -301,7 +301,7 @@
</form> <br /> <br />
<center>
<iframe name="inlineframe" align="middle" width="80%" height="200">
&lt;p&gt;Something is wrong...&lt;/p&gt;
&lt;p&gt;Something is wrong...&lt;/p&gt;
</iframe>
</center> <br />
<hr />
@ -316,7 +316,7 @@ tag. The filter/tex/pix.php script then searches the database to find an
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>
@ -324,27 +324,27 @@ you might try to fix them.</p>
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 &quot;Delete DB Entry&quot;</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 &quot;" . PHP_OS . "&quot;:" ;?><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>

View File

@ -1,4 +1,4 @@
<?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

View File

@ -1,26 +1,26 @@
<?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,
@ -30,13 +30,13 @@ class tidy_filter extends moodle_text_filter {
'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');
@ -45,4 +45,4 @@ class tidy_filter extends moodle_text_filter {
return $text;
}
}
?>

View File

@ -233,4 +233,4 @@ if ($postcontrol) { // the magic request variable plugins must pass on returning
// actually do the work now..
$exporter->process_stage($stage, $alreadystolen);
?>

View File

@ -79,4 +79,4 @@ if (count($table->data) > 0) {
echo $OUTPUT->footer();
?>

View File

@ -59,4 +59,4 @@ if (!$exporter->get('instance')->verify_file_request_params(array_merge($_GET, $
$exporter->get('instance')->send_file();
$exporter->process_stage_cleanup(true);
exit;
?>

View File

@ -1,4 +1,4 @@
<?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");
@ -56,4 +56,4 @@ class testPortfolioPluginBoxnet extends portfoliolib_test {
$this->assertTrue($this->plugin->send_package());
}
}
?>

View File

@ -4,4 +4,4 @@ $plugin->version = 2008072500;
$plugin->requires = 2008072500;
$plugin->cron = 0;
?>

View File

@ -37,4 +37,4 @@ echo '<div id="redirect">
echo $OUTPUT->footer();
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once($CFG->libdir.'/simpletest/testportfoliolib.php');
require_once($CFG->dirroot.'/portfolio/type/download/lib.php');
@ -19,4 +19,4 @@ class testPortfolioPluginDownload extends portfoliolib_test {
}
}
?>

View File

@ -4,4 +4,4 @@ $plugin->version = 2008072500;
$plugin->requires = 2008072500;
$plugin->cron = 0;
?>

View File

@ -4,4 +4,4 @@ $plugin->version = 2008072500;
$plugin->requires = 2008072500;
$plugin->cron = 0;
?>

View File

@ -1,11 +1,11 @@
<?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'
),
);
?>

View File

@ -1,9 +1,8 @@
<?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');
@ -21,7 +20,7 @@ class portfolio_plugin_googledocs extends portfolio_plugin_push_base {
public function prepare_package() {
// we send the files as they are, no prep required
return true;
return true;
}
public function get_continue_url(){
@ -89,7 +88,7 @@ class portfolio_plugin_googledocs extends portfolio_plugin_push_base {
}
/**
* 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
@ -110,5 +109,5 @@ function portfolio_googledocs_user_deleted($user){
}
}
return true;
return true;
}

View File

@ -1,6 +1,6 @@
<?php // $Id$
<?php
$plugin->version = 2008072505;
$plugin->requires = 2008072500;
$plugin->cron = 0;
?>

View File

@ -1,4 +1,4 @@
<?php //$Id$
<?php
// This file keeps track of upgrades to
// the portfolio/mahara plugin

View File

@ -354,4 +354,4 @@ class portfolio_plugin_mahara extends portfolio_plugin_pull_base {
}
}
?>

View File

@ -28,4 +28,4 @@ if (!$landed = optional_param('landed', false, PARAM_BOOL)) {
$exporter->get('instance')->send_intent();
redirect($CFG->wwwroot . '/portfolio/add.php?postcontrol=1&id=' . $exporter->get('id'));
}
?>

View File

@ -4,4 +4,4 @@ $plugin->version = 2008072500;
$plugin->requires = 2008072500;
$plugin->cron = 0;
?>

View File

@ -1,11 +1,11 @@
<?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'
),
);
?>

View File

@ -1,9 +1,8 @@
<?php
<?php
/**
* Picasa Portfolio Plugin
*
* @author Dan Poltawski <talktodan@gmail.com>
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
@ -22,7 +21,7 @@ class portfolio_plugin_picasa extends portfolio_plugin_push_base {
public function prepare_package() {
// we send the files as they are, no prep required
return true;
return true;
}
public function get_continue_url(){
@ -90,7 +89,7 @@ class portfolio_plugin_picasa extends portfolio_plugin_push_base {
}
/**
* 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
@ -111,5 +110,5 @@ function portfolio_picasa_user_deleted($user){
}
}
return true;
return true;
}

View File

@ -1,7 +1,7 @@
<?php // $Id$
<?php
$plugin->version = 2008072505;
$plugin->requires = 2008072500;
$plugin->cron = 0;
?>

View File

@ -2,7 +2,6 @@
/**
* repository_alfresco class
*
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
@ -51,7 +50,7 @@ class repository_alfresco extends repository {
$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';
@ -203,4 +202,4 @@ class repository_alfresco extends repository {
}
}
}
?>

View File

@ -6,7 +6,6 @@ require_once($CFG->libdir.'/boxlib.php');
* 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 {
@ -32,7 +31,7 @@ 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;
@ -149,7 +148,7 @@ class repository_boxnet extends repository {
$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/'
@ -199,7 +198,7 @@ class repository_boxnet extends repository {
$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';
@ -244,4 +243,4 @@ class repository_boxnet extends repository {
$mform->addElement('static', null, '', get_string('information','repository_boxnet'));
}
}
?>

View File

@ -3,7 +3,6 @@
* 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 {
@ -102,4 +101,4 @@ class repository_draft extends repository {
return get_string('repositoryname', 'repository_draft');;
}
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
/**
* repository_filesystem class

View File

@ -4,7 +4,6 @@
* 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
*/
@ -169,7 +168,7 @@ class repository_flickr extends repository {
$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'),

View File

@ -27,8 +27,8 @@ class moodle_image {
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;
@ -114,7 +114,7 @@ class moodle_image {
case 'image/png':
return imagepng($this->image, $imagepath);
break;
case 'image/gif':
case 'image/gif':
return imagegif($this->image, $imagepath);
break;
default:

View File

@ -6,7 +6,6 @@
* 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
*/
@ -266,7 +265,7 @@ class repository_flickr_public extends repository {
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,
@ -336,7 +335,7 @@ class repository_flickr_public extends repository {
// 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'),

View File

@ -3,7 +3,6 @@
* Google Docs Plugin
*
* @author Dan Poltawski <talktodan@gmail.com>
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
@ -44,16 +43,16 @@ class repository_googledocs extends repository {
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;
}
}

View File

@ -3,7 +3,6 @@
* repository_local class
* This is a subclass of repository class
*
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
@ -160,4 +159,4 @@ class repository_local extends repository {
return get_string('repositoryname', 'repository_local');;
}
}
?>

View File

@ -88,7 +88,7 @@ class repository_mahara extends repository {
//set session
$SESSION->loginmahara = true;
$ret = array();
$popup_btn = new stdclass;
$popup_btn->type = 'popup';
@ -176,7 +176,7 @@ class repository_mahara extends repository {
} else {
$client->add_param($search);
}
///call the method and manage host error
if (!$client->send($mnet_peer)) {
$message =" ";
@ -219,7 +219,7 @@ class repository_mahara extends repository {
$list[] = array( 'title'=>$file['title'], 'date'=>$file['mtime'], 'source'=>$file['id'], 'thumbnail' => $thumbnail);
}
}
$filepickerlisting = array(
'path' => $newpath,
@ -343,4 +343,4 @@ class repository_mahara extends repository {
return array('peer');
}
}
?>

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once(dirname(dirname(__FILE__)) . '/config.php');
require_once($CFG->dirroot . '/repository/lib.php');

View File

@ -3,7 +3,6 @@
* Picasa Repository Plugin
*
* @author Dan Poltawski <talktodan@gmail.com>
* @version $Id$
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
@ -44,17 +43,17 @@ class repository_picasa extends repository {
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>';
}

View File

@ -4,7 +4,6 @@
* 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
*/
@ -322,4 +321,4 @@ class repository_remotemoodle extends repository {
return array('peer');
}
}
?>

View File

@ -22,17 +22,17 @@
.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; }

View File

@ -4,7 +4,7 @@
// //
///////////////////////////////////////////////////////////////////////////
/**
* 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();
@ -173,7 +173,7 @@ var repository_client = (function(){
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;
@ -265,7 +265,7 @@ repository_client.req = function(client_id, id, path, page) {
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);
@ -370,7 +370,7 @@ repository_client.print_login = function(id, data) {
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{
@ -494,7 +494,7 @@ repository_client.view_as_list = function(client_id, data) {
// 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);
@ -507,7 +507,7 @@ repository_client.view_as_list = function(client_id, data) {
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);
}
@ -590,7 +590,7 @@ repository_client.select_file = function(oldname, url, icon, client_id, repo_id)
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!');
@ -800,7 +800,7 @@ repository_client.view_as_icons = function(client_id, data) {
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;
@ -852,7 +852,7 @@ repository_client.view_as_icons = function(client_id, data) {
this.on('click', function(){
this.folder.fireEvent('click');
});
});
});
el_title.folder = folder;
} else {
var el_title = new YAHOO.util.Element(title.id);
@ -866,7 +866,7 @@ repository_client.view_as_icons = function(client_id, data) {
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);
@ -1015,7 +1015,7 @@ repository_client.download = function(client_id, 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;
@ -1109,7 +1109,7 @@ repository_client.upload = function(client_id) {
}
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);

View File

@ -1,7 +1,5 @@
<?php
/**
* $Id$
*
* Copyright (c) 2008, Donovan Schönknecht. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once('S3.php');
class repository_s3 extends repository {
@ -63,7 +63,7 @@ class repository_s3 extends repository {
$this->s->getObject($bucket, $filename, $path);
return $path;
}
// login
// login
public function check_login() {
return true;
}

View File

@ -3,7 +3,6 @@
* 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
*/
@ -72,4 +71,4 @@ class repository_upload extends repository {
return get_string('repositoryname', 'repository_upload');
}
}
?>

Some files were not shown because too many files have changed in this diff Show More