<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/34/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Fox</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/34/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Fox"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/Special:Contributions/Fox"/>
	<updated>2026-04-09T05:36:00Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=GDPR&amp;diff=130461</id>
		<title>GDPR</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=GDPR&amp;diff=130461"/>
		<updated>2018-03-20T10:26:42Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Managing a Moodle site}}&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
GDPR stands for General Data Protection Regulation and refers to the European Union regulation for data protection for all individuals within the European Union. The regulation (Regulation (EU) 2016/679)[[#ref2|2]] becomes enforceable on 25 May 2018 and replaces the data protection directive (officially Directive 95/46/EC)[[#ref3|3]] from 1995.&lt;br /&gt;
&lt;br /&gt;
Who does it affect?&lt;br /&gt;
&lt;br /&gt;
Any individual or organisation that stores or processes personal information on an identifiable person from an EU member state (regardless if the processing or storage of information occurs in the EU or not). It also applies if the individual or organisation themselves is located in an EU member state.&lt;br /&gt;
&lt;br /&gt;
What kind of information comprises personal data in a Moodle site?&lt;br /&gt;
&lt;br /&gt;
It is all information that can be associated with a natural person. Each user account and all the activity associated with that user account is classified as personal information. This extends to information stored in backups, as well as associated information such as web server log files.&lt;br /&gt;
&lt;br /&gt;
What are the penalties for non-compliance with the regulations?&lt;br /&gt;
&lt;br /&gt;
Severe!&lt;br /&gt;
&lt;br /&gt;
== Disclaimer ==&lt;br /&gt;
&lt;br /&gt;
The advice in this document is provided for informational purposes only, and not be construed as legal or professional advice. Moodle Pty Ltd does not warrant that the advice is accurate, complete, reliable, current or error-free.&lt;br /&gt;
&lt;br /&gt;
== Checklist ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; Is the Moodle site hosted in an EU member state, or is it possible that any user of the Moodle site is an individual from an EU member state?&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt; If you answered no to this question, you are not affected by this regulation. However, the benefits of data protection afforded by the regulation are universally applicable and you may consider voluntarily complying with this legislation for the benefit of your site users.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Do you require your site users to accept a site policy document before using your site (either in Moodle or something outside of Moodle, like a paper form)?&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you answered no to this question, you must start doing so. Users need to be aware of their rights and the processes with which they can exercise their rights.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you answered yes to this question you must review your privacy policy to make sure it covers all requirements of the new regulations (see “Site policy” below). If you change your privacy policy you must get all site users to accept the new policy before they can continue using the site.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Is it possible that your site is used by minors? (Under 16 in most member states, but some states may reduce this as low as 13 years).&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you answered yes to this question, you must ensure that the consent is obtained from their legal guardian. Keep in mind that collecting and processing personal information on minors is may impact your risk assessment. You should take extra care to adequately secure this information, and retain it for as short a period as is necessary.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Is it the collection or storage of personal data from your site users likely to result in a high risk to their rights and freedoms?&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Some examples that would indicate high risk are:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;a systematic and extensive evaluation of personal aspects relating to natural persons which is based on automated processing, including profiling, and on which decisions are based that produce legal effects concerning the natural person or similarly significantly affect the natural person&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;processing on a large scale of special categories of data including&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Racial or ethnic origin&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Political opinions&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Religious or philosophical beliefs&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Trade union membership&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Genetic data&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Biometric data&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Data concerning health&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Sexual orientation&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Data concerning a natural person’s sex life&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Criminal convictions&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;This is not an exhaustive list and if you are unsure if you should consider the data collected from your users as “High risk” you should refer to the legislation and seek professional advice.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If the answer is “Yes”, you should perform a Data Protection Impact Assessment. Refer to the legislation and seek professional advice.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Do you use any of the collected personal information for the purposes of marketing?&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you answered yes to this question - you must obtain a separate consent from each user to use this data for this purpose. Consent to use the data for marketing must be separately withdrawable by the user.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Do you use any of the collected personal information for the purposes of research?&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you answered yes to this question, you must either obtain a specific consent from each user to use the data for this purpose, or completely anonymise the data before using it for research. &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;[https://github.com/moodlehq/moodle-local_anonymise https://github.com/moodlehq/moodle-local_anonymise] is an example of a tool designed to anonymise all the data on a moodle site.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Do you share any of the collected data with any third parties? This includes sites and services that integrate with Moodle such as: Google analytics, LTI, Repositories (Google Docs, OneDrive etc), Authentication systems etc. This also includes sites and services used in the provision of your own Moodle site such as hosting providers.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you answered yes to this question then you are responsible for all data that is shared with a third party. You must obtain the user’s consent to share this data with each third party. If the list of third party services changes you must re-obtain consent from all site users for each new third party site/service. You should also take reasonable steps to ensure that each third party will adequately protect users personal data including:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reviewing the third party privacy policy to make sure it is congruent with your own&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Monitoring and notifying your site users about changes to the third party privacy policy&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Identify the mechanism for processing requests to erase or correct personal data with each third party so that you can follow this process when you receive one of these requests for your own site&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Identify and list the data protection officer, and privacy policy for each third party site as part of your own privacy policy&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Google analytics for example has not yet provided clear updated instructions on how to comply with the new GDPR when using their service. It is probable that they will issue guidance on how to use Google Analytics in compliance with the GDPR before it becomes enforceable, but this example demonstrates that it is your responsibility to ensure the protection of privacy of the users of your site and it is not legal to use cloud services without considering the privacy implications of each and every service provider.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Do you follow best practice policies and procedures to ensure data security?&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you answered no to this question then you have must review your policies and procedures to ensure you are not placing your sites users personal data at risk.&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;“Best practices” includes but is not limited to organisational and technical measures to ensure a level of security appropriate to the risk such that:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;pseudonymisation and encryption of personal data&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;the ability to ensure the ongoing confidentiality, integrity, availability and resilience of processing systems and services&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;the ability to restore the availability and access to personal data in a timely manner in the event of a physical or technical incident&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;a process for regularly testing, assessing and evaluating the effectiveness of technical and organisational measures for ensuring the security of the processing&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Examples:&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Appropriate use of encryption (https)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Maintaining all systems and software with relevant security updates.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Deletion of personal data as soon as possible, once it is no longer required for the purpose it was collected.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Do you have defined policies and procedures for disclosing data breaches?&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you answered no this question then you must define some&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you have existing policies and procedures they should be reviewed&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;These policies and procedures must include notifying the Supervisory Authority within 72 hours of the data breach and notifying all affected users if they have been adversely affected (personal data disclosed).&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Have you appointed a data protection officer, and listed them in your privacy policy?&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you answered no to this question then you must appoint one and list them in your sites privacy policy. The data protection officer is expected to be “proficient at managing IT processes, data security (including dealing with cyber-attacks) and other critical business continuity issues around the holding and processing of personal and sensitive data [[#ref1|1]].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Do you have a mechanism with with your site users can request their personal data is erased, corrected or made available to the requesting user on your site?&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you answered yes to this question then must ensure it is listed in your sites privacy policy&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you answered no to this question then you define one and list it in your sites privacy policy&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;For a Moodle site a suitable mechanism would be an email address, reserved for this purpose that is monitored by an administrator for your Moodle site. Once a request is received, reasonable steps should be taken to ensure the authenticity of the request and the identity of the user making the request&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Corrections to personal data can be processed by changing the data in Moodle directly using an administrator account&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Erasures of personal data can be processed by either deleting the user account, or by editing the user account to remove all identifying information and making it inactive&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Records of personal data can be obtained from the “Site Administration -&amp;amp;gt; Reports -&amp;amp;gt; Logs” by downloading all the logs for a single user as a CSV file. There will likely be additional personal data about a user that is stored outside of Moodle, such as web server access logs.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Does your organisation have more than 250 employees?&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If you answered yes to this question then you must maintain detailed records on all processing of personal data. Refer to the regulation for details of the records that must be maintained&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Site policy ==&lt;br /&gt;
&lt;br /&gt;
Moodle site policy can be used to collect consent for the purposes of GDPR compliance. The site policy document should be reviewed carefully to make sure it covers all the information listed below, in succinct, simple language.&lt;br /&gt;
&lt;br /&gt;
Site policies can be enabled in Moodle via the “Site policy URL (sitepolicy)” setting on the “Site Administration -&amp;amp;gt; Security -&amp;amp;gt; Site policies” page. This setting should be set to a public page that contains all of the information listed below. The site policy will be displayed in an iframe as part of the login process, so it does not require headers and footers.&lt;br /&gt;
&lt;br /&gt;
A recommended practice is to create a file resource on the frontpage of the Moodle site and copy the url for this resource to use as the site policy. This means the site policy is always available for your users to access, and can be updated easily from within Moodle. Note that this technique is incompatible with the “Force users to log in (forcelogin)” setting, also on the “Site Administration -&amp;amp;gt; Security -&amp;amp;gt; Site policies” page as the file resource will no longer be visible until the user has logged into the site.&lt;br /&gt;
&lt;br /&gt;
For more information on the “sitepolicy” setting in Moodle see the section &#039;Site policy URL&#039; in [[Site policies]].&lt;br /&gt;
&lt;br /&gt;
The site policy must include all of the following information in simple language:&lt;br /&gt;
&lt;br /&gt;
# What information is collected.&lt;br /&gt;
# The purpose of all processing to be performed on the users data. Marketing must be listed separately with a separate revocable “consent”.&lt;br /&gt;
# The identity of the data controller and contact information&lt;br /&gt;
# List of rights&lt;br /&gt;
# The period the data is stored&lt;br /&gt;
# The mechanism for withdrawing consent&lt;br /&gt;
# The mechanism for requesting corrections, or erasures of personal data&lt;br /&gt;
# The mechanism for requesting a record of all personal data&lt;br /&gt;
# List of third parties that data will be shared with (This includes integrations such as LTI, portfolios, plagiarism, repositories, authentication etc.) including:&lt;br /&gt;
## The contact details of the data protection officer for each&lt;br /&gt;
## The privacy policy for each.&lt;br /&gt;
# Whether the personal data will be used for any automated decision making process, including the significance and details of the process (e.g. analytics).&lt;br /&gt;
&lt;br /&gt;
=== Sample site policy ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Privacy and personal data&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
At Company XYZ we take your privacy very seriously. In order to provide access to the service we must collect and store some personal information about you.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Minors&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Children under 16 years of age are not permitted to access the services provided by [https://example.com/ https://example.com/]. By agreeing to this privacy policy you are also agreeing that you are 16 years of age or older.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;What is collected?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Basic profile information is collected from you when you create your account including your full name and email address.&lt;br /&gt;
&lt;br /&gt;
As you use the site, information about the users, courses, activities and resources you interact with will also be stored and linked to your profile information.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;How is this information used?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This information is only used to provide you access to the online courses at [https://example.com/ https://example.com/]. Statistical information about usage of the site is also used to improve the site and services provided on the [https://example.com/ https://example.com/] website.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Who can I contact?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The data protection officer for Company XYZ is John Smith and they may be contacted at [mailto:privacy@example.com privacy@example.com]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Who is my data shared with?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to provide access to LTI content provided by https://www.awesomeltis.com, we may share your basic profile information with Awesome LTI Ltd. The data protection officer for Awesome LTI Ltd is Mrs Jane Smith and she may be contacted at [mailto:privacy@awesomeltis.com privacy@awesomeltis.com]. The privacy policy for Awesome LTI Ltd is available at [http://www.awesomeltis.com/privacy https://www.awesomeltis.com/privacy]. In order to protect your privacy Company XYZ has entered into a data sharing agreement with Awesome LTI Ltd. The terms of this agreement are available here: [https://example.com/data-sharing.html https://example.com/data-sharing.html].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;How long is my data stored?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Your personal data is stored as long as you are enrolled in one or more online courses at [https://example.com/ https://example.com/]. Course data is deleted 6 months after the end date for each course and profile information will be anonymised when an account has not been accessed for 12 consecutive months.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;How do I withdraw my consent for Company XYZ to store and process my personal data?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you have previously consented to allow Company XYZ to store and process your personal data in accordance with this privacy policy, and you wish to withdraw your consent, please send an email to the data protection officer at [mailto:privacy@example.com privacy@example.com]. You will no longer be able to access the services provided by [https://example.com/ https://example.com/] if your consent is withdrawn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;How do I request that my personal data is corrected or erased?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You may make corrections to your basic profile information by logging into the [https://example.com/ https://example.com/] and editing your own profile. If you have questions, or would like any other data to be corrected or erased, please send an email to the data protection officer at [mailto:privacy@example.com privacy@example.com].&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;How do I request a record of all my personal data that has been collected?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You may request a record of all of the personal data relating to you that has been collected in accordance with this privacy policy. To do so, please send an email to the data protection officer at [mailto:privacy@example.com privacy@example.com].&lt;br /&gt;
&lt;br /&gt;
==Plugins==&lt;br /&gt;
&lt;br /&gt;
Two plugins are available as follows for adding GDPR functionality to Moodle 3.4.2 or 3.3.5 sites. (All GDPR functionality will be available as standard in Moodle 3.5.)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[https://moodle.org/plugins/tool_policy Policies plugin]&#039;&#039;&#039; provides a new user sign on process, with ability to define multiple policies (site, privacy, third party), track user consents, and manage updates and versioning of the policies.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;[https://moodle.org/plugins/tool_dataprivacy Data privacy plugin]&#039;&#039;&#039; provides the workflow for users to submit subject access requests and for site administrators and privacy officers to process these requests.  The subject access request process currently retrieves the user information from the following core plugins:&lt;br /&gt;
&lt;br /&gt;
* Choice Activity Module&lt;br /&gt;
* HTML Block&lt;br /&gt;
* User Tours&lt;br /&gt;
&lt;br /&gt;
Support for retrieving user information from the remaining core plugins will be added soon. The plugin will also be further extended to include functionality for data erasure requests and the data registry to define a purpose and retention period for data stored in a Moodle site.&lt;br /&gt;
&lt;br /&gt;
Moodle 3.4.2 and 3.3.5 include the following core API changes that are required to support the GDPR plugins:&lt;br /&gt;
&lt;br /&gt;
* An age and location check to identify minors&lt;br /&gt;
* The API to request personal data from all plugins&lt;br /&gt;
* Implementation of the API for a subset of Moodle core plugins so far&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[:dev:GDPR for plugin developers|GDPR for plugin developers]] in the dev docs&lt;br /&gt;
* [https://moodle.org/mod/forum/discuss.php?d=352538 EU General Data Protection Regulation (GDPR) compliance] forum discussion&lt;br /&gt;
&lt;br /&gt;
References:&lt;br /&gt;
&lt;br /&gt;
* [https://www.eugdpr.org/ Home Page of EU GDPR]&lt;br /&gt;
* [http://data.consilium.europa.eu/doc/document/ST-5419-2016-INIT/en/pdf GDPR Regulation]&lt;br /&gt;
* [http://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX:31995L0046 Directive 95/46/EC]&lt;br /&gt;
&lt;br /&gt;
==Any questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [https://moodle.org/mod/forum/view.php?id=7301 Security and privacy forum] on moodle.org.&lt;br /&gt;
&lt;br /&gt;
[[Category:GDPR]]&lt;br /&gt;
&lt;br /&gt;
[[es:GDPR]]&lt;br /&gt;
[[fr:RGPD]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Offline_quiz_activity&amp;diff=129829</id>
		<title>Offline quiz activity</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Offline_quiz_activity&amp;diff=129829"/>
		<updated>2018-01-08T15:00:36Z</updated>

		<summary type="html">&lt;p&gt;Fox: Link corrected&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = activity&lt;br /&gt;
|entry = https://moodle.org/plugins/view/mod_offlinequiz&lt;br /&gt;
|tracker = https://github.com/academic-moodle-cooperation/moodle-mod_offlinequiz&lt;br /&gt;
|discussion = https://github.com/academic-moodle-cooperation/moodle-mod_offlinequiz&lt;br /&gt;
|maintainer = [[user:AMC Academic Moodle Cooperation|AMC Academic Moodle Cooperation]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
{{Note|You can find the most up-to-date English and German documentation for this plugin in the AMC website at http://www.academic-moodle-cooperation.org/en/module/offline-quiz/. This page is intended for users who clicked on the &#039;Moodle Docs for this page&#039; link and for Moodle users of languages other than English and German (IN OTHER LANGUAGES  at the bottom of this page).}}&lt;br /&gt;
&lt;br /&gt;
[[File:MC Offline quiz module thumbnail.png]]&lt;br /&gt;
The Moodle MC Offline quiz module adds paper-and-pencil multiple-choice quizzes to Moodle. In offline quizzes students mark answers to questions on a sheet of paper (the answer form). The students&#039; answer forms are evaluated and graded automatically by the offline quiz module. &lt;br /&gt;
&lt;br /&gt;
More precisely, a complete offline quiz consists (at least) of the following steps:&lt;br /&gt;
&lt;br /&gt;
* A teacher creates an offline quiz in Moodle and adds multiple-choice questions, all-or-nothing multiple-choice questions or description questions (text) to the quiz. This is very similar to creating online quizzes (standard Moodle quizzes).&lt;br /&gt;
* From the question lists the teacher creates question sheets and answer forms as PDF (DOCX) documents using the module. &lt;br /&gt;
* The question sheets and answer forms are handed out to students for the actual quiz. The students mark the answers they think are correct in the answer form.&lt;br /&gt;
* The teacher scans the filled-in answer forms and uploads the resulting images into the offline quiz. The scanned answer forms are evaluated and graded automatically by the module. &lt;br /&gt;
* If necessary, the teacher corrects errors that might have occurred due to mistakes made by the students or due to bad scan quality. &lt;br /&gt;
&lt;br /&gt;
After results have been created in an offline quiz, students can review their result as usual. If the teacher allows it, students can also see the scanned answer forms and which markings have been recognised as crosses.&lt;br /&gt;
&lt;br /&gt;
The module supports up to six groups which are not related to Moodle course groups. Each group can contain a different set of questions in a different order. Separate question sheets and answer forms are created for the different offline quiz groups.&lt;br /&gt;
&lt;br /&gt;
The module also supports lists of participants which are useful for checking which students actually took part in the exam. Lists of participants are pre-filled with students in Moodle. PDF versions of those lists can be created in the module for easy marking during the exam. The marked lists can be uploaded and evaluated automatically.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
The offline quiz module is used intensively at different Austrian universities for mass exams. Hundreds of students can be easily examined at the same time (given enough seating space in lecture halls) without the need for expensive e-testing equipment.&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
Juergen Zimmer, from the [http://www.academic-moodle-cooperation.org Academic Moodle Cooperation] of several Vienna Universities.&lt;br /&gt;
&lt;br /&gt;
==Moodle versions==&lt;br /&gt;
* This module is available from [https://moodle.org/plugins/view.php?plugin=mod_offlinequiz the Moodle plugins database] for Moodle 2.6, Moodle 2.7 and Moodle 2.8. &lt;br /&gt;
* The Moodle 2.8 version released on september 2nd 2015, but seems to have a problem that it can not add specific questions from the question bank, even though adding random questions and making a new question work OK.&lt;br /&gt;
&lt;br /&gt;
[[File:Offline quiz edit offline quiz.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Offline quiz add random questions.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Offline quiz add a new question.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
* You can expect a version for Moodle 2.9 to be released approximately in February 2016.&lt;br /&gt;
&lt;br /&gt;
* There seems to be a version for Moodle 2.5 in [https://github.com/academic-moodle-cooperation/moodle-mod_offlinequiz/tree/MOODLE_25_STABLE Github].&lt;br /&gt;
* There seems to be a version for Moodle 2.2 in [https://github.com/academic-moodle-cooperation/moodle-mod_offlinequiz/blob/5dbf36388eea93f09c3bedfb06dcc77b9e993f8e/README.txt Github].&lt;br /&gt;
&lt;br /&gt;
==Translations available==&lt;br /&gt;
The Moodle 2.8 version has French, German and Mexican Spanish language translations made in [https://lang.moodle.org/local/amos/ AMOS].&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Copy the module code directly to the &amp;quot;mod/offlinequiz&amp;quot; directory. Open the messages page in the administration area to automatically start the installation.&lt;br /&gt;
&lt;br /&gt;
The automatic analysis of questionnaires requires the activation of an appropriate cronjob (see README.txt).&lt;br /&gt;
&lt;br /&gt;
===Cronjob===&lt;br /&gt;
&lt;br /&gt;
For the evaluation of answer forms an additional cronjob has to be installed. This should look similar to the following:&lt;br /&gt;
 &lt;br /&gt;
     */10 * * * * DATE=`date +\%Y\%m\%d`; php &amp;lt;your moodle root dir&amp;gt;/mod/offlinequiz/cron.php --cli=1 &amp;gt;&amp;gt; /var/log/moodle/cron-olq.log.$DATE 2&amp;gt;&amp;amp;1&lt;br /&gt;
     &lt;br /&gt;
but has to be adjusted to your environment. Since the evaluation of answer forms usually takes a lot of system resources, it is recommended to run this cronjob on a separate application server to take load from the frontend servers.&lt;br /&gt;
   &lt;br /&gt;
===Website settings===&lt;br /&gt;
In the website admin settings for the module   &lt;br /&gt;
&lt;br /&gt;
         Site Administration -&amp;gt; Plugins -&amp;gt; Activity modules -&amp;gt; Offline Quiz&lt;br /&gt;
&lt;br /&gt;
One can choose the default settings for the module and also determine the University Logo that will appear on the top of the answer forms (Logo URL).&lt;br /&gt;
 &lt;br /&gt;
The user identification has to be set to a formula describing how the user IDs can be retrieved from the digits marked by the students on the answer forms.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
 &lt;br /&gt;
A user identification formula   &lt;br /&gt;
        a[7]=username&lt;br /&gt;
&lt;br /&gt;
means that the students mark a 7 digit number on the answer form. A concatenation of the letter &#039;a&#039; and that number denotes the &#039;username&#039; of the user in Moodle&#039;s &#039;user&#039; table.&lt;br /&gt;
 &lt;br /&gt;
A formula &lt;br /&gt;
        b[5]cd=idnumber &lt;br /&gt;
means that the students mark a 5 digit number on the answer form. A concatenation of the letter &#039;b&#039;, the marked number,  and the string &#039;cd&#039; denotes the &#039;idnumber&#039; of the user in Moodle&#039;s &#039;user&#039; table.&lt;br /&gt;
&lt;br /&gt;
==Admin settings==&lt;br /&gt;
&lt;br /&gt;
As an administrator you can set the default values instance-wide on the settings page for administrators in the MC Offline quiz module.&lt;br /&gt;
&lt;br /&gt;
* formula for participant identification (text field)&lt;br /&gt;
* mix questions (checkbox)&lt;br /&gt;
* mix answers (checkbox)&lt;br /&gt;
* logo URL (text field)&lt;br /&gt;
* copyright indication (checkbox)&lt;br /&gt;
* settings for exam inspection (checkbox)&lt;br /&gt;
* decimal places (drop down)&lt;br /&gt;
* paper&#039;s white level (drop down)&lt;br /&gt;
* 1-click inscription (checkbox)&lt;br /&gt;
* role for inscription (drop down)&lt;br /&gt;
* saving days (text field)&lt;br /&gt;
&lt;br /&gt;
==Screenshot of the module==&lt;br /&gt;
[[File:Offline_quiz_screenshot.png|600px]]&lt;br /&gt;
&lt;br /&gt;
===Contact===&lt;br /&gt;
In case you have any questions regarding this module you can either contact the author of the module (zimmerj7@univie.ac.at) or the e-learning support of the University of Vienna (e-support.zid@univie.ac.at).&lt;br /&gt;
&lt;br /&gt;
===See also===&lt;br /&gt;
This information was copied from http://www.academic-moodle-cooperation.org/en/modules/offline-quiz/ &lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
[[Category:AMC Academic Moodle Cooperation]]&lt;br /&gt;
&lt;br /&gt;
[[es:Actividad de examen fuera-de-línea]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Search_and_replace_tool&amp;diff=129660</id>
		<title>Search and replace tool</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Search_and_replace_tool&amp;diff=129660"/>
		<updated>2017-12-12T12:10:22Z</updated>

		<summary type="html">&lt;p&gt;Fox: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Admin tools}}&lt;br /&gt;
Admins can search and replace text e.g. URLs in their Moodle database using the search and replace tool at &amp;lt;nowiki&amp;gt;http://yourmoodlesite.org/admin/tool/replace/index.php&amp;lt;/nowiki&amp;gt; (replacing yourmoodlesite.org with the address of your Moodle site). This is useful when a [[Moodle migration|Moodle site is moved from one server to another]] or when the URL changes.&lt;br /&gt;
&lt;br /&gt;
Alternatively, a command line script can be used to search and replace text. See [[Administration via command line]] for details.&lt;br /&gt;
&lt;br /&gt;
{{Warning|A database backup should be created before performing a search and replace.}}&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Tracker issue MDL-35099 Convert hidden search/replace script into a proper core admin tool&lt;br /&gt;
&lt;br /&gt;
[[es:Herramienta para buscar y remplazar]]&lt;br /&gt;
[[fr: Recherche et remplacement]]&lt;br /&gt;
[[de:Datenbank-Suche]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Moodle_migration&amp;diff=129659</id>
		<title>Moodle migration</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Moodle_migration&amp;diff=129659"/>
		<updated>2017-12-12T10:50:46Z</updated>

		<summary type="html">&lt;p&gt;Fox: Typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
There may be times when you need to move your Moodle site from one server to another. For example, moving a Moodle site from shared hosting service&#039;s server to a dedicated server.&lt;br /&gt;
&lt;br /&gt;
==Recommended method==&lt;br /&gt;
&lt;br /&gt;
This involves moving a whole site from one server to another. If you are changing the domain/IP address to the new server you need to do these steps:&lt;br /&gt;
&lt;br /&gt;
===Turn on maintenance mode===&lt;br /&gt;
&lt;br /&gt;
Place your current Moodle site into [[Maintenance mode]] via &#039;&#039;Site Administration &amp;gt; Server &amp;gt; Maintenance Mode&#039;&#039; to prevent any further additions to the Moodle database. Don&#039;t let administrators login during the migration as they are not affected by the maintenance mode setting.&lt;br /&gt;
&lt;br /&gt;
===Backup the Moodle database on the old sever===&lt;br /&gt;
&lt;br /&gt;
The right way to back up your database depends on which database system you are using. The instructions below are one way to back up a MySQL database. Another option would be to use a tool like phpMyAdmin to manually make a backup. The documentation for your database will give more options. There are many ways to do such backups. Here is an outline of a little script you can run from command line on Unix to backup the database:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cd /my/backup/directory&lt;br /&gt;
mv moodle-database.sql.gz moodle-database-old.sql.gz&lt;br /&gt;
mysqldump -h example.com -u myusername -p&#039;mypassword&#039; -C -Q -e --create-options mydatabasename &amp;gt; moodle-database.sql&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
If you only write &amp;quot;-p&amp;quot; without your password, you will be prompted for it.&lt;br /&gt;
&lt;br /&gt;
=== Restore the database backup to the new server ===&lt;br /&gt;
&lt;br /&gt;
Copy the database back up files to the new server and restore into the new database server.&lt;br /&gt;
&lt;br /&gt;
Once you have created the new database on the new server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;mysql -p new_database &amp;lt; moodle-database.sql&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For other databases, follow their instructions for restoring a backup. &lt;br /&gt;
&lt;br /&gt;
===Copy moodledata from the old server to the new server===&lt;br /&gt;
&lt;br /&gt;
Copy the contents of your data directory (check for the value in &amp;lt;code&amp;gt;$CFG-&amp;gt;dataroot&amp;lt;/code&amp;gt;) to the new server. This can be a lot of data, so consider using a good data copying tool like rsync. If using an FTP client, the transfer of the &amp;lt;code&amp;gt;filedir&amp;lt;/code&amp;gt; folder must be in &#039;&#039;&#039;BINARY&#039;&#039;&#039; mode or the files will get corrupted in the process.&lt;br /&gt;
&lt;br /&gt;
Check the file permissions of the copied files. The web server needs read and write access.&lt;br /&gt;
&lt;br /&gt;
===Copy the Moodle code from the old server to the new server===&lt;br /&gt;
&lt;br /&gt;
You will need to copy the Moodle code itself to the new server (this is the Moodle folder found in your webroot folder e.g. /var/www or public_html). &lt;br /&gt;
&lt;br /&gt;
Check the file permissions of the copied files. The web server needs read access.&lt;br /&gt;
&lt;br /&gt;
===Update config.php with the URL of the new server===&lt;br /&gt;
&lt;br /&gt;
If the migration will move Moodle to a new URL, then update $CFG-&amp;gt;wwwroot in config.php to point to the new location.&lt;br /&gt;
&lt;br /&gt;
Also check the other properties there. Is the path $CFG-&amp;gt;moodledata still correct? Do the database connection settings need to be changed?&lt;br /&gt;
&lt;br /&gt;
===Test the copied site===&lt;br /&gt;
&lt;br /&gt;
You should now be able to log into the new site as admin, and verify that most things are working.&lt;br /&gt;
&lt;br /&gt;
===Update links containing wwwroot in the database===&lt;br /&gt;
&lt;br /&gt;
The one thing we have not fixed is any internal links stored in the database. To fix these use the [[Search and replace tool]] buy going to {wwwroot}/admin/tool/replace/index.php.&lt;br /&gt;
&lt;br /&gt;
Enter the url for your old server (&amp;lt;nowiki&amp;gt;http://oldserver.com/&amp;lt;/nowiki&amp;gt;) and new server (&amp;lt;nowiki&amp;gt;http://newserver.com/&amp;lt;/nowiki&amp;gt;) and it will fix any links stored in the database.&lt;br /&gt;
&lt;br /&gt;
===Take the site out of maintenance mode===&lt;br /&gt;
&lt;br /&gt;
Test the migration some more, then when you are satisfied, remember to take the site out of maintenance mode.&lt;br /&gt;
&lt;br /&gt;
==Quick and hacky method==&lt;br /&gt;
&lt;br /&gt;
If you have shell access on both servers, here is a quick command-line based method.&lt;br /&gt;
&lt;br /&gt;
*Set up a new empty database on the &#039;&#039;&#039;new&#039;&#039;&#039; server.&lt;br /&gt;
*Place your existing Moodle site into maintenance mode.&lt;br /&gt;
*Login to shell on the &#039;&#039;&#039;old&#039;&#039;&#039; existing server.&lt;br /&gt;
*Use rsync to copy &#039;&#039;&#039;moodledata&#039;&#039;&#039; and &#039;&#039;&#039;public_html&#039;&#039;&#039; or &#039;&#039;&#039;moodle&#039;&#039;&#039; folders (or whatever directory your Moodle install is in) to the new server - execute (replacing caps with your details; SOURCE = the directory you want to copy) for each directory:&lt;br /&gt;
::&amp;lt;code&amp;gt;rsync -av -e ssh SOURCE/ USERNAME@NEW_SERVER.COM:/PATH/TO/DESTINATION/&amp;lt;/code&amp;gt;&lt;br /&gt;
*Dump existing database and move and import into database on new server by executing:&lt;br /&gt;
::&amp;lt;code&amp;gt;mysqldump --allow-keywords --opt -uMySQL_USERNAME -pPASSWORD DATABASE | ssh USER@DOMAIN &amp;quot;mysql -uMySQL_USERNAME -pPASSWORD DATABASE&amp;quot;&amp;lt;/code&amp;gt;&lt;br /&gt;
*Replace any links in the database that contin the full site URL:&lt;br /&gt;
::&amp;lt;code&amp;gt;#sed -e &#039;s/oldserver.com/newserver.com/g&#039; oldmysqldump.sql &amp;gt; newmysqldump.sql&amp;lt;/code&amp;gt;&lt;br /&gt;
*On the &#039;&#039;&#039;new server&#039;&#039;&#039;, update &#039;&#039;&#039;config.php&#039;&#039;&#039; with relevant details where applicable (e.g. database name and user details, the wwwroot and the dataroot).&lt;br /&gt;
*Check ownership and permissions are correct on both moodle code and moodledata directories.&lt;br /&gt;
*Make sure everything is working.&lt;br /&gt;
&lt;br /&gt;
Takes about 15 minutes for a small site.  However, transferring several Gigabytes of data for a larger site can take hours depending on your network connection and hard drive read/write speed.&lt;br /&gt;
&lt;br /&gt;
When you are happy all has gone well, set up redirects/make DNS changes if required, take new site out of maintenance mode and &amp;quot;switch off&amp;quot; old site. &lt;br /&gt;
&lt;br /&gt;
*If you are switching the ip address from the old server to the new one, you will need to turn off the old server before firing up the new one to avoid ip addressing conflicts and confusion!&lt;br /&gt;
&lt;br /&gt;
==Other considerations==&lt;br /&gt;
&lt;br /&gt;
===Upgrade Moodle at the same time?===&lt;br /&gt;
&lt;br /&gt;
While doing the work of migrating Moodle, you might want to [[Upgrading | upgrade Moodle]] to the latest version at the same time. On the other hand, if you do that, and something breaks, you won&#039;t be sure which change caused the problem, so the more cautious approach is to change one thing at a time, and test in between to verify that all is well.&lt;br /&gt;
&lt;br /&gt;
===DNS &amp;amp; masquerading changes===&lt;br /&gt;
&lt;br /&gt;
You may have had to change the DNS entries for the new Moodle site. If you have done so, it will take some time for the changes to replicate, so be patient. If your server is located behind a firewall, you may also have to change your firewall rules to allow access to the new server. See the [[Masquerading | masquerading docs]].&lt;br /&gt;
&lt;br /&gt;
===Internal and external access===&lt;br /&gt;
&lt;br /&gt;
If you have a set up where your Moodle site can be accessed via a network and via the internet, ensure you check that the new site can be accessed internally and externally.&lt;br /&gt;
&lt;br /&gt;
===ReCAPTURE===&lt;br /&gt;
If you migrate to a new domain and have setup [[Email-based_self-registration]], you need to create new API-Keys at google. You will find the explanation and links to google  in [[Email-based_self-registration]].&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Site backup]]&lt;br /&gt;
* [[Site restore]]&lt;br /&gt;
* [[Backup and restore FAQ]]&lt;br /&gt;
&lt;br /&gt;
==Any questions?==&lt;br /&gt;
&lt;br /&gt;
Please post in the [http://moodle.org/mod/forum/view.php?id=28 Installing and upgrading help forum] on moodle.org&lt;br /&gt;
&lt;br /&gt;
[[es:Migración de Moodle]]&lt;br /&gt;
[[fr:Migration de Moodle]]&lt;br /&gt;
[[ja:Moodle移行]]&lt;br /&gt;
[[de:Moodle-Migration]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Standard_Moodle_tags&amp;diff=129635</id>
		<title>Standard Moodle tags</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Standard_Moodle_tags&amp;diff=129635"/>
		<updated>2017-12-11T09:00:26Z</updated>

		<summary type="html">&lt;p&gt;Fox: /* Tags in use */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Tags are useful for connecting different bits of information together.&lt;br /&gt;
&lt;br /&gt;
Obviously it&#039;s important to use the same tags everywhere.&lt;br /&gt;
&lt;br /&gt;
This page describes standard Moodle tags that you should use when describing Moodle events on the internet (Flickr, Twitter, Facebook, del.icio.us etc)&lt;br /&gt;
&lt;br /&gt;
==General Moodle stuff==&lt;br /&gt;
&lt;br /&gt;
For general discussion of Moodle, use the tag &amp;quot;moodle&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Twitter example:&lt;br /&gt;
 I just installed #moodle on a computer I bought ten years ago!&lt;br /&gt;
&lt;br /&gt;
==Moodle Moots==&lt;br /&gt;
&lt;br /&gt;
For Moodle conferences (Moots) use mootCCYY where:&lt;br /&gt;
* CC is a country ISO code or state abbreviation, and&lt;br /&gt;
* YY is a year.&lt;br /&gt;
&lt;br /&gt;
 mootAU09&lt;br /&gt;
&lt;br /&gt;
Capitalisation doesn&#039;t matter and just helps readability.&lt;br /&gt;
&lt;br /&gt;
The two letter code would usually be a country, but for somewhere like the US where there are different moots they might choose to use &amp;quot;us&amp;quot; or a state like &amp;quot;sf&amp;quot; or &amp;quot;ok&amp;quot;. It really doesn&#039;t matter if two moots both used mootus09 for example, because they would be separated in time.&lt;br /&gt;
&lt;br /&gt;
==Tags in use==&lt;br /&gt;
&lt;br /&gt;
* #mooteu09 MoodleMoot Euskadi&lt;br /&gt;
* #mootNL09 Amsterdam Moodlemoot&lt;br /&gt;
* #mootUS09ok Moodlemoot Oklahoma  (or #mootok09)&lt;br /&gt;
* #mootUS09SF Moodlemoot San Francisco  (or #mootsf09)&lt;br /&gt;
* #mootin09 Goshen Midwest MoodleMoot&lt;br /&gt;
* #mootus09ny MoodleMoot Delhi (or #mootny09) &lt;br /&gt;
* #mootar09 MoodleMoot Argentina&lt;br /&gt;
* #mootat09 MoodleMoot Austria &lt;br /&gt;
* #mootDE09 MoodleMoot Germany 2009&lt;br /&gt;
* #mootco09 MoodleMoot Colombia&lt;br /&gt;
* #mootcl09 MoodleMoot Chile&lt;br /&gt;
* #mootes09 MoodleMoot Spain 2009&lt;br /&gt;
* #moodle #OE09 Moodle at Online Educa 2009 in Berlin (December)&lt;br /&gt;
* #moodledev09 [[Development:Czech Hackfest 2009|Czech Hackfest 2009]]&lt;br /&gt;
* #imoot and #imoot2010 iMoot 2010&lt;br /&gt;
* #mootJP10hk Moodlemoot Japan in Hakodate, February 2010&lt;br /&gt;
* #mootDE10b Moodlemoot Germany 2010 in Berlin March&lt;br /&gt;
* #mootDE10e [http://moodle2010.de/ Moodlemoot Germany 2010 in Essen] 16-17 September 2010&lt;br /&gt;
* #mootNZ10 Moodle Moot New Zealand (Christchurch) April 2010&lt;br /&gt;
* #mootUK10 MoodleMoot UK April 2010&lt;br /&gt;
* #mootsi10 Slovenian MoodleMoot&lt;br /&gt;
* #mootok10 MoodleMoot Oklahoma&lt;br /&gt;
* #mootau10 MoodleMoot AU 2010&lt;br /&gt;
* #mootcz10 [http://www.moodlemoot.cz/ MoodleMoot Czech Republic, Brno] 10-11 June 2010&lt;br /&gt;
* #mootfr10 6th French MoodleMoot&lt;br /&gt;
* #mootIT10 MoodleMoot Italia 2010&lt;br /&gt;
* #mootnl10 MoodleMoot NL 2010&lt;br /&gt;
* #mootPL10 Second Polish MoodleMoot, 4-5 November 2010, Czestochowa, Poland, http://moodlemoot.pl&lt;br /&gt;
* #mootusin10 Goshen, Indiana, USA 26-28 July, 2010&lt;br /&gt;
* #mootustx10 Austin, Texas, USA 2-3 August, 2010&lt;br /&gt;
* #mootfr11 [http://moodlemoot2011.uvt.rnu.tn/ 7th French MoodleMoot], Hammamet, Tunisia, 27-29 June 2011&lt;br /&gt;
* #mootde12 [http://moodlemoot.de/ German Moodlemoot], Münster, Germany, 13-16 March 2012&lt;br /&gt;
* #mootfr12 [http://moodlemoot2012.unimes.fr/ 8th French MoodleMoot], Nîmes, France, 20-22 June 2012&lt;br /&gt;
* #mootde13 [http://moodlemoot.de/ German Moodlemoot], München, Germany, 28 Feb - 1 Mar 2013&lt;br /&gt;
* #mootfr13 [http://moodlemoot2013.univ-bordeaux.fr/ 9th French MoodleMoot], Bordeaux, France, 5-7 June 2013&lt;br /&gt;
* #smootau13 [http://http://school.moodlemoot.com.au/ 2nd Australian Schoolmoot], Sydney, Australia, 2-4 October 2013&lt;br /&gt;
* #mootfr14 [http://moodlemoot2014.univ-paris3.fr 10th French MoodleMoot], Paris, 4-6 June 2014&lt;br /&gt;
* #mootfr15 [https://moodlemoot2015.univ-tours.fr 11th French MoodleMoot], Tours, 10-12 June 2015&lt;br /&gt;
* #mootfr16 [http://2016.moodlemoot.fr 12th French MoodleMoot], Sierre, Switzerland, 6-8 July 2016&lt;br /&gt;
* #mootfr17 [http://2017.moodlemoot.fr 13th French MoodleMoot], Lyon, 28-30 June 2017&lt;br /&gt;
* #mootfr18 [https://2018.moodlemoot.fr 14th French MoodleMoot], Bruxelles, 4-6 July 2018&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Lounge discussion [http://moodle.org/mod/forum/discuss.php?d=121619 A standard naming scheme for Moodle hashtags]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Talk:New_features&amp;diff=129143</id>
		<title>Talk:New features</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Talk:New_features&amp;diff=129143"/>
		<updated>2017-11-03T14:06:50Z</updated>

		<summary type="html">&lt;p&gt;Fox: Please update interlanguage link to 3.4&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi,&lt;br /&gt;
Can you please change  [[es:Nuevas características de Moodle 3.3]] to [[es:Nuevas características de Moodle 3.4]] for this 3.4 version page ?&lt;br /&gt;
And I guess the French link also, Thanks in advance. :) [[User:German Valero|German Valero]] ([[User talk:German Valero|talk]])&lt;br /&gt;
&lt;br /&gt;
  Hi,&lt;br /&gt;
  Yes, please do it so. I was about to ask the same (or opposite ?) thing ;-) --[[User:Séverin Terrier|Séverin Terrier]] ([[User talk:Séverin Terrier|talk]]) 14:06, 3 November 2017 (UTC)&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=User:S%C3%A9verin_Terrier&amp;diff=128871</id>
		<title>User:Séverin Terrier</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=User:S%C3%A9verin_Terrier&amp;diff=128871"/>
		<updated>2017-09-22T08:59:14Z</updated>

		<summary type="html">&lt;p&gt;Fox: https link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Working in [http://www.ut-capitole.fr Université Toulouse 1 Capitole], i&#039;m administrator of several Moodle sites.&lt;br /&gt;
&lt;br /&gt;
In Moodle community, i :&lt;br /&gt;
* assist [[User:Nicolas Martignoni|Nicolas Martignoni]] for [https://moodle.org/course/view.php?id=20 Moodle en français].&lt;br /&gt;
* try to improve the [[:fr:|french Moodle documentation]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Utilisateur:Séverin Terrier]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Boost_Campus_theme&amp;diff=128859</id>
		<title>Boost Campus theme</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Boost_Campus_theme&amp;diff=128859"/>
		<updated>2017-09-19T09:41:38Z</updated>

		<summary type="html">&lt;p&gt;Fox: RTL as title&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Themes}}&lt;br /&gt;
{{Infobox plugin&lt;br /&gt;
|type = Theme &lt;br /&gt;
|entry = https://moodle.org/plugins/theme_boost_campus&lt;br /&gt;
|tracker = https://github.com/moodleuulm/moodle-theme_boost_campus/issues&lt;br /&gt;
|discussion = https://github.com/moodleuulm/moodle-theme_boost_campus&lt;br /&gt;
|maintainer = [[User:Ulm University|Ulm University]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Note|You can find the most up-to-date English  documentation for this plugin in the Ulm University&#039;s Github address at https://github.com/moodleuulm/moodle-theme_boost_campus/.}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
Moodle Boost child theme which is intended to meet the needs of university campuses and adds several features and improvements&lt;br /&gt;
&lt;br /&gt;
==Images==&lt;br /&gt;
&lt;br /&gt;
[[File:Boost Campus screen 1 .png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Boost Campus screen 2 .png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Boost Campus screen 3.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Boost Campus screen 4.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
This plugin requires Moodle 3.2+&lt;br /&gt;
&lt;br /&gt;
==Motivation for this theme==&lt;br /&gt;
Moodle installations on university campuses have certain constraints which are not completely covered by the Boost theme in Moodle core. We implemented this Boost child theme to accommodate these needs as much as possible while keeping the functionality from Boost from Moodle core as much as possible as well.&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
Install the plugin like any other theme to folder /theme/boost_campus&lt;br /&gt;
&lt;br /&gt;
See [[Installing plugins]] for details on installing Moodle plugins&lt;br /&gt;
&lt;br /&gt;
==Usage &amp;amp; Settings==&lt;br /&gt;
&lt;br /&gt;
After installing the theme, it does not do anything to Moodle yet.&lt;br /&gt;
&lt;br /&gt;
To configure the theme and its behaviour, please visit: Site administration ►Appearance ►Themes ►Boost Campus.&lt;br /&gt;
&lt;br /&gt;
There, you find multiple settings tabs:&lt;br /&gt;
==1. Tab &amp;quot;General Settings&amp;quot;==&lt;br /&gt;
&lt;br /&gt;
In this tab there are the following settings:&lt;br /&gt;
===Theme presets===&lt;br /&gt;
Theme preset&lt;br /&gt;
&lt;br /&gt;
This setting is already available in the Moodle core theme Boost. For more information how to use it, please have a look at the official Moodle documentation: [[Boost theme]]&lt;br /&gt;
&lt;br /&gt;
===Additional theme preset files===&lt;br /&gt;
&lt;br /&gt;
This setting is already available in the Moodle core theme Boost. For more information how to use it, please have a look at the official Moodle documentation: [[Boost theme]]&lt;br /&gt;
&lt;br /&gt;
===Brand colors===&lt;br /&gt;
Brand color&lt;br /&gt;
&lt;br /&gt;
This setting is already available in the Moodle core theme Boost. For more information how to use it, please have a look at the official Moodle documentation: [[Boost theme]]&lt;br /&gt;
&lt;br /&gt;
===Brand success color===&lt;br /&gt;
&lt;br /&gt;
This color is used for example in regards to form valiations.&lt;br /&gt;
&lt;br /&gt;
===Brand info color===&lt;br /&gt;
&lt;br /&gt;
This color is used for example for availabiity information of course activities or resources.&lt;br /&gt;
Brand warning color&lt;br /&gt;
&lt;br /&gt;
This color is used for example for warning texts.&lt;br /&gt;
&lt;br /&gt;
===Brand danger color===&lt;br /&gt;
&lt;br /&gt;
This color is used for example in regards to form valiations.&lt;br /&gt;
&lt;br /&gt;
===Favicon===&lt;br /&gt;
&lt;br /&gt;
This setting allows you to upload an image (.ico or .png format) that your browser will display as a favicon.&lt;br /&gt;
&lt;br /&gt;
==2. Tab &amp;quot;Advanced Settings&amp;quot;==&lt;br /&gt;
&lt;br /&gt;
In this tab there are the following settings:&lt;br /&gt;
&lt;br /&gt;
===Raw initial SCSS===&lt;br /&gt;
&lt;br /&gt;
This setting is already available in the Moodle core theme Boost. For more information how to use it, please have a look at the official Moodle documentation: [[Boost theme]]&lt;br /&gt;
&lt;br /&gt;
===Raw SCSS===&lt;br /&gt;
&lt;br /&gt;
This setting is already available in the Moodle core theme Boost. For more information how to use it, please have a look at the official Moodle documentation: [[Boost theme]]&lt;br /&gt;
&lt;br /&gt;
===Catch keyboard commands===&lt;br /&gt;
&lt;br /&gt;
The following settings are intended to serve the needs for advanced users, especially if your Moodle instance has a large footer. Advanced users are likely to use keyboard shortcuts to navigate through the sites. They may use this for reaching the end of the page in the intention to get fast to the most recent topic in the course (for adding content or grading latest activities). If the footer is not quite small, they would need to scroll up again. With these settings you can enable that the following shortcuts are caught and would only scroll to the bottom of the main course content.&lt;br /&gt;
&lt;br /&gt;
===End key===&lt;br /&gt;
&lt;br /&gt;
This setting will catch the &amp;quot;End&amp;quot; key (should work on all main browsers and operating systems), prevent the default scrolling to the bottom of the web page and changes the behavior to scroll only to the bottom of the main course content.&lt;br /&gt;
&lt;br /&gt;
===Cmd + Arrow down shortcut===&lt;br /&gt;
&lt;br /&gt;
This setting will catch the &amp;quot;Cmd + Arrow down&amp;quot; shortcut (MAC), prevent the default scrolling to the bottom of the web page and changes the behavior to scroll only to the bottom of the main course content.&lt;br /&gt;
&lt;br /&gt;
===Ctrl + Arrow down shortcut===&lt;br /&gt;
&lt;br /&gt;
This setting will catch the &amp;quot;Ctrl + Arrow down&amp;quot; shortcut (Windows), prevent the default scrolling to the bottom of the web page and changes the behavior to scroll only to the bottom of the main course content.&lt;br /&gt;
&lt;br /&gt;
==3. Tab &amp;quot;Course Layout Settings&amp;quot;==&lt;br /&gt;
===Section 0: Title===&lt;br /&gt;
&lt;br /&gt;
This setting can change the behaviour Moodle displays the title for the first course section. Moodle does not display it as long as the default title for this section is set. As soon as a user changes the title, it will appear. With this setting (option is checked), you can achieve a consistent behaviour by always showing the title for section 0.&lt;br /&gt;
&lt;br /&gt;
===Course edit button===&lt;br /&gt;
&lt;br /&gt;
With this setting you can add an additional course edit on / off button to the course header for faster accessibility. This the same way as it was displayed before theme_boost.&lt;br /&gt;
&lt;br /&gt;
===Position of switch role information===&lt;br /&gt;
&lt;br /&gt;
With this setting you can choose the place where the information to which role a user has switched is being displayed. If not checked (default value), the role information will be displayed right beneath the user&#039;s name in the user menu (like in theme Boost). If checked, this information - together with a link to switch back - will be displayed beneath the course, as this functionality is course related.&lt;br /&gt;
&lt;br /&gt;
===Course settings===&lt;br /&gt;
In course settings menu&lt;br /&gt;
&lt;br /&gt;
With this setting you can change the displaying of the course context menu. In Boost, there is a popup context menu right next to the cog icon and clicking on the &amp;quot;More...&amp;quot; menu item will lead the user to another page with all course settings. By enabling this setting the settings will occur directly beneath the course header. Please note that this change does not affect users who have switched off javascript in their browsers - they will still get the behaviour from Moodle core with a popup course context menu.&lt;br /&gt;
&lt;br /&gt;
===Move &amp;quot;Switch role to...&amp;quot; to the course settings===&lt;br /&gt;
&lt;br /&gt;
With this setting you can move the &amp;quot;Switch role to...&amp;quot; link as a new tab from the user menu to the in-course course menu. The role switching is a feature which is used in course context and thus it is better to place it in the course settings menu than in the user menu. Please note that this setting won&#039;t have any effect if you do not activate the &amp;quot;In course settings menu&amp;quot; above.&lt;br /&gt;
&lt;br /&gt;
==4. Tab &amp;quot;Footer Layout Settings&amp;quot;==&lt;br /&gt;
===Footer blocks===&lt;br /&gt;
&lt;br /&gt;
You can chose if you want to enable the possibility to place blocks into the footer. If enabled, you can choose between one, two or three block columns. These columns are only displayed on large screens. On small screens the columns will be automatically reduced to one column for better readability and layout.&lt;br /&gt;
&lt;br /&gt;
===Default footer links===&lt;br /&gt;
&lt;br /&gt;
Moodle provides some default links in the footer: Link to the Moodle docs, login information, and a link to the webpage start. With these three settings you can decide if you want to hide specific links because you think that your users won&#039;t need them in your instance. If checked, the link will not be displayed in the footer. If not checked (default), it will be shown.&lt;br /&gt;
&lt;br /&gt;
==5. Tab &amp;quot;Additional Layout Settings&amp;quot;==&lt;br /&gt;
===Badgearea===&lt;br /&gt;
Badge area items&lt;br /&gt;
&lt;br /&gt;
With this widget you can upload your images that will be displayed in the additional badge area region. The images will be sorted and displayed alphabetically by the filename. To remove this region, simply delete all uploaded images.&lt;br /&gt;
===Badge area item links===&lt;br /&gt;
&lt;br /&gt;
With this optional setting you can add links to your uploaded images. Each line consists of the file identifier (the file name) the a link URL, separated by pipe characters. Each link declaration needs to be written in a new line. For example: moodle.jpg|http://moodle.org You can declare links for a abitrary amount of your uploaded images. The links will be added only to those badges that match their filename with the identifier declared in this setting.&lt;br /&gt;
===Badge area items maximal height===&lt;br /&gt;
&lt;br /&gt;
With this setting you can change the height in pixels for your uploaded badges. All images will have the same maximum height and their width will be resized proportionally. The default value is set to 100 pixels.&lt;br /&gt;
===Footnote===&lt;br /&gt;
&lt;br /&gt;
Whatever you add to this textarea will be displayed beneath the footer on every page that renders the theme standard footer (for layouts &amp;quot;columns2&amp;quot;, &amp;quot;login&amp;quot; and &amp;quot;maintenance&amp;quot;). Content in this area could be for example the copyright, the terms of use and the name of your organisation.&lt;br /&gt;
===Nav drawer menu===&lt;br /&gt;
Default homepage on top&lt;br /&gt;
&lt;br /&gt;
By checking this setting the default homepage link (Dashboard or Site home) will always be located at the top of the nav drawer. By default, this is already the case on every Moodle page except for course pages. There, the current course and its contents are placed on top. This might break user&#039;s expectations for the placement of the default homepage link.&lt;br /&gt;
&lt;br /&gt;
==6. Tab &amp;quot;Design Settings&amp;quot;==&lt;br /&gt;
===Login Page===&lt;br /&gt;
Login page background images&lt;br /&gt;
&lt;br /&gt;
In this setting you can add up to 10 files as a background image for the login page. One of these images will be picked randomly and delivered when the user visits the login page.&lt;br /&gt;
===Login form===&lt;br /&gt;
&lt;br /&gt;
With this setting you can optimize the login form to fit to a greater variety background images (if checked). This means that the login form will be moved to the left of the login page, will get smaller in width and will get a background that let the background image shine through. The login form will be placed on the left because many images have their main content rather in the center and so we keep this content visible. Note: You can also activate this setting if no background images are uploaded, of course.&lt;br /&gt;
===Fonts===&lt;br /&gt;
Font files&lt;br /&gt;
&lt;br /&gt;
With this dialogue you can upload own font files. The upload is resricted to the font files of type .eot, .woff, .woff2, .ttf and .svg.&lt;br /&gt;
&lt;br /&gt;
Important: To be able to use the uploaded fonts within this theme, you have to add related code to your &amp;quot;Raw SCSS&amp;quot; area in the tab &amp;quot;Advanced Settings&amp;quot;! First you have to add all font-faces correctly and then you can set the font as font-family to any tag. Set it for the body tag to use it all over the instance. With the following expamle you can see how the SCSS code should look like. Of course you have to adapt it for your individual font and the number and type of uploaded files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code css&amp;gt; /* your-font-regular - latin */&lt;br /&gt;
@font-face {&lt;br /&gt;
        font-family: &amp;quot;Your Font&amp;quot;;&lt;br /&gt;
        font-style: normal;&lt;br /&gt;
        font-weight: 400;&lt;br /&gt;
        /* IE9 Compat Modes */&lt;br /&gt;
        src: url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-regular.eot&amp;quot;);&lt;br /&gt;
        src: local(&amp;quot;Your Font&amp;quot;), local(&amp;quot;YourFont-Regular&amp;quot;),&lt;br /&gt;
               /* IE6-IE8 */&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-regular.eot?#iefix&amp;quot;) format(&amp;quot;embedded-opentype&amp;quot;),&lt;br /&gt;
                /* Super Modern Browsers */&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-regular.woff2&amp;quot;) format(&amp;quot;woff2&amp;quot;),&lt;br /&gt;
                /* Modern Browsers */&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-regular.woff&amp;quot;) format(&amp;quot;woff&amp;quot;),&lt;br /&gt;
                /* Safari, Android, iOS */&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-regular.ttf&amp;quot;) format(&amp;quot;truetype&amp;quot;),&lt;br /&gt;
                /* Legacy iOS */&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-regular.svg#YourFont&amp;quot;) format(&amp;quot;svg&amp;quot;);&lt;br /&gt;
\}&lt;br /&gt;
/* your-font-italic - latin */&lt;br /&gt;
@font-face {&lt;br /&gt;
        font-family: &amp;quot;Your Font&amp;quot;;&lt;br /&gt;
        font-style: italic;&lt;br /&gt;
        font-weight: 400;&lt;br /&gt;
        src: url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-italic.eot&amp;quot;);&lt;br /&gt;
        src: local(&amp;quot;Your Font Italic&amp;quot;), local(&amp;quot;YourFont-Italic&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-italic.eot?#iefix&amp;quot;) format(&amp;quot;embedded-opentype&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-italic.woff2&amp;quot;) format(&amp;quot;woff2&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-italic.woff&amp;quot;) format(&amp;quot;woff&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-italic.ttf&amp;quot;) format(&amp;quot;truetype&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-italic.svg#YourFont&amp;quot;) format(&amp;quot;svg&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
/* your-font-700 - latin */&lt;br /&gt;
@font-face {&lt;br /&gt;
        font-family: &amp;quot;Your Font&amp;quot;;&lt;br /&gt;
        font-style: normal;&lt;br /&gt;
        font-weight: 700;&lt;br /&gt;
        src: url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700.eot&amp;quot;);&lt;br /&gt;
        src: local(&amp;quot;Your Font Bold&amp;quot;), local(&amp;quot;YourFont-Bold&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700.eot?#iefix&amp;quot;) format(&amp;quot;embedded-opentype&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700.woff2&amp;quot;) format(&amp;quot;woff2&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700.woff&amp;quot;) format(&amp;quot;woff&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700.ttf&amp;quot;) format(&amp;quot;truetype&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700.svg#YourFont&amp;quot;) format(&amp;quot;svg&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
/* your-font-700italic - latin */&lt;br /&gt;
@font-face {&lt;br /&gt;
        font-family: &amp;quot;Your Font&amp;quot;;&lt;br /&gt;
        font-style: italic;&lt;br /&gt;
        font-weight: 700;&lt;br /&gt;
        src: url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700italic.eot&amp;quot;);&lt;br /&gt;
        src: local(&amp;quot;Your Font Bold Italic&amp;quot;), local(&amp;quot;YourFont-BoldItalic&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700-italic.eot?#iefix&amp;quot;) format(&amp;quot;embedded-opentype&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700-italic.woff2&amp;quot;) format(&amp;quot;woff2&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700-italic.woff&amp;quot;) format(&amp;quot;woff&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700-italic.ttf&amp;quot;) format(&amp;quot;truetype&amp;quot;),&lt;br /&gt;
                url(&amp;quot;/pluginfile.php/1/theme_boost_campus/fontfiles/0/your-font-latin-700-italic.svg#YourFont&amp;quot;) format(&amp;quot;svg&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
body {&lt;br /&gt;
        font-family: &amp;quot;Your Font&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note: The code itself and the URLs have to fit exactly to your uploaded files, unless the fonts cannot be loaded! As the font files will be delivered with an expires header to the client but currently without a timestamp in the URL, emptying the Moodle cache unfortunately will not force a reload of the font files on the client side.&lt;br /&gt;
===Blocks===&lt;br /&gt;
Block icon&lt;br /&gt;
&lt;br /&gt;
With this setting you can add a default Font Awesome icon in front of the block title. If checked, we additionally provide individual icon replacements for many Moodle core blocks and also some widely used blocks. You also can change the icons easily for each block individually in your raw SCSS via the change of the Font Awesome content. For all available icons please visit http://fontawesome.io/icons/ and use the Unicode value of the icon to replace the default one. The code to change the icon looks like this example change for the block &amp;quot;People&amp;quot;: .block_people .card-block .card-title::before { content: &#039;\f0c0&#039; ; }.&lt;br /&gt;
===Navbar===&lt;br /&gt;
Dark navbar&lt;br /&gt;
&lt;br /&gt;
By enabling this setting you can invert the default light navbar to a dark one with white links.&lt;br /&gt;
==Further improvements to Boost core theme==&lt;br /&gt;
&lt;br /&gt;
Apart from the features which can be configured in the theme&#039;s settings, we have added some more improvements which are simply there without any settings:&lt;br /&gt;
Font Awesome&lt;br /&gt;
&lt;br /&gt;
To be able to use icons provided by Font Awesome it is added to theme_boost_campus.&lt;br /&gt;
===Flat navigation (nav-drawer) menu===&lt;br /&gt;
&lt;br /&gt;
We improved the code of the new flatnavigation nay-drawer menu items to be uniformly. Furthermore, we improved the layout of the menu by styling borders, icons and margins. Now a user can recognize faster what items belong together to a parent node.&lt;br /&gt;
===Course settings icon===&lt;br /&gt;
&lt;br /&gt;
The course settings icon will now be displayed on all sites that renders the course header. This improves the accessibility to those settings as there is not a onmipresent block anymore.&lt;br /&gt;
===Back to top button===&lt;br /&gt;
&lt;br /&gt;
We added a back to top button that appears in the right bottom corner when the user scrolls down the page. With a click on it the page scrolls back to top smoothly and the button will disappear again.&lt;br /&gt;
&lt;br /&gt;
==Design==&lt;br /&gt;
&lt;br /&gt;
* Added Font Awesome icons to mailto and broken links. Furthermore, colored broken link in red for fast recognizability.&lt;br /&gt;
&lt;br /&gt;
===Course Design:===&lt;br /&gt;
&lt;br /&gt;
* Used the brand color as border color.&lt;br /&gt;
* Improved highlighting of a highlighted section.&lt;br /&gt;
* Improved recognisability of hidden activities by gray scaling the icon.&lt;br /&gt;
* Improved paddings and margins for better alignment and better delineation of sections.&lt;br /&gt;
* Designed description and intro boxes.&lt;br /&gt;
* Designed blockquotes.&lt;br /&gt;
* Improved design of maintenance warning to be more visible.&lt;br /&gt;
&lt;br /&gt;
===Categories overview page===&lt;br /&gt;
&lt;br /&gt;
Improved font sizes and weights on category overview page for better readability.&lt;br /&gt;
&lt;br /&gt;
==How this theme works==&lt;br /&gt;
&lt;br /&gt;
This Boost child theme is implemented with minimal code duplication in mind. It inherits / requires as much code as possible from theme_boost and only implements the extended or modified functionalities.&lt;br /&gt;
===Plugin repositories===&lt;br /&gt;
&lt;br /&gt;
This plugin is published and regularly updated in the Moodle plugins repository: http://moodle.org/plugins/view/theme_boost_campus&lt;br /&gt;
&lt;br /&gt;
The latest development version can be found on Github: https://github.com/moodleuulm/moodle-theme_boost_campus&lt;br /&gt;
==Bug and problem reports / Support requests==&lt;br /&gt;
&lt;br /&gt;
This plugin is carefully developed and thoroughly tested, but bugs and problems can always appear.&lt;br /&gt;
&lt;br /&gt;
Please report bugs and problems on Github: https://github.com/moodleuulm/moodle-theme_boost_campus/issues&lt;br /&gt;
&lt;br /&gt;
We will do our best to solve your problems, but please note that due to limited resources we can&#039;t always provide per-case support.&lt;br /&gt;
&lt;br /&gt;
==Feature proposals==&lt;br /&gt;
&lt;br /&gt;
Due to limited resources, the functionality of this plugin is primarily implemented for our own local needs and published as-is to the community. We are aware that members of the community will have other needs and would love to see them solved by this plugin.&lt;br /&gt;
&lt;br /&gt;
Please issue feature proposals on Github: https://github.com/moodleuulm/moodle-theme_boost_campus/issues&lt;br /&gt;
&lt;br /&gt;
Please create pull requests on Github: https://github.com/moodleuulm/moodle-theme_boost_campus/pulls&lt;br /&gt;
&lt;br /&gt;
We are always interested to read about your feature proposals or even get a pull request from you, but please accept that we can handle your issues only as feature proposals and not as feature requests.&lt;br /&gt;
&lt;br /&gt;
==Moodle release support==&lt;br /&gt;
&lt;br /&gt;
Due to limited resources, this plugin is only maintained for the most recent major release of Moodle. However, previous versions of this plugin which work in legacy major releases of Moodle are still available as-is without any further updates in the Moodle Plugins repository.&lt;br /&gt;
&lt;br /&gt;
There may be several weeks after a new major release of Moodle has been published until we can do a compatibility check and fix problems if necessary. If you encounter problems with a new major release of Moodle - or can confirm that this plugin still works with a new major relase - please let us know on Github.&lt;br /&gt;
&lt;br /&gt;
If you are running a legacy version of Moodle, but want or need to run the latest version of this plugin, you can get the latest version of the plugin, remove the line starting with $plugin-&amp;gt;requires from version.php and use this latest plugin version then on your legacy Moodle. However, please note that you will run this setup completely at your own risk. We can&#039;t support this approach in any way and there is a undeniable risk for erratic behavior.&lt;br /&gt;
&lt;br /&gt;
==Translating this plugin==&lt;br /&gt;
&lt;br /&gt;
This Moodle plugin is shipped with an English language pack only. All translations into other languages must be managed through [https://lang.moodle.org AMOS] by what they will become part of Moodle&#039;s official language pack.&lt;br /&gt;
&lt;br /&gt;
As the plugin creator, we manage the translation into German for our own local needs on  [https://lang.moodle.org AMOS]. Please contribute your translation into all other languages in  [https://lang.moodle.org AMOS]where they will be reviewed by the official language pack maintainers for Moodle.&lt;br /&gt;
&lt;br /&gt;
==Right-to-left support==&lt;br /&gt;
&lt;br /&gt;
This plugin has not been tested with Moodle&#039;s support for right-to-left (RTL) languages. If you want to use this plugin with a RTL language and it doesn&#039;t work as-is, you are free to send us a pull request on Github with modifications.&lt;br /&gt;
&lt;br /&gt;
==PHP7 Support==&lt;br /&gt;
&lt;br /&gt;
Since Moodle 3.0, Moodle core basically supports PHP7. Please note that PHP7 support is on our roadmap for this plugin, but it has not yet been thoroughly tested for PHP7 support and we are still running it in production on PHP5. If you encounter any success or failure with this plugin and PHP7, please let us know.&lt;br /&gt;
&lt;br /&gt;
==Copyright==&lt;br /&gt;
&lt;br /&gt;
Ulm University kiz - Media Department Team Web &amp;amp; Teaching Support Kathrin Osswald&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Tema Boost Campus]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=error/moodle/dmlreadexception&amp;diff=128182</id>
		<title>error/moodle/dmlreadexception</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=error/moodle/dmlreadexception&amp;diff=128182"/>
		<updated>2017-06-16T13:09:07Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This message was displayed because Moodle experienced a problem trying to read data from your Moodle database. &lt;br /&gt;
&lt;br /&gt;
To get more information about the error you should enable [[Debugging]] in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Development &amp;gt; Debugging&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Setting this debugging mode will cause Moodle to display detailed information about the problem and a stack trace. You can then use this information and try searching moodle.org and the Moodle tracker to find any other reports of the problem with suggested solutions, or if necessary create a new issue for it in the Tracker. The Moodle developers will then use this information to reproduce and debug the problem.&lt;br /&gt;
&lt;br /&gt;
After you have reported the problem reset the debugging level to the original state so that your users do not see the debugging messages.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Development:DML exceptions]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Error|Dmlreadexception]]&lt;br /&gt;
&lt;br /&gt;
[[es:error/moodle/dmlreadexception]]&lt;br /&gt;
[[fr:error/moodle/dmlreadexception]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=error/moodle/invalidrecord&amp;diff=128177</id>
		<title>error/moodle/invalidrecord</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=error/moodle/invalidrecord&amp;diff=128177"/>
		<updated>2017-06-14T12:59:31Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The message &#039;Can not find data record in database table&#039; is displayed when a forum post or other data has been deleted.&lt;br /&gt;
&lt;br /&gt;
If you have recently upgraded and obtain the message, try running [[Cron]] repeatedly until you see the message &amp;quot;Running clean-up tasks...&amp;quot; near the top of the output. See the  [https://moodle.org/mod/forum/discuss.php?d=199860 Can not find data record in database table context] discussion for further advice.&lt;br /&gt;
&lt;br /&gt;
[[Category:Error|Invalidrecord]]&lt;br /&gt;
&lt;br /&gt;
[[es:error/moodle/invalidrecord]]&lt;br /&gt;
[[fr:error/moodle/invalidrecord]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=error/moodle/dmlwriteexception&amp;diff=127167</id>
		<title>error/moodle/dmlwriteexception</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=error/moodle/dmlwriteexception&amp;diff=127167"/>
		<updated>2017-03-21T14:07:44Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This indicates that a general error occurred when Moodle tried to write to the database. If you turn on [[Debugging]] you will get more detailed information about what the problem is.&lt;br /&gt;
&lt;br /&gt;
==MySQL==&lt;br /&gt;
&lt;br /&gt;
If you&#039;re using a MySQL database for your Moodle installation, this error can be caused by the server&#039;s &amp;lt;code&amp;gt;max_allowed_packet&amp;lt;/code&amp;gt; size being configured incorrectly. [https://moodle.org/mod/forum/discuss.php?d=230681#p1001751 Increasing this value may resolve the issue.]&lt;br /&gt;
&lt;br /&gt;
==dmlwriteexception error when restoring a course==&lt;br /&gt;
&lt;br /&gt;
If you obtain a  dmlwriteexception error when restoring a course, it is recommended that InnoDB tables are converted to the Barracuda file format. See the section &#039;Converting InnoDB tables to Barracuda&#039; in [[Administration via command line]] for details of why this is recommended plus information on a tool for converting tables.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Development:DML exceptions]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Error|Dmlwriteexception]]&lt;br /&gt;
&lt;br /&gt;
[[es:error/moodle/dmlwriteexception]]&lt;br /&gt;
[[fr:error/moodle/dmlwriteexception]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Managing_tags&amp;diff=127128</id>
		<title>Managing tags</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Managing_tags&amp;diff=127128"/>
		<updated>2017-03-15T10:57:35Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Tags}}Tags can be managed by a site administrator or manager (or any other user with the capability [[Capabilities/moodle/tag:manage|moodle/tag:manage]]) in &#039;&#039;Site administration &amp;gt; Appearance &amp;gt; Manage tags&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Tag collections==&lt;br /&gt;
&lt;br /&gt;
Tag collections are a way to separate out tags by the type of objects the tags are attached to, or sets of tags for different areas. &lt;br /&gt;
&lt;br /&gt;
For example, a collection of standard tags can be used to tag courses, with user interests and blog post tags kept in a separate collection. When a user clicks on a tag, the tag page displays only items with that tag in the same collection including the same types of objects.&lt;br /&gt;
&lt;br /&gt;
Tags can be automatically added to a collection according to the area tagged or can be added manually as standard tags.&lt;br /&gt;
&lt;br /&gt;
Clicking on the name of a tag collection then displays the list of tags, together with information on their creators, how many times they are used, when they were last modified, which tags have been flagged as inappropriate and which tags are marked as standard. &lt;br /&gt;
&lt;br /&gt;
[[File:managestandardtags.png|thumb|center|600px|Accessing and managing tags]]&lt;br /&gt;
&lt;br /&gt;
Standard tags are tags which are added by a site administrator and are available for others to use.  Standard tags are never deleted during clean-up tasks even when there are no tagged items.&lt;br /&gt;
&lt;br /&gt;
===Adding a new collection===&lt;br /&gt;
&lt;br /&gt;
A new collection may be added by clicking the &#039;Add tag collection&#039; link and giving the new collection a name:&lt;br /&gt;
 &lt;br /&gt;
[[File:Tagcollections.png|thumb|center|600px|A new tag collection]]&lt;br /&gt;
&lt;br /&gt;
Tag areas may then be selected for this collection, by clicking the pencil icon of a particular tag area in the Tag collection column, and changing it from &#039;Default collection&#039; to the chosen, new collection:&lt;br /&gt;
&lt;br /&gt;
[[File:tagareaselect.png|center]]&lt;br /&gt;
&lt;br /&gt;
==Tag areas==&lt;br /&gt;
&lt;br /&gt;
Areas in which tags may be used, such as for activities and resources, and user interests, may be enabled or disabled as required. &lt;br /&gt;
&lt;br /&gt;
For example, if you don&#039;t intend to use course tags on your site, the courses tag area can be disabled so that the Tags section doesn&#039;t appear on the edit settings page for each course. If you have turned off Blogs at the system level, then you would usually turn off blog tagging too.&lt;br /&gt;
&lt;br /&gt;
==Managing a tag collection==&lt;br /&gt;
&lt;br /&gt;
*Tags which are flagged as inappropriate are indicated in red (colour may vary with non-standard theme).&lt;br /&gt;
*Tags may be renamed (inline, by clicking on the pencil icon next to them), marked as standard or reset. Tags may also be deleted individually or in bulk.&lt;br /&gt;
*Tags may be filtered by adding a term to the search box:&lt;br /&gt;
&lt;br /&gt;
[[File:tagsfiltering.png|thumb|600px|center|Tag search results]]&lt;br /&gt;
&lt;br /&gt;
===Combining tags===&lt;br /&gt;
&lt;br /&gt;
Tags with similar names may be combined by an administrator or manager by selecting them and then, from the bottom of the screen, clicking the &#039;Combine selected tags&#039;  button. A pop up will appear asking which name you want to keep, and clicking &#039;Continue&#039; will then combine the tags:&lt;br /&gt;
&lt;br /&gt;
[[File:combinetags.png]]&lt;br /&gt;
&lt;br /&gt;
[[cs:tag/manage]]&lt;br /&gt;
[[es:Gestión de marcas (tags)]]&lt;br /&gt;
[[eu:Etiketak kudeatu]]&lt;br /&gt;
[[fr:Gérer les tags]]&lt;br /&gt;
[[de:Schlagwörter verwalten]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=MySQL_full_unicode_support&amp;diff=127104</id>
		<title>MySQL full unicode support</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=MySQL_full_unicode_support&amp;diff=127104"/>
		<updated>2017-03-10T15:25:28Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Environment}}&lt;br /&gt;
==UTF-8==&lt;br /&gt;
&lt;br /&gt;
UTF-8 is a character encoding that most websites use. It encodes each of the 1,112,064 valid code points. To store all of this information, four bytes is required. The most popular values are in the three byte region. MySQL by default only uses a three byte encoding and so values in the four byte range can not be stored. Any record that contains a four byte character will not be saved.&lt;br /&gt;
&lt;br /&gt;
MySQL does support full UTF-8 support. It requires certain settings to be configured. From Moodle 3.3 the default will be to use full UTF-8 for MySQL and MariaDB. Existing databases will still run with partial support, but it is recommended to move over to full support.&lt;br /&gt;
&lt;br /&gt;
Moodle comes with a Command Line Interface (CLI) script for converting to full UTF-8 for MySQL (and MariaDB). Before Moodle 3.3 this conversion tool would only change the collation to some variant of &#039;utf8_bin&#039;. &#039;utf8_unicode_ci&#039; was the recommended collation. We now recommend &#039;utf8mb4_unicode_ci&#039;. &#039;utf8mb4_unicode_ci&#039; supports 4 byte characters (utf8_unicode_ci only supports 3 byte characters) so four byte characters such as Asian characters and emoji should now be fully supported.&lt;br /&gt;
&lt;br /&gt;
This script will attempt to change the database collation, character set, and default table settings.&lt;br /&gt;
&lt;br /&gt;
To summarise:&lt;br /&gt;
&lt;br /&gt;
* Fresh installs of Moodle 3.1.5 and 3.2.2 onwards will use utf8mb4 by default.&lt;br /&gt;
* Sites upgrading to Moodle 3.1.5 or 3.2.2 can use the script to update to utf8mb4. In Moodle 3.3 a warning will show that the database isn&#039;t using full UTF-8 support and suggest moving to utf8mb4, but you may choose to keep using utf8.&lt;br /&gt;
&lt;br /&gt;
===File format===&lt;br /&gt;
&lt;br /&gt;
To allow for large indexes on columns that are a varchar, a combination of settings needs to be set. The file format for the system needs to be using &amp;quot;Barracuda&amp;quot;. This allows for the row format to be set to &amp;quot;Compressed&amp;quot; or &amp;quot;Dynamic&amp;quot;. To enable this setting see the upgrade steps listed below.&lt;br /&gt;
&lt;br /&gt;
===File per table===&lt;br /&gt;
&lt;br /&gt;
To enable this setting see the upgrade steps listed below.&lt;br /&gt;
&lt;br /&gt;
===Large prefix===&lt;br /&gt;
&lt;br /&gt;
This in conjunction with the row format being either &amp;quot;Compressed&amp;quot; or &amp;quot;Dynamic&amp;quot; allows for large varchar indexes above 191 characters.&lt;br /&gt;
To enable this setting see the upgrade steps listed below.&lt;br /&gt;
&lt;br /&gt;
==Steps to upgrade==&lt;br /&gt;
&lt;br /&gt;
Most important: Please backup your database before making any changes or running the CLI script.&lt;br /&gt;
&lt;br /&gt;
* Change configuration settings for MySQL (exactly the same for MariaDB). This step is optional. You can run the script and it will try and make these changes itself. If errors occur then try manually changing these settings as listed below.&lt;br /&gt;
** On Linux based systems you will want to alter my.cnf. This may be located in &#039;/etc/mysql/&#039;.&lt;br /&gt;
** Make the following alterations to my.cnf:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
[client]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&lt;br /&gt;
[mysqld]&lt;br /&gt;
innodb_file_format = Barracuda&lt;br /&gt;
innodb_file_per_table = 1&lt;br /&gt;
innodb_large_prefix&lt;br /&gt;
&lt;br /&gt;
character-set-client-handshake = FALSE&lt;br /&gt;
character-set-server = utf8mb4&lt;br /&gt;
collation-server = utf8mb4_unicode_ci&lt;br /&gt;
&lt;br /&gt;
[mysql]&lt;br /&gt;
default-character-set = utf8mb4&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
* Restart your mysql server.&lt;br /&gt;
* Run the CLI script to convert to the new character set and collation (requires Moodle 3.1.5, 3.2.2 or newer): &#039;&#039;&#039;php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The upgrade is now complete.&lt;br /&gt;
&lt;br /&gt;
[[Category:Environment|UTF-8]]&lt;br /&gt;
[[Category:UTF-8]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:MySQL soporte unicode completo]]&lt;br /&gt;
[[fr:Support unicode complet pour MySQL]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Custom_SQL_queries_report&amp;diff=127045</id>
		<title>Custom SQL queries report</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Custom_SQL_queries_report&amp;diff=127045"/>
		<updated>2017-03-08T11:29:06Z</updated>

		<summary type="html">&lt;p&gt;Fox: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sitewide reports}}&lt;br /&gt;
Created by The Open University&lt;br /&gt;
&lt;br /&gt;
This admin report plugin allows Administrators to set up arbitrary database queries to act as ad-hoc reports. Reports can be of two types: either run on demand, or scheduled to run automatically. Other users with the right capability can go in and see a list of queries that they have access to. Results can be viewed on-screen or downloaded as CSV.&lt;br /&gt;
&lt;br /&gt;
==Installing this report==&lt;br /&gt;
&lt;br /&gt;
Follow the generic [[Installing plugins]] documentation.&lt;br /&gt;
&lt;br /&gt;
==Screen shots==&lt;br /&gt;
&lt;br /&gt;
Here are two example screen shots, showing the two main screens.&lt;br /&gt;
&lt;br /&gt;
[[Image:Custom_report_list.png|thumb|none|600px|The list of available reports]]&lt;br /&gt;
[[Image:Custom_report.png|thumb|none|600px|The results of running one of the reports]]&lt;br /&gt;
&lt;br /&gt;
(Note, these screen shots are in the OU theme, not the standard Moodle theme, and iCMA is OU-jargon for quiz.)&lt;br /&gt;
&lt;br /&gt;
==Interface for normal users==&lt;br /&gt;
&lt;br /&gt;
===List of available queries===&lt;br /&gt;
&lt;br /&gt;
Users with the report/customsql:view capability can access the list of reports in the admin block. Each query is accessible only to a certain people. There are three levels of access:&lt;br /&gt;
* Available to any one who can access the report at all (those with report/customsql:view).&lt;br /&gt;
* Available to people who are able to see other system reports (those with moodle/site:viewreports)&lt;br /&gt;
* Available to administrators only (those with moodle/site:config)&lt;br /&gt;
&lt;br /&gt;
When you go to the list, it will only show the queries you have access to. There is a note beside each query saying when it was last run, and how long it took to generate.&lt;br /&gt;
&lt;br /&gt;
The list shows on-demand and scheduled queries separately.&lt;br /&gt;
&lt;br /&gt;
===Running an on-demand query===&lt;br /&gt;
&lt;br /&gt;
To run an on-demand query, click on its name in the list of queries.&lt;br /&gt;
&lt;br /&gt;
The query will be run, and the results will be displayed as a table. Any URLs in the table will automatically be made into hyperlinks.&lt;br /&gt;
&lt;br /&gt;
A description of the query may appear above the table.&lt;br /&gt;
&lt;br /&gt;
The summary of when the query was run and how long it took is shown at the bottom, along with a link to download the CSV file (for example to get the data into Excel) and a link back to the list of all available queries.&lt;br /&gt;
&lt;br /&gt;
===Viewing the results of scheduled queries===&lt;br /&gt;
&lt;br /&gt;
Scheduled queries can work in one of two ways. Either each run of the report generates and entire table of reasults, or each run just creates one line of results, and the report builds up a row at a time.&lt;br /&gt;
&lt;br /&gt;
When you click the name in the list of queries, you get taken to a display of the latest results, just like in the on-demand case.&lt;br /&gt;
&lt;br /&gt;
However, if each scheduled run generates a complete report, then at the bottom of a page there will be a list of all the previous runs of the report, so that you can go and see how the report changed over time.&lt;br /&gt;
&lt;br /&gt;
==Interface for administrators==&lt;br /&gt;
&lt;br /&gt;
Administrators (that is, users with report/customsql:definequeries) see everything that other users see, but with some additions.&lt;br /&gt;
&lt;br /&gt;
===Additional controls in the staff interface===&lt;br /&gt;
&lt;br /&gt;
Administrators get shown who each report in the list is available to.&lt;br /&gt;
&lt;br /&gt;
They also get an edit and a delete icon next to each query.&lt;br /&gt;
&lt;br /&gt;
There is an &#039;&#039;&#039;Add new query button&#039;&#039;&#039; at the end of the list of queries.&lt;br /&gt;
&lt;br /&gt;
When viewing a particular query, Administrators get an edit and a delete link underneath the table of results.&lt;br /&gt;
&lt;br /&gt;
===Adding or editing a query===&lt;br /&gt;
&lt;br /&gt;
When you click the &#039;&#039;&#039;Add new query button&#039;&#039;&#039;, you get taken to an editing form that lets you define the query.&lt;br /&gt;
&lt;br /&gt;
You must give the query a name.&lt;br /&gt;
&lt;br /&gt;
You can optionally enter a description that is displayed above the results table. You should use this to explain what the results of the query mean.&lt;br /&gt;
&lt;br /&gt;
You must enter the SQL to generate the results you want displayed. This must be an SQL select statement. You must use the prefix prefix_ for table names. It should not be possible to enter any SQL that would alter the contents of the database.&lt;br /&gt;
&lt;br /&gt;
You choose who you want the query to be accessible to.&lt;br /&gt;
&lt;br /&gt;
You choose whether the query should be run on-demand or scheduled weekly or monthly. If the report is scheduled, you can say whether the each run returns one row to be added to a single table, or whether each run generates a separate table.&lt;br /&gt;
&lt;br /&gt;
When you save the new query, the SQL is checked to make sure that it will execute without errors. If you have said that the report will only return a single row, this is also checked.&lt;br /&gt;
After saving the query, if this was a manual query, you are taken to the query results page, so you can see what the results look like. If it was an automatic query or if you cancel the form, you are taken to the list of available queries.&lt;br /&gt;
&lt;br /&gt;
Editing an existing query uses the same form as for adding a new query, but to change the properties of an existing query.&lt;br /&gt;
&lt;br /&gt;
Note that at the OU, weeks start on Saturday. If you don&#039;t like that, there is a fairly obvious constant to hack at the top of locallib.php.&lt;br /&gt;
&lt;br /&gt;
===Deleting a query===&lt;br /&gt;
&lt;br /&gt;
When you click the delete icon or link for a query, you are taken to a confirmation page that shows you SQL of the query you are about to delete. The query is only deleted if you click Yes on the confirmation page.&lt;br /&gt;
&lt;br /&gt;
After deleting a query, you are taken back to the list of queries.&lt;br /&gt;
&lt;br /&gt;
==Share your interesting queries here==&lt;br /&gt;
&lt;br /&gt;
If you come up with any interesting SQL to custom reports, you can share it here.&lt;br /&gt;
&lt;br /&gt;
===Quiz attempts in the last week/month===&lt;br /&gt;
&lt;br /&gt;
Set this up as a scheduled report:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(*)&lt;br /&gt;
FROM prefix_quiz_attempts&lt;br /&gt;
WHERE timefinish &amp;gt; %%STARTTIME%%&lt;br /&gt;
    AND timefinish &amp;lt;= %%ENDTIME%%&lt;br /&gt;
    AND preview = 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This &#039;&#039;&#039;must&#039;&#039;&#039; be set up as a &#039;&#039;&#039;Scheduled, on the first day of each week&#039;&#039;&#039; or &#039;&#039;&#039;Scheduled, on the first day of each month&#039;&#039;&#039; report, or it will not work.&lt;br /&gt;
&lt;br /&gt;
===Usage summary===&lt;br /&gt;
&lt;br /&gt;
This report shows roughly the same usage statistics that are sent to moodle.org when you register your site. The ones that are aggregated at http://moodle.org/stats/. (The only difference is that the registration form does not do AND confirmed = 1 for some reason.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
(SELECT COUNT(id) FROM prefix_course) - 1 AS courses,&lt;br /&gt;
(SELECT COUNT(id) FROM prefix_user WHERE deleted = 0 AND confirmed = 1) AS users,&lt;br /&gt;
(SELECT COUNT(DISTINCT ra.userid)&lt;br /&gt;
 FROM prefix_role_capabilities rc&lt;br /&gt;
 JOIN prefix_role_assignments ra ON ra.roleid = rc.roleid&lt;br /&gt;
 WHERE rc.capability IN (&#039;moodle/course:upd&#039; || &#039;ate&#039;, &#039;moodle/site:doanything&#039;)) AS teachers,&lt;br /&gt;
(SELECT COUNT(id) FROM prefix_role_assignments) AS enrolments,&lt;br /&gt;
(SELECT COUNT(id) FROM prefix_forum_posts) AS forum_posts,&lt;br /&gt;
(SELECT COUNT(id) FROM prefix_resource) AS resources,&lt;br /&gt;
(SELECT COUNT(id) FROM prefix_question) AS questions&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There are two interesting queries in this blog post [http://tjhunt.blogspot.com/2010/03/when-do-students-submit-their-online.html When do students submit their online tests?].&lt;br /&gt;
&lt;br /&gt;
===Monthly Usage by Role===&lt;br /&gt;
&lt;br /&gt;
This report shows a distinct count of users by their role, accessing your site.  Each instance of user and role is counted once per month, no matter how many courses they access.  We use this to show the total number of students and teachers accessing our site.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
month(from_unixtime(`prefix_stats_user_monthly`.`timeend`)) AS calendar_month,&lt;br /&gt;
year(from_unixtime(`prefix_stats_user_monthly`.`timeend`)) AS calendar_year,&lt;br /&gt;
prefix_role.name as user_role,&lt;br /&gt;
COUNT(DISTINCT prefix_stats_user_monthly.userid) AS total_users&lt;br /&gt;
FROM&lt;br /&gt;
prefix_stats_user_monthly&lt;br /&gt;
Inner Join prefix_role_assignments ON prefix_stats_user_monthly.userid = prefix_role_assignments.userid&lt;br /&gt;
Inner Join prefix_context ON prefix_role_assignments.contextid = prefix_context.id&lt;br /&gt;
Inner Join prefix_role ON prefix_role_assignments.roleid = prefix_role.id&lt;br /&gt;
WHERE prefix_context.contextlevel = 50&lt;br /&gt;
AND `prefix_stats_user_monthly`.`stattype` = &#039;activity&#039;&lt;br /&gt;
AND prefix_stats_user_monthly.courseid &amp;lt;&amp;gt;1&lt;br /&gt;
GROUP BY month(from_unixtime(`prefix_stats_user_monthly`.`timeend`)),&lt;br /&gt;
year(from_unixtime(`prefix_stats_user_monthly`.`timeend`)),&lt;br /&gt;
prefix_stats_user_monthly.stattype,&lt;br /&gt;
prefix_role.name&lt;br /&gt;
ORDER BY &lt;br /&gt;
year(from_unixtime(`prefix_stats_user_monthly`.`timeend`)), month(from_unixtime(`prefix_stats_user_monthly`.`timeend`)),&lt;br /&gt;
prefix_role.name&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You must have Statistics turned on to be able to generate any data with this report.&lt;br /&gt;
&lt;br /&gt;
PostgreSQL version of the Monthly Usage by Role query:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
extract(month from to_timestamp(prefix_stats_user_monthly.timeend)) AS calendar_month,&lt;br /&gt;
extract(year from to_timestamp(prefix_stats_user_monthly.timeend)) AS calendar_year,&lt;br /&gt;
prefix_role.name AS user_role,&lt;br /&gt;
COUNT(DISTINCT prefix_stats_user_monthly.userid) AS total_users&lt;br /&gt;
FROM&lt;br /&gt;
prefix_stats_user_monthly&lt;br /&gt;
INNER JOIN prefix_role_assignments ON prefix_stats_user_monthly.userid = prefix_role_assignments.userid&lt;br /&gt;
INNER JOIN prefix_context ON prefix_role_assignments.contextid = prefix_context.id&lt;br /&gt;
INNER JOIN prefix_role ON prefix_role_assignments.roleid = prefix_role.id&lt;br /&gt;
WHERE prefix_context.contextlevel = 50&lt;br /&gt;
AND prefix_stats_user_monthly.stattype = &#039;activity&#039;&lt;br /&gt;
AND prefix_stats_user_monthly.courseid &amp;lt;&amp;gt;1&lt;br /&gt;
GROUP BY extract(month from to_timestamp(prefix_stats_user_monthly.timeend)),&lt;br /&gt;
extract(year from to_timestamp(prefix_stats_user_monthly.timeend)),&lt;br /&gt;
prefix_stats_user_monthly.stattype,&lt;br /&gt;
prefix_role.name&lt;br /&gt;
ORDER BY &lt;br /&gt;
extract(year from to_timestamp(prefix_stats_user_monthly.timeend)), extract(month from to_timestamp(prefix_stats_user_monthly.timeend)),&lt;br /&gt;
prefix_role.name&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Show all Quiz results across a site===&lt;br /&gt;
I&#039;m sure someone will be able to improve upon this, but this is a query that will show Quiz results across a site. --[[User:Stuart Mealor|Stuart Mealor]] 22:07, 9 April 2010 (UTC)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
     prefix_grade_items.itemname,&lt;br /&gt;
     prefix_grade_items.grademax,&lt;br /&gt;
     ROUND(prefix_grade_grades.finalgrade, 0) AS finalgrade,&lt;br /&gt;
     prefix_user.firstname,&lt;br /&gt;
     prefix_user.lastname,&lt;br /&gt;
     prefix_user.username&lt;br /&gt;
FROM&lt;br /&gt;
     prefix_grade_grades&lt;br /&gt;
     INNER JOIN prefix_user ON prefix_grade_grades.userid = prefix_user.id&lt;br /&gt;
     INNER JOIN prefix_grade_items ON prefix_grade_grades.itemid = prefix_grade_items.id&lt;br /&gt;
WHERE (prefix_grade_items.itemname IS NOT NULL)&lt;br /&gt;
AND (prefix_grade_items.itemtype = &#039;mod&#039; OR prefix_grade_items.itemtype = &#039;manual&#039;)&lt;br /&gt;
AND (prefix_grade_items.itemmodule = &#039;quiz&#039; OR prefix_grade_items.itemmodule IS NULL)&lt;br /&gt;
AND (prefix_grade_grades.timemodified IS NOT NULL)&lt;br /&gt;
AND (prefix_grade_grades.finalgrade &amp;gt; 0)&lt;br /&gt;
AND (prefix_user.deleted = 0)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=136484 Custom SQL queries report] forum announcement&lt;br /&gt;
* list of [[ad-hoc contributed reports]]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=153059 Forum post] with some more useful queries.&lt;br /&gt;
* [http://moodle.org/mod/data/view.php?d=13&amp;amp;rid=2884 Modules and plugins database entry]&lt;br /&gt;
* [[Configurable_reports|Configurable reports]] bloc&lt;br /&gt;
&lt;br /&gt;
[[Category:Contributed_code]]&lt;br /&gt;
&lt;br /&gt;
[[es:Reportes de consultas personalizadas SQL]]&lt;br /&gt;
[[fr:admin/report/customsql/index]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Configurable_reports&amp;diff=127044</id>
		<title>Configurable reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Configurable_reports&amp;diff=127044"/>
		<updated>2017-03-08T11:27:50Z</updated>

		<summary type="html">&lt;p&gt;Fox: Add categories&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox plugin&lt;br /&gt;
|type = Block&lt;br /&gt;
|entry = https://moodle.org/plugins/view.php?plugin=block_configurable_reports&lt;br /&gt;
|tracker = http://tracker.moodle.org/browse/CONTRIB/component/10753&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/view.php?id=7979&lt;br /&gt;
|maintainer = [[User:Juan Leyva|Juan Leyva]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
# Download the Configurable Reports installation file and unzip it to the &#039;&#039;&#039;\blocks&#039;&#039;&#039; directory in your Moodle folder.&lt;br /&gt;
# Be sure that the final name of the directory is: configurable_reports, the full path in your Moodle installation will be blocks/configurable_reports&lt;br /&gt;
# Login to Moodle as Administrator and click Notifications under Site Administration.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more information see [[Installing contributed modules or plugins]]&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This block is a Moodle custom reports builder. It its also connected to a [https://github.com/jleyva/moodle-configurable_reports_repository public repository of sample reports] (only plugin version 2.3 and above)&lt;br /&gt;
&lt;br /&gt;
It is designed in a modular way to allow developers to create new plugins in less than an hour.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Who can create custom reports?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Anyone with block, managereports or manageownreports permissions at SITE level or COURSE level.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;What type of reports can I create?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
- Courses reports, with information regarding courses.&lt;br /&gt;
&lt;br /&gt;
- Categories reports, with information regarding categories. A courses report can be embedded in this type of report.&lt;br /&gt;
&lt;br /&gt;
- Users reports, with information regarding users and their activity in a course.&lt;br /&gt;
&lt;br /&gt;
- Timeline reports, this is a special type of report that displays a timeline. A course or user report can be embedded in this timeline showing data depending on the start and end time of the current row.&lt;br /&gt;
&lt;br /&gt;
- Custom SQL Reports, custom SQL queries. This block can use the same SQL queries as [https://moodle.org/plugins/view.php?plugin=report_customsql Tim Hunt&#039;s Custom SQL queries] plugin.&lt;br /&gt;
&lt;br /&gt;
Note for developers: You can create your own type of reports.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Who can view the reports?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
When you create a report you can select which users can view it.&lt;br /&gt;
&lt;br /&gt;
The reports are displayed in a block in the course or site frontpage.&lt;br /&gt;
&lt;br /&gt;
== Creating a report ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is a very simple process.  &lt;br /&gt;
&lt;br /&gt;
If you are going to create a report for a course, you have to add the block in the course and click in the &amp;quot;Manage reports&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
On the other hand, for site reports, add the block in the frontpage and click in the &amp;quot;Manage reports&amp;quot; link.&lt;br /&gt;
&lt;br /&gt;
You must enter a name, an optional description, and you have to choose the type of report, pagination and exports formats.&lt;br /&gt;
&lt;br /&gt;
Depending on the report choosen, there will be more or less tabs. These are the tabs for the courses and users report:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Columns&#039;&#039;&#039;: Here you can choose the differents columns of your report depending on the type of report. (Course Name, User firstname, etc..)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Conditions&#039;&#039;&#039;: Here you can define the conditions (i.e, only courses from this category, only users from Spain, etc.)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Ordering&#039;&#039;&#039;: Here you can choose how to order the report using fields and directions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Filters&#039;&#039;&#039;: Here you can choose which filters will be displayed.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Template&#039;&#039;&#039;: You can modify the report&#039;s layout by creating a template.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Permissions&#039;&#039;&#039;: Here you can choose who can view a report.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Calculations&#039;&#039;&#039;: Here you can add calculations for columns, i.e: average of number of users enrolled in courses&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plots&#039;&#039;&#039;: Here you can add graphs to your report based on the report columns and values.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;View report&#039;&#039;&#039;: Self explanatory&lt;br /&gt;
&lt;br /&gt;
== Tutorial ==&lt;br /&gt;
&lt;br /&gt;
=== Creating a users&#039; report ===&lt;br /&gt;
&lt;br /&gt;
Requirements: &#039;&#039;Users from Spain, but not from Madrid, in this course. This report can be viewed only by users from Spain. A filter based on the user&#039;s city must be displayed. A pie plot showing the users&#039; cities is required. A calculation table showing the total forum post views is required. The report must be ordered by users&#039; lastname.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Let&#039;s see how easy it is!&lt;br /&gt;
&lt;br /&gt;
First of all, install the block.&lt;br /&gt;
&lt;br /&gt;
Go to the course where the report will be created.&lt;br /&gt;
&lt;br /&gt;
Add an instance of the Custom Reports block.&lt;br /&gt;
&lt;br /&gt;
Click on &amp;quot;Manage reports&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Click on &amp;quot;Add report&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Enter a name, a description and choose &amp;quot;Users report&amp;quot; as Type of Report&lt;br /&gt;
&lt;br /&gt;
The report will be saved and you will be redirected to the first Tab named &amp;quot;Columns&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Adding Columns&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Here you can define the report table properties, width, align, cell padding, cell spacing, etc.&lt;br /&gt;
&lt;br /&gt;
Add a Column called &amp;quot;User profile field&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Choose the field &amp;quot;firstname&amp;quot; and enter a name for the column in the text field. You can leave the rest of elements blank.&lt;br /&gt;
&lt;br /&gt;
Repeat the process above for the lastname and city fields.&lt;br /&gt;
&lt;br /&gt;
Add a Column called &amp;quot;User module actions&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Choose a module from the list, in this example, a forum.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Adding Conditions&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Click on the Conditions Tab.&lt;br /&gt;
&lt;br /&gt;
Add a Condition named &amp;quot;User field Condition&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Choose the column &amp;quot;Country&amp;quot;, the Operator &amp;quot;=&amp;quot;, and enter the value &amp;quot;ES&amp;quot; (this is the international code for Spain as Moodle stores it).&lt;br /&gt;
&lt;br /&gt;
Add a Condition named &amp;quot;User field Condition&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Choose the column &amp;quot;city&amp;quot;, the Operator &amp;quot;&amp;lt;&amp;gt;&amp;quot;, and enter the value &amp;quot;Madrid&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Add a Condition named &amp;quot;Users in current report course&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
These are the main conditions of the reports. Note that at the bottom there is a text box called condition, with this text:&lt;br /&gt;
&lt;br /&gt;
 &amp;quot;c2 and c1 and c3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Here you can define a logic condition, in this case, we don&#039;t need to edit this condition but you can create complex expressions like:&lt;br /&gt;
&lt;br /&gt;
 (c1 and c2) or (c4 and c3)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Adding Ordering&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Click on the Ordering Tab.&lt;br /&gt;
&lt;br /&gt;
Add a ordering named &amp;quot;User field ordering&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Choose the column &amp;quot;Lastname&amp;quot; and the ordering &amp;quot;ASC&amp;quot; (Ascending).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Adding Filters&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Click on the Filters Tab.&lt;br /&gt;
&lt;br /&gt;
Add a filter named &amp;quot;User field filter&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Choose city.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Adding Permissions&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Click on the Permissions Tab.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;User field Value&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Choose the column &amp;quot;Country&amp;quot;, and enter the value &amp;quot;ES&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Here you can add more permissions and a logic condition to be achieved.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Adding Calculations&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Click on the Calculations tab.&lt;br /&gt;
&lt;br /&gt;
Choose Sum.&lt;br /&gt;
&lt;br /&gt;
Choose the column &amp;quot;User module actions&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Adding Plots&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Click on the Plots tab.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;Pie&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Choose the colum &amp;quot;City&amp;quot; as Name and Value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Finally, add a few users in Moodle with the country Spain, and different cities, Madrid, Barcelona, Seville, etc. and test the report.&lt;br /&gt;
&lt;br /&gt;
You can download the report in different formats (ods and xls), remember to check these options in the report page.&lt;br /&gt;
&lt;br /&gt;
[[blocks/configurable_reports/#Users_report | See screenshot]]&lt;br /&gt;
&lt;br /&gt;
=== Creating a SQL Report ===&lt;br /&gt;
&lt;br /&gt;
You can find a lot of SQL Reports here: [[ad-hoc contributed reports]]&lt;br /&gt;
&lt;br /&gt;
Since this block supports Tim Hunt&#039;s CustomSQL Queries Reports, you can use any query.&lt;br /&gt;
&lt;br /&gt;
Remember to add a &amp;quot;Time filter&amp;quot; if you are going to use reports with time tokens.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First of all, install the block.&lt;br /&gt;
&lt;br /&gt;
Go to the course where the report will be created.&lt;br /&gt;
&lt;br /&gt;
Add an instance of the Custom Reports block.&lt;br /&gt;
&lt;br /&gt;
Click on &amp;quot;Manage reports&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Click on &amp;quot;Add report&lt;br /&gt;
&lt;br /&gt;
Enter a name, description, choose &amp;quot;SQL&amp;quot; as Type of Report&lt;br /&gt;
&lt;br /&gt;
The report will be saved and you redirect to the first Tab named &amp;quot;Custom SQL&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Add this query (&#039;&#039;Courses activity&#039;&#039;):&lt;br /&gt;
&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;
Go to Calculations Tab&lt;br /&gt;
&lt;br /&gt;
Add a Sum calculation, choose the hits column&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go to Plot&lt;br /&gt;
&lt;br /&gt;
Add a Pie graph, choosing coursename as Name and hits as value&lt;br /&gt;
&lt;br /&gt;
So, here you have a report with a Graph and calculations based on a SQL Query.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can add a Course filter, it&#039;s very easy:&lt;br /&gt;
&lt;br /&gt;
Go to filters, choose Courses&lt;br /&gt;
&lt;br /&gt;
Edit the Custom SQL query:&lt;br /&gt;
&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;
%%FILTER_COURSES:l.course%% &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;
Note that we are adding a token called: %%FILTER_COURSES:l.courseid%% &lt;br /&gt;
&lt;br /&gt;
Go to View report, and you will see a Courses Filter, choose a Course and click on Add, here you have a report filtered.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can also add a Starttime and endtime filter&lt;br /&gt;
&lt;br /&gt;
Go to filters, choose Start / End date filter&lt;br /&gt;
&lt;br /&gt;
Go to Custom SQL tab, this is the new query:&lt;br /&gt;
&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;
%%FILTER_COURSES:l.course%% &lt;br /&gt;
%%FILTER_STARTTIME:l.time:&amp;gt;%% %%FILTER_ENDTIME:l.time:&amp;lt;%% &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;
&lt;br /&gt;
If you want to filter text (for example, lastname)&lt;br /&gt;
&lt;br /&gt;
Go to filters, choose Search Text filter&lt;br /&gt;
&lt;br /&gt;
Go to Custom SQL tab and type your query. Here is an example for querying the user table:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname&lt;br /&gt;
FROM prefix_user u&lt;br /&gt;
WHERE 1=1&lt;br /&gt;
%%FILTER_SEARCHTEXT:u.lastname:~%%&lt;br /&gt;
ORDER BY u.lastname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace WHERE 1=1 with your WHERE criteria. If you do not have any where criteria and do not specify WHERE 1=1, you will receive a SQL error.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One more example (for filtering a group of courses by category)&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(l.id) hits, c.fullname as Course,c.id as CourseID&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;
FROM prefix_log l INNER JOIN prefix_course c ON l.course = c.id&lt;br /&gt;
%%FILTER_CATEGORIES:c.category%% &lt;br /&gt;
GROUP BY l.course&lt;br /&gt;
ORDER BY hits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Go to View report, now you can filter by time also&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;SQL variables&#039;&#039;&#039;&lt;br /&gt;
If you place this strings in your SQL queries, it will be replaced by the appropriate value (current course id, current user id, Moodle www root (url))&lt;br /&gt;
&lt;br /&gt;
* %%COURSEID%% &lt;br /&gt;
* %%USERID%%&lt;br /&gt;
* %%WWWROOT%%&lt;br /&gt;
&lt;br /&gt;
[[blocks/configurable_reports/#SQL_report | See screenshot]]&lt;br /&gt;
&lt;br /&gt;
=== Creating a timeline report ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This report assumes that you have created at least one user or course report&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Timeline reports are a special type of reports. A timeline report displays a timeline in which a course report or user report can be embedded.&lt;br /&gt;
&lt;br /&gt;
In this example we are going to create a report showing the user logins to the site during the last month (day per day).&lt;br /&gt;
&lt;br /&gt;
Create a User report (see tutorial above) with three columns (firstname, lastname and user statistics)&lt;br /&gt;
&lt;br /&gt;
Select the statistic (User logins)&lt;br /&gt;
&lt;br /&gt;
Create a Timeline report, in the Timeline tab you can select the dates or days of the report (in this case, the last 30 days) and the interval of time for every row.&lt;br /&gt;
&lt;br /&gt;
Add three &amp;quot;Other report column&amp;quot; columns, selecting all the previous user report columns.&lt;br /&gt;
&lt;br /&gt;
And that&#039;s all, you can create a new type of plot (line graph). This graph is suitable for data depending on time.&lt;br /&gt;
&lt;br /&gt;
== Advanced options ==&lt;br /&gt;
&lt;br /&gt;
=== Export and import of reports ===&lt;br /&gt;
&lt;br /&gt;
Embedded reports exporting is not working because the reports include references to another reports. A workaround is edit the imported report for changing the references in the &amp;quot;Other report field&amp;quot; column.&lt;br /&gt;
&lt;br /&gt;
Reports that uses the user module outline column can&#039;t be exported either&lt;br /&gt;
&lt;br /&gt;
=== Use the same report in different courses ===&lt;br /&gt;
&lt;br /&gt;
(Available only in Configurable Report version 2.3 and above)&lt;br /&gt;
&lt;br /&gt;
In order to use the same report in different courses you have to check the &amp;quot;Global report&amp;quot; option where creating a new report. This report will be then displayed in all the courses where the configurable report block is displayed and the block instance settings are set to &amp;quot;Display global reports&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to display global reports in a certain block instance you can always edit the instance settings for selecting &amp;quot;No&amp;quot; in the &amp;quot;Display global reports&amp;quot; block setting.&lt;br /&gt;
&lt;br /&gt;
Notice that these types of reports inherit the context of the course where is displayed, so any condition related to course inside the report is calculated using the course where the report is being viewed&lt;br /&gt;
&lt;br /&gt;
=== Reports can run on a different DB then the current (production) DB ===&lt;br /&gt;
&lt;br /&gt;
(Available only in Configurable Report version 2.3 and above)&lt;br /&gt;
&lt;br /&gt;
Go to Admin -&amp;gt; Plugins -&amp;gt; Blocks -&amp;gt; Configurable Report settings&lt;br /&gt;
&lt;br /&gt;
=== DataTables for the report table ===&lt;br /&gt;
&lt;br /&gt;
(Available only in Configurable Report version 2.3 and above)&lt;br /&gt;
&lt;br /&gt;
Go to Admin -&amp;gt; Plugins -&amp;gt; Blocks -&amp;gt; Configurable Report settings to enable this functionality&lt;br /&gt;
&lt;br /&gt;
=== CodeMirror.js for highlighting SQL query code ===&lt;br /&gt;
&lt;br /&gt;
(Available only in Configurable Report version 2.3 and above)&lt;br /&gt;
&lt;br /&gt;
Go to Admin -&amp;gt; Plugins -&amp;gt; Blocks -&amp;gt; Configurable Report settings to disable this functionality&lt;br /&gt;
&lt;br /&gt;
=== Using GITHUB as a repository to distribute and manage sharable SQL queries ===&lt;br /&gt;
&lt;br /&gt;
(Available only in Configurable Report version 2.3 and above)&lt;br /&gt;
&lt;br /&gt;
Go to Admin -&amp;gt; Plugins -&amp;gt; Blocks -&amp;gt; Configurable Report settings to point to your own repository&lt;br /&gt;
&lt;br /&gt;
=== Cron SQL queries ===&lt;br /&gt;
&lt;br /&gt;
(Available only in Configurable Report version 2.3 and above)&lt;br /&gt;
&lt;br /&gt;
=== Settings to control security of SQL Queries ===&lt;br /&gt;
&lt;br /&gt;
(Available only in Configurable Report version 2.3 and above)&lt;br /&gt;
&lt;br /&gt;
Go to Admin -&amp;gt; Plugins -&amp;gt; Blocks -&amp;gt; Configurable Report settings to change the security level&lt;br /&gt;
&lt;br /&gt;
=== Templates ===&lt;br /&gt;
&lt;br /&gt;
You can customize the report output using a template.&lt;br /&gt;
&lt;br /&gt;
Just enable the Template option in the same name tab.&lt;br /&gt;
&lt;br /&gt;
This is an example html code for displaying a list of users:&lt;br /&gt;
&lt;br /&gt;
Header:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html4strict&amp;gt;&lt;br /&gt;
&amp;lt;p align=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;b&amp;gt;##reportname##&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;table width=&amp;quot;60%&amp;quot; align=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Record:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html4strict&amp;gt;&lt;br /&gt;
&amp;lt;table width=&amp;quot;100%&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;img src=&amp;quot;http://yourmoodle.com/user/pix.php/[[id]]/f1.jpg&amp;quot;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;h2&amp;gt;[[Firstname]] [[Lastname]]&amp;lt;/h2&amp;gt;&lt;br /&gt;
City: [[City]]&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Footer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code html4strict&amp;gt;&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;td valign=&amp;quot;top&amp;quot;&amp;gt;&lt;br /&gt;
##graphs## &lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
##exportoptions##&lt;br /&gt;
&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Embedded reports ===&lt;br /&gt;
&lt;br /&gt;
An embedded report consists in a report&#039;s set of columns that are embedded in another report.&lt;br /&gt;
&lt;br /&gt;
You can embed a user report into a course report, in this case, the resulting rows will be expanded duplicating each row for each user.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Type of report&lt;br /&gt;
! Reports that can be embedded&lt;br /&gt;
|-&lt;br /&gt;
| Courses&lt;br /&gt;
| Users&lt;br /&gt;
|-&lt;br /&gt;
| Categories&lt;br /&gt;
| Courses&lt;br /&gt;
|-&lt;br /&gt;
| Timeline&lt;br /&gt;
| Users, courses&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Imagine you have a courses report, you can embed a user report, every row of the course report will be cloned for each user.&lt;br /&gt;
&lt;br /&gt;
To embed a report just add a &amp;quot;Other report&amp;quot; column, a list of your reports will be showed.&lt;br /&gt;
&lt;br /&gt;
Inside a course report you can embed a user report and the other way.&lt;br /&gt;
&lt;br /&gt;
==== Timeline reports ====&lt;br /&gt;
&lt;br /&gt;
Timeline reports are a special type of reports. A timeline report displays a timeline in which a courses report or users report can be embedded.&lt;br /&gt;
&lt;br /&gt;
Timeline reports should be used when your user or course report includes statistics (course stats or user stats columns). I.e: you can create a report showing the number of user logins to the site during a week or month.&lt;br /&gt;
&lt;br /&gt;
== Reports repository ==&lt;br /&gt;
&lt;br /&gt;
Configurable Reports is connected to two different repositories:&lt;br /&gt;
&lt;br /&gt;
* https://github.com/jleyva/moodle-configurable_reports_repository A repository of any type of reports (users, courses, sql, etc...)&lt;br /&gt;
* https://github.com/jleyva/moodle-custom_sql_report_queries A repository of just SQL queries to be used in the SQL repor type&lt;br /&gt;
&lt;br /&gt;
You can use your custom repository following this instructions:&lt;br /&gt;
&lt;br /&gt;
* First, you need a github account (free)&lt;br /&gt;
&lt;br /&gt;
* Fork any of the previous repositorys, using the GITHUB fork tool&lt;br /&gt;
&lt;br /&gt;
* Using GIT, clone the repository to your computer in order to add your custom reports (some GIT knowledge is needed)&lt;br /&gt;
&lt;br /&gt;
* Go to Administration / Plugins / Blocks / Configurable reports and change the settings for pointing to your repository (github account + / + repository name&lt;br /&gt;
&lt;br /&gt;
* If you want to contribute to the official repository, use the Pull request Github feature (So I can easily add your reports)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Developers documentation ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s very easy to create new report types, components and plugins.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Report&#039;&#039;&#039;: A report plugin is a folder located at /report. &lt;br /&gt;
This folder contains a .class.php file with the child - class of the report_base.&lt;br /&gt;
&lt;br /&gt;
You only need to modify a few methods to add a new report type.&lt;br /&gt;
Please, take a look at any of the current reports. The SQL report is an example of a non-typical report, &lt;br /&gt;
meanwhile the users and courses reports are standard reports.&lt;br /&gt;
&lt;br /&gt;
The best way to create a report is to duplicate an existing one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Component&#039;&#039;&#039;: A component is part of a report, a component may be used by more than one report.&lt;br /&gt;
The main Component is the component Columns, that is used to add the columns of a report.&lt;br /&gt;
&lt;br /&gt;
Others components are filters, permissions, plot, calculations..&lt;br /&gt;
&lt;br /&gt;
The best way to create a component is to duplicate an existing one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Plugin&#039;&#039;&#039;: A plugin is a component module. The component column has a few of plugins (coursefield, userfield, etc.)&lt;br /&gt;
A plugin usually works for a unique report, but there are plugins that work for more than one report.&lt;br /&gt;
The best way to create a plugin is to duplicate an existing one.&lt;br /&gt;
&lt;br /&gt;
== How to request a new feature ==&lt;br /&gt;
&lt;br /&gt;
* Go to the Plugin Tracker http://tracker.moodle.org/browse/CONTRIB/component/10753&lt;br /&gt;
* Check in the open issues if your feature have been already requested http://tracker.moodle.org/secure/IssueNavigator.jspa?reset=true&amp;amp;jqlQuery=project+%3D+CONTRIB+AND+component+%3D+%22Block%3A+Configurable+report%22+AND+status+%3D+Open+ORDER+BY+priority+DESC&amp;amp;mode=hide&lt;br /&gt;
* If not, create a New issue (Component: Non-core contributed modules Issue type: New feature) (You have to register yourself in the tracker)&lt;br /&gt;
* Select the component Block: Configurable Reports and your Moodle version&lt;br /&gt;
* Explain in the Description field your needs&lt;br /&gt;
* If you have funding, you can contact me using the forum or the moodle internal messaging system, since I work for a Moodle Partner I can work on your request.&lt;br /&gt;
* Vote and Watch the issue you have created&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
Juan Leyva [http://moodle.org/user/view.php?id=49568&amp;amp;course=1 Moodle profile]&lt;br /&gt;
&lt;br /&gt;
[http://twitter.com/jleyvadelgado Follow me in Twitter]&lt;br /&gt;
&lt;br /&gt;
== Screenshots ==&lt;br /&gt;
&lt;br /&gt;
=== Users report ===&lt;br /&gt;
[[Image:block_custom_reports_sample_user_report.png|600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== SQL report ===&lt;br /&gt;
[[Image:block_custom_reports_sample_sql_report.png|600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
* CONTRIB-2386&lt;br /&gt;
* [https://tracker.moodle.org/issues/?jql=project%20%3D%20CONTRIB%20AND%20component%20%3D%20%22Block%3A%20Configurable%20report%22 Block: Configurable reports] Tracker component&lt;br /&gt;
* [http://moodle.org/plugins/view.php?plugin=block_configurable_reports Modules &amp;amp; Plugins] database entry&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=159820 Help forum]&lt;br /&gt;
* [[ad-hoc_contributed_reports|contributed reports]] (in plain SQL)&lt;br /&gt;
* [https://github.com/jleyva/moodle-configurable_reports_repository Configurable Reports Repository on GitHub]&lt;br /&gt;
* [https://www.youtube.com/watch?v=lF6CuY2Qiw0 Configurable Reports as a Learning Analytics Tool] - iMoot 2015 presentation by Elizabeth Dalton&lt;br /&gt;
* [http://opensourceelearning.blogspot.co.za/2015/08/moodle-configurable-reports-plugin-all.html All Variables and Filters] - Lists the Variables and Filters you can use in a report&lt;br /&gt;
&lt;br /&gt;
[[Category:Report]]&lt;br /&gt;
[[Category:Contributed_code]]&lt;br /&gt;
&lt;br /&gt;
[[es:blocks/configurable_reports/]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Upgrading_FAQ&amp;diff=126858</id>
		<title>Upgrading FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Upgrading_FAQ&amp;diff=126858"/>
		<updated>2017-02-15T13:51:45Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
==How do I upgrade from 1.9.x to {{Version}}?==&lt;br /&gt;
&lt;br /&gt;
1.x -&amp;gt;  1.9.19+ -&amp;gt; 2.2.11 -&amp;gt; 2.7.18 -&amp;gt; {{Version}} &lt;br /&gt;
&lt;br /&gt;
(It is better to upgrade to latest current stable before going to next branch, the same for plugins; upgrading from early stable branches usually works but there is no guarantee.)&lt;br /&gt;
&lt;br /&gt;
Moodle 2.2.11 may be downloaded from https://download.moodle.org/stable22/.&lt;br /&gt;
&lt;br /&gt;
==How do I upgrade Moodle? Do I just overwrite the files?==&lt;br /&gt;
&lt;br /&gt;
Do NOT overwrite files, as it may cause strange errors. Read the [[Upgrading]] documentation before proceeding.&lt;br /&gt;
&lt;br /&gt;
==I obtain the message &amp;quot;Upgrade already running in this session, please wait!&amp;quot;==&lt;br /&gt;
&lt;br /&gt;
Most likely you refreshed the page before the completion message. If you are absolutely sure that there are no upgrade processes active (php and/or mysql), you can click on &amp;quot;!!!&amp;quot; and restart the upgrade.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;Note&#039;&#039;: If you click on &amp;quot;&#039;!!!&amp;quot; or try to restart the upgrade from another browser, there is a chance that your data in the database could be corrupted. If this happens, you will need to restore the database from sql dump and then restart the upgrade and wait - the process can take several hours on large sites.&lt;br /&gt;
&lt;br /&gt;
==Can I upgrade more than one version at a time?==&lt;br /&gt;
&lt;br /&gt;
You can only upgrade to Moodle {{Version}} from Moodle 2.7 or later.&lt;br /&gt;
&lt;br /&gt;
You can only upgrade to Moodle 2.7 from Moodle 2.2 or later.&lt;br /&gt;
&lt;br /&gt;
You can only upgrade to Moodle 2.2 from Moodle 1.9 or later.&lt;br /&gt;
&lt;br /&gt;
For information on upgrading from versions of Moodle prior to 1.9, see the section &#039;Upgrading more than one version&#039; in the Moodle 2.2 documentation [https://docs.moodle.org/22/en/Upgrading Upgrading].&lt;br /&gt;
&lt;br /&gt;
==I have custom code in my site. How do I upgrade?==&lt;br /&gt;
Please see this forum post on [https://moodle.org/mod/forum/discuss.php?d=263355#p1141326 upgrading with custom code] for some suggestions.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[Installation FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[es:Actualización FAQ]]&lt;br /&gt;
[[fr:FAQ de mise à jour]]&lt;br /&gt;
[[ja:アップグレードFAQ]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=PayPal_enrolment&amp;diff=126857</id>
		<title>PayPal enrolment</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=PayPal_enrolment&amp;diff=126857"/>
		<updated>2017-02-15T13:03:29Z</updated>

		<summary type="html">&lt;p&gt;Fox: Language links at the bottom&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Enrolment}}&lt;br /&gt;
The PayPal enrolment plugin allows users to pay for courses and then be automatically enrolled. &lt;br /&gt;
&lt;br /&gt;
==PayPal account creation==&lt;br /&gt;
&lt;br /&gt;
# Go to https://www.paypal.com and create a PayPal account. Not required but recommended for selling: Upgrade your account to &amp;quot;Premier&amp;quot; status and get &amp;quot;Verified&amp;quot;.&lt;br /&gt;
# Set the Encoding to UFT-8.  In Paypal, go to &#039;&#039;Profile &amp;gt; Language Encoding&#039;&#039; (under the Selling Preferences column) and set your website&#039;s language (like select &amp;quot;Western European Languages (including English)&amp;quot; as it is the only English version).  Then click on the &amp;quot;More Options&amp;quot; button and set the Encoding to &amp;quot;UTF-8&amp;quot;, select &amp;quot;Yes&amp;quot; to use the same encoding for data sent from PayPal to you, and save.&lt;br /&gt;
# Optionally setup IPN in PayPal to interact with Moodle.  Log into PayPal, go to &amp;quot;Profile &amp;gt; Instant Payment Notifications (IPN)”, click &amp;quot;Turn On IPN&amp;quot;, click the &amp;quot;Edit settings&amp;quot; and enter a URL that references your IPN file in your Moodle installation (for example: &amp;lt;nowiki&amp;gt;http://&amp;lt;domain name&amp;gt;/moodle/enrol/paypal/ipn.php&amp;lt;/nowiki&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==Enabling PayPal enrolment==&lt;br /&gt;
&lt;br /&gt;
An administrator can enable PayPal file enrolment as follows:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;Go to Site administration &amp;gt; Plugins &amp;gt; Enrolments &amp;gt; Manage enrol plugins&#039;&#039; and click the eye icon opposite PayPal. When enabled, it will no longer be greyed out. [[Manual enrolment]] must also be enabled, since the PayPal plugin requires it.&lt;br /&gt;
# Click the settings link, configure as required (see details of settings below), then click the &#039;Save changes&#039; button.&lt;br /&gt;
&lt;br /&gt;
* PayPal business email - This setting is case sensitive and must exactly match that in PayPal&lt;br /&gt;
* Default role assignment - This means the role that a new user will automatically be given in a course when they purchase access. Usually this would be &amp;quot;student&amp;quot; unless you have a special reason for choosing another role. As for other default settings, it may be overridden in individual courses.&lt;br /&gt;
&lt;br /&gt;
Tip: If you wish to allow users to create their own accounts on your site then you need to set up [[Email-based_self-registration|Email based self registration]].&lt;br /&gt;
&lt;br /&gt;
==Course settings for PayPal==&lt;br /&gt;
&lt;br /&gt;
===Checking you have PayPal in your course===&lt;br /&gt;
&lt;br /&gt;
# In a course, go to &#039;&#039;Course administration &amp;gt; Users &amp;gt; Enrolment methods&#039;&#039;&lt;br /&gt;
# If you do not see PayPal, use the pull down menu &amp;quot;Add method&amp;quot; and select PayPal&lt;br /&gt;
# Make sure PayPal has its &amp;quot;eye&amp;quot; opened: &lt;br /&gt;
&lt;br /&gt;
[[File:Paypalenrolmentmethod.png]]&lt;br /&gt;
{{Note|Make sure you don&#039;t  have [[Self enrolment]] enabled as this would allow users to access the course without paying. If you do need some users to self enrol for free, then add an [[Enrolment key]] in the self enrolment settings.}}&lt;br /&gt;
===Setting a price for your course===&lt;br /&gt;
&lt;br /&gt;
# In &#039;&#039;Course Administration &amp;gt; Users &amp;gt; Enrolment methods&#039;&#039;, click the edit/hand/pen icon to the right of the PayPal option. &lt;br /&gt;
# Optional: Give a name to this enrolment method if you wish in &amp;quot;Custom Instance name&amp;quot;&lt;br /&gt;
# Ensure that &amp;quot;Allow PayPal enrolments&amp;quot; is set to &amp;quot;yes&amp;quot;&lt;br /&gt;
# In &amp;quot;Enrol cost&amp;quot;, type in the cost of your course and in &amp;quot;Currency&amp;quot; choose your currency.&lt;br /&gt;
# Usually you would leave the &amp;quot;Assign role&amp;quot; as &amp;quot;student&amp;quot; unless you have a very special reason for allowing your users to enrol as, say, editing teachers etc&lt;br /&gt;
# Choose an enrolment period and/or start/end dates if desired.&lt;br /&gt;
# Click the &amp;quot;Save changes&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
[[File:Paypalcoursesettings.png]]&lt;br /&gt;
&lt;br /&gt;
===What the new user sees===&lt;br /&gt;
&lt;br /&gt;
When a new user clicks on your course link, they will see a message inviting them to go to PayPal to purchase access to the course. In the list of courses, PayPal courses have a dollar sign icon next to them.&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Paypaluserview.png|frame|left|Message inviting user to pay via PayPal]]&lt;br /&gt;
| [[File:Paypalicon.png|frame|left|PayPal course listed with dollar sign icon]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Changing the dollar symbol==&lt;br /&gt;
[[File:PaypalGBP.png|frame|PayPal course listed with GBP sign icon]]&lt;br /&gt;
The default currency symbol for PayPal is a dollar sign. If you are using GBP or Euros or another currency, you can change this by creating your own customised icon with your choice of currency. Make it 16x 16 pixels and call it &#039;&#039;icon.gif&#039;&#039;  Upload your new icon via FTP to your  &#039;&#039;moodle directory&amp;gt;enrol&amp;gt;paypal&amp;gt;pix&#039;&#039;. Your icon.gif will override the dollar sign. Make sure you refresh your page to be sure of the changes.&lt;br /&gt;
&lt;br /&gt;
==PayPal capabilities==&lt;br /&gt;
&lt;br /&gt;
*[[Capabilities/enrol/paypal:config|Configure PayPal enrol instances]]&lt;br /&gt;
*[[Capabilities/enrol/paypal:manage|Manage enrolled users]]&lt;br /&gt;
*[[Capabilities/enrol/paypal:unenrol|Unenrol users from course]]&lt;br /&gt;
*[[Capabilities/enrol/paypal:unenrolself|Unenrol self from the course]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=171745#p977221 Testing the PayPal plugin in the PayPal Sandbox]&lt;br /&gt;
&lt;br /&gt;
[[de:Paypal-Einschreibung]]&lt;br /&gt;
[[es:Inscripción por Paypal]]&lt;br /&gt;
[[fr:Inscription Paypal]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=PayPal_enrolment&amp;diff=126856</id>
		<title>PayPal enrolment</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=PayPal_enrolment&amp;diff=126856"/>
		<updated>2017-02-15T13:01:59Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Enrolment}}&lt;br /&gt;
The PayPal enrolment plugin allows users to pay for courses and then be automatically enrolled. &lt;br /&gt;
&lt;br /&gt;
==PayPal account creation==&lt;br /&gt;
&lt;br /&gt;
# Go to https://www.paypal.com and create a PayPal account. Not required but recommended for selling: Upgrade your account to &amp;quot;Premier&amp;quot; status and get &amp;quot;Verified&amp;quot;.&lt;br /&gt;
# Set the Encoding to UFT-8.  In Paypal, go to &#039;&#039;Profile &amp;gt; Language Encoding&#039;&#039; (under the Selling Preferences column) and set your website&#039;s language (like select &amp;quot;Western European Languages (including English)&amp;quot; as it is the only English version).  Then click on the &amp;quot;More Options&amp;quot; button and set the Encoding to &amp;quot;UTF-8&amp;quot;, select &amp;quot;Yes&amp;quot; to use the same encoding for data sent from PayPal to you, and save.&lt;br /&gt;
# Optionally setup IPN in PayPal to interact with Moodle.  Log into PayPal, go to &amp;quot;Profile &amp;gt; Instant Payment Notifications (IPN)”, click &amp;quot;Turn On IPN&amp;quot;, click the &amp;quot;Edit settings&amp;quot; and enter a URL that references your IPN file in your Moodle installation (for example: &amp;lt;nowiki&amp;gt;http://&amp;lt;domain name&amp;gt;/moodle/enrol/paypal/ipn.php&amp;lt;/nowiki&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
==Enabling PayPal enrolment==&lt;br /&gt;
&lt;br /&gt;
An administrator can enable PayPal file enrolment as follows:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;Go to Site administration &amp;gt; Plugins &amp;gt; Enrolments &amp;gt; Manage enrol plugins&#039;&#039; and click the eye icon opposite PayPal. When enabled, it will no longer be greyed out. [[Manual enrolment]] must also be enabled, since the PayPal plugin requires it.&lt;br /&gt;
# Click the settings link, configure as required (see details of settings below), then click the &#039;Save changes&#039; button.&lt;br /&gt;
&lt;br /&gt;
* PayPal business email - This setting is case sensitive and must exactly match that in PayPal&lt;br /&gt;
* Default role assignment - This means the role that a new user will automatically be given in a course when they purchase access. Usually this would be &amp;quot;student&amp;quot; unless you have a special reason for choosing another role. As for other default settings, it may be overridden in individual courses.&lt;br /&gt;
&lt;br /&gt;
Tip: If you wish to allow users to create their own accounts on your site then you need to set up [[Email-based_self-registration|Email based self registration]].&lt;br /&gt;
&lt;br /&gt;
==Course settings for PayPal==&lt;br /&gt;
&lt;br /&gt;
===Checking you have PayPal in your course===&lt;br /&gt;
&lt;br /&gt;
# In a course, go to &#039;&#039;Course administration &amp;gt; Users &amp;gt; Enrolment methods&#039;&#039;&lt;br /&gt;
# If you do not see PayPal, use the pull down menu &amp;quot;Add method&amp;quot; and select PayPal&lt;br /&gt;
# Make sure PayPal has its &amp;quot;eye&amp;quot; opened: &lt;br /&gt;
&lt;br /&gt;
[[File:Paypalenrolmentmethod.png]]&lt;br /&gt;
{{Note|Make sure you don&#039;t  have [[Self enrolment]] enabled as this would allow users to access the course without paying. If you do need some users to self enrol for free, then add an [[Enrolment key]] in the self enrolment settings.}}&lt;br /&gt;
===Setting a price for your course===&lt;br /&gt;
&lt;br /&gt;
# In &#039;&#039;Course Administration &amp;gt; Users &amp;gt; Enrolment methods&#039;&#039;, click the edit/hand/pen icon to the right of the PayPal option. &lt;br /&gt;
# Optional: Give a name to this enrolment method if you wish in &amp;quot;Custom Instance name&amp;quot;&lt;br /&gt;
# Ensure that &amp;quot;Allow PayPal enrolments&amp;quot; is set to &amp;quot;yes&amp;quot;&lt;br /&gt;
# In &amp;quot;Enrol cost&amp;quot;, type in the cost of your course and in &amp;quot;Currency&amp;quot; choose your currency.&lt;br /&gt;
# Usually you would leave the &amp;quot;Assign role&amp;quot; as &amp;quot;student&amp;quot; unless you have a very special reason for allowing your users to enrol as, say, editing teachers etc&lt;br /&gt;
# Choose an enrolment period and/or start/end dates if desired.&lt;br /&gt;
# Click the &amp;quot;Save changes&amp;quot; button.&lt;br /&gt;
&lt;br /&gt;
[[File:Paypalcoursesettings.png]]&lt;br /&gt;
&lt;br /&gt;
===What the new user sees===&lt;br /&gt;
&lt;br /&gt;
When a new user clicks on your course link, they will see a message inviting them to go to PayPal to purchase access to the course. In the list of courses, PayPal courses have a dollar sign icon next to them.&lt;br /&gt;
{|&lt;br /&gt;
| [[File:Paypaluserview.png|frame|left|Message inviting user to pay via PayPal]]&lt;br /&gt;
| [[File:Paypalicon.png|frame|left|PayPal course listed with dollar sign icon]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Changing the dollar symbol==&lt;br /&gt;
[[File:PaypalGBP.png|frame|PayPal course listed with GBP sign icon]]&lt;br /&gt;
The default currency symbol for PayPal is a dollar sign. If you are using GBP or Euros or another currency, you can change this by creating your own customised icon with your choice of currency. Make it 16x 16 pixels and call it &#039;&#039;icon.gif&#039;&#039;  Upload your new icon via FTP to your  &#039;&#039;moodle directory&amp;gt;enrol&amp;gt;paypal&amp;gt;pix&#039;&#039;. Your icon.gif will override the dollar sign. Make sure you refresh your page to be sure of the changes.&lt;br /&gt;
&lt;br /&gt;
==PayPal capabilities==&lt;br /&gt;
&lt;br /&gt;
*[[Capabilities/enrol/paypal:config|Configure PayPal enrol instances]]&lt;br /&gt;
*[[Capabilities/enrol/paypal:manage|Manage enrolled users]]&lt;br /&gt;
*[[Capabilities/enrol/paypal:unenrol|Unenrol users from course]]&lt;br /&gt;
*[[Capabilities/enrol/paypal:unenrolself|Unenrol self from the course]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Inscription Paypal]]&lt;br /&gt;
[[de:Paypal-Einschreibung]]&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
*[http://moodle.org/mod/forum/discuss.php?d=171745#p977221 Testing the PayPal plugin in the PayPal Sandbox]&lt;br /&gt;
&lt;br /&gt;
[[es:Inscripción por Paypal]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Category:MoodleDocs&amp;diff=126855</id>
		<title>Category:MoodleDocs</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Category:MoodleDocs&amp;diff=126855"/>
		<updated>2017-02-15T10:10:06Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An index of pages relating to Moodle documentation.&lt;br /&gt;
&lt;br /&gt;
[[fr:Catégorie:Documentation]]&lt;br /&gt;
[[pt:Categoria:MoodleDocs]]&lt;br /&gt;
[[es:Categoría:MoodleDocs]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Documentation_philosophy&amp;diff=126854</id>
		<title>Documentation philosophy</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Documentation_philosophy&amp;diff=126854"/>
		<updated>2017-02-15T09:53:33Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Help}}* Focus on &#039;&#039;&#039;Moodle Docs&#039;&#039;&#039; as the central Moodle knowledge-base&lt;br /&gt;
* Transfer content from [http://moodle.org/course/view.php?id=5 Using Moodle] forum discussions (e.g. answers to how-to questions, ideas/suggestions of ways of using a particular feature) to Moodle Docs&lt;br /&gt;
* Encourage newcomers to contribute to Moodle Docs&lt;br /&gt;
:&amp;quot;New users are ideal for writing system-level documentation aimed at new users. They have the point of view and experience with the current software at the system level rather than at the library level. The most common evidence of this is FAQ lists, in which issues repeatedly raised on mailing lists and chat sessions are answered.&amp;quot; Source: [http://www.oss-watch.ac.uk/resources/documentation.xml Documentation issues in open source]&lt;br /&gt;
* Encourage Using Moodle regulars to contribute to Moodle Docs by adding content in response to a question in the forums, then provide a link to the Moodle Docs page in the forum discussion&lt;br /&gt;
* Provide &amp;quot;See also&amp;quot; links in Moodle Docs to additional information in Using Moodle discussions e.g. [[Forums]] (though if the Using Moodle discussion leads to a conclusion/agreement then this should be transferred to MoodleDocs)&lt;br /&gt;
&lt;br /&gt;
[[Category:MoodleDocs]]&lt;br /&gt;
&lt;br /&gt;
[[es:MoodleDocs:Filosofía de la documentación]]&lt;br /&gt;
[[fr:Philosophie de la documentation]]&lt;br /&gt;
[[zh:文档的哲学]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=User_tours&amp;diff=126341</id>
		<title>User tours</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=User_tours&amp;diff=126341"/>
		<updated>2016-12-09T08:59:04Z</updated>

		<summary type="html">&lt;p&gt;Fox: /* See also */ French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Site appearance}}&lt;br /&gt;
{{New features}}&lt;br /&gt;
&lt;br /&gt;
User tours are step-by-step guides to various areas of Moodle. Administrators can create new tours or import existing tours from [https://moodle.net/mod/data/view.php?id=17 Moodle.net/tours].  The [[Multi-language_content_filter| multi-lang filters]] allow for tours to display in different languages. Watch the screencast [https://youtu.be/hhLVvyP3DU0 User tours] to see a demonstration.&lt;br /&gt;
&lt;br /&gt;
==How is it set up?==&lt;br /&gt;
* As an administrator, access  &#039;User tours&#039; from Site administration&lt;br /&gt;
*Here you see any existing user tours and have the option to create a new tour, import a tour or browse user tours on the [https://moodle.net/mod/data/view.php?id=17 Tour repository]. (An administrator and a teacher tour have been added to new and upgraded sites to introduce the [[Boost theme]] and get you started.)&lt;br /&gt;
[[File:usertour_listing_page.png|thumb|600px|center]]&lt;br /&gt;
*For each of your existing tours, you can click either directly on its name or on its View action icon to view its current listed steps&lt;br /&gt;
*Each tour can be individually enabled or disabled as required in its settings page.&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; &#039;&#039;You can have multiple tours created for the same page destination, but  you should only have one per page enabled at one time.&#039;&#039;&lt;br /&gt;
*Icons against each tour allow you to view, edit, export or delete it.&lt;br /&gt;
*Tours will be displayed on any page whose URL matches the specified path value, for instance:&lt;br /&gt;
#/my/% - to match the Dashboard&lt;br /&gt;
#/course/view.php?id=2 - to match a specific course&lt;br /&gt;
#/mod/forum/view.php% - to match the forum discussion list&lt;br /&gt;
#/user/profile.php% - to match the user profile page&lt;br /&gt;
*Each tour will be configured with default step settings which you can edit in the settings page:&lt;br /&gt;
*Placement: Top, Bottom (Default), Left, Right. This determines where the step shows relative to its matching block or CSS selector on the page.&lt;br /&gt;
*Show if target not found: No (Default), Yes. This determines whether the step is shown or not when the target has not been found.&lt;br /&gt;
*Show with backdrop: No (Default), Yes. If yes, the step appears surrounded by a darkened backdrop to emphasis its content and location.&lt;br /&gt;
*Move on click: No (Default), Yes. If yes, the tour continues to the next step when the user clicks within the block or area targeted by the current step.&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; &#039;&#039;If you want users to be able to fill in forms as they work through the tour, then don&#039;t use a backdrop.&#039;&#039;&lt;br /&gt;
*Tour filters allow you to choose the role(s) and theme(s) for which the tour will be displayed.&lt;br /&gt;
&lt;br /&gt;
==How do I add steps to a tour ?==&lt;br /&gt;
* Either click directly on its name or on its View action icon to view the currently listed steps.&lt;br /&gt;
*Here are the initial steps for a sample tour for the Dashboard page:&lt;br /&gt;
[[File:usertour steps page.png|thumb|600px|center]]&lt;br /&gt;
*Click on the &#039;New step&#039; link and select what you want to highlight:&lt;br /&gt;
#Block - to display next to a matching block on the page. Select the block you want from the dropdown.&lt;br /&gt;
#CSS Selector - to display next to a matching selector on the page. Type in the relevant selector. (See examples below.)&lt;br /&gt;
#Display in the middle of the page&lt;br /&gt;
*Add the title and content&lt;br /&gt;
*For all types, select whether to display the step with a darkened backdrop&lt;br /&gt;
*For blocks or selectors, select the Placement option for where to place the display&lt;br /&gt;
*For blocks or selectors, select whether to display the step if its target isn’t found&lt;br /&gt;
*For blocks or selectors, select whether to move on click, ie move to next step when target is clicked&lt;br /&gt;
*Click on &#039;Save changes&#039;&lt;br /&gt;
&lt;br /&gt;
==How do user tours work?==&lt;br /&gt;
[[File:usertours01.png|thumb|600px|center]]&lt;br /&gt;
Once a user tour has been created and enabled, the first time that any user views a page which matches that user tour’s page (path) settings, the user tour will automatically start to display, starting with the first step. Each tour step will display its title and content, along with three button options:&lt;br /&gt;
*Prev - to return to the previous step in the tour&lt;br /&gt;
*Next - to go to the next step in the tour&lt;br /&gt;
*End Tour - to exit out of the tour completely&lt;br /&gt;
Any time a user wishes to re-run the page&#039;s tour, they can click on the &amp;quot;Reset user tour on this page&amp;quot; link at the bottom of the page.&lt;br /&gt;
&lt;br /&gt;
==Help with CSS selectors==&lt;br /&gt;
If you wish to use CSS selectors as part of your user tour, your browser&#039;s developer tools will be very useful in helping you create these selectors:&lt;br /&gt;
*[https://developer.chrome.com/devtools#dom-and-styles Google Chrome]&lt;br /&gt;
*[https://developer.mozilla.org/en-US/docs/Tools/DOM_Property_Viewer Mozilla Firefox]&lt;br /&gt;
*[https://developer.microsoft.com/en-us/microsoft-edge/platform/documentation/f12-devtools-guide/ Microsoft Edge]&lt;br /&gt;
*[https://developer.apple.com/library/content/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/ResourcesandtheDOM/ResourcesandtheDOM.html#//apple_ref/doc/uid/TP40007874-CH3-SW1 Apple Safari]&lt;br /&gt;
&lt;br /&gt;
===Example of a very simple CSS selector===&lt;br /&gt;
&lt;br /&gt;
[[File:CSS_selector_for_user_picture_in_a_user_tour.png|400px]]&lt;br /&gt;
&lt;br /&gt;
The settings above will produce this in the user tour:&lt;br /&gt;
&lt;br /&gt;
[[File:user picture chosen by CSS selector in a user tour.png|400px]]&lt;br /&gt;
&lt;br /&gt;
* How did we know that .userpicture would select just the Moodle user picture?&lt;br /&gt;
* By looking at the page with an HTML inspector in Firefox, as described in the &#039;Help with CSS selectors&#039; section below.&lt;br /&gt;
&lt;br /&gt;
===Other simple CSS selector examples===&lt;br /&gt;
 &#039;&#039;&#039;.breadcrumb&#039;&#039;&#039; These site links (known as breadcrumbs) will always show where you are in the site and how to return to a main page, such as your Dashboard or your course main page.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;.usermenu&#039;&#039;&#039;  This is the user menu. It contains links to your Dashboard, Messages, Profile, and your Preferences.&lt;br /&gt;
&lt;br /&gt;
 &#039;&#039;&#039;[value=&amp;quot;Customise this page&amp;quot;]&#039;&#039;&#039;  Add your own blocks of content by clicking here!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Multi-language capability==&lt;br /&gt;
&lt;br /&gt;
If your Moodle site is already set up or intending to be enabled for multi-lingual usage, tours are completely compatible with this requirement. Using the multi-lang filter formatting, each tour step’s titles and content, displayed to the user, can be edited to cater for multi-lingual requirements. Please see [[Multi-language_content_filter]] for further detailed instructions on how to enable, format and submit multi-lingual strings for your Moodle site.&lt;br /&gt;
&lt;br /&gt;
Please remember to go to &#039;&#039; Dashboard ► Site administration ► Plugins ► Filters ► Manage filters &#039;&#039; in order to enable the [[Multi-language_content_filter]] before importing any multi-language user tours into your site, or the users will see ALL the texts in ALL the languages simultaneously, as the following image illustrates:&lt;br /&gt;
&lt;br /&gt;
[[File:Multilang user tour when multilang filter NOT properly configured.png|300px]]&lt;br /&gt;
&lt;br /&gt;
When properly configured, a multi-language user tour will be automatically displayed in the user&#039;s preferred language, as seen in the following Dashboard tours starting pages in Spanish, English and French (in the same server):&lt;br /&gt;
&lt;br /&gt;
[[File:Multilang user tour in Spanish.png|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Multilang user tour in English.png|300px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Multilang user tour in French.png|300px]]&lt;br /&gt;
&lt;br /&gt;
==Translating user tours==&lt;br /&gt;
See [https://docs.moodle.org/dev/Translating_User_tours_from_Moodle.net how to translate user tours] in the developer&#039;s documentation..&lt;br /&gt;
&lt;br /&gt;
==Sharing is caring==&lt;br /&gt;
&lt;br /&gt;
We really hope that you are able to create some really powerful tours to help guide your users around your site. We certainly think you will and we encourage you to share any of the tours you create with others.&lt;br /&gt;
&lt;br /&gt;
We&#039;ve created a [https://moodle.net/mod/data/view.php?id=17 Moodle.net tour database] where you can share your creations and also find inspiration from the ideas of others.&lt;br /&gt;
&lt;br /&gt;
This work was paid for and sponsored by the kind folk of [http://www.dcu.ie/ Dublin City University].&lt;br /&gt;
&lt;br /&gt;
==User tour capabilities==&lt;br /&gt;
&lt;br /&gt;
There is just one capability, which is allowed for the default role of manager:&lt;br /&gt;
&lt;br /&gt;
* [[Capabilities/tool/usertours:managetours|Create, edit and remove user tours]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [http://jsonlint.com/ JSONLint - a JSON validator] useful for checking the workings of a JSON file&lt;br /&gt;
&lt;br /&gt;
[[es:Tours para Usuarios]]&lt;br /&gt;
[[fr:Visites guidées]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=MySQL&amp;diff=125089</id>
		<title>MySQL</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=MySQL&amp;diff=125089"/>
		<updated>2016-08-29T13:40:51Z</updated>

		<summary type="html">&lt;p&gt;Fox: /* Which database belongs to which Moodle */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
MySQL is one of the supported databases that underpins a Moodle installation. &lt;br /&gt;
&lt;br /&gt;
== Installing MySQL ==&lt;br /&gt;
&lt;br /&gt;
* If you are running Linux your preference should be to install using your distributions package manager. This ensures you will get any available updates.  However, you can also use apt-get or yum depending on the distribution that you are running.&lt;br /&gt;
* There are installers available for most popular operating systems at http://www.mysql.com/downloads/mysql/.&lt;br /&gt;
* It is possible and reasonably straightforward to build mysql from source but it is not recommended (the pre-built binaries are supposedly better optimised).&lt;br /&gt;
* Make sure you set a password for the &#039;root&#039; user (see http://dev.mysql.com/doc/refman/5.0/en/default-privileges.html).&lt;br /&gt;
* Consider installing and configuring my.cnf (the MySQL settings file) to suit your needs. The default configuration is usually very conservative in respect of memory usage versus performance. Increase the &#039;max_allowed_packet&#039; setting to at least 4 megabytes.&lt;br /&gt;
* If you are going to use Master/Slave replication, you must add binlog_format = &#039;ROW&#039; into your my.cnf within [mysqld]. Otherwise, Moodle will not be able to write to the database.&lt;br /&gt;
&lt;br /&gt;
== Creating Moodle database ==&lt;br /&gt;
&lt;br /&gt;
These are the steps to create an empty Moodle database. Substitute your own database name, user name and password as appropriate.&lt;br /&gt;
&lt;br /&gt;
The instructions assume that the web server and MySQL server are on the same machine. In this case the &#039;dbhost&#039; is &#039;localhost&#039;. If they are on different machines substitute the name of the web server for &#039;localhost&#039; in the following instructions and the &#039;dbhost&#039; setting will be the name of the database server. &lt;br /&gt;
Databases have a &amp;quot;Character set&amp;quot; and a &amp;quot;Collation&amp;quot;. For moodle the character set should be utf8 and the collation is utf8_general_ci. You may get the option to set these values when you create the database. If you are not given a choice, the default options are probably good. An install on an old server may have the wrong settings.&lt;br /&gt;
&lt;br /&gt;
=== Command line === &lt;br /&gt;
&lt;br /&gt;
* To create a database using the &#039;mysql&#039; command line client, first log into MySQL&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ mysql -u root -p&lt;br /&gt;
Enter password: &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Enter the password you previously set - or been given - for the MySQL &#039;root&#039; user). After some pre-amble this should take you to the &#039;&#039;mysql&amp;gt;&#039;&#039; prompt.&lt;br /&gt;
* Create a new database (called &#039;moodle&#039; - substitute your own name if required).  We recommend you use &#039;&#039;&#039;utf8_unicode_ci&#039;&#039;&#039; for collation.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql&amp;gt; CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Add a user/password with the minimum needed permissions:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mysql&amp;gt; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodleuser@localhost IDENTIFIED BY &#039;yourpassword&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
...which creates a user called &#039;moodleuser&#039; with a password &#039;yourpassword&#039;. Make sure you invent a strong password and resist the temptation to &#039;GRANT ALL&#039;.&lt;br /&gt;
&lt;br /&gt;
=== phpMyAdmin ===&lt;br /&gt;
&lt;br /&gt;
[http://www.phpmyadmin.net/ phpMyAdmin] is a web based administration tool for MySQL. If this is available you can use it to create a new database. Make sure that you select &#039;UTF8&#039; as the default character set.&lt;br /&gt;
&lt;br /&gt;
==Which database belongs to which Moodle==&lt;br /&gt;
If you have installed several Moodle installations on the same server, there will be several databases in your MySQL server. The names might be quite poor reflections of the content like  _mdl1 _mdl2 _mdl3 . So how do I see which database goes with which Moodle installation? You can go in with phpMyAdmin and in the various databases check for the table &amp;quot;mdl_course&amp;quot;. There you will easily see the name of that Moodle Installation. In table mdl_config you can see the Moodle version. The main URL for the site is not in the database except where there are absolute links.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[MariaDB]]&lt;br /&gt;
* [http://www.mysql.com/ The MySQL homepage]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/MySQL Wikipedia article about &#039;&#039;MySQL&#039;&#039;]&lt;br /&gt;
* [http://forums.mysql.com/read.php?24,92131,92131 List of articles on MySQL performance tuning]&lt;br /&gt;
&lt;br /&gt;
[[Category:SQL databases]]&lt;br /&gt;
&lt;br /&gt;
[[ja:MySQL]]&lt;br /&gt;
[[de:MySQL]]&lt;br /&gt;
[[es:MySQL]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Cron_with_Unix_or_Linux&amp;diff=124139</id>
		<title>Cron with Unix or Linux</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Cron_with_Unix_or_Linux&amp;diff=124139"/>
		<updated>2016-06-20T08:40:00Z</updated>

		<summary type="html">&lt;p&gt;Fox: Updated, and deleted (very) old information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
On Unix and Linux use the built in &#039;&#039;cron&#039;&#039; program which is standard on nearly all systems. You are required to add a command to the &#039;crontab&#039; (the table that holds cron commands) for the web server user. &lt;br /&gt;
&lt;br /&gt;
There are two different methods that can be used to invoke the Moodle cron process:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; The commands shown need to be added to the crontab to function (described in a moment). However, you can - and should - run them on the command line to check they work first. &lt;br /&gt;
&lt;br /&gt;
== Method 1: The command line (cli) cron ==&lt;br /&gt;
&lt;br /&gt;
If you have a choice, this is normally the best way to run Moodle cron. &lt;br /&gt;
&lt;br /&gt;
PHP is also capable of running programs directly from the command line. Your system needs to be set up to do this; specifically you need the &#039;CLI&#039; version of PHP to be installed. Most systems with PHP installed will have this by default. If you have the PHP CLI version installed then this is the recommended method of invoking cron. The correct command will be something like...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/bin/php /path/to/moodle/admin/cli/cron.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(substitute the correct path to moodle and for php as required)&lt;br /&gt;
&lt;br /&gt;
You can simply type this on the command line this to see if it works. If you are not sure about the path to PHP you can type &amp;quot;&amp;lt;code&amp;gt;which php&amp;lt;/code&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tip:&#039;&#039;&#039;: If you have problems, see the [[PHP]] page. In particular, suspect an alternate php.ini for the CLI PHP command which may not have suitable settings.&lt;br /&gt;
&lt;br /&gt;
== Method 2: Web based cron ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; In order to use the web based cron script you must first check [[Cron settings]] to make sure this method is permitted. &lt;br /&gt;
&lt;br /&gt;
The idea is to call the following web page (you can try this from your browser):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
http://url.of.your/moodle/admin/cron.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A command line (text based) browser is needed to run this on the server. Possibilities are as follows (OSX, for example, only ships with curl)...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/bin/wget -q -O /dev/null/ http://url.of.your/moodle/admin/cron.php&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(no output is displayed - remove the &#039;&#039;-O /dev/null/&#039;&#039; to test)&lt;br /&gt;
&lt;br /&gt;
...OR...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/usr/bin/curl http://url.of.your/moodle/admin/cron.php -o /dev/null/ -silent&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(no output is displayed - remove the &#039;&#039;-o /dev/null/ -silent&#039;&#039; to test)&lt;br /&gt;
&lt;br /&gt;
==Using the crontab program on Unix/Linux==&lt;br /&gt;
&lt;br /&gt;
Once you have selected (and tested!) an appropriate command to invoke the Moodle cron it must be added to the web users &#039;crontab&#039; to schedule it to run regularly. &#039;Crontab&#039; is both a file containing the user&#039;s cron commands and is also the name of the (command line) program used to edit it. Use the following command (as root) substituting the correct user in place of &#039;www-data&#039; (e.g. &#039;apache&#039; for Centos, &#039;www-data&#039; for Debian/Ubuntu - Google will know!)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# crontab -u www-data -e&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This will bring up an editor window (the first time it may ask you which editor to use). Add the command onto the end of the file in this way (it may be empty or it may have some instructional comments):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 */1 * * * * /usr/bin/php  /path/to/moodle/admin/cli/cron.php &amp;gt;/dev/null&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The first five entries specify the times, followed by the command, to run. This says to run the command every minute which is normally ok. On a hosted system you may get complaints if you do not run it a lot less often (e.g. to run every two hours use &#039;0 */2 * * *&#039; for the first five entries). If you want to use the wget/curl version, the first five entries remain the same - just change the command part.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://linuxweblog.com/node/24 A basic crontab tutorial] &lt;br /&gt;
* [http://www.freebsd.org/cgi/man.cgi?query=crontab&amp;amp;apropos=0&amp;amp;sektion=5&amp;amp;manpath=FreeBSD+6.0-RELEASE+and+Ports&amp;amp;format=html Online version of the man page]&lt;br /&gt;
* [http://www.easycron.com/predictor Predicting Cron job&#039;s run time]&lt;br /&gt;
&lt;br /&gt;
[[es:Cron con Unix o Linux]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Logged_in_user_block&amp;diff=122247</id>
		<title>Logged in user block</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Logged_in_user_block&amp;diff=122247"/>
		<updated>2016-02-11T09:23:06Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Blocks}}&lt;br /&gt;
The logged in user block displays certain information about the user who is currently logged in to a Moodle course:&lt;br /&gt;
&lt;br /&gt;
[[File:Loggedinuserexample.png]]&lt;br /&gt;
&lt;br /&gt;
The information which is displayed can be selected by the course teacher by clicking on the &amp;quot;configure&amp;quot; icon of the block. A number of dropdown boxes then appear for the teacher to choose which items will appear:&lt;br /&gt;
&lt;br /&gt;
[[File:Loggedinusersettings.png]]&lt;br /&gt;
&lt;br /&gt;
[[de:Persönliches-Profil-Block]]&lt;br /&gt;
[[es:Bloque de usuario ingresado]]&lt;br /&gt;
[[fr:Bloc Utilisateur connecté]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Moodle_Mobile_additional_features&amp;diff=122231</id>
		<title>Moodle Mobile additional features</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Moodle_Mobile_additional_features&amp;diff=122231"/>
		<updated>2016-02-10T16:05:15Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Mobile}}&lt;br /&gt;
{{Infobox plugin&lt;br /&gt;
|type = Local plugin&lt;br /&gt;
|entry = http://moodle.org/plugins/view.php?plugin=local_mobile&lt;br /&gt;
|tracker = https://tracker.moodle.org/browse/CONTRIB/component/13930&lt;br /&gt;
|discussion = https://moodle.org/mod/forum/view.php?id=7798&lt;br /&gt;
|maintainer = [[User:Juan Leyva|Juan Leyva]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The Moodle Mobile additional features plugin provides new features and web services for the Moodle Mobile app which are currently only available in the latest Moodle version.&lt;br /&gt;
&lt;br /&gt;
This plugin is officially developed and maintained by Moodle HQ&lt;br /&gt;
&lt;br /&gt;
== How it works ==&lt;br /&gt;
&lt;br /&gt;
Once installed the plugin creates a new service &amp;quot;Moodle Mobile additional features&amp;quot;. The Mobile app checks if this service is enabled. If not, the Mobile app falls backs to the standard core Mobile app service.&lt;br /&gt;
&lt;br /&gt;
Please, open [[Moodle Mobile features]] to check what new features are added to your site depending on your Moodle version.&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
* Support for sites using SSO authentication methods (Shibboleth and CAS)&lt;br /&gt;
* Support for sites using MNet authentication (Moodle Network authentication)&lt;br /&gt;
* Support for push notifications in Moodle sites prior to version 2.6&lt;br /&gt;
&lt;br /&gt;
=== Enable authentication for sites using SSO methods (like Shibboleth and CAS) ===&lt;br /&gt;
&lt;br /&gt;
VERY IMPORTANT NOTE: You need to disable the &amp;quot;Auto login guest&amp;quot; option &amp;quot;autologinguests&amp;quot;. This setting is not compatible with the SSO via app.&lt;br /&gt;
&lt;br /&gt;
SSO and MNet authentication is not supported in the Windows 8 and Windows Phone 8 apps&lt;br /&gt;
&lt;br /&gt;
Once the plugin is installed, you need to go to Site administration &amp;gt; Plugins &amp;gt; Local plugins &amp;gt; Moodle Mobile additional features&lt;br /&gt;
&lt;br /&gt;
There you can choose the &amp;quot;Type of login&amp;quot;:&lt;br /&gt;
; &#039;&#039;&#039;Via the app&#039;&#039;&#039; : Is the default login, the user must introduce his credentials in the app&lt;br /&gt;
; &#039;&#039;&#039;Via a browser window&#039;&#039;&#039; : A new browser instance is open in the mobile device pointing to the login form in the Moodle site (which may again redirect to external identity providers if required). The user must introduce his credentials there. This is the option that must be selected for sites using SSO methods (or for sites that wants to force the user to authenticate in the site, not in the app)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;mediaplayer&amp;gt;https://www.youtube.com/watch?v=cl8rsyyyg9g&amp;lt;/mediaplayer&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
# Unpack the zip file into the local/ directory. A new directory will be created called local/mobile.&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Notifications&#039;&#039; to complete the plugin installation.&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Web services &amp;gt; Mobile&#039;&#039; and enable web services for mobile devices (Remember to save the changes)&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Web services &amp;gt; External services&#039;&#039;, edit &amp;quot;Moodle Mobile additional features&amp;quot; and check the &amp;quot;Enabled&amp;quot; field, then save changes.&lt;br /&gt;
# Go to &#039;&#039;Site administration &amp;gt; Users &amp;gt; Permissions &amp;gt; Define roles&#039;&#039;, edit the Authenticated user role and allow the capability moodle/webservice:createtoken.&lt;br /&gt;
&lt;br /&gt;
Note: You need to have upgraded the Moodle Mobile app to version 1.4.4.&lt;br /&gt;
&lt;br /&gt;
If you are currently using the Moodle Mobile app, you will need to log out of all your sites in order for the app to detect the new service.&lt;br /&gt;
&lt;br /&gt;
== Admin users, please read ==&lt;br /&gt;
&lt;br /&gt;
This plugin installs a new service in your Moodle installation, the automatic token creation for this type of services is forbidden for admin users. This means that admin users will not be able to use the Mobile app.&lt;br /&gt;
&lt;br /&gt;
This can be solved easily, administrators must create a token manually in Moodle (&#039;&#039;Plugins &amp;gt; Web Services &amp;gt; Manage tokens&#039;&#039;) for the local_mobile service. &#039;&#039;&#039;Note:&#039;&#039;&#039; Be sure to toggle the default &amp;quot;Moodle mobile web services&amp;quot; setting to &amp;quot;Moodle mobile additional features service&amp;quot; before creating the token. &lt;br /&gt;
&lt;br /&gt;
[[de:Moodle Mobile - Zusatzfunktionen]]&lt;br /&gt;
[[es:Características adicionales de Moodle Mobile]]&lt;br /&gt;
[[fr:Fonctionnalités additionnelles de l&#039;app mobile]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Creating_Moodle_Mobile_friendly_courses&amp;diff=122230</id>
		<title>Creating Moodle Mobile friendly courses</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Creating_Moodle_Mobile_friendly_courses&amp;diff=122230"/>
		<updated>2016-02-10T16:02:39Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Mobile}}&lt;br /&gt;
As more and more students access courses from their smartphones, tablets or other mobile devices, it is increasingly important to ensure your courses are mobile-friendly.&lt;br /&gt;
&lt;br /&gt;
Encouraging students to install the [https://download.moodle.org/mobile/ official Moodle mobile app] is one way to improve their learning experience. Below are some suggestions for optimising your course materials for students both using the app and accessing Moodle from mobile devices.&lt;br /&gt;
&lt;br /&gt;
==Use a mobile-friendly theme==&lt;br /&gt;
&lt;br /&gt;
Recent versions of Moodle allow for responsive themes, which adapt to the browser screen size. Make sure your course uses such a theme and check its contents yourself before your students start the course.&lt;br /&gt;
&lt;br /&gt;
==Notifications and messages==&lt;br /&gt;
&lt;br /&gt;
Encourage your students to enable mobile notifications so they are alerted about calendar events, forum posts, messages, assignment submissions and so on. Find out more in [[Mobile app notifications]].&lt;br /&gt;
&lt;br /&gt;
==Provide a &#039;how to&#039; guide to Moodle on the mobile==&lt;br /&gt;
&lt;br /&gt;
Consider offering your students a guide (as a PDF or a page resource) on how to access your course on the app, what they can do and not (yet) do from the app. Read up on the [[Moodle Mobile features]] and what&#039;s [[New for mobile]].&lt;br /&gt;
&lt;br /&gt;
==Setting up your course==&lt;br /&gt;
&lt;br /&gt;
*Topics or weekly course format is best suited to mobile devices.&lt;br /&gt;
*Don&#039;t use orphaned activities or direct links to activities.&lt;br /&gt;
*If you have a mix of students accessing the course on mobile and desktop, consider asking your admin to install the [[Moodle Mobile availability plugin]] which restricts items to desktop or mobile users.&lt;br /&gt;
&lt;br /&gt;
==Course content==&lt;br /&gt;
&lt;br /&gt;
*Labels are initially collapsed, so include a short text introduction of what is inside any label.&lt;br /&gt;
*Use responsive HTML in pages or mini-sites.&lt;br /&gt;
*Try to use a [[Page resource|page resource]] instead of downloadable documents where possible.&lt;br /&gt;
*Avoid uploading many documents or having numerous, text heavy pages. Think more in terms of short &amp;quot;information-bytes&amp;quot;.&lt;br /&gt;
*If you include YouTube videos, provide them also for download and offline viewing in a [[Folder resource|folder]]. Not all video formats are supported so add them in different formats. (MP4 is probably the most widely accepted format.)&lt;br /&gt;
*Note that if you add YouTube video links or map links as URL resources, they will open automatically in the app.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| [[File:moodlemobile_short_text_intro.png|thumb|Short text for label]]&lt;br /&gt;
| [[File:moodlemobile_responsive_html.png|thumb|Responsive HTML]]&lt;br /&gt;
| [[File:moodlemobile_youtube_maps_links.png|thumb|Map link]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Things to avoid===&lt;br /&gt;
&lt;br /&gt;
Some activities are not yet supported by the mobile app, so find alternatives.&lt;br /&gt;
&lt;br /&gt;
*Instead  of using an [[IMS content package]], unzip the file and add it as a resource (mini-site)&lt;br /&gt;
&lt;br /&gt;
See [[Moodle Mobile SCORM player]] for things to avoid in SCORM packages.&lt;br /&gt;
&lt;br /&gt;
==Learn more==&lt;br /&gt;
&lt;br /&gt;
* [http://es.slideshare.net/juanleyva/tips-for-creating-moodle-mobile-friendly-courses-sites-moodlemoot-spain-2014 Tips for creating Moodle Mobile friendly courses and sites - MoodleMoot Spain 2014] - Juan Leyva, Mobile app developer,  presented this in 2014. While some features have now been updated, the general principles are still useful. &lt;br /&gt;
* An open course, about &amp;quot;[http://tempus-efa.proj.ac.il/moodle/course/view.php?id=102 Teaching using Mobile - Best practices]&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[es:Crear sitios amistosos para Moodle Mobile]]&lt;br /&gt;
[[fr:Créer des cours pour appareils mobiles]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Mobile_app_notifications&amp;diff=122229</id>
		<title>Mobile app notifications</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Mobile_app_notifications&amp;diff=122229"/>
		<updated>2016-02-10T16:01:28Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Mobile}}&lt;br /&gt;
&lt;br /&gt;
==For students and teachers==&lt;br /&gt;
[[File:12Notifications.png|thumb|Forum post notification]]&lt;br /&gt;
The Moodle mobile app lets you keep up to date with all that&#039;s happening in your courses and on the site. Every time you open the app, events are synchronised with the main website.&lt;br /&gt;
&lt;br /&gt;
You will receive [[Calendar|Moodle calendar]] event notifications automatically. If you don&#039;t want to get them, you can turn them all off in the app in &#039;&#039;Settings &amp;gt; General,&#039;&#039; or individually in the Calendar events options in the main menu.&lt;br /&gt;
&lt;br /&gt;
You will also receive notifications of messages, forum posts, submitted assignments etc (known as &#039;push notifications&#039;) if your site administrator has enabled these. To receive these notifications you need to enable them for your mobile on the main site, from the user menu top right &amp;gt;&#039;&#039;Preferences&amp;gt;Messaging.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==For administrators==&lt;br /&gt;
&lt;br /&gt;
Push notifications can be enabled by an administrator by connecting their Moodle site to a messaging server such https://messages.moodle.net (available for [[Site registration|registered Moodle sites]] only). An access key can be obtained via &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Message outputs &amp;gt; Mobile Notifications&#039;&#039;. (If you have problems requesting the access key, please fill in the [http://goo.gl/forms/WLwkbe8b7c  Airnotifier access key manual request form]. Your site registration will be checked and you will be sent an access key in a few days if everything is correct.)&lt;br /&gt;
&lt;br /&gt;
Users then need to connect at least once with the latest version of the Moodle Mobile app in order to register their phones with the Moodle site.&lt;br /&gt;
&lt;br /&gt;
=== Event Reminders plugin===&lt;br /&gt;
&lt;br /&gt;
Push notifications can also include calendar event notifications, however this requires the [https://moodle.org/plugins/view/local_reminders Event Reminders plugin] to be installed on the Moodle site.&lt;br /&gt;
&lt;br /&gt;
The Event Reminders plugin will automatically send reminders for Moodle calendar events in a timely manner via Moodle message interface. It also allows users to control how they receive messages for each type of event in the Moodle calendar.&lt;br /&gt;
&lt;br /&gt;
=== Installing your own notifications infrastructure ===&lt;br /&gt;
&lt;br /&gt;
If you have a customized version of the Moodle Mobile app, or you want to use your own notifications infrastructure, you will have to install a private [http://airnotifier.github.io AirNotifier] (backend server for notifications).&lt;br /&gt;
&lt;br /&gt;
https://messages.moodle.net uses a slightly modified version of Airnotifier: https://github.com/moodlehq/airnotifier/tree/moodle2. &lt;br /&gt;
&lt;br /&gt;
You will have to add your app certificates - see https://github.com/airnotifier/airnotifier/wiki/Installation for further information.&lt;br /&gt;
&lt;br /&gt;
The Airnotifier message plugin allows you to point to your custom Airnotifier instance using your own access keys.&lt;br /&gt;
&lt;br /&gt;
Remember to install using GIT (repository https://github.com/moodlehq/airnotifier.git branch &#039;&#039;moodle2&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
[[de:Moodle Mobile - Mitteilungen]]&lt;br /&gt;
[[es:Mobile app Notificaciones Push]]&lt;br /&gt;
[[fr:Notifications de l&#039;app mobile]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Moodle_Mobile&amp;diff=122227</id>
		<title>Moodle Mobile</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Moodle_Mobile&amp;diff=122227"/>
		<updated>2016-02-10T15:47:27Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Main page}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
==On the move with Moodle==&lt;br /&gt;
[[File:Mobile orientation.png|thumb|Access your Moodle course on your mobile]]&lt;br /&gt;
Moodle Mobile is the official mobile app for Moodle.&lt;br /&gt;
&lt;br /&gt;
* Browse the content of your courses, even when offline&lt;br /&gt;
* Participate in course activities from your mobile device&lt;br /&gt;
* Receive instant notifications of messages and other events&lt;br /&gt;
* Quickly find and contact other people in your courses&lt;br /&gt;
* Upload images, audio, videos and other files.&lt;br /&gt;
* View your course grades&lt;br /&gt;
&lt;br /&gt;
... and more - see the full list of [[Moodle Mobile features]].&lt;br /&gt;
&lt;br /&gt;
The Moodle Mobile app is available for free from Google Play, Apple Store, and the Windows Phone Store. See [https://download.moodle.org/mobile/ Moodle Mobile downloads] for links. You can also install the app directly from your mobile device by searching for &#039;Moodle Mobile&#039; with author/owner &#039;Moodle Pty Ltd&#039;.&lt;br /&gt;
&lt;br /&gt;
==Using the app==&lt;br /&gt;
*To set up notifications on your app, see [[Mobile app notifications]]&lt;br /&gt;
*For a quick guide to setting up the Moodle mobile app on your site, see [[Moodle Mobile guide for admins]].&lt;br /&gt;
*For ideas to make your Moodle course more mobile friendly, see [[Creating Moodle Mobile friendly courses]].&lt;br /&gt;
&lt;br /&gt;
==Rapid development==&lt;br /&gt;
More features are being added to Moodle Mobile all the time. See [[New for mobile|what&#039;s new in Moodle Mobile]] and the [[:dev:Moodle Mobile release notes|Moodle Mobile release notes]].&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Moodle Mobile FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Mobile]]&lt;br /&gt;
	&lt;br /&gt;
[[fr:App mobile]]&lt;br /&gt;
[[ja:モバイルアプリ]]&lt;br /&gt;
[[de:Mobiles Moodle]]&lt;br /&gt;
[[es:Moodle Mobile]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Moodle_Mobile_features&amp;diff=122226</id>
		<title>Moodle Mobile features</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Moodle_Mobile_features&amp;diff=122226"/>
		<updated>2016-02-10T15:44:59Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Mobile}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
&amp;lt;div class=&amp;quot;contentblock&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;div class=&amp;quot;row-fluid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;thumbnails&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;&lt;br /&gt;
[[File:mobile01.png|600px]]&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h4&amp;gt;See your courses at glance&amp;lt;/h4&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt;Your courses are listed with easy access to contents, participants, grades and notes. A useful filter field lets you find a particular course quickly. If your token expires during a session, you&#039;re prompted to re-enter your password and continue. &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;&lt;br /&gt;
[[File:02connectwithcourseparticipants.png|600px]]&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h4&amp;gt;Connect with course participants&amp;lt;/h4&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt; Infinite scrolling improves access to the participant view, with the complete user profile now displayed and available from every page. &amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt; &lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;contentblock&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;div class=&amp;quot;row-fluid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;thumbnails&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;&lt;br /&gt;
[[File:10PulltoRefresh.png|600px]]&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h4&amp;gt;Pull to refresh&amp;lt;/h4&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt;Most screens will allow you to pull to refresh, improving the real-time participation experience.&amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Mobile orientation.png|600px]]&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h4&amp;gt; Orientation and resolution support &amp;lt;/h4&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt;The app displays in portrait or landscape view, whatever your screen resolution.&amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;contentblock&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;div class=&amp;quot;row-fluid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;thumbnails&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;&lt;br /&gt;
[[File:03coursecontent.png|600px]]&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h4&amp;gt;Easily access course content&amp;lt;/h4&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt;View course activities and and download materials for offline use.  Work through Books and IMS Content packages directly in the app. The downloading status of resources is preserved even when changing sections or pages.&amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;&lt;br /&gt;
[[File:04ActivityCompletionCheckboxes.png|600px]]&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h4&amp;gt;Activity completion&amp;lt;/h4&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt;Track progress from your device with [[Activity completion]]. Automatic completion is registered, and students can also manually mark a task complete on their mobile.&amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;contentblock&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;div class=&amp;quot;row-fluid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;thumbnails&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;&lt;br /&gt;
[[File:05Grades.png|600px]]&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h4&amp;gt;Grades and grading&amp;lt;/h4&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt; A Grades link for each course gives fingertip access to the gradebook, and teachers can view assignment submissions on the move.&amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;&lt;br /&gt;
[[File:06Notes.png|600px]]&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h4&amp;gt;Notes&amp;lt;/h4&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt;Teachers can view site, course and personal notes about their students and add their own notes.&amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;contentblock&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;div class=&amp;quot;row-fluid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;thumbnails&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;&lt;br /&gt;
[[File:07Messages.png|600px]]&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h4&amp;gt;Message participants&amp;lt;/h4&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt;Send and view private messages to colleagues and students from the Messages link in the side tab.&amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;&lt;br /&gt;
[[File:08Calendar.png|600px]]&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h4&amp;gt;Keep up to date with calendar events&amp;lt;/h4&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt;Site, course and user events can be viewed in the calendar.Calendar events can now be viewed offline and infinite scrolling is available.&amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;contentblock&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;div class=&amp;quot;row-fluid&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;thumbnails&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;&lt;br /&gt;
[[File:09PrivateFiles.png|600px]]&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h4&amp;gt;View and upload to your Private files&amp;lt;/h4&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt;Check the contents of your private files and upload media to them on the go. You&#039;re now allowed up to 50MB storage (depending on your SD card).&amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;&lt;br /&gt;
[[File:12Notifications.png|600px]]&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;&lt;br /&gt;
            &amp;lt;h4&amp;gt;Notifications&amp;lt;/h4&amp;gt;&lt;br /&gt;
            &amp;lt;p&amp;gt;Keep up to date with notifications. The app supports both local (calendar events) and push (messages, forum posts, submitted assignments etc) notifications. See [[Mobile app notifications]] for more details. Infinite scrolling is available and local notifications have multi-site support.&amp;lt;/p&amp;gt;&lt;br /&gt;
          &amp;lt;/div&amp;gt;&lt;br /&gt;
        &amp;lt;/div&amp;gt;&lt;br /&gt;
      &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;/ul&amp;gt;&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;div class=&amp;quot;row-fluid&amp;quot;&amp;gt;			&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;thumbnails&amp;quot;&amp;gt;			&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;			&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;			&lt;br /&gt;
[[File: MobileChoice.png|600px]]			&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;			&lt;br /&gt;
            &amp;lt;h4&amp;gt;Make choices&amp;lt;/h4&amp;gt;			&lt;br /&gt;
            &amp;lt;p&amp;gt;The app supports students making and removing choices.&amp;lt;/p&amp;gt;			&lt;br /&gt;
          &amp;lt;/div&amp;gt; 			&lt;br /&gt;
        &amp;lt;/div&amp;gt;			&lt;br /&gt;
      &amp;lt;/li&amp;gt;			&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;			&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;			&lt;br /&gt;
[[File:MobileappChat.png|600px]]			&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;			&lt;br /&gt;
            &amp;lt;h4&amp;gt;Engage in chat, on the move&amp;lt;/h4&amp;gt;			&lt;br /&gt;
            &amp;lt;p&amp;gt;Participate in a course [[Chat activity]].&amp;lt;/p&amp;gt;			&lt;br /&gt;
          &amp;lt;/div&amp;gt;			&lt;br /&gt;
        &amp;lt;/div&amp;gt;			&lt;br /&gt;
      &amp;lt;/li&amp;gt;			&lt;br /&gt;
    &amp;lt;/ul&amp;gt;			&lt;br /&gt;
  &amp;lt;/div&amp;gt;			&lt;br /&gt;
&amp;lt;div class=&amp;quot;row-fluid&amp;quot;&amp;gt;			&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;thumbnails&amp;quot;&amp;gt;			&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;			&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;			&lt;br /&gt;
[[File:MobileSurvey.png|600px]]			&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;			&lt;br /&gt;
            &amp;lt;h4&amp;gt; Feed back to teachers with a survey&amp;lt;/h4&amp;gt;			&lt;br /&gt;
            &amp;lt;p&amp;gt;[[Survey|Surveys]] may now be taken using the app.&amp;lt;/p&amp;gt;			&lt;br /&gt;
          &amp;lt;/div&amp;gt; 			&lt;br /&gt;
        &amp;lt;/div&amp;gt;			&lt;br /&gt;
      &amp;lt;/li&amp;gt;			&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;			&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;			&lt;br /&gt;
[[File: coursesearchmobile.png|600px]]			&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;			&lt;br /&gt;
            &amp;lt;h4&amp;gt;Search the list of courses&amp;lt;/h4&amp;gt;			&lt;br /&gt;
            &amp;lt;p&amp;gt;App users can search courses to find one they wish to take.&amp;lt;/p&amp;gt;			&lt;br /&gt;
          &amp;lt;/div&amp;gt;			&lt;br /&gt;
        &amp;lt;/div&amp;gt;			&lt;br /&gt;
      &amp;lt;/li&amp;gt;			&lt;br /&gt;
    &amp;lt;/ul&amp;gt;			&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;row-fluid&amp;quot;&amp;gt;			&lt;br /&gt;
    &amp;lt;ul class=&amp;quot;thumbnails&amp;quot;&amp;gt;			&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;			&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;			&lt;br /&gt;
[[File:enrolmemobile.png|600px]]			&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;			&lt;br /&gt;
            &amp;lt;h4&amp;gt;Enrol yourself from your smartphone&amp;lt;/h4&amp;gt;			&lt;br /&gt;
            &amp;lt;p&amp;gt;Found a course you like? Enrol immediately via the app.&amp;lt;/p&amp;gt;			&lt;br /&gt;
          &amp;lt;/div&amp;gt; 			&lt;br /&gt;
        &amp;lt;/div&amp;gt;			&lt;br /&gt;
      &amp;lt;/li&amp;gt;			&lt;br /&gt;
      &amp;lt;li class=&amp;quot;span6&amp;quot;&amp;gt;			&lt;br /&gt;
        &amp;lt;div class=&amp;quot;thumbnail&amp;quot;&amp;gt;			&lt;br /&gt;
[[File:scorm syncing.png|600px]]			&lt;br /&gt;
          &amp;lt;div class=&amp;quot;caption&amp;quot;&amp;gt;			&lt;br /&gt;
            &amp;lt;h4&amp;gt;Play SCORM packages on and off-line&amp;lt;/h4&amp;gt;			&lt;br /&gt;
            &amp;lt;p&amp;gt;The [[Moodle Mobile SCORM player]] tracks interactions and synchronises when you&#039;re back online.&amp;lt;/p&amp;gt;			&lt;br /&gt;
          &amp;lt;/div&amp;gt; 			&lt;br /&gt;
        &amp;lt;/div&amp;gt;			&lt;br /&gt;
      &amp;lt;/li&amp;gt;		&lt;br /&gt;
    &amp;lt;/ul&amp;gt;			&lt;br /&gt;
  &amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Features summary====&lt;br /&gt;
&lt;br /&gt;
* Responsive design for phone and tablets&lt;br /&gt;
* Upload a picture into your private file area&lt;br /&gt;
* Record an audio file and upload it into your private file area&lt;br /&gt;
* Record a video and upload it into your private file area&lt;br /&gt;
* Send a private message to a course participant (can be done offline)&lt;br /&gt;
* Take a personal note about a course participant (can be done offline)&lt;br /&gt;
* Add a course participant to your phone contact&lt;br /&gt;
* Call a course participant touching the phone number&lt;br /&gt;
* Locate a course participant address on Google map&lt;br /&gt;
* Download and view some course resources&lt;br /&gt;
* Quick access to your course contents&lt;br /&gt;
* View calendar events&lt;br /&gt;
* Reminder notifications for calendar events&lt;br /&gt;
* Mobile Push notifications&lt;br /&gt;
* Remote layout/style customization (see below)&lt;br /&gt;
* View all your past private messages and notifications&lt;br /&gt;
* Browse and download your private and course files&lt;br /&gt;
* View forum discussions&lt;br /&gt;
* Private messaging between users&lt;br /&gt;
* Calendar integration with warning reminders as local notifications&lt;br /&gt;
* Upload any type of file from your device to your Moodle private files area&lt;br /&gt;
* View the book module and IMS CP&lt;br /&gt;
* View site, course and personal users notes&lt;br /&gt;
* Support for sites using CAS or Shibboleth as auth methods &lt;br /&gt;
* View your activity and course total grades in a course &lt;br /&gt;
* Participate in choices &lt;br /&gt;
* Participate in chats &lt;br /&gt;
* Participate in surveys&lt;br /&gt;
* Access external tools (LTI)&lt;br /&gt;
* Course search&lt;br /&gt;
* Self-enrolment in courses&lt;br /&gt;
* Access courses with guest access enrolment method enabled&lt;br /&gt;
* [[Moodle_Mobile_SCORM_player|SCORM player]]&lt;br /&gt;
&lt;br /&gt;
==Comparison of features in different versions==&lt;br /&gt;
[[File:30_moodlemobile_features.png]]&lt;br /&gt;
&lt;br /&gt;
=== Languages ===&lt;br /&gt;
&lt;br /&gt;
Over 15 languages are currently supported: Arabic, Basque, Catalan, Chinese, Czech, Dutch, English, French, German, Hebrew, Hungarian, Italian, Japanese, Mexican Spanish, Portuguese, Russian, Spanish, Swedish&lt;br /&gt;
&lt;br /&gt;
[[es:Características de Moodle Mobile]]&lt;br /&gt;
[[fr:Fonctionnalités de l&#039;app mobile]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=External_database_enrolment&amp;diff=122223</id>
		<title>External database enrolment</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=External_database_enrolment&amp;diff=122223"/>
		<updated>2016-02-10T09:34:13Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Enrolment}}&lt;br /&gt;
==Using an external database to control enrolments==&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 and 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 and 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&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;
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 &#039;&#039;Site administration &amp;gt; Plugins &amp;gt; Enrolments &amp;gt; Manage enrol plugins&#039;&#039;, 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;
* A new optional field enrol_database | remoteotheruserfield allows those with the role &amp;quot;Other users&amp;quot; to be added but not to be included as course participants.&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;
== 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 database 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;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;
*[[External database authentication]]&lt;br /&gt;
&lt;br /&gt;
[[es:Inscripción por BasedeDatos externa]]&lt;br /&gt;
[[fr:Inscription par base de données externe]]&lt;br /&gt;
[[de:Einschreibung über externe Datenbank]]&lt;br /&gt;
[[ja:外部データベース登録]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Assign_roles&amp;diff=122222</id>
		<title>Assign roles</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Assign_roles&amp;diff=122222"/>
		<updated>2016-02-10T09:13:53Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&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;
&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:Attribution des rôles]]&lt;br /&gt;
[[ja:ロールの割り当て]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=External_database_authentication&amp;diff=122221</id>
		<title>External database authentication</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=External_database_authentication&amp;diff=122221"/>
		<updated>2016-02-10T08:41:02Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Authentication}}&lt;br /&gt;
Location: &#039;&#039; Site administration &amp;gt; Plugins &amp;gt; Authentication &amp;gt; External database&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This method uses an external database table to check whether a given username and password is valid. If the user does not currently exist in Moodle a new account will be created and their information copied from the external database. &lt;br /&gt;
&lt;br /&gt;
== Field mappings ==&lt;br /&gt;
&lt;br /&gt;
This is done by mapping fields at the bottom of the database authentication page. Each data field in the user profile has a text field next to it. Enter the name of the column in the external database that maps to the profile data field.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Update Local&#039;&#039;&#039; - Specifies that the external data will be entered into the local field in question&lt;br /&gt;
* On Creation - specifies that this will only happen on the original login when the account is created for the first time.&lt;br /&gt;
* On Every Login - specifies that changes in the external data will be updated on the local Moodle field in question the next time the user logs in again.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Update External&#039;&#039;&#039; - Specifies just the opposite, meaning changes in the local Moodle field in question will update the corresponding field in the external database&lt;br /&gt;
* Never - Specifies this is disabled&lt;br /&gt;
* On Update - Enables this to happen if a change is made locally (additional configuration is probably required)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Lock Value&#039;&#039;&#039; - Only determines whether the local user can make a change in the Moodle field and does not affect the two settings above.&lt;br /&gt;
* Unlocked - A user can make changes locally in the Moodle field (assumably even if it contradicts the external database the next login would change it again if Update Local is set&lt;br /&gt;
* Locked - A user can never make changes&lt;br /&gt;
* Unlocked if empty - A user can only make changes if the field is not populated already from the external database (this would seem to indicate a user could only enter something into this field once and could not change it after saving)&lt;br /&gt;
&lt;br /&gt;
== Automatic Synchronisation ==&lt;br /&gt;
&lt;br /&gt;
The above method adds new users only when they log in. If you want user accounts to be created in Moodle independent of actual logins, the db authentication plugin offers a script you can run regularly via &#039;cron&#039;. A typical cron entry will be as follows...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0 * * * *    /usr/bin/php /path/to/moodle/auth/db/cli/sync_users.php &amp;gt;dev/null&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This runs every hour (adjust as required). It reads the entire table updating and creating local Moodle users. &lt;br /&gt;
&lt;br /&gt;
If you have custom profile fields on your site, these can be synced with External database authentication.&lt;br /&gt;
&lt;br /&gt;
==Additional Notes==&lt;br /&gt;
&lt;br /&gt;
It is now possible to  use Salted Crypt passwords for the password format with external database authentication from the Password format setting:&lt;br /&gt;
[[File:dbsaltedcrypt.png|thumb|300px|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Plain text password matching is now always case sensitive&lt;br /&gt;
* sha1/md5 hash comparisons are now enforced case insensitive (as underlying they are hexadecimal values)&lt;br /&gt;
&lt;br /&gt;
* Some of the things that apply to [[Upload users]] apply to the External database, but not all of the fields in the [[Upload users]] are available for the External Database authentication. The only available fields are the fields listed in the data mapping section of the admin page for the External Database connection.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=45444 Special and characters con tilde (accute accent) when connected to external database] forum discussion&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=75519 HELP!--User Authentication problem] forum discussion&lt;br /&gt;
*[[External database enrolment]]&lt;br /&gt;
*change password in external DB authentication plugin  [https://moodle.org/mod/forum/discuss.php?d=269311#p1162046] &lt;br /&gt;
&lt;br /&gt;
[[de:Externe Datenbank]]&lt;br /&gt;
[[fr:Authentification par base de données externe]]&lt;br /&gt;
[[ja:外部データベース認証]]&lt;br /&gt;
[[es:Autenticación con BasedeDatos externa]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=MoodleDocs:Guidelines_for_contributors&amp;diff=122212</id>
		<title>MoodleDocs:Guidelines for contributors</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=MoodleDocs:Guidelines_for_contributors&amp;diff=122212"/>
		<updated>2016-02-09T09:06:02Z</updated>

		<summary type="html">&lt;p&gt;Fox: French link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Help}}You are welcome to contribute to Moodle Docs. Find something that can be improved, either in content, grammar or formatting, and fix it! Note: You will need to [[Special:Userlogin|login]] to edit pages.&lt;br /&gt;
&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
* Please note that all contributions are released here under [[License|GNU General Public License]].&lt;br /&gt;
* Every page in Moodle has a link to a corresponding page in Moodle Docs. You can see this on [http://moodle.org moodle.org] and, from an administrator&#039;s perspective, on the [http://demo.moodle.net/ Moodle demo site].&lt;br /&gt;
* You are encouraged to illustrate documentation with screenshots. Please refer to the [[MoodleDocs:Style guide|style guide]] for further information.&lt;br /&gt;
* See [[MoodleDocs:Templates]] for ways of asking for editing help from other contributors.&lt;br /&gt;
&lt;br /&gt;
==Creating new pages==&lt;br /&gt;
&lt;br /&gt;
* You are welcome to create pages for additional documentation about Moodle. Simply type the name of your new page between double brackets &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[New page name]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; on an existing page and follow the link to start editing the new page. Alternatively, you may type in your browser address bar: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;https://docs.moodle.org/en/New_page_name&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; (i.e. replace spaces in the new page name with underscores).&lt;br /&gt;
* Please choose a short name and capitalize the first word only (with a few exceptions, such as the word &#039;&#039;Moodle&#039;&#039;).&lt;br /&gt;
* Please follow the [[MoodleDocs:Style guide|style guide]]. If you categorize new pages it can make it easier for users to find, but the important thing is to put good content into the page. &lt;br /&gt;
* Page titles may be changed in the future by redirecting/moving pages, as part of documentation restructuring.&lt;br /&gt;
&lt;br /&gt;
==Inter-language linking==&lt;br /&gt;
&lt;br /&gt;
* Inter-language links between pages in different languages may be added by typing, for example, &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[es:Corresponding page title in Spanish]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; in the English MoodleDocs, or &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[en:Corresponding page title in English]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; in the [[:es:Portada|Spanish MoodleDocs]], at the bottom of the page, below the category link. Inter-language links will appear automatically in the &amp;quot;In other languages&amp;quot; block.&lt;br /&gt;
&lt;br /&gt;
== Page comments ==&lt;br /&gt;
&lt;br /&gt;
* For comments about a particular page, and/or short discussions, please use the corresponding talk page (click on the page comments tab). Please sign and date your talk page contribution by typing four tildes &amp;lt;nowiki&amp;gt;~~~~&amp;lt;/nowiki&amp;gt;. There&#039;s also a handy button for signing in the toolbar of the editing field: [[Image:Signature Icon.png]]&lt;br /&gt;
&lt;br /&gt;
* For longer discussions about the documentation, please post on moodle.org in the [http://moodle.org/mod/forum/view.php?id=7135 Moodle community sites forum].&lt;br /&gt;
&lt;br /&gt;
* If you find an unsigned comment you can use the Template:Unsigned like so &amp;lt;nowiki&amp;gt;{{Unsigned|Username}}&amp;lt;/nowiki&amp;gt; which will show as &amp;lt;small&amp;gt;(&#039;&#039;The preceding comment was added by&#039;&#039; [[User:Username]])&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Page protection==&lt;br /&gt;
&lt;br /&gt;
* Certain pages, such as the [[Table of Contents]], are protected from editing. Please use the page comments for suggesting additional content or other changes. &lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Moodle documentation FAQ]]&lt;br /&gt;
*[http://moodle.org/mod/forum/view.php?id=7135 Moodle community sites forum].&lt;br /&gt;
&lt;br /&gt;
[[Category:MoodleDocs|Guidelines for contributors]]&lt;br /&gt;
&lt;br /&gt;
[[ca:MoodleDocs:Recomanacions_als_ajudants]]&lt;br /&gt;
[[de:Hinweise für Moodle Docs Autoren]]&lt;br /&gt;
[[es:MoodleDocs:Normas para colaboradores]]&lt;br /&gt;
[[fr:Contribution à la documentation]]&lt;br /&gt;
[[ja:MoodleDocs:寄稿のガイドライン]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Talk:Logging&amp;diff=118611</id>
		<title>Talk:Logging</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Talk:Logging&amp;diff=118611"/>
		<updated>2015-05-21T08:11:59Z</updated>

		<summary type="html">&lt;p&gt;Fox: Thanks Marina&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article says: &amp;quot;A new Moodle site will have Standard logging enabled and Legacy logging disabled. A site which has been upgraded will have both enabled.&amp;quot; &lt;br /&gt;
But is it ok to disable the legacy log on a site which has been upgraded and only use the new standard log? Does Moodle store anything in the legacy log that is not stored in the standard log - especially on a site which has been upgraded? An explanation of this would be useful, especially if disabling the legacy logs will cause some information that is/was logged to the legacy logs to no longer be logged.&lt;br /&gt;
--[[User:Luis de Vasconcelos|Luis de Vasconcelos]] ([[User talk:Luis de Vasconcelos|talk]]) 15:52, 20 May 2015 (AWST)&lt;br /&gt;
&lt;br /&gt;
: For what i know, you can disable legacy logs. But if you do so : you won&#039;t be able to look/show/display (existing) legacy logs, and no new legacy logs will be generated. It can be a problem for non standard plugins not well upgraded, still generating legacy logs, but not standard logs. With time, more plugins are upgraded...&lt;br /&gt;
:--[[User:Séverin Terrier|Séverin Terrier]] ([[User talk:Séverin Terrier|talk]]) 19:58, 20 May 2015 (AWST)&lt;br /&gt;
&lt;br /&gt;
Thanks  Séverin - I have added your comments to the page. --[[User:Mary Cooch|Mary Cooch]] ([[User talk:Mary Cooch|talk]]) 22:25, 20 May 2015 (AWST)&lt;br /&gt;
&lt;br /&gt;
: You can disable legacy store plugin completely OR you can only disable writing to legacy log inside the plugin settings. In the second case you will be able to read from the log but no new entries will be added. This is also what will be set automatically during upgrade. [https://docs.moodle.org/27/en/Upgrading#Possible_issues_that_may_affect_you_in_Moodle_2.7 More details]&lt;br /&gt;
: --[[User:Marina Glancy|Marina Glancy]] ([[User talk:Marina Glancy|talk]]) 08:15, 21 May 2015 (AWST)&lt;br /&gt;
&lt;br /&gt;
:: Thanks Marina for your detailed information. If i remember well (but i can be wrong), when i upgraded to 2.7(.1 ?), legacy log where automatically disabled, so not visible. Suppose it has been improved since then.&lt;br /&gt;
::--[[User:Séverin Terrier|Séverin Terrier]] ([[User talk:Séverin Terrier|talk]]) 16:11, 21 May 2015 (AWST)&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Talk:Logging&amp;diff=118602</id>
		<title>Talk:Logging</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Talk:Logging&amp;diff=118602"/>
		<updated>2015-05-20T11:58:38Z</updated>

		<summary type="html">&lt;p&gt;Fox: My answer&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article says: &amp;quot;A new Moodle site will have Standard logging enabled and Legacy logging disabled. A site which has been upgraded will have both enabled.&amp;quot; &lt;br /&gt;
But is it ok to disable the legacy log on a site which has been upgraded and only use the new standard log? Does Moodle store anything in the legacy log that is not stored in the standard log - especially on a site which has been upgraded? An explanation of this would be useful, especially if disabling the legacy logs will cause some information that is/was logged to the legacy logs to no longer be logged.&lt;br /&gt;
--[[User:Luis de Vasconcelos|Luis de Vasconcelos]] ([[User talk:Luis de Vasconcelos|talk]]) 15:52, 20 May 2015 (AWST)&lt;br /&gt;
&lt;br /&gt;
: For what i know, you can disable legacy logs. But if you do so : you won&#039;t be able to look/show/display (existing) legacy logs, and no new legacy logs will be generated. It can be a problem for non standard plugins not well upgraded, still generating legacy logs, but not standard logs. With time, more plugins are upgraded...&lt;br /&gt;
:--[[User:Séverin Terrier|Séverin Terrier]] ([[User talk:Séverin Terrier|talk]]) 19:58, 20 May 2015 (AWST)&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=error/tool_uploadcourse/csvfileerror&amp;diff=117672</id>
		<title>error/tool uploadcourse/csvfileerror</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=error/tool_uploadcourse/csvfileerror&amp;diff=117672"/>
		<updated>2015-03-24T15:41:59Z</updated>

		<summary type="html">&lt;p&gt;Fox: Small correction&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This error message appears when a file is uploaded to &#039;&#039;Site administration&amp;gt;Courses&amp;gt;Upload courses&#039;&#039; and the file is either:&lt;br /&gt;
&lt;br /&gt;
*an incorrectly formatted .csv file, in which case, please check [[Upload courses]] &lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
* a completely different file such as an .mbz or .tgz file (a Moodle course backup)&lt;br /&gt;
&lt;br /&gt;
{{Note|If you see this errror when uploading an .mbz or tgz file, you should be using [[Course restore]] instead. }}&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Offline_quiz_activity&amp;diff=117377</id>
		<title>Offline quiz activity</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Offline_quiz_activity&amp;diff=117377"/>
		<updated>2015-03-06T13:45:48Z</updated>

		<summary type="html">&lt;p&gt;Fox: Plugin link corrected&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
&lt;br /&gt;
{{Infobox plugin&lt;br /&gt;
|type = activity&lt;br /&gt;
|entry = https://moodle.org/plugins/view/mod_offlinequiz&lt;br /&gt;
|tracker = https://github.com/academic-moodle-cooperation/moodle-mod_offlinequiz&lt;br /&gt;
|discussion = https://github.com/academic-moodle-cooperation/moodle-mod_offlinequiz&lt;br /&gt;
|maintainer = [[user:AMC Academic Moodle Cooperation|AMC Academic Moodle Cooperation]]&lt;br /&gt;
|float = right&lt;br /&gt;
}}&lt;br /&gt;
[[File:MC Offline quiz module thumbnail.png]]&lt;br /&gt;
The Moodle MC Offline quiz module adds paper-and-pencil multiple-choice quizzes to Moodle. In offline quizzes students mark answers to questions on a sheet of paper (the answer form). The students&#039; answer forms are evaluated and graded automatically by the offline quiz module. &lt;br /&gt;
&lt;br /&gt;
More precisely, a complete offline quiz consists (at least) of the following steps:&lt;br /&gt;
&lt;br /&gt;
* A teacher creates an offline quiz in Moodle and adds multiple-choice questions, all-or-nothing multiple-choice questions or description questions (text) to the quiz. This is very similar to creating online quizzes (standard Moodle quizzes).&lt;br /&gt;
* From the question lists the teacher creates question sheets and answer forms as PDF (DOCX) documents using the module. &lt;br /&gt;
* The question sheets and answer forms are handed out to students for the actual quiz. The students mark the answers they think are correct in the answer form.&lt;br /&gt;
* The teacher scans the filled-in answer forms and uploads the resulting images into the offline quiz. The scanned answer forms are evaluated and graded automatically by the module. &lt;br /&gt;
* If necessary, the teacher corrects errors that might have occurred due to mistakes made by the students or due to bad scan quality. &lt;br /&gt;
&lt;br /&gt;
After results have been created in an offline quiz, students can review their result as usual. If the teacher allows it, students can also see the scanned answer forms and which markings have been recognised as crosses.&lt;br /&gt;
&lt;br /&gt;
The module supports up to six groups which are not related to Moodle course groups. Each group can contain a different set of questions in a different order. Separate question sheets and answer forms are created for the different offline quiz groups.&lt;br /&gt;
&lt;br /&gt;
The module also supports lists of participants which are useful for checking which students actually took part in the exam. Lists of participants are pre-filled with students in Moodle. PDF versions of those lists can be created in the module for easy marking during the exam. The marked lists can be uploaded and evaluated automatically.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
The offline quiz module is used intensively at different Austrian universities for mass exams. Hundreds of students can be easily examined at the same time (given enough seating space in lecture halls) without the need for expensive e-testing equipment.&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
Juergen Zimmer, from the [http://www.academic-moodle-cooperation.org Academic Moodle Cooperation] of several Vienna Universities.&lt;br /&gt;
&lt;br /&gt;
==Moodle versions==&lt;br /&gt;
This module is available from [https://moodle.org/plugins/view.php?plugin=mod_offlinequiz the Moodle plugins database] for Moodle 2.6 only.&lt;br /&gt;
&lt;br /&gt;
There seems to be a version for Moodle 2.5 in [https://github.com/academic-moodle-cooperation/moodle-mod_offlinequiz/tree/MOODLE_25_STABLE Github].&lt;br /&gt;
&lt;br /&gt;
There seems to be a version for Moodle 2.2 in [https://github.com/academic-moodle-cooperation/moodle-mod_offlinequiz/blob/5dbf36388eea93f09c3bedfb06dcc77b9e993f8e/README.txt Github].&lt;br /&gt;
&lt;br /&gt;
There will probably be a stable version for Moodle 2.7 by the end of 2014. &lt;br /&gt;
&lt;br /&gt;
==Translations available==&lt;br /&gt;
The Moodle 2.6 version has Mexican Spanish and German language translations made in [https://lang.moodle.org/local/amos/ AMOS].&lt;br /&gt;
&lt;br /&gt;
==Installation==&lt;br /&gt;
&lt;br /&gt;
Copy the module code directly to the &amp;quot;mod/offlinequiz&amp;quot; directory. Open the messages page in the administration area to automatically start the installation.&lt;br /&gt;
&lt;br /&gt;
The automatic analysis of questionnaires requires the activation of an appropriate cronjob (see README.txt).&lt;br /&gt;
&lt;br /&gt;
==Admin settings==&lt;br /&gt;
&lt;br /&gt;
As an administrator you can set the default values instance-wide on the settings page for administrators in the MC Offline quiz module.&lt;br /&gt;
&lt;br /&gt;
* formula for participant identification (text field)&lt;br /&gt;
* mix questions (checkbox)&lt;br /&gt;
* mix answers (checkbox)&lt;br /&gt;
* logo URL (text field)&lt;br /&gt;
* copyright indication (checkbox)&lt;br /&gt;
* settings for exam inspection (checkbox)&lt;br /&gt;
* decimal places (drop down)&lt;br /&gt;
* paper&#039;s white level (drop down)&lt;br /&gt;
* 1-click inscription (checkbox)&lt;br /&gt;
* role for inscription (drop down)&lt;br /&gt;
* saving days (text field)&lt;br /&gt;
&lt;br /&gt;
==Screenshot of the module==&lt;br /&gt;
[[File:Offline_quiz_screenshot.png|600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Author==&lt;br /&gt;
[https://moodle.org/user/profile.php?id=1765078|  AMC Academic Moodle Cooperation] &lt;br /&gt;
&lt;br /&gt;
This information was copied from http://www.academic-moodle-cooperation.org/en/modules/offline-quiz/ &lt;br /&gt;
&lt;br /&gt;
[[Category:Quiz]]&lt;br /&gt;
[[Category:Questions]]&lt;br /&gt;
&lt;br /&gt;
[[es:mod/offlinequiz/mod]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Talk:ad-hoc_contributed_reports&amp;diff=116241</id>
		<title>Talk:ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Talk:ad-hoc_contributed_reports&amp;diff=116241"/>
		<updated>2014-12-04T13:58:01Z</updated>

		<summary type="html">&lt;p&gt;Fox: Thanks Mary, and reflexion&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Could someone apply my latest changes on 2.7 and 2.6 versions? --[[User:Séverin Terrier|Séverin Terrier]] ([[User talk:Séverin Terrier|talk]]) 17:50, 3 December 2014 (AWST)&lt;br /&gt;
&lt;br /&gt;
==Reply to Séverin==&lt;br /&gt;
I have copied your changes to 2.7 and 2.6 (I think I have got the right bits; let me know if not) However, just to point out that as a rule we only update the latest version and the one before that -- - so normally it would just be 2.8 and 2.7 - but I did 2.6 anyway :) --[[User:Mary Cooch|Mary Cooch]] ([[User talk:Mary Cooch|talk]]) 17:55, 3 December 2014 (AWST)&lt;br /&gt;
&lt;br /&gt;
:Thanks Mary. There was also another change : a new query. I&#039;ve just put it myself in 2.7 and 2.6. I know the general rule, but i feel it&#039;s a problem, because it means that we sometimes let incorrect information, and people can come to some documentation pages in a specific version from a Moodle internal documentation link, a Google search... And they don&#039;t always have the reflex to look at the pages for the most recent version. In fact, if i was using 2.5, i really won&#039;t look for 2.8 version ! --[[User:Séverin Terrier|Séverin Terrier]] ([[User talk:Séverin Terrier|talk]]) 21:58, 4 December 2014 (AWST)&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Debugging&amp;diff=116240</id>
		<title>Debugging</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Debugging&amp;diff=116240"/>
		<updated>2014-12-04T09:03:20Z</updated>

		<summary type="html">&lt;p&gt;Fox: Minor typo fixed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Developer tools}}&lt;br /&gt;
Debugging messages can be enabled by an administrator in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Development &amp;gt; Debugging&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Debugging messages are intended to help diagnose problems and/or help Moodle developers. If you have a problem with your Moodle site and ask for help in a Moodle.org forum, a developer may ask you to turn debug messages on, in order to locate the cause of the problem. By default Moodle does not show any error messages at all. If you are having problems (e.g. blank screens or incomplete screens) turning on debugging is usually the first thing to try. &lt;br /&gt;
&lt;br /&gt;
==Debugging settings==&lt;br /&gt;
Here are the settings on the Debugging page:&lt;br /&gt;
&lt;br /&gt;
===Debug messages===&lt;br /&gt;
The default is none, your choices are:&lt;br /&gt;
&lt;br /&gt;
;NONE : Do not show any errors or warnings (Default) &lt;br /&gt;
;ALL : Show all reasonable PHP debug messages&lt;br /&gt;
;MINIMAL : Show only fatal errors&lt;br /&gt;
;NORMAL : Show warnings, errors and notices&lt;br /&gt;
;DEVELOPER : extra Moodle debug messages for developers&lt;br /&gt;
&lt;br /&gt;
There is rarely any advantage in going to Developer level, unless you are a developer, in which case it is strongly recommended.&lt;br /&gt;
&lt;br /&gt;
Once you have got the error message, and copied and pasted it somewhere.  HIGHLY RECOMMENDED to turn Debug back to NONE. Debug messages can give clues to a hacker as to the setup of your site.&lt;br /&gt;
&lt;br /&gt;
===Display debug messages===&lt;br /&gt;
&lt;br /&gt;
There is an option to choose whether to display error messages or simply record them in the server logs.&lt;br /&gt;
&lt;br /&gt;
===Debug email sending===&lt;br /&gt;
&lt;br /&gt;
Determines whether or not to enable verbose debug information during sending of email messages to SMTP server.&lt;br /&gt;
&lt;br /&gt;
===Performance info===&lt;br /&gt;
&lt;br /&gt;
The Performance info option determines whether performance info will be included in the footer of the standard theme (and some other themes). Performance info includes the time for the page to load, the amount of memory used to generate the page, cpu usage, load, and the record cache hit/miss ration.&lt;br /&gt;
&lt;br /&gt;
If you add&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
define(&#039;MDL_PERF&#039;, true);&lt;br /&gt;
define(&#039;MDL_PERFDB&#039;, true);&lt;br /&gt;
define(&#039;MDL_PERFTOLOG&#039;, true);&lt;br /&gt;
define(&#039;MDL_PERFTOFOOT&#039;, true);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
to your config.php file, then it will also count database queries. (This has to be in config.php, because Moodle starts doing DB queries before it loads the config information in the database!&lt;br /&gt;
&lt;br /&gt;
===Show origin of language strings===&lt;br /&gt;
&lt;br /&gt;
Helps with [[:dev:Translation|translation]] and also with [[Language customization]]. Sometimes &amp;lt;code&amp;gt;?strings=1&amp;lt;/code&amp;gt; should be added; other times &amp;lt;code&amp;gt;&amp;amp;strings=1&amp;lt;/code&amp;gt;. See the Wikipedia article [http://en.wikipedia.org/wiki/Query_string Query string] for details.&lt;br /&gt;
&lt;br /&gt;
===Show validator links===&lt;br /&gt;
Be careful, read the warning.&lt;br /&gt;
&lt;br /&gt;
===Show page information===&lt;br /&gt;
To show page information printed in the page footer.&lt;br /&gt;
&lt;br /&gt;
==What to do if you cannot get to the admin screens==&lt;br /&gt;
&lt;br /&gt;
If the error is stopping you even getting to the admin screens to turn on debugging, then you can set the debugging setting manually.&lt;br /&gt;
&lt;br /&gt;
===Try typing the URL directly===&lt;br /&gt;
&lt;br /&gt;
The debug settings are at the URL &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://.../admin/settings.php?section=debugging&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; on your server. Sometimes that URL will work, even though the pages you need to go to get there (for example the site front page) do not. So it is worth trying to enter that URL directly.&lt;br /&gt;
&lt;br /&gt;
===In config.php===&lt;br /&gt;
&lt;br /&gt;
In [[Configuration file|config.php]] you can add the lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
@error_reporting(E_ALL | E_STRICT);&lt;br /&gt;
@ini_set(&#039;display_errors&#039;, &#039;1&#039;);&lt;br /&gt;
$CFG-&amp;gt;debug = (E_ALL | E_STRICT); &lt;br /&gt;
$CFG-&amp;gt;debugdisplay = 1;&lt;br /&gt;
&lt;br /&gt;
// You can specify a comma separated list of user ids that always see&lt;br /&gt;
// debug messages, this overrides the debug flag in $CFG-&amp;gt;debug and $CFG-&amp;gt;debugdisplay&lt;br /&gt;
// for these users only.&lt;br /&gt;
$CFG-&amp;gt;debugusers = &#039;2&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; Add these lines immediately before the line...&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
require_once(dirname(__FILE__) . &#039;/lib/setup.php&#039;);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember to remove those lines again when you have finished diagnosing your problem.&lt;br /&gt;
&lt;br /&gt;
NOTE: do not try to modify the config database table directly, it will not work because the values are cached in MUC.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Developers can also use [http://xdebug.org/ XDEBUG] (Installed as a module on the Apache server) to further dig into the code, step by step using an [http://xdebug.org/docs/remote XDEBUG client application]. Probably, as part of their favorite IDE. For example: [http://php.netbeans.org/ NetBeans], [http://www.jetbrains.com/phpstorm/ phpStorm] or...&lt;br /&gt;
&lt;br /&gt;
[[es:Depuración]]&lt;br /&gt;
[[fr:Débogage]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Talk:ad-hoc_contributed_reports&amp;diff=116236</id>
		<title>Talk:ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Talk:ad-hoc_contributed_reports&amp;diff=116236"/>
		<updated>2014-12-03T09:50:10Z</updated>

		<summary type="html">&lt;p&gt;Fox: Can someone apply my latest changes on 2.7 and 2.6 version?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are some scripts here that are only usable in 1.9 and have 2.x versions working, so I am removing them. ~~ Randy, June 2013&lt;br /&gt;
&lt;br /&gt;
Could someone apply my latest changes on 2.7 and 2.6 versions? --[[User:Séverin Terrier|Séverin Terrier]] ([[User talk:Séverin Terrier|talk]]) 17:50, 3 December 2014 (AWST)&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=ad-hoc_contributed_reports&amp;diff=116220</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=ad-hoc_contributed_reports&amp;diff=116220"/>
		<updated>2014-12-02T10:07:59Z</updated>

		<summary type="html">&lt;p&gt;Fox: /* Lists &amp;quot;Totally Opened Courses&amp;quot; (visible, opened to guests, with no password) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sitewide reports}}&lt;br /&gt;
==User and Role Report==&lt;br /&gt;
&lt;br /&gt;
===Count number of distinct learners and teachers enrolled per category (including all its sub categories)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;SELECT COUNT(DISTINCT lra.userid) AS learners, COUNT(DISTINCT tra.userid) as teachers&lt;br /&gt;
FROM prefix_course AS c #, mdl_course_categories AS cats&lt;br /&gt;
LEFT JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments  AS lra ON lra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_role_assignments  AS tra ON tra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_course_categories AS cats ON c.category = cats.id&lt;br /&gt;
WHERE c.category = cats.id&lt;br /&gt;
AND (&lt;br /&gt;
	cats.path LIKE &#039;%/CATEGORYID/%&#039; #Replace CATEGORYID with the category id you want to count (eg: 80)&lt;br /&gt;
	OR cats.path LIKE &#039;%/CATEGORYID&#039;&lt;br /&gt;
	)&lt;br /&gt;
AND lra.roleid=5&lt;br /&gt;
AND tra.roleid=3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each ROLE (TEACHER, NON-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_context AS context ON context.instanceid = l.course AND context.contextlevel = 50&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON l.userid = ra.userid AND ra.contextid = context.id&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;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Student (user) COUNT in each Course===&lt;br /&gt;
Including (optional) filter by: year (if included in course fullname).&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;,course.id,&#039;&amp;quot;&amp;gt;&#039;,course.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%%/user/index.php?contextid=&#039;,context.id,&#039;&amp;quot;&amp;gt;Show users&amp;lt;/a&amp;gt;&#039;) AS Users&lt;br /&gt;
, COUNT(course.id) AS Students&lt;br /&gt;
FROM prefix_role_assignments AS asg&lt;br /&gt;
JOIN prefix_context AS context ON asg.contextid = context.id AND context.contextlevel = 50&lt;br /&gt;
JOIN prefix_user AS user ON user.id = asg.userid&lt;br /&gt;
JOIN prefix_course AS course ON context.instanceid = course.id&lt;br /&gt;
WHERE asg.roleid = 5 &lt;br /&gt;
# AND course.fullname LIKE &#039;%2013%&#039;&lt;br /&gt;
GROUP BY course.id&lt;br /&gt;
ORDER BY COUNT(course.id) DESC&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;
===Enrolled users,which did not login into the Course, even once (Moodle 2)===&lt;br /&gt;
Designed forMoodle 2 table structure and uses special plugin filter : %%FILTER_SEARCHTEXT:table.field%%&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user2.id as ID,&lt;br /&gt;
ul.timeaccess,&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;
user2.idnumber AS IDNumber,&lt;br /&gt;
user2.phone1 AS Phone,&lt;br /&gt;
user2.institution AS Institution,&lt;br /&gt;
&lt;br /&gt;
IF (user2.lastaccess = 0,&#039;never&#039;,&lt;br /&gt;
DATE_FORMAT(FROM_UNIXTIME(user2.lastaccess),&#039;%Y-%m-%d&#039;)) AS dLastAccess&lt;br /&gt;
&lt;br /&gt;
,(SELECT DATE_FORMAT(FROM_UNIXTIME(timeaccess),&#039;%Y-%m-%d&#039;) FROM prefix_user_lastaccess WHERE userid=user2.id and courseid=c.id) as CourseLastAccess&lt;br /&gt;
&lt;br /&gt;
,(SELECT r.name&lt;br /&gt;
FROM  prefix_user_enrolments AS uenrol&lt;br /&gt;
JOIN prefix_enrol AS e ON e.id = uenrol.enrolid&lt;br /&gt;
JOIN prefix_role AS r ON e.id = r.id&lt;br /&gt;
WHERE uenrol.userid=user2.id and e.courseid = c.id) AS RoleName&lt;br /&gt;
&lt;br /&gt;
FROM prefix_user_enrolments as ue&lt;br /&gt;
JOIN prefix_enrol as e on e.id = ue.enrolid&lt;br /&gt;
JOIN prefix_course as c ON c.id = e.courseid&lt;br /&gt;
JOIN prefix_user as user2 ON user2 .id = ue.userid&lt;br /&gt;
LEFT JOIN prefix_user_lastaccess as ul on ul.userid = user2.id&lt;br /&gt;
WHERE c.id=16 AND ul.timeaccess IS NULL&lt;br /&gt;
%%FILTER_SEARCHTEXT:user2.firstname%%&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Role assignments on categories===&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/category.php?id=&#039;,cc.id,&#039;&amp;quot;&amp;gt;&#039;,cc.id,&#039;&amp;lt;/a&amp;gt;&#039;) AS id,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/category.php?id=&#039;,cc.id,&#039;&amp;quot;&amp;gt;&#039;,cc.name,&#039;&amp;lt;/a&amp;gt;&#039;) AS category,&lt;br /&gt;
cc.depth, cc.path, r.name AS role,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/user/view.php?id=&#039;,usr.id,&#039;&amp;quot;&amp;gt;&#039;,usr.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) AS name,&lt;br /&gt;
usr.firstname, usr.username, usr.email&lt;br /&gt;
FROM prefix_course_categories cc&lt;br /&gt;
INNER JOIN prefix_context cx ON cc.id = cx.instanceid&lt;br /&gt;
AND cx.contextlevel = &#039;40&#039;&lt;br /&gt;
INNER JOIN prefix_role_assignments ra ON cx.id = ra.contextid&lt;br /&gt;
INNER JOIN prefix_role r ON ra.roleid = r.id&lt;br /&gt;
INNER JOIN prefix_user usr ON ra.userid = usr.id&lt;br /&gt;
ORDER BY cc.depth, cc.path, usr.lastname, usr.firstname, r.name, cc.name&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&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.id,&#039;&amp;lt;/a&amp;gt;&#039;) AS id,&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.shortname,&#039;&amp;lt;/a&amp;gt;&#039;) AS &#039;Course&#039;,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/enrol/instances.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;Méthodes inscription&amp;lt;/a&amp;gt;&#039;) AS &#039;Enrollment plugins&#039;,&lt;br /&gt;
e.sortorder&lt;br /&gt;
FROM prefix_enrol AS e, prefix_course AS c&lt;br /&gt;
WHERE e.enrol=&#039;guest&#039; AND e.status=0 AND e.password=&#039;&#039; AND c.id=e.courseid AND c.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;
===Lists the users who have only logged into the site once===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id, username, firstname, lastname, idnumber&lt;br /&gt;
FROM prefix_user&lt;br /&gt;
WHERE prefix_user.deleted = 0&lt;br /&gt;
AND prefix_user.lastlogin = 0 &lt;br /&gt;
AND prefix_user.lastaccess &amp;gt; 0&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 prefix_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;
===List Users with extra info (email) in current course===&lt;br /&gt;
blocks/configurable_reports replaces %%COURSEID%% with course id.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname, u.email&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS context ON context.id = ra.contextid AND context.contextlevel = 50&lt;br /&gt;
JOIN prefix_course AS c ON c.id = context.instanceid AND c.id = %%COURSEID%%&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&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=uenr.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 prefix_enrol As enr, prefix_user_enrolments AS uenr&lt;br /&gt;
WHERE enr.id = uenr.enrolid AND enr.status = uenr.status&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== List of users with language===&lt;br /&gt;
&lt;br /&gt;
An issue with systems that do not have their default language set up properly is the need to do a mass change for all users to a localization. A common case is changing default English to American English. &lt;br /&gt;
&lt;br /&gt;
This will show you the language setting for all users:&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT username, lang from prefix_user &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code will change the setting from &#039;en&#039; to &#039;en_us&#039; for all users:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
UPDATE prefix_user SET lang = &#039;en_us&#039; WHERE lang = &#039;en&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Compare role capability and permissions ===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT DISTINCT mrc.capability &lt;br /&gt;
,(SELECT rc.permission FROM `mdl_role_capabilities` AS rc WHERE rc.capability = mrc.capability &lt;br /&gt;
  AND rc.roleid = &#039;1&#039; AND rc.contextid = &#039;1&#039;) AS Manager&lt;br /&gt;
,(SELECT rc.permission FROM `mdl_role_capabilities` AS rc WHERE rc.capability = mrc.capability &lt;br /&gt;
  AND rc.roleid = &#039;2&#039; AND rc.contextid = &#039;1&#039;) AS CourseCreator&lt;br /&gt;
,(SELECT rc.permission FROM `mdl_role_capabilities` AS rc WHERE rc.capability = mrc.capability &lt;br /&gt;
  AND rc.roleid = &#039;3&#039; AND rc.contextid = &#039;1&#039;) AS Teacher&lt;br /&gt;
,(SELECT rc.permission FROM `mdl_role_capabilities` AS rc WHERE rc.capability = mrc.capability &lt;br /&gt;
  AND rc.roleid = &#039;4&#039; AND rc.contextid = &#039;1&#039;) AS AssistantTeacher&lt;br /&gt;
,(SELECT rc.permission FROM `mdl_role_capabilities` AS rc WHERE rc.capability = mrc.capability &lt;br /&gt;
  AND rc.roleid = &#039;5&#039; AND rc.contextid = &#039;1&#039;) AS Student&lt;br /&gt;
,(SELECT rc.permission FROM `mdl_role_capabilities` AS rc WHERE rc.capability = mrc.capability &lt;br /&gt;
  AND rc.roleid = &#039;6&#039; AND rc.contextid = &#039;1&#039;) AS Guest&lt;br /&gt;
&lt;br /&gt;
FROM `mdl_role_capabilities` AS mrc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Log Activity Reports==&lt;br /&gt;
===Count all Active Users by ROLE in a course category (including all of its sub-categories)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(DISTINCT l.userid) as active&lt;br /&gt;
FROM mdl_course as c&lt;br /&gt;
JOIN mdl_context AS ctx ON  ctx.instanceid=c.id&lt;br /&gt;
JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN mdl_user_lastaccess as l ON ra.userid = l.userid&lt;br /&gt;
JOIN mdl_course_categories AS cats ON c.category = cats.id&lt;br /&gt;
WHERE c.category=cats.id AND (&lt;br /&gt;
	cats.path LIKE &#039;%/80/%&#039;&lt;br /&gt;
	OR cats.path LIKE &#039;%/80&#039;&lt;br /&gt;
) &lt;br /&gt;
AND ra.roleid=3  AND ctx.contextlevel=50  #ra.roleid= TEACHER 3, NON-EDITING TEACHER 4, STUDENT 5&lt;br /&gt;
AND  l.timeaccess &amp;gt; (unix_timestamp() - ((60*60*24)*NO_OF_DAYS)) #NO_OF_DAYS change to number&lt;br /&gt;
&amp;lt;/code&amp;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;
===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;
===Total activity per course, per unique user on the last 24h===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
Select&lt;br /&gt;
     Count(Distinct userid) As countUsers&lt;br /&gt;
   , Count(course) As countVisits&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;
 From prefix_log as l&lt;br /&gt;
 JOIN prefix_course as c on c.id = l.course&lt;br /&gt;
 Where course &amp;gt; 0 and FROM_UNIXTIME(time) &amp;gt;= DATE_SUB(NOW(), INTERVAL 1 DAY) and c.fullname LIKE &#039;%תשעג%&#039;&lt;br /&gt;
 Group By course&lt;br /&gt;
ORDER BY countVisits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Weekly Instructor Online Participation===&lt;br /&gt;
Contributed by Elizabeth Dalton&lt;br /&gt;
&lt;br /&gt;
Displays participation of instructors in all courses per week of a term, including pre-term and post-term edits. An edit is defined as a change to the course, such as a discussion post, the grading of an assignment, or the uploading of file attachments, as well as alterations to course content.&lt;br /&gt;
&lt;br /&gt;
* To specify a subject and/or course number, use % as a wildcard, e.g. ARTS% or ARTS501%&lt;br /&gt;
* To match part of a last name, use %, e.g. Smi% will match &amp;quot;Smith&amp;quot;, &amp;quot;Smile&amp;quot;, etc.&lt;br /&gt;
&lt;br /&gt;
At our institution, we include filters on the course name or category to constrain by terms. These are very specific to how course names and categories are constructed at our institution, so I&#039;ve removed those elements from this code. Also, our terms are 12 weeks long. You would want to insert additional &amp;quot;SUM&amp;quot; lines for longer terms, or remove lines for shorter terms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
c.shortname AS CourseID&lt;br /&gt;
, cc.name AS Category&lt;br /&gt;
, CONCAT(u.firstname ,&#039; &#039;,u.lastname) AS Instructor&lt;br /&gt;
&lt;br /&gt;
, (SELECT COUNT( ra2.userid ) AS Users2 FROM prefix_role_assignments AS ra2&lt;br /&gt;
JOIN prefix_context AS ctx2 ON ra2.contextid = ctx2.id&lt;br /&gt;
WHERE ra2.roleid = 5 AND ctx2.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
, c.startdate AS Course_Start_Date&lt;br /&gt;
&lt;br /&gt;
, c.visible AS Visible&lt;br /&gt;
&lt;br /&gt;
,  COUNT(l.id) AS Edits&lt;br /&gt;
&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time)) - WEEK(FROM_UNIXTIME(c.startdate))&amp;lt;0,1,0)) AS BeforeTerm&lt;br /&gt;
&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=0,1,0)) AS Week1&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=1,1,0)) AS Week2&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=2,1,0)) AS Week3&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=3,1,0)) AS Week4&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=4,1,0)) AS Week5&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=5,1,0)) AS Week6&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=6,1,0)) AS Week7&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=7,1,0)) AS Week8&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=8,1,0)) AS Week9&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=9,1,0)) AS Week10&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=10,1,0)) AS Week11&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=11,1,0)) AS Week12&lt;br /&gt;
&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))&amp;gt;=12,1,0)) AS AfterTerm&lt;br /&gt;
&lt;br /&gt;
, CONCAT(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/report/log/index.php&#039;,CHAR(63),&#039;chooselog=1&amp;amp;showusers=1&amp;amp;showcourses=0&amp;amp;id=&#039;,c.id,&#039;&amp;amp;user=&#039;,u.id,&#039;&amp;amp;date=0&amp;amp;modid=&amp;amp;modaction=&amp;amp;logformat=showashtml&#039;,&#039;&amp;quot;&amp;gt;&#039;,&#039;Logs&#039;,&#039;&amp;lt;/a&amp;gt;&#039;) AS Link&lt;br /&gt;
&lt;br /&gt;
FROM prefix_user AS u&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_course AS c ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_course_categories as cc ON c.category = cc.id&lt;br /&gt;
&lt;br /&gt;
LEFT JOIN prefix_log AS l ON l.userid = u.id AND l.course = c.id  AND l.action NOT LIKE &amp;quot;view%&amp;quot;&lt;br /&gt;
&lt;br /&gt;
WHERE ra.roleid =3&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
AND c.shortname LIKE :course&lt;br /&gt;
AND u.lastname LIKE :last_name&lt;br /&gt;
&lt;br /&gt;
GROUP BY u.idnumber, c.id&lt;br /&gt;
HAVING students &amp;gt; 0&lt;br /&gt;
ORDER BY c.shortname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Module activity (Hits) between dates===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT module, COUNT( * ) &lt;br /&gt;
FROM prefix_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME( l.`time` ) BETWEEN  &#039;2012-10-01 00:00:00&#039; AND  &#039;2013-09-31 00:00:00&#039;)&lt;br /&gt;
GROUP BY module&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Module activity (Instances and Hits) for each academic year===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT name&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM mdl_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME(l.`time`) BETWEEN &#039;2010-10-01 00:00:00&#039; AND &#039;2011-09-31 00:00:00&#039;)&lt;br /&gt;
AND l.module = m.name AND l.action = &#039;add&#039;&lt;br /&gt;
) AS &amp;quot;Added 2010&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM mdl_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME(l.`time`) BETWEEN &#039;2010-10-01 00:00:00&#039; AND &#039;2011-09-31 00:00:00&#039;)&lt;br /&gt;
AND l.module = m.name&lt;br /&gt;
) AS &amp;quot;Used 2010&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM mdl_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME(l.`time`) BETWEEN &#039;2011-10-01 00:00:00&#039; AND &#039;2012-09-31 00:00:00&#039;)&lt;br /&gt;
AND l.module = m.name AND l.action = &#039;add&#039;&lt;br /&gt;
) AS &amp;quot;Added 2011&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM mdl_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME(l.`time`) BETWEEN &#039;2011-10-01 00:00:00&#039; AND &#039;2012-09-31 00:00:00&#039;)&lt;br /&gt;
AND l.module = m.name&lt;br /&gt;
) AS &amp;quot;Used 2011&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM mdl_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME(l.`time`) BETWEEN &#039;2012-10-01 00:00:00&#039; AND &#039;2013-09-31 00:00:00&#039;)&lt;br /&gt;
AND l.module = m.name AND l.action = &#039;add&#039;&lt;br /&gt;
) AS &amp;quot;Added 2012&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM mdl_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME(l.`time`) BETWEEN &#039;2012-10-01 00:00:00&#039; AND &#039;2013-09-31 00:00:00&#039;)&lt;br /&gt;
AND l.module = m.name&lt;br /&gt;
) AS &amp;quot;Used 2012&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM mdl_modules AS m&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;
===Count unique teachers with courses that use at least X module (Moodle19)===&lt;br /&gt;
You can remove the outer &amp;quot;SELECT COUNT(*) FROM (...) AS ActiveTeachers&amp;quot; SQL query and get the list of the Teachers and Courses.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(*)&lt;br /&gt;
FROM (SELECT c.id AS CourseID, c.fullname AS Course, ra.roleid AS RoleID, CONCAT(u.firstname, &#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
,(SELECT COUNT(*) FROM prefix_course_modules cm WHERE cm.course = c.id) AS Modules&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid AND ctx.contextlevel = 50 &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_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE  ra.roleid = 3 &lt;br /&gt;
GROUP BY u.id&lt;br /&gt;
HAVING Modules &amp;gt; 5) AS ActiveTeachers&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;
===Common resource types count for each Category (Moodle19)===&lt;br /&gt;
Including sub-categories in total count.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT mcc.id AS mccid, CONCAT( LPAD( &#039;&#039;, mcc.depth, &#039;.&#039; ) , mcc.name ) AS Category&lt;br /&gt;
,(SELECT COUNT( * ) &lt;br /&gt;
FROM prefix_resource AS r&lt;br /&gt;
JOIN prefix_course AS c ON c.id = r.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%&#039;, mccid, &#039;%&#039; ) AND r.TYPE = &#039;file&#039; AND r.reference LIKE &#039;http://%&#039;&lt;br /&gt;
) AS Links&lt;br /&gt;
 &lt;br /&gt;
,(SELECT COUNT( * ) &lt;br /&gt;
FROM prefix_resource AS r&lt;br /&gt;
JOIN prefix_course AS c ON c.id = r.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%&#039;, mccid, &#039;%&#039; ) AND r.TYPE = &#039;file&#039; AND r.reference NOT LIKE &#039;http://%&#039;&lt;br /&gt;
) AS Files&lt;br /&gt;
 &lt;br /&gt;
,(SELECT COUNT( * ) &lt;br /&gt;
FROM prefix_resource AS r&lt;br /&gt;
JOIN prefix_course AS c ON c.id = r.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%&#039;, mccid, &#039;%&#039; ) AND r.TYPE = &#039;directory&#039; &lt;br /&gt;
) AS Folders&lt;br /&gt;
 &lt;br /&gt;
,(SELECT COUNT( * ) &lt;br /&gt;
FROM prefix_resource AS r&lt;br /&gt;
JOIN prefix_course AS c ON c.id = r.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%&#039;, mccid, &#039;%&#039; ) AND r.TYPE = &#039;html&#039; &lt;br /&gt;
) AS Pages&lt;br /&gt;
 &lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM stats_log_context_role_course &lt;br /&gt;
WHERE roleid = 5 AND module = &#039;resource&#039; AND category = mcc.id&lt;br /&gt;
) AS Hits&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course_categories AS mcc&lt;br /&gt;
ORDER BY mcc.path&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Where &amp;quot;stats_log_context_role_course&amp;quot; (in the above SQL query) is a VIEW generated by:&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
CREATE VIEW stats_log_context_role_course AS&lt;br /&gt;
SELECT l.course, c.category, cc.path, l.module, l.action, ra.userid, ra.roleid&lt;br /&gt;
FROM prefix_log AS l&lt;br /&gt;
JOIN prefix_context AS context ON context.instanceid = l.course AND context.contextlevel = 50&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.userid = l.userid AND ra.contextid = context.id&lt;br /&gt;
JOIN prefix_course AS c ON c.id = l.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Same query but for Moodle2+&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT mcc.id AS mccid, CONCAT( LPAD( &#039;&#039;, mcc.depth, &#039;.&#039; ) , mcc.name ) AS Category,&lt;br /&gt;
mcc.path,&lt;br /&gt;
&lt;br /&gt;
(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_url AS u&lt;br /&gt;
JOIN prefix_course AS c ON c.id = u.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%/&#039;, mccid, &#039;%&#039; )&lt;br /&gt;
) AS URLs,&lt;br /&gt;
&lt;br /&gt;
(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_folder AS f&lt;br /&gt;
JOIN prefix_course AS c ON c.id = f.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%/&#039;, mccid, &#039;%&#039; )&lt;br /&gt;
) AS FOLDERs,&lt;br /&gt;
&lt;br /&gt;
(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_page AS p&lt;br /&gt;
JOIN prefix_course AS c ON c.id = p.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%/&#039;, mccid, &#039;%&#039; )&lt;br /&gt;
) AS PAGEs,&lt;br /&gt;
&lt;br /&gt;
(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_book AS b&lt;br /&gt;
JOIN prefix_course AS c ON c.id = b.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%/&#039;, mccid, &#039;%&#039; )&lt;br /&gt;
) AS BOOKs,&lt;br /&gt;
&lt;br /&gt;
(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_label AS l&lt;br /&gt;
JOIN prefix_course AS c ON c.id = l.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%/&#039;, mccid, &#039;%&#039; )&lt;br /&gt;
) AS LABELs,&lt;br /&gt;
&lt;br /&gt;
(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_tab AS t&lt;br /&gt;
JOIN prefix_course AS c ON c.id = t.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%/&#039;, mccid, &#039;%&#039; )&lt;br /&gt;
) AS TABs&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course_categories AS mcc&lt;br /&gt;
ORDER BY mcc.path&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed Resource COUNT by Teacher in each course===&lt;br /&gt;
&lt;br /&gt;
Including (optional) filter by: year, semester and course id.&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 CourseID&lt;br /&gt;
, c.id&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;
, (CASE &lt;br /&gt;
WHEN c.fullname LIKE &#039;%תשעב%&#039; THEN &#039;2012&#039; &lt;br /&gt;
WHEN c.fullname LIKE &#039;%תשעא%&#039; THEN &#039;2011&#039;&lt;br /&gt;
END ) as Year&lt;br /&gt;
, (CASE &lt;br /&gt;
WHEN c.fullname LIKE &#039;%סמסטר א%&#039; THEN &#039;Semester A&#039; &lt;br /&gt;
WHEN c.fullname LIKE &#039;%סמסטר ב%&#039; THEN &#039;Semester B&#039;&lt;br /&gt;
WHEN c.fullname LIKE &#039;%סמסטר ק%&#039; THEN &#039;Semester C&#039;&lt;br /&gt;
END ) as Semester&lt;br /&gt;
,COUNT(c.id) AS Total&lt;br /&gt;
,(SELECT count(*) FROM prefix_course_modules AS cm WHERE cm.course = c.id AND cm.module= 20) AS TABs&lt;br /&gt;
,(SELECT count(*) FROM prefix_course_modules AS cm WHERE cm.course = c.id AND cm.module= 33) AS BOOKs&lt;br /&gt;
&lt;br /&gt;
FROM `prefix_resource` as r &lt;br /&gt;
JOIN `prefix_course` AS c on c.id = r.course&lt;br /&gt;
#WHERE type= &#039;file&#039; and reference NOT LIKE &#039;http://%&#039; &lt;br /&gt;
&lt;br /&gt;
#WHERE 1=1&lt;br /&gt;
#%%FILTER_YEARS:c.fullname%%&lt;br /&gt;
#AND c.fullname LIKE &#039;%2013%&#039;&lt;br /&gt;
&lt;br /&gt;
GROUP BY course&lt;br /&gt;
ORDER BY COUNT(c.id) 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;
,(SELECT count(*) FROM prefix_groups g WHERE g.courseid = c.id) Groups&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;
===Courses with Groups===&lt;br /&gt;
&lt;br /&gt;
List of all courses with Groups in them (groupmode &amp;gt; 0). You can also use groupmode=1 to list just Separate type groups or groupmode=2 to list Visible type groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname, g.name, c.groupmode&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_groups AS g ON c.id = g.courseid&lt;br /&gt;
WHERE c.groupmode &amp;gt; 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Groups in course with member list===&lt;br /&gt;
&lt;br /&gt;
List the groups in a course (replace the # by the course id number) with the members of each group.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname, g.name AS Groupname, u.username&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_groups AS g ON g.courseid = c.id&lt;br /&gt;
JOIN prefix_groups_members AS m ON g.id = m.groupid&lt;br /&gt;
JOIN prefix_user AS u ON m.userid = u.id&lt;br /&gt;
WHERE c.id = #&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Group Export===&lt;br /&gt;
&lt;br /&gt;
There&#039;s a [[Import_groups|group import]] function, but no export. Use this to give you a report with the proper column order and headings to export to a csv file you can then import into another course to replicate the groups. This is a simple version with just the main fields: groupname, description, enrolment key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT g.name AS groupname, g.description, g.enrolmentkey&lt;br /&gt;
FROM prefix_groups AS g &lt;br /&gt;
JOIN prefix_course as c ON g.courseid = c.id&lt;br /&gt;
WHERE c.id = #&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;
&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;
===Student&#039;s posts content in all course blogs (oublog)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
b.name &lt;br /&gt;
,op.title&lt;br /&gt;
,op.message&lt;br /&gt;
,( SELECT CONCAT(u.firstname, &#039; &#039;,u.lastname) FROM prefix_user AS u WHERE u.id = oi.userid) AS &amp;quot;Username&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM prefix_oublog_posts AS op&lt;br /&gt;
JOIN prefix_oublog_instances AS oi ON oi.id = op.oubloginstancesid &lt;br /&gt;
JOIN prefix_oublog as b ON b.id = oi.oublogid&lt;br /&gt;
JOIN prefix_course AS c ON b.course = c.id&lt;br /&gt;
&lt;br /&gt;
WHERE c.id = %%COURSEID%%&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;
===Site-wide completed SCORM activities by Course name===&lt;br /&gt;
This report will list all completed attempts for all SCORM activities. It is ordered first by Course name, then student&#039;s last name, then student&#039;s first name, then attempt number. Please note: the FROM_UNIXTIME command is for MySQL.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname First,u.lastname Last,c.fullname Course, st.attempt Attempt,st.value Status,FROM_UNIXTIME(st.timemodified,&amp;quot;%m-%d-%Y&amp;quot;) Date &lt;br /&gt;
FROM prefix_scorm_scoes_track AS st &lt;br /&gt;
JOIN prefix_user AS u ON st.userid=u.id&lt;br /&gt;
JOIN prefix_scorm AS sc ON sc.id=st.scormid&lt;br /&gt;
JOIN prefix_course AS c ON c.id=sc.course&lt;br /&gt;
WHERE st.value=&#039;completed&#039; &lt;br /&gt;
ORDER BY c.fullname, u.lastname,u.firstname, st.attempt&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module instances + Module HITs by role teacher and student in course==&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
m.name AS &amp;quot;Module name&amp;quot;&lt;br /&gt;
, COUNT(*) AS &amp;quot;Module count&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_log AS l &lt;br /&gt;
WHERE l.course = cm.course AND l.module = m.name ) AS &amp;quot;Hits&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*)&lt;br /&gt;
FROM prefix_log AS l&lt;br /&gt;
JOIN prefix_context AS con ON con.instanceid= l.course AND con.contextlevel=50&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid= con.id AND ra.userid= l.userid AND ra.roleid = 5 &lt;br /&gt;
WHERE l.course = cm.course AND l.module = m.name) AS &amp;quot;Students HITs&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*)&lt;br /&gt;
FROM prefix_log AS l&lt;br /&gt;
JOIN prefix_context AS con ON con.instanceid= l.course AND con.contextlevel=50&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid= con.id AND ra.userid= l.userid AND ra.roleid = 3 &lt;br /&gt;
WHERE l.course = cm.course AND l.module = m.name) AS &amp;quot;Teachers HITs&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM mdl_course_modules AS cm&lt;br /&gt;
JOIN mdl_modules AS m on m.id = cm.module&lt;br /&gt;
WHERE cm.course = &#039;%%COURSEID%%&#039;&lt;br /&gt;
GROUP BY cm.module&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grade and Course Completion 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. Works with ad-hoc reports or Configurable Reports&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. Replace the line&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
with&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECOND) 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. Works with ad-hoc reports or Configurable Reports&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,gg.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;
&lt;br /&gt;
For MySQL users:&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;, CONCAT(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;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN CONCAT(c.fullname, &#039; - 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;
FROM_UNIXTIME(gg.timemodified) 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;
&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;
===User Course Completion===&lt;br /&gt;
&lt;br /&gt;
A very simple report with list of course completion status by username. Completions are noted by date, blank otherwise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.username, c.shortname,  &lt;br /&gt;
DATE_FORMAT(FROM_UNIXTIME(p.timecompleted&lt;br /&gt;
),&#039;%Y-%m-%d&#039;) &lt;br /&gt;
AS completed&lt;br /&gt;
FROM prefix_course_completions AS p&lt;br /&gt;
JOIN prefix_course AS c ON p.course = c.id&lt;br /&gt;
JOIN prefix_user AS u ON p.userid = u.id&lt;br /&gt;
WHERE c.enablecompletion = 1&lt;br /&gt;
ORDER BY u.username&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===User Course Completion with Criteria===&lt;br /&gt;
&lt;br /&gt;
A report with course completions by username, with Aggregation method, Criteria types, and Criteria detail where available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.username AS user, &lt;br /&gt;
c.shortname AS course,&lt;br /&gt;
DATE_FORMAT(FROM_UNIXTIME(t.timecompleted),&#039;%Y-%m-%d&#039;) AS completed,&lt;br /&gt;
CASE&lt;br /&gt;
WHEN (SELECT a.method FROM prefix_course_completion_aggr_methd AS a  WHERE (a.course = c.id AND a.criteriatype IS NULL) = 1) THEN &amp;quot;Any&amp;quot;&lt;br /&gt;
ELSE &amp;quot;All&amp;quot;&lt;br /&gt;
END AS aggregation,&lt;br /&gt;
CASE &lt;br /&gt;
WHEN p.criteriatype = 1 THEN &amp;quot;Self&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 2 THEN &amp;quot;By Date&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 3 THEN &amp;quot;Unenrol Status&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 4 THEN &amp;quot;Activity&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 5 THEN &amp;quot;Duration&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 6 THEN &amp;quot;Course Grade&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 7 THEN &amp;quot;Approve by Role&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 8 THEN &amp;quot;Previous Course&amp;quot;&lt;br /&gt;
END AS criteriatype,&lt;br /&gt;
CASE &lt;br /&gt;
WHEN p.criteriatype = 1 THEN &amp;quot;*&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 2 THEN DATE_FORMAT(FROM_UNIXTIME(p.timeend),&#039;%Y-%m-%d&#039;)&lt;br /&gt;
WHEN p.criteriatype = 3 THEN t.unenroled&lt;br /&gt;
WHEN p.criteriatype = 4 THEN &lt;br /&gt;
CONCAT(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/&#039;,p.module,&#039;/view.php?id=&#039;,p.moduleinstance,&#039;&amp;quot;&amp;gt;&#039;,p.module,&#039;&amp;lt;/a&amp;gt;&#039;)&lt;br /&gt;
WHEN p.criteriatype = 5 THEN p.enrolperiod&lt;br /&gt;
WHEN p.criteriatype = 6 THEN CONCAT(&#039;Needed: &#039;,ROUND(p.gradepass,2),&#039; Achieved: &#039;,ROUND(t.gradefinal,2)) &lt;br /&gt;
WHEN p.criteriatype = 7 THEN p.role&lt;br /&gt;
WHEN p.criteriatype = 8 THEN (SELECT pc.shortname FROM prefix_course AS pc WHERE pc.id = p.courseinstance)&lt;br /&gt;
END AS criteriadetail &lt;br /&gt;
FROM prefix_course_completion_crit_compl AS t&lt;br /&gt;
JOIN prefix_user AS u ON t.userid = u.id&lt;br /&gt;
JOIN prefix_course AS c ON t.course = c.id&lt;br /&gt;
JOIN prefix_course_completion_criteria AS p ON t.criteriaid = p.id&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Courses with Completion Enabled and their settings===&lt;br /&gt;
&lt;br /&gt;
List of all courses with completion enabled and their Aggregation setting, Criteria types, and Criteria details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT c.shortname AS Course, &lt;br /&gt;
CASE&lt;br /&gt;
WHEN (SELECT a.method FROM prefix_course_completion_aggr_methd AS a  WHERE (a.course = t.course AND a.criteriatype IS NULL)) = 2 THEN &amp;quot;All&amp;quot;&lt;br /&gt;
ELSE &amp;quot;Any&amp;quot;&lt;br /&gt;
END AS Course_Aggregation,&lt;br /&gt;
CASE&lt;br /&gt;
WHEN t.criteriatype = 1 THEN &amp;quot;Self completion&amp;quot;&lt;br /&gt;
WHEN t.criteriatype = 2 THEN &amp;quot;Date done by&amp;quot; &lt;br /&gt;
WHEN t.criteriatype = 3 THEN &amp;quot;Unenrolement&amp;quot; &lt;br /&gt;
WHEN t.criteriatype = 4 THEN &amp;quot;Activity completion&amp;quot;   &lt;br /&gt;
WHEN t.criteriatype = 5 THEN &amp;quot;Duration in days&amp;quot; &lt;br /&gt;
WHEN t.criteriatype = 6 THEN &amp;quot;Final grade&amp;quot;     &lt;br /&gt;
WHEN t.criteriatype = 7 THEN &amp;quot;Approve by role&amp;quot; &lt;br /&gt;
WHEN t.criteriatype = 8 THEN &amp;quot;Previous course&amp;quot;&lt;br /&gt;
END AS Criteria_type,&lt;br /&gt;
CASE&lt;br /&gt;
WHEN t.criteriatype = 1 THEN &amp;quot;On&amp;quot;&lt;br /&gt;
WHEN t.criteriatype = 2 THEN DATE_FORMAT(FROM_UNIXTIME(t.timeend),&#039;%Y-%m-%d&#039;)&lt;br /&gt;
WHEN t.criteriatype = 3 THEN &amp;quot;On&amp;quot;&lt;br /&gt;
WHEN t.criteriatype = 4 THEN&lt;br /&gt;
CONCAT(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/&#039;,t.module,&#039;/view.php?id=&#039;,t.moduleinstance,&#039;&amp;quot;&amp;gt;&#039;,t.module,&#039;&amp;lt;/a&amp;gt;&#039;)&lt;br /&gt;
WHEN t.criteriatype = 5 THEN ROUND(t.enrolperiod/86400)&lt;br /&gt;
WHEN t.criteriatype = 6 THEN ROUND(t.gradepass,2)&lt;br /&gt;
WHEN t.criteriatype = 7 THEN (SELECT r.shortname FROM prefix_role AS r WHERE r.id = t.role)&lt;br /&gt;
WHEN t.criteriatype = 8 THEN (SELECT pc.shortname FROM prefix_course AS pc WHERE pc.id = t.courseinstance)&lt;br /&gt;
END AS Criteria_detail&lt;br /&gt;
FROM prefix_course_completion_criteria as t&lt;br /&gt;
JOIN prefix_course AS c ON t.course = c.id&lt;br /&gt;
WHERE c.enablecompletion = 1&lt;br /&gt;
ORDER BY course&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Course Completion Report with custom dates===&lt;br /&gt;
&lt;br /&gt;
List of users who completed multiple or single course/s from a start date to end date chosen by the user. The output gives username, name, course name, completion date and score&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT u.username AS &#039;User Name&#039;,&lt;br /&gt;
CONCAT(u.firstname , &#039; &#039; , u.lastname) AS &#039;Name&#039;,&lt;br /&gt;
c.shortname AS &#039;Course Name&#039;, &lt;br /&gt;
DATE_FORMAT(FROM_UNIXTIME(p.timecompleted),&#039;%W %e %M, %Y&#039;) AS &#039;Completed Date&#039;,&lt;br /&gt;
ROUND(c4.gradefinal,2) AS &#039;Score&#039;&lt;br /&gt;
FROM prefix_course_completions AS p&lt;br /&gt;
JOIN prefix_course AS c ON p.course = c.id&lt;br /&gt;
JOIN prefix_user AS u ON p.userid = u.id&lt;br /&gt;
JOIN prefix_course_completion_crit_compl AS c4 ON u.id = c4.userid&lt;br /&gt;
WHERE c.enablecompletion = 1  AND (p.timecompleted IS NOT NULL OR p.timecompleted !=&#039;&#039;) &lt;br /&gt;
AND (p.timecompleted&amp;gt;= :start_date AND p.timecompleted&amp;lt;=:end_date)&lt;br /&gt;
GROUP BY u.username&lt;br /&gt;
ORDER BY c.shortname&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Scales used in activities===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT scale.name&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/&#039;,gi.itemmodule,&#039;/view.php?id=&#039;,cm.id,&#039;&amp;quot;&amp;gt;&#039;,gi.itemname,&#039;&amp;lt;/a&amp;gt;&#039;) AS &amp;quot;Module View&amp;quot;&lt;br /&gt;
,CONCAT(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/modedit.php?up&#039;,&#039;date=&#039;,cm.id,&#039;&amp;quot;&amp;gt;&#039;,gi.itemname,&#039;&amp;lt;/a&amp;gt;&#039;) AS &amp;quot;Module Settings&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM prefix_grade_items AS gi&lt;br /&gt;
JOIN prefix_course AS c ON c.id = gi.courseid&lt;br /&gt;
JOIN prefix_course_modules AS cm ON cm.course = gi.courseid AND cm.instance = gi.iteminstance&lt;br /&gt;
JOIN prefix_scale AS scale ON scale.id = gi.scaleid&lt;br /&gt;
WHERE gi.scaleid IS NOT NULL&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Activity Module Reports==&lt;br /&gt;
&lt;br /&gt;
===How many SCORM activities are used in each Course===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT cm.course,c.fullname ,m.name &lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/scorm/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,count(cm.id),&#039;&amp;lt;/a&amp;gt;&#039;) AS Counter&lt;br /&gt;
 &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;%scorm%&#039; &lt;br /&gt;
GROUP BY cm.course,cm.module &lt;br /&gt;
ORDER BY count(cm.id) desc&lt;br /&gt;
&amp;lt;/code&amp;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;
===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;
===Course wiki usage/activity over the last 6 semesters===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &amp;quot;Courses with Wikis&amp;quot;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;2010&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%Semester A%&#039;) AS &#039;2010 &amp;lt;br/&amp;gt; Semester A&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;2010&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%Semester B%&#039;) AS &#039;2010 &amp;lt;br/&amp;gt; Semester B&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;תשעא&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%סמסטר א%&#039;) AS &#039;תשעא &amp;lt;br/&amp;gt; סמסטר א&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;תשעא&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%סמסטר ב%&#039;) AS &#039;תשעא &amp;lt;br/&amp;gt; סמסטר ב&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;תשעב&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%סמסטר א%&#039;) AS &#039;תשעב &amp;lt;br/&amp;gt; סמסטר א&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;תשעב&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%סמסטר ב%&#039;) AS &#039;תשעב &amp;lt;br/&amp;gt; סמסטר ב&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;תשעג&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%סמסטר א%&#039;) AS &#039;תשעג &amp;lt;br/&amp;gt; סמסטר א&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;תשעג&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%סמסטר ב%&#039;) AS &#039;תשעג &amp;lt;br/&amp;gt; סמסטר ב&#039;&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;
===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;
=== Elluminate (Blackboard Collaborate) - system wide usage===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT e.name As Session ,er.recordingsize&lt;br /&gt;
,c.fullname As Course&lt;br /&gt;
,u.firstname,u.lastname &lt;br /&gt;
,DATE_FORMAT(FROM_UNIXTIME(e.timestart),&#039;%d-%m-%Y&#039;) AS dTimeStart&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/moodle/mod/elluminate/loadrecording.php?id=&#039;,er.id,&#039;&amp;quot;&amp;gt;Show&amp;lt;/a&amp;gt;&#039;) AS RecordedSession&lt;br /&gt;
&lt;br /&gt;
FROM prefix_elluminate_recordings AS er&lt;br /&gt;
JOIN prefix_elluminate AS e ON e.meetingid = er.meetingid&lt;br /&gt;
JOIN prefix_course as c ON c.id = e.course&lt;br /&gt;
JOIN prefix_user AS u ON u.id = e.creator &lt;br /&gt;
ORDER BY er.recordingsize DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Choice ===&lt;br /&gt;
&lt;br /&gt;
Results of the Choice activity. For all courses, shows course shortname, username, the Choice text, and the answer chosen by the user.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname AS course, u.username, h.name as question, o.text AS answer&lt;br /&gt;
FROM prefix_choice AS h&lt;br /&gt;
JOIN prefix_course AS c ON h.course = c.id&lt;br /&gt;
JOIN prefix_choice_answers AS a ON h.id = a.choiceid&lt;br /&gt;
JOIN prefix_user AS u ON a.userid = u.id&lt;br /&gt;
JOIN prefix_choice_options AS o ON a.optionid = o.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Assignment type usage in courses ===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
&lt;br /&gt;
CONCAT(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/assign/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS &amp;quot;List assignments&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) FROM prefix_assign WHERE c.id = course) AS Assignments&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_assign_plugin_config AS apc&lt;br /&gt;
JOIN prefix_assign AS iassign ON iassign.id = apc.assignment &lt;br /&gt;
WHERE iassign.course = c.id AND apc.plugin = &#039;file&#039; AND apc.subtype = &#039;assignsubmission&#039; AND apc.name = &#039;enabled&#039; AND apc.value = &#039;1&#039;&lt;br /&gt;
#GROUP BY apc.plugin&lt;br /&gt;
) AS &amp;quot;File Assignments&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_assign_plugin_config AS apc&lt;br /&gt;
JOIN prefix_assign AS iassign ON iassign.id = apc.assignment &lt;br /&gt;
WHERE iassign.course = c.id AND apc.plugin = &#039;onlinetext&#039; AND apc.subtype = &#039;assignsubmission&#039; AND apc.name = &#039;enabled&#039; AND apc.value = &#039;1&#039;&lt;br /&gt;
) AS &amp;quot;Online Assignments&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_assign_plugin_config AS apc&lt;br /&gt;
JOIN prefix_assign AS iassign ON iassign.id = apc.assignment &lt;br /&gt;
WHERE iassign.course = c.id AND apc.plugin = &#039;pdf&#039; AND apc.subtype = &#039;assignsubmission&#039; AND apc.name = &#039;enabled&#039; AND apc.value = &#039;1&#039;&lt;br /&gt;
) AS &amp;quot;PDF Assignments&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_assign_plugin_config AS apc&lt;br /&gt;
JOIN prefix_assign AS iassign ON iassign.id = apc.assignment &lt;br /&gt;
WHERE iassign.course = c.id AND apc.plugin = &#039;offline&#039; AND apc.subtype = &#039;assignsubmission&#039; AND apc.name = &#039;enabled&#039; AND apc.value = &#039;1&#039;&lt;br /&gt;
) AS &amp;quot;Offline Assignments&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_assign_plugin_config AS apc&lt;br /&gt;
JOIN prefix_assign AS iassign ON iassign.id = apc.assignment &lt;br /&gt;
WHERE iassign.course = c.id AND apc.plugin = &#039;comments&#039; AND apc.subtype = &#039;assignsubmission&#039; AND apc.name = &#039;enabled&#039; AND apc.value = &#039;1&#039;&lt;br /&gt;
) AS &amp;quot;Assignments Comments&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM prefix_assign AS assign&lt;br /&gt;
JOIN prefix_course AS c ON c.id = assign.course&lt;br /&gt;
GROUP BY c.id &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;
===Assignments (and Quizzes) waiting to be graded===&lt;br /&gt;
This report requires a YEAR filter to be added (Available when using the latest block/configurable_reports)&lt;br /&gt;
&lt;br /&gt;
Which you can always remove, to make this query work on earlier versions.&lt;br /&gt;
&lt;br /&gt;
The report includes: &lt;br /&gt;
*number of quizzes&lt;br /&gt;
*unFinished Quiz attempts&lt;br /&gt;
*Finished Quiz attempts&lt;br /&gt;
*number of students&lt;br /&gt;
*number of Assignments&lt;br /&gt;
*number of submitted answers by students &lt;br /&gt;
*number of unchecked assignments (waiting for the Teacher) in a 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;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/assignment/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;מטלות&amp;lt;/a&amp;gt;&#039;) AS Assignments&lt;br /&gt;
&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;בחנים&amp;lt;/a&amp;gt;&#039;) AS &#039;Quizzes&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_course_modules cm &lt;br /&gt;
JOIN prefix_modules as m ON m.id = cm.module &lt;br /&gt;
WHERE m.name LIKE &#039;quiz&#039; AND cm.course = c.id &lt;br /&gt;
GROUP BY cm.course &lt;br /&gt;
) AS &#039;nQuizzes&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*)&lt;br /&gt;
FROM prefix_quiz_attempts AS qa&lt;br /&gt;
JOIN prefix_quiz AS q ON q.id = qa.quiz&lt;br /&gt;
WHERE q.course = c.id&lt;br /&gt;
AND qa.timefinish = 0&lt;br /&gt;
GROUP BY q.course) AS &#039;unFinished Quiz attempts&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*)&lt;br /&gt;
FROM prefix_quiz_attempts AS qa&lt;br /&gt;
JOIN prefix_quiz AS q ON q.id = qa.quiz&lt;br /&gt;
WHERE q.course = c.id&lt;br /&gt;
AND qa.timefinish &amp;gt; 0&lt;br /&gt;
GROUP BY q.course) AS &#039;finished quiz attempts&#039;&lt;br /&gt;
&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 nStudents&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
,(&lt;br /&gt;
SELECT count(a.id)&lt;br /&gt;
FROM prefix_assignment AS a &lt;br /&gt;
JOIN prefix_course_modules AS cm ON a.course = cm.course &lt;br /&gt;
WHERE cm.instance = a.id AND cm.module = 1 AND a.course = c.id&lt;br /&gt;
) nAssignments&lt;br /&gt;
&lt;br /&gt;
,(&lt;br /&gt;
SELECT count(*)&lt;br /&gt;
FROM prefix_assignment AS a &lt;br /&gt;
WHERE a.course = c.id AND FROM_UNIXTIME(a.timedue) &amp;gt; NOW()&lt;br /&gt;
GROUP BY a.course&lt;br /&gt;
) &#039;Open &amp;lt;br/&amp;gt;Assignments&#039;&lt;br /&gt;
&lt;br /&gt;
, CONCAT(ROUND( (100 / iAssignments ) * iOpenAssignments ) ,&#039;%&#039;) &#039;unFinished &amp;lt;br/&amp;gt;Assignments &amp;lt;br/&amp;gt;(percent)&#039;&lt;br /&gt;
 &lt;br /&gt;
,(&lt;br /&gt;
SELECT count(asb.id)&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_course_modules AS cm ON a.course = cm.course &lt;br /&gt;
WHERE asb.grade &amp;lt; 0 AND cm.instance = a.id AND cm.module = 1 AND a.course = c.id&lt;br /&gt;
) &#039;unChecked  &amp;lt;br/&amp;gt;Submissions&#039; &lt;br /&gt;
 &lt;br /&gt;
,(&lt;br /&gt;
SELECT count(asb.id)&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_course_modules AS cm ON a.course = cm.course &lt;br /&gt;
WHERE cm.instance = a.id AND cm.module = 1 AND a.course = c.id&lt;br /&gt;
) &#039;Submitted  &amp;lt;br/&amp;gt;Assignments&#039;&lt;br /&gt;
 &lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
LEFT JOIN (&lt;br /&gt;
SELECT course, count(*) AS iAssignments&lt;br /&gt;
FROM prefix_assignment AS a &lt;br /&gt;
GROUP BY a.course &lt;br /&gt;
) AS tblAssignmentsCount ON tblAssignmentsCount.course = c.id&lt;br /&gt;
&lt;br /&gt;
LEFT JOIN (&lt;br /&gt;
SELECT course, count(*) AS iOpenAssignments&lt;br /&gt;
FROM prefix_assignment AS a &lt;br /&gt;
WHERE FROM_UNIXTIME(a.timedue) &amp;gt; NOW()&lt;br /&gt;
GROUP BY a.course &lt;br /&gt;
) AS tblOpenAssignmentsCount ON tblOpenAssignmentsCount.course = c.id&lt;br /&gt;
&lt;br /&gt;
WHERE 1=1  &lt;br /&gt;
#AND c.fullname LIKE &#039;%תשעג%&#039;&lt;br /&gt;
%%FILTER_YEARS:c.fullname%%&lt;br /&gt;
## You can enable the SEMESTER filter as well, &lt;br /&gt;
## by uncommenting the following line:&lt;br /&gt;
## %%FILTER_SEMESTERS:c.fullname%%&lt;br /&gt;
ORDER BY &#039;Open &amp;lt;br/&amp;gt;Assignments&#039; DESC&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;
===print all User&#039;s post in course Forums===&lt;br /&gt;
@@COURSEID@@ is a variable the is replace by the current CourseID you are running the sql report from. if you are using the latest block/configurable_reports ! (You can always change it to a fixed course or remove it to display all courses.)&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%%/mod/forum/user.php?course=&#039;,c.id,&#039;&amp;amp;id=&#039;,u.id,&#039;&amp;amp;mode=posts&amp;quot;&amp;gt;&#039;,CONCAT(u.firstname,&#039; &#039;, u.lastname),&#039;&amp;lt;/a&amp;gt;&#039;) As Fullname&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;,f.name,&#039;&amp;lt;/a&amp;gt;&#039;) AS Forum&lt;br /&gt;
,count(*) as Posts&lt;br /&gt;
,(SELECT count(*) FROM prefix_forum_discussions AS ifd JOIN prefix_forum as iforum ON iforum.id = ifd.forum  WHERE ifd.userid = fp.userid AND iforum.id = f.id) AS cAllDiscussion&lt;br /&gt;
&lt;br /&gt;
FROM prefix_forum_posts AS fp &lt;br /&gt;
JOIN prefix_user as u ON u.id = fp.userid &lt;br /&gt;
JOIN prefix_forum_discussions AS fd ON fp.discussion = fd.id &lt;br /&gt;
JOIN prefix_forum AS f ON f.id = fd.forum &lt;br /&gt;
JOIN prefix_course as c ON c.id = fd.course &lt;br /&gt;
WHERE fd.course = &#039;@@COURSEID@@&#039; &lt;br /&gt;
GROUP BY f.id,u.id&lt;br /&gt;
ORDER BY u.id&lt;br /&gt;
&amp;lt;/code&amp;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;
===Forum activity - system wide===&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.id,&#039;&amp;lt;/a&amp;gt;&#039;) AS CourseID&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;
,c.fullname as Course&lt;br /&gt;
,f.type&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;
, fd.forum, f.name,count(*) AS cPostAndDisc&lt;br /&gt;
,(SELECT count(*) FROM prefix_forum_discussions AS ifd WHERE ifd.forum = f.id) AS cDiscussion&lt;br /&gt;
FROM prefix_forum_posts AS fp&lt;br /&gt;
JOIN prefix_forum_discussions AS fd ON fd.id = fp.discussion&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;
WHERE f.type != &#039;news&#039; AND c.fullname LIKE &#039;%2013%&#039;&lt;br /&gt;
## WHERE 1=1 &lt;br /&gt;
## %%FILTER_YEARS:c.fullname%%&lt;br /&gt;
## You can enable the SEMESTER filter as well, &lt;br /&gt;
## by uncommenting the following line:&lt;br /&gt;
## %%FILTER_SEMESTERS:c.fullname%%&lt;br /&gt;
&lt;br /&gt;
GROUP BY fd.forum&lt;br /&gt;
ORDER BY count( * ) 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;
===Cantidad de foros que han sido posteados por profesor===&lt;br /&gt;
Queriamos saber cuales son las acciones del profesor dentro de los foros de cada curso, por ello se hizo este informe.&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.shortname,&#039;&amp;lt;/a&amp;gt;&#039;) AS curso,&lt;br /&gt;
CONCAT(u.firstname ,&#039; &#039;,u.lastname) AS Facilitador,&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 foros,&lt;br /&gt;
&lt;br /&gt;
COUNT(*) AS Posts&lt;br /&gt;
&lt;br /&gt;
FROM prefix_forum_posts AS fp &lt;br /&gt;
JOIN prefix_forum_discussions AS fd ON fp.discussion = fd.id &lt;br /&gt;
JOIN prefix_forum AS f ON f.id = fd.forum &lt;br /&gt;
JOIN prefix_course AS c ON c.id = fd.course&lt;br /&gt;
JOIN prefix_user AS u ON u.id = fp.userid &lt;br /&gt;
&lt;br /&gt;
WHERE fp.userid =&lt;br /&gt;
(&lt;br /&gt;
select distinct prefix_user.id&lt;br /&gt;
from prefix_user &lt;br /&gt;
join prefix_role_assignments as ra on ra.userid = prefix_user.id &lt;br /&gt;
where ra.roleid = 3 &lt;br /&gt;
and userid = fp.userid&lt;br /&gt;
limit 1&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
and c.shortname like &#039;%2014-2-1%&#039;&lt;br /&gt;
GROUP BY c.id, u.id&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 prefix_quiz qu, prefix_course co, prefix_role re, prefix_context ct, prefix_role_assignments ra, prefix_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 prefix_role_assignments a&lt;br /&gt;
                                JOIN prefix_user u ON userid = u.id&lt;br /&gt;
                                WHERE roleid = 5 AND contextid = (SELECT id FROM prefix_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;br /&gt;
&lt;br /&gt;
===List all MultiAnswer (Cloze) Questions===&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%%/mod/quiz/attempt.php?q=&#039;, quiz.id, &#039;&amp;quot;&amp;gt;&#039;, quiz.name, &#039;&amp;lt;/a&amp;gt;&#039;) AS Quiz&lt;br /&gt;
,question.id question_id, question.questiontext &lt;br /&gt;
FROM  prefix_question question&lt;br /&gt;
JOIN prefix_quiz_question_instances qqi ON question.id = qqi.question&lt;br /&gt;
JOIN prefix_quiz quiz ON qqi.quiz = quiz.id&lt;br /&gt;
WHERE  `qtype` LIKE  &#039;multianswer&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List courses with MANUAL grades===&lt;br /&gt;
Which is basically and indication to teachers using Moodle to hold offline grades inside Moodle&#039;s Gradebook,&lt;br /&gt;
So grades could be uploaded into an administrative SIS. Use with Configurable Reports.&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%%/grade/edit/tree/index.php?showadvanced=1&amp;amp;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_grade_items AS gi&lt;br /&gt;
JOIN prefix_course as c ON c.id = gi.courseid&lt;br /&gt;
WHERE  `itemtype` =  &#039;manual&#039;&lt;br /&gt;
GROUP BY courseid&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
===List the users that did not took the Quiz===&lt;br /&gt;
Do not forget to change &amp;quot;c.id = 14&amp;quot; and q.name LIKE &#039;%quiz name goes here%&#039;&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user2.id AS ID,&lt;br /&gt;
ul.timeaccess,&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.username AS IDNumber,&lt;br /&gt;
user2.institution AS Institution,&lt;br /&gt;
 &lt;br /&gt;
IF (user2.lastaccess = 0,&#039;never&#039;,&lt;br /&gt;
DATE_FORMAT(FROM_UNIXTIME(user2.lastaccess),&#039;%Y-%m-%d&#039;)) AS dLastAccess&lt;br /&gt;
 &lt;br /&gt;
,(SELECT DATE_FORMAT(FROM_UNIXTIME(timeaccess),&#039;%Y-%m-%d&#039;) FROM prefix_user_lastaccess WHERE userid=user2.id AND courseid=c.id) AS CourseLastAccess&lt;br /&gt;
 &lt;br /&gt;
,(SELECT r.name&lt;br /&gt;
FROM  prefix_user_enrolments AS uenrol&lt;br /&gt;
JOIN prefix_enrol AS e ON e.id = uenrol.enrolid&lt;br /&gt;
JOIN prefix_role AS r ON e.id = r.id&lt;br /&gt;
WHERE uenrol.userid=user2.id AND e.courseid = c.id) AS RoleName&lt;br /&gt;
 &lt;br /&gt;
FROM prefix_user_enrolments AS ue&lt;br /&gt;
JOIN prefix_enrol AS e ON e.id = ue.enrolid&lt;br /&gt;
JOIN prefix_course AS c ON c.id = e.courseid&lt;br /&gt;
JOIN prefix_user AS user2 ON user2 .id = ue.userid&lt;br /&gt;
LEFT JOIN prefix_user_lastaccess AS ul ON ul.userid = user2.id&lt;br /&gt;
WHERE c.id=14 and ue.userid NOT IN (SELECT qa.userid FROM prefix_quiz_attempts AS qa&lt;br /&gt;
JOIN prefix_quiz AS q ON qa.quiz = q.id&lt;br /&gt;
JOIN prefix_course AS c ON q.course = c.id&lt;br /&gt;
WHERE c.id = 14 AND q.name LIKE &#039;%quiz name goes here%&#039;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===List Questions in each Quiz===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT quiz.id,quiz.name, q.id, q.name&lt;br /&gt;
FROM mdl_quiz AS quiz&lt;br /&gt;
JOIN mdl_question AS q ON FIND_IN_SET(q.id, quiz.questions)&lt;br /&gt;
WHERE quiz.course = %%COURSEID%%&lt;br /&gt;
ORDER BY quiz.id ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SCORM Activity Reports==&lt;br /&gt;
&lt;br /&gt;
===Lists All completed SCORM activites by Course name===&lt;br /&gt;
This report will list all completed attempts for all SCORM activities. It is ordered first by Course name, then student&#039;s last name, then student&#039;s first name, then attempt number. Please note: the FROM_UNIXTIME command is for MySQL.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname First,u.lastname Last,c.fullname Course, st.attempt Attempt,st.value Status,FROM_UNIXTIME(st.timemodified,&amp;quot;%m-%d-%Y&amp;quot;) Date &lt;br /&gt;
FROM prefix_scorm_scoes_track AS st &lt;br /&gt;
JOIN prefix_user AS u ON st.userid=u.id&lt;br /&gt;
JOIN prefix_scorm AS sc ON sc.id=st.scormid&lt;br /&gt;
JOIN prefix_course AS c ON c.id=sc.course&lt;br /&gt;
WHERE st.value=&#039;completed&#039; &lt;br /&gt;
ORDER BY c.fullname, u.lastname,u.firstname, st.attempt&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Badges==&lt;br /&gt;
&lt;br /&gt;
=== All badges issued, by User ===&lt;br /&gt;
&lt;br /&gt;
This report will show you all the badges on a site that have been issued, both site and all courses, by the username of each user issued a badge. Includes the type of criteria passed (activity, course completion, manual), date issued, date expires, and a direct link to that issued badge page so you can see all the other details for that badge.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.username, b.name AS badgename, &lt;br /&gt;
CASE&lt;br /&gt;
WHEN b.courseid IS NOT NULL THEN&lt;br /&gt;
(SELECT c.shortname&lt;br /&gt;
    FROM prefix_course AS c&lt;br /&gt;
    WHERE c.id = b.courseid)&lt;br /&gt;
WHEN b.courseid IS NULL THEN &amp;quot;*&amp;quot;&lt;br /&gt;
END AS Context,&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN t.criteriatype = 1 AND t.method = 1 THEN &amp;quot;Activity Completion (All)&amp;quot;&lt;br /&gt;
  WHEN t.criteriatype = 1 AND t.method = 2 THEN &amp;quot;Activity Completion (Any)&amp;quot;&lt;br /&gt;
  WHEN t.criteriatype = 2 AND t.method = 2 THEN &amp;quot;Manual Award&amp;quot;&lt;br /&gt;
  WHEN t.criteriatype = 4 AND t.method = 1 THEN &amp;quot;Course Completion (All)&amp;quot;&lt;br /&gt;
  WHEN t.criteriatype = 4 AND t.method = 2 THEN &amp;quot;Course Completion (Any)&amp;quot;&lt;br /&gt;
  ELSE CONCAT (&#039;Other: &#039;, t.criteriatype)&lt;br /&gt;
END AS Criteriatype,&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( d.dateissued ) , &#039;%Y-%m-%d&#039; ) AS dateissued,&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( d.dateexpire ), &#039;%Y-%m-%d&#039; ) AS dateexpires,&lt;br /&gt;
CONCAT (&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/badges/badge.php?hash=&#039;,d.uniquehash,&#039;&amp;quot;&amp;gt;link&amp;lt;/a&amp;gt;&#039;) AS Details&lt;br /&gt;
FROM prefix_badge_issued AS d &lt;br /&gt;
JOIN prefix_badge AS b ON d.badgeid = b.id&lt;br /&gt;
JOIN prefix_user AS u ON d.userid = u.id&lt;br /&gt;
JOIN prefix_badge_criteria AS t on b.id = t.badgeid &lt;br /&gt;
WHERE t.criteriatype &amp;lt;&amp;gt; 0&lt;br /&gt;
ORDER BY u.username&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note: the FROM_UNIXTIME command is for MySQL.&lt;br /&gt;
&lt;br /&gt;
=== All badges available in the system, with Earned count ===&lt;br /&gt;
&lt;br /&gt;
Report of all badges in the system, with badge name and description, context, course shortname if a course badge, whether it is active and available, and a count of how many users have been issued that badge.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT b.id, b.name, b.description,&lt;br /&gt;
CASE&lt;br /&gt;
WHEN b.type = 1 THEN &amp;quot;System&amp;quot;&lt;br /&gt;
WHEN b.type = 2 THEN &amp;quot;Course&amp;quot;&lt;br /&gt;
END AS Context, &lt;br /&gt;
CASE&lt;br /&gt;
WHEN b.courseid IS NOT NULL THEN &lt;br /&gt;
(SELECT c.shortname &lt;br /&gt;
    FROM prefix_course AS c &lt;br /&gt;
    WHERE c.id = b.courseid)&lt;br /&gt;
WHEN b.courseid IS NULL THEN &amp;quot;*&amp;quot;&lt;br /&gt;
END AS Course, &lt;br /&gt;
CASE&lt;br /&gt;
WHEN b.status = 0 OR b.status = 2 THEN &amp;quot;No&amp;quot;&lt;br /&gt;
WHEN b.status = 1 OR b.status = 3 THEN &amp;quot;Yes&amp;quot;&lt;br /&gt;
WHEN b.status = 4 THEN &amp;quot;x&amp;quot;&lt;br /&gt;
END AS Available,&lt;br /&gt;
CASE&lt;br /&gt;
WHEN b.status = 0 OR b.status = 1 THEN &amp;quot;0&amp;quot;&lt;br /&gt;
WHEN b.status = 2 OR b.status = 3 OR b.status = 4 THEN &lt;br /&gt;
 (SELECT COUNT(*) &lt;br /&gt;
   FROM prefix_badge_issued AS d&lt;br /&gt;
   WHERE d.badgeid = b.id&lt;br /&gt;
 )&lt;br /&gt;
END AS Earned&lt;br /&gt;
FROM prefix_badge AS b&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Badges Leaderboard ===&lt;br /&gt;
&lt;br /&gt;
A simple list of usernames and how many badges they have earned overall.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.username, (SELECT COUNT(*) FROM prefix_badge_issued AS d WHERE d.userid = u.id) AS earned&lt;br /&gt;
FROM prefix_user AS u&lt;br /&gt;
ORDER BY earned DESC, u.username ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Administrator Reports==&lt;br /&gt;
&lt;br /&gt;
===Config changes in Export friendly form===&lt;br /&gt;
&lt;br /&gt;
The Administrative report Config changes is very useful but it would be nice to have it in a format that could be easily exported in one listing. Here is code to do that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( g.timemodified ) , &#039;%Y-%m-%d&#039; ) AS date, &lt;br /&gt;
u.username AS user, &lt;br /&gt;
g.name AS setting, &lt;br /&gt;
CASE &lt;br /&gt;
 WHEN g.plugin IS NULL THEN &amp;quot;core&amp;quot;&lt;br /&gt;
 ELSE g.plugin&lt;br /&gt;
END AS plugin, &lt;br /&gt;
g.value AS new_value, &lt;br /&gt;
g.oldvalue AS original_value&lt;br /&gt;
FROM prefix_config_log  AS g&lt;br /&gt;
JOIN prefix_user AS u ON g.userid = u.id&lt;br /&gt;
ORDER BY date DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cohorts by user===&lt;br /&gt;
&lt;br /&gt;
How to get a list of all users and which cohorts they belong to.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname, h.idnumber, h.name&lt;br /&gt;
FROM prefix_cohort AS h&lt;br /&gt;
JOIN prefix_cohort_members AS hm ON h.id = hm.cohortid&lt;br /&gt;
JOIN prefix_user AS u ON hm.userid = u.id&lt;br /&gt;
ORDER BY u.firstname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Courses created And Active courses by Year===&lt;br /&gt;
Active courses is counting course that have at least one Hit, And &amp;quot;Active_MoreThan100Hits&amp;quot; counts courses that have at least 100 Hits&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
&lt;br /&gt;
YEAR( FROM_UNIXTIME( `timecreated` ) ) AS YEAR, COUNT( * ) AS Counter&lt;br /&gt;
&lt;br /&gt;
, (SELECT COUNT( DISTINCT course ) &lt;br /&gt;
FROM prefix_log AS l&lt;br /&gt;
WHERE YEAR( FROM_UNIXTIME( l.`time` ) ) = YEAR( FROM_UNIXTIME( `timecreated` ) )&lt;br /&gt;
) AS &amp;quot;Active&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) FROM ( &lt;br /&gt;
SELECT COUNT( * ),time &lt;br /&gt;
FROM prefix_log AS l &lt;br /&gt;
GROUP BY course &lt;br /&gt;
HAVING COUNT(*) &amp;gt; 100) AS courses_log&lt;br /&gt;
WHERE YEAR( FROM_UNIXTIME( courses_log.`time` ) ) = YEAR( FROM_UNIXTIME( `timecreated` ) )&lt;br /&gt;
) AS &amp;quot;Active_MoreThan100Hits&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM `prefix_course` &lt;br /&gt;
GROUP BY YEAR( FROM_UNIXTIME( `timecreated` ) ) &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Users created And Active users by Year===&lt;br /&gt;
Active users is counting users that have at least one Hit, And &amp;quot;Active_MoreThan500Hits&amp;quot; counts users that have at least 500 Hits&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
&lt;br /&gt;
YEAR( FROM_UNIXTIME( `firstaccess` ) ) AS YEAR, COUNT( * ) AS Counter&lt;br /&gt;
&lt;br /&gt;
, (SELECT COUNT( DISTINCT userid ) &lt;br /&gt;
FROM prefix_log AS l&lt;br /&gt;
WHERE YEAR( FROM_UNIXTIME( l.`time` ) ) = YEAR( FROM_UNIXTIME( `firstaccess` ) )&lt;br /&gt;
) AS &amp;quot;Active&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) FROM ( &lt;br /&gt;
SELECT COUNT( * ),time &lt;br /&gt;
FROM prefix_log AS l &lt;br /&gt;
GROUP BY userid &lt;br /&gt;
HAVING COUNT(*) &amp;gt; 500) AS users_log&lt;br /&gt;
WHERE YEAR( FROM_UNIXTIME( users_log.`time` ) ) = YEAR( FROM_UNIXTIME( `firstaccess` ) )&lt;br /&gt;
) AS &amp;quot;Active_MoreThan500Hits&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM `prefix_user` &lt;br /&gt;
GROUP BY YEAR( FROM_UNIXTIME( `timecreated` ) ) &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Useful sub queries ==&lt;br /&gt;
&lt;br /&gt;
=== All teachers in the course ===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
,(SELECT GROUP_CONCAT( CONCAT( u.firstname,  &amp;quot; &amp;quot;, u.lastname ) ) &lt;br /&gt;
FROM prefix_course ic&lt;br /&gt;
JOIN prefix_context con ON con.instanceid = ic.id&lt;br /&gt;
JOIN prefix_role_assignments ra ON con.id = ra.contextid AND con.contextlevel = 50&lt;br /&gt;
JOIN prefix_role r ON ra.roleid = r.id&lt;br /&gt;
JOIN prefix_user u ON u.id = ra.userid&lt;br /&gt;
WHERE r.id = 3 AND ic.id = c.id&lt;br /&gt;
GROUP BY ic.id&lt;br /&gt;
) AS TeacherNames&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Contributed code]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=ad-hoc_contributed_reports&amp;diff=116219</id>
		<title>ad-hoc contributed reports</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=ad-hoc_contributed_reports&amp;diff=116219"/>
		<updated>2014-12-02T09:57:21Z</updated>

		<summary type="html">&lt;p&gt;Fox: Added &amp;quot;Role assignments on categories&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Sitewide reports}}&lt;br /&gt;
==User and Role Report==&lt;br /&gt;
&lt;br /&gt;
===Count number of distinct learners and teachers enrolled per category (including all its sub categories)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;SELECT COUNT(DISTINCT lra.userid) AS learners, COUNT(DISTINCT tra.userid) as teachers&lt;br /&gt;
FROM prefix_course AS c #, mdl_course_categories AS cats&lt;br /&gt;
LEFT JOIN prefix_context AS ctx ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_role_assignments  AS lra ON lra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_role_assignments  AS tra ON tra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_course_categories AS cats ON c.category = cats.id&lt;br /&gt;
WHERE c.category = cats.id&lt;br /&gt;
AND (&lt;br /&gt;
	cats.path LIKE &#039;%/CATEGORYID/%&#039; #Replace CATEGORYID with the category id you want to count (eg: 80)&lt;br /&gt;
	OR cats.path LIKE &#039;%/CATEGORYID&#039;&lt;br /&gt;
	)&lt;br /&gt;
AND lra.roleid=5&lt;br /&gt;
AND tra.roleid=3&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed ACTIONs for each ROLE (TEACHER, NON-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_context AS context ON context.instanceid = l.course AND context.contextlevel = 50&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON l.userid = ra.userid AND ra.contextid = context.id&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;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Student (user) COUNT in each Course===&lt;br /&gt;
Including (optional) filter by: year (if included in course fullname).&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;,course.id,&#039;&amp;quot;&amp;gt;&#039;,course.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%%/user/index.php?contextid=&#039;,context.id,&#039;&amp;quot;&amp;gt;Show users&amp;lt;/a&amp;gt;&#039;) AS Users&lt;br /&gt;
, COUNT(course.id) AS Students&lt;br /&gt;
FROM prefix_role_assignments AS asg&lt;br /&gt;
JOIN prefix_context AS context ON asg.contextid = context.id AND context.contextlevel = 50&lt;br /&gt;
JOIN prefix_user AS user ON user.id = asg.userid&lt;br /&gt;
JOIN prefix_course AS course ON context.instanceid = course.id&lt;br /&gt;
WHERE asg.roleid = 5 &lt;br /&gt;
# AND course.fullname LIKE &#039;%2013%&#039;&lt;br /&gt;
GROUP BY course.id&lt;br /&gt;
ORDER BY COUNT(course.id) DESC&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;
===Enrolled users,which did not login into the Course, even once (Moodle 2)===&lt;br /&gt;
Designed forMoodle 2 table structure and uses special plugin filter : %%FILTER_SEARCHTEXT:table.field%%&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user2.id as ID,&lt;br /&gt;
ul.timeaccess,&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;
user2.idnumber AS IDNumber,&lt;br /&gt;
user2.phone1 AS Phone,&lt;br /&gt;
user2.institution AS Institution,&lt;br /&gt;
&lt;br /&gt;
IF (user2.lastaccess = 0,&#039;never&#039;,&lt;br /&gt;
DATE_FORMAT(FROM_UNIXTIME(user2.lastaccess),&#039;%Y-%m-%d&#039;)) AS dLastAccess&lt;br /&gt;
&lt;br /&gt;
,(SELECT DATE_FORMAT(FROM_UNIXTIME(timeaccess),&#039;%Y-%m-%d&#039;) FROM prefix_user_lastaccess WHERE userid=user2.id and courseid=c.id) as CourseLastAccess&lt;br /&gt;
&lt;br /&gt;
,(SELECT r.name&lt;br /&gt;
FROM  prefix_user_enrolments AS uenrol&lt;br /&gt;
JOIN prefix_enrol AS e ON e.id = uenrol.enrolid&lt;br /&gt;
JOIN prefix_role AS r ON e.id = r.id&lt;br /&gt;
WHERE uenrol.userid=user2.id and e.courseid = c.id) AS RoleName&lt;br /&gt;
&lt;br /&gt;
FROM prefix_user_enrolments as ue&lt;br /&gt;
JOIN prefix_enrol as e on e.id = ue.enrolid&lt;br /&gt;
JOIN prefix_course as c ON c.id = e.courseid&lt;br /&gt;
JOIN prefix_user as user2 ON user2 .id = ue.userid&lt;br /&gt;
LEFT JOIN prefix_user_lastaccess as ul on ul.userid = user2.id&lt;br /&gt;
WHERE c.id=16 AND ul.timeaccess IS NULL&lt;br /&gt;
%%FILTER_SEARCHTEXT:user2.firstname%%&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Role assignments on categories===&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/category.php?id=&#039;,cc.id,&#039;&amp;quot;&amp;gt;&#039;,cc.id,&#039;&amp;lt;/a&amp;gt;&#039;) AS id,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/category.php?id=&#039;,cc.id,&#039;&amp;quot;&amp;gt;&#039;,cc.name,&#039;&amp;lt;/a&amp;gt;&#039;) AS category,&lt;br /&gt;
cc.depth, cc.path, r.name AS role,&lt;br /&gt;
concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/user/view.php?id=&#039;,usr.id,&#039;&amp;quot;&amp;gt;&#039;,usr.lastname,&#039;&amp;lt;/a&amp;gt;&#039;) AS name,&lt;br /&gt;
usr.firstname, usr.username, usr.email&lt;br /&gt;
FROM prefix_course_categories cc&lt;br /&gt;
INNER JOIN prefix_context cx ON cc.id = cx.instanceid&lt;br /&gt;
AND cx.contextlevel = &#039;40&#039;&lt;br /&gt;
INNER JOIN prefix_role_assignments ra ON cx.id = ra.contextid&lt;br /&gt;
INNER JOIN prefix_role r ON ra.roleid = r.id&lt;br /&gt;
INNER JOIN prefix_user usr ON ra.userid = usr.id&lt;br /&gt;
ORDER BY cc.depth, cc.path, usr.lastname, usr.firstname, r.name, cc.name&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;
Moodle 2.7 you would use:&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.id , c.category , c.fullname , c.shortname &lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_enrol AS e ON e.courseid = c.id&lt;br /&gt;
WHERE e.enrol=&#039;guest&#039; AND e.status=1&lt;br /&gt;
AND e.`password` = &#039;&#039;&lt;br /&gt;
AND c.`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;
===Lists the users who have only logged into the site once===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT id, username, firstname, lastname, idnumber&lt;br /&gt;
FROM prefix_user&lt;br /&gt;
WHERE prefix_user.deleted = 0&lt;br /&gt;
AND prefix_user.lastlogin = 0 &lt;br /&gt;
AND prefix_user.lastaccess &amp;gt; 0&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 prefix_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;
===List Users with extra info (email) in current course===&lt;br /&gt;
blocks/configurable_reports replaces %%COURSEID%% with course id.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname, u.email&lt;br /&gt;
FROM prefix_role_assignments AS ra&lt;br /&gt;
JOIN prefix_context AS context ON context.id = ra.contextid AND context.contextlevel = 50&lt;br /&gt;
JOIN prefix_course AS c ON c.id = context.instanceid AND c.id = %%COURSEID%%&lt;br /&gt;
JOIN prefix_user AS u ON u.id = ra.userid&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=uenr.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 prefix_enrol As enr, prefix_user_enrolments AS uenr&lt;br /&gt;
WHERE enr.id = uenr.enrolid AND enr.status = uenr.status&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== List of users with language===&lt;br /&gt;
&lt;br /&gt;
An issue with systems that do not have their default language set up properly is the need to do a mass change for all users to a localization. A common case is changing default English to American English. &lt;br /&gt;
&lt;br /&gt;
This will show you the language setting for all users:&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT username, lang from prefix_user &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This code will change the setting from &#039;en&#039; to &#039;en_us&#039; for all users:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
UPDATE prefix_user SET lang = &#039;en_us&#039; WHERE lang = &#039;en&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Compare role capability and permissions ===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT DISTINCT mrc.capability &lt;br /&gt;
,(SELECT rc.permission FROM `mdl_role_capabilities` AS rc WHERE rc.capability = mrc.capability &lt;br /&gt;
  AND rc.roleid = &#039;1&#039; AND rc.contextid = &#039;1&#039;) AS Manager&lt;br /&gt;
,(SELECT rc.permission FROM `mdl_role_capabilities` AS rc WHERE rc.capability = mrc.capability &lt;br /&gt;
  AND rc.roleid = &#039;2&#039; AND rc.contextid = &#039;1&#039;) AS CourseCreator&lt;br /&gt;
,(SELECT rc.permission FROM `mdl_role_capabilities` AS rc WHERE rc.capability = mrc.capability &lt;br /&gt;
  AND rc.roleid = &#039;3&#039; AND rc.contextid = &#039;1&#039;) AS Teacher&lt;br /&gt;
,(SELECT rc.permission FROM `mdl_role_capabilities` AS rc WHERE rc.capability = mrc.capability &lt;br /&gt;
  AND rc.roleid = &#039;4&#039; AND rc.contextid = &#039;1&#039;) AS AssistantTeacher&lt;br /&gt;
,(SELECT rc.permission FROM `mdl_role_capabilities` AS rc WHERE rc.capability = mrc.capability &lt;br /&gt;
  AND rc.roleid = &#039;5&#039; AND rc.contextid = &#039;1&#039;) AS Student&lt;br /&gt;
,(SELECT rc.permission FROM `mdl_role_capabilities` AS rc WHERE rc.capability = mrc.capability &lt;br /&gt;
  AND rc.roleid = &#039;6&#039; AND rc.contextid = &#039;1&#039;) AS Guest&lt;br /&gt;
&lt;br /&gt;
FROM `mdl_role_capabilities` AS mrc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Log Activity Reports==&lt;br /&gt;
===Count all Active Users by ROLE in a course category (including all of its sub-categories)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(DISTINCT l.userid) as active&lt;br /&gt;
FROM mdl_course as c&lt;br /&gt;
JOIN mdl_context AS ctx ON  ctx.instanceid=c.id&lt;br /&gt;
JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id&lt;br /&gt;
JOIN mdl_user_lastaccess as l ON ra.userid = l.userid&lt;br /&gt;
JOIN mdl_course_categories AS cats ON c.category = cats.id&lt;br /&gt;
WHERE c.category=cats.id AND (&lt;br /&gt;
	cats.path LIKE &#039;%/80/%&#039;&lt;br /&gt;
	OR cats.path LIKE &#039;%/80&#039;&lt;br /&gt;
) &lt;br /&gt;
AND ra.roleid=3  AND ctx.contextlevel=50  #ra.roleid= TEACHER 3, NON-EDITING TEACHER 4, STUDENT 5&lt;br /&gt;
AND  l.timeaccess &amp;gt; (unix_timestamp() - ((60*60*24)*NO_OF_DAYS)) #NO_OF_DAYS change to number&lt;br /&gt;
&amp;lt;/code&amp;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;
===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;
===Total activity per course, per unique user on the last 24h===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
Select&lt;br /&gt;
     Count(Distinct userid) As countUsers&lt;br /&gt;
   , Count(course) As countVisits&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;
 From prefix_log as l&lt;br /&gt;
 JOIN prefix_course as c on c.id = l.course&lt;br /&gt;
 Where course &amp;gt; 0 and FROM_UNIXTIME(time) &amp;gt;= DATE_SUB(NOW(), INTERVAL 1 DAY) and c.fullname LIKE &#039;%תשעג%&#039;&lt;br /&gt;
 Group By course&lt;br /&gt;
ORDER BY countVisits DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Weekly Instructor Online Participation===&lt;br /&gt;
Contributed by Elizabeth Dalton&lt;br /&gt;
&lt;br /&gt;
Displays participation of instructors in all courses per week of a term, including pre-term and post-term edits. An edit is defined as a change to the course, such as a discussion post, the grading of an assignment, or the uploading of file attachments, as well as alterations to course content.&lt;br /&gt;
&lt;br /&gt;
* To specify a subject and/or course number, use % as a wildcard, e.g. ARTS% or ARTS501%&lt;br /&gt;
* To match part of a last name, use %, e.g. Smi% will match &amp;quot;Smith&amp;quot;, &amp;quot;Smile&amp;quot;, etc.&lt;br /&gt;
&lt;br /&gt;
At our institution, we include filters on the course name or category to constrain by terms. These are very specific to how course names and categories are constructed at our institution, so I&#039;ve removed those elements from this code. Also, our terms are 12 weeks long. You would want to insert additional &amp;quot;SUM&amp;quot; lines for longer terms, or remove lines for shorter terms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
c.shortname AS CourseID&lt;br /&gt;
, cc.name AS Category&lt;br /&gt;
, CONCAT(u.firstname ,&#039; &#039;,u.lastname) AS Instructor&lt;br /&gt;
&lt;br /&gt;
, (SELECT COUNT( ra2.userid ) AS Users2 FROM prefix_role_assignments AS ra2&lt;br /&gt;
JOIN prefix_context AS ctx2 ON ra2.contextid = ctx2.id&lt;br /&gt;
WHERE ra2.roleid = 5 AND ctx2.instanceid = c.id) AS Students&lt;br /&gt;
&lt;br /&gt;
, c.startdate AS Course_Start_Date&lt;br /&gt;
&lt;br /&gt;
, c.visible AS Visible&lt;br /&gt;
&lt;br /&gt;
,  COUNT(l.id) AS Edits&lt;br /&gt;
&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time)) - WEEK(FROM_UNIXTIME(c.startdate))&amp;lt;0,1,0)) AS BeforeTerm&lt;br /&gt;
&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=0,1,0)) AS Week1&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=1,1,0)) AS Week2&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=2,1,0)) AS Week3&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=3,1,0)) AS Week4&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=4,1,0)) AS Week5&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=5,1,0)) AS Week6&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=6,1,0)) AS Week7&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=7,1,0)) AS Week8&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=8,1,0)) AS Week9&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=9,1,0)) AS Week10&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=10,1,0)) AS Week11&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))=11,1,0)) AS Week12&lt;br /&gt;
&lt;br /&gt;
, SUM(IF(WEEK(FROM_UNIXTIME(l.time))-WEEK(FROM_UNIXTIME(c.startdate))&amp;gt;=12,1,0)) AS AfterTerm&lt;br /&gt;
&lt;br /&gt;
, CONCAT(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/report/log/index.php&#039;,CHAR(63),&#039;chooselog=1&amp;amp;showusers=1&amp;amp;showcourses=0&amp;amp;id=&#039;,c.id,&#039;&amp;amp;user=&#039;,u.id,&#039;&amp;amp;date=0&amp;amp;modid=&amp;amp;modaction=&amp;amp;logformat=showashtml&#039;,&#039;&amp;quot;&amp;gt;&#039;,&#039;Logs&#039;,&#039;&amp;lt;/a&amp;gt;&#039;) AS Link&lt;br /&gt;
&lt;br /&gt;
FROM prefix_user AS u&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON u.id = ra.userid&lt;br /&gt;
JOIN prefix_context AS ctx ON ra.contextid = ctx.id&lt;br /&gt;
JOIN prefix_course AS c ON c.id = ctx.instanceid&lt;br /&gt;
JOIN prefix_course_categories as cc ON c.category = cc.id&lt;br /&gt;
&lt;br /&gt;
LEFT JOIN prefix_log AS l ON l.userid = u.id AND l.course = c.id  AND l.action NOT LIKE &amp;quot;view%&amp;quot;&lt;br /&gt;
&lt;br /&gt;
WHERE ra.roleid =3&lt;br /&gt;
AND ctx.instanceid = c.id&lt;br /&gt;
AND c.shortname LIKE :course&lt;br /&gt;
AND u.lastname LIKE :last_name&lt;br /&gt;
&lt;br /&gt;
GROUP BY u.idnumber, c.id&lt;br /&gt;
HAVING students &amp;gt; 0&lt;br /&gt;
ORDER BY c.shortname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Module activity (Hits) between dates===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT module, COUNT( * ) &lt;br /&gt;
FROM prefix_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME( l.`time` ) BETWEEN  &#039;2012-10-01 00:00:00&#039; AND  &#039;2013-09-31 00:00:00&#039;)&lt;br /&gt;
GROUP BY module&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Module activity (Instances and Hits) for each academic year===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT name&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM mdl_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME(l.`time`) BETWEEN &#039;2010-10-01 00:00:00&#039; AND &#039;2011-09-31 00:00:00&#039;)&lt;br /&gt;
AND l.module = m.name AND l.action = &#039;add&#039;&lt;br /&gt;
) AS &amp;quot;Added 2010&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM mdl_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME(l.`time`) BETWEEN &#039;2010-10-01 00:00:00&#039; AND &#039;2011-09-31 00:00:00&#039;)&lt;br /&gt;
AND l.module = m.name&lt;br /&gt;
) AS &amp;quot;Used 2010&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM mdl_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME(l.`time`) BETWEEN &#039;2011-10-01 00:00:00&#039; AND &#039;2012-09-31 00:00:00&#039;)&lt;br /&gt;
AND l.module = m.name AND l.action = &#039;add&#039;&lt;br /&gt;
) AS &amp;quot;Added 2011&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM mdl_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME(l.`time`) BETWEEN &#039;2011-10-01 00:00:00&#039; AND &#039;2012-09-31 00:00:00&#039;)&lt;br /&gt;
AND l.module = m.name&lt;br /&gt;
) AS &amp;quot;Used 2011&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM mdl_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME(l.`time`) BETWEEN &#039;2012-10-01 00:00:00&#039; AND &#039;2013-09-31 00:00:00&#039;)&lt;br /&gt;
AND l.module = m.name AND l.action = &#039;add&#039;&lt;br /&gt;
) AS &amp;quot;Added 2012&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM mdl_log AS l&lt;br /&gt;
WHERE (FROM_UNIXTIME(l.`time`) BETWEEN &#039;2012-10-01 00:00:00&#039; AND &#039;2013-09-31 00:00:00&#039;)&lt;br /&gt;
AND l.module = m.name&lt;br /&gt;
) AS &amp;quot;Used 2012&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM mdl_modules AS m&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;
===Count unique teachers with courses that use at least X module (Moodle19)===&lt;br /&gt;
You can remove the outer &amp;quot;SELECT COUNT(*) FROM (...) AS ActiveTeachers&amp;quot; SQL query and get the list of the Teachers and Courses.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT COUNT(*)&lt;br /&gt;
FROM (SELECT c.id AS CourseID, c.fullname AS Course, ra.roleid AS RoleID, CONCAT(u.firstname, &#039; &#039;, u.lastname) AS Teacher&lt;br /&gt;
,(SELECT COUNT(*) FROM prefix_course_modules cm WHERE cm.course = c.id) AS Modules&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_context AS ctx ON c.id = ctx.instanceid AND ctx.contextlevel = 50 &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_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE  ra.roleid = 3 &lt;br /&gt;
GROUP BY u.id&lt;br /&gt;
HAVING Modules &amp;gt; 5) AS ActiveTeachers&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;
===Common resource types count for each Category (Moodle19)===&lt;br /&gt;
Including sub-categories in total count.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT mcc.id AS mccid, CONCAT( LPAD( &#039;&#039;, mcc.depth, &#039;.&#039; ) , mcc.name ) AS Category&lt;br /&gt;
,(SELECT COUNT( * ) &lt;br /&gt;
FROM prefix_resource AS r&lt;br /&gt;
JOIN prefix_course AS c ON c.id = r.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%&#039;, mccid, &#039;%&#039; ) AND r.TYPE = &#039;file&#039; AND r.reference LIKE &#039;http://%&#039;&lt;br /&gt;
) AS Links&lt;br /&gt;
 &lt;br /&gt;
,(SELECT COUNT( * ) &lt;br /&gt;
FROM prefix_resource AS r&lt;br /&gt;
JOIN prefix_course AS c ON c.id = r.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%&#039;, mccid, &#039;%&#039; ) AND r.TYPE = &#039;file&#039; AND r.reference NOT LIKE &#039;http://%&#039;&lt;br /&gt;
) AS Files&lt;br /&gt;
 &lt;br /&gt;
,(SELECT COUNT( * ) &lt;br /&gt;
FROM prefix_resource AS r&lt;br /&gt;
JOIN prefix_course AS c ON c.id = r.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%&#039;, mccid, &#039;%&#039; ) AND r.TYPE = &#039;directory&#039; &lt;br /&gt;
) AS Folders&lt;br /&gt;
 &lt;br /&gt;
,(SELECT COUNT( * ) &lt;br /&gt;
FROM prefix_resource AS r&lt;br /&gt;
JOIN prefix_course AS c ON c.id = r.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%&#039;, mccid, &#039;%&#039; ) AND r.TYPE = &#039;html&#039; &lt;br /&gt;
) AS Pages&lt;br /&gt;
 &lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM stats_log_context_role_course &lt;br /&gt;
WHERE roleid = 5 AND module = &#039;resource&#039; AND category = mcc.id&lt;br /&gt;
) AS Hits&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course_categories AS mcc&lt;br /&gt;
ORDER BY mcc.path&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Where &amp;quot;stats_log_context_role_course&amp;quot; (in the above SQL query) is a VIEW generated by:&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
CREATE VIEW stats_log_context_role_course AS&lt;br /&gt;
SELECT l.course, c.category, cc.path, l.module, l.action, ra.userid, ra.roleid&lt;br /&gt;
FROM prefix_log AS l&lt;br /&gt;
JOIN prefix_context AS context ON context.instanceid = l.course AND context.contextlevel = 50&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.userid = l.userid AND ra.contextid = context.id&lt;br /&gt;
JOIN prefix_course AS c ON c.id = l.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Same query but for Moodle2+&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT mcc.id AS mccid, CONCAT( LPAD( &#039;&#039;, mcc.depth, &#039;.&#039; ) , mcc.name ) AS Category,&lt;br /&gt;
mcc.path,&lt;br /&gt;
&lt;br /&gt;
(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_url AS u&lt;br /&gt;
JOIN prefix_course AS c ON c.id = u.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%/&#039;, mccid, &#039;%&#039; )&lt;br /&gt;
) AS URLs,&lt;br /&gt;
&lt;br /&gt;
(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_folder AS f&lt;br /&gt;
JOIN prefix_course AS c ON c.id = f.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%/&#039;, mccid, &#039;%&#039; )&lt;br /&gt;
) AS FOLDERs,&lt;br /&gt;
&lt;br /&gt;
(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_page AS p&lt;br /&gt;
JOIN prefix_course AS c ON c.id = p.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%/&#039;, mccid, &#039;%&#039; )&lt;br /&gt;
) AS PAGEs,&lt;br /&gt;
&lt;br /&gt;
(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_book AS b&lt;br /&gt;
JOIN prefix_course AS c ON c.id = b.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%/&#039;, mccid, &#039;%&#039; )&lt;br /&gt;
) AS BOOKs,&lt;br /&gt;
&lt;br /&gt;
(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_label AS l&lt;br /&gt;
JOIN prefix_course AS c ON c.id = l.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%/&#039;, mccid, &#039;%&#039; )&lt;br /&gt;
) AS LABELs,&lt;br /&gt;
&lt;br /&gt;
(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_tab AS t&lt;br /&gt;
JOIN prefix_course AS c ON c.id = t.course&lt;br /&gt;
JOIN prefix_course_categories AS cc ON cc.id = c.category&lt;br /&gt;
WHERE cc.path LIKE CONCAT( &#039;%/&#039;, mccid, &#039;%&#039; )&lt;br /&gt;
) AS TABs&lt;br /&gt;
&lt;br /&gt;
FROM prefix_course_categories AS mcc&lt;br /&gt;
ORDER BY mcc.path&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Detailed Resource COUNT by Teacher in each course===&lt;br /&gt;
&lt;br /&gt;
Including (optional) filter by: year, semester and course id.&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 CourseID&lt;br /&gt;
, c.id&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;
, (CASE &lt;br /&gt;
WHEN c.fullname LIKE &#039;%תשעב%&#039; THEN &#039;2012&#039; &lt;br /&gt;
WHEN c.fullname LIKE &#039;%תשעא%&#039; THEN &#039;2011&#039;&lt;br /&gt;
END ) as Year&lt;br /&gt;
, (CASE &lt;br /&gt;
WHEN c.fullname LIKE &#039;%סמסטר א%&#039; THEN &#039;Semester A&#039; &lt;br /&gt;
WHEN c.fullname LIKE &#039;%סמסטר ב%&#039; THEN &#039;Semester B&#039;&lt;br /&gt;
WHEN c.fullname LIKE &#039;%סמסטר ק%&#039; THEN &#039;Semester C&#039;&lt;br /&gt;
END ) as Semester&lt;br /&gt;
,COUNT(c.id) AS Total&lt;br /&gt;
,(SELECT count(*) FROM prefix_course_modules AS cm WHERE cm.course = c.id AND cm.module= 20) AS TABs&lt;br /&gt;
,(SELECT count(*) FROM prefix_course_modules AS cm WHERE cm.course = c.id AND cm.module= 33) AS BOOKs&lt;br /&gt;
&lt;br /&gt;
FROM `prefix_resource` as r &lt;br /&gt;
JOIN `prefix_course` AS c on c.id = r.course&lt;br /&gt;
#WHERE type= &#039;file&#039; and reference NOT LIKE &#039;http://%&#039; &lt;br /&gt;
&lt;br /&gt;
#WHERE 1=1&lt;br /&gt;
#%%FILTER_YEARS:c.fullname%%&lt;br /&gt;
#AND c.fullname LIKE &#039;%2013%&#039;&lt;br /&gt;
&lt;br /&gt;
GROUP BY course&lt;br /&gt;
ORDER BY COUNT(c.id) 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;
,(SELECT count(*) FROM prefix_groups g WHERE g.courseid = c.id) Groups&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;
===Courses with Groups===&lt;br /&gt;
&lt;br /&gt;
List of all courses with Groups in them (groupmode &amp;gt; 0). You can also use groupmode=1 to list just Separate type groups or groupmode=2 to list Visible type groups.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname, g.name, c.groupmode&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_groups AS g ON c.id = g.courseid&lt;br /&gt;
WHERE c.groupmode &amp;gt; 0&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Groups in course with member list===&lt;br /&gt;
&lt;br /&gt;
List the groups in a course (replace the # by the course id number) with the members of each group.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname, g.name AS Groupname, u.username&lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
JOIN prefix_groups AS g ON g.courseid = c.id&lt;br /&gt;
JOIN prefix_groups_members AS m ON g.id = m.groupid&lt;br /&gt;
JOIN prefix_user AS u ON m.userid = u.id&lt;br /&gt;
WHERE c.id = #&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Group Export===&lt;br /&gt;
&lt;br /&gt;
There&#039;s a [[Import_groups|group import]] function, but no export. Use this to give you a report with the proper column order and headings to export to a csv file you can then import into another course to replicate the groups. This is a simple version with just the main fields: groupname, description, enrolment key.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT g.name AS groupname, g.description, g.enrolmentkey&lt;br /&gt;
FROM prefix_groups AS g &lt;br /&gt;
JOIN prefix_course as c ON g.courseid = c.id&lt;br /&gt;
WHERE c.id = #&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;
&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;
===Student&#039;s posts content in all course blogs (oublog)===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
b.name &lt;br /&gt;
,op.title&lt;br /&gt;
,op.message&lt;br /&gt;
,( SELECT CONCAT(u.firstname, &#039; &#039;,u.lastname) FROM prefix_user AS u WHERE u.id = oi.userid) AS &amp;quot;Username&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM prefix_oublog_posts AS op&lt;br /&gt;
JOIN prefix_oublog_instances AS oi ON oi.id = op.oubloginstancesid &lt;br /&gt;
JOIN prefix_oublog as b ON b.id = oi.oublogid&lt;br /&gt;
JOIN prefix_course AS c ON b.course = c.id&lt;br /&gt;
&lt;br /&gt;
WHERE c.id = %%COURSEID%%&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;
===Site-wide completed SCORM activities by Course name===&lt;br /&gt;
This report will list all completed attempts for all SCORM activities. It is ordered first by Course name, then student&#039;s last name, then student&#039;s first name, then attempt number. Please note: the FROM_UNIXTIME command is for MySQL.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname First,u.lastname Last,c.fullname Course, st.attempt Attempt,st.value Status,FROM_UNIXTIME(st.timemodified,&amp;quot;%m-%d-%Y&amp;quot;) Date &lt;br /&gt;
FROM prefix_scorm_scoes_track AS st &lt;br /&gt;
JOIN prefix_user AS u ON st.userid=u.id&lt;br /&gt;
JOIN prefix_scorm AS sc ON sc.id=st.scormid&lt;br /&gt;
JOIN prefix_course AS c ON c.id=sc.course&lt;br /&gt;
WHERE st.value=&#039;completed&#039; &lt;br /&gt;
ORDER BY c.fullname, u.lastname,u.firstname, st.attempt&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Module instances + Module HITs by role teacher and student in course==&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
m.name AS &amp;quot;Module name&amp;quot;&lt;br /&gt;
, COUNT(*) AS &amp;quot;Module count&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_log AS l &lt;br /&gt;
WHERE l.course = cm.course AND l.module = m.name ) AS &amp;quot;Hits&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*)&lt;br /&gt;
FROM prefix_log AS l&lt;br /&gt;
JOIN prefix_context AS con ON con.instanceid= l.course AND con.contextlevel=50&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid= con.id AND ra.userid= l.userid AND ra.roleid = 5 &lt;br /&gt;
WHERE l.course = cm.course AND l.module = m.name) AS &amp;quot;Students HITs&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*)&lt;br /&gt;
FROM prefix_log AS l&lt;br /&gt;
JOIN prefix_context AS con ON con.instanceid= l.course AND con.contextlevel=50&lt;br /&gt;
JOIN prefix_role_assignments AS ra ON ra.contextid= con.id AND ra.userid= l.userid AND ra.roleid = 3 &lt;br /&gt;
WHERE l.course = cm.course AND l.module = m.name) AS &amp;quot;Teachers HITs&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM mdl_course_modules AS cm&lt;br /&gt;
JOIN mdl_modules AS m on m.id = cm.module&lt;br /&gt;
WHERE cm.course = &#039;%%COURSEID%%&#039;&lt;br /&gt;
GROUP BY cm.module&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Grade and Course Completion 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. Works with ad-hoc reports or Configurable Reports&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. Replace the line&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATEADD(ss,gi.timemodified,&#039;1970-01-01&#039;) AS Time&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
with&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
DATE_ADD(&#039;1970-01-01&#039;, INTERVAL gi.timemodified SECOND) 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. Works with ad-hoc reports or Configurable Reports&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,gg.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;
&lt;br /&gt;
For MySQL users:&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;, CONCAT(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;
CASE &lt;br /&gt;
  WHEN gi.itemtype = &#039;course&#039; &lt;br /&gt;
   THEN CONCAT(c.fullname, &#039; - 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;
FROM_UNIXTIME(gg.timemodified) 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;
&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;
===User Course Completion===&lt;br /&gt;
&lt;br /&gt;
A very simple report with list of course completion status by username. Completions are noted by date, blank otherwise. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.username, c.shortname,  &lt;br /&gt;
DATE_FORMAT(FROM_UNIXTIME(p.timecompleted&lt;br /&gt;
),&#039;%Y-%m-%d&#039;) &lt;br /&gt;
AS completed&lt;br /&gt;
FROM prefix_course_completions AS p&lt;br /&gt;
JOIN prefix_course AS c ON p.course = c.id&lt;br /&gt;
JOIN prefix_user AS u ON p.userid = u.id&lt;br /&gt;
WHERE c.enablecompletion = 1&lt;br /&gt;
ORDER BY u.username&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===User Course Completion with Criteria===&lt;br /&gt;
&lt;br /&gt;
A report with course completions by username, with Aggregation method, Criteria types, and Criteria detail where available.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.username AS user, &lt;br /&gt;
c.shortname AS course,&lt;br /&gt;
DATE_FORMAT(FROM_UNIXTIME(t.timecompleted),&#039;%Y-%m-%d&#039;) AS completed,&lt;br /&gt;
CASE&lt;br /&gt;
WHEN (SELECT a.method FROM prefix_course_completion_aggr_methd AS a  WHERE (a.course = c.id AND a.criteriatype IS NULL) = 1) THEN &amp;quot;Any&amp;quot;&lt;br /&gt;
ELSE &amp;quot;All&amp;quot;&lt;br /&gt;
END AS aggregation,&lt;br /&gt;
CASE &lt;br /&gt;
WHEN p.criteriatype = 1 THEN &amp;quot;Self&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 2 THEN &amp;quot;By Date&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 3 THEN &amp;quot;Unenrol Status&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 4 THEN &amp;quot;Activity&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 5 THEN &amp;quot;Duration&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 6 THEN &amp;quot;Course Grade&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 7 THEN &amp;quot;Approve by Role&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 8 THEN &amp;quot;Previous Course&amp;quot;&lt;br /&gt;
END AS criteriatype,&lt;br /&gt;
CASE &lt;br /&gt;
WHEN p.criteriatype = 1 THEN &amp;quot;*&amp;quot;&lt;br /&gt;
WHEN p.criteriatype = 2 THEN DATE_FORMAT(FROM_UNIXTIME(p.timeend),&#039;%Y-%m-%d&#039;)&lt;br /&gt;
WHEN p.criteriatype = 3 THEN t.unenroled&lt;br /&gt;
WHEN p.criteriatype = 4 THEN &lt;br /&gt;
CONCAT(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/&#039;,p.module,&#039;/view.php?id=&#039;,p.moduleinstance,&#039;&amp;quot;&amp;gt;&#039;,p.module,&#039;&amp;lt;/a&amp;gt;&#039;)&lt;br /&gt;
WHEN p.criteriatype = 5 THEN p.enrolperiod&lt;br /&gt;
WHEN p.criteriatype = 6 THEN CONCAT(&#039;Needed: &#039;,ROUND(p.gradepass,2),&#039; Achieved: &#039;,ROUND(t.gradefinal,2)) &lt;br /&gt;
WHEN p.criteriatype = 7 THEN p.role&lt;br /&gt;
WHEN p.criteriatype = 8 THEN (SELECT pc.shortname FROM prefix_course AS pc WHERE pc.id = p.courseinstance)&lt;br /&gt;
END AS criteriadetail &lt;br /&gt;
FROM prefix_course_completion_crit_compl AS t&lt;br /&gt;
JOIN prefix_user AS u ON t.userid = u.id&lt;br /&gt;
JOIN prefix_course AS c ON t.course = c.id&lt;br /&gt;
JOIN prefix_course_completion_criteria AS p ON t.criteriaid = p.id&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Courses with Completion Enabled and their settings===&lt;br /&gt;
&lt;br /&gt;
List of all courses with completion enabled and their Aggregation setting, Criteria types, and Criteria details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT c.shortname AS Course, &lt;br /&gt;
CASE&lt;br /&gt;
WHEN (SELECT a.method FROM prefix_course_completion_aggr_methd AS a  WHERE (a.course = t.course AND a.criteriatype IS NULL)) = 2 THEN &amp;quot;All&amp;quot;&lt;br /&gt;
ELSE &amp;quot;Any&amp;quot;&lt;br /&gt;
END AS Course_Aggregation,&lt;br /&gt;
CASE&lt;br /&gt;
WHEN t.criteriatype = 1 THEN &amp;quot;Self completion&amp;quot;&lt;br /&gt;
WHEN t.criteriatype = 2 THEN &amp;quot;Date done by&amp;quot; &lt;br /&gt;
WHEN t.criteriatype = 3 THEN &amp;quot;Unenrolement&amp;quot; &lt;br /&gt;
WHEN t.criteriatype = 4 THEN &amp;quot;Activity completion&amp;quot;   &lt;br /&gt;
WHEN t.criteriatype = 5 THEN &amp;quot;Duration in days&amp;quot; &lt;br /&gt;
WHEN t.criteriatype = 6 THEN &amp;quot;Final grade&amp;quot;     &lt;br /&gt;
WHEN t.criteriatype = 7 THEN &amp;quot;Approve by role&amp;quot; &lt;br /&gt;
WHEN t.criteriatype = 8 THEN &amp;quot;Previous course&amp;quot;&lt;br /&gt;
END AS Criteria_type,&lt;br /&gt;
CASE&lt;br /&gt;
WHEN t.criteriatype = 1 THEN &amp;quot;On&amp;quot;&lt;br /&gt;
WHEN t.criteriatype = 2 THEN DATE_FORMAT(FROM_UNIXTIME(t.timeend),&#039;%Y-%m-%d&#039;)&lt;br /&gt;
WHEN t.criteriatype = 3 THEN &amp;quot;On&amp;quot;&lt;br /&gt;
WHEN t.criteriatype = 4 THEN&lt;br /&gt;
CONCAT(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/&#039;,t.module,&#039;/view.php?id=&#039;,t.moduleinstance,&#039;&amp;quot;&amp;gt;&#039;,t.module,&#039;&amp;lt;/a&amp;gt;&#039;)&lt;br /&gt;
WHEN t.criteriatype = 5 THEN ROUND(t.enrolperiod/86400)&lt;br /&gt;
WHEN t.criteriatype = 6 THEN ROUND(t.gradepass,2)&lt;br /&gt;
WHEN t.criteriatype = 7 THEN (SELECT r.shortname FROM prefix_role AS r WHERE r.id = t.role)&lt;br /&gt;
WHEN t.criteriatype = 8 THEN (SELECT pc.shortname FROM prefix_course AS pc WHERE pc.id = t.courseinstance)&lt;br /&gt;
END AS Criteria_detail&lt;br /&gt;
FROM prefix_course_completion_criteria as t&lt;br /&gt;
JOIN prefix_course AS c ON t.course = c.id&lt;br /&gt;
WHERE c.enablecompletion = 1&lt;br /&gt;
ORDER BY course&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Course Completion Report with custom dates===&lt;br /&gt;
&lt;br /&gt;
List of users who completed multiple or single course/s from a start date to end date chosen by the user. The output gives username, name, course name, completion date and score&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
&lt;br /&gt;
SELECT u.username AS &#039;User Name&#039;,&lt;br /&gt;
CONCAT(u.firstname , &#039; &#039; , u.lastname) AS &#039;Name&#039;,&lt;br /&gt;
c.shortname AS &#039;Course Name&#039;, &lt;br /&gt;
DATE_FORMAT(FROM_UNIXTIME(p.timecompleted),&#039;%W %e %M, %Y&#039;) AS &#039;Completed Date&#039;,&lt;br /&gt;
ROUND(c4.gradefinal,2) AS &#039;Score&#039;&lt;br /&gt;
FROM prefix_course_completions AS p&lt;br /&gt;
JOIN prefix_course AS c ON p.course = c.id&lt;br /&gt;
JOIN prefix_user AS u ON p.userid = u.id&lt;br /&gt;
JOIN prefix_course_completion_crit_compl AS c4 ON u.id = c4.userid&lt;br /&gt;
WHERE c.enablecompletion = 1  AND (p.timecompleted IS NOT NULL OR p.timecompleted !=&#039;&#039;) &lt;br /&gt;
AND (p.timecompleted&amp;gt;= :start_date AND p.timecompleted&amp;lt;=:end_date)&lt;br /&gt;
GROUP BY u.username&lt;br /&gt;
ORDER BY c.shortname&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Scales used in activities===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT scale.name&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/&#039;,gi.itemmodule,&#039;/view.php?id=&#039;,cm.id,&#039;&amp;quot;&amp;gt;&#039;,gi.itemname,&#039;&amp;lt;/a&amp;gt;&#039;) AS &amp;quot;Module View&amp;quot;&lt;br /&gt;
,CONCAT(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/course/modedit.php?up&#039;,&#039;date=&#039;,cm.id,&#039;&amp;quot;&amp;gt;&#039;,gi.itemname,&#039;&amp;lt;/a&amp;gt;&#039;) AS &amp;quot;Module Settings&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM prefix_grade_items AS gi&lt;br /&gt;
JOIN prefix_course AS c ON c.id = gi.courseid&lt;br /&gt;
JOIN prefix_course_modules AS cm ON cm.course = gi.courseid AND cm.instance = gi.iteminstance&lt;br /&gt;
JOIN prefix_scale AS scale ON scale.id = gi.scaleid&lt;br /&gt;
WHERE gi.scaleid IS NOT NULL&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Activity Module Reports==&lt;br /&gt;
&lt;br /&gt;
===How many SCORM activities are used in each Course===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT cm.course,c.fullname ,m.name &lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/scorm/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,count(cm.id),&#039;&amp;lt;/a&amp;gt;&#039;) AS Counter&lt;br /&gt;
 &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;%scorm%&#039; &lt;br /&gt;
GROUP BY cm.course,cm.module &lt;br /&gt;
ORDER BY count(cm.id) desc&lt;br /&gt;
&amp;lt;/code&amp;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;
===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;
===Course wiki usage/activity over the last 6 semesters===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &amp;quot;Courses with Wikis&amp;quot;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;2010&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%Semester A%&#039;) AS &#039;2010 &amp;lt;br/&amp;gt; Semester A&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;2010&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%Semester B%&#039;) AS &#039;2010 &amp;lt;br/&amp;gt; Semester B&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;תשעא&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%סמסטר א%&#039;) AS &#039;תשעא &amp;lt;br/&amp;gt; סמסטר א&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;תשעא&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%סמסטר ב%&#039;) AS &#039;תשעא &amp;lt;br/&amp;gt; סמסטר ב&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;תשעב&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%סמסטר א%&#039;) AS &#039;תשעב &amp;lt;br/&amp;gt; סמסטר א&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;תשעב&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%סמסטר ב%&#039;) AS &#039;תשעב &amp;lt;br/&amp;gt; סמסטר ב&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;תשעג&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%סמסטר א%&#039;) AS &#039;תשעג &amp;lt;br/&amp;gt; סמסטר א&#039;&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;
JOIN prefix_course AS c ON c.id = cm.course&lt;br /&gt;
WHERE cm.course = c.id AND m.name LIKE &#039;%wiki%&#039;&lt;br /&gt;
 and c.fullname LIKE CONCAT(&#039;%&#039;,&#039;תשעג&#039;,&#039;%&#039;) and c.fullname LIKE &#039;%סמסטר ב%&#039;) AS &#039;תשעג &amp;lt;br/&amp;gt; סמסטר ב&#039;&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;
===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;
=== Elluminate (Blackboard Collaborate) - system wide usage===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT e.name As Session ,er.recordingsize&lt;br /&gt;
,c.fullname As Course&lt;br /&gt;
,u.firstname,u.lastname &lt;br /&gt;
,DATE_FORMAT(FROM_UNIXTIME(e.timestart),&#039;%d-%m-%Y&#039;) AS dTimeStart&lt;br /&gt;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/moodle/mod/elluminate/loadrecording.php?id=&#039;,er.id,&#039;&amp;quot;&amp;gt;Show&amp;lt;/a&amp;gt;&#039;) AS RecordedSession&lt;br /&gt;
&lt;br /&gt;
FROM prefix_elluminate_recordings AS er&lt;br /&gt;
JOIN prefix_elluminate AS e ON e.meetingid = er.meetingid&lt;br /&gt;
JOIN prefix_course as c ON c.id = e.course&lt;br /&gt;
JOIN prefix_user AS u ON u.id = e.creator &lt;br /&gt;
ORDER BY er.recordingsize DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Choice ===&lt;br /&gt;
&lt;br /&gt;
Results of the Choice activity. For all courses, shows course shortname, username, the Choice text, and the answer chosen by the user.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT c.shortname AS course, u.username, h.name as question, o.text AS answer&lt;br /&gt;
FROM prefix_choice AS h&lt;br /&gt;
JOIN prefix_course AS c ON h.course = c.id&lt;br /&gt;
JOIN prefix_choice_answers AS a ON h.id = a.choiceid&lt;br /&gt;
JOIN prefix_user AS u ON a.userid = u.id&lt;br /&gt;
JOIN prefix_choice_options AS o ON a.optionid = o.id&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Assignment type usage in courses ===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
&lt;br /&gt;
CONCAT(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/assign/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;&#039;,c.fullname,&#039;&amp;lt;/a&amp;gt;&#039;) AS &amp;quot;List assignments&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) FROM prefix_assign WHERE c.id = course) AS Assignments&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_assign_plugin_config AS apc&lt;br /&gt;
JOIN prefix_assign AS iassign ON iassign.id = apc.assignment &lt;br /&gt;
WHERE iassign.course = c.id AND apc.plugin = &#039;file&#039; AND apc.subtype = &#039;assignsubmission&#039; AND apc.name = &#039;enabled&#039; AND apc.value = &#039;1&#039;&lt;br /&gt;
#GROUP BY apc.plugin&lt;br /&gt;
) AS &amp;quot;File Assignments&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_assign_plugin_config AS apc&lt;br /&gt;
JOIN prefix_assign AS iassign ON iassign.id = apc.assignment &lt;br /&gt;
WHERE iassign.course = c.id AND apc.plugin = &#039;onlinetext&#039; AND apc.subtype = &#039;assignsubmission&#039; AND apc.name = &#039;enabled&#039; AND apc.value = &#039;1&#039;&lt;br /&gt;
) AS &amp;quot;Online Assignments&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_assign_plugin_config AS apc&lt;br /&gt;
JOIN prefix_assign AS iassign ON iassign.id = apc.assignment &lt;br /&gt;
WHERE iassign.course = c.id AND apc.plugin = &#039;pdf&#039; AND apc.subtype = &#039;assignsubmission&#039; AND apc.name = &#039;enabled&#039; AND apc.value = &#039;1&#039;&lt;br /&gt;
) AS &amp;quot;PDF Assignments&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_assign_plugin_config AS apc&lt;br /&gt;
JOIN prefix_assign AS iassign ON iassign.id = apc.assignment &lt;br /&gt;
WHERE iassign.course = c.id AND apc.plugin = &#039;offline&#039; AND apc.subtype = &#039;assignsubmission&#039; AND apc.name = &#039;enabled&#039; AND apc.value = &#039;1&#039;&lt;br /&gt;
) AS &amp;quot;Offline Assignments&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_assign_plugin_config AS apc&lt;br /&gt;
JOIN prefix_assign AS iassign ON iassign.id = apc.assignment &lt;br /&gt;
WHERE iassign.course = c.id AND apc.plugin = &#039;comments&#039; AND apc.subtype = &#039;assignsubmission&#039; AND apc.name = &#039;enabled&#039; AND apc.value = &#039;1&#039;&lt;br /&gt;
) AS &amp;quot;Assignments Comments&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM prefix_assign AS assign&lt;br /&gt;
JOIN prefix_course AS c ON c.id = assign.course&lt;br /&gt;
GROUP BY c.id &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;
===Assignments (and Quizzes) waiting to be graded===&lt;br /&gt;
This report requires a YEAR filter to be added (Available when using the latest block/configurable_reports)&lt;br /&gt;
&lt;br /&gt;
Which you can always remove, to make this query work on earlier versions.&lt;br /&gt;
&lt;br /&gt;
The report includes: &lt;br /&gt;
*number of quizzes&lt;br /&gt;
*unFinished Quiz attempts&lt;br /&gt;
*Finished Quiz attempts&lt;br /&gt;
*number of students&lt;br /&gt;
*number of Assignments&lt;br /&gt;
*number of submitted answers by students &lt;br /&gt;
*number of unchecked assignments (waiting for the Teacher) in a 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;
,concat(&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/mod/assignment/index.php?id=&#039;,c.id,&#039;&amp;quot;&amp;gt;מטלות&amp;lt;/a&amp;gt;&#039;) AS Assignments&lt;br /&gt;
&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;בחנים&amp;lt;/a&amp;gt;&#039;) AS &#039;Quizzes&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) &lt;br /&gt;
FROM prefix_course_modules cm &lt;br /&gt;
JOIN prefix_modules as m ON m.id = cm.module &lt;br /&gt;
WHERE m.name LIKE &#039;quiz&#039; AND cm.course = c.id &lt;br /&gt;
GROUP BY cm.course &lt;br /&gt;
) AS &#039;nQuizzes&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*)&lt;br /&gt;
FROM prefix_quiz_attempts AS qa&lt;br /&gt;
JOIN prefix_quiz AS q ON q.id = qa.quiz&lt;br /&gt;
WHERE q.course = c.id&lt;br /&gt;
AND qa.timefinish = 0&lt;br /&gt;
GROUP BY q.course) AS &#039;unFinished Quiz attempts&#039;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*)&lt;br /&gt;
FROM prefix_quiz_attempts AS qa&lt;br /&gt;
JOIN prefix_quiz AS q ON q.id = qa.quiz&lt;br /&gt;
WHERE q.course = c.id&lt;br /&gt;
AND qa.timefinish &amp;gt; 0&lt;br /&gt;
GROUP BY q.course) AS &#039;finished quiz attempts&#039;&lt;br /&gt;
&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 nStudents&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
,(&lt;br /&gt;
SELECT count(a.id)&lt;br /&gt;
FROM prefix_assignment AS a &lt;br /&gt;
JOIN prefix_course_modules AS cm ON a.course = cm.course &lt;br /&gt;
WHERE cm.instance = a.id AND cm.module = 1 AND a.course = c.id&lt;br /&gt;
) nAssignments&lt;br /&gt;
&lt;br /&gt;
,(&lt;br /&gt;
SELECT count(*)&lt;br /&gt;
FROM prefix_assignment AS a &lt;br /&gt;
WHERE a.course = c.id AND FROM_UNIXTIME(a.timedue) &amp;gt; NOW()&lt;br /&gt;
GROUP BY a.course&lt;br /&gt;
) &#039;Open &amp;lt;br/&amp;gt;Assignments&#039;&lt;br /&gt;
&lt;br /&gt;
, CONCAT(ROUND( (100 / iAssignments ) * iOpenAssignments ) ,&#039;%&#039;) &#039;unFinished &amp;lt;br/&amp;gt;Assignments &amp;lt;br/&amp;gt;(percent)&#039;&lt;br /&gt;
 &lt;br /&gt;
,(&lt;br /&gt;
SELECT count(asb.id)&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_course_modules AS cm ON a.course = cm.course &lt;br /&gt;
WHERE asb.grade &amp;lt; 0 AND cm.instance = a.id AND cm.module = 1 AND a.course = c.id&lt;br /&gt;
) &#039;unChecked  &amp;lt;br/&amp;gt;Submissions&#039; &lt;br /&gt;
 &lt;br /&gt;
,(&lt;br /&gt;
SELECT count(asb.id)&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_course_modules AS cm ON a.course = cm.course &lt;br /&gt;
WHERE cm.instance = a.id AND cm.module = 1 AND a.course = c.id&lt;br /&gt;
) &#039;Submitted  &amp;lt;br/&amp;gt;Assignments&#039;&lt;br /&gt;
 &lt;br /&gt;
FROM prefix_course AS c&lt;br /&gt;
LEFT JOIN (&lt;br /&gt;
SELECT course, count(*) AS iAssignments&lt;br /&gt;
FROM prefix_assignment AS a &lt;br /&gt;
GROUP BY a.course &lt;br /&gt;
) AS tblAssignmentsCount ON tblAssignmentsCount.course = c.id&lt;br /&gt;
&lt;br /&gt;
LEFT JOIN (&lt;br /&gt;
SELECT course, count(*) AS iOpenAssignments&lt;br /&gt;
FROM prefix_assignment AS a &lt;br /&gt;
WHERE FROM_UNIXTIME(a.timedue) &amp;gt; NOW()&lt;br /&gt;
GROUP BY a.course &lt;br /&gt;
) AS tblOpenAssignmentsCount ON tblOpenAssignmentsCount.course = c.id&lt;br /&gt;
&lt;br /&gt;
WHERE 1=1  &lt;br /&gt;
#AND c.fullname LIKE &#039;%תשעג%&#039;&lt;br /&gt;
%%FILTER_YEARS:c.fullname%%&lt;br /&gt;
## You can enable the SEMESTER filter as well, &lt;br /&gt;
## by uncommenting the following line:&lt;br /&gt;
## %%FILTER_SEMESTERS:c.fullname%%&lt;br /&gt;
ORDER BY &#039;Open &amp;lt;br/&amp;gt;Assignments&#039; DESC&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;
===print all User&#039;s post in course Forums===&lt;br /&gt;
@@COURSEID@@ is a variable the is replace by the current CourseID you are running the sql report from. if you are using the latest block/configurable_reports ! (You can always change it to a fixed course or remove it to display all courses.)&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%%/mod/forum/user.php?course=&#039;,c.id,&#039;&amp;amp;id=&#039;,u.id,&#039;&amp;amp;mode=posts&amp;quot;&amp;gt;&#039;,CONCAT(u.firstname,&#039; &#039;, u.lastname),&#039;&amp;lt;/a&amp;gt;&#039;) As Fullname&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;,f.name,&#039;&amp;lt;/a&amp;gt;&#039;) AS Forum&lt;br /&gt;
,count(*) as Posts&lt;br /&gt;
,(SELECT count(*) FROM prefix_forum_discussions AS ifd JOIN prefix_forum as iforum ON iforum.id = ifd.forum  WHERE ifd.userid = fp.userid AND iforum.id = f.id) AS cAllDiscussion&lt;br /&gt;
&lt;br /&gt;
FROM prefix_forum_posts AS fp &lt;br /&gt;
JOIN prefix_user as u ON u.id = fp.userid &lt;br /&gt;
JOIN prefix_forum_discussions AS fd ON fp.discussion = fd.id &lt;br /&gt;
JOIN prefix_forum AS f ON f.id = fd.forum &lt;br /&gt;
JOIN prefix_course as c ON c.id = fd.course &lt;br /&gt;
WHERE fd.course = &#039;@@COURSEID@@&#039; &lt;br /&gt;
GROUP BY f.id,u.id&lt;br /&gt;
ORDER BY u.id&lt;br /&gt;
&amp;lt;/code&amp;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;
===Forum activity - system wide===&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.id,&#039;&amp;lt;/a&amp;gt;&#039;) AS CourseID&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;
,c.fullname as Course&lt;br /&gt;
,f.type&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;
, fd.forum, f.name,count(*) AS cPostAndDisc&lt;br /&gt;
,(SELECT count(*) FROM prefix_forum_discussions AS ifd WHERE ifd.forum = f.id) AS cDiscussion&lt;br /&gt;
FROM prefix_forum_posts AS fp&lt;br /&gt;
JOIN prefix_forum_discussions AS fd ON fd.id = fp.discussion&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;
WHERE f.type != &#039;news&#039; AND c.fullname LIKE &#039;%2013%&#039;&lt;br /&gt;
## WHERE 1=1 &lt;br /&gt;
## %%FILTER_YEARS:c.fullname%%&lt;br /&gt;
## You can enable the SEMESTER filter as well, &lt;br /&gt;
## by uncommenting the following line:&lt;br /&gt;
## %%FILTER_SEMESTERS:c.fullname%%&lt;br /&gt;
&lt;br /&gt;
GROUP BY fd.forum&lt;br /&gt;
ORDER BY count( * ) 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;
===Cantidad de foros que han sido posteados por profesor===&lt;br /&gt;
Queriamos saber cuales son las acciones del profesor dentro de los foros de cada curso, por ello se hizo este informe.&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.shortname,&#039;&amp;lt;/a&amp;gt;&#039;) AS curso,&lt;br /&gt;
CONCAT(u.firstname ,&#039; &#039;,u.lastname) AS Facilitador,&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 foros,&lt;br /&gt;
&lt;br /&gt;
COUNT(*) AS Posts&lt;br /&gt;
&lt;br /&gt;
FROM prefix_forum_posts AS fp &lt;br /&gt;
JOIN prefix_forum_discussions AS fd ON fp.discussion = fd.id &lt;br /&gt;
JOIN prefix_forum AS f ON f.id = fd.forum &lt;br /&gt;
JOIN prefix_course AS c ON c.id = fd.course&lt;br /&gt;
JOIN prefix_user AS u ON u.id = fp.userid &lt;br /&gt;
&lt;br /&gt;
WHERE fp.userid =&lt;br /&gt;
(&lt;br /&gt;
select distinct prefix_user.id&lt;br /&gt;
from prefix_user &lt;br /&gt;
join prefix_role_assignments as ra on ra.userid = prefix_user.id &lt;br /&gt;
where ra.roleid = 3 &lt;br /&gt;
and userid = fp.userid&lt;br /&gt;
limit 1&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
and c.shortname like &#039;%2014-2-1%&#039;&lt;br /&gt;
GROUP BY c.id, u.id&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 prefix_quiz qu, prefix_course co, prefix_role re, prefix_context ct, prefix_role_assignments ra, prefix_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 prefix_role_assignments a&lt;br /&gt;
                                JOIN prefix_user u ON userid = u.id&lt;br /&gt;
                                WHERE roleid = 5 AND contextid = (SELECT id FROM prefix_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;br /&gt;
&lt;br /&gt;
===List all MultiAnswer (Cloze) Questions===&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%%/mod/quiz/attempt.php?q=&#039;, quiz.id, &#039;&amp;quot;&amp;gt;&#039;, quiz.name, &#039;&amp;lt;/a&amp;gt;&#039;) AS Quiz&lt;br /&gt;
,question.id question_id, question.questiontext &lt;br /&gt;
FROM  prefix_question question&lt;br /&gt;
JOIN prefix_quiz_question_instances qqi ON question.id = qqi.question&lt;br /&gt;
JOIN prefix_quiz quiz ON qqi.quiz = quiz.id&lt;br /&gt;
WHERE  `qtype` LIKE  &#039;multianswer&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===List courses with MANUAL grades===&lt;br /&gt;
Which is basically and indication to teachers using Moodle to hold offline grades inside Moodle&#039;s Gradebook,&lt;br /&gt;
So grades could be uploaded into an administrative SIS. Use with Configurable Reports.&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%%/grade/edit/tree/index.php?showadvanced=1&amp;amp;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_grade_items AS gi&lt;br /&gt;
JOIN prefix_course as c ON c.id = gi.courseid&lt;br /&gt;
WHERE  `itemtype` =  &#039;manual&#039;&lt;br /&gt;
GROUP BY courseid&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
===List the users that did not took the Quiz===&lt;br /&gt;
Do not forget to change &amp;quot;c.id = 14&amp;quot; and q.name LIKE &#039;%quiz name goes here%&#039;&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT&lt;br /&gt;
user2.id AS ID,&lt;br /&gt;
ul.timeaccess,&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.username AS IDNumber,&lt;br /&gt;
user2.institution AS Institution,&lt;br /&gt;
 &lt;br /&gt;
IF (user2.lastaccess = 0,&#039;never&#039;,&lt;br /&gt;
DATE_FORMAT(FROM_UNIXTIME(user2.lastaccess),&#039;%Y-%m-%d&#039;)) AS dLastAccess&lt;br /&gt;
 &lt;br /&gt;
,(SELECT DATE_FORMAT(FROM_UNIXTIME(timeaccess),&#039;%Y-%m-%d&#039;) FROM prefix_user_lastaccess WHERE userid=user2.id AND courseid=c.id) AS CourseLastAccess&lt;br /&gt;
 &lt;br /&gt;
,(SELECT r.name&lt;br /&gt;
FROM  prefix_user_enrolments AS uenrol&lt;br /&gt;
JOIN prefix_enrol AS e ON e.id = uenrol.enrolid&lt;br /&gt;
JOIN prefix_role AS r ON e.id = r.id&lt;br /&gt;
WHERE uenrol.userid=user2.id AND e.courseid = c.id) AS RoleName&lt;br /&gt;
 &lt;br /&gt;
FROM prefix_user_enrolments AS ue&lt;br /&gt;
JOIN prefix_enrol AS e ON e.id = ue.enrolid&lt;br /&gt;
JOIN prefix_course AS c ON c.id = e.courseid&lt;br /&gt;
JOIN prefix_user AS user2 ON user2 .id = ue.userid&lt;br /&gt;
LEFT JOIN prefix_user_lastaccess AS ul ON ul.userid = user2.id&lt;br /&gt;
WHERE c.id=14 and ue.userid NOT IN (SELECT qa.userid FROM prefix_quiz_attempts AS qa&lt;br /&gt;
JOIN prefix_quiz AS q ON qa.quiz = q.id&lt;br /&gt;
JOIN prefix_course AS c ON q.course = c.id&lt;br /&gt;
WHERE c.id = 14 AND q.name LIKE &#039;%quiz name goes here%&#039;)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===List Questions in each Quiz===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT quiz.id,quiz.name, q.id, q.name&lt;br /&gt;
FROM mdl_quiz AS quiz&lt;br /&gt;
JOIN mdl_question AS q ON FIND_IN_SET(q.id, quiz.questions)&lt;br /&gt;
WHERE quiz.course = %%COURSEID%%&lt;br /&gt;
ORDER BY quiz.id ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==SCORM Activity Reports==&lt;br /&gt;
&lt;br /&gt;
===Lists All completed SCORM activites by Course name===&lt;br /&gt;
This report will list all completed attempts for all SCORM activities. It is ordered first by Course name, then student&#039;s last name, then student&#039;s first name, then attempt number. Please note: the FROM_UNIXTIME command is for MySQL.&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname First,u.lastname Last,c.fullname Course, st.attempt Attempt,st.value Status,FROM_UNIXTIME(st.timemodified,&amp;quot;%m-%d-%Y&amp;quot;) Date &lt;br /&gt;
FROM prefix_scorm_scoes_track AS st &lt;br /&gt;
JOIN prefix_user AS u ON st.userid=u.id&lt;br /&gt;
JOIN prefix_scorm AS sc ON sc.id=st.scormid&lt;br /&gt;
JOIN prefix_course AS c ON c.id=sc.course&lt;br /&gt;
WHERE st.value=&#039;completed&#039; &lt;br /&gt;
ORDER BY c.fullname, u.lastname,u.firstname, st.attempt&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Badges==&lt;br /&gt;
&lt;br /&gt;
=== All badges issued, by User ===&lt;br /&gt;
&lt;br /&gt;
This report will show you all the badges on a site that have been issued, both site and all courses, by the username of each user issued a badge. Includes the type of criteria passed (activity, course completion, manual), date issued, date expires, and a direct link to that issued badge page so you can see all the other details for that badge.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.username, b.name AS badgename, &lt;br /&gt;
CASE&lt;br /&gt;
WHEN b.courseid IS NOT NULL THEN&lt;br /&gt;
(SELECT c.shortname&lt;br /&gt;
    FROM prefix_course AS c&lt;br /&gt;
    WHERE c.id = b.courseid)&lt;br /&gt;
WHEN b.courseid IS NULL THEN &amp;quot;*&amp;quot;&lt;br /&gt;
END AS Context,&lt;br /&gt;
CASE &lt;br /&gt;
  WHEN t.criteriatype = 1 AND t.method = 1 THEN &amp;quot;Activity Completion (All)&amp;quot;&lt;br /&gt;
  WHEN t.criteriatype = 1 AND t.method = 2 THEN &amp;quot;Activity Completion (Any)&amp;quot;&lt;br /&gt;
  WHEN t.criteriatype = 2 AND t.method = 2 THEN &amp;quot;Manual Award&amp;quot;&lt;br /&gt;
  WHEN t.criteriatype = 4 AND t.method = 1 THEN &amp;quot;Course Completion (All)&amp;quot;&lt;br /&gt;
  WHEN t.criteriatype = 4 AND t.method = 2 THEN &amp;quot;Course Completion (Any)&amp;quot;&lt;br /&gt;
  ELSE CONCAT (&#039;Other: &#039;, t.criteriatype)&lt;br /&gt;
END AS Criteriatype,&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( d.dateissued ) , &#039;%Y-%m-%d&#039; ) AS dateissued,&lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( d.dateexpire ), &#039;%Y-%m-%d&#039; ) AS dateexpires,&lt;br /&gt;
CONCAT (&#039;&amp;lt;a target=&amp;quot;_new&amp;quot; href=&amp;quot;%%WWWROOT%%/badges/badge.php?hash=&#039;,d.uniquehash,&#039;&amp;quot;&amp;gt;link&amp;lt;/a&amp;gt;&#039;) AS Details&lt;br /&gt;
FROM prefix_badge_issued AS d &lt;br /&gt;
JOIN prefix_badge AS b ON d.badgeid = b.id&lt;br /&gt;
JOIN prefix_user AS u ON d.userid = u.id&lt;br /&gt;
JOIN prefix_badge_criteria AS t on b.id = t.badgeid &lt;br /&gt;
WHERE t.criteriatype &amp;lt;&amp;gt; 0&lt;br /&gt;
ORDER BY u.username&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note: the FROM_UNIXTIME command is for MySQL.&lt;br /&gt;
&lt;br /&gt;
=== All badges available in the system, with Earned count ===&lt;br /&gt;
&lt;br /&gt;
Report of all badges in the system, with badge name and description, context, course shortname if a course badge, whether it is active and available, and a count of how many users have been issued that badge.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT b.id, b.name, b.description,&lt;br /&gt;
CASE&lt;br /&gt;
WHEN b.type = 1 THEN &amp;quot;System&amp;quot;&lt;br /&gt;
WHEN b.type = 2 THEN &amp;quot;Course&amp;quot;&lt;br /&gt;
END AS Context, &lt;br /&gt;
CASE&lt;br /&gt;
WHEN b.courseid IS NOT NULL THEN &lt;br /&gt;
(SELECT c.shortname &lt;br /&gt;
    FROM prefix_course AS c &lt;br /&gt;
    WHERE c.id = b.courseid)&lt;br /&gt;
WHEN b.courseid IS NULL THEN &amp;quot;*&amp;quot;&lt;br /&gt;
END AS Course, &lt;br /&gt;
CASE&lt;br /&gt;
WHEN b.status = 0 OR b.status = 2 THEN &amp;quot;No&amp;quot;&lt;br /&gt;
WHEN b.status = 1 OR b.status = 3 THEN &amp;quot;Yes&amp;quot;&lt;br /&gt;
WHEN b.status = 4 THEN &amp;quot;x&amp;quot;&lt;br /&gt;
END AS Available,&lt;br /&gt;
CASE&lt;br /&gt;
WHEN b.status = 0 OR b.status = 1 THEN &amp;quot;0&amp;quot;&lt;br /&gt;
WHEN b.status = 2 OR b.status = 3 OR b.status = 4 THEN &lt;br /&gt;
 (SELECT COUNT(*) &lt;br /&gt;
   FROM prefix_badge_issued AS d&lt;br /&gt;
   WHERE d.badgeid = b.id&lt;br /&gt;
 )&lt;br /&gt;
END AS Earned&lt;br /&gt;
FROM prefix_badge AS b&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Badges Leaderboard ===&lt;br /&gt;
&lt;br /&gt;
A simple list of usernames and how many badges they have earned overall.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.username, (SELECT COUNT(*) FROM prefix_badge_issued AS d WHERE d.userid = u.id) AS earned&lt;br /&gt;
FROM prefix_user AS u&lt;br /&gt;
ORDER BY earned DESC, u.username ASC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Administrator Reports==&lt;br /&gt;
&lt;br /&gt;
===Config changes in Export friendly form===&lt;br /&gt;
&lt;br /&gt;
The Administrative report Config changes is very useful but it would be nice to have it in a format that could be easily exported in one listing. Here is code to do that.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
DATE_FORMAT( FROM_UNIXTIME( g.timemodified ) , &#039;%Y-%m-%d&#039; ) AS date, &lt;br /&gt;
u.username AS user, &lt;br /&gt;
g.name AS setting, &lt;br /&gt;
CASE &lt;br /&gt;
 WHEN g.plugin IS NULL THEN &amp;quot;core&amp;quot;&lt;br /&gt;
 ELSE g.plugin&lt;br /&gt;
END AS plugin, &lt;br /&gt;
g.value AS new_value, &lt;br /&gt;
g.oldvalue AS original_value&lt;br /&gt;
FROM prefix_config_log  AS g&lt;br /&gt;
JOIN prefix_user AS u ON g.userid = u.id&lt;br /&gt;
ORDER BY date DESC&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Cohorts by user===&lt;br /&gt;
&lt;br /&gt;
How to get a list of all users and which cohorts they belong to.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT u.firstname, u.lastname, h.idnumber, h.name&lt;br /&gt;
FROM prefix_cohort AS h&lt;br /&gt;
JOIN prefix_cohort_members AS hm ON h.id = hm.cohortid&lt;br /&gt;
JOIN prefix_user AS u ON hm.userid = u.id&lt;br /&gt;
ORDER BY u.firstname&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Courses created And Active courses by Year===&lt;br /&gt;
Active courses is counting course that have at least one Hit, And &amp;quot;Active_MoreThan100Hits&amp;quot; counts courses that have at least 100 Hits&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
&lt;br /&gt;
YEAR( FROM_UNIXTIME( `timecreated` ) ) AS YEAR, COUNT( * ) AS Counter&lt;br /&gt;
&lt;br /&gt;
, (SELECT COUNT( DISTINCT course ) &lt;br /&gt;
FROM prefix_log AS l&lt;br /&gt;
WHERE YEAR( FROM_UNIXTIME( l.`time` ) ) = YEAR( FROM_UNIXTIME( `timecreated` ) )&lt;br /&gt;
) AS &amp;quot;Active&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) FROM ( &lt;br /&gt;
SELECT COUNT( * ),time &lt;br /&gt;
FROM prefix_log AS l &lt;br /&gt;
GROUP BY course &lt;br /&gt;
HAVING COUNT(*) &amp;gt; 100) AS courses_log&lt;br /&gt;
WHERE YEAR( FROM_UNIXTIME( courses_log.`time` ) ) = YEAR( FROM_UNIXTIME( `timecreated` ) )&lt;br /&gt;
) AS &amp;quot;Active_MoreThan100Hits&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM `prefix_course` &lt;br /&gt;
GROUP BY YEAR( FROM_UNIXTIME( `timecreated` ) ) &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Users created And Active users by Year===&lt;br /&gt;
Active users is counting users that have at least one Hit, And &amp;quot;Active_MoreThan500Hits&amp;quot; counts users that have at least 500 Hits&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
SELECT &lt;br /&gt;
&lt;br /&gt;
YEAR( FROM_UNIXTIME( `firstaccess` ) ) AS YEAR, COUNT( * ) AS Counter&lt;br /&gt;
&lt;br /&gt;
, (SELECT COUNT( DISTINCT userid ) &lt;br /&gt;
FROM prefix_log AS l&lt;br /&gt;
WHERE YEAR( FROM_UNIXTIME( l.`time` ) ) = YEAR( FROM_UNIXTIME( `firstaccess` ) )&lt;br /&gt;
) AS &amp;quot;Active&amp;quot;&lt;br /&gt;
&lt;br /&gt;
,(SELECT COUNT(*) FROM ( &lt;br /&gt;
SELECT COUNT( * ),time &lt;br /&gt;
FROM prefix_log AS l &lt;br /&gt;
GROUP BY userid &lt;br /&gt;
HAVING COUNT(*) &amp;gt; 500) AS users_log&lt;br /&gt;
WHERE YEAR( FROM_UNIXTIME( users_log.`time` ) ) = YEAR( FROM_UNIXTIME( `firstaccess` ) )&lt;br /&gt;
) AS &amp;quot;Active_MoreThan500Hits&amp;quot;&lt;br /&gt;
&lt;br /&gt;
FROM `prefix_user` &lt;br /&gt;
GROUP BY YEAR( FROM_UNIXTIME( `timecreated` ) ) &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Useful sub queries ==&lt;br /&gt;
&lt;br /&gt;
=== All teachers in the course ===&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
,(SELECT GROUP_CONCAT( CONCAT( u.firstname,  &amp;quot; &amp;quot;, u.lastname ) ) &lt;br /&gt;
FROM prefix_course ic&lt;br /&gt;
JOIN prefix_context con ON con.instanceid = ic.id&lt;br /&gt;
JOIN prefix_role_assignments ra ON con.id = ra.contextid AND con.contextlevel = 50&lt;br /&gt;
JOIN prefix_role r ON ra.roleid = r.id&lt;br /&gt;
JOIN prefix_user u ON u.id = ra.userid&lt;br /&gt;
WHERE r.id = 3 AND ic.id = c.id&lt;br /&gt;
GROUP BY ic.id&lt;br /&gt;
) AS TeacherNames&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Contributed code]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=You_Might_Be_a_Moodler&amp;diff=116006</id>
		<title>You Might Be a Moodler</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=You_Might_Be_a_Moodler&amp;diff=116006"/>
		<updated>2014-11-17T13:41:37Z</updated>

		<summary type="html">&lt;p&gt;Fox: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In the spirit of Jeff Foxworthy&#039;s &#039;&#039;You Might be a Redneck&#039;&#039; - http://www.jefffoxworthy.com/comedy/jod/index.shtml &lt;br /&gt;
&lt;br /&gt;
*If you have ever turned on a football game and and the orange uniforms of one team caused you to leap up from the sofa and check out moodle.org, you might be a Moodler.&lt;br /&gt;
&lt;br /&gt;
*If you type &amp;quot;moodle.org&amp;quot; in your browser when you intend to type &amp;quot;google.com.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*If you look up recipes in moodle.org.&lt;br /&gt;
&lt;br /&gt;
*If you look up recipes in moodle.org... and [http://moodle.org/mod/forum/discuss.php?d=5395&amp;amp;parent=30227 find them]!&lt;br /&gt;
&lt;br /&gt;
*If you can spell &#039;&#039;&#039;Dougiamas&#039;&#039;&#039; without having to look it up.&lt;br /&gt;
&lt;br /&gt;
*If you can &#039;&#039;pronounce&#039;&#039; &#039;&#039;&#039;Dougiamas&#039;&#039;&#039; without having to look it up.&lt;br /&gt;
&lt;br /&gt;
*If you check the Moodle forums at 8:30 on a Saturday night.&lt;br /&gt;
&lt;br /&gt;
*If you find yourself heading to the bugtracker when the dishwasher is broken.&lt;br /&gt;
&lt;br /&gt;
*If you start seeing double square brackets around words you don&#039;t know the translation of.&lt;br /&gt;
&lt;br /&gt;
*Your spouse wants you to take up golf again because they hate being a &#039;moodle widow(er)&#039; more.&lt;br /&gt;
&lt;br /&gt;
*You describe the color of something as &amp;quot;Moodle&amp;quot; orange.&lt;br /&gt;
&lt;br /&gt;
*If you find yourself logging in to moodle.org during your summer holiday in Italy instead of enjoying the beautiful view or going to the beach. &lt;br /&gt;
&lt;br /&gt;
*You try to figure out how to grade e-mails from your friends&lt;br /&gt;
&lt;br /&gt;
*You find moodle.org is down for some reason and the first thing you want to do is post on moodle.org about it.&lt;br /&gt;
&lt;br /&gt;
*Every verb you use is &#039;to moodle&#039;.&lt;br /&gt;
&lt;br /&gt;
*You go into a Chinese restaurant and ask for a side order of Moodles with your Egg Foo Young.&lt;br /&gt;
&lt;br /&gt;
*You talk about Moodle so much that your non-Moodling, non-native English speaking husband asks if the noodles on the plate in front of him are moodles and when you ask him if that is what he meant to say he replies, &amp;quot;Yes, aren&#039;t they moodles?&amp;quot; (based on a true story)&lt;br /&gt;
&lt;br /&gt;
*You know that the course id for &#039;&#039;&#039;Moodle in English&#039;&#039;&#039; is 5.&lt;br /&gt;
&lt;br /&gt;
*And even if you drive a car, you always drive it in &#039;&#039;&#039;5&#039;&#039;&#039;th gear.&lt;br /&gt;
&lt;br /&gt;
*You throw away all but the orange M&amp;amp;amp;M&#039;s.&lt;br /&gt;
&lt;br /&gt;
*You eat all but the orange M&amp;amp;amp;M&#039;s (and keep it for good &#039;&#039;feng shui&#039;&#039; in your desktop).&lt;br /&gt;
&lt;br /&gt;
*You try to convince your wife and kids that there is a Disney Park in Perth.&lt;br /&gt;
&lt;br /&gt;
*The homepage of your computer is https://moodle.org.&lt;br /&gt;
&lt;br /&gt;
*The homepage of every computer you have ever laid hands on is https://moodle.org.&lt;br /&gt;
&lt;br /&gt;
*You only recently discovered that typing an address in your browser takes you to a page outside Moodle.org&lt;br /&gt;
 &lt;br /&gt;
*You sometimes refer to your third child as &#039;&#039;&#039;1.3&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*Your default response to a rerun on TV is to fire up the laptop and check out moodle.org.&lt;br /&gt;
&lt;br /&gt;
*If you put little labels on your TV&#039;s remote control that say... view.php?id=1, view.php?id=2, etc ...&lt;br /&gt;
&lt;br /&gt;
*You have five browser windows open right now, four of which are Moodle sites.&lt;br /&gt;
&lt;br /&gt;
*Reading the moodle.org forums is part of the morning routine:  coffee, newspaper, wake up the children. . .&lt;br /&gt;
&lt;br /&gt;
*You find yourself adding items to a list that only the Moodle clique will understand.&lt;br /&gt;
&lt;br /&gt;
*You tell people to &amp;quot;Keep Moodling&amp;quot; and that they have been &amp;quot;Moodlised&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*If instead of saying &#039;&#039;Have a good day&#039;&#039; you begin greeting folks by saying &#039;&#039;Happy Moodling!&#039;&#039; and even worse when you actually believe that the two statements mean the same thing. {Based on a true story}&lt;br /&gt;
&lt;br /&gt;
*If normal words start being morphed into &#039;&#039;Moodle-isms&#039;&#039;. For example, when someone asks &#039;&#039;How are you?&#039;&#039; you begin to reply with words like Moodle-rrific and Moodle-tastic. Subsequently, you get confused when someone gives you a quizzical look because they do not understand what have just said. {Based on a true story}&lt;br /&gt;
&lt;br /&gt;
*If your students start showing up to the Friday night football games wanting to know when the Moodle chant is going to begin and students begin painting  &#039;&#039;MOODLE&#039;&#039; on their chests! {Based on a true story}&lt;br /&gt;
&lt;br /&gt;
* You are looking forward to Christmas vacation so that you will have time to upgrade Moodle!&lt;br /&gt;
&lt;br /&gt;
* You read something interesting and your first thought is, &amp;quot;I have to post that at moodle.org.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* You forget that the comment you just ignored from a co-worker won&#039;t be retrievable later in a Recent Activities block.&lt;br /&gt;
&lt;br /&gt;
* When in the supermarket, you prefer to buy orange capsicums (peppers) rather than any other colour.&lt;br /&gt;
&lt;br /&gt;
* If you go to https://moodle.org instead of http://google.com and try some (global) searches there, only realizing after some attempts that you are looking within Moodleland only. {Based on a true story}&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Oohoo_-_Capture_repository&amp;diff=115179</id>
		<title>Oohoo - Capture repository</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Oohoo_-_Capture_repository&amp;diff=115179"/>
		<updated>2014-10-06T09:54:13Z</updated>

		<summary type="html">&lt;p&gt;Fox: Cleaned duplicate information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Repositories}}&lt;br /&gt;
This repository allows users to record video, sound and take a photo WITHOUT a streaming server. This works as any other Moodle 2.x repository. It must first be enabled. Once enabled, it will show up in the file picker. Simply click on the &amp;quot;Capture&amp;quot; repository and choose if you want to record a sound, a video or have a picture taken from your webcam.&lt;br /&gt;
 &lt;br /&gt;
Once you are done recording, you can edit your video by trimming the beginning and the end.&lt;br /&gt;
&lt;br /&gt;
Note: You must install FFMPEG on your Moodle server inorder for this plugin to work.&lt;br /&gt;
&lt;br /&gt;
==Versions available==&lt;br /&gt;
Available for Moodle 2.3, 2.4, 2.5 and 2.6&lt;br /&gt;
&lt;br /&gt;
==Download==&lt;br /&gt;
From the [https://moodle.org/plugins/view.php?plugin=repository_capture Moodle plugins database]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Theme_settings&amp;diff=113395</id>
		<title>Theme settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Theme_settings&amp;diff=113395"/>
		<updated>2014-07-02T13:04:42Z</updated>

		<summary type="html">&lt;p&gt;Fox: /* Adding other attributes to the HTML */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Themes}}&lt;br /&gt;
== Theme settings ==&lt;br /&gt;
An administrator can change theme settings in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme settings&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Themesettings.png]]&lt;br /&gt;
&lt;br /&gt;
===Theme list===&lt;br /&gt;
This lists the themes available for course and user themes. Leave this blank to allow any valid theme to be used. If you want to shorten the theme menu, you may specify a comma-separated list of names, though don&#039;t use spaces (e.g. standard,orangewhite).&lt;br /&gt;
&lt;br /&gt;
You can  preview the available themes in &#039;&#039;Administration &amp;gt; Site Administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Themes selector.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Theme designer mode===&lt;br /&gt;
Turn this on if you are designing and testing themes as it will stop the themes being cached and enable you to see theme changes quickly. (You can also do this with the Clear theme cache button on the theme selector page.)&lt;br /&gt;
&lt;br /&gt;
===Allow user themes===&lt;br /&gt;
If the option &#039;&#039;allowuserthemes&#039;&#039; is enabled, each user may select their preferred theme on the edit profile page. All Moodle pages will be displayed in the user&#039;s theme, apart from courses where a course theme has been set.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; the user&#039;s theme will not be available in mobile and tablet devices unless the option &#039;&#039;enabledevicedetection&#039;&#039; is unchecked.&lt;br /&gt;
&lt;br /&gt;
===Allow course themes===&lt;br /&gt;
If you enable this, then teachers will be able to set their own course themes. Course themes override all other theme choices (site, user, or session themes).&lt;br /&gt;
&lt;br /&gt;
*If the option &#039;&#039;allowcoursethemes&#039;&#039; is enabled, each editing teacher may select their course theme via the Force theme option on the [[course/edit|Course settings]] page. The course will always be displayed in the theme specified in the course setting, with user and the site themes being overwritten.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; the course theme will not be available in mobile and tablet devices unless the option &#039;&#039;enabledevicedetection&#039;&#039; is unchecked.&lt;br /&gt;
&lt;br /&gt;
===Allow category themes===&lt;br /&gt;
When enabled, themes can be set at the category level. This will affect all child categories and courses unless they have specifically set their own theme. WARNING: Enabling category themes may affect performance, as it will result in a few extra DB queries on each page, so only turn this on if you need it!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; the category theme will not be available in mobile and tablet devices unless the option &#039;&#039;enabledevicedetection&#039;&#039; is unchecked.&lt;br /&gt;
&lt;br /&gt;
===Allow theme changes in the URL===&lt;br /&gt;
*If this is checked then the theme may be changed by adding &amp;lt;code&amp;gt;?theme=theme_name&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;&amp;amp;theme=theme_name&amp;lt;/code&amp;gt; if there are other URL parameters) to the URL in the browser. Theme names should be in lower case with spaces replaced by underscores, for example the theme &amp;quot;Formal white&amp;quot; should be entered as &amp;lt;code&amp;gt;?theme=formal_white&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Allow users to hide blocks===&lt;br /&gt;
Allows users to display and hide blocks&lt;br /&gt;
&lt;br /&gt;
===Allow blocks to use the docks===&lt;br /&gt;
*If the theme allows it, then checking this will allow the user to move blocks to the side dock.&lt;br /&gt;
&lt;br /&gt;
===Custom menu items===&lt;br /&gt;
The custommenuitems setting allows you to create a drop down menu that can be displayed by themes that support it. Currently all themes that are provided with Moodle 2.0 support this custom menu.&lt;br /&gt;
&lt;br /&gt;
You are able to create the custom menu by entering custom menu items one per line into the setting. Each item is preceded by a number of hyphens (-), the number of hyphens determines the depth of the item. So items that are &#039;&#039;&#039;NOT&#039;&#039;&#039; preceded by a hyphen appear on the top level of the menu (always visible), items with a single hyphen appear on a drop down menu below the previous top level item, and  items with two hyphens appear on a drop down menu below the previous first level item and so on.&lt;br /&gt;
&lt;br /&gt;
The content of each item is constructed of up to three bits, each separated by a &#039;&#039;&#039;|&#039;&#039;&#039; (Shift + \) character. The bits are &#039;&#039;&#039;label&#039;&#039;&#039; | &#039;&#039;&#039;url&#039;&#039;&#039; | &#039;&#039;&#039;tooltip&#039;&#039;&#039;.&lt;br /&gt;
; label : This is the text that will be shown within the menu item. You must specify a label for every item on the menu.&lt;br /&gt;
; url : This is the URL that the user will be taken to it they click the menu item. This is optional, if not provided then the item will not link anywhere.&lt;br /&gt;
; tooltip : If you provide a URL you can also choose to provide a tooltip for the link that is created with the URL. This is optional and if not set the label is used as the tooltip for the menu item.&lt;br /&gt;
&lt;br /&gt;
The following is an example of how you would create a custom menu:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Moodle community|http://moodle.org&lt;br /&gt;
-Moodle free support|http://moodle.org/support&lt;br /&gt;
-Moodle development|http://moodle.org/development&lt;br /&gt;
--Moodle Tracker|http://tracker.moodle.org&lt;br /&gt;
--Moodle Docs|https://docs.moodle.org&lt;br /&gt;
-Moodle News|http://moodle.org/news&lt;br /&gt;
Moodle company&lt;br /&gt;
-Moodle commercial hosting|http://moodle.com/hosting&lt;br /&gt;
-Moodle commercial support|http://moodle.com/support&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: The custom menu does not escape characters within the label, if you want to use a special HTML character such as an ampersand you must escape it yourself within the label. e.g. use &amp;amp;amp; instead of &amp;amp;.&lt;br /&gt;
&lt;br /&gt;
For more information on this setting please see the &#039;&#039;Using Moodle&#039;&#039; forum discussion [http://moodle.org/mod/forum/discuss.php?d=149803 Moodle 2.0: Custom menu in core]&lt;br /&gt;
&lt;br /&gt;
==== Multilanguage support ====&lt;br /&gt;
&lt;br /&gt;
You can add a language code (or a comma separated list of codes) as the 4th item of the line. The line will be then printed if and only if the user has currently selected the listed language. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 English only|http://moodle.com|English only item|en&lt;br /&gt;
 German only|http://moodle.de|Deutsch|de,de_du,de_kids&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Adding other attributes to the HTML ====&lt;br /&gt;
Other attributes, such as &#039;&#039;&#039;target&#039;&#039;&#039; can be added:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 Moodle Homepage|http://moodle.org&amp;quot; target=&amp;quot;_blank&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
The first quote closes the href attribute, allowing other attributes to be added. Do not add the closing quotation mark on the final attribute, it is added automatically by Moodle.&lt;br /&gt;
&lt;br /&gt;
===Enable device detection===&lt;br /&gt;
Will detect mobile and tablets that identify themselves via the web browser at the time of login to Moodle.   These work with the theme selector.  When the theme selector has identified a default, mobile and tablet themes, this feature will use that theme.&lt;br /&gt;
&lt;br /&gt;
===Device detection regular expressions===&lt;br /&gt;
This will allow you to customize the theme selector options.   For example, you can add a custom theme for IE6 and another for Windows CE by entering the identifying expressions the browser sends and the &amp;quot;Return value&amp;quot; you want to display as the theme selectors &amp;quot;Device type&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==Special themes==&lt;br /&gt;
&lt;br /&gt;
=== Session themes ===&lt;br /&gt;
Moodle offers an additional way to set a theme - the &#039;&#039;&#039;session theme&#039;&#039;&#039;. This is set with the URL and lasts until you log out. When you next login, the site/course/user themes are active again. This option is great for theme testing and works perfectly when you want to enable different themes for different situations.&lt;br /&gt;
&lt;br /&gt;
For example you can offer a special link for PDA users and integrate the session theme &#039;&#039;orangewhitepda&#039;&#039; in that link. Nobody needs to change any settings, you just click on that link. The session theme is called by the URL parameter &amp;lt;code&amp;gt;&amp;amp;theme=orangewhitepda&amp;lt;/code&amp;gt;. The whole URL  without the session theme could look like &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://mymoodlesite.org/course/view.php?id=18&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and with the parameter for the PDA theme like &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;quot;http://mymoodlesite.org/course/view.php?id=18&amp;amp;theme=orangewhitepda&amp;quot;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In a standard Moodle installation, session themes are not active. To activate them the administrator must add the parameter &amp;lt;code&amp;gt;$CFG-&amp;gt;allowthemechangeonurl = true;&amp;lt;/code&amp;gt; to the Moodle &#039;&#039;config.php&#039;&#039; file in the Moodle base directory.&lt;br /&gt;
&lt;br /&gt;
=== Page theme ===&lt;br /&gt;
A page theme is for special page-only themes set by code, use &amp;lt;code&amp;gt;$PAGE-&amp;gt;force_theme()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Theme hierarchy ==&lt;br /&gt;
Here is the usual order that themes are considered by the Moodle interface.&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;border:1px dashed #ddd&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;text-align:left&amp;quot;&lt;br /&gt;
!Theme type&lt;br /&gt;
! style=&amp;quot;background:#eee&amp;quot;|Overwrites&lt;br /&gt;
!Display&lt;br /&gt;
! style=&amp;quot;background:#eee&amp;quot;|Setting type&lt;br /&gt;
|- style=&amp;quot;vertical-align:top&amp;quot;&lt;br /&gt;
|Site&lt;br /&gt;
|style=&amp;quot;background:#eee&amp;quot;| - &lt;br /&gt;
|all pages*&lt;br /&gt;
|style=&amp;quot;background:#eee&amp;quot;|saved in theme profile&lt;br /&gt;
|- style=&amp;quot;vertical-align:top&amp;quot;&lt;br /&gt;
|User&lt;br /&gt;
|style=&amp;quot;background:#eee&amp;quot;|Site theme&lt;br /&gt;
|all pages*&lt;br /&gt;
|style=&amp;quot;background:#eee&amp;quot;|saved in user profile&lt;br /&gt;
|- style=&amp;quot;vertical-align:top&amp;quot;&lt;br /&gt;
|Course&lt;br /&gt;
|style=&amp;quot;background:#eee&amp;quot;|Site, user and session themes&lt;br /&gt;
|one course&lt;br /&gt;
|style=&amp;quot;background:#eee&amp;quot;|saved in course profile&lt;br /&gt;
|- style=&amp;quot;vertical-align:top&amp;quot;&lt;br /&gt;
|Session&lt;br /&gt;
|style=&amp;quot;background:#eee&amp;quot;|Site and user themes&lt;br /&gt;
|all pages*&lt;br /&gt;
|style=&amp;quot;background:#eee&amp;quot;|temporary until logout&lt;br /&gt;
|}&lt;br /&gt;
(* except courses with the course theme set)&lt;br /&gt;
&lt;br /&gt;
=== Change default  hierarchy===&lt;br /&gt;
The priority of themes can be set via the /moodle/config.php file. The order defines which theme wins when there are several set at different levels. You can set a variable called $CFG-&amp;gt;themeorder (see config-dist.php for more details). By default it is set to: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;$CFG-&amp;gt;themeorder = array(&#039;course&#039;, &#039;category&#039;, &#039;session&#039;, &#039;user&#039;, &#039;site&#039;);&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Particular theme settings==&lt;br /&gt;
&lt;br /&gt;
Logo, tagline, link colour, column width, custom CSS and other settings for a particular theme may be set by an administrator in &#039;&#039;Administration &amp;gt; Site administration &amp;gt; Appearance &amp;gt; Themes &amp;gt; Theme name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Configuración de temas]]&lt;br /&gt;
[[fr:Réglages des thèmes]]&lt;br /&gt;
[[ja:テーマ設定]]&lt;br /&gt;
[[de:Design-Einstellungen]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Talk:Moodle.org_configuration&amp;diff=113213</id>
		<title>Talk:Moodle.org configuration</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Talk:Moodle.org_configuration&amp;diff=113213"/>
		<updated>2014-06-18T10:03:03Z</updated>

		<summary type="html">&lt;p&gt;Fox: Put in on Dev docs ?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Information on this page is outdated... Would it be possible to have an update, with more details (linux distribution, PHP version...)?--[[User:Séverin Terrier|Séverin Terrier]] ([[User talk:Séverin Terrier|talk]]) 23:15, 16 June 2014 (WST)&lt;br /&gt;
&lt;br /&gt;
I also think this page (and perhaps all moodle.org pages) should be on Dev docs better than on all versions documentation... --[[User:Séverin Terrier|Séverin Terrier]] ([[User talk:Séverin Terrier|talk]]) 18:03, 18 June 2014 (WST)&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Talk:Moodle.org_configuration&amp;diff=113175</id>
		<title>Talk:Moodle.org configuration</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Talk:Moodle.org_configuration&amp;diff=113175"/>
		<updated>2014-06-16T15:15:39Z</updated>

		<summary type="html">&lt;p&gt;Fox: Please update the page with actual information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Information on this page is outdated... Would it be possible to have an update, with more details (linux distribution, PHP version...)?--[[User:Séverin Terrier|Séverin Terrier]] ([[User talk:Séverin Terrier|talk]]) 23:15, 16 June 2014 (WST)&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Unexpected_installation_halts&amp;diff=107701</id>
		<title>Unexpected installation halts</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Unexpected_installation_halts&amp;diff=107701"/>
		<updated>2013-11-12T08:46:59Z</updated>

		<summary type="html">&lt;p&gt;Fox: /* Do not upgrade incrementally */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}&lt;br /&gt;
Sometimes the installation will hang when setting up tables, where only half the page displayed in the browser and/or other outputs are removed. Examples and causes are:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Truncated MySQL statements==&lt;br /&gt;
 &lt;br /&gt;
 (mysql): SET NAMES &#039;utf8&#039;&lt;br /&gt;
 --------------------------------------------------------------------------------&lt;br /&gt;
 (mysql): SHOW LOCAL VARIABLES LIKE &#039;character_set_database&#039;&lt;br /&gt;
 ...&lt;br /&gt;
 ...&lt;br /&gt;
 (no more statements are displayed)   &lt;br /&gt;
&lt;br /&gt;
==Missing Continue button==&lt;br /&gt;
The “Scroll to continue” link is displayed but no “Continue” button is there. &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;Note&#039;&#039;&#039;: There is an exception to this when upgrading an existing database and the installation may appear to hang at the roles generation phase. This process can take a very long time - so please be patient.&lt;br /&gt;
&lt;br /&gt;
Below are some solutions you can try to overcome this problem:&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Check for MySQL limits&#039;&#039;&#039;. This is often a MySQL error and not a php error. Check that there is no limit placed on your mysql database, e.g. a &amp;quot;questions&amp;quot; limit. See [http://dev.mysql.com/doc/refman/5.0/en/user-resources.html Limiting Account Resources in the MySQL manual].&lt;br /&gt;
&lt;br /&gt;
*&#039;&#039;&#039;Check your .htaccess files&#039;&#039;&#039;. If the install is on a webhost, adding the following line to the .htaccess file in the Moodle directory has been known to solve the problem.&lt;br /&gt;
 AddType x-mapp-php5 .php&lt;br /&gt;
&lt;br /&gt;
:Try also renaming the .htaccess file so that it is disabled.&lt;br /&gt;
&lt;br /&gt;
==Code customizations==&lt;br /&gt;
You may also want to look and see if you&#039;ve customized any of your code.  Look at the last successful table, and then look at the block, mod, or other code that is referenced by that table.  For example, if your install hangs and continues to say that the forum tables were successful as the last message, look at /mod/forum/ for any custom code.  If you have customized code, backup those files and replace with the correct files.  You can then restart the install by renaming config.php or reinstalling your database from the backup.  If your install is successful, you can make your code changes back into the stock Moodle code.&lt;br /&gt;
&lt;br /&gt;
==Check your memory limit==&lt;br /&gt;
It may also be that the &amp;quot;memory_limit&amp;quot; in your php.ini is set too low. Please check your php.ini file and allocate the recommended amount (see [https://docs.moodle.org/en/Installing_Moodle#Requirements Moodle requirements]). For Moodle version 1.8 and above at least 40MB is  recommended.&lt;br /&gt;
&lt;br /&gt;
==Do not upgrade incrementally==&lt;br /&gt;
To avoid this problem when upgrading, it is recommended to upgrade directly from any previous version to these versions: 1.x -&amp;gt; 1.9.19 -&amp;gt; 2.2.11 -&amp;gt; 2.6.x&lt;br /&gt;
&lt;br /&gt;
A work-around to this problem is to setup a working Moodle system on your local PC or server using the [http://download.moodle.org Moodle Packages]. Once you have a running Moodle, [https://docs.moodle.org/en/Upgrading_Moodle#Backup_important_data backup the database] and import to your webhost. Then backup the Moodle code itself (the &amp;quot;moodle&amp;quot; directory on your PC) and copy this to your webhost using (for example) FTP. Finally, edit the moodle/config.php file for the new settings that have to be changed for the webhost.&lt;br /&gt;
&lt;br /&gt;
Some Moodlers have found the suggestion in http://moodle.org/mod/forum/discuss.php?d=65786#p297433 helpful, for some unknown reason. It claims that it is because the fopen function in the line (now line 426 instead of 406) was not being given a string as the first argument, but that&#039;s not true. It was a string; after the edit it is a string whose first and last characters are single quote marks. The amazing thing is that it works at all after that edit. What&#039;s even more amazing is that it fixes the problem, at least for some users. Go figure.&lt;br /&gt;
&lt;br /&gt;
==Database configuration issues==&lt;br /&gt;
If the installation hangs after entering your database details, it is likely that there is a problem with the details that you have entered for accessing the database. For example, if your MySQL database is running on port 3309 rather than the default 3306, make sure that you set the database URL to &amp;quot;http://localhost:3309&amp;quot; rather than just &amp;quot;http://localhost&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[http://moodle.org/mod/forum/view.php?id=28 Installation Forum at Moodle.org]&lt;br /&gt;
&lt;br /&gt;
[[ja:予期しないインストールの停止]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=External_database_enrolment&amp;diff=106388</id>
		<title>External database enrolment</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=External_database_enrolment&amp;diff=106388"/>
		<updated>2013-08-21T09:36:04Z</updated>

		<summary type="html">&lt;p&gt;Fox: /* Synchronization Script */ Changed cli script path and name (was 1.9 style). To do in other 2.x docs...&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_db_defaultcourseroleid&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_db_remoterolefield&amp;quot; setting) that contains the short name 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;
== 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>Fox</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=File_handling&amp;diff=106214</id>
		<title>File handling</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=File_handling&amp;diff=106214"/>
		<updated>2013-07-31T07:33:27Z</updated>

		<summary type="html">&lt;p&gt;Fox: Typo (same problem in other 2.x versions)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Working with files and folders}}&lt;br /&gt;
{{Improve}}&lt;br /&gt;
&lt;br /&gt;
The way files are handled in Moodle 2.0 has changed from earlier versions. Students and teachers will use the [[File picker]] to upload and organize their files in areas called [[Repositories]]. Repositories can be located on the Moodle site or externally. Site administrators can [[Manage repositories|reveal, restrict, add, edit or create repositories]] for the site. &lt;br /&gt;
&lt;br /&gt;
* Previously, if a file was used in different courses, it was duplicated. In Moodle 2.0, files are stored only once, saving disk space.&lt;br /&gt;
* Full support for Unicode file names on all operating systems.&lt;br /&gt;
* Metadata about each file (author, date, license, etc) and what the file is used for are stored in the database.&lt;br /&gt;
* Files are no longer just &amp;quot;uploaded to the course&amp;quot;.  Files are connected to the particular bit of Moodle content that uses them. (For example, a file may belong to a file resource, a forum post or a wiki page). Access to these files is controlled by the same [[Context|contextual]] [[Roles and capabilities|rules]] as as that bit of Moodle, increasing security.&lt;br /&gt;
* File picker has a list (file tree) or icon view &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A video on file handling in Moodle 2.0:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;mediaplayer&amp;gt;http://www.youtube.com/watch?v=2bUwx675Pqo&amp;lt;/mediaplayer&amp;gt;&lt;br /&gt;
== How is Moodle 2.0 better? ==&lt;br /&gt;
*There is no course Files space - good because you don&#039;t have to keep it tidy any more.&lt;br /&gt;
*Access to a file is based on the resource or activity to which it&#039;s connected; from any context you can easily get to a file - good because you can now easily link to files between areas you have editing access to.&lt;br /&gt;
*You can access the File Picker from many more places - good because it helps to avoid tedious and overwhelming front pages.&lt;br /&gt;
*Deleting a link to a file will delete the file - good because your files area won&#039;t become unkempt and unwieldy any longer, and because it will help to keep Moodle&#039;s database small.&lt;br /&gt;
*At the same time you can&#039;t delete a file which is linked elsewhere - good because it is now impossible to break a link.&lt;br /&gt;
&lt;br /&gt;
== Typical Moodle 2.0 workflow ==&lt;br /&gt;
Edit text or activity. Use the file picker to easily select the file from any local or remote repository. The file is then copied to Moodle and stored securely with the text or activity. &lt;br /&gt;
&lt;br /&gt;
Or Edit text or url resource. Use the file picker to select a file from any local or remote repository and select &amp;quot;link&amp;quot;. The file URL is then embedded into the text and when viewed, the media comes directly from the open repository.&lt;br /&gt;
&lt;br /&gt;
The standard Moodle install has  4 default areas (repositories) displayed in file picker for the teacher to select:&lt;br /&gt;
*Server - &lt;br /&gt;
*Recent -&lt;br /&gt;
*Upload -&lt;br /&gt;
*[[Private files]]&lt;br /&gt;
&lt;br /&gt;
The site administrator can expand the above list to include 15 other predefined repository areas.  For example, the teacher may see a file picker link to a Google Docs or UTube repositories where they can find files. As in the previous versions, the teacher can create a folder structure to store the files at the time files are uploaded.&lt;br /&gt;
&lt;br /&gt;
==FAQ==&lt;br /&gt;
Caveat: these are just making a start on these.  Subject to quality, style and accuracy improvements.&lt;br /&gt;
&lt;br /&gt;
===What are ways to make files available to other teachers/designers?===&lt;br /&gt;
In Moodle 2, this is going to require a change of habits. Some of the philosophy is written up in a small essay on course files [[Course_files|here]]&lt;br /&gt;
&lt;br /&gt;
One approach is to use a [[Repositories| repository]].  One of the easiest to set up is a [[File_system_repository_configuration|File System Repository]]  &lt;br /&gt;
&lt;br /&gt;
This needs server access.  One such example:&lt;br /&gt;
&lt;br /&gt;
[[Image:Repository-filesystem-filepicker.png]]&lt;br /&gt;
&lt;br /&gt;
===What are ways to make ONE change in a file and have this reflected across a Moodle site?===&lt;br /&gt;
This also will require a change in thinking.  You cannot just go to the file in the file picker and change it&#039;s name or upload a new file.  This would cause problems if it was linked to elsewhere.&lt;br /&gt;
&lt;br /&gt;
One answer is again to use repositories.  &#039;&#039;&#039;Link&#039;&#039;&#039; to the files in the repository.  Change the files (according to the permissions on the repository) and this is reflected everywhere in the course instantly.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://www.youtube.com/watch?v=JtePGeffl3o&amp;amp;feature=player_embedded Video: How teachers can upload files in Moodle 2.0]&lt;br /&gt;
* [[Course files]]&lt;br /&gt;
* [[Development:File API]]&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=160067 File Manager In Moodle 2.0] forum discussion&lt;br /&gt;
&lt;br /&gt;
[[Category:Files]]&lt;br /&gt;
&lt;br /&gt;
[[de:Dateiverwaltung in Moodle 2.0]]&lt;br /&gt;
[[fr:Gestion des fichiers 2.0]]&lt;/div&gt;</summary>
		<author><name>Fox</name></author>
	</entry>
</feed>