summaryrefslogtreecommitdiff
path: root/sqlbox
diff options
context:
space:
mode:
authorJan Klemkow <j.klemkow@wemelug.de>2012-10-09 15:28:22 +0200
committerJan Klemkow <j.klemkow@wemelug.de>2012-10-09 15:28:22 +0200
commit5c7511c7c64f62f44244ba1c9f1aac9952c564e1 (patch)
tree9f10a75a48b2d7df333ada2f6d750dddf430bafb /sqlbox
parent459313e56b0653e4709694a7e86afc11be514097 (diff)
downloadsqltutor-plugin-5c7511c7c64f62f44244ba1c9f1aac9952c564e1.tar.gz
sqltutor-plugin-5c7511c7c64f62f44244ba1c9f1aac9952c564e1.tar.bz2
sqltutor-plugin-5c7511c7c64f62f44244ba1c9f1aac9952c564e1.zip
Rename 'newmodule' into sqlbox in all files.
Diffstat (limited to 'sqlbox')
-rw-r--r--sqlbox/README.txt10
-rw-r--r--sqlbox/db/access.php8
-rw-r--r--sqlbox/db/install.php6
-rw-r--r--sqlbox/db/install.xml8
-rw-r--r--sqlbox/db/log.php10
-rw-r--r--sqlbox/db/uninstall.php4
-rw-r--r--sqlbox/db/upgrade.php42
-rw-r--r--sqlbox/index.php30
-rw-r--r--sqlbox/lang/en/sqlbox.php (renamed from sqlbox/lang/en/newmodule.php)22
-rw-r--r--sqlbox/lib.php136
-rw-r--r--sqlbox/locallib.php8
-rw-r--r--sqlbox/mod_form.php18
-rw-r--r--sqlbox/version.php6
-rw-r--r--sqlbox/view.php30
14 files changed, 168 insertions, 170 deletions
diff --git a/sqlbox/README.txt b/sqlbox/README.txt
index 3b8a9ec..5c5931a 100644
--- a/sqlbox/README.txt
+++ b/sqlbox/README.txt
@@ -5,17 +5,17 @@ this module template code.
* Unzip the archive and read this file
-* Rename the newmodule/ folder to the name of your module (eg "widget").
+* Rename the sqlbox/ folder to the name of your module (eg "widget").
The module folder MUST be lower case. You should check the CVS contrib
area at http://cvs.moodle.org/contrib/plugins/mod/ to make sure that
your name is not already used by an other module.
* Edit all the files in this directory and its subdirectories and change
- all the instances of the string "newmodule" to your module name
+ all the instances of the string "sqlbox" to your module name
(eg "widget"). If you are using Linux, you can use the following command
- $ find . -type f -exec sed -i 's/newmodule/widget/g' {} \;
+ $ find . -type f -exec sed -i 's/sqlbox/widget/g' {} \;
-* Rename the file lang/en/newmodule.php to lang/en/widget.php
+* Rename the file lang/en/sqlbox.php to lang/en/widget.php
where "widget" is the name of your module
* Place the widget folder into the /mod folder of the moodle
@@ -30,7 +30,7 @@ this module template code.
the module's tables successfully created
* Go to Site Administration > Plugins > Activity modules > Manage activities
- and you should find that this newmodule has been added to the list of
+ and you should find that this sqlbox has been added to the list of
installed modules.
* You may now proceed to run your own code in an attempt to develop
diff --git a/sqlbox/db/access.php b/sqlbox/db/access.php
index 71647d3..9722601 100644
--- a/sqlbox/db/access.php
+++ b/sqlbox/db/access.php
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Capability definitions for the newmodule module
+ * Capability definitions for the sqlbox module
*
* The capabilities are loaded into the database table when the module is
* installed or updated. Whenever the capability definitions are updated,
@@ -41,7 +41,7 @@
* The variable name for the capability definitions array is $capabilities
*
* @package mod
- * @subpackage newmodule
+ * @subpackage sqlbox
* @copyright 2011 Your Name
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -51,7 +51,7 @@ defined('MOODLE_INTERNAL') || die();
$capabilities = array(
/***************************** remove these comment marks and modify the code as needed
- 'mod/newmodule:view' => array(
+ 'mod/sqlbox:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
@@ -63,7 +63,7 @@ $capabilities = array(
)
),
- 'mod/newmodule:submit' => array(
+ 'mod/sqlbox:submit' => array(
'riskbitmask' => RISK_SPAM,
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
diff --git a/sqlbox/db/install.php b/sqlbox/db/install.php
index d81ba97..4b3c1e7 100644
--- a/sqlbox/db/install.php
+++ b/sqlbox/db/install.php
@@ -20,7 +20,7 @@
* lib.php/modulename_install() post installation hook and partially defaults.php
*
* @package mod
- * @subpackage newmodule
+ * @subpackage sqlbox
* @copyright 2011 Your Name <your@email.adress>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -30,7 +30,7 @@
*
* @see upgrade_plugins_modules()
*/
-function xmldb_newmodule_install() {
+function xmldb_sqlbox_install() {
}
/**
@@ -38,5 +38,5 @@ function xmldb_newmodule_install() {
*
* @see upgrade_plugins_modules()
*/
-function xmldb_newmodule_install_recovery() {
+function xmldb_sqlbox_install_recovery() {
}
diff --git a/sqlbox/db/install.xml b/sqlbox/db/install.xml
index d5d861b..f83ed09 100644
--- a/sqlbox/db/install.xml
+++ b/sqlbox/db/install.xml
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="mod/newmodule/db" VERSION="20101203" COMMENT="XMLDB file for Moodle mod/newmodule"
+<XMLDB PATH="mod/sqlbox/db" VERSION="20101203" COMMENT="XMLDB file for Moodle mod/sqlbox"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
- <TABLE NAME="newmodule" COMMENT="Default comment for newmodule, please edit me">
+ <TABLE NAME="sqlbox" COMMENT="Default comment for sqlbox, please edit me">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="course"/>
- <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="Course newmodule activity belongs to" PREVIOUS="id" NEXT="name"/>
+ <FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" COMMENT="Course sqlbox activity belongs to" PREVIOUS="id" NEXT="name"/>
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="name field for moodle instances" PREVIOUS="course" NEXT="intro"/>
- <FIELD NAME="intro" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="General introduction of the newmodule activity" PREVIOUS="name" NEXT="introformat"/>
+ <FIELD NAME="intro" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="General introduction of the sqlbox activity" PREVIOUS="name" NEXT="introformat"/>
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" COMMENT="Format of the intro field (MOODLE, HTML, MARKDOWN...)" PREVIOUS="intro" NEXT="timecreated"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" PREVIOUS="introformat" NEXT="timemodified"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="timecreated"/>
diff --git a/sqlbox/db/log.php b/sqlbox/db/log.php
index 73561d7..6ddcc2a 100644
--- a/sqlbox/db/log.php
+++ b/sqlbox/db/log.php
@@ -23,7 +23,7 @@
* in the previous 1.9 NEWMODULE.
*
* @package mod
- * @subpackage newmodule
+ * @subpackage sqlbox
* @copyright 2011 Your Name <your@email.adress>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -33,8 +33,8 @@ defined('MOODLE_INTERNAL') || die();
global $DB;
$logs = array(
- array('module'=>'newmodule', 'action'=>'add', 'mtable'=>'newmodule', 'field'=>'name'),
- array('module'=>'newmodule', 'action'=>'update', 'mtable'=>'newmodule', 'field'=>'name'),
- array('module'=>'newmodule', 'action'=>'view', 'mtable'=>'newmodule', 'field'=>'name'),
- array('module'=>'newmodule', 'action'=>'view all', 'mtable'=>'newmodule', 'field'=>'name')
+ array('module'=>'sqlbox', 'action'=>'add', 'mtable'=>'sqlbox', 'field'=>'name'),
+ array('module'=>'sqlbox', 'action'=>'update', 'mtable'=>'sqlbox', 'field'=>'name'),
+ array('module'=>'sqlbox', 'action'=>'view', 'mtable'=>'sqlbox', 'field'=>'name'),
+ array('module'=>'sqlbox', 'action'=>'view all', 'mtable'=>'sqlbox', 'field'=>'name')
);
diff --git a/sqlbox/db/uninstall.php b/sqlbox/db/uninstall.php
index 22ad141..cb5f7aa 100644
--- a/sqlbox/db/uninstall.php
+++ b/sqlbox/db/uninstall.php
@@ -19,7 +19,7 @@
* @see uninstall_plugin()
*
* @package mod
- * @subpackage newmodule
+ * @subpackage sqlbox
* @copyright 2011 Your Name <your@email.adress>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -27,6 +27,6 @@
/**
* Custom uninstallation procedure
*/
-function xmldb_newmodule_uninstall() {
+function xmldb_sqlbox_uninstall() {
return true;
}
diff --git a/sqlbox/db/upgrade.php b/sqlbox/db/upgrade.php
index 7f74831..1392912 100644
--- a/sqlbox/db/upgrade.php
+++ b/sqlbox/db/upgrade.php
@@ -16,7 +16,7 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * This file keeps track of upgrades to the newmodule module
+ * This file keeps track of upgrades to the sqlbox module
*
* Sometimes, changes between versions involve alterations to database
* structures and other major things that may break installations. The upgrade
@@ -26,7 +26,7 @@
* here will all be database-neutral, using the functions defined in DLL libraries.
*
* @package mod
- * @subpackage newmodule
+ * @subpackage sqlbox
* @copyright 2011 Your Name
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -34,12 +34,12 @@
defined('MOODLE_INTERNAL') || die();
/**
- * Execute newmodule upgrade from the given old version
+ * Execute sqlbox upgrade from the given old version
*
* @param int $oldversion
* @return bool
*/
-function xmldb_newmodule_upgrade($oldversion) {
+function xmldb_sqlbox_upgrade($oldversion) {
global $DB;
$dbman = $DB->get_manager(); // loads ddl manager and xmldb classes
@@ -55,10 +55,10 @@ function xmldb_newmodule_upgrade($oldversion) {
// Lines below (this included) MUST BE DELETED once you get the first version
// of your module ready to be installed. They are here only
- // for demonstrative purposes and to show how the newmodule
+ // for demonstrative purposes and to show how the sqlbox
// iself has been upgraded.
- // For each upgrade block, the file newmodule/version.php
+ // For each upgrade block, the file sqlbox/version.php
// needs to be updated . Such change allows Moodle to know
// that this file has to be processed.
@@ -71,8 +71,8 @@ function xmldb_newmodule_upgrade($oldversion) {
// First example, some fields were added to install.xml on 2007/04/01
if ($oldversion < 2007040100) {
- // Define field course to be added to newmodule
- $table = new xmldb_table('newmodule');
+ // Define field course to be added to sqlbox
+ $table = new xmldb_table('sqlbox');
$field = new xmldb_field('course', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'id');
// Add field course
@@ -80,8 +80,8 @@ function xmldb_newmodule_upgrade($oldversion) {
$dbman->add_field($table, $field);
}
- // Define field intro to be added to newmodule
- $table = new xmldb_table('newmodule');
+ // Define field intro to be added to sqlbox
+ $table = new xmldb_table('sqlbox');
$field = new xmldb_field('intro', XMLDB_TYPE_TEXT, 'medium', null, null, null, null,'name');
// Add field intro
@@ -89,8 +89,8 @@ function xmldb_newmodule_upgrade($oldversion) {
$dbman->add_field($table, $field);
}
- // Define field introformat to be added to newmodule
- $table = new xmldb_table('newmodule');
+ // Define field introformat to be added to sqlbox
+ $table = new xmldb_table('sqlbox');
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0',
'intro');
@@ -101,7 +101,7 @@ function xmldb_newmodule_upgrade($oldversion) {
// Once we reach this point, we can store the new version and consider the module
// upgraded to the version 2007040100 so the next time this block is skipped
- upgrade_mod_savepoint(true, 2007040100, 'newmodule');
+ upgrade_mod_savepoint(true, 2007040100, 'sqlbox');
}
// Second example, some hours later, the same day 2007/04/01
@@ -109,8 +109,8 @@ function xmldb_newmodule_upgrade($oldversion) {
// "01" in the last two digits of the version
if ($oldversion < 2007040101) {
- // Define field timecreated to be added to newmodule
- $table = new xmldb_table('newmodule');
+ // Define field timecreated to be added to sqlbox
+ $table = new xmldb_table('sqlbox');
$field = new xmldb_field('timecreated', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0',
'introformat');
@@ -119,8 +119,8 @@ function xmldb_newmodule_upgrade($oldversion) {
$dbman->add_field($table, $field);
}
- // Define field timemodified to be added to newmodule
- $table = new xmldb_table('newmodule');
+ // Define field timemodified to be added to sqlbox
+ $table = new xmldb_table('sqlbox');
$field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0',
'timecreated');
@@ -129,8 +129,8 @@ function xmldb_newmodule_upgrade($oldversion) {
$dbman->add_field($table, $field);
}
- // Define index course (not unique) to be added to newmodule
- $table = new xmldb_table('newmodule');
+ // Define index course (not unique) to be added to sqlbox
+ $table = new xmldb_table('sqlbox');
$index = new xmldb_index('courseindex', XMLDB_INDEX_NOTUNIQUE, array('course'));
// Add index to course field
@@ -139,7 +139,7 @@ function xmldb_newmodule_upgrade($oldversion) {
}
// Another save point reached
- upgrade_mod_savepoint(true, 2007040101, 'newmodule');
+ upgrade_mod_savepoint(true, 2007040101, 'sqlbox');
}
// Third example, the next day, 2007/04/02 (with the trailing 00), some actions were performed to install.php,
@@ -148,7 +148,7 @@ function xmldb_newmodule_upgrade($oldversion) {
// insert here code to perform some actions (same as in install.php)
- upgrade_mod_savepoint(true, 2007040200, 'newmodule');
+ upgrade_mod_savepoint(true, 2007040200, 'sqlbox');
}
// And that's all. Please, examine and understand the 3 example blocks above. Also
diff --git a/sqlbox/index.php b/sqlbox/index.php
index 60e85d0..b4c9456 100644
--- a/sqlbox/index.php
+++ b/sqlbox/index.php
@@ -22,13 +22,11 @@
* if you like, and it can span multiple lines.
*
* @package mod
- * @subpackage newmodule
- * @copyright 2011 Your Name
+ * @subpackage sqlbox
+ * @copyright 2012 Jan Klemkow, Benjamin Franzke
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-/// Replace newmodule with the name of your module and remove this line
-
require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once(dirname(__FILE__).'/lib.php');
@@ -38,19 +36,19 @@ $course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
require_course_login($course);
-add_to_log($course->id, 'newmodule', 'view all', 'index.php?id='.$course->id, '');
+add_to_log($course->id, 'sqlbox', 'view all', 'index.php?id='.$course->id, '');
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
-$PAGE->set_url('/mod/newmodule/index.php', array('id' => $id));
+$PAGE->set_url('/mod/sqlbox/index.php', array('id' => $id));
$PAGE->set_title(format_string($course->fullname));
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_context($coursecontext);
echo $OUTPUT->header();
-if (! $newmodules = get_all_instances_in_course('newmodule', $course)) {
- notice(get_string('nonewmodules', 'newmodule'), new moodle_url('/course/view.php', array('id' => $course->id)));
+if (! $sqlboxs = get_all_instances_in_course('sqlbox', $course)) {
+ notice(get_string('nosqlboxs', 'sqlbox'), new moodle_url('/course/view.php', array('id' => $course->id)));
}
if ($course->format == 'weeks') {
@@ -64,25 +62,25 @@ if ($course->format == 'weeks') {
$table->align = array('left', 'left', 'left');
}
-foreach ($newmodules as $newmodule) {
- if (!$newmodule->visible) {
+foreach ($sqlboxs as $sqlbox) {
+ if (!$sqlbox->visible) {
$link = html_writer::link(
- new moodle_url('/mod/newmodule.php', array('id' => $newmodule->coursemodule)),
- format_string($newmodule->name, true),
+ new moodle_url('/mod/sqlbox.php', array('id' => $sqlbox->coursemodule)),
+ format_string($sqlbox->name, true),
array('class' => 'dimmed'));
} else {
$link = html_writer::link(
- new moodle_url('/mod/newmodule.php', array('id' => $newmodule->coursemodule)),
- format_string($newmodule->name, true));
+ new moodle_url('/mod/sqlbox.php', array('id' => $sqlbox->coursemodule)),
+ format_string($sqlbox->name, true));
}
if ($course->format == 'weeks' or $course->format == 'topics') {
- $table->data[] = array($newmodule->section, $link);
+ $table->data[] = array($sqlbox->section, $link);
} else {
$table->data[] = array($link);
}
}
-echo $OUTPUT->heading(get_string('modulenameplural', 'newmodule'), 2);
+echo $OUTPUT->heading(get_string('modulenameplural', 'sqlbox'), 2);
echo html_writer::table($table);
echo $OUTPUT->footer();
diff --git a/sqlbox/lang/en/newmodule.php b/sqlbox/lang/en/sqlbox.php
index 822e6c4..3b7bc70 100644
--- a/sqlbox/lang/en/newmodule.php
+++ b/sqlbox/lang/en/sqlbox.php
@@ -17,25 +17,25 @@
/**
- * English strings for newmodule
+ * English strings for sqlbox
*
* You can have a rather longer description of the file as well,
* if you like, and it can span multiple lines.
*
* @package mod
- * @subpackage newmodule
+ * @subpackage sqlbox
* @copyright 2011 Your Name
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
-$string['modulename'] = 'newmodule';
-$string['modulenameplural'] = 'newmodules';
-$string['modulename_help'] = 'Use the newmodule module for... | The newmodule module allows...';
-$string['newmodulefieldset'] = 'Custom example fieldset';
-$string['newmodulename'] = 'newmodule name';
-$string['newmodulename_help'] = 'This is the content of the help tooltip associated with the newmodulename field. Markdown syntax is supported.';
-$string['newmodule'] = 'newmodule';
-$string['pluginadministration'] = 'newmodule administration';
-$string['pluginname'] = 'newmodule';
+$string['modulename'] = 'sqlbox';
+$string['modulenameplural'] = 'sqlboxs';
+$string['modulename_help'] = 'Use the sqlbox module for... | The sqlbox module allows...';
+$string['sqlboxfieldset'] = 'Custom example fieldset';
+$string['sqlboxname'] = 'sqlbox name';
+$string['sqlboxname_help'] = 'This is the content of the help tooltip associated with the sqlboxname field. Markdown syntax is supported.';
+$string['sqlbox'] = 'sqlbox';
+$string['pluginadministration'] = 'sqlbox administration';
+$string['pluginname'] = 'sqlbox';
diff --git a/sqlbox/lib.php b/sqlbox/lib.php
index d84e480..fe3cc17 100644
--- a/sqlbox/lib.php
+++ b/sqlbox/lib.php
@@ -16,16 +16,16 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Library of interface functions and constants for module newmodule
+ * Library of interface functions and constants for module sqlbox
*
* All the core Moodle functions, neeeded to allow the module to work
* integrated in Moodle should be placed here.
- * All the newmodule specific functions, needed to implement all the module
+ * All the sqlbox specific functions, needed to implement all the module
* logic, should go to locallib.php. This will help to save some memory when
* Moodle is performing actions across all modules.
*
* @package mod
- * @subpackage newmodule
+ * @subpackage sqlbox
* @copyright 2011 Your Name
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -46,7 +46,7 @@ defined('MOODLE_INTERNAL') || die();
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed true if the feature is supported, null if unknown
*/
-function newmodule_supports($feature) {
+function sqlbox_supports($feature) {
switch($feature) {
case FEATURE_MOD_INTRO: return true;
default: return null;
@@ -54,51 +54,51 @@ function newmodule_supports($feature) {
}
/**
- * Saves a new instance of the newmodule into the database
+ * Saves a new instance of the sqlbox into the database
*
* Given an object containing all the necessary data,
* (defined by the form in mod_form.php) this function
* will create a new instance and return the id number
* of the new instance.
*
- * @param object $newmodule An object from the form in mod_form.php
- * @param mod_newmodule_mod_form $mform
- * @return int The id of the newly inserted newmodule record
+ * @param object $sqlbox An object from the form in mod_form.php
+ * @param mod_sqlbox_mod_form $mform
+ * @return int The id of the newly inserted sqlbox record
*/
-function newmodule_add_instance(stdClass $newmodule, mod_newmodule_mod_form $mform = null) {
+function sqlbox_add_instance(stdClass $sqlbox, mod_sqlbox_mod_form $mform = null) {
global $DB;
- $newmodule->timecreated = time();
+ $sqlbox->timecreated = time();
# You may have to add extra stuff in here #
- return $DB->insert_record('newmodule', $newmodule);
+ return $DB->insert_record('sqlbox', $sqlbox);
}
/**
- * Updates an instance of the newmodule in the database
+ * Updates an instance of the sqlbox in the database
*
* Given an object containing all the necessary data,
* (defined by the form in mod_form.php) this function
* will update an existing instance with new data.
*
- * @param object $newmodule An object from the form in mod_form.php
- * @param mod_newmodule_mod_form $mform
+ * @param object $sqlbox An object from the form in mod_form.php
+ * @param mod_sqlbox_mod_form $mform
* @return boolean Success/Fail
*/
-function newmodule_update_instance(stdClass $newmodule, mod_newmodule_mod_form $mform = null) {
+function sqlbox_update_instance(stdClass $sqlbox, mod_sqlbox_mod_form $mform = null) {
global $DB;
- $newmodule->timemodified = time();
- $newmodule->id = $newmodule->instance;
+ $sqlbox->timemodified = time();
+ $sqlbox->id = $sqlbox->instance;
# You may have to add extra stuff in here #
- return $DB->update_record('newmodule', $newmodule);
+ return $DB->update_record('sqlbox', $sqlbox);
}
/**
- * Removes an instance of the newmodule from the database
+ * Removes an instance of the sqlbox from the database
*
* Given an ID of an instance of this module,
* this function will permanently delete the instance
@@ -107,16 +107,16 @@ function newmodule_update_instance(stdClass $newmodule, mod_newmodule_mod_form $
* @param int $id Id of the module instance
* @return boolean Success/Failure
*/
-function newmodule_delete_instance($id) {
+function sqlbox_delete_instance($id) {
global $DB;
- if (! $newmodule = $DB->get_record('newmodule', array('id' => $id))) {
+ if (! $sqlbox = $DB->get_record('sqlbox', array('id' => $id))) {
return false;
}
# Delete any dependent records here #
- $DB->delete_records('newmodule', array('id' => $newmodule->id));
+ $DB->delete_records('sqlbox', array('id' => $sqlbox->id));
return true;
}
@@ -130,7 +130,7 @@ function newmodule_delete_instance($id) {
*
* @return stdClass|null
*/
-function newmodule_user_outline($course, $user, $mod, $newmodule) {
+function sqlbox_user_outline($course, $user, $mod, $sqlbox) {
$return = new stdClass();
$return->time = 0;
@@ -145,20 +145,20 @@ function newmodule_user_outline($course, $user, $mod, $newmodule) {
* @param stdClass $course the current course record
* @param stdClass $user the record of the user we are generating report for
* @param cm_info $mod course module info
- * @param stdClass $newmodule the module instance record
+ * @param stdClass $sqlbox the module instance record
* @return void, is supposed to echp directly
*/
-function newmodule_user_complete($course, $user, $mod, $newmodule) {
+function sqlbox_user_complete($course, $user, $mod, $sqlbox) {
}
/**
* Given a course and a time, this module should find recent activity
- * that has occurred in newmodule activities and print it out.
+ * that has occurred in sqlbox activities and print it out.
* Return true if there was output, or false is there was none.
*
* @return boolean
*/
-function newmodule_print_recent_activity($course, $viewfullnames, $timestart) {
+function sqlbox_print_recent_activity($course, $viewfullnames, $timestart) {
return false; // True if anything was printed, otherwise false
}
@@ -167,7 +167,7 @@ function newmodule_print_recent_activity($course, $viewfullnames, $timestart) {
*
* This callback function is supposed to populate the passed array with
* custom activity records. These records are then rendered into HTML via
- * {@link newmodule_print_recent_mod_activity()}.
+ * {@link sqlbox_print_recent_mod_activity()}.
*
* @param array $activities sequentially indexed array of objects with the 'cmid' property
* @param int $index the index in the $activities to use for the next record
@@ -178,15 +178,15 @@ function newmodule_print_recent_activity($course, $viewfullnames, $timestart) {
* @param int $groupid check for a particular group's activity only, defaults to 0 (all groups)
* @return void adds items into $activities and increases $index
*/
-function newmodule_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) {
+function sqlbox_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) {
}
/**
- * Prints single activity item prepared by {@see newmodule_get_recent_mod_activity()}
+ * Prints single activity item prepared by {@see sqlbox_get_recent_mod_activity()}
* @return void
*/
-function newmodule_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames) {
+function sqlbox_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames) {
}
/**
@@ -197,7 +197,7 @@ function newmodule_print_recent_mod_activity($activity, $courseid, $detail, $mod
* @return boolean
* @todo Finish documenting this function
**/
-function newmodule_cron () {
+function sqlbox_cron () {
return true;
}
@@ -207,7 +207,7 @@ function newmodule_cron () {
* @example return array('moodle/site:accessallgroups');
* @return array
*/
-function newmodule_get_extra_capabilities() {
+function sqlbox_get_extra_capabilities() {
return array();
}
@@ -216,21 +216,21 @@ function newmodule_get_extra_capabilities() {
////////////////////////////////////////////////////////////////////////////////
/**
- * Is a given scale used by the instance of newmodule?
+ * Is a given scale used by the instance of sqlbox?
*
- * This function returns if a scale is being used by one newmodule
+ * This function returns if a scale is being used by one sqlbox
* if it has support for grading and scales. Commented code should be
* modified if necessary. See forum, glossary or journal modules
* as reference.
*
- * @param int $newmoduleid ID of an instance of this module
- * @return bool true if the scale is used by the given newmodule instance
+ * @param int $sqlboxid ID of an instance of this module
+ * @return bool true if the scale is used by the given sqlbox instance
*/
-function newmodule_scale_used($newmoduleid, $scaleid) {
+function sqlbox_scale_used($sqlboxid, $scaleid) {
global $DB;
/** @example */
- if ($scaleid and $DB->record_exists('newmodule', array('id' => $newmoduleid, 'grade' => -$scaleid))) {
+ if ($scaleid and $DB->record_exists('sqlbox', array('id' => $sqlboxid, 'grade' => -$scaleid))) {
return true;
} else {
return false;
@@ -238,18 +238,18 @@ function newmodule_scale_used($newmoduleid, $scaleid) {
}
/**
- * Checks if scale is being used by any instance of newmodule.
+ * Checks if scale is being used by any instance of sqlbox.
*
* This is used to find out if scale used anywhere.
*
* @param $scaleid int
- * @return boolean true if the scale is used by any newmodule instance
+ * @return boolean true if the scale is used by any sqlbox instance
*/
-function newmodule_scale_used_anywhere($scaleid) {
+function sqlbox_scale_used_anywhere($scaleid) {
global $DB;
/** @example */
- if ($scaleid and $DB->record_exists('newmodule', array('grade' => -$scaleid))) {
+ if ($scaleid and $DB->record_exists('sqlbox', array('grade' => -$scaleid))) {
return true;
} else {
return false;
@@ -257,44 +257,44 @@ function newmodule_scale_used_anywhere($scaleid) {
}
/**
- * Creates or updates grade item for the give newmodule instance
+ * Creates or updates grade item for the give sqlbox instance
*
* Needed by grade_update_mod_grades() in lib/gradelib.php
*
- * @param stdClass $newmodule instance object with extra cmidnumber and modname property
+ * @param stdClass $sqlbox instance object with extra cmidnumber and modname property
* @return void
*/
-function newmodule_grade_item_update(stdClass $newmodule) {
+function sqlbox_grade_item_update(stdClass $sqlbox) {
global $CFG;
require_once($CFG->libdir.'/gradelib.php');
/** @example */
$item = array();
- $item['itemname'] = clean_param($newmodule->name, PARAM_NOTAGS);
+ $item['itemname'] = clean_param($sqlbox->name, PARAM_NOTAGS);
$item['gradetype'] = GRADE_TYPE_VALUE;
- $item['grademax'] = $newmodule->grade;
+ $item['grademax'] = $sqlbox->grade;
$item['grademin'] = 0;
- grade_update('mod/newmodule', $newmodule->course, 'mod', 'newmodule', $newmodule->id, 0, null, $item);
+ grade_update('mod/sqlbox', $sqlbox->course, 'mod', 'sqlbox', $sqlbox->id, 0, null, $item);
}
/**
- * Update newmodule grades in the gradebook
+ * Update sqlbox grades in the gradebook
*
* Needed by grade_update_mod_grades() in lib/gradelib.php
*
- * @param stdClass $newmodule instance object with extra cmidnumber and modname property
+ * @param stdClass $sqlbox instance object with extra cmidnumber and modname property
* @param int $userid update grade of specific user only, 0 means all participants
* @return void
*/
-function newmodule_update_grades(stdClass $newmodule, $userid = 0) {
+function sqlbox_update_grades(stdClass $sqlbox, $userid = 0) {
global $CFG, $DB;
require_once($CFG->libdir.'/gradelib.php');
/** @example */
$grades = array(); // populate array of grade objects indexed by userid
- grade_update('mod/newmodule', $newmodule->course, 'mod', 'newmodule', $newmodule->id, 0, $grades);
+ grade_update('mod/sqlbox', $sqlbox->course, 'mod', 'sqlbox', $sqlbox->id, 0, $grades);
}
////////////////////////////////////////////////////////////////////////////////
@@ -312,14 +312,14 @@ function newmodule_update_grades(stdClass $newmodule, $userid = 0) {
* @param stdClass $context
* @return array of [(string)filearea] => (string)description
*/
-function newmodule_get_file_areas($course, $cm, $context) {
+function sqlbox_get_file_areas($course, $cm, $context) {
return array();
}
/**
- * File browsing support for newmodule file areas
+ * File browsing support for sqlbox file areas
*
- * @package mod_newmodule
+ * @package mod_sqlbox
* @category files
*
* @param file_browser $browser
@@ -333,25 +333,25 @@ function newmodule_get_file_areas($course, $cm, $context) {
* @param string $filename
* @return file_info instance or null if not found
*/
-function newmodule_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
+function sqlbox_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) {
return null;
}
/**
- * Serves the files from the newmodule file areas
+ * Serves the files from the sqlbox file areas
*
- * @package mod_newmodule
+ * @package mod_sqlbox
* @category files
*
* @param stdClass $course the course object
* @param stdClass $cm the course module object
- * @param stdClass $context the newmodule's context
+ * @param stdClass $context the sqlbox's context
* @param string $filearea the name of the file area
* @param array $args extra arguments (itemid, path)
* @param bool $forcedownload whether or not force download
* @param array $options additional options affecting the file serving
*/
-function newmodule_pluginfile($course, $cm, $context, $filearea, array $args, $forcedownload, array $options=array()) {
+function sqlbox_pluginfile($course, $cm, $context, $filearea, array $args, $forcedownload, array $options=array()) {
global $DB, $CFG;
if ($context->contextlevel != CONTEXT_MODULE) {
@@ -368,26 +368,26 @@ function newmodule_pluginfile($course, $cm, $context, $filearea, array $args, $f
////////////////////////////////////////////////////////////////////////////////
/**
- * Extends the global navigation tree by adding newmodule nodes if there is a relevant content
+ * Extends the global navigation tree by adding sqlbox nodes if there is a relevant content
*
* This can be called by an AJAX request so do not rely on $PAGE as it might not be set up properly.
*
- * @param navigation_node $navref An object representing the navigation tree node of the newmodule module instance
+ * @param navigation_node $navref An object representing the navigation tree node of the sqlbox module instance
* @param stdClass $course
* @param stdClass $module
* @param cm_info $cm
*/
-function newmodule_extend_navigation(navigation_node $navref, stdclass $course, stdclass $module, cm_info $cm) {
+function sqlbox_extend_navigation(navigation_node $navref, stdclass $course, stdclass $module, cm_info $cm) {
}
/**
- * Extends the settings navigation with the newmodule settings
+ * Extends the settings navigation with the sqlbox settings
*
- * This function is called when the context for the page is a newmodule module. This is not called by AJAX
+ * This function is called when the context for the page is a sqlbox module. This is not called by AJAX
* so it is safe to rely on the $PAGE.
*
* @param settings_navigation $settingsnav {@link settings_navigation}
- * @param navigation_node $newmodulenode {@link navigation_node}
+ * @param navigation_node $sqlboxnode {@link navigation_node}
*/
-function newmodule_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $newmodulenode=null) {
+function sqlbox_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $sqlboxnode=null) {
}
diff --git a/sqlbox/locallib.php b/sqlbox/locallib.php
index 62a5f5e..5785e5d 100644
--- a/sqlbox/locallib.php
+++ b/sqlbox/locallib.php
@@ -16,13 +16,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Internal library of functions for module newmodule
+ * Internal library of functions for module sqlbox
*
- * All the newmodule specific functions, needed to implement the module
+ * All the sqlbox specific functions, needed to implement the module
* logic, should go here. Never include this file from your lib.php!
*
* @package mod
- * @subpackage newmodule
+ * @subpackage sqlbox
* @copyright 2011 Your Name
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -35,6 +35,6 @@ defined('MOODLE_INTERNAL') || die();
* @param array $things
* @return object
*/
-//function newmodule_do_something_useful(array $things) {
+//function sqlbox_do_something_useful(array $things) {
// return new stdClass();
//}
diff --git a/sqlbox/mod_form.php b/sqlbox/mod_form.php
index 53fda02..e1dde18 100644
--- a/sqlbox/mod_form.php
+++ b/sqlbox/mod_form.php
@@ -16,13 +16,13 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * The main newmodule configuration form
+ * The main sqlbox configuration form
*
* It uses the standard core Moodle formslib. For more info about them, please
* visit: http://docs.moodle.org/en/Development:lib/formslib.php
*
* @package mod
- * @subpackage newmodule
+ * @subpackage sqlbox
* @copyright 2011 Your Name
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -34,7 +34,7 @@ require_once($CFG->dirroot.'/course/moodleform_mod.php');
/**
* Module instance settings form
*/
-class mod_newmodule_mod_form extends moodleform_mod {
+class mod_sqlbox_mod_form extends moodleform_mod {
/**
* Defines forms elements
@@ -48,7 +48,7 @@ class mod_newmodule_mod_form extends moodleform_mod {
$mform->addElement('header', 'general', get_string('general', 'form'));
// Adding the standard "name" field
- $mform->addElement('text', 'name', get_string('newmodulename', 'newmodule'), array('size'=>'64'));
+ $mform->addElement('text', 'name', get_string('sqlboxname', 'sqlbox'), array('size'=>'64'));
if (!empty($CFG->formatstringstriptags)) {
$mform->setType('name', PARAM_TEXT);
} else {
@@ -56,18 +56,18 @@ class mod_newmodule_mod_form extends moodleform_mod {
}
$mform->addRule('name', null, 'required', null, 'client');
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
- $mform->addHelpButton('name', 'newmodulename', 'newmodule');
+ $mform->addHelpButton('name', 'sqlboxname', 'sqlbox');
// Adding the standard "intro" and "introformat" fields
$this->add_intro_editor();
//-------------------------------------------------------------------------------
- // Adding the rest of newmodule settings, spreeading all them into this fieldset
+ // Adding the rest of sqlbox settings, spreeading all them into this fieldset
// or adding more fieldsets ('header' elements) if needed for better logic
- $mform->addElement('static', 'label1', 'newmodulesetting1', 'Your newmodule fields go here. Replace me!');
+ $mform->addElement('static', 'label1', 'sqlboxsetting1', 'Your sqlbox fields go here. Replace me!');
- $mform->addElement('header', 'newmodulefieldset', get_string('newmodulefieldset', 'newmodule'));
- $mform->addElement('static', 'label2', 'newmodulesetting2', 'Your newmodule fields go here. Replace me!');
+ $mform->addElement('header', 'sqlboxfieldset', get_string('sqlboxfieldset', 'sqlbox'));
+ $mform->addElement('static', 'label2', 'sqlboxsetting2', 'Your sqlbox fields go here. Replace me!');
//-------------------------------------------------------------------------------
// add standard elements, common to all modules
diff --git a/sqlbox/version.php b/sqlbox/version.php
index dc1f915..1c8578a 100644
--- a/sqlbox/version.php
+++ b/sqlbox/version.php
@@ -17,13 +17,13 @@
/**
- * Defines the version of newmodule
+ * Defines the version of sqlbox
*
* This code fragment is called by moodle_needs_upgrading() and
* /admin/index.php
*
* @package mod
- * @subpackage newmodule
+ * @subpackage sqlbox
* @copyright 2011 Your Name
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
@@ -34,4 +34,4 @@ $module->version = 0; // If version == 0 then module will not be
//$module->version = 2010032200; // The current module version (Date: YYYYMMDDXX)
$module->requires = 2010031900; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
-$module->component = 'mod_newmodule'; // To check on upgrade, that module sits in correct place
+$module->component = 'mod_sqlbox'; // To check on upgrade, that module sits in correct place
diff --git a/sqlbox/view.php b/sqlbox/view.php
index 0a374b5..adb2159 100644
--- a/sqlbox/view.php
+++ b/sqlbox/view.php
@@ -16,33 +16,33 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Prints a particular instance of newmodule
+ * Prints a particular instance of sqlbox
*
* You can have a rather longer description of the file as well,
* if you like, and it can span multiple lines.
*
* @package mod
- * @subpackage newmodule
+ * @subpackage sqlbox
* @copyright 2011 Your Name
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-/// (Replace newmodule with the name of your module and remove this line)
+/// (Replace sqlbox with the name of your module and remove this line)
require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once(dirname(__FILE__).'/lib.php');
$id = optional_param('id', 0, PARAM_INT); // course_module ID, or
-$n = optional_param('n', 0, PARAM_INT); // newmodule instance ID - it should be named as the first character of the module
+$n = optional_param('n', 0, PARAM_INT); // sqlbox instance ID - it should be named as the first character of the module
if ($id) {
- $cm = get_coursemodule_from_id('newmodule', $id, 0, false, MUST_EXIST);
+ $cm = get_coursemodule_from_id('sqlbox', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
- $newmodule = $DB->get_record('newmodule', array('id' => $cm->instance), '*', MUST_EXIST);
+ $sqlbox = $DB->get_record('sqlbox', array('id' => $cm->instance), '*', MUST_EXIST);
} elseif ($n) {
- $newmodule = $DB->get_record('newmodule', array('id' => $n), '*', MUST_EXIST);
- $course = $DB->get_record('course', array('id' => $newmodule->course), '*', MUST_EXIST);
- $cm = get_coursemodule_from_instance('newmodule', $newmodule->id, $course->id, false, MUST_EXIST);
+ $sqlbox = $DB->get_record('sqlbox', array('id' => $n), '*', MUST_EXIST);
+ $course = $DB->get_record('course', array('id' => $sqlbox->course), '*', MUST_EXIST);
+ $cm = get_coursemodule_from_instance('sqlbox', $sqlbox->id, $course->id, false, MUST_EXIST);
} else {
error('You must specify a course_module ID or an instance ID');
}
@@ -50,25 +50,25 @@ if ($id) {
require_login($course, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
-add_to_log($course->id, 'newmodule', 'view', "view.php?id={$cm->id}", $newmodule->name, $cm->id);
+add_to_log($course->id, 'sqlbox', 'view', "view.php?id={$cm->id}", $sqlbox->name, $cm->id);
/// Print the page header
-$PAGE->set_url('/mod/newmodule/view.php', array('id' => $cm->id));
-$PAGE->set_title(format_string($newmodule->name));
+$PAGE->set_url('/mod/sqlbox/view.php', array('id' => $cm->id));
+$PAGE->set_title(format_string($sqlbox->name));
$PAGE->set_heading(format_string($course->fullname));
$PAGE->set_context($context);
// other things you may want to set - remove if not needed
//$PAGE->set_cacheable(false);
//$PAGE->set_focuscontrol('some-html-id');
-//$PAGE->add_body_class('newmodule-'.$somevar);
+//$PAGE->add_body_class('sqlbox-'.$somevar);
// Output starts here
echo $OUTPUT->header();
-if ($newmodule->intro) { // Conditions to show the intro can change to look for own settings or whatever
- echo $OUTPUT->box(format_module_intro('newmodule', $newmodule, $cm->id), 'generalbox mod_introbox', 'newmoduleintro');
+if ($sqlbox->intro) { // Conditions to show the intro can change to look for own settings or whatever
+ echo $OUTPUT->box(format_module_intro('sqlbox', $sqlbox, $cm->id), 'generalbox mod_introbox', 'sqlboxintro');
}
// Replace the following lines with you own code