Revision: 3637
Author: seba.wagner
Date: Sun Jan 9 03:57:47 2011
Log: Fix issues in view and lib
http://code.google.com/p/openmeetings/source/detail?r=3637
Modified:
/trunk/plugins/moodle_plugin/lib.php
/trunk/plugins/moodle_plugin/mod_form.php
/trunk/plugins/moodle_plugin/view.php
=======================================
--- /trunk/plugins/moodle_plugin/lib.php Sun Feb 7 04:20:57 2010
+++ /trunk/plugins/moodle_plugin/lib.php Sun Jan 9 03:57:47 2011
@@ -35,7 +35,7 @@
}
function openmeetings_add_instance($openmeetings) {
- global $USER, $CFG;
+ global $USER, $CFG, $DB;
$openmeetings_gateway = new openmeetings_gateway();
if ($openmeetings_gateway->openmeetings_loginuser()) {
@@ -51,24 +51,25 @@
}
# May have to add extra stuff in here #
- return insert_record("openmeetings", $openmeetings);
+ return $DB->insert_record("openmeetings", $openmeetings);
}
function openmeetings_update_instance($openmeetings) {
-
+ global $DB;
$openmeetings->timemodified = time();
$openmeetings->id = $openmeetings->instance;
# May have to add extra stuff in here #
- return update_record("openmeetings", $openmeetings);
+ return $DB->update_record("openmeetings", $openmeetings);
}
function openmeetings_delete_instance($id) {
-
- if (! $openmeetings = get_record("openmeetings", "id", "$id")) {
+ global $DB;
+
+ if (! $openmeetings = $DB->get_record("openmeetings", "id", "$id")) {
return false;
}
@@ -76,7 +77,7 @@
# Delete any dependent records here #
- if (! delete_records("openmeetings", "id", "$openmeetings->id")) {
+ if (! $DB->delete_records("openmeetings", "id", "$openmeetings->id")) {
$result = false;
}
=======================================
--- /trunk/plugins/moodle_plugin/mod_form.php Sun Jan 9 03:24:20 2011
+++ /trunk/plugins/moodle_plugin/mod_form.php Sun Jan 9 03:57:47 2011
@@ -1,6 +1,10 @@
-<?php //$Id,v 1.0 2007/10/24 12:00:00 Serafim Panov Exp $
-
-require_once ('moodleform_mod.php');
+<?php
+
+if (!defined('MOODLE_INTERNAL')) {
+ die('Direct access to this script is forbidden.'); /// It must be
included from a Moodle page
+}
+
+require_once ($CFG->dirroot.'/course/moodleform_mod.php');
class mod_openmeetings_mod_form extends moodleform_mod {
@@ -93,13 +97,17 @@
$mform->addElement('htmleditor', 'intro',
get_string('Comment', 'openmeetings'));
$mform->setType('intro', PARAM_RAW);
//$mform->addRule('intro', get_string('required'), 'required',
null, 'client');
- $mform->setHelpButton('intro', array('writing', 'richtext'),
false, 'editorhelpbutton');
-
- $mform->addElement('format', 'introformat', get_string('format'));
+ //$mform->setHelpButton('intro', array('writing', 'richtext'),
false, 'editorhelpbutton');
+
+ //$mform->addElement('format', 'introformat',
get_string('format', 'openmeetings'));
+ //$this->add_intro_editor(true,
get_string('description', 'mplayer'));
+
+ $this->add_intro_editor(true);
//-------------------------------------------------------------------------------
// add standard elements, common to all modules
-
$this->standard_coursemodule_elements(array('groups'=>true, 'groupings'=>true, 'groupmembersonly'=>true));
+
//$this->standard_coursemodule_elements(array('groups'=>true, 'groupings'=>true, 'groupmembersonly'=>true));
+ $this->standard_coursemodule_elements();
//-------------------------------------------------------------------------------
// add standard buttons, common to all modules
=======================================
--- /trunk/plugins/moodle_plugin/view.php Sun Jan 9 02:59:47 2011
+++ /trunk/plugins/moodle_plugin/view.php Sun Jan 9 03:57:47 2011
@@ -1,4 +1,4 @@
-<?php // $Id: view.php,v 1.0 2007/10/24 12:00:00 Serafim Panov Exp $
+<?php
require_once("../../config.php");
@@ -7,33 +7,34 @@
$id = optional_param('id', 0, PARAM_INT); // Course Module ID, or
- $a = optional_param('a', 0, PARAM_INT); // whiteboard ID
- $g = optional_param('g');
-
- if ($id) {
- if (! $cm = get_record("course_modules", "id", $id)) {
- error("Course Module ID was incorrect");
- }
-
- if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
- }
-
- if (! $openmeetings = get_record("openmeetings", "id",
$cm->instance)) {
- error("Course module is incorrect");
- }
-
- } else {
- if (! $openmeetings = get_record("openmeetings", "id", $a)) {
- error("Course module is incorrect");
- }
- if (! $course = get_record("course", "id", $openmeetings->course))
{
- error("Course is misconfigured");
- }
- if (! $cm = get_coursemodule_from_instance("openmeetings",
$openmeetings->id, $course->id)) {
- error("Course Module ID was incorrect");
- }
- }
+ $g = optional_param('g', 0, PARAM_INT);
+
+ if (!empty($id)) {
+ if (! $cm = get_coursemodule_from_id('openmeetings', $id)) {
+ print_error('invalidcoursemodule');
+ }
+ if (! $course = $DB->get_record("course",
array("id"=>$cm->course))) {
+ print_error('coursemisconf');
+ }
+ if (! $openmeetings = $DB->get_record("openmeetings",
array("id"=>$cm->instance))) {
+ print_error('invalidid', 'openmeetings');
+ }
+
+ } else if (!empty($g)) {
+ if (! $openmeetings = $DB->get_record("openmeetings",
array("id"=>$g))) {
+ print_error('invalidid', 'openmeetings');
+ }
+ if (! $course = $DB->get_record("course",
array("id"=>$openmeetings->course))) {
+ print_error('invalidcourseid');
+ }
+ if (!$cm = get_coursemodule_from_instance("openmeetings",
$openmeetings->id, $course->id)) {
+ print_error('invalidcoursemodule');
+ }
+ $id = $cm->id;
+ } else {
+ print_error('invalidid', 'openmeetings');
+ }
+
require_login($course->id);
@@ -65,11 +66,10 @@
$sitelink = str_replace("http://", "", $CFG->wwwroot);
-
- $moduleid = get_record ("modules", "name", "openmeetings");
-
- $coursedata = get_record ("course_modules", "course",
$cm->course, "module", $moduleid->id, "instance", $cm->instance);
-
+// $moduleid = $DB->get_record ("modules", "name", "openmeetings");
+//
+// $coursedata = $DB->get_record ("course_modules", "course",
$cm->course, "module", $moduleid->id, "instance", $cm->instance);
+//
// if ($coursedata->groupmode != 0 && empty($g)) {
// //print_r (groups_get_groups($cm->course));
// //$usergroups = groups_get_groups_for_user($USER->id,
$cm->course);
--
You received this message because you are subscribed to the Google Groups
"OpenMeetings developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/openmeetings-dev?hl=en.