| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?php
- // This file is part of the Sloodle project (www.sloodle.org) and is released under the GNU GPL v3.
- /**
- * Defines base classes for SLOODLE Presenter plugins.
- *
- * @package sloodle
- * @copyright Copyright (c) 2009 Sloodle (various contributors)
- * @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3
- * @since Sloodle 0.4.1
- *
- * @contributor Peter R. Bloomfield
- *
- */
- /**
- * Base class for plugins which provide slide types for the SLOODLE Presenter.
- * Sub-classes should override the essential functions, in addition to those in the SloodlePluginBase class.
- * The purpose of the plugin is to render slides for output to a browser or to SL.
- *
- * @package sloodle
- */
- class SloodlePluginBasePresenterSlide extends SloodlePluginBase
- {
- // DATA //
- // OVERRIDABLE FUNCTIONS //
- // These are functions which can be overridden by sub-classes.
- /**
- * Render the given slide for browser output -- NOTE: render to a string, and return the string.
- * The title of the slide need not be included -- simply the basic iFrame or embedded player etc.
- * @param SloodlePresenterSlide $slide An object containing the raw slide data.
- * @return string
- */
- function render_slide_for_browser($slide)
- {
- // In case this function isn't overridden, just output a basic link.
- $output = "<a href=\"{$slide->source}\" title=\"\">".get_string('directlink', 'sloodle')."</a>";
- return $output;
- }
- /**
- * Render the given slide for virtual-world output.
- * This returns two items of data in a numeric array.
- * The first is the virtual world compatible type identifier: web, image, video, or audio (or a mime type).
- * The second is the absolute URL to give it.
- * @param SloodlePresenterSlide $slide An object containing the raw slide data.
- * @return array Numeric array containg (type, url)
- */
- function render_slide_for_sl($slide)
- {
- // In case this function isn't overridden, just output a basic web URL
- return array('web', $slide->source);
- }
-
- /**
- * Gets the category to which this plugin belongs.
- * For example, Presenters have two plugin categories: slides, and importers.
- * This function must be overriden.
- * A useful approach would be to have a derived plugin base class for a particular category of plugins.
- * Each derived base class would report the appropriate category by overriding this function.
- * The actual plugin classes would simply have to inherit that derived base, without needing to specify their own category.
- * @access public
- * @return string The name of this category of plugin.
- */
- function get_category()
- {
- return 'presenter-slide';
- }
- }
- /**
- * Base class for plugins which provide slide importers for the SLOODLE Presenter.
- * Sub-classes should override the essential functions, in addition to those in the SloodlePluginBase class.
- * The purpose of the plugin is to take a specified file (locally), process it, and add slides to the Presentation at the given point.
- */
- class SloodlePluginBasePresenterImporter extends SloodlePluginBase
- {
- // DATA //
- // OVERRIDABLE FUNCTIONS //
- // These are functions which can be overridden by sub-classes.
- /**
- * Import the given file, and insert the new slides at the specified position in the Presentation.
- * The best approach to inserting slides is to insert the first one at the specified position,
- * and then increment the position on each insertion.
- * Inserting at the same point repeatedly will cause the slides to appear in reverse order! :-)
- * @param string $file The path of the file to import.
- * @param int $position Position at which the first new slide should be imported. (If negative, then insert at end)
- * @return bool True if successful, or false otherwise.
- */
- function import($file, $position = -1)
- {
- return false;
- }
-
- /**
- * Gets the category to which this plugin belongs.
- * For example, Presenters have two plugin categories: slides, and importers.
- * This function must be overriden.
- * A useful approach would be to have a derived plugin base class for a particular category of plugins.
- * Each derived base class would report the appropriate category by overriding this function.
- * The actual plugin classes would simply have to inherit that derived base, without needing to specify their own category.
- * @access public
- * @return string The name of this category of plugin.
- */
- function get_category()
- {
- return 'presenter-importer';
- }
- }
- ?>
|