<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/405/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jonwitts</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/405/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jonwitts"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/Special:Contributions/Jonwitts"/>
	<updated>2026-05-10T19:08:45Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Antivirus_plugins&amp;diff=151131</id>
		<title>Talk:Antivirus plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Antivirus_plugins&amp;diff=151131"/>
		<updated>2025-03-04T14:40:12Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: broken link in article fixed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Antivirus_plugins&amp;diff=151130</id>
		<title>Antivirus plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Antivirus_plugins&amp;diff=151130"/>
		<updated>2025-03-04T14:39:40Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: fix broken link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Security}}&lt;br /&gt;
An administrator can enable and configure virus scanners for use on uploaded files via &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Antivirus plugins &amp;gt; Manage antivirus plugins&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
ClamAV antivirus is available as a standard plugin. It&#039;s likely that more antivirus plugins will be available in future from the [https://moodle.org/plugins/ Moodle plugins directory].&lt;br /&gt;
&lt;br /&gt;
==ClamAV antivirus==&lt;br /&gt;
&lt;br /&gt;
To make use of ClamAV antivirus, ClamAV® should be installed on your server. See http://www.clamav.net for more information.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* RHEL/CentOS and [https://en.wikipedia.org/wiki/Security-Enhanced_Linux SELinux]: https://moodle.org/mod/forum/discuss.php?d=316066&lt;br /&gt;
* RHEL/CentOS and [https://access.redhat.com/blogs/766093/posts/1976243 PrivateTmp]: https://moodle.org/mod/forum/discuss.php?d=364706&lt;br /&gt;
* Improve performance by using ClamDScan https://moodle.org/mod/forum/discuss.php?d=382731&lt;br /&gt;
&lt;br /&gt;
[[Category:Site administration]]&lt;br /&gt;
&lt;br /&gt;
[[eu:Antibirusa]]&lt;br /&gt;
[[de:Antivirus]]&lt;br /&gt;
[[es:Plugins antivirus]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Pedagogy&amp;diff=150849</id>
		<title>Pedagogy</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Pedagogy&amp;diff=150849"/>
		<updated>2025-01-09T12:04:53Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Social Constructionism as a Referent */ update link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{About Moodle}}&lt;br /&gt;
Let&#039;s sit back and really reflect on the pedagogy that is at the core of what we, as online educators, are trying to do.&lt;br /&gt;
&lt;br /&gt;
==Definition of Pedagogy==&lt;br /&gt;
One definition of [http://en.wiktionary.org/wiki/Pedagogy pedagogy] in Wiktionary says&lt;br /&gt;
#The profession of teaching&lt;br /&gt;
#The activities of educating, teaching or instructing&lt;br /&gt;
&lt;br /&gt;
Wikipedia has a much longer page on [http://en.wikipedia.org/wiki/Pedagogy Pedagogy]. At one point it said Pedagogy is the art or science of being a teacher, generally refers to strategies of instruction, or a style of instruction. The word comes from the Ancient Greek παιδαγωγέω (paidagōgeō; from παῖς (child) and ἄγω (lead)): literally, &amp;quot;to lead the child”.&lt;br /&gt;
&lt;br /&gt;
==Moodle in three short paragraphs==&lt;br /&gt;
&lt;br /&gt;
The heart of Moodle is courses that contain activities and resources. There are about 20 different types of activities available (forums, glossaries, wikis, assignments, quizzes, choices (polls), SCORM players, databases etc) and each can be customised quite a lot. The main power of this activity-based model comes in combining the activities into sequences and groups, which can help you guide participants through learning paths. Thus, each activity can build on the outcomes of previous ones.&lt;br /&gt;
&lt;br /&gt;
There are a number of other tools that make it easier to build communities of learners, including blogs, messaging, participant lists etc, as well as useful tools like grading, reports, integration with other systems and so on.&lt;br /&gt;
&lt;br /&gt;
For more about Moodle, see http://moodle.org, and particularly the main community “course” called [http://moodle.org/course/view.php?id=5 Moodle in English]. It&#039;s crowded and busy these days, but jump in and you&#039;ll soon find interesting stuff I&#039;m sure. The developers and the users are deliberately forced to mix in the same forums. The other great place to start is our [https://docs.moodle.org/ online documentation] which is a community-developed wiki site.&lt;br /&gt;
&lt;br /&gt;
==Social Constructionism as a Referent==&lt;br /&gt;
&lt;br /&gt;
I have these five points on a slide which I use in every presentation I do. They are useful referents taken from research that apply to education in general, boiled down into a simple list that I carry around under the moniker of &amp;quot;social constructionism&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;All of us are potential teachers as well as learners - in a true collaborative environment we are both&#039;&#039;&#039;.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; It&#039;s so important to recognise and remember this.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; I think this perspective helps us retain some humility as teachers and fight the (very natural!) tendency to consolidate all your history and assume the revered position of “wise source of knowledge”.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; It helps us keep our eyes open for opportunities to allow the other participants in our learning situation to share their ideas with us and to remind us to listen carefully and ask good questions that elicit more from others.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; I find I need to constantly remind myself of this point, especially when the culture of a situation pushes me into a central role (like now!)&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;We learn particularly well from the act of creating or expressing something for others to see.&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; For most of us this is basically “learning by doing”, and is fairly obvious, yet it&#039;s worth reminding ourselves of it. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; It&#039;s surprising how much online learning is still just presenting static information, giving students little opportunity to practice the activities they are learning about. I often see online teachers spending a great deal of time constructing perfect resources for their course, which no doubt is a terrific learning experience for them, but then they deny their students that same learning experience. Even textbooks often do a better job, with exercises after every chapter and so on.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; Most importantly, such learning is best when you are expressing and presenting posts, projects, assignments, constructions etc &#039;&#039;&#039;for others to see&#039;&#039;&#039;. In this situation your personal “stakes” are a lot higher, and a lot of self-checking and reflection takes place that increases learning. Seymour Papert (the inventor of logo) famously described the process of constructing something for others to see as a very powerful learning experience, and really this sort of thinking goes right back to Socrates and beyond.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;We learn a lot by just observing the activity of our peers&#039;&#039;&#039;.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; Basically this is about “classroom culture”, or learning by osmosis. Humans are good at watching each other and learning what to do in a given situation through cues from others. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; For example, if you walk into a lecture theatre where everyone is sitting in seats, facing the front, listening quietly to the teacher at the front and taking notes, then that&#039;s most likely what you are going to do too, right?&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; If you are in a less rigid class where people are asking questions all the time, then it&#039;s likely you&#039;ll feel freer to do so too. By doing so you&#039;ll be learning about both the subject itself and the meta-subject of how learning occurs from overhearing the discussions of your peers and the kinds of questions that get asked, leading to a richer multi-dimensional immersion in learning.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;By understanding the contexts of others, we can teach in a more transformational way (constructivism)&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; As you probably know from experience, advice from a mentor or friend can provide a better, more timely and customised learning experience than with someone who doesn&#039;t know you and is speaking to a hundred people.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; If we understand the background of the people we are speaking to then we can customise our language and our expression of concepts in ways that are best suited to the audience. You can choose metaphors that you know the audience will relate to. You can use jargon where it helps or avoid jargon when it gets in the way.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; Again this is a pretty basic idea - every guide to public speaking talks about knowing your audience - but in online learning we need to be particularly mindful of this because we often have not met these people in person and don&#039;t have access to many visual and auditory cues.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;A learning environment needs to be flexible and adaptable, so that it can quickly respond to the needs of the participants within it&#039;&#039;&#039;.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; Combining all the above, if you as a learning facilitator want to take advantage of your growing knowledge about your participants, giving them tailored opportunities to share ideas, ask questions and express their knowledge, then you need an environment which is flexible, both in time and space.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; If you discover that you need to throw your schedule out the window because your participants know a lot less than you&#039;d expected when you first designed the course, you should be able to readjust the schedule, and easily add new activities to help everyone (or just one group) catch up. Likewise, some great ideas for a simulation or something may have come up during discussions, so you should be able to add those later in the course.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; Timewise, your participants may be spread over different time-zones, or maybe they live in the same time-zone but have differing free time, so you should be able to offer asynchronous activities where people can work together but at different times.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Jason Cole from Open University recently referred to these as “Martin&#039;s five laws” (ha!) but really they are referents: guiding concepts that I personally find useful to refer to whenever I need to make a decision in any given educational situation. In particular I find them useful for building &#039;&#039;&#039;communities of learners&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
I guess you probably find a lot of this familiar, even if you use different terms. If not there is a lot of research about constructionism, constructivism and social Constructionism which you can find out more about in some of [https://dougiamas.com/archives/ my more formal papers].&lt;br /&gt;
&lt;br /&gt;
==How Moodle tries to support a Social Constructionist view==&lt;br /&gt;
&lt;br /&gt;
I&#039;m going to go through the earlier list again, this time pointing out existing features in Moodle. Pedagogy and software design are closely intertwined in online learning - the &amp;quot;shape&amp;quot; of the software can help or hinder the teacher in what they are trying to do.&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;All of us are potential teachers as well as learners - in a true collaborative environment we are both&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; Many of the activities in Moodle are designed to allow students to control common content, such as forums, wikis, glossaries, databases, messaging and so on. This encourages students to add to the total course experience for others.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; We made a huge step with a  Roles implementation which further breaks down the distinction of teachers and students, allowing Moodle system administrators and teachers to create new roles with any mix of capabilities they like. If you want students to be allowed to facilitate forums, create quiz questions or even control the course layout then you can. There is a very fine degree of control – for example you can allow students the ability to delete posts in just one single forum if you like.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; I hope that people will take these  features and experiment with control in their courses, allowing students more flexibility to do things that were previously thought of as something teachers should do.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;We learn particularly well from the act of creating or expressing something for others to see&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; Moodle has a wide range of ways in which people can create representations of their knowledge and share them.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* The course structure itself is terrific way to construct a shared and active representation of the learning journey that everyone is going through.&lt;br /&gt;
#* Forums of course are the core of this, providing spaces for discussion and sharing of media and documents (using the media plugin filters, attachments or simply links).&lt;br /&gt;
#* Wikis are collaboratively-built pages useful for group work and other negotiations.&lt;br /&gt;
#* Glossaries are collaboratively-built lists of definitions that can then appear throughout the course.&lt;br /&gt;
#* Databases are an extension of this idea allowing participants to enter structured media of any type (for example a collection of digital photos or a library of references). &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;We learn a lot by just observing the activity of our peers&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; The participants link in the navigation block is the main place where you can see everyone in your course. It shows a lot of information about your participants and how recently they&#039;ve been there.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; An Online Users block is the best way to see everyone else who might be on right now.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; The Recent Activity block shows a great deal of information about what has happened recently, and via link you can see reports with more detail. Things that happened not only include changes to the course and forum posts, etc, but also things like assignment submissions and quiz attempts. Students can&#039;t see the results that other students got from these activities, but they do get some sense that everyone is submitting Assignment 1 now and this peer pressure hopefully helps those who need it.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; Finally, almost all the modules will &amp;quot;tag&amp;quot; an entry or change with the name of the user, so that you can see who did what and when. For example, wiki pages all have a history link with full details on every edit.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;By understanding the contexts of others, we can teach in a more transformational way (constructivism)&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; There are many different ways to find out about people. Access to these can be decided on a site basis (different sites have different privacy policies): &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* The user profile contains several fields where people can provide information about their background, etc. In particular there is a user profile photograph, which appears throughout Moodle whenever that person writes something. The photo links back to the profile page.&lt;br /&gt;
#* A compendium of forum posts (and discussion starters) by that person in that course (or across the site).&lt;br /&gt;
#* Individual blogs allow people to express things in a public but reflective way, often providing access to thinking that might not normally expressed in, say, a forum. Others can give comments on the blog posts.&lt;br /&gt;
#* Overall activity reports show all the contributions from a user in a course, including assignment submissions, glossary entries, etc.&lt;br /&gt;
#* User log reports show detailed logs of every action taken by a person in Moodle, as well as graphs showing overall activity statistics.&lt;br /&gt;
#* The survey module provides a variety of proven questionnaire instruments for discovering interesting information about the state of mind of the group.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
# &#039;&#039;&#039;A learning environment needs to be flexible and adaptable, so that it can quickly respond to the needs of the participants within it&#039;&#039;&#039;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
#* The course page itself is the main tool for a teacher, allowing them to add/remove and structure activities as necessary. Changing the course is one button click away at any time, so the teacher can change it on a whim. We have AJAX features, so that activities, sections and blocks can all be simply dragged-and-dropped. Access can be restricted according to time, conditions or user profile fields.&lt;br /&gt;
#* Roles can be applied individually in every context across the site, and can be further tweaked with overrides. So if you want to create one single quiz where everyone has access to everybody&#039;s results, or allow parents of students to see parts of your course, then you can.&lt;br /&gt;
#* Navigation around the course and site is automatically generated.&lt;br /&gt;
#* The gradebook is automatically maintained, and reflects the activities in the course at any given time.&lt;br /&gt;
#* There are preferences for many aspects of appearance and behaviour, at site, course and activity levels, allowing educators to fine-tune the behaviour of Moodle in many ways.&lt;br /&gt;
#* External systems can be integrated easily, to maintain authentication, enrolments and other things, allowing Moodle to react smoothly as data in other systems is modified. &amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Finding a balance==&lt;br /&gt;
&lt;br /&gt;
Before I talk about where we are going, let me talk a little about the balance that a Course Management System (aka VLE) like Moodle needs to achieve. One thing I found out quickly in a community like ours is that people have a wide range of expectations of online learning.&lt;br /&gt;
&lt;br /&gt;
At the authoritarian extreme there are those who want students to be highly controlled: reading resources that are revealed at set times and later sitting quizzes to prove they read those resources. I call this the rat-in-the-maze approach, or dump-and-pump.&lt;br /&gt;
&lt;br /&gt;
At the techno-hippy end of that spectrum there are those who want to devolve management completely, with every user running their own portfolio site, streaming blogs and files to each other using RSS and trackbacks. It&#039;s an interesting dream that really opens up thinking about education but I think the problems to be solved are many (such as security, accountability, the structure of institutions etc).&lt;br /&gt;
&lt;br /&gt;
The vast majority of people that I meet fall somewhere between these two extremes. Many of them are new to online learning, and are looking for the next step beyond what they were being paid to do offline, while being accepting of gentle guidance to improving their online techniques. These people are on a steep learning curve already without facing the aggregation of 100 different blogs.&lt;br /&gt;
&lt;br /&gt;
==Progression==&lt;br /&gt;
&lt;br /&gt;
Moodle needs to be flexible to cater for a wide variety of needs while remaining simple enough for ordinary teachers to start making good use of the power of the internet for community building and collaborative learning. My hope is that Moodle can be seen as a toolbox where they can start simply and naturally, and then progress to more and more advanced community facilitation over time. Ultimately, we&#039;d like to see teachers being involved with and supported by a community of their peers.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s look at a typical progression that a teacher might go through as they learn to use the Moodle tools:&lt;br /&gt;
&lt;br /&gt;
# Putting up the handouts (Resources, SCORM)&lt;br /&gt;
# Providing a passive Forum (unfacilitated)&lt;br /&gt;
# Using Quizzes and Assignments (less management)&lt;br /&gt;
# Using the Wiki, Glossary and Database tools (interactive content)&lt;br /&gt;
# Facilitate discussions in Forums, asking questions, guiding&lt;br /&gt;
# Combining activities into sequences, where results feed later activities&lt;br /&gt;
# Introduce external activities and games (internet resources)&lt;br /&gt;
# Using the Survey module to study and reflect on course activity&lt;br /&gt;
# Using peer-review modules like Workshop, giving students more control over grading and even structuring the course in some ways&lt;br /&gt;
# Conducting active research on oneself, sharing ideas in a community of peers&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Repositories and Portfolios===&lt;br /&gt;
&lt;br /&gt;
Special-purpose [[Repository|repositories]]&lt;br /&gt;
are a growing area, and it means institutions can keep their valuable data where they want to, even if they switch front-end systems like VLEs. &lt;br /&gt;
Most importantly, this will allow the development of e-Portfolios to explode, and these are something I think a lot of us really want to see as a very positive pedagogical enhancement.&lt;br /&gt;
&lt;br /&gt;
===Community Hubs===&lt;br /&gt;
&lt;br /&gt;
We want to improve the way teachers and users of Moodle communicate with each other, not only about e-learning and Moodle, but also in their subject areas. For example, imagine a Biology 101 teacher finding a &amp;quot;community search&amp;quot; block in their course, taking them straight to a place where their peers are all discussing best practice for teaching Biology 101, sharing and browsing repositories of course materials and learning designs.&lt;br /&gt;
&lt;br /&gt;
The creation of networking between Moodles allows anyone to turn their Moodle site into a [[Community_hubs|Moodle Community Hub]]. Login between Moodles is transparent but secure and fully controlled by site administrators. The peer-to-peer nature of the design  allows all sorts of interesting scenarios to develop.&lt;br /&gt;
&lt;br /&gt;
===Interaction between tools===&lt;br /&gt;
&lt;br /&gt;
By piping all the messaging from throughout the system via the Messaging module that we already have, users have a much finer control over exactly what sorts of messages they want to see.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Metadata and outcome statements===&lt;br /&gt;
&lt;br /&gt;
Moodle has a mechanism so that:&lt;br /&gt;
&lt;br /&gt;
# admins can import a long list of outcome statements (as tags)&lt;br /&gt;
# teachers can relate a subset of these to their course&lt;br /&gt;
# teachers can connect each activity to an even smaller subset&lt;br /&gt;
&lt;br /&gt;
[[Tracking_progress|Progress Tracking]]  allows these things to be guided by individual learning plans for each student.&lt;br /&gt;
&lt;br /&gt;
===Role-playing and scenario simulations===&lt;br /&gt;
&lt;br /&gt;
A popular and effective technique in face-to-face teaching is that of role-playing in scenarios, and this can be difficult to do online. You could imagine an Environmental Science course running a role-playing simulation where some students play the government, some as Greenpeace, some as industry for a particular scenario.&lt;br /&gt;
&lt;br /&gt;
The plans for this have been around for a long time, but I hope it can be developed soon. It would be a module where people can be assigned roles within a simulated situation and appear to others anonymously in those roles, interacting in forums, wikis, and all the other tools in Moodle according to the rules of the simulation.&lt;br /&gt;
&lt;br /&gt;
==What else would you like to see?==&lt;br /&gt;
&lt;br /&gt;
I hope this has stimulated some thoughts about the sorts of things you would like to see in your ideal online learning environment. If so, please join in with the discussions on http://moodle.org and let&#039;s brainstorm them a bit. I hope we can come up with some new ideas to put in the [http://tracker.moodle.org Moodle Tracker], or at least some support or modifications for old ones.&lt;br /&gt;
&lt;br /&gt;
==Interesting links==&lt;br /&gt;
&lt;br /&gt;
* [http://muppetmasteruk.blogspot.com/2010/06/effective-use-of-guerra-scale-in-moodle.html Effective use of the Guerra Scale in Moodle]&lt;br /&gt;
* [[Bloom&#039;s_taxonomy | Bloom&#039;s taxonomy]] Is, arguably, one of the most commonly used pedagogies in 6-10 education today.&lt;br /&gt;
* [http://www.uq.edu.au/teach/assessment/docs/biggs-SOLO.pdf Solo Pedagogy] An alternative to Bloom&#039;s is SOLO (Structure of the Observed Learning Outcome) Taxonomy. &lt;br /&gt;
&lt;br /&gt;
[[Category:Pedagogy]]&lt;br /&gt;
&lt;br /&gt;
[[es:Pedagogia]]&lt;br /&gt;
[[de:Pädagogik]]&lt;br /&gt;
[[fr:Pédagogie]]&lt;br /&gt;
[[it:Pedagogia]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Pedagogy&amp;diff=150848</id>
		<title>Talk:Pedagogy</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Pedagogy&amp;diff=150848"/>
		<updated>2025-01-09T12:03:57Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Broken link... */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===References to up and coming Moodle 2===&lt;br /&gt;
I understand this page is based on a talk Martin gave a while back, but I wonder if we should perhaps rephrase the parts where he talks about the up and coming features of Moodle 2.0 such as community hubs/repositories/messaging etc? I appreciate as a transcript it is a useful archive but on the other hand for people who are not aware of that it  might be a bit confusing?--[[User:Mary Cooch|Mary Cooch]] 04:33, 20 January 2013 (WST)&lt;br /&gt;
&lt;br /&gt;
:Hi Mary, I think the page should be updated. The original version will always be available via the page history. --[[User:Helen Foster|Helen Foster]] 18:53, 21 January 2013 (WST)&lt;br /&gt;
&lt;br /&gt;
===Broken link...===&lt;br /&gt;
Hello ladies, could you please update the link to Martin&#039;s formal papers? The current link is this: https://dougiamas.com/writing/ but it&#039;s broken :(&lt;br /&gt;
Perhaps it should be this: https://dougiamas.com/writing/tlf2000/ ? --[[User:anna krassa|Anna Krassa]] 7:50, 7 November 2016 (GTM+2)&lt;br /&gt;
&lt;br /&gt;
:Thanks Anna, I have updated the link. --[[User:Helen Foster|Helen Foster]] ([[User talk:Helen Foster|talk]]) 14:21, 8 November 2016 (AWST)&lt;br /&gt;
&lt;br /&gt;
:I have updated the link to this https://dougiamas.com/archives/ as it seems to link to a greater list of writings than the previous link. [[User:Jon Witts|Jon Witts]] ([[User talk:Jon Witts|talk]]) 12:03, 9 January 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Grade_calculations&amp;diff=142638</id>
		<title>Grade calculations</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Grade_calculations&amp;diff=142638"/>
		<updated>2021-12-03T11:58:27Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Setting a grade calculation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Managing grades}}&lt;br /&gt;
A grade calculation is a formula used to determine grades, based on other grade items. Note that this is not the same as [[Calculated_question_type|Calculated question types]].&lt;br /&gt;
&lt;br /&gt;
Grade calculations follow the pattern of formulas/functions in popular spreadsheet programs. They start with an equal (=) sign, and use common mathematical operators and functions to produce a single numerical output. This output is then used as the computed value for the grade item you are editing.&lt;br /&gt;
&lt;br /&gt;
Conditional (IF) operators can be used in grade calculations of the grade book, and logical operators (AND,OR) can be also used (MDL-64414).&lt;br /&gt;
==Setting a grade calculation==&lt;br /&gt;
[[File:Edit Calculated Grade.png|alt=|thumb|Edit calculation setting]]&lt;br /&gt;
[[Image:newcalculationgrade.png|thumb|Example calculation]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To set a grade calculation:&lt;br /&gt;
&lt;br /&gt;
# Login as teacher or other user with permission to edit grades&lt;br /&gt;
# Click on Grades in the course administration block&lt;br /&gt;
# Click &#039;View &amp;gt; Grader Report&#039;&lt;br /&gt;
# Click &#039;Turn Editing On&#039;; a &#039;Controls&#039; bar should appear above the grades&lt;br /&gt;
# Click the &#039;Calculator&#039; icon above the grade item or category you wish to edit. Note: if you don&#039;t see this, then it must be enabled in &#039;&#039;Site administration&amp;gt;Grades&amp;gt;Report settings&amp;gt;Grader report&amp;gt;Show calculations&#039;&#039;&lt;br /&gt;
# Start with an equal sign (=)&lt;br /&gt;
# Type an expression using numbers, arithmetic operators, mathematical functions and ID numbers; for example =average()&lt;br /&gt;
# Plug in your ID numbers (see below) enclosed in double square brackets, for example =&amp;lt;nowiki&amp;gt;[[item1]]&amp;lt;/nowiki&amp;gt;+&amp;lt;nowiki&amp;gt;[[item2]]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
# Separate each function argument with a comma, as in =average(&amp;lt;nowiki&amp;gt;[[item1]]&amp;lt;/nowiki&amp;gt;, &amp;lt;nowiki&amp;gt;[[item2]]&amp;lt;/nowiki&amp;gt;)+&amp;lt;nowiki&amp;gt;[[item3]]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
# Click the &amp;quot;Save Changes&amp;quot; button&lt;br /&gt;
&lt;br /&gt;
==Assigning ID numbers==&lt;br /&gt;
You can include the values of other grade items by using their ID number as references in your formulas. The ID number must be surrounded by double square brackets, for example if you have a grade item with Quiz.3 as ID number, you can refer this item using &amp;lt;nowiki&amp;gt;[[Quiz.3]]&amp;lt;/nowiki&amp;gt; in your calculation.&lt;br /&gt;
&lt;br /&gt;
Below the calculation field there is a list of your course grade categories and grade items. Next to each item or category&#039;s total there is the ID number you can use in your calculation (already surrounded with the required double square brackets).&lt;br /&gt;
&lt;br /&gt;
However, since ID numbers are optional, some items may not yet have one. Each item without ID number have a form field that you can use to enter its ID number directly. As soon as you have assigned the ID numbers you need, you must click the &amp;quot;Add ID numbers&amp;quot; button; the page will reload and show you the same list including the ID numbers you have just assigned. Now you can use them in your grade calculation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: Moodle does not allow calculations involving no ID numbers.&lt;br /&gt;
==Calculation functions==&lt;br /&gt;
Every grade calculation must start with an equal sign (=) followed by an expression using operators and functions supported by the system.&lt;br /&gt;
All common arithmetic operators are supported&lt;br /&gt;
* addition, using the plus (+) sign&lt;br /&gt;
* subtraction, using the minus (-) sign&lt;br /&gt;
* multiplication, using the asterisk (*) character&lt;br /&gt;
* division, using the slash (/) character&lt;br /&gt;
* exponentiation, using the caret (^) character&lt;br /&gt;
with their usual evaluation precedence rules: exponentiations are evaluated first, then multiplications and divisions are performed, finally additions and subtraction are carried out; so, the expression =1+2-3*4/5^6 gives almost 3 (2,999232). Different precedences can be forced using round parentheses, as in the expression =((((1+2)-3)*4)/5)^6 which yields 0.&lt;br /&gt;
&lt;br /&gt;
Functions can also appear in expressions, using a separator between their arguments listed within round brackets. &lt;br /&gt;
&amp;lt;div class=&amp;quot;alert alert-danger&amp;quot;&amp;gt;Important:&lt;br /&gt;
&amp;lt;ul&amp;gt;&amp;lt;li&amp;gt;For the English language pack this separator is a comma (,).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;For other [[Language|languages]] the separator could be a different character, for example a semicolon (;).&amp;lt;/li&amp;gt;&amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
* average&amp;lt;nowiki&amp;gt;([[item1]], [[item2]]...)&amp;lt;/nowiki&amp;gt;: Returns the average of the values in a list of arguments&lt;br /&gt;
* ceil(number): Maps a real number to the smallest following integer&lt;br /&gt;
* floor(number): Maps a real number to the largest previous integer&lt;br /&gt;
* if&amp;lt;nowiki&amp;gt;([[item1]], [[item2]], [[item3]]):&amp;lt;/nowiki&amp;gt; Evaluates the first argument (condition) and returns the second argument if the condition is not zero (true condition) and returns the third argument if the condition is zero (false condition).&lt;br /&gt;
* max&amp;lt;nowiki&amp;gt;([[item1]], [[item2]]...)&amp;lt;/nowiki&amp;gt;: Returns the maximum value in a list of arguments&lt;br /&gt;
* min&amp;lt;nowiki&amp;gt;([[item1]], [[item2]]...)&amp;lt;/nowiki&amp;gt;: Returns the minimum value in a list of arguments&lt;br /&gt;
* mod(dividend, divisor): Calculates the remainder of a division&lt;br /&gt;
* pi(): Returns the value of the number Pi (3.14159265...)&lt;br /&gt;
* power(base, exponent): Raises a number to the exponent power (this is the same as base^exponent)&lt;br /&gt;
* round(number, count): Rounds number to count decimal digits&lt;br /&gt;
* sum&amp;lt;nowiki&amp;gt;([[item1]], [[item2]]...)&amp;lt;/nowiki&amp;gt;: Returns the sum of all arguments (this is the same as &amp;lt;nowiki&amp;gt;[[item1]]+[[item2]]+...&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
Many other mathematical functions are also supported:&lt;br /&gt;
* sin()&lt;br /&gt;
* sinh()&lt;br /&gt;
* arcsin()&lt;br /&gt;
* asin()&lt;br /&gt;
* arcsinh()&lt;br /&gt;
* asinh()&lt;br /&gt;
* cos()&lt;br /&gt;
* cosh()&lt;br /&gt;
* arccos()&lt;br /&gt;
* acos()&lt;br /&gt;
* arccosh()&lt;br /&gt;
* acosh()&lt;br /&gt;
* tan()&lt;br /&gt;
* tanh()&lt;br /&gt;
* arctan()&lt;br /&gt;
* atan()&lt;br /&gt;
* arctanh()&lt;br /&gt;
* atanh()&lt;br /&gt;
* sqrt()&lt;br /&gt;
* abs()&lt;br /&gt;
* ln()&lt;br /&gt;
* log()&lt;br /&gt;
* exp()&lt;br /&gt;
==Example calculations==&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;=max([[Quiz.1]], [[Quiz.4]], [[Assignment.1]])&amp;lt;/nowiki&amp;gt; - Returns the maximum value of the grades referred by Quiz.1, Quiz.4 and Assignment.1&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;=average(max([[Quiz.1]], [[Quiz.4]], [[Assignment.1]]), min([[Quiz.1]], [[Quiz.4]], [[Assignment.1]]))&amp;lt;/nowiki&amp;gt; - Returns the average of the maximum and the minimum values among Quiz.1, Quiz.4 and Assignment.1 (functions can be nested)&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;=sum([[item1]]*0.3, [[item2]]*0.6, [[item3]]*2)&amp;lt;/nowiki&amp;gt; - Returns a weighted grade sum where item1 is weighted 30%, item2 is weighted at 60% and item3 is weighted at 200%&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;=if([[midtermexam]]&amp;gt;=5, [[midtermexam]]+[[lab]], 0)&amp;lt;/nowiki&amp;gt; - Returns the sum of midtermexam and lab items if the midtermexam grade is 5 of more, and 0 otherwise. This is a very handy way of dealing with conditional evaluation in a course.&lt;br /&gt;
* &amp;lt;nowiki&amp;gt;=if(AND([[item1]]&amp;gt;=5, [[item2]]&amp;gt;=5), ([[item1]]+[[item2]])/2, 0)&amp;lt;/nowiki&amp;gt; - Returns the average of item1 and item2 if both have 5 of more, and 0 otherwise. This is a very handy way of dealing with sine qua non activities.&lt;br /&gt;
==Calculations when user language is not English==&lt;br /&gt;
Calculations and formulas use decimal and list separators as defined in the [https://docs.moodle.org/dev/Translation_langconfig langconfig.php] file of each [[Language packs|language pack]].&lt;br /&gt;
&lt;br /&gt;
The [[Decimal separator|decimal separator]] (the symbol used to mark the boundary between the integral and the fractional parts of a decimal number) is a point (.) in English. In other languages it may be a comma (,).&lt;br /&gt;
&lt;br /&gt;
Analogously, the list separator (the symbol used to separate the items within a list, such as the arguments of a function) is a comma (,) in English. In other languages it may be a semicolon (;).&lt;br /&gt;
==See also==&lt;br /&gt;
*[http://www.youtube.com/watch?v=WKUGyzAXcyA Video on how to set up calculations in the gradebook (basic)]&lt;br /&gt;
*[http://www.youtube.com/watch?v=VBEj8mmu8lM Video on how to set up calculations in the gradebook (advanced)]&lt;br /&gt;
[[ca:grade/edit/tree/calculation]]&lt;br /&gt;
[[es:Cálculos de calificación]]&lt;br /&gt;
[[fr:Calcul de note]]&lt;br /&gt;
[[ru:Формулы и вычисления оценок]]&lt;br /&gt;
[[ja:評定計算]]&lt;br /&gt;
[[de:Bewertungen berechnen]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=File:Edit_Calculated_Grade.png&amp;diff=142637</id>
		<title>File:Edit Calculated Grade.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=File:Edit_Calculated_Grade.png&amp;diff=142637"/>
		<updated>2021-12-03T11:58:16Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Edit Calculated Grade&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Usage&amp;diff=141598</id>
		<title>Usage</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Usage&amp;diff=141598"/>
		<updated>2021-08-27T12:03:12Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Maintenance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{About Moodle}}&lt;br /&gt;
==Who uses Moodle?==&lt;br /&gt;
Moodle is used by a variety of institutions and individuals, including:&lt;br /&gt;
* Universities &lt;br /&gt;
* High schools &lt;br /&gt;
* Primary schools&lt;br /&gt;
* Government departments &lt;br /&gt;
* Healthcare organisations &lt;br /&gt;
* Military organistions&lt;br /&gt;
* Airlines&lt;br /&gt;
* Oil companies &lt;br /&gt;
* Homeschoolers&lt;br /&gt;
* Independent educators&lt;br /&gt;
* special educators&lt;br /&gt;
==How many Moodle sites are there==&lt;br /&gt;
There are tens of thousands of registered Moodle sites in the sites list that we maintain; however it is impossible to know exactly how many Moodle sites exist because Moodle is open source, free to download and distribute, and doesn&#039;t force registration on its users. Very often we find people, will not inform us about their sites.&lt;br /&gt;
&lt;br /&gt;
For up-to-date summary statistics about registered sites browse the [https://stats.moodle.org/ Moodle statistics] page. Statistics shown on this page are updated daily to provide an accurate summary of collected information.&lt;br /&gt;
You can also browse the [https://stats.moodle.org/sites/ Registered sites] page, which provides a useful list of registered sites grouped by country for all sites that have chosen to make their information public.&lt;br /&gt;
==How statistics are collected and maintained==&lt;br /&gt;
===Registration===&lt;br /&gt;
All information collected is from site administrators that have registered their sites. See [[Site registration]] for further details.&lt;br /&gt;
&lt;br /&gt;
Registration data is updated automatically by a scheduled task. The administrator can also manually update their registration at any time.&lt;br /&gt;
===Moderation===&lt;br /&gt;
To ensure that the statistics that we collect are as accurate as possible there are certain conditions that a registered site has to meet in order to be included into both the statistics and sites pages.&lt;br /&gt;
&lt;br /&gt;
When a site first registers we check the information about the site to ensure that the URL they have provided is valid and that the email address for the site administrator is a valid email address.&lt;br /&gt;
===Maintenance===&lt;br /&gt;
Like most of the web many sites come and go. Since we strive to maintain accurate statistics we need to check registered sites on a regular basis and clean out old data.&lt;br /&gt;
A sophisticated, automated site check process is used to undertake the task of checking every registered site on a weekly basis.&lt;br /&gt;
&lt;br /&gt;
In checking registered sites, every site is visited by our site check program that then evaluates and scores each site individually based on a collection of a number of defined rules that we have set to identify each and every Moodle release. The score that a site receives determines whether the site is included in the sites list or not.&lt;br /&gt;
&lt;br /&gt;
Any site that fails the evaluation is then removed from the list of registered sites and not included in any statistics.&lt;br /&gt;
===Ensuring your site passes the weekly evaluation===&lt;br /&gt;
To ensure that your site passes the weekly evaluation check that your site meets the following three criteria.&lt;br /&gt;
* Check the URL you registered is the URL of your Moodle registration. We check only the page returned from the URL you registered, we don&#039;t dig down into your site, or search any alternatives.&lt;br /&gt;
* Check the site is publicly available on the Internet. We can&#039;t check your site if it is only available locally, or has been wrapped in any means of authentication.&lt;br /&gt;
* Ensure you have content when you register your site. If you don&#039;t have any content when you register it is likely we will dismiss your site as a test site. Ensure that you have created at least one course, and three users within your installation before registering.&lt;br /&gt;
To find out when we last came through, you can check your web server logs. Look for page requests that have the following user-agent:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MoodleBot-LinkChecker (+https://docs.moodle.org/en/Usage)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
==See also==&lt;br /&gt;
*[[:Category:Installations|Moodle installation listings]]&lt;br /&gt;
[[de:Nutzung]]&lt;br /&gt;
[[es:Uso]]&lt;br /&gt;
[[fr:Utilisation]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Usage&amp;diff=141597</id>
		<title>Usage</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Usage&amp;diff=141597"/>
		<updated>2021-08-27T12:02:01Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Registration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{About Moodle}}&lt;br /&gt;
==Who uses Moodle?==&lt;br /&gt;
Moodle is used by a variety of institutions and individuals, including:&lt;br /&gt;
* Universities &lt;br /&gt;
* High schools &lt;br /&gt;
* Primary schools&lt;br /&gt;
* Government departments &lt;br /&gt;
* Healthcare organisations &lt;br /&gt;
* Military organistions&lt;br /&gt;
* Airlines&lt;br /&gt;
* Oil companies &lt;br /&gt;
* Homeschoolers&lt;br /&gt;
* Independent educators&lt;br /&gt;
* special educators&lt;br /&gt;
==How many Moodle sites are there==&lt;br /&gt;
There are tens of thousands of registered Moodle sites in the sites list that we maintain; however it is impossible to know exactly how many Moodle sites exist because Moodle is open source, free to download and distribute, and doesn&#039;t force registration on its users. Very often we find people, will not inform us about their sites.&lt;br /&gt;
&lt;br /&gt;
For up-to-date summary statistics about registered sites browse the [https://stats.moodle.org/ Moodle statistics] page. Statistics shown on this page are updated daily to provide an accurate summary of collected information.&lt;br /&gt;
You can also browse the [https://stats.moodle.org/sites/ Registered sites] page, which provides a useful list of registered sites grouped by country for all sites that have chosen to make their information public.&lt;br /&gt;
==How statistics are collected and maintained==&lt;br /&gt;
===Registration===&lt;br /&gt;
All information collected is from site administrators that have registered their sites. See [[Site registration]] for further details.&lt;br /&gt;
&lt;br /&gt;
Registration data is updated automatically by a scheduled task. The administrator can also manually update their registration at any time.&lt;br /&gt;
===Moderation===&lt;br /&gt;
To ensure that the statistics that we collect are as accurate as possible there are certain conditions that a registered site has to meet in order to be included into both the statistics and sites pages.&lt;br /&gt;
&lt;br /&gt;
When a site first registers we check the information about the site to ensure that the URL they have provided is valid and that the email address for the site administrator is a valid email address.&lt;br /&gt;
===Maintenance===&lt;br /&gt;
Like most of the web many sites come and go. Since we strive to maintain accurate statistics we need to check registered sites on a regular basis and clean out old data.&lt;br /&gt;
A sophisticated, automated site check process is used to undertake the task of checking every registered site on a weekly basis.&lt;br /&gt;
&lt;br /&gt;
In checking registered sites every sites is visited by our site check program that then evaluates and scores each site individually based on a collection of a number of defined rules that we have set to identify each and every Moodle release. The score that a site receives determines whether the site is included in the sites list or not.&lt;br /&gt;
&lt;br /&gt;
Any site that fails the evaluation is then removed from the list of registered sites and not included in any statistics.&lt;br /&gt;
===Ensuring your site passes the weekly evaluation===&lt;br /&gt;
To ensure that your site passes the weekly evaluation check that your site meets the following three criteria.&lt;br /&gt;
* Check the URL you registered is the URL of your Moodle registration. We check only the page returned from the URL you registered, we don&#039;t dig down into your site, or search any alternatives.&lt;br /&gt;
* Check the site is publicly available on the Internet. We can&#039;t check your site if it is only available locally, or has been wrapped in any means of authentication.&lt;br /&gt;
* Ensure you have content when you register your site. If you don&#039;t have any content when you register it is likely we will dismiss your site as a test site. Ensure that you have created at least one course, and three users within your installation before registering.&lt;br /&gt;
To find out when we last came through, you can check your web server logs. Look for page requests that have the following user-agent:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;MoodleBot-LinkChecker (+https://docs.moodle.org/en/Usage)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
==See also==&lt;br /&gt;
*[[:Category:Installations|Moodle installation listings]]&lt;br /&gt;
[[de:Nutzung]]&lt;br /&gt;
[[es:Uso]]&lt;br /&gt;
[[fr:Utilisation]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Assign_roles&amp;diff=119954</id>
		<title>Assign roles</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Assign_roles&amp;diff=119954"/>
		<updated>2015-10-01T10:34:20Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Enabling teachers to assign the role of teacher */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Roles}}&lt;br /&gt;
==Context and roles==&lt;br /&gt;
&lt;br /&gt;
*In Moodle,  apart from the site administrator, users do not normally have a global, site-wide role. In other words, even though you may be a tutor offline, when you are in Moodle you could have a tutor role in the course you teach in but a student role in another course where you are studying for a diploma. There are a few exceptions but this is generally the case.&lt;br /&gt;
*Because of the way Moodle works,assigning roles is done for a particular context. A site and course are examples of two different contexts. When you create a new role or tweak a pre-existing role via &#039;&#039;Administration &amp;gt; Site Administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;, you are asked in which context(s) you want the role to be assigned:&lt;br /&gt;
[[File:rolecontexttypes.png]]&lt;br /&gt;
&lt;br /&gt;
*Here are some examples of contexts; how to get to the assign roles screen, and when/why you would assign roles here:&lt;br /&gt;
&lt;br /&gt;
===System context===&lt;br /&gt;
*&#039;&#039;Administration &amp;gt; Site Administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Assign system roles&#039;&#039;&lt;br /&gt;
*Any roles assigned here apply to the whole Moodle site. It makes sense therefore that only roles that need this functionality can be assigned here. The [[Manager]] role and [[Course creator]] role are examples of two such roles. Assigning a teacher or student here would result in their being able to teach/study in every single course on the site, which is not usually desirable. &lt;br /&gt;
*If you really feel your Moodle needs to have teachers or students assigned in the system context, go to the teacher/student role in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; and check the &amp;quot;system&amp;quot; box. Then search for and allow the capability [[Capabilities/moodle/course:view|moodle/course:view]]&lt;br /&gt;
&lt;br /&gt;
=====Assigning system roles by CSV=====&lt;br /&gt;
{{New features}}&lt;br /&gt;
&lt;br /&gt;
Where certain custom roles are applied in the system context, it is possible to upload users to that role in bulk by adding the field &#039;&#039;sysrole1&#039;&#039; (etc) to a CSV file.&lt;br /&gt;
&lt;br /&gt;
[[File:GlobalRoles1.png|thumb|500px|center|sysrole column]]&lt;br /&gt;
&lt;br /&gt;
When previewed, there is a column indicating their system role:&lt;br /&gt;
&lt;br /&gt;
[[File:GlobalRoles2.png|thumb|center|500px|Preview screen]]&lt;br /&gt;
&lt;br /&gt;
Once uploaded, the users are present on the &#039;Assign system roles&#039; screen:&lt;br /&gt;
&lt;br /&gt;
[[File:GlobalRoles3.png|thumb|center|500px|Assign system roles screen]]&lt;br /&gt;
&lt;br /&gt;
See [[Upload users]] for information on adding users to roles via CSV.&lt;br /&gt;
&lt;br /&gt;
===Front page context===&lt;br /&gt;
*&#039;&#039;Administration &amp;gt; Site Administration &amp;gt; Front Page&amp;gt;Users&amp;gt;Permissions&amp;gt;Assigned roles&lt;br /&gt;
*Those with a role in the system context do not need to be assigned a role here as well.&lt;br /&gt;
*However you might want to allow a teacher to manage items on the front page; in this instance, you would assign them the role on the Front page.&lt;br /&gt;
&lt;br /&gt;
===Course Category context===&lt;br /&gt;
*See [[Category enrolments]]&lt;br /&gt;
*Users may be enrolled in the category to save enrolling them in each individual course in that category.&lt;br /&gt;
&lt;br /&gt;
===Course context===&lt;br /&gt;
[[File:enrolusers.png|thumb|Enrol users]]&lt;br /&gt;
* Go to &#039;&#039;Administration &amp;gt; Course administration &amp;gt; Enrolled users&#039;&#039;&lt;br /&gt;
* Click the &amp;quot;Enrol users&amp;quot; button and click those users you wish to enrol&lt;br /&gt;
&lt;br /&gt;
The dropdown menu at the top shows roles for which you are allowed to enrol; typically those users with lower roles than you. See [[Enrolled users]] for more details.&lt;br /&gt;
&lt;br /&gt;
===Block context===&lt;br /&gt;
*(Within the block) &#039;&#039;Administration &amp;gt; Assign roles&#039;&#039;&lt;br /&gt;
*You may wish to assign roles to a block if, for instance you want specific people to see the block but for it to be hidden from others&lt;br /&gt;
&lt;br /&gt;
=== Activity Module context===&lt;br /&gt;
*(Within the activity settings) &#039;&#039;Administration &amp;gt; Locally assigned roles&#039;&#039;&lt;br /&gt;
*An example of this is assigning a student the teacher role locally in an individual activity like a forum so they can moderate their classmates&#039; posts while still retaining the student role in the rest of the course.&lt;br /&gt;
&lt;br /&gt;
===User context===&lt;br /&gt;
*The most common use of this is for the Parent role. &lt;br /&gt;
*When the Parent role is created via&#039;&#039;Administration &amp;gt; Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039; the &amp;quot;user&amp;quot; context box is checked.&lt;br /&gt;
*To assign a parent the role in the context of their child (so they can see their child&#039;s grades etc) click the child&#039;s profile and then go to &#039;&#039;Administration&amp;gt;Roles&amp;gt;Assign roles relative to this user&#039;&#039;&lt;br /&gt;
*See [[Parent role]] for more information.&lt;br /&gt;
&lt;br /&gt;
The assign roles page lists the names of users assigned to each role (unless there are more than 10 users, in which case this is stated).&lt;br /&gt;
&lt;br /&gt;
==Hierarchy==&lt;br /&gt;
&lt;br /&gt;
By assigning a role to a user in a certain context, you grant them the permissions contained in that role for the current context and all lower contexts.&lt;br /&gt;
&lt;br /&gt;
The list of contexts in hierarchical order is as follows:&lt;br /&gt;
&lt;br /&gt;
*System (no parent)&lt;br /&gt;
*Front page (parent = system) - &lt;br /&gt;
*Course category (parent = parent category or system)&lt;br /&gt;
*Course (parent = category or system)&lt;br /&gt;
*Module (parent = course or system) &lt;br /&gt;
*Block (parent = course or system)&lt;br /&gt;
*User (parent = system)&lt;br /&gt;
&lt;br /&gt;
Roles can be inherited.  For example if a user is assigned a Teacher role in a specific course category then the user will have this role in ALL courses within the category. Tip: use the override feature in a specific context for exceptions.&lt;br /&gt;
&lt;br /&gt;
Roles will only work if the role assignment is made in the correct context. Some examples: a Teacher role should be assigned to a user in the course or course category context, a Forum moderator for a particular forum should be assigned in that specific forum.&lt;br /&gt;
&lt;br /&gt;
==Assigning someone the role of Site administrator==&lt;br /&gt;
&lt;br /&gt;
*Site administrators are assigned via a special page: &#039;&#039;Administration &amp;gt; Site Administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Site Administrators&#039;&#039;. Select the name from the right and move it over to the left:&lt;br /&gt;
[[File:managesiteadmins.png]]&lt;br /&gt;
*The original (primary) administrator cannot be deleted.&lt;br /&gt;
&lt;br /&gt;
==Checking a user&#039;s role assignments==&lt;br /&gt;
&lt;br /&gt;
A user&#039;s role assignments can be checked by going to their profile page then in the administration block under the profile settings for the user, clicking &#039;This user&#039;s role assignments&#039;.&lt;br /&gt;
&lt;br /&gt;
==Hidden roles==&lt;br /&gt;
&lt;br /&gt;
If you want to provide users with access to the course, but don&#039;t want them to be visible in the participants list, use the [[Other users]] link in the course administration menu (&#039;&#039;Administration &amp;gt; Course Administration &amp;gt; Users &amp;gt; Other Users&#039;&#039;). Assigning roles here provides course access, and editing rights according to the permissions set for the role assigned without actually enrolling the user in the course. This is similar to the functionality of the &amp;quot;hidden user&amp;quot; check box in previous versions of Moodle.&lt;br /&gt;
&lt;br /&gt;
Note: By default, the only role which can be assigned to other users is the manager role. To enable other roles, such as teacher to be assigned, the capability [[Capabilities/moodle/course:view|moodle/course:view]] should be allowed for the role (see below).&lt;br /&gt;
&lt;br /&gt;
==Enabling teachers to assign the role of teacher==&lt;br /&gt;
&lt;br /&gt;
By default, teachers are only allowed to assign the roles of non-editing teacher, student and guest. To enable teachers to assign the role of teacher:&lt;br /&gt;
&lt;br /&gt;
#Access &#039;&#039;Site Administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;.&lt;br /&gt;
#Click the tab &amp;quot;Allow role assignments&amp;quot;.&lt;br /&gt;
#Click the checkbox where the teacher row and column intersect.&lt;br /&gt;
#Click the &amp;quot;Save changes&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
==Beware of assignments that don&#039;t make sense==&lt;br /&gt;
&lt;br /&gt;
There are many role assignments that do not make sense as the underlying functionality does not exist. Just because you give someone the &amp;quot;right&amp;quot; to do something does not guarantee that the interface or facility actually exists within the context that you have assigned that right. For example, you can assign a user the right to create new categories in the category context. However there is no interface within Moodle to do that (category creation is only available at the system level).&lt;br /&gt;
&lt;br /&gt;
==Multiple assignments==&lt;br /&gt;
&lt;br /&gt;
A significant part of the roles infrastructure is the ability to assign a user into multiple roles (at the same time). The capabilities of each role are merged to produce the effective set of capabilities. For example, a user could be  both a Teacher and Student in the same course. You should be careful to ensure that if you change a user&#039;s role that you remove them from any other roles as required as this will no longer be done automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Creating custom roles]]&lt;br /&gt;
*[[Enrolment]]&lt;br /&gt;
*[[Managing roles]] - for administrators&lt;br /&gt;
*[[Useful things a teacher can do with roles]]&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=59900 Discrepancies between Assign Roles lists and Participants list]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=66782 What happens if a user has multiple roles in a course?]&lt;br /&gt;
&lt;br /&gt;
[[Category:Roles]]&lt;br /&gt;
&lt;br /&gt;
[[de:Rollen zuweisen]]&lt;br /&gt;
[[es:Asignar_roles]]&lt;br /&gt;
[[eu:Rolak_esleitu]]&lt;br /&gt;
[[fr:Attribuer des rôles]]&lt;br /&gt;
[[ja:ロールの割り当て]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=question/type/ddmarker&amp;diff=119143</id>
		<title>question/type/ddmarker</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=question/type/ddmarker&amp;diff=119143"/>
		<updated>2015-06-28T15:18:36Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* More documentation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Questions}}Drag and drop marker questions allow for multiple markers to be placed onto an image and the positioning of each marker to be assessed.&lt;br /&gt;
&lt;br /&gt;
[[File:markerexample.png]]&lt;br /&gt;
&lt;br /&gt;
Drag and drop marker questions differ from Drag and drop onto image questions in that there are no predefined areas on the underlying image that are visible to the student. &lt;br /&gt;
&lt;br /&gt;
This is a question type created and maintained by the Open University.&lt;br /&gt;
&lt;br /&gt;
== More documentation ==&lt;br /&gt;
&lt;br /&gt;
More [http://www.open.edu/openlearnworks/mod/oucontent/view.php?id=52747&amp;amp;section=2.5.1 documentation is available] on the Open University&#039;s [http://www.open.edu/openlearn/ OpenLearn site].&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/plugins/browse.php?list=set&amp;amp;id=10 Other Moodle plugins from the Open University]&lt;br /&gt;
* [http://moodle.org/plugins/browse.php?list=category&amp;amp;id=29 Other third-party question type plugins]&lt;br /&gt;
* [http://labspace.open.ac.uk/course/view.php?id=3484 eAssessment at the Open University with open source software]&lt;br /&gt;
* [http://www.somerandomthoughts.com/blog/2012/02/20/review-question-type-drag-and-drop-marker-for-moodle-2/ Review of this question type]&lt;br /&gt;
* [http://www.youtube.com/watch?v=Tvl4GuGvtxc Video tutorial: How to Create a Question Using the Drag and Drop with Markers Question Type]&lt;br /&gt;
[[Category:Contributed code]]&lt;br /&gt;
&lt;br /&gt;
[[de:question/type/ddmarker]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Dataform_notification_block&amp;diff=117560</id>
		<title>Dataform notification block</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Dataform_notification_block&amp;diff=117560"/>
		<updated>2015-03-16T21:18:55Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Git clone */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dataform | innertrail = ► [[Dataform Plugins|Plugins and components ]]  }}&lt;br /&gt;
&lt;br /&gt;
{{Infobox plugin&lt;br /&gt;
|type = Blocks&lt;br /&gt;
|set = https://moodle.org/plugins/browse.php?list=set&amp;amp;id=4&lt;br /&gt;
|entry = http://moodle.org/plugins/view.php?plugin=block_dataformnotification&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/CONTRIB/component/13430 &lt;br /&gt;
|discussion = http://moodle.org/mod/forum/view.php?id=3505&lt;br /&gt;
|maintainer = [[User:Itamar Tzadok|Itamar Tzadok]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Dataform notification block provides context and settings for [Dataform_module|Dataform activity] notification rules. The Dataform notification rules allow sending custom messages to specified recipients on specified Dataform events. &lt;br /&gt;
&lt;br /&gt;
==Features==&lt;br /&gt;
* General Dataform rule settings&lt;br /&gt;
&lt;br /&gt;
* Dataform notification settings&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
===Git clone===&lt;br /&gt;
* Type the following command in the root of your Moodle install: git clone git://github.com/itamart/moodle-block_dataformnotification.git blocks/dataformnotification&lt;br /&gt;
* Add /blocks/dataformnotification to your .git/info/exclude.&lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation.&lt;br /&gt;
&lt;br /&gt;
===Download===&lt;br /&gt;
* Download zip from: https://github.com/itamart/moodle-block_dataformaccessview/zipball/master or http://moodle.org/plugins/pluginversions.php?plugin=block_dataformnotification&lt;br /&gt;
* Unzip into the &#039;blocks&#039; subfolder of your Moodle install.&lt;br /&gt;
* Rename the new folder to dataform_view.&lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation.&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
===General settings===&lt;br /&gt;
[[File:df-rule-general-settings.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Notification settings===&lt;br /&gt;
[[File:df-rule-notification-settings.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Dataform_field_access_block&amp;diff=117559</id>
		<title>Dataform field access block</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Dataform_field_access_block&amp;diff=117559"/>
		<updated>2015-03-16T21:15:10Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Git clone */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dataform | innertrail = ► [[Dataform Plugins|Plugins and components ]]  }}&lt;br /&gt;
&lt;br /&gt;
{{Infobox plugin&lt;br /&gt;
|type = Blocks&lt;br /&gt;
|set = https://moodle.org/plugins/browse.php?list=set&amp;amp;id=4&lt;br /&gt;
|entry = http://moodle.org/plugins/view.php?plugin=block_dataformaccessfield&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/CONTRIB/component/13430 &lt;br /&gt;
|discussion = http://moodle.org/mod/forum/view.php?id=8192&lt;br /&gt;
|maintainer = [[User:Itamar Tzadok|Itamar Tzadok]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The Dataform field access block provides context and settings for [[Dataform_module|Dataform activity]] view access rules. The field access rules allow for controlling access to specific fields.&lt;br /&gt;
&lt;br /&gt;
==Features==&lt;br /&gt;
* General Dataform rule settings&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
===Git clone===&lt;br /&gt;
* Type the following command in the root of your Moodle install: git clone git://github.com/itamart/moodle-block_dataformaccessfield blocks/dataformaccessfield&lt;br /&gt;
* Add /blocks/dataformaccessfield to your .git/info/exclude.&lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation.&lt;br /&gt;
&lt;br /&gt;
===Download===&lt;br /&gt;
* Download zip from:  or &lt;br /&gt;
* Unzip into the &#039;blocks&#039; subfolder of your Moodle install.&lt;br /&gt;
* Rename the new folder to &lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation.&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
===General settings===&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Dataform_field_access_block&amp;diff=117510</id>
		<title>Dataform field access block</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Dataform_field_access_block&amp;diff=117510"/>
		<updated>2015-03-16T12:00:57Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* General settings */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dataform | innertrail = ► [[Dataform Plugins|Plugins and components ]]  }}&lt;br /&gt;
&lt;br /&gt;
{{Infobox plugin&lt;br /&gt;
|type = Blocks&lt;br /&gt;
|set = https://moodle.org/plugins/browse.php?list=set&amp;amp;id=4&lt;br /&gt;
|entry = http://moodle.org/plugins/view.php?plugin=block_dataformaccessfield&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/CONTRIB/component/13430 &lt;br /&gt;
|discussion = http://moodle.org/mod/forum/view.php?id=8192&lt;br /&gt;
|maintainer = [[User:Itamar Tzadok|Itamar Tzadok]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The Dataform field access block provides context and settings for [[Dataform_module|Dataform activity]] view access rules. The field access rules allow for controlling access to specific fields.&lt;br /&gt;
&lt;br /&gt;
==Features==&lt;br /&gt;
* General Dataform rule settings&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
===Git clone===&lt;br /&gt;
* Type the following command in the root of your Moodle install: git clone &lt;br /&gt;
* Add /blocks/ to your .git/info/exclude.&lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation.&lt;br /&gt;
&lt;br /&gt;
===Download===&lt;br /&gt;
* Download zip from:  or &lt;br /&gt;
* Unzip into the &#039;blocks&#039; subfolder of your Moodle install.&lt;br /&gt;
* Rename the new folder to &lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation.&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
===General settings===&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Dataform_field_access_block&amp;diff=117509</id>
		<title>Dataform field access block</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Dataform_field_access_block&amp;diff=117509"/>
		<updated>2015-03-16T12:00:34Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dataform | innertrail = ► [[Dataform Plugins|Plugins and components ]]  }}&lt;br /&gt;
&lt;br /&gt;
{{Infobox plugin&lt;br /&gt;
|type = Blocks&lt;br /&gt;
|set = https://moodle.org/plugins/browse.php?list=set&amp;amp;id=4&lt;br /&gt;
|entry = http://moodle.org/plugins/view.php?plugin=block_dataformaccessfield&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/CONTRIB/component/13430 &lt;br /&gt;
|discussion = http://moodle.org/mod/forum/view.php?id=8192&lt;br /&gt;
|maintainer = [[User:Itamar Tzadok|Itamar Tzadok]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The Dataform field access block provides context and settings for [[Dataform_module|Dataform activity]] view access rules. The field access rules allow for controlling access to specific fields.&lt;br /&gt;
&lt;br /&gt;
==Features==&lt;br /&gt;
* General Dataform rule settings&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
===Git clone===&lt;br /&gt;
* Type the following command in the root of your Moodle install: git clone &lt;br /&gt;
* Add /blocks/ to your .git/info/exclude.&lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation.&lt;br /&gt;
&lt;br /&gt;
===Download===&lt;br /&gt;
* Download zip from:  or &lt;br /&gt;
* Unzip into the &#039;blocks&#039; subfolder of your Moodle install.&lt;br /&gt;
* Rename the new folder to &lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation.&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
===General settings===&lt;br /&gt;
[[Image:Dataform_Manage-Access.png]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Dataform_view_access_block&amp;diff=117508</id>
		<title>Dataform view access block</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Dataform_view_access_block&amp;diff=117508"/>
		<updated>2015-03-16T11:58:14Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dataform | innertrail = ► [[Dataform Plugins|Plugins and components ]]  }}&lt;br /&gt;
&lt;br /&gt;
{{Infobox plugin&lt;br /&gt;
|type = Blocks&lt;br /&gt;
|set = https://moodle.org/plugins/browse.php?list=set&amp;amp;id=4&lt;br /&gt;
|entry = http://moodle.org/plugins/view.php?plugin=block_dataformaccessview&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/CONTRIB/component/13430 &lt;br /&gt;
|discussion = http://moodle.org/mod/forum/view.php?id=3505&lt;br /&gt;
|maintainer = [[User:Itamar Tzadok|Itamar Tzadok]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Dataform view access block provides context and settings for [[Dataform_module|Dataform activity]] view access rules. The view access rules allow for controlling access to specific views.&lt;br /&gt;
&lt;br /&gt;
==Features==&lt;br /&gt;
* General Dataform rule settings&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
===Git clone===&lt;br /&gt;
* Type the following command in the root of your Moodle install: git clone git://github.com/itamart/moodle-block_dataformaccessview.git blocks/dataformaccessview&lt;br /&gt;
* Add /blocks/dataformaccessview to your .git/info/exclude.&lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation.&lt;br /&gt;
&lt;br /&gt;
===Download===&lt;br /&gt;
* Download zip from: https://github.com/itamart/moodle-block_dataformaccessview/zipball/master or http://moodle.org/plugins/pluginversions.php?plugin=block_dataformaccessview&lt;br /&gt;
* Unzip into the &#039;blocks&#039; subfolder of your Moodle install.&lt;br /&gt;
* Rename the new folder to dataform_view.&lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation.&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
===General settings===&lt;br /&gt;
[[File:df-rule-general-settings.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Dataform_entry_access_block&amp;diff=117507</id>
		<title>Dataform entry access block</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Dataform_entry_access_block&amp;diff=117507"/>
		<updated>2015-03-16T11:57:51Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dataform | innertrail = ► [[Dataform Plugins|Plugins and components ]]  }}&lt;br /&gt;
&lt;br /&gt;
{{Infobox plugin&lt;br /&gt;
|type = Blocks&lt;br /&gt;
|set = https://moodle.org/plugins/browse.php?list=set&amp;amp;id=4&lt;br /&gt;
|entry = http://moodle.org/plugins/view.php?plugin=block_dataformaccessentry&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/CONTRIB/component/13430 &lt;br /&gt;
|discussion = http://moodle.org/mod/forum/view.php?id=3505&lt;br /&gt;
|maintainer = [[User:Itamar Tzadok|Itamar Tzadok]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The Dataform entry access block provides context and settings for [[Dataform_module|Dataform activity]] entry access rules. The entry access rules allow for controlling access to entries that have a specified content in specified views.&lt;br /&gt;
&lt;br /&gt;
==Features==&lt;br /&gt;
* Entry filter settings for creating content specific entry access rules. &lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
===Git clone===&lt;br /&gt;
* Type the following command in the root of your Moodle install: git clone git://github.com/itamart/moodle-block_dataformaccessentry.git blocks/dataformaccessentry&lt;br /&gt;
* Add /blocks/dataformaccessentry to your .git/info/exclude.&lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation.&lt;br /&gt;
&lt;br /&gt;
===Download===&lt;br /&gt;
* Download zip from: https://github.com/itamart/moodle-block_dataformaccessentry/zipball/master or http://moodle.org/plugins/pluginversions.php?plugin=block_dataformaccessentry&lt;br /&gt;
* Unzip into the &#039;blocks&#039; subfolder of your Moodle install.&lt;br /&gt;
* Rename the new folder to dataform_view.&lt;br /&gt;
* Visit http://yoursite.com/admin to finish the installation.&lt;br /&gt;
&lt;br /&gt;
==Configuration==&lt;br /&gt;
===General settings===&lt;br /&gt;
[[File:df-rule-general-settings.png]]&lt;br /&gt;
&lt;br /&gt;
===Entry filter settings===&lt;br /&gt;
&lt;br /&gt;
[[File:df-rule-access-entry-filter-settings.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Dataform_field_access_block&amp;diff=117506</id>
		<title>Dataform field access block</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Dataform_field_access_block&amp;diff=117506"/>
		<updated>2015-03-16T11:55:49Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dataform | innertrail = ► [[Dataform Plugins|Plugins and components ]]  }}&lt;br /&gt;
[[Image:Dataform_Manage-Access.png]] &lt;br /&gt;
{{Infobox plugin&lt;br /&gt;
|type = Blocks&lt;br /&gt;
|set = https://moodle.org/plugins/browse.php?list=set&amp;amp;id=4&lt;br /&gt;
|entry = http://moodle.org/plugins/view.php?plugin=block_dataformaccessfield&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/CONTRIB/component/13430 &lt;br /&gt;
|discussion = http://moodle.org/mod/forum/view.php?id=8192&lt;br /&gt;
|maintainer = [[User:Itamar Tzadok|Itamar Tzadok]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=File:Dataform_Manage-Access.png&amp;diff=117505</id>
		<title>File:Dataform Manage-Access.png</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=File:Dataform_Manage-Access.png&amp;diff=117505"/>
		<updated>2015-03-16T11:54:21Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Dataform_field_access_block&amp;diff=117504</id>
		<title>Dataform field access block</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Dataform_field_access_block&amp;diff=117504"/>
		<updated>2015-03-16T11:53:50Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Dataform | innertrail = ► [[Dataform Plugins|Plugins and components ]]  }}&lt;br /&gt;
[[Image:Manage-Access Edit Manage-Access.png]]&lt;br /&gt;
{{Infobox plugin&lt;br /&gt;
|type = Blocks&lt;br /&gt;
|set = https://moodle.org/plugins/browse.php?list=set&amp;amp;id=4&lt;br /&gt;
|entry = http://moodle.org/plugins/view.php?plugin=block_dataformaccessfield&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/CONTRIB/component/13430 &lt;br /&gt;
|discussion = http://moodle.org/mod/forum/view.php?id=8192&lt;br /&gt;
|maintainer = [[User:Itamar Tzadok|Itamar Tzadok]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=mod/dataform/access/index&amp;diff=117503</id>
		<title>mod/dataform/access/index</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=mod/dataform/access/index&amp;diff=117503"/>
		<updated>2015-03-16T11:48:55Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: Redirected page to Dataform field access block&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Dataform_field_access_block]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Upgrading&amp;diff=117214</id>
		<title>Upgrading</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Upgrading&amp;diff=117214"/>
		<updated>2015-02-26T15:29:54Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Finishing the upgrade */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}	&lt;br /&gt;
&#039;&#039;This page explains in detail how to upgrade Moodle. For a summary of the process, see [[Upgrade overview]].&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Check the requirements==&lt;br /&gt;
&lt;br /&gt;
Check that your server meets all requirements for 2.8 in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Server &amp;gt; [[Environment]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Note: You can only upgrade to Moodle 2.8 from Moodle 2.2 or later. If upgrading from earlier versions, you must [https://docs.moodle.org/22/en/Upgrading_to_Moodle_2.2 upgrade to 2.2] as a first step.&lt;br /&gt;
&lt;br /&gt;
==Before upgrading==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;We advise that you test the upgrade first on a COPY of your production site, to make sure it works as you expect.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Backup important data ==&lt;br /&gt;
&lt;br /&gt;
There are three areas that should be backed up before any upgrade:&lt;br /&gt;
#Moodle software (For example, everything in server/htdocs/moodle)&lt;br /&gt;
#Moodle uploaded files (For example, server/moodledata)&lt;br /&gt;
#Moodle database (For example, your Postgres or MySQL database dump)&lt;br /&gt;
&lt;br /&gt;
See [[Site backup]] for more specific information.&lt;br /&gt;
&lt;br /&gt;
== Check for plugin updates ==&lt;br /&gt;
&lt;br /&gt;
If you have [[Automatic updates deployment]] enabled, you will be able to update installed plugins automatically during the upgrade. Just make sure you check for available updates (via the button for it) at the Plugins check screen.&lt;br /&gt;
&lt;br /&gt;
If you are updating plugins manually, it is a good moment now to check in the [http://moodle.org/plugins Moodle Plugins directory] whether there is a 2.8 version available for any plugins (including themes) that you have previously installed on your site. If so, download the plugin package. In the next step, you will copy it to the appropriate location in your Moodle code (see [[Installing plugins]]).&lt;br /&gt;
&lt;br /&gt;
The upgrade of the plugin will then happen as part of the Moodle upgrade process.&lt;br /&gt;
&lt;br /&gt;
If an out-of-date plugin causes your upgrade to fail, you can usually delete the plugin code rather than uninstalling it from within Moodle so that the data associated with it is not deleted.&lt;br /&gt;
&lt;br /&gt;
==Put your site into maintenance mode==&lt;br /&gt;
Before you begin upgrading your site, you should put it into [[Maintenance_mode | maintenance mode]] to stop any non-admin users from logging in. Then you should wait for any currently running cron processes to complete before proceeding.&lt;br /&gt;
&lt;br /&gt;
== Install the new Moodle software ==&lt;br /&gt;
You can fetch the current (2.8) version of the software through &lt;br /&gt;
&lt;br /&gt;
wget http://sourceforge.net/projects/moodle/files/Moodle/stable28/moodle-latest-28.tgz&lt;br /&gt;
&lt;br /&gt;
=== Standard install package ===&lt;br /&gt;
&lt;br /&gt;
# Move your old Moodle software program files to another location. &#039;&#039;Do NOT copy new files over the old files.&#039;&#039;&lt;br /&gt;
# Unzip or unpack the upgrade file so that all the new Moodle software program files are in the location the old files used to be in on the server. Moodle will adjust SQL and moodledata if it needs to in the upgrade.&lt;br /&gt;
# Copy your old [[Configuration file|config.php file]] back to the new Moodle directory. &lt;br /&gt;
# As mentioned above, if you had installed any plugins on your site you should add them to the new code tree now. It is important to check that you get the correct version for your new version of Moodle. Be particularly careful that you do not overwrite any code in the new version of Moodle.&lt;br /&gt;
# Dont forget to also copy over your moodledata folder / directory.  If you don&#039;t you will get a &amp;quot;fatal error $cfg- dataroot is not configured properly&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
 mv moodle moodle.backup&lt;br /&gt;
 tar xvzf moodle-2.8.tgz&lt;br /&gt;
&lt;br /&gt;
Next, copy across your config.php, any custom plugins, and your .htaccess file if you created one (&#039;&#039;&#039;check that custom plugins are the correct version for your new Moodle first&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 cp moodle.backup/config.php moodle&lt;br /&gt;
 cp -pr moodle.backup/theme/mytheme moodle/theme/mytheme&lt;br /&gt;
 cp -pr moodle.backup/mod/mymod moodle/mod/mymod&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to make moodle/config.php (and the rest of the source code) readable by your www server. Ideally the files should not be writeable by your server.&lt;br /&gt;
&lt;br /&gt;
If you use cron, take care that cron.php is executeable and uses the correct php command: &lt;br /&gt;
 chmod 740 admin/cli/cron.php (some configurations need chmod 750 or chmod 755)&lt;br /&gt;
 copy the first line from cron.php (if it looks like &#039;#!/usr/local/bin/php&#039; or &#039;#!/usr/local/bin/php5.3&#039;, no need to copy &#039;&amp;lt;?php&#039;)&lt;br /&gt;
&lt;br /&gt;
if necessary.&lt;br /&gt;
&lt;br /&gt;
=== Using Git ===&lt;br /&gt;
&lt;br /&gt;
You can use Git for updating or upgrading your Moodle. See [[Git for Administrators]] for details.&lt;br /&gt;
&lt;br /&gt;
===Command line upgrade===&lt;br /&gt;
&lt;br /&gt;
On Linux servers, Moodle 2.8 supports running the [[CLI|upgrade from the command line]], rather than through a web browser. This is likely to be more reliable, particularly for large sites.&lt;br /&gt;
&lt;br /&gt;
== Finishing the upgrade ==&lt;br /&gt;
&lt;br /&gt;
The last step is to trigger the upgrade processes within Moodle. &lt;br /&gt;
&lt;br /&gt;
If you put your site into Maintenance mode earlier; take it out now!&lt;br /&gt;
&lt;br /&gt;
To do this just go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Notifications&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Moodle will automatically detect the new version and perform all the SQL database or file system upgrades that are necessary. If there is anything it can&#039;t do itself (very rare) then you will see messages telling you what you need to do.&lt;br /&gt;
&lt;br /&gt;
Assuming all goes well (no error messages) then you can start using your new version of Moodle and enjoy the new features!&lt;br /&gt;
&lt;br /&gt;
Note: If you are running multiple servers then you should purge all caches manually (via &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Development &amp;gt; Purge all caches&#039;&#039;) after completing the upgrade on all servers.&lt;br /&gt;
&lt;br /&gt;
===Fatal error: Maximum execution time of 30 seconds exceeded...===&lt;br /&gt;
&lt;br /&gt;
If your server uses a main language other than English, you may encounter a &#039;Fatal error: Maximum execution time of 30 seconds exceeded&#039; when you try to upgrade it. You can increase max_execution_time = 160 on php.ini to allow the scripts enough time to process the language update. Otherwise, you can switch to English as the default language before doing the upgrade and back to your original language after a succcessful upgrade. See the forum discussion at https://moodle.org/mod/forum/discuss.php?d=119598.&lt;br /&gt;
&lt;br /&gt;
==After upgrading==&lt;br /&gt;
&lt;br /&gt;
The config.php file from your installation should work fine but if you take a look at config-dist.php that came with Moodle 2.8 there are more/different options available (e.g. database drivers and settings). It&#039;s a good idea to map your old config.php settings to a new one based on the 2.8 config-dist.php.&lt;br /&gt;
&lt;br /&gt;
===Cron===&lt;br /&gt;
&lt;br /&gt;
Cron has received a major update (MDL-25499) and now has support for both scheduled and adhoc tasks.&lt;br /&gt;
&lt;br /&gt;
The benefits of these changes are:&lt;br /&gt;
* The schedule for every task can be configured by the admin&lt;br /&gt;
* Tasks can run in parallel&lt;br /&gt;
* Cron processes use locking to prevent the same task running at the same time by different processes&lt;br /&gt;
* Clusters with multiple identical application nodes are supported, you can run cron on all of them&lt;br /&gt;
&lt;br /&gt;
A result of this is that cron can be run much more often, which means (for example) forum posts can be sent out sooner.  To take advantage of the new cron system it is now strongly recommended that administrators increase the frequency that cron is run to at least &#039;&#039;once per minute&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You also may need to modify any automated scripts you have that are parsing the output from cron. It is no longer possible to simply monitor the output of cron for the string &amp;quot;Cron script completed correctly&amp;quot; (if that is what you were doing). An alternative is to monitor the output for the string &amp;quot;task failed:&amp;quot;. If you detect that a task is failing, [[Cron#Debugging_Scheduled_Tasks|here]] are some tips for debugging the failure. &lt;br /&gt;
&lt;br /&gt;
Before the upgrade to 2.8, there may have been a cron task that was failing, which was preventing the rest of cron from being executed. A failure in any single task will no longer prevent the rest of the Moodle cron tasks from executing, so you may uncover previously masked bugs. It is a good idea to closely monitor the output from cron after the upgrade to 2.8.&lt;br /&gt;
&lt;br /&gt;
===Assignments===&lt;br /&gt;
&lt;br /&gt;
The old assignment (2.2) module has been removed from core and has been replaced by a stub to support transparently remapping URLs and restoring course backups from the old module to the new one. &lt;br /&gt;
&lt;br /&gt;
If you are still using the old assignment (2.2) module, after upgrading to Moodle 2.8 all assignment (2.2) activities will be hidden. You need to run the [[Assignment upgrade tool]] to un-hide the activities.&lt;br /&gt;
&lt;br /&gt;
If you really, really need to keep using the old assignment (2.2) module, you should update the code to Moodle 2.8, and then replace the &amp;quot;mod/assignment&amp;quot; folder with the one from https://github.com/moodlehq/moodle-mod_assignment/releases before completing the upgrade.&lt;br /&gt;
&lt;br /&gt;
==Possible issues that may affect you in Moodle 2.8==&lt;br /&gt;
&lt;br /&gt;
===New aggregation method - &#039;Natural&#039;===&lt;br /&gt;
&lt;br /&gt;
The aggregation method &#039;Sum of grades&#039; used in the [[Grades|gradebook]] has been reviewed, significantly improved and renamed to &#039;Natural&#039;. It is recommended that &#039;Natural&#039; is set as the default aggregation method, as for new Moodle 2.8 installs.&lt;br /&gt;
&lt;br /&gt;
In addition, the aggregation setting &#039;Aggregate including subcategories&#039; has been removed.&lt;br /&gt;
&lt;br /&gt;
Any courses previously using either &#039;Sum of grades&#039; and/or &#039;Aggregate including subcategories&#039; may have some changes to grades. Thus it is recommended that grades in the gradebook are reviewed for such courses.&lt;br /&gt;
&lt;br /&gt;
===Teachers able to enrol users via the cohort sync enrolment method===&lt;br /&gt;
&lt;br /&gt;
Teachers will get access to [[Cohort sync]] enrolment method if it is enabled, remove capability to use this enrolment method from teachers if you want to preserve 2.7 behaviour. See MDL-36014&lt;br /&gt;
&lt;br /&gt;
===Gradebook scrolling and theme issues===&lt;br /&gt;
Themes with non-fixed headers must have the .navbar class in their navbar in order for floating headers in the grader report to work - see MDL-46658 for more information.&lt;br /&gt;
&lt;br /&gt;
===Removal of the &#039;Group members only&#039; experimental setting===&lt;br /&gt;
&lt;br /&gt;
The experimental setting &#039;Group members only&#039; has been removed in Moodle 2.8. The group and grouping restrictions in [[Conditional activities settings|conditional activities]] now provide this functionality. Any &#039;Available for group members only&#039; instances are automatically converted to group or grouping restrictions when a site is upgraded.&lt;br /&gt;
&lt;br /&gt;
* &#039;Available for group members only&#039; instances with no grouping selected are converted to a &#039;Must belong to any group&#039; restriction.&lt;br /&gt;
* &#039;Available for group members only&#039; instances with a grouping specified are converted to a &#039;Must belong to the specific grouping&#039; restriction.&lt;br /&gt;
&lt;br /&gt;
===Removal of DragMath===&lt;br /&gt;
&lt;br /&gt;
DragMath is no longer distributed in Moodle. It is available elsewhere as a third-party plugin which may be downloaded and installed by an administrator.&lt;br /&gt;
&lt;br /&gt;
=== MySQL dmlwriteexceptionerror exception throw on course restoration ===&lt;br /&gt;
&lt;br /&gt;
Some users are getting the following MySQL error during the course restoration procedure:&lt;br /&gt;
&lt;br /&gt;
  Row size too large (&amp;gt;8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.&lt;br /&gt;
&lt;br /&gt;
This affect all moodle versions and is due MySQL default InnoDB file format (Antelope) cannot handle more than 10 text columns. We strongly recommend you change the InnoDB file format to Barracuda.&lt;br /&gt;
&lt;br /&gt;
Since 2.6 onwards we have a specific tool to help users on this conversion. Please use the command below to do the database change.&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/mysql_compressed_rows.php&lt;br /&gt;
&lt;br /&gt;
More information about InnoDB file formats can be found here:&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_antelope&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_barracuda&lt;br /&gt;
&lt;br /&gt;
=== Moodle 2.3, 2.4, 2.5, 2.6 and 2.7 improvements ===&lt;br /&gt;
&lt;br /&gt;
Depending on which version you are upgrading from, please see the section &#039;Possible issues that may affect you&#039; in the documentation&lt;br /&gt;
&lt;br /&gt;
* [https://docs.moodle.org/23/en/Upgrading Upgrading to Moodle 2.3]&lt;br /&gt;
* [https://docs.moodle.org/24/en/Upgrading Upgrading to Moodle 2.4]&lt;br /&gt;
* [https://docs.moodle.org/25/en/Upgrading Upgrading to Moodle 2.5]&lt;br /&gt;
* [https://docs.moodle.org/26/en/Upgrading Upgrading to Moodle 2.6]&lt;br /&gt;
* [https://docs.moodle.org/27/en/Upgrading Upgrading to Moodle 2.7]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum] &lt;br /&gt;
* [[dev:Moodle 2.8 release notes|Moodle 2.8 release notes]]&lt;br /&gt;
&lt;br /&gt;
[[es:Actualización de moodle]]&lt;br /&gt;
[[fr:Mise à jour]]&lt;br /&gt;
[[ja:Moodleをアップグレードする]]&lt;br /&gt;
[[de:Aktualisierung von Moodle]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Upgrading&amp;diff=117213</id>
		<title>Upgrading</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Upgrading&amp;diff=117213"/>
		<updated>2015-02-26T14:52:34Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: Correct order of checking plugin updates and entering maintenance mode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}	&lt;br /&gt;
&#039;&#039;This page explains in detail how to upgrade Moodle. For a summary of the process, see [[Upgrade overview]].&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Check the requirements==&lt;br /&gt;
&lt;br /&gt;
Check that your server meets all requirements for 2.8 in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Server &amp;gt; [[Environment]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Note: You can only upgrade to Moodle 2.8 from Moodle 2.2 or later. If upgrading from earlier versions, you must [https://docs.moodle.org/22/en/Upgrading_to_Moodle_2.2 upgrade to 2.2] as a first step.&lt;br /&gt;
&lt;br /&gt;
==Before upgrading==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;We advise that you test the upgrade first on a COPY of your production site, to make sure it works as you expect.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Backup important data ==&lt;br /&gt;
&lt;br /&gt;
There are three areas that should be backed up before any upgrade:&lt;br /&gt;
#Moodle software (For example, everything in server/htdocs/moodle)&lt;br /&gt;
#Moodle uploaded files (For example, server/moodledata)&lt;br /&gt;
#Moodle database (For example, your Postgres or MySQL database dump)&lt;br /&gt;
&lt;br /&gt;
See [[Site backup]] for more specific information.&lt;br /&gt;
&lt;br /&gt;
== Check for plugin updates ==&lt;br /&gt;
&lt;br /&gt;
If you have [[Automatic updates deployment]] enabled, you will be able to update installed plugins automatically during the upgrade. Just make sure you check for available updates (via the button for it) at the Plugins check screen.&lt;br /&gt;
&lt;br /&gt;
If you are updating plugins manually, it is a good moment now to check in the [http://moodle.org/plugins Moodle Plugins directory] whether there is a 2.8 version available for any plugins (including themes) that you have previously installed on your site. If so, download the plugin package. In the next step, you will copy it to the appropriate location in your Moodle code (see [[Installing plugins]]).&lt;br /&gt;
&lt;br /&gt;
The upgrade of the plugin will then happen as part of the Moodle upgrade process.&lt;br /&gt;
&lt;br /&gt;
If an out-of-date plugin causes your upgrade to fail, you can usually delete the plugin code rather than uninstalling it from within Moodle so that the data associated with it is not deleted.&lt;br /&gt;
&lt;br /&gt;
==Put your site into maintenance mode==&lt;br /&gt;
Before you begin upgrading your site, you should put it into [[Maintenance_mode | maintenance mode]] to stop any non-admin users from logging in. Then you should wait for any currently running cron processes to complete before proceeding.&lt;br /&gt;
&lt;br /&gt;
== Install the new Moodle software ==&lt;br /&gt;
You can fetch the current (2.8) version of the software through &lt;br /&gt;
&lt;br /&gt;
wget http://sourceforge.net/projects/moodle/files/Moodle/stable28/moodle-latest-28.tgz&lt;br /&gt;
&lt;br /&gt;
=== Standard install package ===&lt;br /&gt;
&lt;br /&gt;
# Move your old Moodle software program files to another location. &#039;&#039;Do NOT copy new files over the old files.&#039;&#039;&lt;br /&gt;
# Unzip or unpack the upgrade file so that all the new Moodle software program files are in the location the old files used to be in on the server. Moodle will adjust SQL and moodledata if it needs to in the upgrade.&lt;br /&gt;
# Copy your old [[Configuration file|config.php file]] back to the new Moodle directory. &lt;br /&gt;
# As mentioned above, if you had installed any plugins on your site you should add them to the new code tree now. It is important to check that you get the correct version for your new version of Moodle. Be particularly careful that you do not overwrite any code in the new version of Moodle.&lt;br /&gt;
# Dont forget to also copy over your moodledata folder / directory.  If you don&#039;t you will get a &amp;quot;fatal error $cfg- dataroot is not configured properly&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
====Linux====&lt;br /&gt;
 mv moodle moodle.backup&lt;br /&gt;
 tar xvzf moodle-2.8.tgz&lt;br /&gt;
&lt;br /&gt;
Next, copy across your config.php, any custom plugins, and your .htaccess file if you created one (&#039;&#039;&#039;check that custom plugins are the correct version for your new Moodle first&#039;&#039;&#039;):&lt;br /&gt;
&lt;br /&gt;
 cp moodle.backup/config.php moodle&lt;br /&gt;
 cp -pr moodle.backup/theme/mytheme moodle/theme/mytheme&lt;br /&gt;
 cp -pr moodle.backup/mod/mymod moodle/mod/mymod&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to make moodle/config.php (and the rest of the source code) readable by your www server. Ideally the files should not be writeable by your server.&lt;br /&gt;
&lt;br /&gt;
If you use cron, take care that cron.php is executeable and uses the correct php command: &lt;br /&gt;
 chmod 740 admin/cli/cron.php (some configurations need chmod 750 or chmod 755)&lt;br /&gt;
 copy the first line from cron.php (if it looks like &#039;#!/usr/local/bin/php&#039; or &#039;#!/usr/local/bin/php5.3&#039;, no need to copy &#039;&amp;lt;?php&#039;)&lt;br /&gt;
&lt;br /&gt;
if necessary.&lt;br /&gt;
&lt;br /&gt;
=== Using Git ===&lt;br /&gt;
&lt;br /&gt;
You can use Git for updating or upgrading your Moodle. See [[Git for Administrators]] for details.&lt;br /&gt;
&lt;br /&gt;
===Command line upgrade===&lt;br /&gt;
&lt;br /&gt;
On Linux servers, Moodle 2.8 supports running the [[CLI|upgrade from the command line]], rather than through a web browser. This is likely to be more reliable, particularly for large sites.&lt;br /&gt;
&lt;br /&gt;
== Finishing the upgrade ==&lt;br /&gt;
&lt;br /&gt;
The last step is to trigger the upgrade processes within Moodle. &lt;br /&gt;
&lt;br /&gt;
To do this just go to &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Notifications&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Moodle will automatically detect the new version and perform all the SQL database or file system upgrades that are necessary. If there is anything it can&#039;t do itself (very rare) then you will see messages telling you what you need to do.&lt;br /&gt;
&lt;br /&gt;
Assuming all goes well (no error messages) then you can start using your new version of Moodle and enjoy the new features!&lt;br /&gt;
&lt;br /&gt;
Note: If you are running multiple servers then you should purge all caches manually (via &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Development &amp;gt; Purge all caches&#039;&#039;) after completing the upgrade on all servers.&lt;br /&gt;
&lt;br /&gt;
===Fatal error: Maximum execution time of 30 seconds exceeded...===&lt;br /&gt;
&lt;br /&gt;
If your server uses a main language other than English, you may encounter a &#039;Fatal error: Maximum execution time of 30 seconds exceeded&#039; when you try to upgrade it. You can increase max_execution_time = 160 on php.ini to allow the scripts enough time to process the language update. Otherwise, you can switch to English as the default language before doing the upgrade and back to your original language after a succcessful upgrade. See the forum discussion at https://moodle.org/mod/forum/discuss.php?d=119598.&lt;br /&gt;
&lt;br /&gt;
==After upgrading==&lt;br /&gt;
&lt;br /&gt;
The config.php file from your installation should work fine but if you take a look at config-dist.php that came with Moodle 2.8 there are more/different options available (e.g. database drivers and settings). It&#039;s a good idea to map your old config.php settings to a new one based on the 2.8 config-dist.php.&lt;br /&gt;
&lt;br /&gt;
===Cron===&lt;br /&gt;
&lt;br /&gt;
Cron has received a major update (MDL-25499) and now has support for both scheduled and adhoc tasks.&lt;br /&gt;
&lt;br /&gt;
The benefits of these changes are:&lt;br /&gt;
* The schedule for every task can be configured by the admin&lt;br /&gt;
* Tasks can run in parallel&lt;br /&gt;
* Cron processes use locking to prevent the same task running at the same time by different processes&lt;br /&gt;
* Clusters with multiple identical application nodes are supported, you can run cron on all of them&lt;br /&gt;
&lt;br /&gt;
A result of this is that cron can be run much more often, which means (for example) forum posts can be sent out sooner.  To take advantage of the new cron system it is now strongly recommended that administrators increase the frequency that cron is run to at least &#039;&#039;once per minute&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You also may need to modify any automated scripts you have that are parsing the output from cron. It is no longer possible to simply monitor the output of cron for the string &amp;quot;Cron script completed correctly&amp;quot; (if that is what you were doing). An alternative is to monitor the output for the string &amp;quot;task failed:&amp;quot;. If you detect that a task is failing, [[Cron#Debugging_Scheduled_Tasks|here]] are some tips for debugging the failure. &lt;br /&gt;
&lt;br /&gt;
Before the upgrade to 2.8, there may have been a cron task that was failing, which was preventing the rest of cron from being executed. A failure in any single task will no longer prevent the rest of the Moodle cron tasks from executing, so you may uncover previously masked bugs. It is a good idea to closely monitor the output from cron after the upgrade to 2.8.&lt;br /&gt;
&lt;br /&gt;
===Assignments===&lt;br /&gt;
&lt;br /&gt;
The old assignment (2.2) module has been removed from core and has been replaced by a stub to support transparently remapping URLs and restoring course backups from the old module to the new one. &lt;br /&gt;
&lt;br /&gt;
If you are still using the old assignment (2.2) module, after upgrading to Moodle 2.8 all assignment (2.2) activities will be hidden. You need to run the [[Assignment upgrade tool]] to un-hide the activities.&lt;br /&gt;
&lt;br /&gt;
If you really, really need to keep using the old assignment (2.2) module, you should update the code to Moodle 2.8, and then replace the &amp;quot;mod/assignment&amp;quot; folder with the one from https://github.com/moodlehq/moodle-mod_assignment/releases before completing the upgrade.&lt;br /&gt;
&lt;br /&gt;
==Possible issues that may affect you in Moodle 2.8==&lt;br /&gt;
&lt;br /&gt;
===New aggregation method - &#039;Natural&#039;===&lt;br /&gt;
&lt;br /&gt;
The aggregation method &#039;Sum of grades&#039; used in the [[Grades|gradebook]] has been reviewed, significantly improved and renamed to &#039;Natural&#039;. It is recommended that &#039;Natural&#039; is set as the default aggregation method, as for new Moodle 2.8 installs.&lt;br /&gt;
&lt;br /&gt;
In addition, the aggregation setting &#039;Aggregate including subcategories&#039; has been removed.&lt;br /&gt;
&lt;br /&gt;
Any courses previously using either &#039;Sum of grades&#039; and/or &#039;Aggregate including subcategories&#039; may have some changes to grades. Thus it is recommended that grades in the gradebook are reviewed for such courses.&lt;br /&gt;
&lt;br /&gt;
===Teachers able to enrol users via the cohort sync enrolment method===&lt;br /&gt;
&lt;br /&gt;
Teachers will get access to [[Cohort sync]] enrolment method if it is enabled, remove capability to use this enrolment method from teachers if you want to preserve 2.7 behaviour. See MDL-36014&lt;br /&gt;
&lt;br /&gt;
===Gradebook scrolling and theme issues===&lt;br /&gt;
Themes with non-fixed headers must have the .navbar class in their navbar in order for floating headers in the grader report to work - see MDL-46658 for more information.&lt;br /&gt;
&lt;br /&gt;
===Removal of the &#039;Group members only&#039; experimental setting===&lt;br /&gt;
&lt;br /&gt;
The experimental setting &#039;Group members only&#039; has been removed in Moodle 2.8. The group and grouping restrictions in [[Conditional activities settings|conditional activities]] now provide this functionality. Any &#039;Available for group members only&#039; instances are automatically converted to group or grouping restrictions when a site is upgraded.&lt;br /&gt;
&lt;br /&gt;
* &#039;Available for group members only&#039; instances with no grouping selected are converted to a &#039;Must belong to any group&#039; restriction.&lt;br /&gt;
* &#039;Available for group members only&#039; instances with a grouping specified are converted to a &#039;Must belong to the specific grouping&#039; restriction.&lt;br /&gt;
&lt;br /&gt;
===Removal of DragMath===&lt;br /&gt;
&lt;br /&gt;
DragMath is no longer distributed in Moodle. It is available elsewhere as a third-party plugin which may be downloaded and installed by an administrator.&lt;br /&gt;
&lt;br /&gt;
=== MySQL dmlwriteexceptionerror exception throw on course restoration ===&lt;br /&gt;
&lt;br /&gt;
Some users are getting the following MySQL error during the course restoration procedure:&lt;br /&gt;
&lt;br /&gt;
  Row size too large (&amp;gt;8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help.&lt;br /&gt;
&lt;br /&gt;
This affect all moodle versions and is due MySQL default InnoDB file format (Antelope) cannot handle more than 10 text columns. We strongly recommend you change the InnoDB file format to Barracuda.&lt;br /&gt;
&lt;br /&gt;
Since 2.6 onwards we have a specific tool to help users on this conversion. Please use the command below to do the database change.&lt;br /&gt;
&lt;br /&gt;
  php admin/cli/mysql_compressed_rows.php&lt;br /&gt;
&lt;br /&gt;
More information about InnoDB file formats can be found here:&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_antelope&lt;br /&gt;
  http://dev.mysql.com/doc/innodb/1.1/en/glossary.html#glos_barracuda&lt;br /&gt;
&lt;br /&gt;
=== Moodle 2.3, 2.4, 2.5, 2.6 and 2.7 improvements ===&lt;br /&gt;
&lt;br /&gt;
Depending on which version you are upgrading from, please see the section &#039;Possible issues that may affect you&#039; in the documentation&lt;br /&gt;
&lt;br /&gt;
* [https://docs.moodle.org/23/en/Upgrading Upgrading to Moodle 2.3]&lt;br /&gt;
* [https://docs.moodle.org/24/en/Upgrading Upgrading to Moodle 2.4]&lt;br /&gt;
* [https://docs.moodle.org/25/en/Upgrading Upgrading to Moodle 2.5]&lt;br /&gt;
* [https://docs.moodle.org/26/en/Upgrading Upgrading to Moodle 2.6]&lt;br /&gt;
* [https://docs.moodle.org/27/en/Upgrading Upgrading to Moodle 2.7]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/view.php?id=28 Installation problems forum] &lt;br /&gt;
* [[dev:Moodle 2.8 release notes|Moodle 2.8 release notes]]&lt;br /&gt;
&lt;br /&gt;
[[es:Actualización de moodle]]&lt;br /&gt;
[[fr:Mise à jour]]&lt;br /&gt;
[[ja:Moodleをアップグレードする]]&lt;br /&gt;
[[de:Aktualisierung von Moodle]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=admin/setting/filtersettingtex&amp;diff=116477</id>
		<title>admin/setting/filtersettingtex</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=admin/setting/filtersettingtex&amp;diff=116477"/>
		<updated>2014-12-07T19:47:04Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: Redirected page to TeX notation filter&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[TeX_notation_filter]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Course_meta_link_enrolment&amp;diff=116162</id>
		<title>Talk:Course meta link enrolment</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Course_meta_link_enrolment&amp;diff=116162"/>
		<updated>2014-11-26T19:54:53Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: Created page with &amp;quot;Can anyone offer some explanation as to what the &amp;quot;External unenrol action&amp;quot; setting in the Course meta link plugin does? ~~~~&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Can anyone offer some explanation as to what the &amp;quot;External unenrol action&amp;quot; setting in the Course meta link plugin does? [[User:Jon Witts|Jon Witts]] ([[User talk:Jon Witts|talk]]) 03:54, 27 November 2014 (AWST)&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Media_FAQ&amp;diff=115050</id>
		<title>Media FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Media_FAQ&amp;diff=115050"/>
		<updated>2014-09-24T05:22:36Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* How can I convert my video file to an .FLV or other format? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Working with media}}&lt;br /&gt;
==Should I put my video into a label or a page?==&lt;br /&gt;
While the embedding process is the same, adding a video to a label will mean it displays as soon as the user clicks on that course page. This can be beneficial if the video is, for example, an introduction to the course or an integral part of the whole course. However, if there are several videos in labels, they can slow the loading of the course down, especially if the videos are coming from an external site. Adding a video to a page in Moodle means that the user has to click a text link to reach the video, but it doesn&#039;t clutter up the main course page and it is a better choice if the course contains a large number of videos.&lt;br /&gt;
&lt;br /&gt;
==My embedded video is too big/small. How can I change its display size?==&lt;br /&gt;
*With the editing turned on, click the edit (hand/pen) icon to get into the HMTL editor where you embedded your video.&lt;br /&gt;
*Click the HTML code icon:&lt;br /&gt;
[[File:Htmlcodeicon.png]]&lt;br /&gt;
*You will see the code of your video there.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;For videos you uploaded yourself...&#039;&#039;&#039; Find the file extension (such as flv or wmv) and just &#039;&#039;&#039;after&#039;&#039;&#039; the file extension and &#039;&#039;&#039;before&#039;&#039;&#039; the &amp;quot;, type in &#039;&#039;?d=400x300&#039;&#039;(for example) where 400 and 300 are the width and height in pixels of the display size you wish your video to be:&lt;br /&gt;
[[File:Resizevideo.png]]&lt;br /&gt;
*&#039;&#039;&#039;For external videos you embedded with embed code&#039;&#039;&#039;...Change the height and width numbers to the size in pixels you wish your video to be:&lt;br /&gt;
[[File:Youtuberesize.png]]&lt;br /&gt;
&lt;br /&gt;
*Click &#039;&#039;Update&#039;&#039; and then, on the next screen, click &#039;&#039;Save changes&#039;&#039;. Your video will now display in a different size.&lt;br /&gt;
&lt;br /&gt;
==Why is the size and player for MP4 video clips hard coded?==&lt;br /&gt;
Not sure.  If anyone from out there knows, so far they have not let on any reasons.  See MDL-43385&lt;br /&gt;
&lt;br /&gt;
==Why won&#039;t my swf video play?==&lt;br /&gt;
The .swf format carries with it some security issues and so the filter that allows it to display is disabled by default. For you to be able to add .swf videos, your administrator needs to enable the filter in [[Multimedia_plugins|Multimedia plugins]], then to go to &#039;&#039;Site Administration&amp;gt;Security&amp;gt;Site policies&#039;&#039; and check the &amp;quot;enable trusted content&amp;quot;  box. They then need to go to &#039;&#039;Site Administration&amp;gt;Users&amp;gt;Permissions&amp;gt;Define roles&#039;&#039; and allow Trust Submitted content &#039;&#039;moodle/site:trustcontent&#039;&#039; for your role. However; swf will still not display in all areas of Moodle, for example forum posts. See this discussion [http://moodle.org/mod/forum/discuss.php?d=183681#p800390| here]&lt;br /&gt;
&lt;br /&gt;
==How can I convert my video file to an .FLV or other format?==&lt;br /&gt;
*There are many sites online that allow you to upload a file which will then be converted and sent to you via a link or email. Zamzar [http://www.zamzar.com]or Youconvertit [http://www.youconvertit.com] are just two examples.&lt;br /&gt;
*However, if it is a large video file or you want to do the conversion off line, then the free Any Video Converter [http://www.any-video-converter.com/products/for_video_free/] (a downloadable program) will convert most video formats to most others.&lt;br /&gt;
*More and more full-featured MTS Video Converter [http://www.mtsconverterfree.com/]software free download a trial, to solve your problem more format conversions.&lt;br /&gt;
*The free and open source video player, VLC has the ability to convert to and from many video formats. For more details and downloads [http://www.videolan.org/vlc/ visit their site].&lt;br /&gt;
*If you are using Linux as your operating system either ffmpeg or avconv can both convert to FLV.&lt;br /&gt;
&lt;br /&gt;
== I have a .wma/wav file. How can I play it in Moodle&#039;s player?==&lt;br /&gt;
*There are various free programs available that will convert one type of sound file to another. If you convert your file to an mp3 then you will be able to use Moodle&#039;s built-in mp3 player.&lt;br /&gt;
*Jodix Free WMA to MP3 converter [http://www.wma-mp3.org/] is just one example&lt;br /&gt;
&lt;br /&gt;
== I have an MP4 file.  How can I play it in Moodle&#039;s player? (ie Flowplayer)==&lt;br /&gt;
It seems that the media filter is hard coded to NOT use Flowplayer for MP4.  &lt;br /&gt;
*See the discussion here: https://moodle.org/mod/forum/discuss.php?d=208849#p914927.  Renaming an MP4 to an FLV seems to create a file that will play in Flowplayer.&lt;br /&gt;
*See the discussion here: https://docs.moodle.org/dev/Media_embedding&lt;br /&gt;
*See the discussion about [https://moodle.org/mod/forum/discuss.php?d=232296#p1048676 how to play mp4 videos in Moodle]&lt;br /&gt;
*You can try the [[Videofile]] plugin&lt;br /&gt;
&lt;br /&gt;
You can vote for a change here: MDL-43385&lt;br /&gt;
&lt;br /&gt;
==Can you stop Flowplayer from preloading a video?==&lt;br /&gt;
*See the discussion here: http://moodle.org/mod/forum/discuss.php?d=184081&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[de:Multimedia FAQ]]&lt;br /&gt;
[[es:Medios FAQ]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Media_FAQ&amp;diff=115049</id>
		<title>Media FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Media_FAQ&amp;diff=115049"/>
		<updated>2014-09-24T05:21:55Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Should I put my video into a label or a page? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Working with media}}&lt;br /&gt;
==Should I put my video into a label or a page?==&lt;br /&gt;
While the embedding process is the same, adding a video to a label will mean it displays as soon as the user clicks on that course page. This can be beneficial if the video is, for example, an introduction to the course or an integral part of the whole course. However, if there are several videos in labels, they can slow the loading of the course down, especially if the videos are coming from an external site. Adding a video to a page in Moodle means that the user has to click a text link to reach the video, but it doesn&#039;t clutter up the main course page and it is a better choice if the course contains a large number of videos.&lt;br /&gt;
&lt;br /&gt;
==My embedded video is too big/small. How can I change its display size?==&lt;br /&gt;
*With the editing turned on, click the edit (hand/pen) icon to get into the HMTL editor where you embedded your video.&lt;br /&gt;
*Click the HTML code icon:&lt;br /&gt;
[[File:Htmlcodeicon.png]]&lt;br /&gt;
*You will see the code of your video there.&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;For videos you uploaded yourself...&#039;&#039;&#039; Find the file extension (such as flv or wmv) and just &#039;&#039;&#039;after&#039;&#039;&#039; the file extension and &#039;&#039;&#039;before&#039;&#039;&#039; the &amp;quot;, type in &#039;&#039;?d=400x300&#039;&#039;(for example) where 400 and 300 are the width and height in pixels of the display size you wish your video to be:&lt;br /&gt;
[[File:Resizevideo.png]]&lt;br /&gt;
*&#039;&#039;&#039;For external videos you embedded with embed code&#039;&#039;&#039;...Change the height and width numbers to the size in pixels you wish your video to be:&lt;br /&gt;
[[File:Youtuberesize.png]]&lt;br /&gt;
&lt;br /&gt;
*Click &#039;&#039;Update&#039;&#039; and then, on the next screen, click &#039;&#039;Save changes&#039;&#039;. Your video will now display in a different size.&lt;br /&gt;
&lt;br /&gt;
==Why is the size and player for MP4 video clips hard coded?==&lt;br /&gt;
Not sure.  If anyone from out there knows, so far they have not let on any reasons.  See MDL-43385&lt;br /&gt;
&lt;br /&gt;
==Why won&#039;t my swf video play?==&lt;br /&gt;
The .swf format carries with it some security issues and so the filter that allows it to display is disabled by default. For you to be able to add .swf videos, your administrator needs to enable the filter in [[Multimedia_plugins|Multimedia plugins]], then to go to &#039;&#039;Site Administration&amp;gt;Security&amp;gt;Site policies&#039;&#039; and check the &amp;quot;enable trusted content&amp;quot;  box. They then need to go to &#039;&#039;Site Administration&amp;gt;Users&amp;gt;Permissions&amp;gt;Define roles&#039;&#039; and allow Trust Submitted content &#039;&#039;moodle/site:trustcontent&#039;&#039; for your role. However; swf will still not display in all areas of Moodle, for example forum posts. See this discussion [http://moodle.org/mod/forum/discuss.php?d=183681#p800390| here]&lt;br /&gt;
&lt;br /&gt;
==How can I convert my video file to an .FLV or other format?==&lt;br /&gt;
*There are many sites online that allow you to upload a file which will then be converted and sent to you via a link or email. Zamzar [http://www.zamzar.com]or Youconvertit [http://www.youconvertit.com] are just two examples.&lt;br /&gt;
*However, if it is a large video file or you want to do the conversion off line, then the free Any Video Converter [http://www.any-video-converter.com/products/for_video_free/] (a downloadable program) will convert most video formats to most others.&lt;br /&gt;
*More and more full-featured MTS Video Converter [http://www.mtsconverterfree.com/]software free download a trial, to solve your problem more format conversions.&lt;br /&gt;
&lt;br /&gt;
== I have a .wma/wav file. How can I play it in Moodle&#039;s player?==&lt;br /&gt;
*There are various free programs available that will convert one type of sound file to another. If you convert your file to an mp3 then you will be able to use Moodle&#039;s built-in mp3 player.&lt;br /&gt;
*Jodix Free WMA to MP3 converter [http://www.wma-mp3.org/] is just one example&lt;br /&gt;
&lt;br /&gt;
== I have an MP4 file.  How can I play it in Moodle&#039;s player? (ie Flowplayer)==&lt;br /&gt;
It seems that the media filter is hard coded to NOT use Flowplayer for MP4.  &lt;br /&gt;
*See the discussion here: https://moodle.org/mod/forum/discuss.php?d=208849#p914927.  Renaming an MP4 to an FLV seems to create a file that will play in Flowplayer.&lt;br /&gt;
*See the discussion here: https://docs.moodle.org/dev/Media_embedding&lt;br /&gt;
*See the discussion about [https://moodle.org/mod/forum/discuss.php?d=232296#p1048676 how to play mp4 videos in Moodle]&lt;br /&gt;
*You can try the [[Videofile]] plugin&lt;br /&gt;
&lt;br /&gt;
You can vote for a change here: MDL-43385&lt;br /&gt;
&lt;br /&gt;
==Can you stop Flowplayer from preloading a video?==&lt;br /&gt;
*See the discussion here: http://moodle.org/mod/forum/discuss.php?d=184081&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[de:Multimedia FAQ]]&lt;br /&gt;
[[es:Medios FAQ]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:Masquerading&amp;diff=114775</id>
		<title>Talk:Masquerading</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:Masquerading&amp;diff=114775"/>
		<updated>2014-09-10T05:46:04Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;oh my lawd oh my god what oh my dear friends what does the following mean: &amp;quot;Then tweak internal DNS server&amp;quot; could there be a little more elobration on that point - thank you my dear friends. i am in great pain, in agony, i&#039;m on fire like the fat guy who ate at lazarus&#039; table and is now burning in the lake of sulphur i suppose i shall continue to burn until i fix this masquarading issue and I want to spare you all my agony with clearer explanations: which i will do once i work out how to do it all.&lt;br /&gt;
&lt;br /&gt;
Then tweak internal DNS server&lt;br /&gt;
&lt;br /&gt;
You can either tweak all PCs in your intranet by editing hosts files which can override the data returned from DNS server.&lt;br /&gt;
&lt;br /&gt;
Or you can tweak your DNS server (or forwarder) to return the internal server IP instead of the public one.&lt;br /&gt;
&lt;br /&gt;
-------&lt;br /&gt;
Let&#039;s say your external dns name for your Moodle server was moodle.my-school.edu and your internal dns domain was my-school.local. Internaly your moodle server would respond to server-name.my-school.local with it&#039;s internal IP address. What we want is for it to respond with it&#039;s internal IP address from inside your network to moodle.my-school.edu.&lt;br /&gt;
&lt;br /&gt;
So the &amp;quot;tweak&amp;quot; would be to create the my-school.edu zone on your internal dns servers and then create an a-record in that zone called moodle which points to the internal ip address of your moodle server. This would get the result we wanted.&lt;br /&gt;
&lt;br /&gt;
The potential gotcha here is if you also have a website configured at www.my-school.edu which is not hosted on your internal LAN... You would then need to add the external IP address for teh server hosting your website as an a record with name www (and possible as the root of the zone too if your website is configured to respond to calls without www).&lt;br /&gt;
&lt;br /&gt;
I hope that clarifies things a little! [[User:Jon Witts|Jon Witts]] ([[User talk:Jon Witts|talk]])&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=External_database_enrolment&amp;diff=108356</id>
		<title>External database enrolment</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=External_database_enrolment&amp;diff=108356"/>
		<updated>2013-12-13T11:48:46Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Unenrolment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Enrolment}}&lt;br /&gt;
Location: External database edit settings link in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Enrolments &amp;gt; Manage enrol plugins&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may use a external database (of nearly any kind) to control your enrolments. It is assumed your external database contains a field containing a course ID, a field containing a user ID, and optionally a field containing a role. These are compared against fields that you choose in the local course, user tables, and role tables.&lt;br /&gt;
&lt;br /&gt;
The following are the supported data sources, but note that you will need to have to compiled PHP with the appropriate options or through [[ODBC]].&lt;br /&gt;
&lt;br /&gt;
*access&lt;br /&gt;
*ado&lt;br /&gt;
*mssql&lt;br /&gt;
*borland_ibase&lt;br /&gt;
*csv&lt;br /&gt;
*db2&lt;br /&gt;
*fbsql&lt;br /&gt;
*firebird&lt;br /&gt;
*ibase&lt;br /&gt;
*informix72&lt;br /&gt;
*informix&lt;br /&gt;
*mysql&lt;br /&gt;
*mysqlt&lt;br /&gt;
*oci805&lt;br /&gt;
*oci8&lt;br /&gt;
*oci8po&lt;br /&gt;
*odbc&lt;br /&gt;
*odbc_mssql&lt;br /&gt;
*odbc_oracle&lt;br /&gt;
*oracle&lt;br /&gt;
*postgres64&lt;br /&gt;
*postgres7&lt;br /&gt;
*postgres&lt;br /&gt;
*proxy&lt;br /&gt;
*sqlanywhere&lt;br /&gt;
*sybase&lt;br /&gt;
*vfp&lt;br /&gt;
&lt;br /&gt;
== Enrolment &amp;amp; Unenrolment ==&lt;br /&gt;
&lt;br /&gt;
External database enrolment happens at the moment when a user logs into Moodle. The plugin will attempt to automatically enrol the student in all their courses according to the data in the external database and, optionally, create empty courses where they do not already exist. To check if it is working, you can log in as a student and then check that their list of courses is as you would expect. &lt;br /&gt;
&lt;br /&gt;
The process also unenrols users from courses if they are no longer in the database. User records are marked according to their original enrolment method. Therefore the external database plugin can only unenrol users who were enroled by the plugin in the first place.&lt;br /&gt;
&lt;br /&gt;
== Hidden Courses ==&lt;br /&gt;
&lt;br /&gt;
Courses that are set to &amp;quot;Course is not available to students&amp;quot; can be ignored for enrolment purposes by setting the &amp;quot;enrol_db_ignorehiddencourse&amp;quot; to &#039;&#039;&#039;yes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Enrolment &amp;amp; Roles ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;enrol_database | defaultrole&amp;quot; setting in the plugin settings page specifies the role that the user will take when they are added to the course. The default setting will set them to the course default setting (initially &amp;quot;student&amp;quot;). However, you can specify a field in the external table (specified in the &amp;quot;enrol_database | remoterolefield&amp;quot; setting) that contains the short name or id for the user&#039;s role. This could, for example, be used to enrol both students and teachers into courses using a suitably configured database.&lt;br /&gt;
&lt;br /&gt;
== Unenrolment ==&lt;br /&gt;
&lt;br /&gt;
The  External unenrol action (&amp;quot;enrol_database | unenrolaction&amp;quot;) setting in the plugin settings page defines what action should be taken when a user enrolment disappears from external enrolment source. Each setting does the following:&lt;br /&gt;
#&#039;&#039;&#039;&amp;quot;Unenrol user from course&amp;quot;&#039;&#039;&#039; When the user disappears from the external source, the enrolment is completely removed and all the roles removed. This means some user data and settings are purged from course during course unenrolment (that usually include grades, activity attempts, etc.)&lt;br /&gt;
#&#039;&#039;&#039;&amp;quot;Keep user enrolled&amp;quot;&#039;&#039;&#039; When the user disappears from the external source, the enrolment is kept as is, and the user is still able to enter the course and perform activities, access resources, etc. It&#039;s a &amp;quot;do nothing&amp;quot; option.&lt;br /&gt;
#&#039;&#039;&#039;&amp;quot;Disable course enrolment&amp;quot;&#039;&#039;&#039; When the user disappears from the external source, user enrolment is suspended (the user can&#039;t access the course, but user data and settings are kept), and roles are kept as is. You might use this because in some cases the user needs a role with some capability to be visible in UI - such has in gradebook, assignments, etc.&lt;br /&gt;
#&#039;&#039;&#039;&amp;quot;Disable course enrolment and remove roles&amp;quot;&#039;&#039;&#039; When the user disappears from the external source, the enrolment is suspended and roles assigned by enrol instance are removed. Please note that user may &amp;quot;disappear&amp;quot; from gradebook and other areas.&lt;br /&gt;
&lt;br /&gt;
== Creating Courses ==&lt;br /&gt;
&lt;br /&gt;
Optionally courses that do not exist in the Moodle site can be created. Switch the &amp;quot;enrol_db_autocreate&amp;quot; option to &amp;quot;yes&amp;quot; in the plugin settings. &lt;br /&gt;
&lt;br /&gt;
You can additionally specify the Category into which the new course will be placed, in the &#039;&#039;&#039;New course category id field&#039;&#039;&#039;. The data in this field must be the id of a currently existing category; it will not create a new category. The id number is number assigned by Moodle in the database when the category is created (e.g. mdl_course_categories.id). &lt;br /&gt;
&lt;br /&gt;
* Do not confuse this &#039;&#039;category id&#039;&#039; with the new custom &#039;&#039;category id number&#039;&#039; field that you can manually assign to a category. (See Trackers http://tracker.moodle.org/browse/MDL-28518 and http://tracker.moodle.org/browse/MDL-31845). &lt;br /&gt;
* Leaving the category id data empty means that a course will be assigned to the default category.&lt;br /&gt;
* If you assign data to categories that do  not exist already in Moodle, the courses will not be created.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default new course category&#039;&#039;&#039; is the category to which courses will be assigned and created in, unless you set up and so indicate in the data field of the &amp;quot;New course category id field.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You may also specify a &#039;&#039;&#039;New course template&#039;&#039;&#039;: a &amp;quot;template&amp;quot; course from which the new course will be copied. The data for this field should be the &#039;&#039;shortname&#039;&#039; of the template course.&lt;br /&gt;
&lt;br /&gt;
== Synchronization Script ==&lt;br /&gt;
&lt;br /&gt;
A script is provided that can synchronize all your user enrollments at once - both adding and removing user enrolments (and creating courses if specified). The script is called sync.php and is found in the enrol/database/cli folder.&lt;br /&gt;
&lt;br /&gt;
This script is meant to be called from a system cronjob to sync moodle enrolments with enrolments in the external database. You need to make sure all the users present in the external enrolments are already created in moodle. If you are using external authentication plugins (db, ldap, etc.) you can use the scripts provided by those plugins to synchronize your users before running this script.&lt;br /&gt;
&lt;br /&gt;
Example cron entry for Moodle 2.5&lt;br /&gt;
    # 5 minutes past 4am&lt;br /&gt;
    5 4 * * * /usr/bin/php -c /path/to/php.ini /path/to/moodle/enrol/database/cli/sync.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* If you have a large number of enrolments, you may want to raise the memory limits by passing -d memory_limit=256M&lt;br /&gt;
* For debugging &amp;amp; better logging, you are encouraged to use in the command line: -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0&lt;br /&gt;
* This only works for users that already exist in your Moodle site (see comment above)&lt;br /&gt;
&lt;br /&gt;
== Setting up enrolment sync (How to) ==&lt;br /&gt;
&lt;br /&gt;
You will need to perform (as a minimum) the following steps to enable external database enrolment - only a single table is required in the database which contains a record for every user/course combination. If the table is large it is a good idea to make sure appropriate indexes have been created:&lt;br /&gt;
&lt;br /&gt;
* Use an existing database or create a new one. Use an existing table or create a new one with the following minimum fields.&lt;br /&gt;
*# A unique course identifier to match one of the following fields.&lt;br /&gt;
*#* the &amp;quot;idnumber&amp;quot; field in Moodle&#039;s course table (varchar 100), which is manually specified as the &amp;quot;Course ID number&amp;quot; when editing a course&#039;s settings&lt;br /&gt;
*#* the &amp;quot;shortname&amp;quot; field in Moodle&#039;s course table (varchar 255), which is manually specified as the &amp;quot;Course short name&amp;quot; when editing a course&#039;s settings&lt;br /&gt;
*#* the &amp;quot;id&amp;quot; field in Moodle&#039;s course table (int 10), which is based on course creation order&lt;br /&gt;
*# A unique user identifier to match one of the following fields.&lt;br /&gt;
*#* the &amp;quot;idnumber&amp;quot; field in Moodle&#039;s user table (varchar 255), which is manually specified as the &amp;quot;ID number&amp;quot; when editing a user&#039;s profile&lt;br /&gt;
*#* the &amp;quot;username&amp;quot; field in Moodle&#039;s user table (varchar 100), which is manually specified as the &amp;quot;Username&amp;quot; when editing a user&#039;s profile&lt;br /&gt;
*#* the &amp;quot;email&amp;quot; field in Moodle&#039;s user table (varchar 100), which is manually specified as the &amp;quot;Email address&amp;quot; when editing a user&#039;s profile&lt;br /&gt;
*#* the &amp;quot;id&amp;quot; field in Moodle&#039;s user table (int 10), which is based on user creation order&lt;br /&gt;
*# (optional) A unique role identifier to match one of the following fields.&lt;br /&gt;
*#* the &amp;quot;shortname&amp;quot; field in Moodle&#039;s role table (varchar 100), for example editingteacher, coursecreator, student, ...&lt;br /&gt;
*#* the &amp;quot;name&amp;quot; field in Moodle&#039;s role table (varchar 255), for example Teacher, Course creator, Student, ...&lt;br /&gt;
*#* the &amp;quot;id&amp;quot; field in Moodle&#039;s role table (int 10), which is based on initial installation and new role creation order&lt;br /&gt;
* Populate the database table. Each user/course combination to have a record in the table.&lt;br /&gt;
* In Moodle, go to Site administration =&amp;gt; Plugins =&amp;gt; Enrolments =&amp;gt; Manage enrol plugins, find External Database in the list, enable it (click the closed-eye icon) and click Settings.&lt;br /&gt;
* In the top panel, select the database type (make sure you have the necessary configuration in PHP for that type) and then supply the information to connect to the database.&lt;br /&gt;
* The middle panel creates the mapping between Moodle and the external database. The first three settings are for the local (Moodle) field names and the last three for the remote (external database) settings. They are in the same order.&lt;br /&gt;
** enrol_localcoursefield / enrol_remotecoursefield - in Moodle the name of the field in the course settings the uniquely identifies the course (e.g., idnumber). In the external database the name of the matching field.&lt;br /&gt;
** enrol_localuserfield / enrol_remoteuserfield - in Moodle the name of the field in the user profile that uniquely identified the user (e.g., idnumber). In the external database the name of the matching field.&lt;br /&gt;
** enrol_db_localrolefield / enrol_db_remoterolefield - (optional) in Moodle the name of the field in the role edit page the uniquely identifies the role (e.g., shortname). In the external database the name of the matching field.&lt;br /&gt;
* The Roles panel specifies the role that the user will get in the course if their role is not specified in the external database.&lt;br /&gt;
* The final panel enables auto creation of courses.&lt;br /&gt;
* Save changes, and then tick the box to enable external database enrolment.&lt;br /&gt;
&lt;br /&gt;
== Database enrolment does not appear in the course enrolment drop down menu. Why? ==&lt;br /&gt;
&lt;br /&gt;
The course enrolment drop down menu only lists [[Enrolment_plugins#Interactive_enrolment|&#039;&#039;&#039;interactive&#039;&#039;&#039; enrolment plugins]]. External database enrolment is not such a plugin, so it doesn&#039;t appear in the list. Similarly, the &amp;quot;Course Enrollable&amp;quot; setting (in the Course Settings) page also only applies to interactive enrolment plugins and has no effect on external database enrollment. &lt;br /&gt;
&lt;br /&gt;
As of this writing, the only interactive enrolment plugins are &#039;&#039;manual&#039;&#039; (also know as &#039;&#039;internal&#039;&#039;), &#039;&#039;paypal&#039;&#039; and &#039;&#039;authorize.net&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Field Mapping Example: ==&lt;br /&gt;
Choose your fields from the Moodle database:&lt;br /&gt;
&lt;br /&gt;
*enrol_localcoursefield:  A course identifier from mdl_course, e.g. &amp;quot;idnumber&amp;quot;&lt;br /&gt;
*enrol_localuserfield: A user identifier from mdl_user, e.g. &amp;quot;idnumber&amp;quot;&lt;br /&gt;
*enrol_localrolefield: (optional) A role identifier from mdl_role, e.g. &amp;quot;shortname&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Create a view in your external database which matches the chosen field values from Moodle:&lt;br /&gt;
&lt;br /&gt;
*enrol_remotecoursefield: A matching course identifier from your external database table, e.g. &amp;quot;course_number&amp;quot;&lt;br /&gt;
*enrol_remoteuserfield: A matching user identifier from your external database table, e.g. &amp;quot;userid&amp;quot;&lt;br /&gt;
*enrol_remoterolefield: (optional) A matching role identifier from your external database table, e.g. &amp;quot;role_name&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Potential Gotchas ==&lt;br /&gt;
&lt;br /&gt;
* It almost goes without saying that the integrity of the external database is important. If data is missing from the database then there is a potential for users being unenrolled from some or all of their courses. The unenrollment process will remove them from any group assignments and also poll each module type to give the module the option of removing that user&#039;s data if appropriate (for example, however, forum posts are never deleted). It is therefore prudent that you take the utmost care to ensure that the data in the external bass is correct at all times.&lt;br /&gt;
* &#039;&#039;&#039;Minor Security Issue&#039;&#039;&#039; Consider that if the ID number field you use to identify your students is editable by the students (in their profile), then there is a potential for them changing this to the id of another valid student and gaining access to resources that they should not. (However, they will still appear as themselves, they cannot impersonate the other user or otherwise gain access to their resources.) To prevent this and similar issues, you can lock the ID number as well as other fields so the user can not change them. Do this in the &#039;&#039;&#039;Data mapping&#039;&#039;&#039; section of &#039;&#039;Settings&amp;gt;Site administration&amp;gt;Plugins&amp;gt;Authentication&amp;gt;External database&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Errors and Diagnostics==&lt;br /&gt;
&lt;br /&gt;
The plugin produces a number of diagnostic messages and/or errors which are recorded to the PHP error log (as defined in the php.ini file). In addition messages about courses that are in the database for the user but that do not exist in the Moodle site will only be produced if debugging is set to ALL or DEVELOPER.&lt;br /&gt;
&lt;br /&gt;
You can get detailed progress information by executing the sync script  with -v parameter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 php /path/to/moodle/enrol/database/cli/sync.php -v&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=49475 MySQL enrolment plugin doesn&#039;t seem to work] forum discussion&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=74133 Someone explain external database enrolment, please??] forum discussion&lt;br /&gt;
*Example Setup [https://docs.moodle.org/en/Talk:External_database_enrolment#Example_External_Enrollment] Example Database Enrollment Setup&lt;br /&gt;
&lt;br /&gt;
[[es:Matriculación Base de Datos Externa]]&lt;br /&gt;
[[fr:Base de données externe]]&lt;br /&gt;
[[de:Einschreibung über externe Datenbank]]&lt;br /&gt;
[[ja:外部データベース登録]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=External_database_enrolment&amp;diff=108351</id>
		<title>External database enrolment</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=External_database_enrolment&amp;diff=108351"/>
		<updated>2013-12-13T11:17:05Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Enrolment &amp;amp; Roles */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Enrolment}}&lt;br /&gt;
Location: External database edit settings link in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Enrolments &amp;gt; Manage enrol plugins&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may use a external database (of nearly any kind) to control your enrolments. It is assumed your external database contains a field containing a course ID, a field containing a user ID, and optionally a field containing a role. These are compared against fields that you choose in the local course, user tables, and role tables.&lt;br /&gt;
&lt;br /&gt;
The following are the supported data sources, but note that you will need to have to compiled PHP with the appropriate options or through [[ODBC]].&lt;br /&gt;
&lt;br /&gt;
*access&lt;br /&gt;
*ado&lt;br /&gt;
*mssql&lt;br /&gt;
*borland_ibase&lt;br /&gt;
*csv&lt;br /&gt;
*db2&lt;br /&gt;
*fbsql&lt;br /&gt;
*firebird&lt;br /&gt;
*ibase&lt;br /&gt;
*informix72&lt;br /&gt;
*informix&lt;br /&gt;
*mysql&lt;br /&gt;
*mysqlt&lt;br /&gt;
*oci805&lt;br /&gt;
*oci8&lt;br /&gt;
*oci8po&lt;br /&gt;
*odbc&lt;br /&gt;
*odbc_mssql&lt;br /&gt;
*odbc_oracle&lt;br /&gt;
*oracle&lt;br /&gt;
*postgres64&lt;br /&gt;
*postgres7&lt;br /&gt;
*postgres&lt;br /&gt;
*proxy&lt;br /&gt;
*sqlanywhere&lt;br /&gt;
*sybase&lt;br /&gt;
*vfp&lt;br /&gt;
&lt;br /&gt;
== Enrolment &amp;amp; Unenrolment ==&lt;br /&gt;
&lt;br /&gt;
External database enrolment happens at the moment when a user logs into Moodle. The plugin will attempt to automatically enrol the student in all their courses according to the data in the external database and, optionally, create empty courses where they do not already exist. To check if it is working, you can log in as a student and then check that their list of courses is as you would expect. &lt;br /&gt;
&lt;br /&gt;
The process also unenrols users from courses if they are no longer in the database. User records are marked according to their original enrolment method. Therefore the external database plugin can only unenrol users who were enroled by the plugin in the first place.&lt;br /&gt;
&lt;br /&gt;
== Hidden Courses ==&lt;br /&gt;
&lt;br /&gt;
Courses that are set to &amp;quot;Course is not available to students&amp;quot; can be ignored for enrolment purposes by setting the &amp;quot;enrol_db_ignorehiddencourse&amp;quot; to &#039;&#039;&#039;yes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Enrolment &amp;amp; Roles ==&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;enrol_database | defaultrole&amp;quot; setting in the plugin settings page specifies the role that the user will take when they are added to the course. The default setting will set them to the course default setting (initially &amp;quot;student&amp;quot;). However, you can specify a field in the external table (specified in the &amp;quot;enrol_database | remoterolefield&amp;quot; setting) that contains the short name or id for the user&#039;s role. This could, for example, be used to enrol both students and teachers into courses using a suitably configured database.&lt;br /&gt;
&lt;br /&gt;
== Unenrolment ==&lt;br /&gt;
&lt;br /&gt;
The  External unenrol action (&amp;quot;enrol_database | unenrolaction&amp;quot;) setting in the plugin settings page defines what action should be taken when a user enrolment disappears from external enrolment source. Each setting does the following:&lt;br /&gt;
*&#039;&#039;&#039;&amp;quot;Unenrol user from course&amp;quot;&#039;&#039;&#039; When the user disappears from the external source, the enrolment is completely removed and all the roles removed. This means some user data and settings are purged from course during course unenrolment (that usually include grades, activity attempts, etc.)&lt;br /&gt;
*&#039;&#039;&#039;&amp;quot;Keep user enrolled&amp;quot;&#039;&#039;&#039; When the user disappears from the external source, the enrolment is kept as is, and the user is still able to enter the course and perform activities, access resources, etc. It&#039;s a &amp;quot;do nothing&amp;quot; option.&lt;br /&gt;
*&#039;&#039;&#039;&amp;quot;Disable course enrolment&amp;quot;&#039;&#039;&#039; When the user disappears from the external source, user enrolment is suspended (the user can&#039;t access the course, but user data and settings are kept), and roles are kept as is. You might use this because in some cases the user needs a role with some capability to be visible in UI - such has in gradebook, assignments, etc.&lt;br /&gt;
*&#039;&#039;&#039;&amp;quot;Disable course enrolment and remove roles&amp;quot;&#039;&#039;&#039; When the user disappears from the external source, the enrolment is suspended and roles assigned by enrol instance are removed. Please note that user may &amp;quot;disappear&amp;quot; from gradebook and other areas.&lt;br /&gt;
&lt;br /&gt;
== Creating Courses ==&lt;br /&gt;
&lt;br /&gt;
Optionally courses that do not exist in the Moodle site can be created. Switch the &amp;quot;enrol_db_autocreate&amp;quot; option to &amp;quot;yes&amp;quot; in the plugin settings. &lt;br /&gt;
&lt;br /&gt;
You can additionally specify the Category into which the new course will be placed, in the &#039;&#039;&#039;New course category id field&#039;&#039;&#039;. The data in this field must be the id of a currently existing category; it will not create a new category. The id number is number assigned by Moodle in the database when the category is created (e.g. mdl_course_categories.id). &lt;br /&gt;
&lt;br /&gt;
* Do not confuse this &#039;&#039;category id&#039;&#039; with the new custom &#039;&#039;category id number&#039;&#039; field that you can manually assign to a category. (See Trackers http://tracker.moodle.org/browse/MDL-28518 and http://tracker.moodle.org/browse/MDL-31845). &lt;br /&gt;
* Leaving the category id data empty means that a course will be assigned to the default category.&lt;br /&gt;
* If you assign data to categories that do  not exist already in Moodle, the courses will not be created.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Default new course category&#039;&#039;&#039; is the category to which courses will be assigned and created in, unless you set up and so indicate in the data field of the &amp;quot;New course category id field.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
You may also specify a &#039;&#039;&#039;New course template&#039;&#039;&#039;: a &amp;quot;template&amp;quot; course from which the new course will be copied. The data for this field should be the &#039;&#039;shortname&#039;&#039; of the template course.&lt;br /&gt;
&lt;br /&gt;
== Synchronization Script ==&lt;br /&gt;
&lt;br /&gt;
A script is provided that can synchronize all your user enrollments at once - both adding and removing user enrolments (and creating courses if specified). The script is called sync.php and is found in the enrol/database/cli folder.&lt;br /&gt;
&lt;br /&gt;
This script is meant to be called from a system cronjob to sync moodle enrolments with enrolments in the external database. You need to make sure all the users present in the external enrolments are already created in moodle. If you are using external authentication plugins (db, ldap, etc.) you can use the scripts provided by those plugins to synchronize your users before running this script.&lt;br /&gt;
&lt;br /&gt;
Example cron entry for Moodle 2.5&lt;br /&gt;
    # 5 minutes past 4am&lt;br /&gt;
    5 4 * * * /usr/bin/php -c /path/to/php.ini /path/to/moodle/enrol/database/cli/sync.php&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* If you have a large number of enrolments, you may want to raise the memory limits by passing -d memory_limit=256M&lt;br /&gt;
* For debugging &amp;amp; better logging, you are encouraged to use in the command line: -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0&lt;br /&gt;
* This only works for users that already exist in your Moodle site (see comment above)&lt;br /&gt;
&lt;br /&gt;
== Setting up enrolment sync (How to) ==&lt;br /&gt;
&lt;br /&gt;
You will need to perform (as a minimum) the following steps to enable external database enrolment - only a single table is required in the database which contains a record for every user/course combination. If the table is large it is a good idea to make sure appropriate indexes have been created:&lt;br /&gt;
&lt;br /&gt;
* Use an existing database or create a new one. Use an existing table or create a new one with the following minimum fields.&lt;br /&gt;
*# A unique course identifier to match one of the following fields.&lt;br /&gt;
*#* the &amp;quot;idnumber&amp;quot; field in Moodle&#039;s course table (varchar 100), which is manually specified as the &amp;quot;Course ID number&amp;quot; when editing a course&#039;s settings&lt;br /&gt;
*#* the &amp;quot;shortname&amp;quot; field in Moodle&#039;s course table (varchar 255), which is manually specified as the &amp;quot;Course short name&amp;quot; when editing a course&#039;s settings&lt;br /&gt;
*#* the &amp;quot;id&amp;quot; field in Moodle&#039;s course table (int 10), which is based on course creation order&lt;br /&gt;
*# A unique user identifier to match one of the following fields.&lt;br /&gt;
*#* the &amp;quot;idnumber&amp;quot; field in Moodle&#039;s user table (varchar 255), which is manually specified as the &amp;quot;ID number&amp;quot; when editing a user&#039;s profile&lt;br /&gt;
*#* the &amp;quot;username&amp;quot; field in Moodle&#039;s user table (varchar 100), which is manually specified as the &amp;quot;Username&amp;quot; when editing a user&#039;s profile&lt;br /&gt;
*#* the &amp;quot;email&amp;quot; field in Moodle&#039;s user table (varchar 100), which is manually specified as the &amp;quot;Email address&amp;quot; when editing a user&#039;s profile&lt;br /&gt;
*#* the &amp;quot;id&amp;quot; field in Moodle&#039;s user table (int 10), which is based on user creation order&lt;br /&gt;
*# (optional) A unique role identifier to match one of the following fields.&lt;br /&gt;
*#* the &amp;quot;shortname&amp;quot; field in Moodle&#039;s role table (varchar 100), for example editingteacher, coursecreator, student, ...&lt;br /&gt;
*#* the &amp;quot;name&amp;quot; field in Moodle&#039;s role table (varchar 255), for example Teacher, Course creator, Student, ...&lt;br /&gt;
*#* the &amp;quot;id&amp;quot; field in Moodle&#039;s role table (int 10), which is based on initial installation and new role creation order&lt;br /&gt;
* Populate the database table. Each user/course combination to have a record in the table.&lt;br /&gt;
* In Moodle, go to Site administration =&amp;gt; Plugins =&amp;gt; Enrolments =&amp;gt; Manage enrol plugins, find External Database in the list, enable it (click the closed-eye icon) and click Settings.&lt;br /&gt;
* In the top panel, select the database type (make sure you have the necessary configuration in PHP for that type) and then supply the information to connect to the database.&lt;br /&gt;
* The middle panel creates the mapping between Moodle and the external database. The first three settings are for the local (Moodle) field names and the last three for the remote (external database) settings. They are in the same order.&lt;br /&gt;
** enrol_localcoursefield / enrol_remotecoursefield - in Moodle the name of the field in the course settings the uniquely identifies the course (e.g., idnumber). In the external database the name of the matching field.&lt;br /&gt;
** enrol_localuserfield / enrol_remoteuserfield - in Moodle the name of the field in the user profile that uniquely identified the user (e.g., idnumber). In the external database the name of the matching field.&lt;br /&gt;
** enrol_db_localrolefield / enrol_db_remoterolefield - (optional) in Moodle the name of the field in the role edit page the uniquely identifies the role (e.g., shortname). In the external database the name of the matching field.&lt;br /&gt;
* The Roles panel specifies the role that the user will get in the course if their role is not specified in the external database.&lt;br /&gt;
* The final panel enables auto creation of courses.&lt;br /&gt;
* Save changes, and then tick the box to enable external database enrolment.&lt;br /&gt;
&lt;br /&gt;
== Database enrolment does not appear in the course enrolment drop down menu. Why? ==&lt;br /&gt;
&lt;br /&gt;
The course enrolment drop down menu only lists [[Enrolment_plugins#Interactive_enrolment|&#039;&#039;&#039;interactive&#039;&#039;&#039; enrolment plugins]]. External database enrolment is not such a plugin, so it doesn&#039;t appear in the list. Similarly, the &amp;quot;Course Enrollable&amp;quot; setting (in the Course Settings) page also only applies to interactive enrolment plugins and has no effect on external database enrollment. &lt;br /&gt;
&lt;br /&gt;
As of this writing, the only interactive enrolment plugins are &#039;&#039;manual&#039;&#039; (also know as &#039;&#039;internal&#039;&#039;), &#039;&#039;paypal&#039;&#039; and &#039;&#039;authorize.net&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Field Mapping Example: ==&lt;br /&gt;
Choose your fields from the Moodle database:&lt;br /&gt;
&lt;br /&gt;
*enrol_localcoursefield:  A course identifier from mdl_course, e.g. &amp;quot;idnumber&amp;quot;&lt;br /&gt;
*enrol_localuserfield: A user identifier from mdl_user, e.g. &amp;quot;idnumber&amp;quot;&lt;br /&gt;
*enrol_localrolefield: (optional) A role identifier from mdl_role, e.g. &amp;quot;shortname&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Create a view in your external database which matches the chosen field values from Moodle:&lt;br /&gt;
&lt;br /&gt;
*enrol_remotecoursefield: A matching course identifier from your external database table, e.g. &amp;quot;course_number&amp;quot;&lt;br /&gt;
*enrol_remoteuserfield: A matching user identifier from your external database table, e.g. &amp;quot;userid&amp;quot;&lt;br /&gt;
*enrol_remoterolefield: (optional) A matching role identifier from your external database table, e.g. &amp;quot;role_name&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Potential Gotchas ==&lt;br /&gt;
&lt;br /&gt;
* It almost goes without saying that the integrity of the external database is important. If data is missing from the database then there is a potential for users being unenrolled from some or all of their courses. The unenrollment process will remove them from any group assignments and also poll each module type to give the module the option of removing that user&#039;s data if appropriate (for example, however, forum posts are never deleted). It is therefore prudent that you take the utmost care to ensure that the data in the external bass is correct at all times.&lt;br /&gt;
* &#039;&#039;&#039;Minor Security Issue&#039;&#039;&#039; Consider that if the ID number field you use to identify your students is editable by the students (in their profile), then there is a potential for them changing this to the id of another valid student and gaining access to resources that they should not. (However, they will still appear as themselves, they cannot impersonate the other user or otherwise gain access to their resources.) To prevent this and similar issues, you can lock the ID number as well as other fields so the user can not change them. Do this in the &#039;&#039;&#039;Data mapping&#039;&#039;&#039; section of &#039;&#039;Settings&amp;gt;Site administration&amp;gt;Plugins&amp;gt;Authentication&amp;gt;External database&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Errors and Diagnostics==&lt;br /&gt;
&lt;br /&gt;
The plugin produces a number of diagnostic messages and/or errors which are recorded to the PHP error log (as defined in the php.ini file). In addition messages about courses that are in the database for the user but that do not exist in the Moodle site will only be produced if debugging is set to ALL or DEVELOPER.&lt;br /&gt;
&lt;br /&gt;
You can get detailed progress information by executing the sync script  with -v parameter:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 php /path/to/moodle/enrol/database/cli/sync.php -v&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=49475 MySQL enrolment plugin doesn&#039;t seem to work] forum discussion&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=74133 Someone explain external database enrolment, please??] forum discussion&lt;br /&gt;
*Example Setup [https://docs.moodle.org/en/Talk:External_database_enrolment#Example_External_Enrollment] Example Database Enrollment Setup&lt;br /&gt;
&lt;br /&gt;
[[es:Matriculación Base de Datos Externa]]&lt;br /&gt;
[[fr:Base de données externe]]&lt;br /&gt;
[[de:Einschreibung über externe Datenbank]]&lt;br /&gt;
[[ja:外部データベース登録]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Moodle_video_tutorials&amp;diff=103175</id>
		<title>Moodle video tutorials</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Moodle_video_tutorials&amp;diff=103175"/>
		<updated>2013-02-15T13:16:14Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Video tutorials in English */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are a large number of free online video tutorials about Moodle and this page collates them for Moodle 2. If you have made some Moodle 2 video tutorials or have a link to some free Moodle 2 video tutorials, please add them here.&lt;br /&gt;
&lt;br /&gt;
==Video tutorials in English==&lt;br /&gt;
*[http://www.youtube.com/moodlehq Videos made by Moodle HQ]&lt;br /&gt;
*[http://youtube.com/usingmoodle video tutorials explaining the new features of Moodle 2]&lt;br /&gt;
*[http://www.lynda.com/Moodle-2-0-tutorials/Moodle-2-Essential-Training-for-Teachers/85410-2.html some free video tutorials from lynda.com]&lt;br /&gt;
*[http://www.youtube.com/HRDNZMoodlePartner Videos made by HRDNZ]&lt;br /&gt;
*[http://www.webanywhere.co.uk/video Videos made by Webanywhere]&lt;br /&gt;
&lt;br /&gt;
==Video tutorials in other languages==&lt;br /&gt;
*[http://youtube.com/Moodle2Ourlearning  video tutorials in French/en Français]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Moodle manuals]]&lt;br /&gt;
*[[Moodle presentations]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Moodle_video_tutorials&amp;diff=103174</id>
		<title>Moodle video tutorials</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Moodle_video_tutorials&amp;diff=103174"/>
		<updated>2013-02-15T13:14:01Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: Removed link as videos have been removed &amp;quot;due to intellectual property rights.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are a large number of free online video tutorials about Moodle and this page collates them for Moodle 2. If you have made some Moodle 2 video tutorials or have a link to some free Moodle 2 video tutorials, please add them here.&lt;br /&gt;
&lt;br /&gt;
==Video tutorials in English==&lt;br /&gt;
*[http://www.youtube.com/moodlehq Videos made by Moodle HQ]&lt;br /&gt;
*[http://youtube.com/usingmoodle video tutorials explaining the new features of Moodle 2]&lt;br /&gt;
*[http://www.lynda.com/Moodle-2-0-tutorials/Moodle-2-Essential-Training-for-Teachers/85410-2.html some free video tutorials from lynda.com]&lt;br /&gt;
*[http://www.youtube.com/HRDNZMoodlePartner Videos made by HRDNZ]&lt;br /&gt;
&lt;br /&gt;
==Video tutorials in other languages==&lt;br /&gt;
*[http://youtube.com/Moodle2Ourlearning  video tutorials in French/en Français]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Moodle manuals]]&lt;br /&gt;
*[[Moodle presentations]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=ad-hoc_contributed_reports&amp;diff=97678</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=ad-hoc_contributed_reports&amp;diff=97678"/>
		<updated>2012-05-14T13:59:01Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Number of Quizes per Course */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==User and Role Report==&lt;br /&gt;
===Detailed ACTIONs for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT r.name,l.action, count( l.userid ) as counter&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE ra.roleid IN (3,4,5)&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
ORDER BY counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 1.9.x)===&lt;br /&gt;
&lt;br /&gt;
Reports a site global list of all users enroled in each course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user.firstname AS Firstname,&lt;br /&gt;
user.lastname AS Lastname,&lt;br /&gt;
user.email AS Email,&lt;br /&gt;
user.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=asg.roleid)&lt;br /&gt;
FROM&lt;br /&gt;
prefix_user AS user,&lt;br /&gt;
prefix_course AS course,&lt;br /&gt;
prefix_role_assignments AS asg&lt;br /&gt;
INNER JOIN prefix_context AS context ON asg.contextid=context.id   &lt;br /&gt;
WHERE&lt;br /&gt;
context.contextlevel = 50&lt;br /&gt;
AND&lt;br /&gt;
user.id=asg.userid&lt;br /&gt;
AND&lt;br /&gt;
context.instanceid=course.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 2.x)===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user2.firstname AS Firstname,&lt;br /&gt;
user2.lastname AS Lastname,&lt;br /&gt;
user2.email AS Email,&lt;br /&gt;
user2.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT shortname FROM prefix_role WHERE id=en.roleid) as Role&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=en.roleid) as RoleName&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course as course &lt;br /&gt;
JOIN prefix_enrol AS en ON en.courseid = course.id&lt;br /&gt;
JOIN prefix_user_enrolments AS ue ON ue.enrolid = en.id&lt;br /&gt;
JOIN prefix_user AS user2 ON ue.userid = user2.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permissions Overides on Categories===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712834 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT rc.id, ct.instanceid, ccat.name, rc.roleid, rc.capability, rc.permission, &lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( rc.timemodified ) , &#039;%Y-%m-%d&#039; ) AS timemodified, rc.modifierid, ct.instanceid, ct.path, ct.depth&lt;br /&gt;
FROM `prefix_role_capabilities` AS rc&lt;br /&gt;
INNER JOIN `prefix_context` AS ct ON rc.contextid = ct.id&lt;br /&gt;
INNER JOIN `prefix_course_categories` AS ccat ON ccat.id = ct.instanceid&lt;br /&gt;
AND `contextlevel` =40&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;Totally Opened Courses&amp;quot; (visible, opened to guests, with no password)===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712837 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id , category , fullname , shortname , enrollable&lt;br /&gt;
FROM `prefix_course`&lt;br /&gt;
WHERE `guest` =1&lt;br /&gt;
AND `password` = &amp;quot;&amp;quot;&lt;br /&gt;
AND `visible` =1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;loggedin users&amp;quot; from the last 120 days===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id,username,FROM_UNIXTIME(`lastlogin`) as days &lt;br /&gt;
FROM `prefix_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;and user count for that same population:&#039;&#039;&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(id) as Users  FROM `prefix_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Students in all courses of some institute===&lt;br /&gt;
What is the status (deleted or not) of all Students (roleid = 5) in all courses of some Institute&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname, u.firstname, u.lastname, u.deleted&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
AND u.institution = &#039;please enter school name here&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full User info (for deleted users)===&lt;br /&gt;
Including extra custom profile fields (from mdl_user_info_data)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT * &lt;br /&gt;
FROM prefix_user as u &lt;br /&gt;
JOIN prefix_user_info_data as uid ON uid.userid = u.id &lt;br /&gt;
JOIN prefix_user_info_field as uif ON (uid.fieldid = uif.id AND uif.shortname = &#039;class&#039;)&lt;br /&gt;
WHERE `deleted` = &amp;quot;1&amp;quot; and `institution`=&amp;quot;your school name&amp;quot; and `department` = &amp;quot;your department&amp;quot; and `data` = &amp;quot;class level and number&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===User&#039;s courses===&lt;br /&gt;
change &amp;quot;u.id = 2&amp;quot; with a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname, c.id, c.fullname&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE u.id = 2&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Special Roles===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.roleid,r.name&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,ra.userid,&#039;&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Username&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_context AS ctx ON (ctx.id = ra.contextid AND ctx.contextlevel = 50)&lt;br /&gt;
JOIN prefix_course AS c ON ctx.instanceid = c.id&lt;br /&gt;
WHERE ra.roleid &amp;gt; 6&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Courses without Teachers===&lt;br /&gt;
Actually, shows the number of Teachers in a course.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id) AS Teachers&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
ORDER BY Teachers ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List of users who have been enrolled for more than 4 weeks===&lt;br /&gt;
For Moodle 2.2 , by  Isuru Madushanka Weerarathna &lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT uenr.userid As User, IF(enr.courseid=enr.courseid ,&#039;Y&#039;,&#039;N&#039;) As Enrolled, &lt;br /&gt;
IF(DATEDIFF(NOW(), FROM_UNIXTIME(uenr.timecreated))&amp;gt;=28,&#039;Y&#039;,&#039;N&#039;) As EnrolledMoreThan4Weeks&lt;br /&gt;
FROM mdl_enrol As enr, mdl_user_enrolments AS uenr&lt;br /&gt;
WHERE enr.id = uenr.enrolid AND enr.status = uenr.statu&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Log Acivity Reports==&lt;br /&gt;
===Detailed &amp;quot;VIEW&amp;quot; ACTION for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT l.action, count( l.userid ) as counter , r.name&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN `prefix_role` AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE (ra.roleid IN (3,4,5)) AND (l.action LIKE &#039;%view%&#039; )&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
order by r.name,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Total Activity of Roles:&amp;quot;Teacher&amp;quot; and &amp;quot;None-Editing Teacher&amp;quot; by Dates and by Hours===&lt;br /&gt;
The output columns of this report table can be used as base for a Pivot-Table&lt;br /&gt;
which will show the amount of &#039;&#039;&#039;activity&#039;&#039;&#039; per &#039;&#039;&#039;hour&#039;&#039;&#039; per &#039;&#039;&#039;days&#039;&#039;&#039; in 3D graph view.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%Y/%m/%d&#039; ) AS grptimed ,&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%k&#039; ) AS grptimeh  , count( l.userid ) AS counter &lt;br /&gt;
FROM `prefix_log` AS l&lt;br /&gt;
JOIN prefix_user AS u ON u.id = l.userid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
WHERE ra.roleid IN (3,4)&lt;br /&gt;
GROUP BY grptimed,grptimeh&lt;br /&gt;
ORDER BY grptimed,grptimeh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===How many LOGINs per user and user&#039;s Activity===&lt;br /&gt;
+ link username to a user activity graph report&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,u.id,&#039;&amp;amp;mode=alllogs&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) as Username&lt;br /&gt;
,count(*) as logins&lt;br /&gt;
,(SELECT count(*) FROM prefix_log WHERE userid = l.userid GROUP BY userid) as Activity &lt;br /&gt;
FROM prefix_log as l JOIN prefix_user as u ON l.userid = u.id &lt;br /&gt;
WHERE `action` LIKE &#039;%login%&#039; group by userid&lt;br /&gt;
ORDER BY Activity DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Course Reports==&lt;br /&gt;
===Most Active courses===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, l.course courseId, c.fullname coursename&lt;br /&gt;
FROM prefix_log l INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
GROUP BY courseId&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Active courses, advanced===&lt;br /&gt;
Including: Teacher&#039;s name, link to the course, All types of log activities, special YEAR generated field, Activities and Resource count, enrolled Student count&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course &lt;br /&gt;
&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher&lt;br /&gt;
&lt;br /&gt;
,CASE &lt;br /&gt;
  WHEN c.fullname LIKE &#039;%תשע&#039; THEN &#039;תשע&#039;&lt;br /&gt;
  WHEN c.fullname LIKE &#039;%תשעא&#039; THEN &#039;תשעא&#039;&lt;br /&gt;
  WHEN c.fullname LIKE &#039;%תשעב&#039; THEN &#039;תשעב&#039;&lt;br /&gt;
END AS Year&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_course_modules cm WHERE cm.course = l.course) Modules&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_log l &lt;br /&gt;
INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
GROUP BY c.id&lt;br /&gt;
HAVING Modules &amp;gt; 2&lt;br /&gt;
ORDER BY Year DESC, hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===RESOURCE count for each COURSE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) count, l.course, c.fullname coursename&lt;br /&gt;
FROM prefix_resource l INNER JOIN prefix_course c on l.course = c.id&lt;br /&gt;
GROUP BY course&lt;br /&gt;
ORDER BY count DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Courses that are defined as using GROUPs===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/group/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,(SELECT count(*) FROM prefix_course_modules cm WHERE cm.course = c.id) Modules&lt;br /&gt;
 FROM `prefix_course` AS c&lt;br /&gt;
WHERE groupmode &amp;gt; 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List all Courses in and below a certain category===&lt;br /&gt;
Use this SQL code to retrieve all courses that exist in or under a set category.&lt;br /&gt;
&lt;br /&gt;
$s should be the id of the category you want to know about...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course. * , prefix_course_categories. *&lt;br /&gt;
FROM prefix_course, prefix_course_categories&lt;br /&gt;
WHERE prefix_course.category = prefix_course_categories.id&lt;br /&gt;
AND (&lt;br /&gt;
prefix_course_categories.path LIKE &#039;/$s/%&#039;&lt;br /&gt;
OR prefix_course_categories.path LIKE &#039;/$s&#039;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
===List all Categories in one level below a certain category===&lt;br /&gt;
Use this PHP code to retrieve a list of all categories below a certain category.&lt;br /&gt;
&lt;br /&gt;
$s should be the id of the top level category you are interested in.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once(&#039;./config.php&#039;);&lt;br /&gt;
&lt;br /&gt;
$parent_id = $s;&lt;br /&gt;
&lt;br /&gt;
$categories= array();&lt;br /&gt;
&lt;br /&gt;
$categories = get_categories($parent_id);&lt;br /&gt;
&lt;br /&gt;
echo &#039;&amp;lt;ol&amp;gt;&#039;;&lt;br /&gt;
foreach ($categories as $category)&lt;br /&gt;
        {&lt;br /&gt;
        echo &#039;&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;&#039;.$CFG-&amp;gt;wwwroot.&#039;/course/category.php?id=&#039;.$category-&amp;gt;id.&#039;&amp;quot;&amp;gt;&#039;.$category-&amp;gt;name.&#039;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#039;;&lt;br /&gt;
        }&lt;br /&gt;
echo &#039;&amp;lt;/ol&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Blog activity per Course (not including VIEW)===&lt;br /&gt;
Filter activity logging to some specific Course Categories!&lt;br /&gt;
+ link course name to actual course (for quick reference)&lt;br /&gt;
(you can change %blog% to %wiki% to filter down all wiki activity or any other module you wish)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID&lt;br /&gt;
,m.name ,count(cm.id) as counter &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS Students&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE `module` LIKE &#039;%blog%&#039; AND course = c.id AND action NOT LIKE &#039;%view%&#039; ) as BlogActivity&lt;br /&gt;
FROM `prefix_course_modules` as cm JOIN prefix_modules as m ON cm.module=m.id JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%blog%&#039; AND c.category IN ( 8,13,15)&lt;br /&gt;
GROUP BY cm.course,cm.module order by counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Courses which uploaded a Syllabus file===&lt;br /&gt;
+ under specific Category&lt;br /&gt;
+ show first Teacher in that course&lt;br /&gt;
+ link Course&#039;s fullname to actual course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) as Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user as u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) as Teacher&lt;br /&gt;
FROM prefix_resource as r &lt;br /&gt;
JOIN prefix_course as c ON r.course = c.id&lt;br /&gt;
WHERE ( r.name LIKE &#039;%סילבוס%&#039; OR r.name LIKE &#039;%סילאבוס%&#039; OR r.name LIKE &#039;%syllabus%&#039; OR r.name LIKE &#039;%תכנית הקורס%&#039; ) &lt;br /&gt;
AND c.category IN (10,18,26,13,28)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grade Reports==&lt;br /&gt;
===Site-Wide Grade Report with All Items===&lt;br /&gt;
Shows grades for all course items along with course totals for each student.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
c.fullname AS &#039;Course&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id &lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Site-Wide Grade Report with Just Course Totals===&lt;br /&gt;
A second site-wide grade report for all students that just shows course totals.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id AND gi.itemtype = &#039;course&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Learner report by Learner with grades===&lt;br /&gt;
Which Learners in which course and what are the grades&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;Name&#039; , u.lastname AS &#039;Surname&#039;, c.fullname AS &#039;Course&#039;, cc.name AS &#039;Category&#039;, &lt;br /&gt;
CASE WHEN gi.itemtype = &#039;Course&#039;    &lt;br /&gt;
THEN c.fullname + &#039; Course Total&#039;  &lt;br /&gt;
ELSE gi.itemname &lt;br /&gt;
END AS &#039;Item Name&#039;, ROUND(gg.finalgrade,2) AS Score,ROUND(gg.rawgrademax,2) AS Max, ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) as Percentage,&lt;br /&gt;
&lt;br /&gt;
if (ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) &amp;gt; 79,&#039;Yes&#039; , &#039;No&#039;) as Pass&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c &lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid &lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id &lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid &lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id &lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid &lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category &lt;br /&gt;
WHERE  gi.courseid = c.id and gi.itemname != &#039;Attendance&#039;&lt;br /&gt;
ORDER BY `Name` ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Activity Module Reports==&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each MODULE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT module,action,count(id) as counter&lt;br /&gt;
FROM prefix_log&lt;br /&gt;
GROUP BY module,action&lt;br /&gt;
ORDER BY module,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Most popular ACTIVITY===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, module&lt;br /&gt;
FROM prefix_log l&lt;br /&gt;
WHERE module != &#039;login&#039; AND module != &#039;course&#039; AND module != &#039;role&#039;&lt;br /&gt;
GROUP BY module&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===System wide use of ACTIVITIES and RESOURCES===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT count( cm.id ) AS counter, m.name&lt;br /&gt;
FROM `prefix_course_modules` AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
GROUP BY cm.module&lt;br /&gt;
ORDER BY counter DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LOG file ACTIONS per MODULE per COURSE (IDs)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select course,module,action,count(action) as summa from prefix_log&lt;br /&gt;
where action &amp;lt;&amp;gt; &#039;new&#039;&lt;br /&gt;
group by course,action,module&lt;br /&gt;
order by course,module,action&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===System Wide usage count of various course Activities===&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
Like: Forum, Wiki, Blog, Assignment, Database,&lt;br /&gt;
#Within specific category&lt;br /&gt;
#Teacher name in course&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher &lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%blog%&#039;) AS Blogs&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM &lt;br /&gt;
prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%forum%&#039;) AS Forums&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%data%&#039;) AS Databses&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%assignment%&#039;) AS Assignments&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 18)&lt;br /&gt;
ORDER BY Wikis DESC,Blogs DESC, Forums DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Detailed WIKI activity (per wiki per course)===&lt;br /&gt;
Including Number of Students in course (for reference)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID  &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id ) AS Students&lt;br /&gt;
,m.name&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%updat%&#039; ) as &#039;UPDAT E&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%annotate%&#039; ) as ANNOTATE&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%comment%&#039; ) as COMMENT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%add%&#039; ) as &#039;A DD&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%edit%&#039; ) as EDIT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action NOT LIKE &#039;%view%&#039; ) as &#039;All (NO View)&#039;&lt;br /&gt;
FROM `prefix_course_modules` as cm &lt;br /&gt;
JOIN prefix_modules as m ON cm.module=m.id &lt;br /&gt;
JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
GROUP BY cm.course,cm.module&lt;br /&gt;
ORDER BY &#039;All (NO View)&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Wiki usage, system wide===&lt;br /&gt;
(you can filter the output by selecting some specific course categories : &amp;quot;WHERE c.category IN ( 8,13,15)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039;) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%add%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ADD&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%edit%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;EDIT&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%annotate%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ANNOTATE&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%comments%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;Comments&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_ouwiki_pages as ouwp&lt;br /&gt;
JOIN prefix_ouwiki as ouw ON ouw.id = ouwp.subwikiid&lt;br /&gt;
WHERE ouw.course = c.id GROUP BY ouw.course  ) as OUWikiPages&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( DISTINCT nwp.pagename ) FROM prefix_wiki_pages AS nwp&lt;br /&gt;
JOIN prefix_wiki AS nw ON nw.id = nwp.dfwiki WHERE nw.course = c.id ) As NWikiPages&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 8,13,15)&lt;br /&gt;
HAVING Wikis &amp;gt; 0&lt;br /&gt;
ORDER BY &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Aggregated Teacher activity by &amp;quot;WEB2&amp;quot; Modules===&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
The NV column shows activity without VIEW log activity&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.userid, u.firstname,u.lastname&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039;) AS Wiki&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Wiki_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039;) AS Forum&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Forum_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039;) AS Blog&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Blog_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039;) AS Assignment&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Assignment_NV&lt;br /&gt;
FROM prefix_role_assignments AS ra &lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid &lt;br /&gt;
WHERE ra.roleid = 3 &lt;br /&gt;
GROUP BY ra.userid&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List all the certificates issued, sort by variables in the custom profile fields===&lt;br /&gt;
Note: The SQL queries look intimidating at first, but isn&#039;t really that difficult to learn. I&#039;ve seen in the forums that users wanted to do &#039;site-wide&#039; groups in 1.9x. This is sort of the idea. It pulls all the certificates issued to all users sorted by the custom profile fields, which in my case is the Units or Depts (i.e. my site wide groups). Why certificates? I&#039;ve explored with both grades and quizzes, the course admins are not really interested in the actual grades but whether the learner received a certificate (i.e. passed the course with x, y, z activities). It also saves me from creating groups and assigning them into the right groups. Even assigning in bulk is not efficient, since I have upward of 25 groups per course and constantly new learners enrolling in courses. The limitation is something to do with the server? as it only pull 5000 rows of data. If anyone figured out how to change this, please let me know. In the meantime, the work around is to pull only a few units/depts at a time to limit the number of rows. This is fine at the moment, since each course admin are only responsible for certain units/depts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME(prefix_certificate_issues.timecreated), &#039;%Y/%m/%d&#039; ) AS Date,&lt;br /&gt;
prefix_certificate_issues.classname AS Topic,&lt;br /&gt;
prefix_certificate.name AS Certificate,&lt;br /&gt;
prefix_certificate_issues.studentname as Name,&lt;br /&gt;
prefix_user_info_data.data AS Units&lt;br /&gt;
&lt;br /&gt;
FROM&lt;br /&gt;
prefix_certificate_issues&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_user_info_data&lt;br /&gt;
on prefix_certificate_issues.userid = prefix_user_info_data.userid&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_certificate&lt;br /&gt;
on prefix_certificate_issues.certificateid = prefix_certificate.id&lt;br /&gt;
&lt;br /&gt;
WHERE prefix_user_info_data.data=&#039;Unit 1&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 2&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 3&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY Units, Name, Topic ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Counter Blog usage in Courses,system wide===&lt;br /&gt;
What teachers in what courses, uses blogs and how many + student count in that course.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT ( @counter := @counter+1) as counter, &lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user AS u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = c.id AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%blog%&#039;) AS Blogs&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c, (SELECT @counter := 0) as s_init&lt;br /&gt;
WHERE c.category IN ( 8,13,15)&lt;br /&gt;
HAVING Blogs &amp;gt; 0&lt;br /&gt;
ORDER BY Blogs DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Assignment Module Reports==&lt;br /&gt;
===All Ungraded Assignments===&lt;br /&gt;
Returns all the submitted assignments that still need grading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id&lt;br /&gt;
and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Ungraded Assignments w/ Link===&lt;br /&gt;
Returns all the submitted assignments that still need grading, along with a link that goes directly to the submission to grade it. The links work if you view the report within Moodle.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
&#039;&amp;lt;a href=&amp;quot;http://education.varonis.com/mod/assignment/submissions.php&#039; + char(63) +&lt;br /&gt;
+ &#039;id=&#039; + cast(cm.id as varchar) + &#039;&amp;amp;userid=&#039; + cast(u.id as varchar) &lt;br /&gt;
+ &#039;&amp;amp;mode=single&amp;amp;filter=0&amp;amp;offset=2&amp;quot;&amp;gt;&#039; + a.name + &#039;&amp;lt;/a&amp;gt;&#039;&lt;br /&gt;
AS &amp;quot;Assignmentlink&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Who is using &amp;quot;Single File Upload&amp;quot; assignment===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
 &lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher &lt;br /&gt;
&lt;br /&gt;
,ass.name as &amp;quot;Assignment Name&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM &lt;br /&gt;
prefix_assignment as ass&lt;br /&gt;
&lt;br /&gt;
JOIN &lt;br /&gt;
prefix_course as c ON c.id = ass.course&lt;br /&gt;
&lt;br /&gt;
WHERE `assignmenttype` LIKE &#039;uploadsingle&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Resource Module Reports==&lt;br /&gt;
===List &amp;quot;Recently uploaded files&amp;quot;===&lt;br /&gt;
see what users are uploading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT FROM_UNIXTIME(time,&#039;%Y %M %D %h:%i:%s&#039;) as time ,ip,userid,url,info  &lt;br /&gt;
FROM `prefix_log` &lt;br /&gt;
WHERE `action` LIKE &#039;upload&#039; &lt;br /&gt;
ORDER BY `prefix_log`.`time`  DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List Courses that loaded a specific file: &amp;quot;X&amp;quot;===&lt;br /&gt;
Did the Teacher (probably) uploaded course&#039;s Syllabus ?&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname  FROM `prefix_log` as l &lt;br /&gt;
JOIN prefix_course as c ON c.id = l.course &lt;br /&gt;
WHERE `action` LIKE &#039;%upload%&#039; AND ( info LIKE &#039;%Syllabus%&#039; OR info LIKE &#039;%Sylabus%&#039; ) GROUP BY c.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All resources that link to some specific external website===&lt;br /&gt;
+ link to course&lt;br /&gt;
+ who&#039;s the teacher&lt;br /&gt;
+ link to external resource&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/resource/view.php?id=&#039;,r.id,&#039;&amp;quot;&amp;gt;&#039;,r.name,&#039;&amp;lt;/a&amp;gt;&#039;) AS Resource&lt;br /&gt;
FROM prefix_resource AS r &lt;br /&gt;
JOIN prefix_course AS c ON r.course = c.id&lt;br /&gt;
WHERE r.reference LIKE &#039;http://info.oranim.ac.il/home%&#039; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Compose Web Page&amp;quot; RESOURCE count===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT course,prefix_course.fullname, COUNT(*) AS Total&lt;br /&gt;
FROM `prefix_resource`&lt;br /&gt;
JOIN `prefix_course` ON prefix_course.id = prefix_resource.course&lt;br /&gt;
WHERE type=&#039;html&#039;&lt;br /&gt;
GROUP BY course&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Resource count in courses===&lt;br /&gt;
+ (First)Teacher name&lt;br /&gt;
+ Where course is inside some specific Categories&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
COUNT(*) AS count&lt;br /&gt;
,r.course &lt;br /&gt;
,c.shortname shortname&lt;br /&gt;
,c.fullname coursename&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user as u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = r.course AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
FROM prefix_resource r &lt;br /&gt;
JOIN prefix_course c ON r.course = c.id&lt;br /&gt;
WHERE c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY r.course&lt;br /&gt;
ORDER BY COUNT(*) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Forum Module Reports==&lt;br /&gt;
===FORUM use Count per COURSE -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FORUM use Count per COURSE by type -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, prefix_forum.type, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course,prefix_forum.type&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Activity In Forums===&lt;br /&gt;
Trying to figure out how much real activity we have in Forums by aggregating:&lt;br /&gt;
Users in Course, Number of Posts, Number of Discussions, Unique student post, Unique student discussions, Number of Teachers , Number of Students, ratio between unique Student posts and the number of students in the Course...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.fullname,f.name,f.type &lt;br /&gt;
,(SELECT count(id) FROM prefix_forum_discussions as fd WHERE f.id = fd.forum) as Discussions&lt;br /&gt;
,(SELECT count(distinct fd.userid) FROM prefix_forum_discussions as fd WHERE fd.forum = f.id) as UniqueUsersDiscussions&lt;br /&gt;
,(SELECT count(fp.id) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as Posts&lt;br /&gt;
,(SELECT count(distinct fp.userid) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as UniqueUsersPosts&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Students&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS StudentsCount&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Teachers&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =3&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS &#039;Teacher&amp;lt;br/&amp;gt;Count&#039;&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid IN (3,5)&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS UserCount&lt;br /&gt;
, (SELECT (UniqueUsersDiscussions / StudentsCount )) as StudentDissUsage&lt;br /&gt;
, (SELECT (UniqueUsersPosts /StudentsCount)) as StudentPostUsage&lt;br /&gt;
FROM prefix_forum as f &lt;br /&gt;
JOIN prefix_course as c ON f.course = c.id&lt;br /&gt;
WHERE `type` != &#039;news&#039;&lt;br /&gt;
ORDER BY StudentPostUsage DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Forum type:NEWS===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT f.id, f.name&lt;br /&gt;
FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
JOIN prefix_forum AS f ON cm.instance = f.id&lt;br /&gt;
WHERE m.name = &#039;forum&#039;&lt;br /&gt;
AND f.type = &#039;news&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All new forum NEWS items (discussions) from all my Courses===&lt;br /&gt;
change &amp;quot;userid = 26&amp;quot; and &amp;quot;id = 26&amp;quot; to a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname,f.name,fd.name,FROM_UNIXTIME(fd.timemodified ,&amp;quot;%d %M %Y &amp;quot;) as Date&lt;br /&gt;
FROM prefix_forum_discussions as fd &lt;br /&gt;
JOIN prefix_forum as f ON f.id = fd.forum &lt;br /&gt;
JOIN prefix_course as c ON c.id = f.course &lt;br /&gt;
JOIN prefix_user_lastaccess as ul ON (c.id = ul.courseid AND ul.userid = 26)&lt;br /&gt;
WHERE fd.timemodified &amp;gt; ul.timeaccess  &lt;br /&gt;
 AND fd.forum IN (SELECT f.id&lt;br /&gt;
 FROM prefix_course_modules AS cm&lt;br /&gt;
 JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
 JOIN prefix_forum AS f ON cm.instance = f.id&lt;br /&gt;
 WHERE m.name = &#039;forum&#039;&lt;br /&gt;
 AND f.type = &#039;news&#039;)&lt;br /&gt;
  AND c.id IN (SELECT c.id&lt;br /&gt;
   FROM prefix_course AS c&lt;br /&gt;
   JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
   JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
   JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
   WHERE u.id = 26) ORDER BY `fd`.`timemodified` DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===News Forum - Discussions COUNT===&lt;br /&gt;
Which is actually... How much instructions students get from their teachers&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname ,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user AS u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = c.id AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/forum/view.php?f=&#039;,fd.forum,&#039;&amp;quot;&amp;gt;&#039;,count(fd.id),&#039;&amp;lt;/a&amp;gt;&#039;) AS DiscussionsSum&lt;br /&gt;
FROM prefix_forum_discussions AS fd&lt;br /&gt;
INNER JOIN prefix_forum AS f ON f.id = fd.forum&lt;br /&gt;
INNER JOIN prefix_course AS c ON c.id = f.course&lt;br /&gt;
WHERE f.type = &#039;news&#039; AND c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY fd.forum&lt;br /&gt;
ORDER BY count(fd.id) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quiz Module Reports==&lt;br /&gt;
===Generate a list of instructors and their email addresses for those courses that has &amp;quot;essay questions&amp;quot; in their quizzes===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT qu.id AS quiz_id, qu.course AS course_id, qu.questions,&lt;br /&gt;
                co.fullname AS course_fullname, co.shortname AS course_shortname,&lt;br /&gt;
                qu.name AS quiz_name, FROM_UNIXTIME(qu.timeopen) AS quiz_timeopen, FROM_UNIXTIME(qu.timeclose) AS quiz_timeclose,&lt;br /&gt;
                u.firstname, u.lastname, u.email,&lt;br /&gt;
FROM mdl_quiz qu, mdl_course co, mdl_role re, mdl_context ct, mdl_role_assignments ra, mdl_user u&lt;br /&gt;
WHERE FROM_UNIXTIME(timeopen) &amp;gt; &#039;2008-05-14&#039; AND&lt;br /&gt;
                qu.course = co.id AND&lt;br /&gt;
                co.id = ct.instanceid AND&lt;br /&gt;
                ra.roleid = re.id AND&lt;br /&gt;
                re.name = &#039;Teacher&#039; AND&lt;br /&gt;
                ra.contextid = ct.id AND&lt;br /&gt;
                ra.userid = u.id&lt;br /&gt;
 &lt;br /&gt;
SELECT Count(&#039;x&#039;) As NumOfStudents&lt;br /&gt;
                                FROM mdl_role_assignments a&lt;br /&gt;
                                JOIN mdl_user u ON userid = u.id&lt;br /&gt;
                                WHERE roleid = 5 AND contextid = (SELECT id FROM mdl_context WHERE instanceid = 668 AND contextlevel = 50)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Number of Quizes per Course===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT count(*)&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/quiz/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;Link&amp;lt;/a&amp;gt;&#039;) AS Quizes&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course_modules cm&lt;br /&gt;
JOIN prefix_course c ON c.id = cm.course&lt;br /&gt;
JOIN prefix_modules as m ON m.id = cm.module&lt;br /&gt;
WHERE m.name LIKE &#039;quiz&#039;&lt;br /&gt;
GROUP BY c.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=ad-hoc_contributed_reports&amp;diff=97460</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=ad-hoc_contributed_reports&amp;diff=97460"/>
		<updated>2012-05-03T12:57:30Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* List all Courses in and below a certain category */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==User and Role Report==&lt;br /&gt;
===Detailed ACTIONs for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT r.name,l.action, count( l.userid ) as counter&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE ra.roleid IN (3,4,5)&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
ORDER BY counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 1.9.x)===&lt;br /&gt;
&lt;br /&gt;
Reports a site global list of all users enroled in each course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user.firstname AS Firstname,&lt;br /&gt;
user.lastname AS Lastname,&lt;br /&gt;
user.email AS Email,&lt;br /&gt;
user.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=asg.roleid)&lt;br /&gt;
FROM&lt;br /&gt;
prefix_user AS user,&lt;br /&gt;
prefix_course AS course,&lt;br /&gt;
prefix_role_assignments AS asg&lt;br /&gt;
INNER JOIN prefix_context AS context ON asg.contextid=context.id   &lt;br /&gt;
WHERE&lt;br /&gt;
context.contextlevel = 50&lt;br /&gt;
AND&lt;br /&gt;
user.id=asg.userid&lt;br /&gt;
AND&lt;br /&gt;
context.instanceid=course.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 2.x)===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user2.firstname AS Firstname,&lt;br /&gt;
user2.lastname AS Lastname,&lt;br /&gt;
user2.email AS Email,&lt;br /&gt;
user2.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT shortname FROM prefix_role WHERE id=en.roleid) as Role&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=en.roleid) as RoleName&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course as course &lt;br /&gt;
JOIN prefix_enrol AS en ON en.courseid = course.id&lt;br /&gt;
JOIN prefix_user_enrolments AS ue ON ue.enrolid = en.id&lt;br /&gt;
JOIN prefix_user AS user2 ON ue.userid = user2.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permissions Overides on Categories===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712834 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT rc.id, ct.instanceid, ccat.name, rc.roleid, rc.capability, rc.permission, &lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( rc.timemodified ) , &#039;%Y-%m-%d&#039; ) AS timemodified, rc.modifierid, ct.instanceid, ct.path, ct.depth&lt;br /&gt;
FROM `prefix_role_capabilities` AS rc&lt;br /&gt;
INNER JOIN `prefix_context` AS ct ON rc.contextid = ct.id&lt;br /&gt;
INNER JOIN `prefix_course_categories` AS ccat ON ccat.id = ct.instanceid&lt;br /&gt;
AND `contextlevel` =40&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;Totally Opened Courses&amp;quot; (visible, opened to guests, with no password)===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712837 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id , category , fullname , shortname , enrollable&lt;br /&gt;
FROM `prefix_course`&lt;br /&gt;
WHERE `guest` =1&lt;br /&gt;
AND `password` = &amp;quot;&amp;quot;&lt;br /&gt;
AND `visible` =1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;loggedin users&amp;quot; from the last 120 days===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id,username,FROM_UNIXTIME(`lastlogin`) as days &lt;br /&gt;
FROM `prefix_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;and user count for that same population:&#039;&#039;&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(id) as Users  FROM `prefix_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Students in all courses of some institute===&lt;br /&gt;
What is the status (deleted or not) of all Students (roleid = 5) in all courses of some Institute&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname, u.firstname, u.lastname, u.deleted&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
AND u.institution = &#039;please enter school name here&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full User info (for deleted users)===&lt;br /&gt;
Including extra custom profile fields (from mdl_user_info_data)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT * &lt;br /&gt;
FROM prefix_user as u &lt;br /&gt;
JOIN prefix_user_info_data as uid ON uid.userid = u.id &lt;br /&gt;
JOIN prefix_user_info_field as uif ON (uid.fieldid = uif.id AND uif.shortname = &#039;class&#039;)&lt;br /&gt;
WHERE `deleted` = &amp;quot;1&amp;quot; and `institution`=&amp;quot;your school name&amp;quot; and `department` = &amp;quot;your department&amp;quot; and `data` = &amp;quot;class level and number&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===User&#039;s courses===&lt;br /&gt;
change &amp;quot;u.id = 2&amp;quot; with a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname, c.id, c.fullname&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE u.id = 2&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Special Roles===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.roleid,r.name&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,ra.userid,&#039;&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Username&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_context AS ctx ON (ctx.id = ra.contextid AND ctx.contextlevel = 50)&lt;br /&gt;
JOIN prefix_course AS c ON ctx.instanceid = c.id&lt;br /&gt;
WHERE ra.roleid &amp;gt; 6&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Courses without Teachers===&lt;br /&gt;
Actually, shows the number of Teachers in a course.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id) AS Teachers&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
ORDER BY Teachers ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List of users who have been enrolled for more than 4 weeks===&lt;br /&gt;
For Moodle 2.2 , by  Isuru Madushanka Weerarathna &lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT uenr.userid As User, IF(enr.courseid=enr.courseid ,&#039;Y&#039;,&#039;N&#039;) As Enrolled, &lt;br /&gt;
IF(DATEDIFF(NOW(), FROM_UNIXTIME(uenr.timecreated))&amp;gt;=28,&#039;Y&#039;,&#039;N&#039;) As EnrolledMoreThan4Weeks&lt;br /&gt;
FROM mdl_enrol As enr, mdl_user_enrolments AS uenr&lt;br /&gt;
WHERE enr.id = uenr.enrolid AND enr.status = uenr.statu&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Log Acivity Reports==&lt;br /&gt;
===Detailed &amp;quot;VIEW&amp;quot; ACTION for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT l.action, count( l.userid ) as counter , r.name&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN `prefix_role` AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE (ra.roleid IN (3,4,5)) AND (l.action LIKE &#039;%view%&#039; )&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
order by r.name,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Total Activity of Roles:&amp;quot;Teacher&amp;quot; and &amp;quot;None-Editing Teacher&amp;quot; by Dates and by Hours===&lt;br /&gt;
The output columns of this report table can be used as base for a Pivot-Table&lt;br /&gt;
which will show the amount of &#039;&#039;&#039;activity&#039;&#039;&#039; per &#039;&#039;&#039;hour&#039;&#039;&#039; per &#039;&#039;&#039;days&#039;&#039;&#039; in 3D graph view.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%Y/%m/%d&#039; ) AS grptimed ,&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%k&#039; ) AS grptimeh  , count( l.userid ) AS counter &lt;br /&gt;
FROM `prefix_log` AS l&lt;br /&gt;
JOIN prefix_user AS u ON u.id = l.userid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
WHERE ra.roleid IN (3,4)&lt;br /&gt;
GROUP BY grptimed,grptimeh&lt;br /&gt;
ORDER BY grptimed,grptimeh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===How many LOGINs per user and user&#039;s Activity===&lt;br /&gt;
+ link username to a user activity graph report&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,u.id,&#039;&amp;amp;mode=alllogs&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) as Username&lt;br /&gt;
,count(*) as logins&lt;br /&gt;
,(SELECT count(*) FROM prefix_log WHERE userid = l.userid GROUP BY userid) as Activity &lt;br /&gt;
FROM prefix_log as l JOIN prefix_user as u ON l.userid = u.id &lt;br /&gt;
WHERE `action` LIKE &#039;%login%&#039; group by userid&lt;br /&gt;
ORDER BY Activity DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Course Reports==&lt;br /&gt;
===Most Active courses===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, l.course courseId, c.fullname coursename&lt;br /&gt;
FROM prefix_log l INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
GROUP BY courseId&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Active courses, advanced===&lt;br /&gt;
Including: Teacher&#039;s name, link to the course, All types of log activities, special YEAR generated field, Activities and Resource count, enrolled Student count&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course &lt;br /&gt;
&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher&lt;br /&gt;
&lt;br /&gt;
,CASE &lt;br /&gt;
  WHEN c.fullname LIKE &#039;%תשע&#039; THEN &#039;תשע&#039;&lt;br /&gt;
  WHEN c.fullname LIKE &#039;%תשעא&#039; THEN &#039;תשעא&#039;&lt;br /&gt;
  WHEN c.fullname LIKE &#039;%תשעב&#039; THEN &#039;תשעב&#039;&lt;br /&gt;
END AS Year&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_course_modules cm WHERE cm.course = l.course) Modules&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_log l &lt;br /&gt;
INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
GROUP BY c.id&lt;br /&gt;
HAVING Modules &amp;gt; 2&lt;br /&gt;
ORDER BY Year DESC, hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===RESOURCE count for each COURSE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) count, l.course, c.fullname coursename&lt;br /&gt;
FROM prefix_resource l INNER JOIN prefix_course c on l.course = c.id&lt;br /&gt;
GROUP BY course&lt;br /&gt;
ORDER BY count DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Courses that are defined as using GROUPs===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/group/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,(SELECT count(*) FROM prefix_course_modules cm WHERE cm.course = c.id) Modules&lt;br /&gt;
 FROM `prefix_course` AS c&lt;br /&gt;
WHERE groupmode &amp;gt; 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List all Courses in and below a certain category===&lt;br /&gt;
Use this SQL code to retrieve all courses that exist in or under a set category.&lt;br /&gt;
&lt;br /&gt;
$s should be the id of the category you want to know about...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course. * , prefix_course_categories. *&lt;br /&gt;
FROM prefix_course, prefix_course_categories&lt;br /&gt;
WHERE prefix_course.category = prefix_course_categories.id&lt;br /&gt;
AND (&lt;br /&gt;
prefix_course_categories.path LIKE &#039;/$s/%&#039;&lt;br /&gt;
OR prefix_course_categories.path LIKE &#039;/$s&#039;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
===List all Categories in one level below a certain category===&lt;br /&gt;
Use this PHP code to retrieve a list of all categories below a certain category.&lt;br /&gt;
&lt;br /&gt;
$s should be the id of the top level category you are interested in.&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
require_once(&#039;./config.php&#039;);&lt;br /&gt;
&lt;br /&gt;
$parent_id = $s;&lt;br /&gt;
&lt;br /&gt;
$categories= array();&lt;br /&gt;
&lt;br /&gt;
$categories = get_categories($parent_id);&lt;br /&gt;
&lt;br /&gt;
echo &#039;&amp;lt;ol&amp;gt;&#039;;&lt;br /&gt;
foreach ($categories as $category)&lt;br /&gt;
        {&lt;br /&gt;
        echo &#039;&amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;&#039;.$CFG-&amp;gt;wwwroot.&#039;/course/category.php?id=&#039;.$category-&amp;gt;id.&#039;&amp;quot;&amp;gt;&#039;.$category-&amp;gt;name.&#039;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&#039;;&lt;br /&gt;
        }&lt;br /&gt;
echo &#039;&amp;lt;/ol&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Blog activity per Course (not including VIEW)===&lt;br /&gt;
Filter activity logging to some specific Course Categories!&lt;br /&gt;
+ link course name to actual course (for quick reference)&lt;br /&gt;
(you can change %blog% to %wiki% to filter down all wiki activity or any other module you wish)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID&lt;br /&gt;
,m.name ,count(cm.id) as counter &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS Students&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE `module` LIKE &#039;%blog%&#039; AND course = c.id AND action NOT LIKE &#039;%view%&#039; ) as BlogActivity&lt;br /&gt;
FROM `prefix_course_modules` as cm JOIN prefix_modules as m ON cm.module=m.id JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%blog%&#039; AND c.category IN ( 8,13,15)&lt;br /&gt;
GROUP BY cm.course,cm.module order by counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Courses which uploaded a Syllabus file===&lt;br /&gt;
+ under specific Category&lt;br /&gt;
+ show first Teacher in that course&lt;br /&gt;
+ link Course&#039;s fullname to actual course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) as Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user as u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) as Teacher&lt;br /&gt;
FROM prefix_resource as r &lt;br /&gt;
JOIN prefix_course as c ON r.course = c.id&lt;br /&gt;
WHERE ( r.name LIKE &#039;%סילבוס%&#039; OR r.name LIKE &#039;%סילאבוס%&#039; OR r.name LIKE &#039;%syllabus%&#039; OR r.name LIKE &#039;%תכנית הקורס%&#039; ) &lt;br /&gt;
AND c.category IN (10,18,26,13,28)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grade Reports==&lt;br /&gt;
===Site-Wide Grade Report with All Items===&lt;br /&gt;
Shows grades for all course items along with course totals for each student.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
c.fullname AS &#039;Course&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id &lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Site-Wide Grade Report with Just Course Totals===&lt;br /&gt;
A second site-wide grade report for all students that just shows course totals.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id AND gi.itemtype = &#039;course&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Learner report by Learner with grades===&lt;br /&gt;
Which Learners in which course and what are the grades&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;Name&#039; , u.lastname AS &#039;Surname&#039;, c.fullname AS &#039;Course&#039;, cc.name AS &#039;Category&#039;, &lt;br /&gt;
CASE WHEN gi.itemtype = &#039;Course&#039;    &lt;br /&gt;
THEN c.fullname + &#039; Course Total&#039;  &lt;br /&gt;
ELSE gi.itemname &lt;br /&gt;
END AS &#039;Item Name&#039;, ROUND(gg.finalgrade,2) AS Score,ROUND(gg.rawgrademax,2) AS Max, ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) as Percentage,&lt;br /&gt;
&lt;br /&gt;
if (ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) &amp;gt; 79,&#039;Yes&#039; , &#039;No&#039;) as Pass&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c &lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid &lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id &lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid &lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id &lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid &lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category &lt;br /&gt;
WHERE  gi.courseid = c.id and gi.itemname != &#039;Attendance&#039;&lt;br /&gt;
ORDER BY `Name` ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Activity Module Reports==&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each MODULE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT module,action,count(id) as counter&lt;br /&gt;
FROM prefix_log&lt;br /&gt;
GROUP BY module,action&lt;br /&gt;
ORDER BY module,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Most popular ACTIVITY===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, module&lt;br /&gt;
FROM prefix_log l&lt;br /&gt;
WHERE module != &#039;login&#039; AND module != &#039;course&#039; AND module != &#039;role&#039;&lt;br /&gt;
GROUP BY module&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===System wide use of ACTIVITIES and RESOURCES===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT count( cm.id ) AS counter, m.name&lt;br /&gt;
FROM `prefix_course_modules` AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
GROUP BY cm.module&lt;br /&gt;
ORDER BY counter DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LOG file ACTIONS per MODULE per COURSE (IDs)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select course,module,action,count(action) as summa from prefix_log&lt;br /&gt;
where action &amp;lt;&amp;gt; &#039;new&#039;&lt;br /&gt;
group by course,action,module&lt;br /&gt;
order by course,module,action&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===System Wide usage count of various course Activities===&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
Like: Forum, Wiki, Blog, Assignment, Database,&lt;br /&gt;
#Within specific category&lt;br /&gt;
#Teacher name in course&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher &lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%blog%&#039;) AS Blogs&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM &lt;br /&gt;
prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%forum%&#039;) AS Forums&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%data%&#039;) AS Databses&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%assignment%&#039;) AS Assignments&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 18)&lt;br /&gt;
ORDER BY Wikis DESC,Blogs DESC, Forums DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Detailed WIKI activity (per wiki per course)===&lt;br /&gt;
Including Number of Students in course (for reference)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID  &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id ) AS Students&lt;br /&gt;
,m.name&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%updat%&#039; ) as &#039;UPDAT E&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%annotate%&#039; ) as ANNOTATE&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%comment%&#039; ) as COMMENT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%add%&#039; ) as &#039;A DD&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%edit%&#039; ) as EDIT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action NOT LIKE &#039;%view%&#039; ) as &#039;All (NO View)&#039;&lt;br /&gt;
FROM `prefix_course_modules` as cm &lt;br /&gt;
JOIN prefix_modules as m ON cm.module=m.id &lt;br /&gt;
JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
GROUP BY cm.course,cm.module&lt;br /&gt;
ORDER BY &#039;All (NO View)&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Wiki usage, system wide===&lt;br /&gt;
(you can filter the output by selecting some specific course categories : &amp;quot;WHERE c.category IN ( 8,13,15)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039;) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%add%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ADD&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%edit%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;EDIT&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%annotate%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ANNOTATE&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%comments%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;Comments&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_ouwiki_pages as ouwp&lt;br /&gt;
JOIN prefix_ouwiki as ouw ON ouw.id = ouwp.subwikiid&lt;br /&gt;
WHERE ouw.course = c.id GROUP BY ouw.course  ) as OUWikiPages&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( DISTINCT nwp.pagename ) FROM prefix_wiki_pages AS nwp&lt;br /&gt;
JOIN prefix_wiki AS nw ON nw.id = nwp.dfwiki WHERE nw.course = c.id ) As NWikiPages&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 8,13,15)&lt;br /&gt;
HAVING Wikis &amp;gt; 0&lt;br /&gt;
ORDER BY &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Aggregated Teacher activity by &amp;quot;WEB2&amp;quot; Modules===&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
The NV column shows activity without VIEW log activity&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.userid, u.firstname,u.lastname&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039;) AS Wiki&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Wiki_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039;) AS Forum&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Forum_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039;) AS Blog&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Blog_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039;) AS Assignment&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Assignment_NV&lt;br /&gt;
FROM prefix_role_assignments AS ra &lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid &lt;br /&gt;
WHERE ra.roleid = 3 &lt;br /&gt;
GROUP BY ra.userid&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List all the certificates issued, sort by variables in the custom profile fields===&lt;br /&gt;
Note: The SQL queries look intimidating at first, but isn&#039;t really that difficult to learn. I&#039;ve seen in the forums that users wanted to do &#039;site-wide&#039; groups in 1.9x. This is sort of the idea. It pulls all the certificates issued to all users sorted by the custom profile fields, which in my case is the Units or Depts (i.e. my site wide groups). Why certificates? I&#039;ve explored with both grades and quizzes, the course admins are not really interested in the actual grades but whether the learner received a certificate (i.e. passed the course with x, y, z activities). It also saves me from creating groups and assigning them into the right groups. Even assigning in bulk is not efficient, since I have upward of 25 groups per course and constantly new learners enrolling in courses. The limitation is something to do with the server? as it only pull 5000 rows of data. If anyone figured out how to change this, please let me know. In the meantime, the work around is to pull only a few units/depts at a time to limit the number of rows. This is fine at the moment, since each course admin are only responsible for certain units/depts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME(prefix_certificate_issues.timecreated), &#039;%Y/%m/%d&#039; ) AS Date,&lt;br /&gt;
prefix_certificate_issues.classname AS Topic,&lt;br /&gt;
prefix_certificate.name AS Certificate,&lt;br /&gt;
prefix_certificate_issues.studentname as Name,&lt;br /&gt;
prefix_user_info_data.data AS Units&lt;br /&gt;
&lt;br /&gt;
FROM&lt;br /&gt;
prefix_certificate_issues&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_user_info_data&lt;br /&gt;
on prefix_certificate_issues.userid = prefix_user_info_data.userid&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_certificate&lt;br /&gt;
on prefix_certificate_issues.certificateid = prefix_certificate.id&lt;br /&gt;
&lt;br /&gt;
WHERE prefix_user_info_data.data=&#039;Unit 1&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 2&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 3&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY Units, Name, Topic ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Counter Blog usage in Courses,system wide===&lt;br /&gt;
What teachers in what courses, uses blogs and how many + student count in that course.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT ( @counter := @counter+1) as counter, &lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user AS u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = c.id AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%blog%&#039;) AS Blogs&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c, (SELECT @counter := 0) as s_init&lt;br /&gt;
WHERE c.category IN ( 8,13,15)&lt;br /&gt;
HAVING Blogs &amp;gt; 0&lt;br /&gt;
ORDER BY Blogs DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Assignment Module Reports==&lt;br /&gt;
===All Ungraded Assignments===&lt;br /&gt;
Returns all the submitted assignments that still need grading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id&lt;br /&gt;
and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Ungraded Assignments w/ Link===&lt;br /&gt;
Returns all the submitted assignments that still need grading, along with a link that goes directly to the submission to grade it. The links work if you view the report within Moodle.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
&#039;&amp;lt;a href=&amp;quot;http://education.varonis.com/mod/assignment/submissions.php&#039; + char(63) +&lt;br /&gt;
+ &#039;id=&#039; + cast(cm.id as varchar) + &#039;&amp;amp;userid=&#039; + cast(u.id as varchar) &lt;br /&gt;
+ &#039;&amp;amp;mode=single&amp;amp;filter=0&amp;amp;offset=2&amp;quot;&amp;gt;&#039; + a.name + &#039;&amp;lt;/a&amp;gt;&#039;&lt;br /&gt;
AS &amp;quot;Assignmentlink&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Who is using &amp;quot;Single File Upload&amp;quot; assignment===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
 &lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher &lt;br /&gt;
&lt;br /&gt;
,ass.name as &amp;quot;Assignment Name&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM &lt;br /&gt;
prefix_assignment as ass&lt;br /&gt;
&lt;br /&gt;
JOIN &lt;br /&gt;
prefix_course as c ON c.id = ass.course&lt;br /&gt;
&lt;br /&gt;
WHERE `assignmenttype` LIKE &#039;uploadsingle&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Resource Module Reports==&lt;br /&gt;
===List &amp;quot;Recently uploaded files&amp;quot;===&lt;br /&gt;
see what users are uploading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT FROM_UNIXTIME(time,&#039;%Y %M %D %h:%i:%s&#039;) as time ,ip,userid,url,info  &lt;br /&gt;
FROM `prefix_log` &lt;br /&gt;
WHERE `action` LIKE &#039;upload&#039; &lt;br /&gt;
ORDER BY `prefix_log`.`time`  DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List Courses that loaded a specific file: &amp;quot;X&amp;quot;===&lt;br /&gt;
Did the Teacher (probably) uploaded course&#039;s Syllabus ?&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname  FROM `prefix_log` as l &lt;br /&gt;
JOIN prefix_course as c ON c.id = l.course &lt;br /&gt;
WHERE `action` LIKE &#039;%upload%&#039; AND ( info LIKE &#039;%Syllabus%&#039; OR info LIKE &#039;%Sylabus%&#039; ) GROUP BY c.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All resources that link to some specific external website===&lt;br /&gt;
+ link to course&lt;br /&gt;
+ who&#039;s the teacher&lt;br /&gt;
+ link to external resource&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/resource/view.php?id=&#039;,r.id,&#039;&amp;quot;&amp;gt;&#039;,r.name,&#039;&amp;lt;/a&amp;gt;&#039;) AS Resource&lt;br /&gt;
FROM prefix_resource AS r &lt;br /&gt;
JOIN prefix_course AS c ON r.course = c.id&lt;br /&gt;
WHERE r.reference LIKE &#039;http://info.oranim.ac.il/home%&#039; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Compose Web Page&amp;quot; RESOURCE count===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT course,prefix_course.fullname, COUNT(*) AS Total&lt;br /&gt;
FROM `prefix_resource`&lt;br /&gt;
JOIN `prefix_course` ON prefix_course.id = prefix_resource.course&lt;br /&gt;
WHERE type=&#039;html&#039;&lt;br /&gt;
GROUP BY course&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Resource count in courses===&lt;br /&gt;
+ (First)Teacher name&lt;br /&gt;
+ Where course is inside some specific Categories&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
COUNT(*) AS count&lt;br /&gt;
,r.course &lt;br /&gt;
,c.shortname shortname&lt;br /&gt;
,c.fullname coursename&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user as u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = r.course AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
FROM prefix_resource r &lt;br /&gt;
JOIN prefix_course c ON r.course = c.id&lt;br /&gt;
WHERE c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY r.course&lt;br /&gt;
ORDER BY COUNT(*) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Forum Module Reports==&lt;br /&gt;
===FORUM use Count per COURSE -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FORUM use Count per COURSE by type -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, prefix_forum.type, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course,prefix_forum.type&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Activity In Forums===&lt;br /&gt;
Trying to figure out how much real activity we have in Forums by aggregating:&lt;br /&gt;
Users in Course, Number of Posts, Number of Discussions, Unique student post, Unique student discussions, Number of Teachers , Number of Students, ratio between unique Student posts and the number of students in the Course...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.fullname,f.name,f.type &lt;br /&gt;
,(SELECT count(id) FROM prefix_forum_discussions as fd WHERE f.id = fd.forum) as Discussions&lt;br /&gt;
,(SELECT count(distinct fd.userid) FROM prefix_forum_discussions as fd WHERE fd.forum = f.id) as UniqueUsersDiscussions&lt;br /&gt;
,(SELECT count(fp.id) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as Posts&lt;br /&gt;
,(SELECT count(distinct fp.userid) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as UniqueUsersPosts&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Students&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS StudentsCount&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Teachers&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =3&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS &#039;Teacher&amp;lt;br/&amp;gt;Count&#039;&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid IN (3,5)&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS UserCount&lt;br /&gt;
, (SELECT (UniqueUsersDiscussions / StudentsCount )) as StudentDissUsage&lt;br /&gt;
, (SELECT (UniqueUsersPosts /StudentsCount)) as StudentPostUsage&lt;br /&gt;
FROM prefix_forum as f &lt;br /&gt;
JOIN prefix_course as c ON f.course = c.id&lt;br /&gt;
WHERE `type` != &#039;news&#039;&lt;br /&gt;
ORDER BY StudentPostUsage DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Forum type:NEWS===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT f.id, f.name&lt;br /&gt;
FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
JOIN prefix_forum AS f ON cm.instance = f.id&lt;br /&gt;
WHERE m.name = &#039;forum&#039;&lt;br /&gt;
AND f.type = &#039;news&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All new forum NEWS items (discussions) from all my Courses===&lt;br /&gt;
change &amp;quot;userid = 26&amp;quot; and &amp;quot;id = 26&amp;quot; to a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname,f.name,fd.name,FROM_UNIXTIME(fd.timemodified ,&amp;quot;%d %M %Y &amp;quot;) as Date&lt;br /&gt;
FROM prefix_forum_discussions as fd &lt;br /&gt;
JOIN prefix_forum as f ON f.id = fd.forum &lt;br /&gt;
JOIN prefix_course as c ON c.id = f.course &lt;br /&gt;
JOIN prefix_user_lastaccess as ul ON (c.id = ul.courseid AND ul.userid = 26)&lt;br /&gt;
WHERE fd.timemodified &amp;gt; ul.timeaccess  &lt;br /&gt;
 AND fd.forum IN (SELECT f.id&lt;br /&gt;
 FROM prefix_course_modules AS cm&lt;br /&gt;
 JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
 JOIN prefix_forum AS f ON cm.instance = f.id&lt;br /&gt;
 WHERE m.name = &#039;forum&#039;&lt;br /&gt;
 AND f.type = &#039;news&#039;)&lt;br /&gt;
  AND c.id IN (SELECT c.id&lt;br /&gt;
   FROM prefix_course AS c&lt;br /&gt;
   JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
   JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
   JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
   WHERE u.id = 26) ORDER BY `fd`.`timemodified` DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===News Forum - Discussions COUNT===&lt;br /&gt;
Which is actually... How much instructions students get from their teachers&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname ,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user AS u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = c.id AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/forum/view.php?f=&#039;,fd.forum,&#039;&amp;quot;&amp;gt;&#039;,count(fd.id),&#039;&amp;lt;/a&amp;gt;&#039;) AS DiscussionsSum&lt;br /&gt;
FROM prefix_forum_discussions AS fd&lt;br /&gt;
INNER JOIN prefix_forum AS f ON f.id = fd.forum&lt;br /&gt;
INNER JOIN prefix_course AS c ON c.id = f.course&lt;br /&gt;
WHERE f.type = &#039;news&#039; AND c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY fd.forum&lt;br /&gt;
ORDER BY count(fd.id) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Quiz Module Reports==&lt;br /&gt;
===Generate a list of instructors and their email addresses for those courses that has &amp;quot;essay questions&amp;quot; in their quizzes===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT qu.id AS quiz_id, qu.course AS course_id, qu.questions,&lt;br /&gt;
                co.fullname AS course_fullname, co.shortname AS course_shortname,&lt;br /&gt;
                qu.name AS quiz_name, FROM_UNIXTIME(qu.timeopen) AS quiz_timeopen, FROM_UNIXTIME(qu.timeclose) AS quiz_timeclose,&lt;br /&gt;
                u.firstname, u.lastname, u.email,&lt;br /&gt;
FROM mdl_quiz qu, mdl_course co, mdl_role re, mdl_context ct, mdl_role_assignments ra, mdl_user u&lt;br /&gt;
WHERE FROM_UNIXTIME(timeopen) &amp;gt; &#039;2008-05-14&#039; AND&lt;br /&gt;
                qu.course = co.id AND&lt;br /&gt;
                co.id = ct.instanceid AND&lt;br /&gt;
                ra.roleid = re.id AND&lt;br /&gt;
                re.name = &#039;Teacher&#039; AND&lt;br /&gt;
                ra.contextid = ct.id AND&lt;br /&gt;
                ra.userid = u.id&lt;br /&gt;
 &lt;br /&gt;
SELECT Count(&#039;x&#039;) As NumOfStudents&lt;br /&gt;
                                FROM mdl_role_assignments a&lt;br /&gt;
                                JOIN mdl_user u ON userid = u.id&lt;br /&gt;
                                WHERE roleid = 5 AND contextid = (SELECT id FROM mdl_context WHERE instanceid = 668 AND contextlevel = 50)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:File_upload_size&amp;diff=96283</id>
		<title>Talk:File upload size</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:File_upload_size&amp;diff=96283"/>
		<updated>2012-03-05T17:13:50Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* This is in the FAQ but is not in the &amp;quot;style of&amp;quot; FAQ */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==This is in the FAQ but is not in the &amp;quot;style of&amp;quot; FAQ==&lt;br /&gt;
I&#039;ve been going through the FAQ pages and spotted this one - it&#039;s in the list but doesn&#039;t actually follow the FAQ format. Shall I restyle it,  making some questions out of the long paragraphs (of the bits I understand) so it looks like the others? OR.. is it here by error?? --[[User:Mary Cooch|Mary Cooch]] 21:08, 5 March 2012 (WST)&lt;br /&gt;
===My thoughts...===&lt;br /&gt;
I don&#039;t think this one should really been seen as an FAQ page Mary. I appreciate it starts with the line &amp;quot;Probably the most frequently asked question in the Moodle.org Using Moodle forums is&amp;quot; but it needs an in-depth technical page to be able to cope with all of the different ways there are of making this change.&lt;br /&gt;
&lt;br /&gt;
Maybe take it out of the FAQ group of pages and just ensure there is a link from a relevant FAQ page back to this one... [[User:Jon Witts|Jon Witts]] 01:13, 6 March 2012 (WST)&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Talk:File_upload_size&amp;diff=96282</id>
		<title>Talk:File upload size</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Talk:File_upload_size&amp;diff=96282"/>
		<updated>2012-03-05T17:13:21Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==This is in the FAQ but is not in the &amp;quot;style of&amp;quot; FAQ==&lt;br /&gt;
I&#039;ve been going through the FAQ pages and spotted this one - it&#039;s in the list but doesn&#039;t actually follow the FAQ format. Shall I restyle it,  making some questions out of the long paragraphs (of the bits I understand) so it looks like the others? OR.. is it here by error?? --[[User:Mary Cooch|Mary Cooch]] 21:08, 5 March 2012 (WST)&lt;br /&gt;
&lt;br /&gt;
I don&#039;t think this one should really been seen as an FAQ page Mary. I appreciate it starts with the line &amp;quot;Probably the most frequently asked question in the Moodle.org Using Moodle forums is&amp;quot; but it needs an in-depth technical page to be able to cope with all of the different ways there are of making this change.&lt;br /&gt;
&lt;br /&gt;
Maybe take it out of the FAQ group of pages and just ensure there is a link from a relevant FAQ page back to this one... [[User:Jon Witts|Jon Witts]] 01:13, 6 March 2012 (WST)&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Performance_FAQ&amp;diff=92364</id>
		<title>Performance FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Performance_FAQ&amp;diff=92364"/>
		<updated>2011-10-19T17:21:49Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Should I go for 64 bit or is 32 bit OK? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Performance}}&lt;br /&gt;
==How do you define &amp;quot;concurrent users&amp;quot;?==&lt;br /&gt;
As has been repeatedly stressed in the [http://moodle.org/mod/forum/view.php?f=94 Hardware and performance] forum, the load on the server at a particular time depends on the number of concurrent users, not on the total number of users neither on the number of users logged-in. The term &amp;quot;concurrent users&amp;quot; is used to mean those users for whom the server is actively doing something . It may by processing a webpage written in PHP, querying the database or simply transferring a file. (see also Wikipedia [http://en.wikipedia.org/wiki/Concurrency_(computer_science) Concurrency])&lt;br /&gt;
&lt;br /&gt;
==How do I benchmark a Moodle-site?==&lt;br /&gt;
You can of course benchmark parts of the system separately: the hardware as seen by the operating system (eg. CPU, disk access), web server performance, database server performance, execution on PHP operations, etc. For further details see [[Performance#Obtain_a_baseline_benchmark]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But there is no easy formula to deduce the maximum number of concurrent users from those results. There is a PHP-script, the [http://moodle.org/mod/forum/discuss.php?d=57028 Performance perspectives - a little script], circulating amoung the Moodle-community which calculates a ballpark figure. The current version is attached to [http://moodle.org/mod/forum/discuss.php?d=57028&amp;amp;parent=772267|the posting on 25. March 2011].&lt;br /&gt;
&lt;br /&gt;
Warning: Note that running this script on a production server may have unwanted side-effects. You are strongly adviced to run it on a test-site.&lt;br /&gt;
&lt;br /&gt;
==What are PHP-accelerators?==&lt;br /&gt;
See Wikipedia [http://en.wikipedia.org/wiki/PHP_accelerator PHP accelerator].&lt;br /&gt;
&lt;br /&gt;
Available software are documented under [[Performance#PHP_performance]]. &lt;br /&gt;
&lt;br /&gt;
You find some user suggestions here [http://moodle.org/mod/forum/discuss.php?d=168965 Update on PHP-accelerators].&lt;br /&gt;
&lt;br /&gt;
==How do I cluster Moodle?==&lt;br /&gt;
&lt;br /&gt;
See [[Performance#Scalability]]&lt;br /&gt;
&lt;br /&gt;
[[Moodle_Clusters]]&lt;br /&gt;
&lt;br /&gt;
==How do I replicate Moodle?==&lt;br /&gt;
&lt;br /&gt;
[[Mirroring_Moodle]]&lt;br /&gt;
&lt;br /&gt;
[http://moodle.org/mod/forum/discuss.php?d=173408&amp;amp;parent=760514  How to Replicate MOODLE ??!!]&lt;br /&gt;
&lt;br /&gt;
==My site is very slow, what should I do?==&lt;br /&gt;
&lt;br /&gt;
First find out &amp;quot;how slow&amp;quot;. (The theme-trick here).&lt;br /&gt;
&lt;br /&gt;
The next question is, whether the performance is normal or something malfunctions. There are many things which can malfunction:&lt;br /&gt;
* hardware&lt;br /&gt;
* crashed filesystems, specially network filesystems&lt;br /&gt;
* memory leaks or other crashes in the system&lt;br /&gt;
* bug in Moodle&lt;br /&gt;
* corrupted database&lt;br /&gt;
* networking issues (DNS, firewalls, ...)&lt;br /&gt;
&lt;br /&gt;
Or your performance could be &amp;quot;normal&amp;quot; under the given circumstances:&lt;br /&gt;
* Are you on a dedicated server or a shared (virtual) server?&lt;br /&gt;
* How much RAM, processing power do you have?&lt;br /&gt;
* What is the software stack you use? (Unix or Windows, Apache or IIS, MySQL, PostgreSQL or SQL-Server, ...?)&lt;br /&gt;
* how many concurrent users can you support&lt;br /&gt;
* what modules/activities you use? Check [[Performance#Performance of different Moodle modules]]&lt;br /&gt;
&lt;br /&gt;
[[Performance#Obtain a baseline benchmark]] and compare it with the published figures.&lt;br /&gt;
&lt;br /&gt;
==What are the requirements for N users?==&lt;br /&gt;
&lt;br /&gt;
[http://moodle.org/mod/forum/discuss.php?d=111847 A moodle setup for 10K simultaneous users]&lt;br /&gt;
&lt;br /&gt;
==How many users will my installation support?==&lt;br /&gt;
&lt;br /&gt;
This is another way of asking the same question as above. Please move up.&lt;br /&gt;
&lt;br /&gt;
==What is the best webserver?==&lt;br /&gt;
&lt;br /&gt;
==Should I go for 64 bit or is 32 bit OK?==&lt;br /&gt;
&lt;br /&gt;
==What hosting provider do you recommend?==&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=99405&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
Using Moodle forum discussions&lt;br /&gt;
* [http://moodle.org/mod/forum/search.php?notwords=Re:&amp;amp;id=5&amp;amp;subject=performance All performance related discussions]&lt;br /&gt;
* [http://moodle.org/mod/forum/search.php?notwords=Re:&amp;amp;id=5&amp;amp;forumid=33&amp;amp;&amp;amp;subject=performance Performance related discussions in the General Developer forum]&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=102978 1000 concurrent users]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=103040 Tool to estimate server&#039;s maximum concurrent users]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=144718 Handling Moodle database load - a solution!]&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=ad-hoc_contributed_reports&amp;diff=89534</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=ad-hoc_contributed_reports&amp;diff=89534"/>
		<updated>2011-09-14T12:27:41Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* List all Courses in and below a certain category */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These are community contributed reports for the [[Custom_SQL_queries_report]] site-wide report plugin (module) &amp;lt;br/&amp;gt;&lt;br /&gt;
Everyone is welcome to add their own. until we find a better way to exchange reports between us.&amp;lt;br/&amp;gt;&lt;br /&gt;
Enjoy :-)&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each MODULE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT module,action,count(id) as counter&lt;br /&gt;
FROM prefix_log&lt;br /&gt;
GROUP BY module,action&lt;br /&gt;
ORDER BY module,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT r.name,l.action, count( l.userid ) as counter&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE ra.roleid IN (3,4,5)&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
ORDER BY counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed &amp;quot;VIEW&amp;quot; ACTION for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT l.action, count( l.userid ) as counter , r.name&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN `prefix_role` AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE (ra.roleid IN (3,4,5)) AND (l.action LIKE &#039;%view%&#039; )&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
order by r.name,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Most Active courses===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, l.course courseId, c.fullname coursename&lt;br /&gt;
FROM prefix_log l INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
GROUP BY courseId&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===RESOURCE count for each COURSE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) count, l.course, c.fullname coursename&lt;br /&gt;
FROM prefix_resource l INNER JOIN prefix_course c on l.course = c.id&lt;br /&gt;
GROUP BY course&lt;br /&gt;
ORDER BY count DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Most popular ACTIVITY===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, module&lt;br /&gt;
FROM prefix_log l&lt;br /&gt;
WHERE module != &#039;login&#039; AND module != &#039;course&#039; AND module != &#039;role&#039;&lt;br /&gt;
GROUP BY module&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===System wide use of ACTIVITIES and RESOURCES===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT count( cm.id ) AS counter, m.name&lt;br /&gt;
FROM `prefix_course_modules` AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
GROUP BY cm.module&lt;br /&gt;
ORDER BY counter DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LOG file ACTIONS per MODULE per COURSE (IDs)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select course,module,action,count(action) as summa from prefix_log&lt;br /&gt;
where action &amp;lt;&amp;gt; &#039;new&#039;&lt;br /&gt;
group by course,action,module&lt;br /&gt;
order by course,module,action&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Compose Web Page&amp;quot; RESOURCE count===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT course,prefix_course.fullname, COUNT(*) AS Total&lt;br /&gt;
FROM `prefix_resource`&lt;br /&gt;
JOIN `prefix_course` ON prefix_course.id = prefix_resource.course&lt;br /&gt;
WHERE type=&#039;html&#039;&lt;br /&gt;
GROUP BY course&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Total Activity of Roles:&amp;quot;Teacher&amp;quot; and &amp;quot;None-Editing Teacher&amp;quot; by Dates and by Hours===&lt;br /&gt;
The output columns of this report table can be used as base for a Pivot-Table&lt;br /&gt;
which will show the amount of &#039;&#039;&#039;activity&#039;&#039;&#039; per &#039;&#039;&#039;hour&#039;&#039;&#039; per &#039;&#039;&#039;days&#039;&#039;&#039; in 3D graph view.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%Y/%m/%d&#039; ) AS grptimed ,&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%k&#039; ) AS grptimeh  , count( l.userid ) AS counter &lt;br /&gt;
FROM `prefix_log` AS l&lt;br /&gt;
JOIN prefix_user AS u ON u.id = l.userid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
WHERE ra.roleid IN (3,4)&lt;br /&gt;
GROUP BY grptimed,grptimeh&lt;br /&gt;
ORDER BY grptimed,grptimeh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FORUM use Count per COURSE -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FORUM use Count per COURSE by type -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, prefix_forum.type, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course,prefix_forum.type&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 1.9.x)===&lt;br /&gt;
&lt;br /&gt;
Reports a site global list of all users enroled in each course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user.firstname AS Firstname,&lt;br /&gt;
user.lastname AS Lastname,&lt;br /&gt;
user.email AS Email,&lt;br /&gt;
user.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=asg.roleid)&lt;br /&gt;
FROM&lt;br /&gt;
prefix_user AS user,&lt;br /&gt;
prefix_course AS course,&lt;br /&gt;
prefix_role_assignments AS asg&lt;br /&gt;
INNER JOIN prefix_context AS context ON asg.contextid=context.id   &lt;br /&gt;
WHERE&lt;br /&gt;
context.contextlevel = 50&lt;br /&gt;
AND&lt;br /&gt;
user.id=asg.userid&lt;br /&gt;
AND&lt;br /&gt;
context.instanceid=course.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 2.x)===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user2.firstname AS Firstname,&lt;br /&gt;
user2.lastname AS Lastname,&lt;br /&gt;
user2.email AS Email,&lt;br /&gt;
user2.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT shortname FROM prefix_role WHERE id=en.roleid) as Role&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=en.roleid) as RoleName&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course as course &lt;br /&gt;
JOIN prefix_enrol AS en ON en.courseid = course.id&lt;br /&gt;
JOIN prefix_user_enrolments AS ue ON ue.enrolid = en.id&lt;br /&gt;
JOIN prefix_user AS user2 ON ue.userid = user2.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permissions Overides on Categories===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712834 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT rc.id, ct.instanceid, ccat.name, rc.roleid, rc.capability, rc.permission, &lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( rc.timemodified ) , &#039;%Y-%m-%d&#039; ) AS timemodified, rc.modifierid, ct.instanceid, ct.path, ct.depth&lt;br /&gt;
FROM `prefix_role_capabilities` AS rc&lt;br /&gt;
INNER JOIN `prefix_context` AS ct ON rc.contextid = ct.id&lt;br /&gt;
INNER JOIN `prefix_course_categories` AS ccat ON ccat.id = ct.instanceid&lt;br /&gt;
AND `contextlevel` =40&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;Totally Opened Courses&amp;quot; (visible, opened to guests, with no password)===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712837 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id , category , fullname , shortname , enrollable&lt;br /&gt;
FROM `prefix_course`&lt;br /&gt;
WHERE `guest` =1&lt;br /&gt;
AND `password` = &amp;quot;&amp;quot;&lt;br /&gt;
AND `visible` =1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;loggedin users&amp;quot; from the last 120 days===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id,username,FROM_UNIXTIME(`lastlogin`) as days &lt;br /&gt;
FROM `mdl_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;and user count for that same population:&#039;&#039;&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(id) as Users  FROM `mdl_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List &amp;quot;Recently uploaded files&amp;quot;===&lt;br /&gt;
see what users are uploading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT FROM_UNIXTIME(time,&#039;%Y %M %D %h:%i:%s&#039;) as time ,ip,userid,url,info  &lt;br /&gt;
FROM `prefix_log` &lt;br /&gt;
WHERE `action` LIKE &#039;upload&#039; &lt;br /&gt;
ORDER BY `prefix_log`.`time`  DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List Courses that loaded a specific file: &amp;quot;X&amp;quot;===&lt;br /&gt;
Did the Teacher (probably) uploaded course&#039;s Syllabus ?&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname  FROM `prefix_log` as l &lt;br /&gt;
JOIN prefix_course as c ON c.id = l.course &lt;br /&gt;
WHERE `action` LIKE &#039;%upload%&#039; AND ( info LIKE &#039;%Syllabus%&#039; OR info LIKE &#039;%Sylabus%&#039; ) GROUP BY c.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Students in all courses of some institute===&lt;br /&gt;
What is the status (deleted or not) of all Students (roleid = 5) in all courses of some Institute&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname, u.firstname, u.lastname, u.deleted&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
AND u.institution = &#039;please enter school name here&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full User info (for deleted users)===&lt;br /&gt;
Including extra custom profile fields (from mdl_user_info_data)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT * &lt;br /&gt;
FROM mdl_user as u &lt;br /&gt;
JOIN mdl_user_info_data as uid ON uid.userid = u.id &lt;br /&gt;
JOIN mdl_user_info_field as uif ON (uid.fieldid = uif.id AND uif.shortname = &#039;class&#039;)&lt;br /&gt;
WHERE `deleted` = &amp;quot;1&amp;quot; and `institution`=&amp;quot;your school name&amp;quot; and `department` = &amp;quot;your department&amp;quot; and `data` = &amp;quot;class level and number&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Activity In Forums===&lt;br /&gt;
Trying to figure out how much real activity we have in Forums by aggregating:&lt;br /&gt;
Users in Course, Number of Posts, Number of Discussions, Unique student post, Unique student discussions, Number of Teachers , Number of Students, ratio between unique Student posts and the number of students in the Course...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.fullname,f.name,f.type &lt;br /&gt;
,(SELECT count(id) FROM prefix_forum_discussions as fd WHERE f.id = fd.forum) as Discussions&lt;br /&gt;
,(SELECT count(distinct fd.userid) FROM prefix_forum_discussions as fd WHERE fd.forum = f.id) as UniqueUsersDiscussions&lt;br /&gt;
,(SELECT count(fp.id) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as Posts&lt;br /&gt;
,(SELECT count(distinct fp.userid) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as UniqueUsersPosts&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Students&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS StudentsCount&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Teachers&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =3&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS &#039;Teacher&amp;lt;br/&amp;gt;Count&#039;&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid IN (3,5)&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS UserCount&lt;br /&gt;
, (SELECT (UniqueUsersDiscussions / StudentsCount )) as StudentDissUsage&lt;br /&gt;
, (SELECT (UniqueUsersPosts /StudentsCount)) as StudentPostUsage&lt;br /&gt;
FROM prefix_forum as f &lt;br /&gt;
JOIN prefix_course as c ON f.course = c.id&lt;br /&gt;
WHERE `type` != &#039;news&#039;&lt;br /&gt;
ORDER BY StudentPostUsage DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Blog activity per Course (not including VIEW)===&lt;br /&gt;
Filter activity logging to some specific Course Categories!&lt;br /&gt;
+ link course name to actual course (for quick reference)&lt;br /&gt;
(you can change %blog% to %wiki% to filter down all wiki activity or any other module you wish)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID&lt;br /&gt;
,m.name ,count(cm.id) as counter &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS Students&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE `module` LIKE &#039;%blog%&#039; AND course = c.id AND action NOT LIKE &#039;%view%&#039; ) as BlogActivity&lt;br /&gt;
FROM `prefix_course_modules` as cm JOIN prefix_modules as m ON cm.module=m.id JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%blog%&#039; AND c.category IN ( 8,13,15)&lt;br /&gt;
GROUP BY cm.course,cm.module order by counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed WIKI activity (per wiki per course)===&lt;br /&gt;
Including Number of Students in course (for reference)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID  &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id ) AS Students&lt;br /&gt;
,m.name&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%updat%&#039; ) as &#039;UPDAT E&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%annotate%&#039; ) as ANNOTATE&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%comment%&#039; ) as COMMENT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%add%&#039; ) as &#039;A DD&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%edit%&#039; ) as EDIT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action NOT LIKE &#039;%view%&#039; ) as &#039;All (NO View)&#039;&lt;br /&gt;
FROM `prefix_course_modules` as cm &lt;br /&gt;
JOIN prefix_modules as m ON cm.module=m.id &lt;br /&gt;
JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
GROUP BY cm.course,cm.module&lt;br /&gt;
ORDER BY &#039;All (NO View)&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Courses which uploaded a Syllabus file===&lt;br /&gt;
+ under specific Category&lt;br /&gt;
+ show first Teacher in that course&lt;br /&gt;
+ link Course&#039;s fullname to actual course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) as Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user as u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) as Teacher&lt;br /&gt;
FROM prefix_resource as r &lt;br /&gt;
JOIN prefix_course as c ON r.course = c.id&lt;br /&gt;
WHERE ( r.name LIKE &#039;%סילבוס%&#039; OR r.name LIKE &#039;%סילאבוס%&#039; OR r.name LIKE &#039;%syllabus%&#039; OR r.name LIKE &#039;%תכנית הקורס%&#039; ) &lt;br /&gt;
AND c.category IN (10,18,26,13,28)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All resources that link to some specific external website===&lt;br /&gt;
+ link to course&lt;br /&gt;
+ who&#039;s the teacher&lt;br /&gt;
+ link to external resource&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/resource/view.php?id=&#039;,r.id,&#039;&amp;quot;&amp;gt;&#039;,r.name,&#039;&amp;lt;/a&amp;gt;&#039;) AS Resource&lt;br /&gt;
FROM prefix_resource AS r &lt;br /&gt;
JOIN prefix_course AS c ON r.course = c.id&lt;br /&gt;
WHERE r.reference LIKE &#039;http://info.oranim.ac.il/home%&#039; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===How many LOGINs per user and user&#039;s Activity===&lt;br /&gt;
+ link username to a user activity graph report&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,u.id,&#039;&amp;amp;mode=alllogs&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) as Username&lt;br /&gt;
,count(*) as logins&lt;br /&gt;
,(SELECT count(*) FROM prefix_log WHERE userid = l.userid GROUP BY userid) as Activity &lt;br /&gt;
FROM prefix_log as l JOIN prefix_user as u ON l.userid = u.id &lt;br /&gt;
WHERE `action` LIKE &#039;%login%&#039; group by userid&lt;br /&gt;
ORDER BY Activity DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===User&#039;s courses===&lt;br /&gt;
change &amp;quot;u.id = 2&amp;quot; with a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname, c.id, c.fullname&lt;br /&gt;
FROM mdl_course AS c&lt;br /&gt;
JOIN mdl_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN mdl_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE u.id = 2&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Forum type:NEWS===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT f.id, f.name&lt;br /&gt;
FROM mdl_course_modules AS cm&lt;br /&gt;
JOIN mdl_modules AS m ON cm.module = m.id&lt;br /&gt;
JOIN mdl_forum AS f ON cm.instance = f.id&lt;br /&gt;
WHERE m.name = &#039;forum&#039;&lt;br /&gt;
AND f.type = &#039;news&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All new forum NEWS items (discussions) from all my Courses===&lt;br /&gt;
change &amp;quot;userid = 26&amp;quot; and &amp;quot;id = 26&amp;quot; to a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname,f.name,fd.name,FROM_UNIXTIME(fd.timemodified ,&amp;quot;%d %M %Y &amp;quot;) as Date&lt;br /&gt;
FROM mdl_forum_discussions as fd &lt;br /&gt;
JOIN mdl_forum as f ON f.id = fd.forum &lt;br /&gt;
JOIN mdl_course as c ON c.id = f.course &lt;br /&gt;
JOIN mdl_user_lastaccess as ul ON (c.id = ul.courseid AND ul.userid = 26)&lt;br /&gt;
WHERE fd.timemodified &amp;gt; ul.timeaccess  &lt;br /&gt;
 AND fd.forum IN (SELECT f.id&lt;br /&gt;
 FROM mdl_course_modules AS cm&lt;br /&gt;
 JOIN mdl_modules AS m ON cm.module = m.id&lt;br /&gt;
 JOIN mdl_forum AS f ON cm.instance = f.id&lt;br /&gt;
 WHERE m.name = &#039;forum&#039;&lt;br /&gt;
 AND f.type = &#039;news&#039;)&lt;br /&gt;
  AND c.id IN (SELECT c.id&lt;br /&gt;
   FROM mdl_course AS c&lt;br /&gt;
   JOIN mdl_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
   JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
   JOIN mdl_user AS u ON u.id = ra.userid&lt;br /&gt;
   WHERE u.id = 26) ORDER BY `fd`.`timemodified` DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Resource count in courses==&lt;br /&gt;
+ (First)Teacher name&lt;br /&gt;
+ Where course is inside some specific Categories&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
COUNT(*) AS count&lt;br /&gt;
,r.course &lt;br /&gt;
,c.shortname shortname&lt;br /&gt;
,c.fullname coursename&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user as u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = r.course AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
FROM prefix_resource r &lt;br /&gt;
JOIN prefix_course c ON r.course = c.id&lt;br /&gt;
WHERE c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY r.course&lt;br /&gt;
ORDER BY COUNT(*) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==News Forum - Discussions COUNT==&lt;br /&gt;
Which is actually... How much instructions students get from their teachers&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname ,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user AS u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = c.id AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/forum/view.php?f=&#039;,fd.forum,&#039;&amp;quot;&amp;gt;&#039;,count(fd.id),&#039;&amp;lt;/a&amp;gt;&#039;) AS DiscussionsSum&lt;br /&gt;
FROM prefix_forum_discussions AS fd&lt;br /&gt;
INNER JOIN prefix_forum AS f ON f.id = fd.forum&lt;br /&gt;
INNER JOIN prefix_course AS c ON c.id = f.course&lt;br /&gt;
WHERE f.type = &#039;news&#039; AND c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY fd.forum&lt;br /&gt;
ORDER BY count(fd.id) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Special Roles==&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.roleid,r.name&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,ra.userid,&#039;&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Username&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_context AS ctx ON (ctx.id = ra.contextid AND ctx.contextlevel = 50)&lt;br /&gt;
JOIN prefix_course AS c ON ctx.instanceid = c.id&lt;br /&gt;
WHERE ra.roleid &amp;gt; 6&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Courses without Teachers==&lt;br /&gt;
Actually, shows the number of Teachers in a course.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id) AS Teachers&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
ORDER BY Teachers ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Site-Wide Grade Report with All Items==&lt;br /&gt;
Shows grades for all course items along with course totals for each student.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
c.fullname AS &#039;Course&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id &lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Site-Wide Grade Report with Just Course Totals==&lt;br /&gt;
A second site-wide grade report for all students that just shows course totals.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id AND gi.itemtype = &#039;course&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
==All Ungraded Assignments==&lt;br /&gt;
Returns all the submitted assignments that still need grading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id&lt;br /&gt;
and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==All Ungraded Assignments w/ Link==&lt;br /&gt;
Returns all the submitted assignments that still need grading, along with a link that goes directly to the submission to grade it. The links work if you view the report within Moodle.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
&#039;&amp;lt;a href=&amp;quot;http://education.varonis.com/mod/assignment/submissions.php&#039; + char(63) +&lt;br /&gt;
+ &#039;id=&#039; + cast(cm.id as varchar) + &#039;&amp;amp;userid=&#039; + cast(u.id as varchar) &lt;br /&gt;
+ &#039;&amp;amp;mode=single&amp;amp;filter=0&amp;amp;offset=2&amp;quot;&amp;gt;&#039; + a.name + &#039;&amp;lt;/a&amp;gt;&#039;&lt;br /&gt;
AS &amp;quot;Assignmentlink&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Wiki usage, system wide==&lt;br /&gt;
(you can filter the output by selecting some specific course categories : &amp;quot;WHERE c.category IN ( 8,13,15)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039;) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%add%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ADD&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%edit%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;EDIT&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%annotate%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ANNOTATE&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%comments%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;Comments&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_ouwiki_pages as ouwp&lt;br /&gt;
JOIN prefix_ouwiki as ouw ON ouw.id = ouwp.subwikiid&lt;br /&gt;
WHERE ouw.course = c.id GROUP BY ouw.course  ) as OUWikiPages&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( DISTINCT nwp.pagename ) FROM prefix_wiki_pages AS nwp&lt;br /&gt;
JOIN prefix_wiki AS nw ON nw.id = nwp.dfwiki WHERE nw.course = c.id ) As NWikiPages&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 8,13,15)&lt;br /&gt;
HAVING Wikis &amp;gt; 0&lt;br /&gt;
ORDER BY &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Aggregated Teacher activity by &amp;quot;WEB2&amp;quot; Modules==&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
The NV column shows activity without VIEW log activity&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.userid, u.firstname,u.lastname&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039;) AS Wiki&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Wiki_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039;) AS Forum&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Forum_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039;) AS Blog&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Blog_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039;) AS Assignment&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Assignment_NV&lt;br /&gt;
FROM prefix_role_assignments AS ra &lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid &lt;br /&gt;
WHERE ra.roleid = 3 &lt;br /&gt;
GROUP BY ra.userid&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Courses that are defined as using GROUPs==&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/group/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
 FROM `prefix_course` AS c&lt;br /&gt;
WHERE groupmode &amp;gt; 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==System Wide usage count of various course Activities==&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
Like: Forum, Wiki, Blog, Assignment, Database,&lt;br /&gt;
#Within specific category&lt;br /&gt;
#Teacher name in course&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher &lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%blog%&#039;) AS Blogs&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM &lt;br /&gt;
prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%forum%&#039;) AS Forums&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%data%&#039;) AS Databses&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%assignment%&#039;) AS Assignments&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 18)&lt;br /&gt;
ORDER BY Wikis DESC,Blogs DESC, Forums DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==List all the certificates issued, sort by variables in the custom profile fields==&lt;br /&gt;
Note: The SQL queries look intimidating at first, but isn&#039;t really that difficult to learn. I&#039;ve seen in the forums that users wanted to do &#039;site-wide&#039; groups in 1.9x. This is sort of the idea. It pulls all the certificates issued to all users sorted by the custom profile fields, which in my case is the Units or Depts (i.e. my site wide groups). Why certificates? I&#039;ve explored with both grades and quizzes, the course admins are not really interested in the actual grades but whether the learner received a certificate (i.e. passed the course with x, y, z activities). It also saves me from creating groups and assigning them into the right groups. Even assigning in bulk is not efficient, since I have upward of 25 groups per course and constantly new learners enrolling in courses. The limitation is something to do with the server? as it only pull 5000 rows of data. If anyone figured out how to change this, please let me know. In the meantime, the work around is to pull only a few units/depts at a time to limit the number of rows. This is fine at the moment, since each course admin are only responsible for certain units/depts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME(prefix_certificate_issues.timecreated), &#039;%Y/%m/%d&#039; ) AS Date,&lt;br /&gt;
prefix_certificate_issues.classname AS Topic,&lt;br /&gt;
prefix_certificate.name AS Certificate,&lt;br /&gt;
prefix_certificate_issues.studentname as Name,&lt;br /&gt;
prefix_user_info_data.data AS Units&lt;br /&gt;
&lt;br /&gt;
FROM&lt;br /&gt;
prefix_certificate_issues&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_user_info_data&lt;br /&gt;
on prefix_certificate_issues.userid = prefix_user_info_data.userid&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_certificate&lt;br /&gt;
on prefix_certificate_issues.certificateid = prefix_certificate.id&lt;br /&gt;
&lt;br /&gt;
WHERE prefix_user_info_data.data=&#039;Unit 1&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 2&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 3&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY Units, Name, Topic ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
==List all Courses in and below a certain category==&lt;br /&gt;
Use this SQL code to retrieve all courses that exist in or under a set category.&lt;br /&gt;
&lt;br /&gt;
$s should be the id of the category you want to know about...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course. * , prefix_course_categories. *&lt;br /&gt;
FROM prefix_course, prefix_course_categories&lt;br /&gt;
WHERE prefix_course.category = prefix_course_categories.id&lt;br /&gt;
AND (&lt;br /&gt;
prefix_course_categories.path LIKE &#039;/$s/%&#039;&lt;br /&gt;
OR prefix_course_categories.path LIKE &#039;/$s&#039;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=ad-hoc_contributed_reports&amp;diff=89533</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=ad-hoc_contributed_reports&amp;diff=89533"/>
		<updated>2011-09-14T12:27:15Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These are community contributed reports for the [[Custom_SQL_queries_report]] site-wide report plugin (module) &amp;lt;br/&amp;gt;&lt;br /&gt;
Everyone is welcome to add their own. until we find a better way to exchange reports between us.&amp;lt;br/&amp;gt;&lt;br /&gt;
Enjoy :-)&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each MODULE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT module,action,count(id) as counter&lt;br /&gt;
FROM prefix_log&lt;br /&gt;
GROUP BY module,action&lt;br /&gt;
ORDER BY module,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT r.name,l.action, count( l.userid ) as counter&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE ra.roleid IN (3,4,5)&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
ORDER BY counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed &amp;quot;VIEW&amp;quot; ACTION for each ROLE (TEACHER,NONE-EDITING TEACHER and STUDENT)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT l.action, count( l.userid ) as counter , r.name&lt;br /&gt;
FROM `prefix_log` as l&lt;br /&gt;
JOIN `prefix_role_assignments` AS ra on l.userid = ra.userid&lt;br /&gt;
JOIN `prefix_role` AS r ON ra.roleid = r.id&lt;br /&gt;
WHERE (ra.roleid IN (3,4,5)) AND (l.action LIKE &#039;%view%&#039; )&lt;br /&gt;
GROUP BY roleid,l.action&lt;br /&gt;
order by r.name,counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Most Active courses===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, l.course courseId, c.fullname coursename&lt;br /&gt;
FROM prefix_log l INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
GROUP BY courseId&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===RESOURCE count for each COURSE===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) count, l.course, c.fullname coursename&lt;br /&gt;
FROM prefix_resource l INNER JOIN prefix_course c on l.course = c.id&lt;br /&gt;
GROUP BY course&lt;br /&gt;
ORDER BY count DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Most popular ACTIVITY===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, module&lt;br /&gt;
FROM prefix_log l&lt;br /&gt;
WHERE module != &#039;login&#039; AND module != &#039;course&#039; AND module != &#039;role&#039;&lt;br /&gt;
GROUP BY module&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===System wide use of ACTIVITIES and RESOURCES===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT count( cm.id ) AS counter, m.name&lt;br /&gt;
FROM `prefix_course_modules` AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
GROUP BY cm.module&lt;br /&gt;
ORDER BY counter DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LOG file ACTIONS per MODULE per COURSE (IDs)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select course,module,action,count(action) as summa from prefix_log&lt;br /&gt;
where action &amp;lt;&amp;gt; &#039;new&#039;&lt;br /&gt;
group by course,action,module&lt;br /&gt;
order by course,module,action&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&amp;quot;Compose Web Page&amp;quot; RESOURCE count===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT course,prefix_course.fullname, COUNT(*) AS Total&lt;br /&gt;
FROM `prefix_resource`&lt;br /&gt;
JOIN `prefix_course` ON prefix_course.id = prefix_resource.course&lt;br /&gt;
WHERE type=&#039;html&#039;&lt;br /&gt;
GROUP BY course&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Total Activity of Roles:&amp;quot;Teacher&amp;quot; and &amp;quot;None-Editing Teacher&amp;quot; by Dates and by Hours===&lt;br /&gt;
The output columns of this report table can be used as base for a Pivot-Table&lt;br /&gt;
which will show the amount of &#039;&#039;&#039;activity&#039;&#039;&#039; per &#039;&#039;&#039;hour&#039;&#039;&#039; per &#039;&#039;&#039;days&#039;&#039;&#039; in 3D graph view.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%Y/%m/%d&#039; ) AS grptimed ,&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( l.time ) , &#039;%k&#039; ) AS grptimeh  , count( l.userid ) AS counter &lt;br /&gt;
FROM `prefix_log` AS l&lt;br /&gt;
JOIN prefix_user AS u ON u.id = l.userid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON l.userid = ra.userid&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
WHERE ra.roleid IN (3,4)&lt;br /&gt;
GROUP BY grptimed,grptimeh&lt;br /&gt;
ORDER BY grptimed,grptimeh&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FORUM use Count per COURSE -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===FORUM use Count per COURSE by type -- not including NEWS Forum!===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course.fullname, prefix_forum.course, prefix_forum.type, count(*) as total FROM prefix_forum&lt;br /&gt;
INNER JOIN prefix_course&lt;br /&gt;
ON prefix_course.id = prefix_forum.course&lt;br /&gt;
WHERE NOT(prefix_forum.type = &#039;news&#039;)&lt;br /&gt;
GROUP BY prefix_forum.course,prefix_forum.type&lt;br /&gt;
ORDER BY total desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 1.9.x)===&lt;br /&gt;
&lt;br /&gt;
Reports a site global list of all users enroled in each course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user.firstname AS Firstname,&lt;br /&gt;
user.lastname AS Lastname,&lt;br /&gt;
user.email AS Email,&lt;br /&gt;
user.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=asg.roleid)&lt;br /&gt;
FROM&lt;br /&gt;
prefix_user AS user,&lt;br /&gt;
prefix_course AS course,&lt;br /&gt;
prefix_role_assignments AS asg&lt;br /&gt;
INNER JOIN prefix_context AS context ON asg.contextid=context.id   &lt;br /&gt;
WHERE&lt;br /&gt;
context.contextlevel = 50&lt;br /&gt;
AND&lt;br /&gt;
user.id=asg.userid&lt;br /&gt;
AND&lt;br /&gt;
context.instanceid=course.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===LIST of all site USERS by COURSE enrollment (Moodle 2.x)===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user2.firstname AS Firstname,&lt;br /&gt;
user2.lastname AS Lastname,&lt;br /&gt;
user2.email AS Email,&lt;br /&gt;
user2.city AS City,&lt;br /&gt;
course.fullname AS Course&lt;br /&gt;
,(SELECT shortname FROM prefix_role WHERE id=en.roleid) as Role&lt;br /&gt;
,(SELECT name FROM prefix_role WHERE id=en.roleid) as RoleName&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course as course &lt;br /&gt;
JOIN prefix_enrol AS en ON en.courseid = course.id&lt;br /&gt;
JOIN prefix_user_enrolments AS ue ON ue.enrolid = en.id&lt;br /&gt;
JOIN prefix_user AS user2 ON ue.userid = user2.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Permissions Overides on Categories===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712834 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT rc.id, ct.instanceid, ccat.name, rc.roleid, rc.capability, rc.permission, &lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( rc.timemodified ) , &#039;%Y-%m-%d&#039; ) AS timemodified, rc.modifierid, ct.instanceid, ct.path, ct.depth&lt;br /&gt;
FROM `prefix_role_capabilities` AS rc&lt;br /&gt;
INNER JOIN `prefix_context` AS ct ON rc.contextid = ct.id&lt;br /&gt;
INNER JOIN `prefix_course_categories` AS ccat ON ccat.id = ct.instanceid&lt;br /&gt;
AND `contextlevel` =40&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;Totally Opened Courses&amp;quot; (visible, opened to guests, with no password)===&lt;br /&gt;
(By: [http://moodle.org/mod/forum/discuss.php?d=153059#p712837 Séverin Terrier] )&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id , category , fullname , shortname , enrollable&lt;br /&gt;
FROM `prefix_course`&lt;br /&gt;
WHERE `guest` =1&lt;br /&gt;
AND `password` = &amp;quot;&amp;quot;&lt;br /&gt;
AND `visible` =1&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists &amp;quot;loggedin users&amp;quot; from the last 120 days===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id,username,FROM_UNIXTIME(`lastlogin`) as days &lt;br /&gt;
FROM `mdl_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;and user count for that same population:&#039;&#039;&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(id) as Users  FROM `mdl_user` &lt;br /&gt;
WHERE DATEDIFF( NOW(),FROM_UNIXTIME(`lastlogin`) ) &amp;lt; 120&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List &amp;quot;Recently uploaded files&amp;quot;===&lt;br /&gt;
see what users are uploading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT FROM_UNIXTIME(time,&#039;%Y %M %D %h:%i:%s&#039;) as time ,ip,userid,url,info  &lt;br /&gt;
FROM `prefix_log` &lt;br /&gt;
WHERE `action` LIKE &#039;upload&#039; &lt;br /&gt;
ORDER BY `prefix_log`.`time`  DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List Courses that loaded a specific file: &amp;quot;X&amp;quot;===&lt;br /&gt;
Did the Teacher (probably) uploaded course&#039;s Syllabus ?&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname  FROM `prefix_log` as l &lt;br /&gt;
JOIN prefix_course as c ON c.id = l.course &lt;br /&gt;
WHERE `action` LIKE &#039;%upload%&#039; AND ( info LIKE &#039;%Syllabus%&#039; OR info LIKE &#039;%Sylabus%&#039; ) GROUP BY c.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Students in all courses of some institute===&lt;br /&gt;
What is the status (deleted or not) of all Students (roleid = 5) in all courses of some Institute&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id, c.fullname, u.firstname, u.lastname, u.deleted&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
AND u.institution = &#039;please enter school name here&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full User info (for deleted users)===&lt;br /&gt;
Including extra custom profile fields (from mdl_user_info_data)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT * &lt;br /&gt;
FROM mdl_user as u &lt;br /&gt;
JOIN mdl_user_info_data as uid ON uid.userid = u.id &lt;br /&gt;
JOIN mdl_user_info_field as uif ON (uid.fieldid = uif.id AND uif.shortname = &#039;class&#039;)&lt;br /&gt;
WHERE `deleted` = &amp;quot;1&amp;quot; and `institution`=&amp;quot;your school name&amp;quot; and `department` = &amp;quot;your department&amp;quot; and `data` = &amp;quot;class level and number&amp;quot;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Activity In Forums===&lt;br /&gt;
Trying to figure out how much real activity we have in Forums by aggregating:&lt;br /&gt;
Users in Course, Number of Posts, Number of Discussions, Unique student post, Unique student discussions, Number of Teachers , Number of Students, ratio between unique Student posts and the number of students in the Course...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.fullname,f.name,f.type &lt;br /&gt;
,(SELECT count(id) FROM prefix_forum_discussions as fd WHERE f.id = fd.forum) as Discussions&lt;br /&gt;
,(SELECT count(distinct fd.userid) FROM prefix_forum_discussions as fd WHERE fd.forum = f.id) as UniqueUsersDiscussions&lt;br /&gt;
,(SELECT count(fp.id) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as Posts&lt;br /&gt;
,(SELECT count(distinct fp.userid) FROM prefix_forum_discussions fd JOIN prefix_forum_posts as fp ON fd.id = fp.discussion WHERE f.id = fd.forum) as UniqueUsersPosts&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Students&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS StudentsCount&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Teachers&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid =3&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS &#039;Teacher&amp;lt;br/&amp;gt;Count&#039;&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid IN (3,5)&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS UserCount&lt;br /&gt;
, (SELECT (UniqueUsersDiscussions / StudentsCount )) as StudentDissUsage&lt;br /&gt;
, (SELECT (UniqueUsersPosts /StudentsCount)) as StudentPostUsage&lt;br /&gt;
FROM prefix_forum as f &lt;br /&gt;
JOIN prefix_course as c ON f.course = c.id&lt;br /&gt;
WHERE `type` != &#039;news&#039;&lt;br /&gt;
ORDER BY StudentPostUsage DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Blog activity per Course (not including VIEW)===&lt;br /&gt;
Filter activity logging to some specific Course Categories!&lt;br /&gt;
+ link course name to actual course (for quick reference)&lt;br /&gt;
(you can change %blog% to %wiki% to filter down all wiki activity or any other module you wish)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID&lt;br /&gt;
,m.name ,count(cm.id) as counter &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
) AS Students&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE `module` LIKE &#039;%blog%&#039; AND course = c.id AND action NOT LIKE &#039;%view%&#039; ) as BlogActivity&lt;br /&gt;
FROM `prefix_course_modules` as cm JOIN prefix_modules as m ON cm.module=m.id JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%blog%&#039; AND c.category IN ( 8,13,15)&lt;br /&gt;
GROUP BY cm.course,cm.module order by counter desc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed WIKI activity (per wiki per course)===&lt;br /&gt;
Including Number of Students in course (for reference)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,cm.course,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as CourseID  &lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id ) AS Students&lt;br /&gt;
,m.name&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%updat%&#039; ) as &#039;UPDAT E&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%annotate%&#039; ) as ANNOTATE&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%comment%&#039; ) as COMMENT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%add%&#039; ) as &#039;A DD&#039;&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action LIKE &#039;%edit%&#039; ) as EDIT&lt;br /&gt;
, ( SELECT count(id) FROM prefix_log WHERE cmid = cm.id AND action NOT LIKE &#039;%view%&#039; ) as &#039;All (NO View)&#039;&lt;br /&gt;
FROM `prefix_course_modules` as cm &lt;br /&gt;
JOIN prefix_modules as m ON cm.module=m.id &lt;br /&gt;
JOIN prefix_course as c ON cm.course = c.id &lt;br /&gt;
WHERE m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
GROUP BY cm.course,cm.module&lt;br /&gt;
ORDER BY &#039;All (NO View)&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Courses which uploaded a Syllabus file===&lt;br /&gt;
+ under specific Category&lt;br /&gt;
+ show first Teacher in that course&lt;br /&gt;
+ link Course&#039;s fullname to actual course&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) as Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user as u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) as Teacher&lt;br /&gt;
FROM prefix_resource as r &lt;br /&gt;
JOIN prefix_course as c ON r.course = c.id&lt;br /&gt;
WHERE ( r.name LIKE &#039;%סילבוס%&#039; OR r.name LIKE &#039;%סילאבוס%&#039; OR r.name LIKE &#039;%syllabus%&#039; OR r.name LIKE &#039;%תכנית הקורס%&#039; ) &lt;br /&gt;
AND c.category IN (10,18,26,13,28)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All resources that link to some specific external website===&lt;br /&gt;
+ link to course&lt;br /&gt;
+ who&#039;s the teacher&lt;br /&gt;
+ link to external resource&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,c.shortname,r.name&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/resource/view.php?id=&#039;,r.id,&#039;&amp;quot;&amp;gt;&#039;,r.name,&#039;&amp;lt;/a&amp;gt;&#039;) AS Resource&lt;br /&gt;
FROM prefix_resource AS r &lt;br /&gt;
JOIN prefix_course AS c ON r.course = c.id&lt;br /&gt;
WHERE r.reference LIKE &#039;http://info.oranim.ac.il/home%&#039; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===How many LOGINs per user and user&#039;s Activity===&lt;br /&gt;
+ link username to a user activity graph report&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,u.id,&#039;&amp;amp;mode=alllogs&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) as Username&lt;br /&gt;
,count(*) as logins&lt;br /&gt;
,(SELECT count(*) FROM prefix_log WHERE userid = l.userid GROUP BY userid) as Activity &lt;br /&gt;
FROM prefix_log as l JOIN prefix_user as u ON l.userid = u.id &lt;br /&gt;
WHERE `action` LIKE &#039;%login%&#039; group by userid&lt;br /&gt;
ORDER BY Activity DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===User&#039;s courses===&lt;br /&gt;
change &amp;quot;u.id = 2&amp;quot; with a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname, c.id, c.fullname&lt;br /&gt;
FROM mdl_course AS c&lt;br /&gt;
JOIN mdl_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN mdl_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE u.id = 2&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All Forum type:NEWS===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT f.id, f.name&lt;br /&gt;
FROM mdl_course_modules AS cm&lt;br /&gt;
JOIN mdl_modules AS m ON cm.module = m.id&lt;br /&gt;
JOIN mdl_forum AS f ON cm.instance = f.id&lt;br /&gt;
WHERE m.name = &#039;forum&#039;&lt;br /&gt;
AND f.type = &#039;news&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===All new forum NEWS items (discussions) from all my Courses===&lt;br /&gt;
change &amp;quot;userid = 26&amp;quot; and &amp;quot;id = 26&amp;quot; to a new user id&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname,f.name,fd.name,FROM_UNIXTIME(fd.timemodified ,&amp;quot;%d %M %Y &amp;quot;) as Date&lt;br /&gt;
FROM mdl_forum_discussions as fd &lt;br /&gt;
JOIN mdl_forum as f ON f.id = fd.forum &lt;br /&gt;
JOIN mdl_course as c ON c.id = f.course &lt;br /&gt;
JOIN mdl_user_lastaccess as ul ON (c.id = ul.courseid AND ul.userid = 26)&lt;br /&gt;
WHERE fd.timemodified &amp;gt; ul.timeaccess  &lt;br /&gt;
 AND fd.forum IN (SELECT f.id&lt;br /&gt;
 FROM mdl_course_modules AS cm&lt;br /&gt;
 JOIN mdl_modules AS m ON cm.module = m.id&lt;br /&gt;
 JOIN mdl_forum AS f ON cm.instance = f.id&lt;br /&gt;
 WHERE m.name = &#039;forum&#039;&lt;br /&gt;
 AND f.type = &#039;news&#039;)&lt;br /&gt;
  AND c.id IN (SELECT c.id&lt;br /&gt;
   FROM mdl_course AS c&lt;br /&gt;
   JOIN mdl_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
   JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
   JOIN mdl_user AS u ON u.id = ra.userid&lt;br /&gt;
   WHERE u.id = 26) ORDER BY `fd`.`timemodified` DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Resource count in courses==&lt;br /&gt;
+ (First)Teacher name&lt;br /&gt;
+ Where course is inside some specific Categories&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
COUNT(*) AS count&lt;br /&gt;
,r.course &lt;br /&gt;
,c.shortname shortname&lt;br /&gt;
,c.fullname coursename&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user as u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = r.course AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
FROM prefix_resource r &lt;br /&gt;
JOIN prefix_course c ON r.course = c.id&lt;br /&gt;
WHERE c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY r.course&lt;br /&gt;
ORDER BY COUNT(*) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==News Forum - Discussions COUNT==&lt;br /&gt;
Which is actually... How much instructions students get from their teachers&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname ,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
,( SELECT DISTINCT CONCAT(u.firstname,&#039; &#039;,u.lastname)&lt;br /&gt;
  FROM prefix_role_assignments AS ra&lt;br /&gt;
  JOIN prefix_user AS u ON ra.userid = u.id&lt;br /&gt;
  JOIN prefix_context AS ctx ON ctx.id = ra.contextid&lt;br /&gt;
  WHERE ra.roleid = 3 AND ctx.instanceid = c.id AND ctx.contextlevel = 50 LIMIT 1) AS Teacher&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/forum/view.php?f=&#039;,fd.forum,&#039;&amp;quot;&amp;gt;&#039;,count(fd.id),&#039;&amp;lt;/a&amp;gt;&#039;) AS DiscussionsSum&lt;br /&gt;
FROM prefix_forum_discussions AS fd&lt;br /&gt;
INNER JOIN prefix_forum AS f ON f.id = fd.forum&lt;br /&gt;
INNER JOIN prefix_course AS c ON c.id = f.course&lt;br /&gt;
WHERE f.type = &#039;news&#039; AND c.category IN (10,13,28,18,26)&lt;br /&gt;
GROUP BY fd.forum&lt;br /&gt;
ORDER BY count(fd.id) DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Special Roles==&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.roleid,r.name&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/user.php?id=1&amp;amp;user=&#039;,ra.userid,&#039;&amp;quot;&amp;gt;&#039;,u.firstname ,&#039; &#039;,u.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Username&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_role AS r ON r.id = ra.roleid&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_context AS ctx ON (ctx.id = ra.contextid AND ctx.contextlevel = 50)&lt;br /&gt;
JOIN prefix_course AS c ON ctx.instanceid = c.id&lt;br /&gt;
WHERE ra.roleid &amp;gt; 6&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Courses without Teachers==&lt;br /&gt;
Actually, shows the number of Teachers in a course.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id) AS Teachers&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
ORDER BY Teachers ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Site-Wide Grade Report with All Items==&lt;br /&gt;
Shows grades for all course items along with course totals for each student.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
c.fullname AS &#039;Course&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id &lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Site-Wide Grade Report with Just Course Totals==&lt;br /&gt;
A second site-wide grade report for all students that just shows course totals.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname AS &#039;First&#039; , u.lastname AS &#039;Last&#039;, u.firstname + &#039; &#039; + u.lastname AS &#039;Display Name&#039;, &lt;br /&gt;
cc.name AS &#039;Category&#039;,&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN c.fullname + &#039; Course Total&#039;&lt;br /&gt;
  ELSE gi.itemname&lt;br /&gt;
END AS &#039;Item Name&#039;,&lt;br /&gt;
&lt;br /&gt;
ROUND(gg.finalgrade,2) AS Grade,&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_grade_grades AS gg ON gg.userid = u.id&lt;br /&gt;
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid&lt;br /&gt;
JOIN prefix_course_categories as cc ON cc.id = c.category&lt;br /&gt;
&lt;br /&gt;
WHERE  gi.courseid = c.id AND gi.itemtype = &#039;course&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For MySQL users, you&#039;ll need to use the MySQL DATE_ADD function instead of DATEADD:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECONDS) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
==All Ungraded Assignments==&lt;br /&gt;
Returns all the submitted assignments that still need grading&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id&lt;br /&gt;
and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==All Ungraded Assignments w/ Link==&lt;br /&gt;
Returns all the submitted assignments that still need grading, along with a link that goes directly to the submission to grade it. The links work if you view the report within Moodle.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
select &lt;br /&gt;
u.firstname AS &amp;quot;First&amp;quot;,&lt;br /&gt;
u.lastname AS &amp;quot;Last&amp;quot;,&lt;br /&gt;
c.fullname AS &amp;quot;Course&amp;quot;,&lt;br /&gt;
a.name AS &amp;quot;Assignment&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
&#039;&amp;lt;a href=&amp;quot;http://education.varonis.com/mod/assignment/submissions.php&#039; + char(63) +&lt;br /&gt;
+ &#039;id=&#039; + cast(cm.id as varchar) + &#039;&amp;amp;userid=&#039; + cast(u.id as varchar) &lt;br /&gt;
+ &#039;&amp;amp;mode=single&amp;amp;filter=0&amp;amp;offset=2&amp;quot;&amp;gt;&#039; + a.name + &#039;&amp;lt;/a&amp;gt;&#039;&lt;br /&gt;
AS &amp;quot;Assignmentlink&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from prefix_assignment_submissions as asb&lt;br /&gt;
join prefix_assignment as a ON a.id = asb.assignment&lt;br /&gt;
join prefix_user as u ON u.id = asb.userid&lt;br /&gt;
join prefix_course as c ON c.id = a.course&lt;br /&gt;
join prefix_course_modules as cm ON c.id = cm.course&lt;br /&gt;
&lt;br /&gt;
where asb.grade &amp;lt; 0 and cm.instance = a.id and cm.module = 1&lt;br /&gt;
&lt;br /&gt;
order by c.fullname, a.name, u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Wiki usage, system wide==&lt;br /&gt;
(you can filter the output by selecting some specific course categories : &amp;quot;WHERE c.category IN ( 8,13,15)&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039;) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%add%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ADD&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%edit%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;EDIT&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%annotate%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;ANNOTATE&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.course = c.id AND l.module LIKE &#039;%wiki%&#039; and l.action LIKE &#039;%comments%&#039; ) AS &#039;WikiActivity&amp;lt;br/&amp;gt;Comments&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
,(SELECT count(*) FROM prefix_ouwiki_pages as ouwp&lt;br /&gt;
JOIN prefix_ouwiki as ouw ON ouw.id = ouwp.subwikiid&lt;br /&gt;
WHERE ouw.course = c.id GROUP BY ouw.course  ) as OUWikiPages&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( DISTINCT nwp.pagename ) FROM prefix_wiki_pages AS nwp&lt;br /&gt;
JOIN prefix_wiki AS nw ON nw.id = nwp.dfwiki WHERE nw.course = c.id ) As NWikiPages&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 8,13,15)&lt;br /&gt;
HAVING Wikis &amp;gt; 0&lt;br /&gt;
ORDER BY &#039;WikiActivity&amp;lt;br/&amp;gt;ALL&#039; DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Aggregated Teacher activity by &amp;quot;WEB2&amp;quot; Modules==&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
The NV column shows activity without VIEW log activity&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT ra.userid, u.firstname,u.lastname&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039;) AS Wiki&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%wiki%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Wiki_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039;) AS Forum&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%forum%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Forum_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039;) AS Blog&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%blog%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Blog_NV&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039;) AS Assignment&lt;br /&gt;
,(SELECT count(*) FROM prefix_log as l WHERE l.userid = u.id AND l.module LIKE &#039;%assignment%&#039; AND l.action NOT LIKE &#039;%view%&#039;) AS Assignment_NV&lt;br /&gt;
FROM prefix_role_assignments AS ra &lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid &lt;br /&gt;
WHERE ra.roleid = 3 &lt;br /&gt;
GROUP BY ra.userid&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Courses that are defined as using GROUPs==&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/group/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS Course&lt;br /&gt;
 FROM `prefix_course` AS c&lt;br /&gt;
WHERE groupmode &amp;gt; 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==System Wide usage count of various course Activities==&lt;br /&gt;
(Tested and works fine in Moodle 2.x)&lt;br /&gt;
Like: Forum, Wiki, Blog, Assignment, Database,&lt;br /&gt;
#Within specific category&lt;br /&gt;
#Teacher name in course&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/view.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) as Course&lt;br /&gt;
&lt;br /&gt;
,(SELECT CONCAT(u.firstname,&#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&lt;br /&gt;
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher &lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;) AS Wikis&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%blog%&#039;) AS Blogs&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM &lt;br /&gt;
prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%forum%&#039;) AS Forums&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%data%&#039;) AS Databses&lt;br /&gt;
&lt;br /&gt;
,(SELECT count( m.name ) AS count FROM prefix_course_modules AS cm&lt;br /&gt;
JOIN prefix_modules AS m ON cm.module = m.id&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%assignment%&#039;) AS Assignments&lt;br /&gt;
&lt;br /&gt;
,(SELECT Count( ra.userid ) AS Users FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
WHERE ra.roleid = 5 AND ctx.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
WHERE c.category IN ( 18)&lt;br /&gt;
ORDER BY Wikis DESC,Blogs DESC, Forums DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==List all the certificates issued, sort by variables in the custom profile fields==&lt;br /&gt;
Note: The SQL queries look intimidating at first, but isn&#039;t really that difficult to learn. I&#039;ve seen in the forums that users wanted to do &#039;site-wide&#039; groups in 1.9x. This is sort of the idea. It pulls all the certificates issued to all users sorted by the custom profile fields, which in my case is the Units or Depts (i.e. my site wide groups). Why certificates? I&#039;ve explored with both grades and quizzes, the course admins are not really interested in the actual grades but whether the learner received a certificate (i.e. passed the course with x, y, z activities). It also saves me from creating groups and assigning them into the right groups. Even assigning in bulk is not efficient, since I have upward of 25 groups per course and constantly new learners enrolling in courses. The limitation is something to do with the server? as it only pull 5000 rows of data. If anyone figured out how to change this, please let me know. In the meantime, the work around is to pull only a few units/depts at a time to limit the number of rows. This is fine at the moment, since each course admin are only responsible for certain units/depts.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME(prefix_certificate_issues.timecreated), &#039;%Y/%m/%d&#039; ) AS Date,&lt;br /&gt;
prefix_certificate_issues.classname AS Topic,&lt;br /&gt;
prefix_certificate.name AS Certificate,&lt;br /&gt;
prefix_certificate_issues.studentname as Name,&lt;br /&gt;
prefix_user_info_data.data AS Units&lt;br /&gt;
&lt;br /&gt;
FROM&lt;br /&gt;
prefix_certificate_issues&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_user_info_data&lt;br /&gt;
on prefix_certificate_issues.userid = prefix_user_info_data.userid&lt;br /&gt;
&lt;br /&gt;
INNER JOIN prefix_certificate&lt;br /&gt;
on prefix_certificate_issues.certificateid = prefix_certificate.id&lt;br /&gt;
&lt;br /&gt;
WHERE prefix_user_info_data.data=&#039;Unit 1&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 2&#039;&lt;br /&gt;
OR prefix_user_info_data.data=&#039;Unit 3&#039;&lt;br /&gt;
&lt;br /&gt;
ORDER BY Units, Name, Topic ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
==List all Courses in and below a certain category==&lt;br /&gt;
Use this SQL code to retrieve all courses that exist in or under a set category.&lt;br /&gt;
&lt;br /&gt;
$s should be the id of the category you want to know about...&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT prefix_course. * , prefix_course_categories. *&lt;br /&gt;
FROM prefix_course, prefix_course_categories&lt;br /&gt;
WHERE prefix_course.category = prefix_course_categories.id&lt;br /&gt;
AND (&lt;br /&gt;
prefix_course_categories.path LIKE &#039;/$v/%&#039;&lt;br /&gt;
OR prefix_course_categories.path LIKE &#039;/$s&#039;&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Private_files&amp;diff=85211</id>
		<title>Private files</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Private_files&amp;diff=85211"/>
		<updated>2011-06-14T18:18:03Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Working with files and folders}}&lt;br /&gt;
{{Repositories}}&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Please refer to [[Page_notes#Private files|these notes]] before editing this page.&#039;&#039;&#039;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Moodle 2.0 onwards, each user has a private files area for uploading and managing a set of files.&lt;br /&gt;
&lt;br /&gt;
The private files area is accessible via &#039;&#039;Navigation &amp;gt; My home &amp;gt; My profile &amp;gt; My private files&#039;&#039; or the [[My private files block]]. It is available as a source within the filepicker when selecting files to use in a course.&lt;br /&gt;
&lt;br /&gt;
==Private files management==&lt;br /&gt;
&lt;br /&gt;
To add a file to your private files area&lt;br /&gt;
# On the Navigation menu, click My profile &amp;gt; My private files&lt;br /&gt;
# Click &amp;quot;Manage my private files&amp;quot; button&lt;br /&gt;
# The standard file picker Add-Create folder popup will appear.&lt;br /&gt;
# If desired, create or move to a folder,&lt;br /&gt;
#Click on the Add button &lt;br /&gt;
#Browse for and select a file&lt;br /&gt;
# Click the &#039;Save changes&#039; button&lt;br /&gt;
&lt;br /&gt;
[[Image:Files_standard_added_files_1.png|center|frame|Standard file add- create directory, showing 2 files]]&lt;br /&gt;
*Uploaded files may be downloaded, renamed, moved or deleted by clicking the icon next to the file. After making any changes, &#039;&#039;&#039;remember to click the &#039;Save changes&#039; button&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;br /&gt;
[[Category:Moodle 2.0]][[Category:Files]]&lt;br /&gt;
&lt;br /&gt;
[[eu:Fitxategi_pribatuak]]&lt;br /&gt;
[[fr:Fichiers personnels]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Legacy_course_files&amp;diff=85210</id>
		<title>Legacy course files</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Legacy_course_files&amp;diff=85210"/>
		<updated>2011-06-14T18:17:23Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Working with files and folders}}&lt;br /&gt;
{{Repositories}}&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Please refer to [[Page_notes#Legacy course files|these notes]] before editing this page.&#039;&#039;&#039;&amp;lt;/p&amp;gt;&lt;br /&gt;
In Moodle 2.0 onwards, files are stored in separate areas, rather than together in the course files area. See [[Course files]] for a detailed explanation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: It is recommended that teachers make use of the new [[Repositories|repositories]] in Moodle 2.0 for storing course files, rather than saving them in a course files area&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In Moodle 2.0 the course files area has been renamed &#039;Legacy course files&#039;. By default, this area is not available in new courses.&lt;br /&gt;
&lt;br /&gt;
==Enabling legacy course files areas==&lt;br /&gt;
&lt;br /&gt;
To enable a legacy course files area in a new course&lt;br /&gt;
&lt;br /&gt;
# Enable the legacy course files repository plugin in &#039;&#039;Administration &amp;gt; Plugins &amp;gt; Repositories &amp;gt; [[Manage repositories]]&#039;&#039;.&lt;br /&gt;
# Check the legacyfilesinnewcourses box in the Manage repositories common settings then click the &#039;Save changes&#039; button.&lt;br /&gt;
# Set &#039;Legacy course files&#039; to Yes in the course settings.&lt;br /&gt;
&lt;br /&gt;
A legacy course files link will then appear in the course administration block.&lt;br /&gt;
&lt;br /&gt;
[[Category:Repositories]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Antivirus_plugins&amp;diff=84915</id>
		<title>Antivirus plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Antivirus_plugins&amp;diff=84915"/>
		<updated>2011-06-10T17:40:11Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Security}}&lt;br /&gt;
&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Please refer to [[Page_notes#Anti-Virus |these notes]] before editing this page.&#039;&#039;&#039;&amp;lt;/p&amp;gt;&lt;br /&gt;
Location: &#039;&#039;Administration &amp;gt; Security &amp;gt; Anti-Virus&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To make use of Moodle&#039;s anti-virus feature, the open source virus scanner ClamAV should be installed on your server. See http://www.clamav.net for more information.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=147820 ClamAV upgrade may be required] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[Category:Administrator]]&lt;br /&gt;
[[Category:Security]]&lt;br /&gt;
&lt;br /&gt;
[[eu:Antibirusa]]&lt;br /&gt;
[[hu:Vírusölő]]&lt;br /&gt;
[[de:Anti-Virus]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Database_activity_FAQ&amp;diff=74109</id>
		<title>Database activity FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Database_activity_FAQ&amp;diff=74109"/>
		<updated>2010-07-21T23:26:10Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Database activity module}}&lt;br /&gt;
==Where can I download additional database presets?==&lt;br /&gt;
&lt;br /&gt;
See [[Database presets]] for discussion links with presets for download.&lt;br /&gt;
&lt;br /&gt;
==How can I create a database in which students can only view their own entries?==&lt;br /&gt;
&lt;br /&gt;
Either:&lt;br /&gt;
*Set up the database so that entries require approval. If the entries are never approved, then only the student that added a particular entry and the teachers can view it.&lt;br /&gt;
&lt;br /&gt;
Or:&lt;br /&gt;
*Set the group mode of the database to &amp;quot;Separate groups&amp;quot; and assign each student to a separate group.&lt;br /&gt;
&lt;br /&gt;
==How can I enable a sort function by clicking on the field headings?==&lt;br /&gt;
&lt;br /&gt;
For sorting, you need to manually create the link in the template around that heading.  To find the URL you need, you can do a sort using the menus and then look in the URLs. Take out everything but the d, sort and order parameters. For example,&lt;br /&gt;
&lt;br /&gt;
http://moodle.org/mod/data/view.php?d=13&amp;amp;sort=44&amp;amp;order=ASC&lt;br /&gt;
&lt;br /&gt;
http://moodle.org/mod/data/view.php?d=13&amp;amp;sort=44&amp;amp;order=DESC&lt;br /&gt;
&lt;br /&gt;
==How can I add highlighting like on the Module and plugins page?==&lt;br /&gt;
&lt;br /&gt;
In the repeated part of the template (note onmouseover and onmouseout to change the classes):&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;tr onmouseover=&amp;quot;this.className=&#039;trhighlight&#039;&amp;quot; onmouseout=&amp;quot;this.className=&#039;trnormal&#039;&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;td class=&amp;quot;c0&amp;quot;&amp;gt;&amp;lt;b&amp;gt;&amp;lt;a href=&amp;quot;##MoreURL##&amp;quot;&amp;gt;[[Name]]&amp;lt;/a&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;td class=&amp;quot;c1&amp;quot;&amp;gt;[[Type]]&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;td class=&amp;quot;c2&amp;quot;&amp;gt;[[Requirement]]&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;td class=&amp;quot;c3&amp;quot;&amp;gt;[[Status]]&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;td class=&amp;quot;c4&amp;quot;&amp;gt;[[Summary]]&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;td align=&amp;quot;center&amp;quot; class=&amp;quot;c5&amp;quot;&amp;gt;##Edit##&amp;amp;nbsp;##Delete##&amp;amp;nbsp;##More##&amp;amp;nbsp;##Approve## &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the CSS template there are two styles:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;.trnormal td {&lt;br /&gt;
   background-color: #FFFFFF;&lt;br /&gt;
 }&lt;br /&gt;
 .trhighlight td {&lt;br /&gt;
   background-color: #EEEEEE;&lt;br /&gt;
 }&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How can I list database information horizontally instead of vertically?==&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=74243 How can I list database information horizontally instead of vertically? Forum discussion]&lt;br /&gt;
&lt;br /&gt;
==Can&#039;t get columns to line up in list view==&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=84050 Can&#039;t get columns to line up in list view forum discussion] including moodle.org presets for download&lt;br /&gt;
&lt;br /&gt;
==How can I make an Encyclopedia database preset?==&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=87560 Encyclopedia database preset forum discussion] including encyclopedia-style preset for download&lt;br /&gt;
&lt;br /&gt;
==Is there a Time stamp for database entries?==&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=86927 Time stamp for database entries forum discussion]&lt;br /&gt;
&lt;br /&gt;
==How can I make the title of an entry into a link?==&lt;br /&gt;
&lt;br /&gt;
To make the title of an entry in list view link to the single view, add the following code to the list template:&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;a href=&amp;quot;##moreurl##&amp;quot;&amp;gt;[[Title]]&amp;lt;/a&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==How can I make email addresses clickable?==&lt;br /&gt;
&lt;br /&gt;
To make email addresses clickable, add the following code to the single template:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;a href=&amp;quot;mailto:[[Email]]&amp;quot;&amp;gt;[[Email]]&amp;lt;/a&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &#039;Email&#039; is the text field for inputting email addresses.&lt;br /&gt;
&lt;br /&gt;
==How can I delete a file attached to a database entry?==&lt;br /&gt;
&lt;br /&gt;
There is currently no user interface for deleting a file attached to a database entry, however a workaround would be to delete the entry completely and then create a new entry without the file attached.&lt;br /&gt;
&lt;br /&gt;
==How can I hide a database entry which was previously approved?==&lt;br /&gt;
&lt;br /&gt;
There is currently no user interface for hiding a database entry which was previously approved i.e. setting it to require approval again. However, an entry can be hidden using [[MySQL Admin]] by editing it in the &#039;&#039;data_records&#039;&#039; table and changing the approved value from 1 to 0.&lt;br /&gt;
&lt;br /&gt;
==How can I add a default sort order of entries?==&lt;br /&gt;
&lt;br /&gt;
In the Fields tab, select a default sort field, choose ascending or descending then click the Save button.&lt;br /&gt;
&lt;br /&gt;
==Why is my database so slow to show each page?==&lt;br /&gt;
&lt;br /&gt;
Try to go to &amp;quot;Administration &amp;gt; Miscellaneous &amp;gt; XMLDB editor&amp;quot; and choose &amp;quot;Check Indexes&amp;quot;. If you have any missing indexes found; upgrade your Moodle to the latest weekly build of your version; re-run the test; backup your site database and then run the suggested SQL from the test on your site database. This should speed up your database activity load times.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
Using Moodle forum discussions:&lt;br /&gt;
&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=87005 New preset, please review, and make suggestions!] including FAQ preset for download&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=88727 Design a Database Preset for Document Sharing] including preset for download&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=55338 Look of the database module]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=61179 For those who want the display of Moodle Site&#039;s Modules and plugins]&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=94854#p457252 Looking for some stellar examples of Moodle courses] including book reviews preset for download&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[de:Datenbank FAQ]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=PHP_settings_by_Moodle_version&amp;diff=73997</id>
		<title>PHP settings by Moodle version</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=PHP_settings_by_Moodle_version&amp;diff=73997"/>
		<updated>2010-07-18T07:31:28Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* PHP Settings */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
and &lt;br /&gt;
{{Review}}{{Template:Installing Moodle}}&lt;br /&gt;
==PHP Version==&lt;br /&gt;
Moodle has different PHP requirements for different versions:&lt;br /&gt;
* Moodle 2.0 will require PHP 5.2.8 or later.&lt;br /&gt;
* Moodle 1.6 to 1.9 requires PHP 4.3.0 or later&lt;br /&gt;
* Moodle 1.0 to 1.5 requires PHP 4.1.0 or later &lt;br /&gt;
==PHP Settings==&lt;br /&gt;
Check these settings in your php.ini or .htaccess file (if you&#039;re using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer. &lt;br /&gt;
* &#039;&#039;register_globals&#039;&#039; &#039;&#039;&#039;MUST&#039;&#039;&#039; be OFF&lt;br /&gt;
* &#039;&#039;safe_mode&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;memory_limit&#039;&#039; should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.&lt;br /&gt;
* &#039;&#039;session.save_handler&#039;&#039; needs to be set to FILES.&lt;br /&gt;
* &#039;&#039;magic_quotes_gpc&#039;&#039; should be OFF. (It will be an installation pre-requisite for this to be turned off from 2.0 onwards.)&lt;br /&gt;
* &#039;&#039;magic_quotes_runtime&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;file_uploads&#039;&#039; needs to be ON.&lt;br /&gt;
* &#039;&#039;session.auto_start&#039;&#039; needs to be OFF.&lt;br /&gt;
* &#039;&#039;session.bug_compat_warn&#039;&#039; needs to be OFF.&lt;br /&gt;
* For file uploads in Moodle 2 on a Windows install, the temp folder must be defined and writeable by your webserver user&lt;br /&gt;
&lt;br /&gt;
==PHP Extensions and libraries==&lt;br /&gt;
* The mbstring extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
* The iconv extension is recommended for Moodle 1.6 or later.&lt;br /&gt;
* [http://www.libgd.org/ GD library] and the [http://www.freetype.org/ FreeType 2] library and extensions are needed to be able to look at the dynamic graphs that the logs pages make. (Freetype support is available as part of the GD extension for the 5.x versions of PHP)&lt;br /&gt;
* The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.&lt;br /&gt;
* The pgsql extension is required if you are using the PostgreSQL database.&lt;br /&gt;
* The zlib extension is required for zip/unzip functionality.&lt;br /&gt;
* The pdo and pdo_sqlite extensions are required for the (experimental) SQLite 3 database support.&lt;br /&gt;
* The tokenizer extension is recommended for Moodle 1.8 or later (enabled by default as of [http://www.php.net/manual/en/tokenizer.installation.php PHP 4.3.0]).&lt;br /&gt;
* The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
* The xmlrpc extension is required for the Moodle network functionality (Moodle 1.8 or later).&lt;br /&gt;
* The ctype extension is recommended for Moodle 1.8 or later (enabled by default as of [http://www.php.net/manual/en/ctype.installation.php PHP 4.2.0]). &lt;br /&gt;
* Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).&lt;br /&gt;
==Database Support==&lt;br /&gt;
A working database server: [[MySQL]] or [[PostgreSQL]] are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is &#039;&#039;the&#039;&#039; choice for many people because it is very popular, but there are some [[Arguments in favour of PostgreSQL|arguments in favour of PostgreSQL]], especially if you are planning a large deployment.&lt;br /&gt;
* For Moodle 1.5, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later). &lt;br /&gt;
* For Moodle 1.6, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).&lt;br /&gt;
* For Moodle 1.7, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
* For Moodle 1.8 or later, MySQL (version 4.1.12 or later), PostgreSQL (8.0 or later) or Microsoft SQL Server 2005 (version 9 or [http://moodle.org/mod/forum/discuss.php?d=59284 SQL Server Express 2005])&lt;br /&gt;
: MySQL Notes: For Moodle 1.6 or later, If you use latin languages only you can use MySQL 4.1.12. If you are using non-latin languages you require MySQL 4.1.16 or later. Currently the MySQL setting &amp;quot;strict mode&amp;quot; must be OFF (set to &amp;quot;&amp;quot; or &amp;quot;MYSQL40&amp;quot;) in the MySQL configuration file. &lt;br /&gt;
: PostgreSQL Notes: PostgreSQL 7.4 is recommended for earlier Moodle versions, since Moodle 1.8 only PostgreSQL 8.0 and above are supported.&lt;br /&gt;
* For showcases or low to medium-sized installations, Moodle 2.0 also includes (experimental) support for SQLite 3 database. This setup requires no database server, as the database file is stored in a local directory on the server.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Installing Moodle]]&lt;br /&gt;
*[[Performance]]&lt;br /&gt;
&lt;br /&gt;
[[de:PHP-Versionen für Moodle]]&lt;br /&gt;
[[ru:Настройки PHP для разных версий Moodle]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Jon_Witts/Biography&amp;diff=73841</id>
		<title>User:Jon Witts/Biography</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Jon_Witts/Biography&amp;diff=73841"/>
		<updated>2010-07-11T19:14:24Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Education History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Jon Witts Biography=&lt;br /&gt;
==Work History==&lt;br /&gt;
*2007 - Current : Director of ICT at South Hunsley School&lt;br /&gt;
*2004 - 2007 : Learning Resource Centre Manager at South Hunsley School&lt;br /&gt;
*2003 - 2004 : Ran my own Cyber Café and IT consultancy Company&lt;br /&gt;
*2002 - 2003 : Audio Visual and IT Technician at Hull Time Based Arts&lt;br /&gt;
*2001 - 2002 : Administrative Assistant at Hull Time Based Arts&lt;br /&gt;
&lt;br /&gt;
==Education History==&lt;br /&gt;
&lt;br /&gt;
*2005 - 2008 : Foundation Degree, Design and Development of e-Learning, University of Huddersfield&lt;br /&gt;
*1997 - 2000 : BA Hons , Fine Art - Time Based Media, University of Humberside and Lincolnshire&lt;br /&gt;
*1996 - 1997 : BTEC, Fine Art Foundation, Barnfield College&lt;br /&gt;
*1994 - 1996 : A Level, Art, Maths and Physics, Luton Sixth Form College&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Jon_Witts/Biography&amp;diff=73840</id>
		<title>User:Jon Witts/Biography</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Jon_Witts/Biography&amp;diff=73840"/>
		<updated>2010-07-11T19:10:47Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: /* Work History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Jon Witts Biography=&lt;br /&gt;
==Work History==&lt;br /&gt;
*2007 - Current : Director of ICT at South Hunsley School&lt;br /&gt;
*2004 - 2007 : Learning Resource Centre Manager at South Hunsley School&lt;br /&gt;
*2003 - 2004 : Ran my own Cyber Café and IT consultancy Company&lt;br /&gt;
*2002 - 2003 : Audio Visual and IT Technician at Hull Time Based Arts&lt;br /&gt;
*2001 - 2002 : Administrative Assistant at Hull Time Based Arts&lt;br /&gt;
&lt;br /&gt;
==Education History==&lt;br /&gt;
&lt;br /&gt;
1997 - 2000 : BA Hons Fine Art at University of Humberside and Lincolnshire specialising in Time Based Media&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Jon_Witts&amp;diff=73839</id>
		<title>User:Jon Witts</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Jon_Witts&amp;diff=73839"/>
		<updated>2010-07-11T19:09:19Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I work at a secondary school in the East Riding of Yorkshire in England as the Director of ICT.&lt;br /&gt;
&lt;br /&gt;
I like to help out in the forums if I can...&lt;br /&gt;
&lt;br /&gt;
I have just started to try and focus more of Moodle time on the docs. Hopefully some of the edits I make and pages I create will help those starting out with Moodle.&lt;br /&gt;
&lt;br /&gt;
Here are links to my User area sub-pages... &lt;br /&gt;
&lt;br /&gt;
*[[user:Jon_Witts/Biography]]&lt;br /&gt;
*[[User:Jon_Witts/moodle_via_apt_get]]&lt;br /&gt;
*[[User:Jon_Witts/file-upload-v2]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Jon_Witts&amp;diff=73475</id>
		<title>User:Jon Witts</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Jon_Witts&amp;diff=73475"/>
		<updated>2010-06-30T20:08:14Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I work at a secondary school in the East Riding of Yorkshire in England as the Director of ICT.&lt;br /&gt;
&lt;br /&gt;
I like to help out in the forums if I can...&lt;br /&gt;
&lt;br /&gt;
I have just started to try and focus more of Moodle time on the docs. Hopefully some of the edits I make and pages I create will help those starting out with Moodle.&lt;br /&gt;
&lt;br /&gt;
[[user:Jon_Witts/Biography]]&lt;br /&gt;
&lt;br /&gt;
[[User:Jon_Witts/moodle_via_apt_get]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Jon_Witts&amp;diff=73474</id>
		<title>User:Jon Witts</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Jon_Witts&amp;diff=73474"/>
		<updated>2010-06-30T20:08:01Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I work at a secondary school in the East Riding of Yorkshire in England as the Director of ICT.&lt;br /&gt;
&lt;br /&gt;
I like to help out in the forums if I can...&lt;br /&gt;
&lt;br /&gt;
I have just started to try and focus more of Moodle time on the docs. Hopefully some of the edits I make and pages I create will help those starting out with Moodle.&lt;br /&gt;
&lt;br /&gt;
[[user:Jon_Witts/Biography]]&lt;br /&gt;
[[User:Jon_Witts/moodle_via_apt_get]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=User:Jon_Witts/moodle_via_apt_get&amp;diff=73473</id>
		<title>User:Jon Witts/moodle via apt get</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=User:Jon_Witts/moodle_via_apt_get&amp;diff=73473"/>
		<updated>2010-06-30T20:07:24Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: New page: =Install Moodle via apt get package on Ubuntu and Debian= So this to try and tidy up the apt-get install docs which are in a bit of disarray at the moment...  *Ubuntu and Debain both use t...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Install Moodle via apt get package on Ubuntu and Debian=&lt;br /&gt;
So this to try and tidy up the apt-get install docs which are in a bit of disarray at the moment...&lt;br /&gt;
&lt;br /&gt;
*Ubuntu and Debain both use the same package manager that uses deb packages to allow you to install software and know that all of the dependencies will be automatically met and resolved for you by the operating system. Packages are also updated automatically as new versions are maintained in the package repositories.&lt;br /&gt;
*There is a deb package for Moodle maintained by ???. Whilst it will not be the latest version of Moodle; it should make installation on a Debian or Ubuntu server very easy.&lt;br /&gt;
==Install your server==&lt;br /&gt;
Download either the latest Ubuntu server disc (10.04 as this written) or the latest Debian disc (5.0 as writing) and follow the documentation on either site to install an basic server install with no packages installed (also known as the base system).&lt;br /&gt;
==Update your server==&lt;br /&gt;
Once your server is installed, make sure it is fully up to date.&lt;br /&gt;
 sudo apt-get update&lt;br /&gt;
 sudo apt-get dist-upgrade&lt;br /&gt;
At this point it is probably wise to reboot your server&lt;br /&gt;
==Set Static IP==&lt;br /&gt;
You are probably going to want your server running on a static IP.&lt;br /&gt;
*Edit /etc/networking/interfaces to set your static IP&lt;br /&gt;
*Restart your networking: sudo /etc/init.d/networking restart&lt;br /&gt;
*Check it works; can you ping another server? www.google.com for example?&lt;br /&gt;
==Install Moodle==&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/405/en/index.php?title=Wiki_settings&amp;diff=73419</id>
		<title>Wiki settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/405/en/index.php?title=Wiki_settings&amp;diff=73419"/>
		<updated>2010-06-28T17:44:48Z</updated>

		<summary type="html">&lt;p&gt;Jonwitts: Undo revision 73407 by Sadak0304025 (Talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Wiki}}&lt;br /&gt;
The standard Moodle wiki has different settings.   Please note that these instructions are located in docs.moodle.org&#039;s documentation wiki.&lt;br /&gt;
&lt;br /&gt;
==Adding a wiki==&lt;br /&gt;
[[Image:Wiki settting screen.JPG|thumb|Adding a new wiki in Moodle 1.7]]&lt;br /&gt;
To create a wiki:&lt;br /&gt;
#Click the &amp;quot;Turn editing on&amp;quot; button.&lt;br /&gt;
#Select Wiki from the &amp;quot;Add an activity&amp;quot; dropdown menu in the course section where you would like to add the wiki.&lt;br /&gt;
#On the Adding a new wiki page, give the wiki a descriptive name.&lt;br /&gt;
#In the summary field, describe the purpose of the wiki and what you expect students to contribute.&lt;br /&gt;
#Select the wiki type - groups, student or teacher. The wiki type interacts with the groups setting for your course, resulting in 9 options, as shown in the [http://moodle.org/help.php?module=wiki&amp;amp;file=wikitype.html&amp;amp;lang=en type help pop-up].&lt;br /&gt;
#Click the &amp;quot;Show Advanced&amp;quot; button (in Moodle 1.8 onwards) to display additional options (see below).&lt;br /&gt;
#Select the common module settings (see below).&lt;br /&gt;
#Click the &amp;quot;Save changes&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
== Adding and editing wiki pages ==&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve created a wiki, it&#039;s available for editing. [[Viewing a wiki]] contains information on adding and editing wiki pages.&lt;br /&gt;
&lt;br /&gt;
==Advanced options==&lt;br /&gt;
&lt;br /&gt;
===Print wiki name of every page===&lt;br /&gt;
If you select this option, the top of each page will have the name of the wiki.&lt;br /&gt;
&lt;br /&gt;
===HTML mode===&lt;br /&gt;
There are three options: No HTML, safe HTML or HTML only. &#039;No HTML&#039; will display all HTML tags as tags. &#039;Safe HTML&#039; will allow certain tags to be displayed. &#039;HTML only&#039; enables the [[HTML editor]] to display in [[Common_acronyms#N_to_Z|WYSIWYG]].&lt;br /&gt;
&lt;br /&gt;
===Allow binary files===&lt;br /&gt;
Binary files are graphics, audio, video, and other non-text resources. If you want students to be able to add files as attachments, set this to Yes. &lt;br /&gt;
&lt;br /&gt;
===Wiki auto-linking options===&lt;br /&gt;
A new page can be created in the wiki by typing a word using CamelCase i.e. with a capital letter at the beginning and a capital letter somewhere else in the word. It&#039;s called CamelCase because the two capital letters resemble a two-humped camel. CamelCase combines all the words for the link into one word. Each word in the link is capitalized. When a word is added in CamelCase, the wiki automatically creates a new page and makes the word a link. You can disable this feature if you wish, so that typing a word enclosed in square brackets is the only way of creating a new page.&lt;br /&gt;
&lt;br /&gt;
CamelCase is not always desirable, as some text is written in it. For example a file name might be MyFile_2007_Feb.jpg.&lt;br /&gt;
&lt;br /&gt;
===Student admin options===&lt;br /&gt;
When students can edit a page, you can allow them certain administrative privileges in the wiki (see [[Wiki administration]]).&lt;br /&gt;
&lt;br /&gt;
===Page name===&lt;br /&gt;
You may wish to seed the wiki with a page name for the first page.&lt;br /&gt;
&lt;br /&gt;
===Choose an initial page===&lt;br /&gt;
This can be the first wiki page that is created, or a way to switch to a different front page. Other files in the same directory as the first wiki page you select will also become part of the initial wiki - see:&lt;br /&gt;
http://moodle.org/mod/forum/discuss.php?d=8501&lt;br /&gt;
&lt;br /&gt;
==Common module settings==&lt;br /&gt;
The [[Common module settings]] section appears in many modules besides wiki.  It sets [[Groups]] interactions levels and the ID number.&lt;br /&gt;
&lt;br /&gt;
==Creating a Wiki with Groups (Step by Step Instructions)==&lt;br /&gt;
Create a Wiki with Groups Tutorial (Subject: American War Battles)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Create Groups&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. On the course page select “Groups” under “Administration”.&lt;br /&gt;
&lt;br /&gt;
2. On the groups page click the “Create group” button.&lt;br /&gt;
&lt;br /&gt;
3. Fill in the following info for this group:&lt;br /&gt;
&lt;br /&gt;
     - Group name: civil&lt;br /&gt;
     - Group description: Civil War Battles Group Project&lt;br /&gt;
     - Enrollment key: civil&lt;br /&gt;
&lt;br /&gt;
4. Click the &amp;quot;Save changes&amp;quot; button. &lt;br /&gt;
&lt;br /&gt;
5. On the group page, make sure the &#039;&#039;civil&#039;&#039; group is selected and click the “Add/remove users” button.&lt;br /&gt;
&lt;br /&gt;
6. Add users to the &#039;&#039;civil&#039;&#039; group (move them from the right box to the left box by clicking the “Add” button). When finished, click the “Back to groups” button.&lt;br /&gt;
&lt;br /&gt;
7. Repeat steps 2-6 to create three additional groups (vietnam, world1, world2). Make sure to make the appropriate changes to Group name, Group description, and Enrollment key.&lt;br /&gt;
&lt;br /&gt;
8. Return to course page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Create the Wiki&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Turn editing on.&lt;br /&gt;
&lt;br /&gt;
2. Click the drop-down menu for “Add an Activity”. Select “Wiki”.&lt;br /&gt;
&lt;br /&gt;
3. On the “Add a Wiki” page fill in the following:&lt;br /&gt;
&lt;br /&gt;
     - Name: American War Battles&lt;br /&gt;
     - Summary: American War Battles Group Project&lt;br /&gt;
     - Type: Groups&lt;br /&gt;
     - Print Wiki name on every page: Yes (optional)&lt;br /&gt;
     - HTML mode: HTML only&lt;br /&gt;
     - Allow Binary Files: Yes&lt;br /&gt;
     - Disable CamelCase linking: Yes&lt;br /&gt;
     - Group Mode: Visible Groups&lt;br /&gt;
     - Visible: Show&lt;br /&gt;
     - Grade Category: Uncategorized&lt;br /&gt;
&lt;br /&gt;
4. Click the “Save and return to course” button.&lt;br /&gt;
&lt;br /&gt;
5. On the course page click on the Wiki link.&lt;br /&gt;
&lt;br /&gt;
6. This is where you need to stop for a moment and get yourself oriented. Most likely you are on the “Groups wiki for civil” page in the “American War Battles&amp;quot; Wiki since this was the first group you created (this will be shown on the top-left of the page).  If so, you are ready to begin created your Civil War page Wiki. If you would prefer to start with another war, simply click the drop-down on the top-right of the page labeled “Other Wikis:” and choose the wiki group you want to start with.&lt;br /&gt;
 &lt;br /&gt;
7. On the lower portion of the page you should see a bold header: &#039;&#039;&#039;Edit this page ‘American War Battles’&#039;&#039;&#039;. (I chose to start with the civil group so I will begin editing for the Civil War). Type the following: &lt;br /&gt;
&lt;br /&gt;
[The Battle of Shiloh]&lt;br /&gt;
&lt;br /&gt;
[The Battle of Gettysburg]&lt;br /&gt;
&lt;br /&gt;
[The Battle of New Orleans]&lt;br /&gt;
&lt;br /&gt;
8. Click the “Save” button&lt;br /&gt;
&lt;br /&gt;
9. On the top-right of the page choose the world1 group from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
10. Repeat steps 7-8 but replace the battles with battles from World War I.&lt;br /&gt;
&lt;br /&gt;
11. On the top-right of the page choose the world2 group from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
12. Repeat steps 7-8 but replace the battles with battles from World War II.&lt;br /&gt;
&lt;br /&gt;
13. On the top-right of the page choose the vietnam group from the drop-down menu.&lt;br /&gt;
&lt;br /&gt;
14. Repeat steps 7-8 but replace the battles with battles from the Vietnam War.&lt;br /&gt;
&lt;br /&gt;
15. Now the Wiki is ready for students to work in!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Student Access to Wiki&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
1. Go to course page.&lt;br /&gt;
&lt;br /&gt;
2. Click on the “American War Battles” Wiki.&lt;br /&gt;
&lt;br /&gt;
3. Select your group from the top-right drop-down menu.&lt;br /&gt;
&lt;br /&gt;
4. Use the Enrollment key that was given to you by your teacher.&lt;br /&gt;
&lt;br /&gt;
5. Click the ? to the right of the battle you want to begin working on.&lt;br /&gt;
&lt;br /&gt;
6. Get to work!&lt;br /&gt;
&lt;br /&gt;
7. Note: Students will only be able to edit within their group. Because the Group Mode was set to “Visible Groups” by the teacher, students will be able to view every groups work but will only be able to edit their own.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Wiki permissions]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Wiki]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Ajouter/modifier un wiki]]&lt;br /&gt;
[[de:Wiki anlegen]]&lt;br /&gt;
[[ja:Wikiを追加/編集する]]&lt;/div&gt;</summary>
		<author><name>Jonwitts</name></author>
	</entry>
</feed>