General developer forum

Blocks again - MY_PAGE_PRIVATE

 
Picture of Howard Miller
Blocks again - MY_PAGE_PRIVATE
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

I'm having one of my regular bushes with trying to understand how the blocks (and in particular Dashboard) works and can be manipulated in code. And mostly failing...

These two constants are defined (undocumented, of course) in my/lib.php. They are used extensively in the functions thereafter. Can anybody tell me what they are for? I'm unaware of any public/private aspect to the Dashboard page. 

Cheers!


define('MY_PAGE_PUBLIC', 0);
define('MY_PAGE_PRIVATE', 1);
 
Average of ratings: -
Picture of Howard Miller
Re: Blocks again - MY_PAGE_PRIVATE
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

While I'm dredging for information. Another one...

In block_instances table... what is the 'subpagepattern' field? Well, I gather it's a restriction on the block but what do the numbers mean? They are (for example) set to '4' for blocks on a customised dashboard page (on my test site). What does that number refer to?


\d mdl_block_instances
                                      Table "public.mdl_block_instances"
      Column       |         Type          |                            Modifiers
-------------------+-----------------------+------------------------------------------------------------------
 id                | bigint                | not null default nextval('mdl_block_instances_id_seq'::regclass)
 blockname         | character varying(40) | not null default ''::character varying
 parentcontextid   | bigint                | not null
 showinsubcontexts | smallint              | not null
 requiredbytheme   | smallint              | not null default 0
 pagetypepattern   | character varying(64) | not null default ''::character varying
 subpagepattern    | character varying(16) |
 defaultregion     | character varying(16) | not null default ''::character varying
 defaultweight     | bigint                | not null
 configdata        | text                  |
 
Average of ratings: -
Picture of Neill Magill
Re: Blocks again - MY_PAGE_PRIVATE
 

I think the subtype is defined entirely by the page that sets it.

For the dashboard it appears to be the id of a record in the my_pages table

The subpage is set https://github.com/moodle/moodle/blob/master/my/index.php#L88, tracing it back the function that gets the record is https://github.com/moodle/moodle/blob/master/my/lib.php#L39

 
Average of ratings: Useful (1)
Picture of Howard Miller
Re: Blocks again - MY_PAGE_PRIVATE
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

Ahh.... that makes sense. I was overthinking it a bit...

Thanks smile

 
Average of ratings: -
Picture of Neill Magill
Re: Blocks again - MY_PAGE_PRIVATE
 

Just had a look at the usages and to me it looks as though MY_PAGE_PUBLIC translates to profile page, while MY_PAGE_PRIVATE translates to dashboard page.

 
Average of ratings: Useful (1)