-<?php // $Id$
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
-// Graph size
+/**
+ * @package mod-survey
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
+ * Graph size
+ * @global int $SURVEY_GHEIGHT
+ */
$SURVEY_GHEIGHT = 500;
+/**
+ * Graph size
+ * @global int $SURVEY_GWIDTH
+ */
$SURVEY_GWIDTH = 900;
-
+/**
+ * Question Type
+ * @global array $SURVEY_QTYPE
+ */
$SURVEY_QTYPE = array (
"-3" => "Virtual Actual and Preferred",
"-2" => "Virtual Preferred",
// STANDARD FUNCTIONS ////////////////////////////////////////////////////////
-
+/**
+ * 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.
+ *
+ * @global object
+ * @param object $survey
+ * @return int|bool
+ */
function survey_add_instance($survey) {
global $DB;
-// 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.
if (!$template = $DB->get_record("survey", array("id"=>$survey->template))) {
return 0;
}
-
+/**
+ * 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.
+ *
+ * @global object
+ * @param object $survey
+ * @return bool
+ */
function survey_update_instance($survey) {
global $DB;
-// 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.
if (!$template = $DB->get_record("survey", array("id"=>$survey->template))) {
return 0;
return $DB->update_record("survey", $survey);
}
+/**
+ * Given an ID of an instance of this module,
+ * this function will permanently delete the instance
+ * and any data that depends on it.
+ *
+ * @global object
+ * @param int $id
+ * @return bool
+ */
function survey_delete_instance($id) {
global $DB;
-// Given an ID of an instance of this module,
-// this function will permanently delete the instance
-// and any data that depends on it.
if (! $survey = $DB->get_record("survey", array("id"=>$id))) {
return false;
return $result;
}
+/**
+ * @global object
+ * @param object $course
+ * @param object $user
+ * @param object $mod
+ * @param object $survey
+ * @return $result
+ */
function survey_user_outline($course, $user, $mod, $survey) {
global $DB;
return NULL;
}
-
+/**
+ * @global stdObject
+ * @global object
+ * @uses SURVEY_CIQ
+ * @param object $course
+ * @param object $user
+ * @param object $mod
+ * @param object $survey
+ */
function survey_user_complete($course, $user, $mod, $survey) {
global $CFG, $DB;
}
}
+/**
+ * @global stdClass
+ * @global object
+ * @param object $course
+ * @param mixed $viewfullnames
+ * @param int $timestamp
+ * @return bool
+ */
function survey_print_recent_activity($course, $viewfullnames, $timestart) {
global $CFG, $DB;
return true;
}
+/**
+ * Returns the users with data in one survey
+ * (users with records in survey_analysis and survey_answers, students)
+ *
+ * @global object
+ * @param int $surveyid
+ * @return array
+ */
function survey_get_participants($surveyid) {
-//Returns the users with data in one survey
-//(users with records in survey_analysis and survey_answers, students)
global $DB;
//Get students from survey_analysis
// SQL FUNCTIONS ////////////////////////////////////////////////////////
-
+/**
+ * @global object
+ * @param sting $log
+ * @return array
+ */
function survey_log_info($log) {
global $DB;
return $DB->get_record_sql("SELECT s.name, u.firstname, u.lastname, u.picture
WHERE s.id = ? AND u.id = ?", array($log->info, $log->userid));
}
+/**
+ * @global object
+ * @param int $surveyid
+ * @param int $groupid
+ * @param int $groupingid
+ * @return array
+ */
function survey_get_responses($surveyid, $groupid, $groupingid) {
global $DB;
ORDER BY time ASC", $params);
}
+/**
+ * @global object
+ * @param int $survey
+ * @param int $user
+ * @return array
+ */
function survey_get_analysis($survey, $user) {
global $DB;
WHERE survey=? AND userid=?", array($survey, $user));
}
+/**
+ * @global object
+ * @param int $survey
+ * @param int $user
+ * @param string $notes
+ */
function survey_update_analysis($survey, $user, $notes) {
global $DB;
AND userid=?", array($notes, $survey, $user));
}
-
+/**
+ * @global object
+ * @param int $surveyid
+ * @param int $groupid
+ * @param string $sort
+ * @return array
+ */
function survey_get_user_answers($surveyid, $questionid, $groupid, $sort="sa.answer1,sa.answer2 ASC") {
global $DB;
ORDER BY $sort", $params);
}
+/**
+ * @global object
+ * @param int $surveyid
+ * @param int $questionid
+ * @param int $userid
+ * @return array
+ */
function survey_get_user_answer($surveyid, $questionid, $userid) {
global $DB;
}
// MODULE FUNCTIONS ////////////////////////////////////////////////////////
-
+/**
+ * @global object
+ * @param int $survey
+ * @param int $user
+ * @param string $notes
+ * @return bool|int
+ */
function survey_add_analysis($survey, $user, $notes) {
global $DB;
return $DB->insert_record("survey_analysis", $record, false);
}
-
+/**
+ * @global object
+ * @param int $survey
+ * @param int $user
+ * @return bool
+ */
function survey_already_done($survey, $user) {
global $DB;
return $DB->record_exists("survey_answers", array("survey"=>$survey, "userid"=>$user));
}
-
+/**
+ * @param int $surveyid
+ * @param int $groupid
+ * @param int $groupingid
+ * @return int
+ */
function survey_count_responses($surveyid, $groupid, $groupingid) {
if ($responses = survey_get_responses($surveyid, $groupid, $groupingid)) {
return count($responses);
}
}
-
+/**
+ * @param int $cmid
+ * @param array $results
+ * @param int $courseid
+ */
function survey_print_all_responses($cmid, $results, $courseid) {
$table = new object();
print_table($table);
}
-
+/**
+ * @global object
+ * @param int $templateid
+ * @return string
+ */
function survey_get_template_name($templateid) {
global $DB;
}
-
+/**
+ * @param string $name
+ * @param array $numwords
+ * @return string
+ */
function survey_shorten_name ($name, $numwords) {
$words = explode(" ", $name);
for ($i=0; $i < $numwords; $i++) {
return $output;
}
-
-
+/**
+ * @todo Check this function
+ *
+ * @global object
+ * @global object
+ * @global int
+ * @global void This is never defined
+ * @global object This is defined twice?
+ * @param object $question
+ */
function survey_print_multi($question) {
global $USER, $DB, $qnum, $checklist, $DB;
}
-
+/**
+ * @global object
+ * @global int
+ * @param object $question
+ */
function survey_print_single($question) {
global $DB, $qnum;
}
+/**
+ *
+ * @param int $qnum
+ * @return string
+ */
function survey_question_rowclass($qnum) {
if ($qnum) {
}
}
+/**
+ * @global object
+ * @global int
+ * @global int
+ * @param string $url
+ */
function survey_print_graph($url) {
global $CFG, $SURVEY_GHEIGHT, $SURVEY_GWIDTH;
}
}
+/**
+ * @return array
+ */
function survey_get_view_actions() {
return array('download','view all','view form','view graph','view report');
}
+/**
+ * @return array
+ */
function survey_get_post_actions() {
return array('submit');
}
/**
* Implementation of the function for printing the form elements that control
* whether the course reset functionality affects the survey.
- * @param $mform form passed by reference
+ *
+ * @param object $mform form passed by reference
*/
function survey_reset_course_form_definition(&$mform) {
$mform->addElement('header', 'surveyheader', get_string('modulenameplural', 'survey'));
/**
* Course reset form defaults.
+ * @return array
*/
function survey_reset_course_form_defaults($course) {
return array('reset_survey_answers'=>1, 'reset_survey_analysis'=>1);
/**
* Actual implementation of the rest coures functionality, delete all the
* survey responses for course $data->courseid.
+ *
+ * @global object
* @param $data the data submitted from the reset course.
* @return array status array
*/
/**
* Returns all other caps used in module
+ *
+ * @return array
*/
function survey_get_extra_capabilities() {
return array('moodle/site:accessallgroups');
}
/**
+ * @uses FEATURE_GROUPS
+ * @uses FEATURE_GROUPINGS
+ * @uses FEATURE_GROUPMEMBERSONLY
+ * @uses FEATURE_MOD_INTRO
+ * @uses FEATURE_COMPLETION_TRACKS_VIEWS
+ * @uses FEATURE_GRADE_HAS_GRADE
+ * @uses FEATURE_GRADE_OUTCOMES
* @param string $feature FEATURE_xx constant for requested feature
- * @return mixed True if module supports feature, null if doesn't know
+ * @return mixed True if module supports feature, false if not, null if doesn't know
*/
function survey_supports($feature) {
switch($feature) {
-<?php // $Id$
-
-/// Library of functions and constants for module wiki
-/// (replace wiki with the name of your module and delete this line)
+<?php
+
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Library of functions and constants for module wiki
+ * (replace wiki with the name of your module and delete this line)
+ *
+ * @package mod-wiki
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+/** @global int $wiki_CONSTANT */
$wiki_CONSTANT = 7; /// for example
+/** @global object $site */
$site = get_site();
+/** @global array $WIKI_TYPES */
$WIKI_TYPES = array ('teacher' => get_string('defaultcourseteacher'),
'group' => get_string('groups',"wiki"),
'student' => get_string('defaultcoursestudent') );
define('SESSION_WIKI_LOCKS','wikilocks');
/*** Moodle 1.7 compatibility functions *****
- *
********************************************/
+
+/**
+ * @todo add some $cm caching if needed
+ * @param object $wiki
+ * @return object
+ */
function wiki_context($wiki) {
//TODO: add some $cm caching if needed
if (is_object($wiki)) {
return get_context_instance(CONTEXT_MODULE, $cm->id);
}
+/**
+ * @param object $wiki
+ * @param int $userid
+ * @return bool
+ */
function wiki_is_teacher($wiki, $userid=NULL) {
return has_capability('mod/wiki:manage', wiki_context($wiki), $userid);
}
-
+/**
+ * @param object $wiki
+ * @param int $userid
+ * @return bool
+ */
function wiki_is_teacheredit($wiki, $userid=NULL) {
return has_capability('mod/wiki:manage', wiki_context($wiki), $userid)
and has_capability('moodle/site:accessallgroups', wiki_context($wiki), $userid);
}
-
+/**
+ * @param object $wiki
+ * @param int $userid
+ * @return bool
+ */
function wiki_is_student($wiki, $userid=NULL) {
return has_capability('mod/wiki:participate', wiki_context($wiki), $userid);
}
-
+/**
+ * @param object $wiki
+ * @param string $groups
+ * @param string $sort
+ * @param string $fields
+ * @return array
+ */
function wiki_get_students($wiki, $groups='', $sort='u.lastaccess', $fields='u.*') {
return $users = get_users_by_capability(wiki_context($wiki), 'mod/wiki:participate', $fields, $sort, '', '', $groups);
}
/* end of compatibility functions */
-
+/**
+ * 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.
+ *
+ * @global object
+ * @param object $wiki
+ * @return bool|int
+ */
function wiki_add_instance($wiki) {
global $DB;
-/// 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.
-
+
$wiki->timemodified = time();
# May have to add extra stuff in here #
return $DB->insert_record("wiki", $wiki);
}
-
+/**
+ * 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.
+ *
+ * @global object
+ * @param object @wiki
+ * @return bool
+ */
function wiki_update_instance($wiki) {
global $DB;
-/// 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.
/// Determine the pagename for this wiki.
$wiki->pagename = wiki_page_name($wiki);
return $DB->update_record("wiki", $wiki);
}
-/// Delete all Directories recursively
+/**
+ * Delete all Directories recursively
+ *
+ * @param string $basedir
+ */
function wiki_rmdir($basedir) {
$handle = @opendir($basedir);
if($handle) {
@rmdir($basedir);
}
+/**
+ * Given an ID of an instance of this module,
+ * this function will permanently delete the instance
+ * and any data that depends on it.
+ *
+ * @global stdObject
+ * @global object
+ * @param int $id
+ * @return bool
+ */
function wiki_delete_instance($id) {
-/// Given an ID of an instance of this module,
-/// this function will permanently delete the instance
-/// and any data that depends on it.
global $CFG, $DB;
if (! $wiki = $DB->get_record("wiki", array("id"=>$id))) {
return $result;
}
+/**
+ * Return a small object with summary information about what a
+ * user has done with a given particular instance of this module
+ * Used for user activity reports.
+ * $return->time = the time they did it
+ * $return->info = a short text description
+ *
+ * @param object $course
+ * @param object $user
+ * @param object $mod
+ * @param object $wiki
+ * @return null
+ */
function wiki_user_outline($course, $user, $mod, $wiki) {
-/// Return a small object with summary information about what a
-/// user has done with a given particular instance of this module
-/// Used for user activity reports.
-/// $return->time = the time they did it
-/// $return->info = a short text description
$return = NULL;
return $return;
}
+/**
+ * Print a detailed representation of what a user has done with
+ * a given particular instance of this module, for user activity reports.
+ *
+ * @param object $course
+ * @param object $user
+ * @param object $mod
+ * @param object $wiki
+ * @return bool true
+ */
function wiki_user_complete($course, $user, $mod, $wiki) {
-/// Print a detailed representation of what a user has done with
-/// a given particular instance of this module, for user activity reports.
-
return true;
}
+/**
+ * Given a course and a time, this module should find recent activity
+ * that has occurred in wiki activities and print it out.
+ * Return true if there was output, or false is there was none.
+ *
+ * @global stdClass
+ * @global object
+ * @param object $course
+ * @param bool $isteacher
+ * @param int $timestart
+ * @return bool
+ */
function wiki_print_recent_activity($course, $isteacher, $timestart) {
-/// Given a course and a time, this module should find recent activity
-/// that has occurred in wiki activities and print it out.
-/// Return true if there was output, or false is there was none.
-
global $CFG, $DB;
$sql = "SELECT l.*, cm.instance
return false;
}
+/**
+ * @global stdClass
+ * @global object
+ * @param string $log
+ * @return array
+ */
function wiki_log_info($log) {
global $CFG, $DB;
return $DB->get_record_sql("SELECT u.firstname, u.lastname
WHERE u.id = ?", array($log->userid));
}
+/**
+ * Function to be run periodically according to the moodle cron
+ * This function searches for things that need to be done, such
+ * as sending out mail, toggling flags etc ...
+ *
+ * @global object
+ * @return bool
+ */
function wiki_cron () {
-/// Function to be run periodically according to the moodle cron
-/// This function searches for things that need to be done, such
-/// as sending out mail, toggling flags etc ...
global $DB;
// Delete expired locks
return $result;
}
+/**
+ * Returns the users with data in one wiki
+ * (users with records in wiki_pages and wiki_entries)
+ *
+ * @global stdClass
+ * @global object
+ * @param int $wikiid
+ * @return array
+ */
function wiki_get_participants($wikiid) {
-//Returns the users with data in one wiki
-//(users with records in wiki_pages and wiki_entries)
+
global $CFG, $DB;
//Get users from wiki_pages
/// Any other wiki functions go here. Each of them must have a name that
/// starts with wiki_
+/**
+ * Return the passed in string in Wiki name format.
+ * Remove any leading and trailing whitespace, capitalize all the words
+ * and then remove any internal whitespace.
+ *
+ * @param string $wikinane
+ * @return string
+ */
function wiki_wiki_name($wikiname) {
-/// Return the passed in string in Wiki name format.
-/// Remove any leading and trailing whitespace, capitalize all the words
-/// and then remove any internal whitespace.
if (wiki_is_wiki_name($wikiname)) {
return $wikiname;
}
}
+/**
+ * Check for correct wikiname syntax and return true or false.
+ *
+ * @param string $wikiname
+ * @return bool
+ */
function wiki_is_wiki_name($wikiname) {
-/// Check for correct wikiname syntax and return true or false.
/// If there are spaces between the words, incorrect format.
if (preg_match_all('/\w+/', $wikiname, $out) > 1) {
}
}
+/**
+ * Determines the wiki's page name and returns it.
+ * @param object $wiki
+ * @return string
+ */
function wiki_page_name(&$wiki) {
-/// Determines the wiki's page name and returns it.
if (!empty($wiki->initialcontent)) {
$ppos = strrpos($wiki->initialcontent, '/');
if ($ppos === false) {
return $pagename;
}
+/**
+ * @global stdClass
+ * @param object $wiki
+ * @return string
+ */
function wiki_content_dir(&$wiki) {
/// Determines the wiki's default content directory (if there is one).
global $CFG;
return $contentdir;
}
+/**
+ * Returns all wikis for the specified course and optionally of the specified type.
+ *
+ * @global object
+ * @param int $courseid
+ * @param string $wtype
+ * @return array
+ */
function wiki_get_course_wikis($courseid, $wtype='*') {
-/// Returns all wikis for the specified course and optionally of the specified type.
global $DB;
$select = 'course = ?';
return $DB->get_records_select('wiki', $select, $params, 'id');
}
+/**
+ * Returns true if wiki already has wiki entries; otherwise false.
+ * @global object
+ * @param object $wiki
+ * @return bool
+ */
function wiki_has_entries(&$wiki) {
-/// Returns true if wiki already has wiki entries; otherwise false.
global $DB;
return $DB->record_exists('wiki_entries', array('wikiid'=>$wiki->id));
}
+/**
+ * Returns an array with all wiki entries indexed by entry id; false if there are none.
+ * If the optional $byindex is specified, returns the entries indexed by that field.
+ * Valid values for $byindex are 'student', 'group'.
+ *
+ * @global stdClass
+ * @global object
+ * @param object $wiki
+ * @param string $byindex
+ */
function wiki_get_entries(&$wiki, $byindex=NULL) {
-/// Returns an array with all wiki entries indexed by entry id; false if there are none.
-/// If the optional $byindex is specified, returns the entries indexed by that field.
-/// Valid values for $byindex are 'student', 'group'.
global $CFG, $DB;
if ($byindex == 'student') {
}
}
+/**
+ * Returns the wiki entry according to the wiki type.
+ *
+ * Optionally, will return wiki entry for $userid student wiki, or
+ * $groupid group or teacher wiki.
+ * Creates one if it needs to and it can.
+ *
+ * @global object
+ * @param object $wiki By reference
+ * @param object $course By reference
+ * @param int $userid
+ * @param int $groupid
+ * @return object
+ */
function wiki_get_default_entry(&$wiki, &$course, $userid=0, $groupid=0) {
-/// Returns the wiki entry according to the wiki type.
-/// Optionally, will return wiki entry for $userid student wiki, or
-/// $groupid group or teacher wiki.
-/// Creates one if it needs to and it can.
global $USER;
/// If there is a groupmode, get the user's group id.
$groupmode = groups_get_activity_groupmode($wiki);
return $wiki_entry;
}
+/**
+ * Returns the wiki entry according to the wiki type.
+ *
+ * Optionally, will return wiki entry for $userid student wiki, or
+ * $groupid group or teacher wiki.
+ * @global object
+ * @param object $wiki By reference
+ * @param object $course By reference
+ * @param int $userid
+ * @param int $groupid
+ * @return object
+ */
function wiki_get_entry(&$wiki, &$course, $userid=0, $groupid=0) {
-/// Returns the wiki entry according to the wiki type.
-/// Optionally, will return wiki entry for $userid student wiki, or
-/// $groupid group or teacher wiki.
global $USER;
switch ($wiki->wtype) {
return $wentry;
}
+/**
+ * Returns the wiki entry for the wiki teacher type.
+ *
+ * @global object
+ * @param object $wiki
+ * @param int $groupid
+ * @return object
+ */
function wiki_get_teacher_entry(&$wiki, $groupid=0) {
global $DB;
-/// Returns the wiki entry for the wiki teacher type.
return $DB->get_record('wiki_entries', array('wikiid'=>$wiki->id, 'course'=>$wiki->course, 'groupid'=>$groupid));
}
+/**
+ * Returns the wiki entry for the given group.
+ *
+ * @global object
+ * @param object $wiki
+ * @param int $groupid
+ * @return object
+ */
function wiki_get_group_entry(&$wiki, $groupid=null) {
global $DB;
-/// Returns the wiki entry for the given group.
return $DB->get_record('wiki_entries', array('wikiid'=>$wiki->id, 'groupid'=>$groupid));
}
+/**
+ * Returns the wiki entry for the given student.
+ *
+ * @global object
+ * @global object
+ * @param object $wiki
+ * @param int $userid
+ * @return object
+ */
function wiki_get_student_entry(&$wiki, $userid=null) {
-/// Returns the wiki entry for the given student.
global $USER, $DB;
if (is_null($userid)) {
return $DB->get_record('wiki_entries', array('wikiid'=>$wiki->id, 'userid'=>$userid));
}
+/**
+ * Returns a list of other wikis to display, depending on the type, group and user.
+ * Returns the key containing the currently selected entry as well.
+ *
+ * @global stdClass
+ * @global int
+ * @global object
+ * @param object $wiki
+ * @param object $user
+ * @param object $course
+ * @param int $currentid
+ * @return array
+ */
function wiki_get_other_wikis(&$wiki, &$user, &$course, $currentid=0) {
- /// Returns a list of other wikis to display, depending on the type, group and user.
- /// Returns the key containing the currently selected entry as well.
-
global $CFG, $id, $DB;
$wikis = false;
return $wikis;
}
+/**
+ * Adds a new wiki entry of the specified type, unless already entered.
+ *
+ * No checking is done here. It is assumed that the caller has the correct
+ * privileges to add this entry.
+ *
+ * @global object
+ * @global object
+ * @param object $wiki
+ * @param object $course
+ * @param int $userid
+ * @param int $groupid
+ * @return bool
+ */
function wiki_add_entry(&$wiki, &$course, $userid=0, $groupid=0) {
-/// Adds a new wiki entry of the specified type, unless already entered.
-/// No checking is done here. It is assumed that the caller has the correct
-/// privileges to add this entry.
-
global $USER, $DB;
/// If this wiki already has a wiki_type entry, return false.
return $DB->insert_record("wiki_entries", $wiki_entry, true);
}
+/**
+ * Returns true or false if the user can add a wiki entry for this wiki.
+ *
+ * @param object $wiki By reference
+ * @param object $user By reference
+ * @param object $course By reference
+ * @param int $userid
+ * @param int $groupid
+ * @return bool
+ */
function wiki_can_add_entry(&$wiki, &$user, &$course, $userid=0, $groupid=0) {
-/// Returns true or false if the user can add a wiki entry for this wiki.
-
/// Get the groupmode. It's been added to the wiki object.
$groupmode = groups_get_activity_groupmode($wiki);
$mygroupid = mygroupid($course->id);
return false;
}
+/**
+ * Returns true or false if the user can edit this wiki entry.
+ *
+ * @param object $wiki_entry by reference
+ * @param object $wiki by reference
+ * @param object $user by reference
+ * @param object $course by reference
+ * @return bool
+ */
function wiki_can_edit_entry(&$wiki_entry, &$wiki, &$user, &$course) {
-/// Returns true or false if the user can edit this wiki entry.
$can_edit = false;
$groupmode = groups_get_activity_groupmode($wiki);
return $can_edit;
}
+/**
+ * @global object
+ * @param object $wiki by reference
+ * @param int $userid
+ * @param object $course
+ * @return bool
+ */
function wiki_user_can_access_student_wiki(&$wiki, $userid, &$course) {
global $USER;
return $can_access;
}
+/**
+ * @global object
+ * @param object $wiki by reference
+ * @param int $groupid
+ * @param object $course
+ * @return bool
+ */
function wiki_user_can_access_group_wiki(&$wiki, $groupid, &$course) {
global $USER;
return $can_access;
}
+/**
+ * @global object
+ * @param object $wiki by reference
+ * @param int $groupid
+ * @param object $course by reference
+ * @return bool
+ */
function wiki_user_can_access_teacher_wiki(&$wiki, $groupid, &$course) {
global $USER;
return $can_access;
}
+/**
+ * @global object
+ * @param object $wiki_entry by reference
+ * @return string
+ */
function wiki_get_owner(&$wiki_entry) {
global $DB;
return $owner;
}
+/**
+ * @todo Add Group and User !!!
+ *
+ * @global stdClass
+ * @param int $cmid
+ * @param string $search
+ * @param int $userid
+ * @param int $groupid
+ * @param bool $return
+ * @return string
+ */
function wiki_print_search_form($cmid, $search="", $userid, $groupid, $return=false) {
global $CFG;
# TODO: Add Group and User !!!
echo $output;
}
+/**
+ * Prints a link-list of special wiki-pages
+ *
+ * @global object
+ * @global string
+ * @param int $cmid
+ * @param bool $binary
+ * @param bool $return
+ */
function wiki_print_wikilinks_block($cmid, $binary=false, $return=false) {
-/// Prints a link-list of special wiki-pages
global $CFG, $ewiki_title;
$links=array();
popup_form(EWIKI_SCRIPT, $links, "wikilinks", "", get_string("choosewikilinks", "wiki"), "", "", $return);
}
+/**
+ * Displays actions which can be performed on the page
+ * @param int $cmit
+ * @param array $specialpages
+ * @param array $page
+ * @param string $action
+ * @param bool $binary
+ * @param bool $canedit
+ */
function wiki_print_page_actions($cmid, $specialpages, $page, $action, $binary=false, $canedit=true) {
-/// Displays actions which can be performed on the page
$page=array();
popup_form(EWIKI_SCRIPT, $page, "wikiactions", "", get_string("action", "wiki"), "", "", false);
}
+/**
+ * Displays actions which can be performed on the page
+ *
+ * @param object $wiki
+ * @param int $cmid
+ * @param int $userid
+ * @param int $groupid
+ * @param object $page
+ * @param bool $noeditor
+ * @param object $course
+ */
function wiki_print_administration_actions($wiki, $cmid, $userid, $groupid, $page, $noeditor, $course) {
-/// Displays actions which can be performed on the page
/// Create the URL
$ewscript = 'admin.php?id='.$cmid;
popup_form($ewscript, $action, "wikiadministration", "", get_string("chooseadministration", "wiki"), "", "", false);
}
+/**
+ * @uses EWIKI_DB_F_TEXT
+ * @uses EWIKI_DB_F_BINARY
+ * @uses EWIKI_DB_F_DISABLED
+ * @uses EWIKI_DB_F_HTML
+ * @uses EWIKI_DB_F_READONLY
+ * @uses EWIKI_DB_F_WRITEABLE
+ * @return array
+ */
function wiki_admin_get_flagarray() {
$ret = array(
EWIKI_DB_F_TEXT => get_string("flagtxt","wiki"),
}
///////// Ewiki Administration. Mostly taken from the ewiki/tools folder and changed
+
+/**
+ * @param bool $pageflagstatus
+ * @return object
+ */
function wiki_admin_setpageflags_list($pageflagstatus) {
$FD = wiki_admin_get_flagarray();
$table = new Object();
return $table;
}
+/**
+ * @param array $pageflags
+ * @return array Status array
+ */
function wiki_admin_setpageflags($pageflags) {
$FD = wiki_admin_get_flagarray();
return $status;
}
-
+/**
+ * @param bool $listall
+ * @return object
+ */
function wiki_admin_remove_list($listall="") {
/// Table header
$table = new Object();
return $table;
}
-/// This function actually removes the pages
+/**
+ * This function actually removes the pages
+ * @param array $pagestodelete
+ * @param object $course
+ * @param object $wiki
+ * @param int $userid
+ * @param int $groupid
+ * @return string
+ */
function wiki_admin_remove($pagestodelete, $course, $wiki, $userid, $groupid) {
$ret="";
foreach ($pagestodelete as $id) {
return $ret;
}
+/**
+ * @param array $pagestostrip
+ * @param string $version
+ * @param string $err
+ * @return object
+ */
function wiki_admin_strip_list($pagestostrip="",$version="",$err="") {
/// Table header
$table = new Object();
return $table;
}
+/**
+ * @param array $pagestostrip
+ * @param string $version
+ * @param string $err
+ * @return array
+ */
function wiki_admin_strip_versions($pagestostrip, $version, &$err) {
$ret=array();
foreach ($pagestostrip as $key => $id_ue) {
return $ret;
}
+/**
+ * @param array $pagestostrip
+ */
function wiki_admin_strip($pagestostrip) {
/// Purges old page-versions
foreach($pagestostrip as $id => $versions) {
}
}
+/**
+ * @return array
+ */
function wiki_admin_checklinks_list() {
$ret=array();
$result = ewiki_database("GETALL",array());
return $ret;
}
+/**
+ * Checks http:// Links
+ * @return string
+ */
function wiki_admin_checklinks($pagetocheck) {
- /// Checks http:// Links
$ret="";
if($pagetocheck) {
$get = ewiki_database("GET", array("id" => $pagetocheck));
return $ret;
}
+/**
+ * @param bool $proceed
+ * @param string $authorfieldpattern
+ * @param int $changesfield
+ * @param string $howtooperate
+ * @param int $deleteversions
+ * @return string
+ */
function wiki_admin_revert($proceed, $authorfieldpattern, $changesfield, $howtooperate, $deleteversions) {
$ret="";
#-- params
}
+/**
+ * @return array
+ */
function wiki_get_view_actions() {
return array('view','view all');
}
+/**
+ * @return array
+ */
function wiki_get_post_actions() {
return array('hack');
}
/**
* Obtains an editing lock on a wiki page.
+ *
+ * @global object
+ * @global object
* @param int $wikiid ID of wiki object.
* @param string $pagename Name of page.
* @return array Two-element array with a boolean true (if lock has been obtained)
* browser crashes or something) since locks time out anyway. This is just
* to avoid confusion of the 'what? it says I'm editing that page but I'm
* not, I just saved it!' variety.
+ *
+ * @global object
* @param int $wikiid ID of wiki object.
* @param string $pagename Name of page.
*/
/**
* Returns all other caps used in module
+ *
+ * @return array
*/
function wiki_get_extra_capabilities() {
return array('moodle/site:accessallgroups', 'moodle/site:viewfullnames');
}
/**
+ * @uses FEATURE_GROUPS
+ * @uses FEATURE_GROUPINGS
+ * @uses FEATURE_GROUPMEMBERSONLY
+ * @uses FEATURE_MOD_INTRO
+ * @uses FEATURE_COMPLETION_TRACKS_VIEWS
+ * @uses FEATURE_GRADE_HAS_GRADE
+ * @uses FEATURE_GRADE_OUTCOMES
* @param string $feature FEATURE_xx constant for requested feature
* @return mixed True if module supports feature, null if doesn't know
*/