Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Talk:Admin reports: Difference between revisions

From MoodleDocs
No edit summary
m (Text replacement - "<code php>" to "<syntaxhighlight lang="php">")
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
I am using Moodle 1.9. I have created a new reporting module in my local moodle server.  I did have problems getting the admin. functions to work, i tried following the examples here but was not able to move forward. To accomplish the same thing, I completed these steps:
==How your report gets included in the admin tree==
This section says that "by default, your report will be included in the admin tree under the 'Reports' section". How does Moodle determine the POSITION of your report in that 'Reports' section?


'''1 -''' Created a new folder under admin\report, called AU_ProfessionalDevelopment
And how can you force your report to appear in a specific position in that 'Reports' folder, e.g. the top?


'''2 -''' Copied index.php and settings.php from the admin\report\question folder (''you could use a different folder under admin\report'')
You can use this code to create a FOLDER in which you can put your report(s):
'''3 -''' edited the setting.php file, updating the code where it says '''question''' with folder name '''AU_ProfessionalDevelopment'''.


code looked like this when done
<syntaxhighlight lang="php">
$ADMIN->add('reports', new admin_category('my_reports', get_string('my_reports','report_my_reports')));
</syntaxhighlight>


$ADMIN->add('reports', new admin_externalpage('reportAU_ProfessionalDevelopment', get_string('AU_ProfessionalDevelopment', 'admin'), "$CFG->wwwroot/$CFG->admin/report/AU_ProfessionalDevelopment/index.php", 'moodle/site:config'));
but how do you force that folder to always appear at the top (or bottom) of the 'Reports' folder?


'''4 -''' edited the index.php, stripping out most of the code, leaving the following:
--[[User:Luis de Vasconcelos|Luis de Vasconcelos]] ([[User talk:Luis de Vasconcelos|talk]]) 22:47, 3 April 2014 (WST)
 
    require_once('../../../config.php');
    require_once($CFG->libdir.'/adminlib.php');
    admin_externalpage_setup('reportAU_ProfessionalDevelopment');
    admin_externalpage_print_header();
 
    $header = "<h2>Accelerateu PD Participant Activity Reporting</h2>";
    echo $header;
    admin_externalpage_print_footer();
 
'''5''' Reloaded the moodle page (i am logged in as the admin - and can see the Admin. Block).
 
I can see '''AU_ProfessionalDevelopment''' in the admin\report block.  When i click on the report - it loads my page with the admin header and footer.

Latest revision as of 20:35, 14 July 2021

How your report gets included in the admin tree

This section says that "by default, your report will be included in the admin tree under the 'Reports' section". How does Moodle determine the POSITION of your report in that 'Reports' section?

And how can you force your report to appear in a specific position in that 'Reports' folder, e.g. the top?

You can use this code to create a FOLDER in which you can put your report(s):

$ADMIN->add('reports', new admin_category('my_reports', get_string('my_reports','report_my_reports')));

but how do you force that folder to always appear at the top (or bottom) of the 'Reports' folder?

--Luis de Vasconcelos (talk) 22:47, 3 April 2014 (WST)