Forums | Mahara Community
Developers
/
Create Plugin: need start-up aid
28 February 2010, 16:16
Hello.
I'm trying to create a new plugin for Mahara, but I havn't come that far with the given documentation.
When I install a base construct of the plugin, the website will not display anything (onlyat url: <siteUrl>/admin.... at least thereis no error.
What I've done:
created a new subdirectory in /artefact
in this subdirectory I created the files lib.php and version.php
Here is the code from lib.php:
<?php
defined('PENDLER') || die();
class PluginArtefactPendler extends PluginArtefact {
public static function get_plugin_name() {
retrun( 'pendler' );
}
public static function get_block_types() {
return array();
}
public static function get_artefact_types () {
return array();
}
}
?>
I hope someone can help me. What am I doing wrong?
Thanks!
Sebastian (from Germany)
28 February 2010, 17:31
Sebastian,
The problem is probably that the constant PENDLER is not defined. You should change defined('PENDLER') || die(); to defined('INTERNAL') || die();
INTERNAL is a constant that is defined when internal Mahara operations are taking place. In other words, you should make sure it is defined on all pages that you don't want users to visit.
Hope that helps.
Cheers,
Evan
01 March 2010, 4:18
Hello Evan,
thank you very much - that halped.
It seems it was too late in the evening when I tried to understand this.
best regards
- Sebastian
08 May 2010, 12:58
hello Evan,
This is Mrunal. I am also had a same Problem.
I am adding the new plugin called development in that i am adding the Personal Development plan but i created the lib.php & version.php & db files but i got the error when i run the mahara.
Here is the code for lib.php.
<?php
defined('INTERNAL') || die();
class PluginArtefactDevelopment extends PluginArtefact {
public static function get_artefact_types() {
return array(
'personalplan',
'plandate',
'cdate',
'strength',
'weakness',
'opportunities',
'threats',
'books',
'training',
'weblinks',
'electronic',
'others',
'reflection',
);
}
public static function get_block_types() {
return array();
}
public static function get_plugin_name() {
return 'development';
}
public static function menu_items() {
return array(
array(
'path' => 'profile/mypersonaldevelopmentplan',
'title' => get_string('mypersonaldevelopmentplan', 'artefact.development'),
'url' => 'artefact/internal/personaldevelopmentplan.php',
'weight' => 21,
),
);
}
}
I got the following Error
development Not installable! class ArtefactTypePersonalplan for type personalplan in plugin was missing
Please help what i am doing wrong?