New siteNavigation block released

New siteNavigation block released

by Rosario Carcò -
Number of replies: 95

As you can see in this thread:

http://moodle.org/mod/forum/discuss.php?d=67494

I updated the block known as myCourses which was originally integrated in a special Moodle Version called FN (First Nation School).

Based on that code I developed a new block which is configurable to navigate the whole site by categories, by categories and courses, for logged in or not logged in users. See further details in the mentioned thread.

Let me know, if you find bugs, or would like to make suggestions/enhancements.

Rosario

Average of ratings: -
In reply to Rosario Carcò

Re: New siteNavigation block released

by Geoffrey Rowland -
Picture of Plugin developers
Hi Rosario

Thanks for this.

I had to rename the unpacked folder 'siteNavigation' rather than 'siteNavigation02' in order for Moodle (1.9.2) to recognise the newly installed block.

Also, got the following error on installation:

Fatal error: Cannot unset string offsets in /var/www/html/admin/upgradesettings.php on line 26

However, despite this, the block seems to be working fine. The block loads quickly and it is good to have a collapsible category and sub-category 'tree'.

Would it be possible that when a user selects a category or subcategory a query is *then* run to find and display the particular 'branch' of the course 'tree' ?

That might avoid the delay (e.g. in the original myCourses block) in loading *all* courses for *all* categories/subcategories but still allow course details to be displayed in the navigation tree.

Thanks again
In reply to Geoffrey Rowland

Re: New siteNavigation block released

by Rosario Carcò -

>>
I had to rename the unpacked folder 'siteNavigation' rather than 'siteNavigation02' in order for Moodle (1.9.2) to recognise the newly installed block.
>>

That's correct. I decided to give the Zip-File a name that distinguishes the different versions. So unzip whereever you want, rename the directory to siteNavigation or simply copy everything into your moodle/htdocs/blocks/siteNavigation directory if it exists already. Adjust any file owner and permissions according to your system and then navigate to notifications in your site-Admin-Block to load the new block or version.

>>
Fatal error: Cannot unset string offsets in /var/www/html/admin/upgradesettings.php on line 26
>>

I simply copied the upgrade functions from an existing moodle block, but they are not used in siteNavigation because there are no sql-tables to set up or upgrade. I will have a look at this as soon as possible.

>>
Would it be possible that when a user selects a category or subcategory a query is *then* run to find and display the particular 'branch' of the course 'tree' ?
>>

From a technical point of view this would mean that we have to post back a request to the server and then wait for the answer (the result of the particular query). On one hand this would mean that the whole page would have to be rendered again (I do not know if it would be possible to send a request to the server and get only HTML-code for a block or a particular part of the whole page; I guess rather not). On the other Hand, from an algorithmycal point of view, this would be the best thing to do: to ask for detailed data on demand.

But, as the things are actually, we load everything into data structures at once and let then Javascript and DHTML do all the processing of the Mouse-Clicks and displaying of the requested data. This is very fast and a better solution than having to reload the whole page at every mouse click by sending according requests to the server. This would generate a lot of network traffic and that's why javascript and DHTML were meant to reduce that.

As I mentioned in the myCourses thread (http://moodle.org/mod/forum/discuss.php?d=67494), the problem is not even the query, it is the way all this javascript and DHTML Code is built up and then rendered, that causes the page to be displayed slowly if there are lots of courses.

So I am looking for better Code like in moodle's site-Admin-Block where opening and closing folders are also used. But if I would use that code, we would probably gain in speed but we would loose some other nice features already built in the HTML_TreeMenu library: this code saves the status of every folder (open or closed) in cookies, what means that the user will find his siteNavigation blocks as he left them even after several days. This is not the case with the site-Admin-Block which starts over with closed folders on every login.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Kim Sihota -
Hi Rosario,

Thanks for the block. I have installed it in my Moodle (1.9.2) with no difficulties.

I have a couple of questions. Probably due to something I have done wrong. I'm hoping you can point me in the right direction.
1. Because I currently only have a few courses listed, there appears to be a large blank area at the bottom of the block. I understand that a scroll bar will display when the block has too much data to display, but is there some way to set the original block size to a height of my own choosing or have it shrink to available space and then expand to a maximum height that could be set in your settings page?

2. I have two settings that I can set for SiteNavigation, one to show categories only and another that says login required.
The first appears to work as I would expect, except that when a category is selected, that classes display in the centre panel. Can the links to the classes/categories be removed from the block so this will not happen? Is there some setting that I have set incorrectly that is allowing this to happen?

The second (login required) seems to block classes from showing, for users not logged in. I thought it would hide the block when no one is logged in. I assume its purpose is to stop the view of classes only if the user is not logged in. This would be fine except that the user can still select that link and view the classes in the centre panel. Again, do I have something set wrong?

I am wanting to use the block to display categories and subcategories to everybody but only allow classes to be displayed to registered users. I would prefer that registered users are able to expand the tree but only select a class, allowing them to enrol or navigate to the selected class.

Thanks for any assistance and for all your work creating this block.

Kim

In reply to Kim Sihota

Re: New siteNavigation block released

by Rosario Carcò -

Kim,

>>1. Because I currently only have a few courses listed, there appears to be a large blank area at the bottom of the block.

I did not think of a custom setting for everything. So if you would actually want to reduce size, you would have to edit the source where I put a comment like "Enhancement of Mario Schellenberg" (see the myCourses thread I mentioned to find the correct lines).

If you would want me to do it for you, I would ask you for a few days because I am very busy with other works at the moment.

>>2. except that when a category is selected, that classes display in the centre panel. Can the links to the classes/categories be removed from the block so this will not happen?

I do not understand this: this block is a SITENAVIGATION so categories and courses, which you can select to appear, are showed with active links to redirect your browser to the according category or course link.

Maybe I should understand you in another way: do you mean that when you select to show courses only the courses should have active links and not the categories as well?

If this is your concern, then obviously this could be programmed too. And the next person would like to have active links in any case. Short this would mean that I had to implement also the options to have active category links or not.

At the moment the setting concerns only WHAT is displayed: categories AND courses or ONLY categories. The links are there in either case.

>>The second (login required) seems to block classes from showing, for users not logged in. I thought it would hide the block when no one is logged in. I assume its purpose is to stop the view of classes only if the user is not logged in.

NO. The purpose of the "login required" parameter is to show the WHOLE navigation or not. This is for the purpose of putting the block directly on the Front Page, where people can be logged in or not. If you want the navigation to be used by not logged in people, deselect the option. If you want them to see the navigation only if they have logged in, then select the option. As I explained in the mentioned thread:

http://moodle.org/mod/forum/discuss.php?d=67494

the idea is to show or not to show the navigation. When users navigate to a category, of course, they are not required to log in (same behaviour if you put the Category-List on your Front Page for not logged in users). But they are required to log in if they click a link to any course/class.

>>I thought it would hide the block when no one is logged in.

You are rigth, if the display area is empty (only home link active), the whole block should NOT be displayed at all. Even the more because there is still the link to "all courses", which is active and which does not test whether the user is logged in. So give me a couple of days to find an according solution.

>>I am wanting to use the block to display categories and subcategories to everybody but only allow classes to be displayed to registered users

Hmm... this is definitely not the purpose of my code. I would guess that the built in block "course_list" could help a little here, because it displays the courses the users have registred already but not all the other ones. I see your point of view and your needs, though.

Who could change my code to fit your needs? My time for moodle-programming is unfortunately very limited due to all the other duties I have to accomplish. Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Kim Sihota -
Hi Rosario,

The spacing issue is not a big deal. Don't waste your time on it.

The navigation to the categories bothers me somewhat because your tree display does such a nice compact presentation of the categories and classes. It really makes it easy for users to navigate through what can be a complex structure.
However, when the user clicks on the category they get a detailed view of the same information. To me, it appears to make a simple, clean display more complicated than necessary. Obviously this is a moodle issue, not yours.

Regarding the block visibility, maybe something is not working properly on my site but this is what is happening:
SiteNavigation settings
SiteNavigation by categories : No
Login Required: Yes

The SiteNavigation Panel is visible by all users, logged in or not (unexpected behaviour?)

When not logged in only categories are visible but by clicking on the category link any user is able to navigate to the classes. (unexpected behaviour)
Obviously they can't go farther until logged in.

When logged in, the SiteNavigation Panel also displays classes (expected behaviour)

For users who are not logged in, I kind of like the behaviour of seeing the block and being able to see the categories as long as there was no links allowing them to navigate farther.

I'll reread your other posts in case I missed something important that is throwing me off track.

Thanks again for all your work.

Kim
In reply to Rosario Carcò

Re: New siteNavigation block released

by Geoffrey Rowland -
Picture of Plugin developers

Hi Rosario

Suspect the Fatal error I reported may have been due to something else I had been doing on Moodle, so may have been a false alarm.

Thanks for your detailed explanation of the performance issues. That said, when just displaying categories on the front page, the Site Navigation block is performing well.

Thanks again!

In reply to Geoffrey Rowland

Re: New siteNavigation block released

by Rosario Carcò -

Geoffrey, may I ask you to verify the unexpected behaviours observed by Kim in his previous posts? I am actually very busy with our academic year starting. The points to verify are clear:

  • if loginRequired is set, then the block should only display the home link and "all courses" in the footer, nothing more. As I told before, I will have to remove the "all courses" link because this is a moodle  default link which does not verify whether users are logged in or not
  • if loginRequired is not set, then categories or categories AND courses are shown to everybody

Thanks a lot, Rosario

In reply to Geoffrey Rowland

Re: New siteNavigation block released

by Rosario Carcò -
Geoffrey, forget about it, I found the little bug. I will post a new version in a few hours. Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

With YUI-Library treeview and what is called XHR request (XMLHttpRequest), now it is possible to asynchronously and dynamically load/reload only desired parts of a web-page. See my post below.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Jeroen Kleijn -
How to install this block??
In reply to Jeroen Kleijn

Re: New siteNavigation block released

by Rosario Carcò -

Jeroen,

you will find plenty of moodle docs explaining how to install a block. It is always the same procedure. I explained it in the previously mentioned thread. And in a short form also in one of my previous posts here. Have a careful look there.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Here is the new Version 1.9.03 2008090301

Be sure to unzip in a working directory first and to copy the extracted files and directories to the moodle/htdocs/blocks/siteNavigation directory afterwards. Then point to notifications in the Site-Admin-Block to get the new version loaded. (actually only one file changed in the root: block_siteNavigation.php)

I corrected two behaviours/bugs pointed out by Kim (thanks a lot):

  • loginRequired should now work independently of the siteNavByCategories setting
  • if loginRequired is set, the whole block gets not displayed at all

Please test again and report back if necessary. I will think about integrating an option to select whether category links should be active or not.

But one question: if we choose them to be not active, they will not be active even when displaying all courses/classes.

Otherwise I should implement two more options, one to make them active/or not when displaying categories only and one to make them active/or not when displaying courses/classes.

What do you think? Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Geoffrey Rowland -
Picture of Plugin developers
Thanks Rosario. The admin options in '0.3' seem to be working as expected and overall the siteNavigation block is working really well for us cool. A number of users have already given very positive feedback. We have set the block to have a flexible height (no scrollbar) and fixed width (with scrollbar) as detailed elsewhere. My feeling is that if the height of the block gets too great (too many categories), the navigation should probably be restructured to have less categories and more sub-categories.

Now just waiting for you to 'fine-tune' the myCourses block so that admins don't see all courses, as suggested by Bob Puffer in this earlier thread wink.

Thanks again!

In reply to Rosario Carcò

Re: New siteNavigation block released

by Kim Sihota -
Hi Rosario,

The new block appears to be working as expected except I see the text:
testFooter
showing right below the Show all courses link.

As far as the links in the tree being active, from my perspective, as long as I can expand the tree to view the categories (and/or courses depending on the settings) and select a course (the course link needs to be active) to go to, that is all that is necessary. I don't need to go to a different view of the same information. I want a clear and easy navigation model, which is given in the navigation tree.

I don't see the need for Display all courses if I can see all courses by expanding the tree. To me it is redundant unless it does something more, that I am missing. I know that it does display all the categories and courses in a single view but couldn't this also be accomplished by an option to expand the tree fully?

I suppose that if you provide a setting that allows you to turn links on or off you are allowing the administrator to choose the model that best suits their needs.
In my case simplicity is more important than providing a variety of different ways to achieve the same end.

Of course, the more flexibilty you provide the more likely you will accommodate more users with specialty needs. But at the same time you increase the complexity for those trying to understand the functionality.

I would say that if the work required was minimal then the more options for configuration the better.

I am now using Site Navigation and My Classes together, so I would rather not have the show all courses link visible in either block. the two blocks together provides me with a clean consistent navigation tool.

I hope this is clearer than it sounds to me. Its been a long day dealing with the kids and I feel like I'm babbling.

I hope your startup is going great.

Kim
In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Here is Version 1.9.04 2008090401

It took me several hours to implement the new option to show/hide the "show all courses" link. But it is worth the work, I think.

And I will back-implement this feature also in the myCourses block. But give me some time...

With the new option all language files have changed and I removed the hard coded "show all courses" link from the file Tree.php and integrated it in the main block_siteNavigation.php source as footer, so unzip in a working directory, copy all directories and files to your moodle/htdocs/blocks/siteNavigation directory, adjust any file owner and permissions according to your system and then navigate to notifications in your site-Admin-Block to load the new block or version.

>>testFooter

removed, I had already begun to test the footer option

>>As far as the links in the tree being active

I leave those options for the next release, as every option takes a lot of time to implement.

Rosario


In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Hahaa... I just noticed a funny behaviour:

  • if loginRequired is set, the content of the block may be empty and the whole block gets NOT displayed, which is what we want
  • if loginRequired is set AND showAllCoursesLink is set too, then the content of the block is not quite empty, because there is this link. So the block WILL BE visible, EVEN if we expected the block to not be visible to not logged in people

This could be seen as a matter of precedence, loginRequired having precedence over all the other settings. But for the moment I do not want to hard code too much of this logic because there will be users one day who will ask me to display the all courses link to not logged in people. So for the moment the best is to take these options as single toggling options and it is up to you to choose the combination that fits your needs.

I forgot to say to Kim that there IS ONE reason to show moodle's built in category and course list: in this list you can see how many courses are in the category, which can be an useful extra information to the user.

I leave this feature for a next release to show the number of courses at the end of the category link and/or in the tool tip popping up when you leave your mouse pointer hovering over the link.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Kim Sihota -
This looks great, Rosario. I don't know how you find the time to make the changes so quickly.

How difficult is it to add a setting that would allow the administrator to remove the height setting from the div style tag at line 644 of the tree.php file? Or better yet remove it or enter a height of your choice? Is this a possibility. It would allow the admin to configure the block without having to manually edit the file. For short lists its nice to have the block expand, but I can see where at one point it would be better to limit the size and implement scrolling.

Thanks again for all the effort you put into this. It is really appreciated.
In reply to Kim Sihota

Re: New siteNavigation block released

by Rosario Carcò -

Kim,

>>How difficult is it to add a setting that would allow the administrator to remove the height setting from the div style tag at line 644 of the tree.php file?

This option would not be difficult to implement, but options with all their language translations demand a certain amount of time. So to advance in a quick way I should perhaps only push the native english version and leave the translations for a later time, when things get more consolidated and do not change to quickly.

But there is another issue, I announced earlier: the HTML-Tree Library is a very nice and sofisticated piece of code, but unfortunately NOT speedy enough to render long trees of categories and courses.

So I would rather spend some time looking for quicker and less complex code like the one used in the site-Administration block. But that solution IS very quick, I suppose, but not able to "remember" the open/close state of each folder at every new login. Thus it is really hard to decide what we want: speed or comfort in this siteNavigation.

What do YOU (all) prefer? Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Kim Sihota -
Hi Rosario,

I see your point. My implementation has few categories and courses and thus speed is not an issue for me. However, I can see where this would become a major problem for many users. I would have to say that your initial inclination would be the way yo go. The most efficient base code should be the starting point and then build the features on top of that.

Keep in mind that I am only throwing out 'wish lists' of features that I think would make the interface simpler and more efficient for my users. Things like the block size are easily done by editing a line of code so are not really important compared to major structural changes that will improve speed. Also keep in mind that I suggest ideas out of ignorance. I have no clue how difficult some of these ideas are to implement, so I ask just to help me get a better understanding. Don't hesitate to point out where I am off track. I program in Delphi so I have some understanding of the issues but I really don't have much understanding of PHP or the integration that goes into what you are doing considering that I write my stuff solo.

Back to the topic (Friday night and a few glasses of wine later) I like that the tree remembers its state but I am not sure that it is really needed between logins. Again there may be a big difference between a site with a lot of categories and courses compared to one with only a few. Currently I have SiteNavigation to show all categories and courses, and MyCourses for the users personal classes. This combination works well for my puposes. I suppose these could be combined if there was a button that allowed the user to select their personal courses in SiteNavigation that expanded the appropriate categories and showed the personal classes, thus allowing me to eliminate the MyCourses block. The courses could be marked similar to the way they are for the administrator in SiteNavigation. In a sense this would eliminate the need to remember the state because with a single click you could open the categories and classes that were important to the user. This assumes that this is the only reason someone would want to recall a previous state. there may be other reasons that I don't know.

It would be nice to hear other people's perspectives regarding this.

Thanks for all your work. Don't forget to take a break and relax for awhile.

Kim
In reply to Kim Sihota

Re: New siteNavigation block released

by Rosario Carcò -

Kim, if you are using the myCourses block previously mentioned:

http://moodle.org/mod/forum/discuss.php?d=67494

then you will recall the reasons why I decided to develop the siteNavigation block apart from the existing myCourses block. As the code base is still the same, there are some equal code snippets like the icons for active and inactive courses in the Administrator's view of the navigation.

And you are right, the siteNavigation could really be (back-) extended to offer myCourses and siteNavigation options all-in-one.

I see only one major drawback: the all-in-one block should be configurable by options for every instance, i.e. on every page you put it. Fortunately this is possible in Moodle, but I have to study this first. For the moment, with only global config settings, the admin would decide whether categories or categories AND courses should be visible, and through another setting whether the siteNavigation should also behave like a myCourses block. Behaving like a myCourses block, on the other hand, is the opposite of a siteNavigation for not logged in people. And that's the main reason, why I decided to split up logic and go ahead with two indipendent blocks. This way we do not have the all-in-one facilities, but everybody is free to combine those two blocks at their convenience.

Hmmm, there IS a problem still: if we implement config settings for block instances, which options should be available only for the admin and which ones also for the teachers? I mean if the teacher can open the siteNavigation on his course page to everybody, even not logged in people, then he would open the navigation whereas the Admin may have decided to show it only to logged in people on the front page. So things get more complex and complicated I think if we combine again.

Rosario

In reply to Kim Sihota

Re: New siteNavigation block released

by Rosario Carcò -
>>
I suppose these could be combined if there was a button that allowed the user to select their personal courses in SiteNavigation that expanded the appropriate categories and showed the personal classes, thus allowing me to eliminate the MyCourses block.
>>

After my last release 06 of the myCourses block, this is an idea I am pondering. We could combine everything into a siteNavigation block "intelligent" enough to present all the buttons and options myCourses offers. Of course everything should be changed to user individual config options, which means a lot of work to do, as I do not know how to program this yet. And I wonder if we could configure the siteNavigation Block on the FrontPage for the guest user (not logged in) to allow the navigation to those people if we wish and as we can do now.

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Konrad Lorinczi -

Would be possible to show the number of courses at the end of the category link, as earlier promoted?

In reply to Konrad Lorinczi

Re: New siteNavigation block released

by Rosario Carcò -

I seem to have missed this post, sorry. I will revise my code and see what I can do. Nice feature of course.

Rosario

In reply to Konrad Lorinczi

回复: Re: New siteNavigation block released

by wmvlqwpprd wmvlqwpprd -

The navigation to the categories bothers me somewhat because your tree display does such a nice compact presentation of the categories and classes. It really makes it easy for users to navigate through what can be a complex structure. However, when the user clicks on the category they get a detailed view of the same information. To me, it appears to make a simple, clean display more complicated than necessary. Obviously this is a moodle issue, not yours. Regarding the block visibility, maybe  Naproxen sodium something is not working properly on my site but this is what is happening: SiteNavigation settings SiteNavigation by categories : No Login Required: Yes The SiteNavigation Panel is visible by all users, logged in or not (unexpected behaviour?)

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

This is version 1.9.05, 2008091101

nothing new for the moment except that I crossported a further config setting from the myCourses Block. You can now choose to show/hide the scrollbars. When you hide the scrollbars, the whole block will grow in vertical direction, but there is no mean to let the block get wider because there is a Moodle setting that limits the width to 210 pixel.

A wider navigation will only be possible when I port the code to be inserted in the central column as you can with "List of categories" or "List of courses" on the Front Page settings.

Note that with the new option all language files changed too, so be sure to unzip and copy everything again to your moodle/htdocs/blocks/siteNavigation directory.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Someone found a little hack here to show blocks also in the center pane/column (thanks Birgit):

http://moodle.org/mod/forum/discuss.php?d=55280

She implemented it, and the siteNavigation block works very neatly.

As I do not like to keep track of too many little code patches at every Moodle upgrade, I will create a version for the center column on the Front Page. I promise to deliver siteNavigationFP for the Front Page before Christmas.

I just discovered a little shift in the display of the siteNavigation tree when the block is displayed in a course. I think I have to check whether we are on the Front Page or not to correctly compute the indentation of every folder and branch in the tree. I hope to correct this in the next release. Strangely the myCourses block behaves correctly when displayed on Front Page AND courses, but obviously there IS the difference that we display the user's courses and not only the categories.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

>>I just discovered a little shift in the display of the siteNavigation tree when the block is displayed in a course.

Today I saw that the display remains correct in FireFox. It is only in Internet Explorer that there seems to be a problem. And I just realized that this problem exists only if the myCourses block precedes the siteNavigation block. So to avoid displaying problems in IE work around it by either setting the myCourses block BELOW the siteNavigation block or on the opposite side.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Julian Ridden -
I'm sorry that it has been so long between comments from me. Have been so busy that I lost track of this development.

As I have said before Rasario, Awesome work! I am taking down the old MyCourses block from the Modules and Plugins database as your block has more than easily replaced it. Cleaner code, better performance and more options.

Can you make sure you add yours to the database now. This will save users having to search through forums trying to find the most up to date code. Let me know if you need help doing so.

Thanks again for working on this and contributing it back to the community.

Julian
In reply to Julian Ridden

Re: New siteNavigation block released

by Rosario Carcò -

Dear Julian,

as you can see, there still remains some work to do until I will feel ready to release both blocks in the Modules and Plugins database.

And yes, I will need your help to upload everything there. But I guess this will not be before Christmas.

Thanks a lot for your ideas and assistance, and all the work you did to keep alive the FN myCourses block.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Fred Lunau -
Hi Rosario,

Thanks for the siteNavigation05 block - it's (almost) what I was looking for!

Two quick questions:
  1. With siteNavigation05, is there a setting that will also display course nodes (vs just category nodes), to avoid needing to list the courses in the selected category (and hence a page refresh)?
  2. Any news on a port to the center area? That would be very, very nice to have as well!
Again, thanks for a very useful block!

Fred
In reply to Fred Lunau

Re: New siteNavigation block released

by Rosario Carcò -
Dear Fred, Dear all,

I was very busy during November and December. Among other duties I attended a Suse Linux Certification Course with according Certification Exam. At my age this was really hard hard work and the exam was 4 hours of full concentration. Awful experience, but I succeeded in passing the exam.

That's why I could not continue the development of myCourses and siteNavigation as promised. Please be patient and give me some weeks more.

Fred, please read my previous posts in this thread an here in the myCourses Block:

http://moodle.org/mod/forum/discuss.php?d=67494

The problem for big sites with hundreds of categories and more than 500 courses is that the Library used is too slow when rendering the whole tree. I measured more than 7 seconds for about 500 courses.

That's why I decided to offer an option to toggle on and off the displaying of the course nodes. So be sure to uncheck the option "navigation by categories" in your Admin -> Modules -> Blocks -> siteNavigation and you should be able to display everything you got in your Moodle.

To display the siteNavigation in the center pane of the Front Page, see one of my previous posts where I wrote about a little hack to achieve this. An example is here, but you have to ask for a test account:

https://moodle.ph-ludwigsburg.de/

My own moodle is here, and requires no login for the navigation. The navigation is set to show only CATEGORIES because we have more than 1000 courses. In combination with the myCourses Block, the students are able to quickly navigate to every category or course they want to:

https://moodle.fhnw.ch


If I misunderstood something, feel free to send me an email/message.

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Alex Race -
Rosario, first of all, great plugin, thanks for all your hard work.

Question - is there a way to have this plugin display the friendly course name instead of the course code?

I'm looking for a simple way to list my courses (only have 10 of them) with the friendly name ...

Thanks!
In reply to Alex Race

Re: New siteNavigation block released

by Alex Race -
Nevermind...found if I modified the entry for $course->shortname to $course->fullname towards the bottom of the block it would get it done. Thanks.
In reply to Alex Race

Re: New siteNavigation block released

by Rosario Carcò -
Dear Alex,

I will offer a config setting in the next release to choose short name or full name. Choosing to display full names will popup the short name in the tooltip Help and vice versa.

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Clark Moodler -

Hi Rosario - How is the sitenavigation coming along? I'm eager to check it out.

I don't notice it in the modules and Plugins directory - where is it available?

thanks,

Clark

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -
I just finished version 1.9.06 (2009052601) with many options cross-ported from the myCourses block and as promised in this thread. (Now I will be free to adapt a version for a central display on the FrontPage, but I fear that we will lose the handy config options interface, unless using the siteNavigation block, but hiding it on the FrontPage when using it instead of the course list.)

As announced before, I am thinking about merging the two blocks into one. The hardest work will be to add user individual config options instead of the global ones we have at the moment.

I had to change the config options variable names to all lowercase to comply with Moodle coding guidelines, which has a little drawback I described here:

http://moodle.org/mod/forum/discuss.php?d=67494#p544748

To avoid further annoyances I did not rename the block and it's directory. But if we want to put it in the modules and plugins section, I will have to do so.

As usual, backup your current version first in case you need a fallback. Extract the Zip-Archive in a temporary directory and copy everything into your moodle/htdocs/blocks/siteNavigation directory. Adjust access-rights as needed and point to the Notifications Link in your admin-block.

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -
I am sorry, crossporting introduced a little bug. Here is version 1.9.06 (2009052901). To distinguish from previous zip I added the letter 'r'.

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Sr. Miguel -

Hello,

First of all, thank you for this block.

However, I would like to give feedback about a problem: I installed the block and I cant make the save changes persistent. Everytime I set the changes, they are always set by the default settings.

Am I the only one getting this behaviour?

Thank you

In reply to Sr. Miguel

Re: New siteNavigation block released

by Rosario Carcò -
Sorry, I was very busy with the new semester starting, migrating our production Moodle to a new server, etc. etc.

This is due to the option variable names that changed. Be sure to delete the old names in the according Moodle table with phpMyAdmin.

See the according post here I mentioned already:

http://moodle.org/mod/forum/discuss.php?d=67494#p544748

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -
There was another little bug after I changed the variable names to all lowercase.

So here is a beta version of the next release, 1.9.07b, 2009101901

Simply replace your /blocks/siteNavigation/block_siteNavigation.php with the version attached here and point your Browser to NOTIFICATIONS to load the new version.

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Andy Hawkins -
This is a really good block and we would like to use it or the myCourses variety but we are having problems.

We have 2 servers - both running Moodle 1.9.6+ (from 211009)

Test server is running UBuntu server - 8.04 I think
Live server is running Xampp on W2003

Both servers are identical in terms of Moodle as far as I can tell. I upgraded both to same state to ensure this. Both have FN my menu on but need this on live one until we can get mycourses working.

Have installed mycourses06r and sitenavigation06r (plus the patch form last night), but then deleted mycourses due to the problems below.

mycourses causes left block to hog while screen width on both servers
site navigation works on test server but shows empty block on live one (apart from show all courses and search box)
See picture which I hope will show below [OK - screenshot image exceeded file size allowed - but the error message dd not tell me what the filesize limit is - so I will try and post separately once I have found this out]

These conditions are same on IE and Firefox, same if logged in or not, same with standard theme, same regardless of which settings are ticked (ie even if all ticked).

I have read the forum over and over but cannot find something that may point us in the right direction - but may well have missed something - apologies if this is the case.

We are getting desparate for something that will do what mycourses will do as we promote our new live server.

Suggestions to investigate/fix would be very welcome
TIA


In reply to Andy Hawkins

Re: New siteNavigation block released

by Rosario Carcò -
I do not remember whether it was in the myCourses or the siteNavigation Thread, where I posted an observation that if using both blocks on the same page/course, the siteNavigation Block should appear BEFORE the myCourses block. Try to put only one or both on the same left or right side in this order. And be sure to set siteNavigation to show only CATEGORIES and no courses, as this may take a long time to render on big sites with more than 500 courses.

My tests went only to 1.9.4+ which I am unsing, but I do not expect it not to work on 1.9.5 or 1.9.6

To see it working, have a look at my production site: https://moodle.fhnw.ch

And to see siteNavigation displaying also courses, see my test-site: https://moodle.fhnw.ch/moodleTest

If you install, deinstall or simply delete from the directory, be sure to remove also all references from mdl_config Table with phpMyAdmin.

For the moment I have no clue what could cause your problems. But try setting your servers DEBUG Mode to DEVELOPER in your ADMIN->SERVER block. This could display what is going on when my code begins to run.

Did you name the Directories in your moodle-root/blocks Directory correctly myCourses and siteNavigation respectively, with correct Upper- and Lower- Case spelling??

The myCourses Block is a little special for ADMINS because the default setting is NOT TO DISPLAY ANYTHING at all. You have to change these default settings or click on the colored squares in the right corner of the block title to toggle on/off the courses you want to see as admin. The normal users, i.e. students and teachers get their course-list by default.

Hope it helps, Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Andy Hawkins -
Thanks for your supportive suggestions.

I think the block we really need is myCourses - so we have started again and posted what we have found back on that discussion.

thanks so far
Andy
In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -
Dear all,

I was using the siteNavigation and myCourses block not only on the FrontPage, but by default on any course page.

After migrating our production server to a Virtual Machine, we had serious problems with the CPU utilization of mysqld so that I had to migrate back everything to the previous physical server.

As on the physical server the same symptoms arised, most probably the reason was in some corrupted tables (mdl_log, mdl_backup_log). After I emptied/truncated them, I switched also off backup and statistics cron-jobs, which seem to have made the trick.

During the last days I did some load-tests and discussed the results with a moodle-partner firm.

We saw that loading the FrontPage and any other course page displays more than 1'000 queries if you enable the Admin->Debugging->Performance info switch and

define('MDL_PERFDB', true); //to show number of queries per page in the performance footer

in your moodle/config.php file. On our site we have roughly 2'000 courses nested in many categories.

So we discovered that the original myCourses code which served also for the siteNavigation block is using queries in loops and recursive calls, which maybe was the only solution when the block was programmed for the FN_Moodle, and may still be ok for small sites. But it is definitely not ok for medium and large scale sites.

So, at the moment being, I have to stop further development until I find simpler queries yielding all the data we need so that we can process only data in a loop without doing more queries to the database than necessary.

I apologize for any inconveniences so far: it seems to be a bad idea to trust older Moodle Code and it is hard to follow at the speed Moodle Development continues, at least for a hobbyist-programmer like me.

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -
This is another intermediate version on the way to 1.9.07

It addresses the following issues which were reported by Birgit May and Bob Puffer, when using special chars in site, category and course names, and by Michael Buchanan when using multilanguage strings in site, category and course names:

* 2009/11/13 Cr - investigated the code to avoid problems with
* course names containing special chars like the APOSTROPHE!
* UNFORTUNATELY addslashes, htmlspecialchars and htmlentities
* do not correctly translate some special characters. If you
* use one of those characters in your category or course names
* the title="some tool tip text" inside the <a href="url"
* title="some tool tip text">link to course or category</a> will
* break and not display anything in the block.
*
* So either you use one of those tricks:
* - you remove the special char which causes the trouble from
* your category or course name or you replace it with another
* substitute like the Back-Tick for Apostrophe like l`avion
* instead of l'avion
* - you encode the special char in your category or course
* name with &apos; or &uuml;
* - you insert a substr_replace() to replace the critical char
* only for the tool tip texts
* - you comment the lines in this code which provide the tool
* tip help to avoid displaying it. I might add another
* config option for this later on. The lines to comment are:
*
* title="'.format_string($course->shortname); or
* title="'.format_string($course->fullname); or
* title="'.format_string($SITE->shortname); or
* title="'.format_string($SITE->fullname); or
* title="'.format_string($catnode->name);
*
* 2009/11/11 Cr - added format_string() to correctly show multilanguage cat
* and course names

Simply copy the attached block_siteNavigation.php to your /block/siteNavigation Directory. You may want to copy your existing version to another place in case you have to revert back.

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -
Sorry, today I realized that htmlspecialchars() needs an optional parameter to correctly convert single and double quotes:

>>''' (single quote) becomes '&#039;' only when ENT_QUOTES is set

So I made some quick tests and it seems to work. It could help us circumvent the previous mentioned workarounds to correctly display course and category names having special characters in the tool tip help texts.

I am not sure, however, if using

>>htmlspecialchars(format_string($catnode->name), ENT_QUOTES)

could interfere with Moodle's displaying and rendering functions.

In the course_list block I saw another trick which could help us:

>>title=\"" . format_string($course->shortname) . "\" "

I will make some more tests and report here the results.



Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Jason Hollowell -
Picture of Particularly helpful Moodlers
Rosario,

I've read through this forum (quickly) and through the forum where the "original" myCourses block was posted by Julian Ridden (here) and I'm having a little trouble figuring out what happened to the MyCourses block.

I see that you were very active in helping to develop and maintain the MyCourses block. I'm not clear however, why the switch was made from the MyCourses block to the Site Navigation block? I've probably missed something somewhere in one of these forum threads.

I've installed the Site Navigation block and can't seem to get it to work as the old MyCourses block does. We have a version installed on our site (1.9.8+) that works exactly how we want it to. That is, it allows the admin to see all courses in "dial down" folders that represent the categories the courses are included in.

The MyCourses 2 block that is available in Modules and Plugins doesn't seem to work in 1.9.8+ and your Site Navigation block, while it does work, does not allow the admin to see all courses. I may have a setting set incorrectly but I think I've tried everything. If I untick the first setting (site naviation by categories) and I can then (and only then) see courses but they are not included in category folders. If I leave it selected then I cannot see anything (categories or courses).

I am attaching a copy of the MyCourses block that we currently use as reference to the functioning copy that I refer to. It may be one that you worked to develop smile

So, the main purpose of this post is to try and figure out what happened to MyCourses and what the motivation to create SiteNavigation in addition to the MyCourses block was.

My apologies if I've missed something that is right in front of my eyes.

Jason

**Edit** Oops, I forgot to attach the package. Here it is.
In reply to Jason Hollowell

Re: New siteNavigation block released

by Jason Hollowell -
Picture of Particularly helpful Moodlers
Rosario,

Updating my comments here as I find more in the forums. smile It looks like the main reason for forking off of the MyCourses block and making the SiteNavigation block was because of the desire to add the capability to only display categories without courses being loaded for efficiency. Is that correct?

I too noticed that when logged in as admin the front page takes a long time to load as the tree is being filled. Strangely however, I've only noticed this extreme slow down on older versions of IE. It doesn't seem to slow Firefox down much at all. Not sure of why this would be...?

At any rate, I think I have a better understanding of the reasoning behind the development of the SiteNavigation block. Now I just have to figure out how to get it to work so I can determine if it can take the place of our MyCourses block.

Jason

P.S. Sorry, I guess I didn't read the post a few jumps up at

http://moodle.org/mod/forum/discuss.php?d=103703#p599296

very thoroughly.

I haven't checked on the db calls when accessing the front page. Maybe I should check into this as the version I am using is quite old I think. Nevertheless, we really need to be able to quickly navigate through our hierarchy of courses and the MyCourses block has served us so well for that purpose. Maybe we should start exploring other options...?
In reply to Jason Hollowell

Re: New siteNavigation block released

by Rosario Carcò -
Dear Jason you are messing up things. Please catch up things in the myCourses Thread started by Julian Ridden. The myCourses Block still exists there and was reengineered to work on 1.9.x by myself. Only then I created siteNavigation to offer SITE-NAVIGATION (through courses AND/OR categories) to everybody, i.e. NOT LOGGED IN person.

You will find the myCourses Thread here:

http://moodle.org/mod/forum/discuss.php?d=67494

Please could you contact Anthony Borrow or someone else to remove your myCourses.zip from this thread? I have no Idea which wild version you are introducing here. My last version is in the mentioned thread.

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Rosario - If Jason agrees, I would be willing to edit his post with the attachment and suggest to folks that they not use the zip file he attached to that post. Generally speaking we try to avoid deleting content and instead clarify/correct which is more consistent with the nature of constructionist pedagogy. Have you, Julian, and Jason seen the new site navigation in Moodle 2.0? Do you think that might make the 'My courses' and or 'Site navigation' blocks obsolete? Peace - Anthony
In reply to Anthony Borrow

Re: New siteNavigation block released

by Rosario Carcò -
Dear Anthony I agree too.

I will install a Moodle 2.x Server only when I am finished with my port to a new server which did not succeed last september due to big big performance problems on our ESX VMware System.

Only then will I get an idea of the new navigation in 2.x

Rosario
In reply to Anthony Borrow

Re: New siteNavigation block released

by Jason Hollowell -
Picture of Particularly helpful Moodlers

Anthony and Rosario,

It is almost two years now since this post was made so it's probably silly of me to even be responding to it now but.... It seems that I never returned to this specific thread (although I'm certain I posted messages regarding the site navigation block elsewhere) and thus never saw these two posts about the file that I attached here in this forum. I have no problem with Anthony deleting the file. That particular version does however work just fine on 1.9 and never gave me any troubles in terms of server load. I know a lot of work has been done on both the myCourses and Site navigation blocks since this message was posted so, as I stated originally, it's probably silly to even be going back this far and responding to an old dormant post. shy At any rate, Anthony, if you see this and are so inclined, please feel free to delete the file I posted here.

Sincerely

Jason (Peace smile)

P.S. The site navigation in Moodle 2.X is a jump forward compared to 1.9 but it doesn't offer the same functionality (in my opinion) from the perspective of a site admin. The MyCourses block was nice because it allowed the admin to quickly dial down into categories and find a specific course (all from the front page of the site). It could be that I got so used to using it that I'm slow to accept other approaches but I don't feel like the site navigation process in 2.X is quite the same. For example, course categories don't appear under the "My courses" menu...or is there a way to make that happen?

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Unfortunately, as other users told, there are also categories and course names which use the Ampersand (&) and I guess also other characters which could break the tooltip-text. So for the moment being we avoid the breaking but the following chars will appear according to the transformation scheme of the function htmlspecialchars() in the tool-tip texts:

>>
The translations performed are:

  • '&' (ampersand) becomes '&amp;'
  • '"' (double quote) becomes '&quot;' when ENT_NOQUOTES is not set.
  • ''' (single quote) becomes '&#039;' only when ENT_QUOTES is set.
  • '<' (less than) becomes '&lt;'
  • '>' (greater than) becomes '&gt;'

>>

So using htmlspecialchars() may be not the last and definitive solution.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -
I just tested on Moodle Version 1.9.9+ and the block still works fine.

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Fernando Oliveira -
Picture of Plugin developers

Hello,

As mentioned in CONTRIB-1442, I created the MoodleFN version of the myCourses block a few years ago, which was discontinued a while back. Recently, our teachers have requested that we bring back this block. There’s been quite a bit of activity since then (especially from Rosario Carco… thanks!) and today it looks like there’s (at least) 3 additional versions of this block.  I haven’t done any heavy testing, but all 3 versions install without problems in Moodle 1.9.9.  The pic below shows screenshots of these 3 versions plus the first MoodleFN version for easy reference. Please let me know if there’s anything in this pic that’s inaccurate or incomplete.

At this point, rather than resurrecting the Moodle FN version this of block (and further complicating this picture), I’m hoping that we can team up and create a “best of” myCourses block that combines the best features/format of all 4 versions.  

Rosario has suggested in CONTRIB-1442 that he’d be willing to bring the siteNavigation block (C) back in line with the myCourses block by reintroducing the “user-switches”.  Given all the work that he has already put in, I think this would be a great place to start.

Thoughts?

Fernando

Attachment mc_block_all_versions2.png
In reply to Fernando Oliveira

Re: New siteNavigation block released

by Rosario Carcò -
Dear Fernando, the only picture that lacks here is the one of the latest myCourses Block you will find in its thread mentioned in my first post here.

So siteNavigation ist definitely NOT myCourses even if I took the same Code-Base of your FN myCourses Block.

But as I commented in the tracker I am pondering whether to merge both blocks into one. For the moment being I put BOTH Blocks per default on every Course Page and also onto the Front Page because we want not logged in people to be able to navigate through our entire site, which was NOT possible with myCourses.

But this eats up place for two blocks on every page. So let's resume:

  • siteNavigation can be configured to display categories only (necessary for large sites with more than 500 courses and many many nested categories)
  • siteNavigation can be configured to display categories AND courses (works fine on little sites with less than 500 courses and rather flat category-trees
  • myCourses displays the users own courses
  • myCourses displays ALL courses for Admins
  • Admins can switch between ALL courses and myCourses only
If we now merge the two blocks we need

  • a new name because the block is capable of displaying myCourses and siteNavigation
  • siteNavigation being the more global name which can easyly include also myCourses, we could name it siteNavigation or simply navigation to comply with the lowercase naming convention of Moodle
  • on the Front Page the navigation Block shows the siteNavigation for not logged in people, if the according config-option is set
  • on the Front Page the navigation Block shows NOTHING for not logged in people, if the according config-option is set
  • after login the navigation block shows myCourses of students, teachers and Admins per default
  • students, teachers and Admins can now use all the switches we already have in myCourses to display own courses, hidden or visible courses
  • one new switch will toggle between myCourses and siteNavigation
  • one new switch will toggel between flat list and hierarchical nested list with opening and closing folders
Let's think about this one week or so and then I will start merging the blocks. Someone should also look at the navigation in Moodle 2.x maybe we could simply take that code and engineer it back to work in Moodle 1.9.x

After the merge we should find the bottleneck on large sites which is either in the recursive queries and/or in the HTML-Tree library we use here.

At the moment being, siteNavigation doing what I intended it to do and myCourses being another fine block which can be combined with the siteNavigation to offer both: navigation through the whole site and fast access to own courses on the same pages, the question arises also whether Moodle 2.x will not make our efforts vane. Maybe it is time to freeze myCourses and siteNavigation at the next planned release 1.9.07 and concentrate on the navigation features of Moodle 2.x or vice-versa to port our two blocks into Moodle 2.x as single and indipendent blocks or merged into one.

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -
I just found a test course showing new features of Moodle 2.x Just log in as Manager:

http://qa.moodle.net/course/view.php?id=2

The navigation Block includes also navigation through all the course sections. To revert back to see all sections again, you have to toggle the SHOW ALL SECTIONS icon on the right.

I do not see however how you could toggle between myCourses and the whole siteNavigation, which is a major feature in my siteNavigation.

But of course the Block could be segmented into two sections like this:

- myCourses
- siteNavigation

which would save us one switch to toggle on/off between those displays. I have to think about this User-Interface a little bit: instead of the switches (blue [myCourses], red [active courses], grey [inactive courses]) in myCourses we could really segment this way:

- myCourses (for teachers and Students)
- myCourses (for Admins only)
- active Courses (for Admins only)
- inactive Courses (for Admins only)

- siteNavigation (for everybody)

I will make a prototype before merging the two blocks.

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -
EDIT because the display eat the indentation. It should be

- myCourses (for teachers and Students)
--> myCourses (for Admins only)
--> active Courses (for Admins only)
--> inactive Courses (for Admins only)

- siteNavigation (for everybody)

And we would have switches as needed to show the myCourses list as flat list (one course per line) or as hierarchical tree of categories/subcategories/course like the siteNavigation does, etc.

This vay we could even add navigation to course sections, forums, resources, databases, etc. etc. later on.

And technically speaking, we would avoid to load the whole course page by toggling switches, if we load every possible view at once:

- myCourses (for teachers and Students, flat list)
- myCourses (for teachers and Students, hierarchical tree with folders)
--> myCourses (for Admins only, flat list)
--> myCourses (for Admins only, hierarchical tree with folders)
--> active Courses (for Admins only, flat list)
--> active Courses (for Admins only, hierarchical tree with folders)
--> inactive Courses (for Admins only, flat list)
--> inactive Courses (for Admins, hierarchical tree with folders)

This charges/clutters the Block a little more for Admins but we would gain a lot of speed if we have to load things only once and can avoid sending a request to the server at every toggle of the view switches.


Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -
Unless we keep the flat and hierarchical views as admin config options as they were until now.

I forgot that rendering all the views in different ways demands as many more cicles through the nested and recursive sql-queries and rendering through the HTML-Tree library which, as I said, IS A BOTTLENECK on medium and large scale sites.

So we have to decide between

- admin config option
- user switch and config option
- find faster code to render all views

Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -
Hey, Lavanya just reported that the new navigation Block in Moodle 2.x displays only a flat list of courses.

This is for certain not acceptable compared to what we have in myCourses and siteNavigation.

A flat list is hardly acceptable for a very small site. But Moodle-Sites have really grown big, so a hierarchical tree-structure like myCourses and siteNavigation offer, is the real way to go.

I am actually busy with merging the two blocks into what we will call sitenavigation (all lowercase letters).

Could someone be so kind to verify the options, look & feel of the navigation block in Moodle 2.x and open a Tracker-Issue on Navigation in Moodle 2.x and link it to our CONTRIB-1442, so that we can coordinate future options, features and efforts to produce a really good block for site-navigation and to display also the user's own courses in an acceptable format?

Of course, as soon as the new navigation block for Moodle 1.9.x is ready I will have to look at how to program blocks in Moodle 2.x and then we could start over, porting our ideas to a new sitenavigation Block for Moodle 2.x I see another 6 Months of hard work to learn and achieve this smile

Rosario
Average of ratings: Useful (1)
In reply to Rosario Carcò

Re: New siteNavigation block released

by Luis de Vasconcelos -

Rosario,

I just discovered your siteNavigation block and it's great!

Does it have an entry in the Modules & Plugins database yet? And what is the latest version?

I read in the forums that you plan to merge the myCourses and siteNavigation blocks. What is the progress on this?

Thanks.

In reply to Luis de Vasconcelos

Re: New siteNavigation block released

by Rosario Carcò -

I just released version 1.9.07a of the myCourses Block with new and faster logic for the admin user willing to display all courses or only his own ones (see according thread).

This week I will revise version 1.9.07 of the siteNavigation block and upload it here.

Next step will be to decide whether it is worth uploading myCourses and siteNavigation into the Modules&Plugins-Section CVS-Server, or whether we leave things as they are to upload only the new merged version of both blocks into CVS.

A first prototype of the merged block will be available next week or so.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Luis de Vasconcelos -

Rosario, thanks for the message. I installed the block and added it to my front page. It works well and looks good - except for all that empty white-space. Is it possible to make the block resize vertically depending on how many categories there are so that the empty white-space is removed?

Thanks.

Attachment siteNavigation.jpg
In reply to Luis de Vasconcelos

Re: New siteNavigation block released

by Rosario Carcò -

YES, it could be done. Let me resume: the width is standard 210 pixels, but the vertical size is actually hard coded. But why would you want to reduce its vertical size? Do you really have only TWO categories? And what about SUB-Categories? As the categories expand or collapse vertically, you can choose to display vertical scrollbars in the admin config options of the block.

Anyway it is up to you to decide how the block should be displayed with or without scrollbars. The vertical size is coded here, so modify it at your will with an editor:

Locate these lines in ../HTML-TreeMenu/TreeMenu.php, around line 637

>>
//Cr:
//Modification of Mario Schellenberger to adapt width and height of block.
//This has to be modified according to the preferred block width and height
//$html = '<div style="width:198px; height:290px; overflow:auto; border:solid 0px">';

//Cr: further enhancement with config settings for scroll bars
if ($CFG->block_myCourses_withscrollbars) {
$html = '<div style="width:198px; height:290px; overflow:auto; border:solid 0px">';
}
>>

Modify $html='<div style="width:198px; height:290px; overflow:auto; border:solid 0px">'; to whatever height you prefer.

Pay attention if you want to modify the horizontal width because 198 pixels fit well with the maximum width of the block which is 210 pixels, keeping a little margin of 12 pixels between borders and displayed text.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Luis de Vasconcelos -

When I enable just these three siteNavigation settings:

block_siteNavigation_showallcourseslink
block_siteNavigation_showlongnames
block_siteNavigation_showcategorylinks

the siteNavigation block automatically resizes vertically and there is no whitespace. This is what I like - it looks good (except for the long course name being "truncated").

sn1.png

But when I enable the block_siteNavigation_withscrollbars option the block is displayed with a whole lot of unnecessary whitespace below the category list, which looks "ugly":

sn2.png

I don't like the idea of having to manually modify the height of the DIV in the source code because I will have to keep changing it as and when I add more courses.

In reply to Luis de Vasconcelos

Re: New siteNavigation block released

by Rosario Carcò -

First, in stead of showlongnames, you could disable it to show only SHORT names. The longnames are then displayed in the tooltip-help box when you place your mouse on the course or category link, so that nothing is truncated.

Second, you could enable the scrollbars, so that nothing is truncated neither.

Third, you are free to modify the vertical size in the code and adjust it whenever your course/category list grows.

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

I just had a look at the new navigation block in Moodle 2.x

Strangely it displays only a FLAT list of courses, no nested categories. Every course I created is located in an according category/subcategory indicated by the numbers. And more strangely the similar navigation block on moodle.org, even in this thread, displays the courses neatly nested in their categories/subcategories, which is what we want:

moodle2xNavigation.gifmoodle2xNavigationMoodleOrg.gif

DOES anyone know why??

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Oh, I am sorry, apologies: Using Moodle IS a course, not a category, so General, Getting started, etc. are only topics containing the different forums. So the new navigation offers really only a flat list of courses, which means that we could port our new merged sitenavigation block also to Moodle 2.x

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

I installed my own Moodle 2.03 testserver and the new navigation can be customized to behave rughly as our siteNavigation block, i.e. with links to the categories, display of nested cats, and so on.

Navigaition Moodle 2x with nested cats and links

And docking is a good alternative to my popUp windows, offering also an acceptable width for longer category and/or course names.

Navigaition Moodle 2x in Dock

So for the moment I do not see any reasons to port our merged siteNavigation to Moodle 2.x

But if you have suggestions, let me know.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Here is Version 1.9.07 (201011080)

NOTHING NEW, though, but it is the final release before I start working on the merged version of both blocks myCourses and siteNavigation.

As usual backup your $CFG->dirroot/blocks/siteNavigation just in case you have to revert back. Unzip everything into a local folder and copy all the contents to your $CFG->dirroot/blocks/siteNavigation directory and point to the NOTIFICATION Link in your Site-Administration-Block.

And since I corrected performance in the myCourses block I have better figures now if you combine both blocks on your FrontPage or on every course page. We have more than 3'500 courses in more than 900 categories:

1.161376 secs
RAM: 23MB

RAM peak: 25.7MB
Included 193 files
DB queries 1878

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

As announced long time ago, we have to ponder whether the underlying HTML-TreeMenu Library is

a) still  modern

b) fast enough to render long and deeply nested trees like in our Moodle Site with 3'500 courses and 900 categories, still increasing

I saw that in Moodle 2.x there is a clear advice to use the YUI libraries. So I just finished my first tests with one component of it which is of our interest. It's treeview which can be used to compose and render nested treeviews as we are doing in our block.

Please have a look at this modified source-code with FireFox and Fire-Bug enabled to measure time-behaviour:

https://moodle.fhnw.ch/lib/yui/treeview/tv_tooltip5100.html

I get this: 2831.159ms, 637'048 function-calls

In the code I simulate the creation of 20'450 nested nodes simply by looping and recursively creating nodes. (No links for the moment, but tooltips work on every node/leaf!)
For the moment I can not compare with the php-code which composes the javascript for HTML-TreeMenu. Unfortunately this will only be possbile after reengineering our Block to use YUI's treeview library.
So I guess that one step towards a merged version of myCourses and siteNavigation is also renewing and replacing the HTML-TreeMenu library.
Expect a prototype in about 1 or 2 weeks.
Rosario
In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

After testing a little bit and studying the YUI-documents and best practices for speeding up web pages, I have to retain these points:

  1. there is a means of dynamically loading the contents of a node in the treeview which would help us speed up the rendering of the whole tree on medium to large scale sites. Have a look at an example here: http://developer.yahoo.com/yui/examples/treeview/dynamic_tree.html
  2. there is the possibility to load the tree, as I considered already in previous posts, as a file

What are the benefits and drawbacks?

  1. would be the fastest solution because it would render only the root categories all collapsed, i.e. on our site with more than 900 categories only the first 15 categories would appear. These categories represent each one University and some special places for teachers and students. Getting the root-cats from the database with Moodle-API-calls is very fast. But as soon as we delve into all nested cats to retrieve cats and courses, the looping and recursive queries go up to 1'800 DB queries if I show only our 900 cats. The JavaScript Code generated would consist only of a few lines and would be fast to load and execute. The main drawbacks are: the so called XHR request (or XMLHttp Request) allows for asynchronous requests dynamically based on what the user does, e.g. clicking on a node to expand in our tree. Of course, again, such a request would only execute the DB-queries needed to represent the next level of nodes and courses contained in only one node, the one that is going to be expanded, and hence would be fast as desired. Nevertheless the user experience would be the one of click-and-wait as you can test yourselves in the yui-example above. The complexity of the code on the server-side would grow a little bit beyond the code of a "simple" block. But fortunately we have everything we need in the myCourses block, so that we can reuse its interface for Admins and Teachers to compose XHR requests to load and expand nodes dynamically. The other big big drawback is that the trees and nodes must be rendered and composed for every user and every page visited, which consumes the same resources in a too expensive manner. But I must admit that this is still a very elegant and very tempting solution.
  2. on the other hand, loading a file, in our case, loading the file with the javascript necessary to render the whole tree, remains the most efficient solution in terms of resources because the file has to be produced only on a time schedule, lets say every 3 hours, and can then be used by every user on every page he visits. In the cited best practices for speeding up web pages you will find also the advice to load javascript files because they can be cached by the user's browser (versus embedding the javascript code directly into the HTML-file). So this technique would really speed up things in our case as the siteNavigation tree to be rendered on every course page is the same and could hence be cached by the user's browser. Technically speaking I would add another Admin config option, lets say block_siteNavigation_composetreedelay. This way you could type in from 1 to 24 hours. The code would then test whether the desired delay has expired and would compose the tree anew and store it in the javascript file to be loaded by the client browser. If the delay would have not expired the file would not be generated.

It is still difficult for me to decide which of both solutions is the one to realize. On one hand we are working on a highly dynamic system, like every database-system is per definition, which means we should fetch every information on the fly from the database. On the other hand the whole siteNavigation Tree, or the site-map, does not change every few seconds, does it? So even if we compose the tree every hour we can save a lot of resources compared to the actual solution and compared even with solution 1) above.

If you have suggestions, feel free to comment here.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

I had to investigate a little problem first, something I noticed when users navigate from one course page to another and both course pages do contain the siteNavigation (and/or myCourses) block, the state of the tree was miraculously preserved, i.e. all expanded and collapsed folders remain and keep their state.

I thought this was sort of a side effect of the HTML-TreeMenu Library we are using. But as I discovered today, it IS using cookies. Look at them in your FireFox while you expand/collapse the folders.

So I researched how to achieve this with YUI treeview for a couple of days and found a solution today, again, using the YUI cookie library but without being aware that HTML-TreeMenu used the same approach.

You can find my first YUI treeview sample with cookies here:

https://moodle.fhnw.ch/lib/yui/treeview/tv_tooltip5100PreserveWithCookies.html

Next step will be to implement this code into siteNavigation and myCourses blocks.

BTW the navigation block in this forum does not preserve what you expand/collapse. It shows only the path to this topic and so does navigation in Moodle 2.x, which means we should port our block also to Moodle 2.x

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Dan Boothby -

Thanks for your continued work in updating the improved siteNavigation block Rosario. smile


I'll be sure to keep an eye out for your improved future versions.

 

Dan

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Here is Version 1.9.07a  (2011120501)

ONE NEW FEATURE requested by a user who wants to use only the siteNavigation Block instead of combining it with the myCourses Block:

per new admin option you can choose to display only active, i.e. not hidden courses or all courses.

I will implement this feature also in the merged 08 line and add also another admin option there to choose to display siteNavigation AND/OR myCourses trees together or separately.

ONE TYPO corrected: in the spanish language file there was a typo ever since I just saw and corrected now.

As usual backup your $CFG->dirroot/blocks/siteNavigation just in case you have to revert back. Unzip everything into a local folder and copy all the contents to your $CFG->dirroot/blocks/siteNavigation directory and point to the NOTIFICATION Link in your Site-Administration-Block.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Mauricio Salles -
Hi, Rosario, I'd like to customize Navigation and Settings block. Actually, I'd like to hide some links, change links hierarchy and put together the contents of the two blocks in a single one. Is that possible? How/where can I do that? Will I face problems on courses pages? Or when upgrading versions? regards
In reply to Mauricio Salles

Re: New siteNavigation block released

by Rosario Carcò -

Did you read this whole thread and also the one of myCourses? And Contrib-1442??

My prototype of a merged Block is already in Beta Stage at https://moodle.fhnw.ch/moodleTest

But of course you can also write your own copy. It is open source.

And as a special feature I added the option to open both the blocks in separate floating popUp-Windows, where we have a lot more space to display the links and gain in speed because the users can leave those windows open all the time while navigating from one course page to the other. And technically I load the navigation trees only once per user session and not, as before, on every course-page where the blocks appear.

Give my another week or two and I will release it here for you all to test.

And this is how it looks like:

moodleSiteNavigationAndMyCoursesMerged

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

I am banging my head against a wall to find the good decision. Please help me:

  • of course siteNavigation and myCourses can still be displayed as before, but in one block instead of two (for those who want to continue with two separate blocks, I can continue to support the 1.9.07 line which has come to an acceptable end stage anyway)
  • independently of the display, there are two major issues:
  1. should we keep the blue, orange and grey toggles for admins and teachers to toggle on/off the display of their active, inactive and for admins ALL courses? If yes, this will be a problem when displaying the blocks in their popUp-Windows because technically speaking a click on one of the buttons sends a request to the server and the response goes back to the main window and not to the popUp-Window. So if we stick on it, I must find a solution first. On the other hand, I was always against it because in my opinion admin-accounts are meant for admin operations and not to enrol in courses. To enrol in courses as teachers and students, admins should use separate accounts so as to separate things completely at role level. What I wanted to add to the myCourses Block anyway, was a means for the students to display only the courses they really want to see, which would free them from the teachers forgetting to unenroll students from old courses or wanting to keep them in because of the grades, which makes the myCourses list grow longer and longer with each semester in our universities. So this would mean to develop a new solution anyway.
  2. to display the siteNavigation and the myCourses lists in popUp windows, I have to write the whole output to files and if I write to files, there comes up another question: how do we delete the old files? Normally you do this simply with a nightly cron-job like rm *_siteNavigation.html and rm *_myCourses.html, but I am not sure whether you all have the means to run your own server and add such a cron-job. I already explained the performance blast we get by writing and reading the output into/from files instead of composing the same output on every course page the users visit. But technically speaking we never know when the user quits the session without using the logoff button/link. So these files are going to be orphaned in the $CFG->dataroot/1/ directory. If we decide to create the siteNavigation file only once a day or at predefined time intervals of 15 minutes to 6 hours, there is no problem to use always the same file and create it after the given time intervals expire. But it is different for the myCourses files because they are individual and we never know when the users quit. Of course we could use always the same user's file, e.g. username_myCourses.html, but only the active users files would be reused this way. The users you delete from Moodle would leave an orphaned username_myCourses.html file. So my best offer is to resolve that case with cron-jobs. Using cron-jobs to nightly purge the siteNavigation and myCourses files means also that we can use admin options to control the generation of the siteNavigation tree. Eg. a time interval of 0 (zero) means that the tree is generated on the fly when the users log in. This is how it was handeled before with the only difference, that the tree is only generated once for every user session and not on every page he visits. A time interval of 1 and more minutes means that we generate only ONE siteNavigation file for all users to use, at the given time interval. For those who have no means of controlling their own server I could leave the display of both trees in one block, i.e. without popUp windows, as it was before. So there would be no gain in performance and hence this would remain a solution only for small to medium sized sites. Starting with more than 1'000 courses, siteNavigation can only be used to display the categories as I did until now on my own site (https://moodle.fhnw.ch, no login required to navigate through the roughly 1'000 deeply nested categories). And starting with more than 2'000 courses the siteNavigation can no longer be displayed on every course page because it would take too long to render even in category-only mode. At the same time this display could be used by those admins who want to keep the blue, orange and grey buttons. (At least until I find a solution to do it also in the popUp windows, if there is a solution)

Let me know, if you have suggestions, and keep watching development on my test server: https://moodle.fhnw.ch/moodleTest

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Here is Version 1.9.08 (2011061501)

  • MERGED version: both blocks, myCourses and siteNavigation appear in one block to reduce space required by two single blocks. For those who want to use only one of both blocks, you can continue to use the 1.9.07 line or I will provide an admin option to show only one of them later on. I still use the original HTML-TreeMenu library. The next major version will use YUI libraries instead.
  • NEW popUp windows: per admin option you can choose whether to display inline in the block or link to a popUp window where you have much more space for the navigation. Opening the navigation trees in popUp windows means an improvement in performance because I generate the navigation trees only once per user session. So from now on you can put the siteNavigation block again on every course page because the links will always point to the same popUp window where the trees are already loaded and rendered, which means a lot of speed also on the client side allowing to save resources also on medium to large scale Moodle sites. (See previous posts for any details regarding the different options and possibilities to speed up siteNavigation even further on very large sites, by generating the siteNavigation file only at given time intervals and not on a user session basis.)

As usual backup your $CFG->dirroot/blocks/siteNavigation just in case you have to revert back. Unzip everything into a local folder and copy all the contents to your $CFG->dirroot/blocks/siteNavigation directory.

Repeat the same procedure for the second chunk, siteNavigation08b.zip (unfortunately the duplication of the HTML-TreeMenu library blew up the whole thing to 160KB which is beyond the upload limits here. I hope to upload this version into the plugins section soon.) And finally point to the NOTIFICATION Link in your Site-Administration-Block.

NOTE: as I use the same HTML-TreeMenu library I use for the myCourses block, it is best if you uninstall this block first to avoid duplicate class declaration issues and other interferences between the blocks.

I will continue to maintain the 1.9.07 line for those who want to stick to the old interface, but remember that we are moving towards a navigation compatible with Moodle 2.x where myCourses and other navigation links appear in the same block.

The next step in the 1.9.08 line could be to integrate further navigation links belonging to the course the user is actually working in, unless I postpone more features directly to the 2.x.x line

Consider this version as a first BETA version, thus install and test on your Test-Server first. If you do not have any, test on my own test-server

https://moodle.fhnw.ch/moodleTest

If you need an account, let me know.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Oh, if you decide to install it on a production server, do not forget to set up a nightly cron-job to purge the sess_xyz_myCourses.html and sess_xyz_siteNavigation.html files I generate in the $CFG->dataroot/1/ directory with something like

rm sess_*.html or erase sess_*.html

If you need furhter details have a look at the development history at the top of block_siteNavigation.php

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Here is Version 1.9.09  (2011120601)

As I will maintain the 07 line separately, the increasing version numbers go with the new merged 08 line.

NEW FEATURE:

per new admin option you can choose to display only active, i.e. not hidden courses or all courses in the siteNavigation tree.

NEW FEATURE:

per new admin option you can choose to diplay only the siteNavigation tree OR only the myCourses tree OR both at the same time.

ONE TYPO:

in the spanish language file there was a typo ever since I just saw and corrected now.

As you have new admin options, all the language files have changed.

NOTE FOR INSTALLATION:

as I can not upload the merged version in one chunk, consider this as a DELTA UPGRADE. This means you have to install first siteNavigation08a.zip AND siteNavigation08b.zip

Then proceed as usual:

Backup your $CFG->dirroot/blocks/siteNavigation just in case you have to revert back. Unzip everything into a local folder and copy all the contents to your $CFG->dirroot/blocks/siteNavigation directory and point to the NOTIFICATION Link in your Site-Administration-Block to load the new version.

The next task now would be to get rid of the HTML-TreeMenu Library and to rewrite everything using YUI-Libraries. But there is a big big discussion taking place in these forums whether it is a good idea or not to use such sofisticated libraries at all. As it is too complicated to take in account for our navigation trees, I will decide on the time I estimate it will take me to rewrite everything. Concerning speed, using popUp-Windows and rendering on a user session basis is in any case a huge step further away from what we had when I had to switch to show only categories in the siteNavigation years ago.

Another idea could be to freeze up a little bit the merged and the 07 line, only doing bug repair, and invest my time to study the new navigation in Moodle 2.x This code is already using YUI. But I do not know how the code behaves on medium to large scale sites. If it renders my 4'800 courses in more than 1'100 deeply nested categories in a reasonable amount of time or not. And unfortunately I can not test, as long as I will keep our production site on Moodle 1.9.x But if that code would have the same limits as ours did, then I could use my code to load the tree on a user session basis and to toggle also the display into a popUp-window.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

One thing I already noticed in the navigation of 2.x is the fact that expanded/collapsed nodes are not preserved in cookies, so you have to start over on every new loaded page. But as I said YUI offers also cookie support, I would have to implement here.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

And as I just realised and expressed earlier here, the navigation is very complicated and complex to track as it is part of the big $PAGE object. I think that trying to change any bits in this complex is too risky as it affects quite a lot of core files and is no longer encapsulated for its own in a separate block. The block_navigation actually does only the rendering part as dockable block. Regarding speed I saw that the navigation is initialized only once per user session and then fetched from cache on every subsequent course page, but I should test the rendering speed on my medium sized site.

So for the moment I have no clue on how to realize cookie support, popUp-windows and other features of my siteNavigation in 2.x Maybe the best would still be to program an own block, we could use as alternative to the built in navigation.

Rosario (slightly frustrated)

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

I just uploaded version 1.9.09 of the merged line into the new Modules & Plugins Database (waiting for approval):

http://moodle.org/plugins/view.php?plugin=block_sitenavigation

I wonder if it is better to leave the 07 line here for download to avoid confusion. Or maybe it is better to have the three blocks myCourses07, siteNavigation07 and sitenavigation09 upward in the same place. But I must check, if I can upload several zip-files into the same place.

PLEASE NOTE: to comply with the Moodle programming guidelines I had to convert everything to lowercase letters. So if you decide to install sitnavigation09 you will have to delete the according entries in mdl_config named block_siteNavigation... otherwise you will not be able to store the new values. As also the directory name changes from sitNavigation to sitenavigation, you will have to delete the block from the Admin->Modules->Blocks->Manage Blocks, then rename the directory, copy the new sitnavigation09 files into it and finally click on the NOTIFICATIONS link in your Moodle GUI.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

It has been approved now and is available for download. I am actually pondering whether to add myCourses and siteNavigation which are the standalone Blocks into the same distribution file, so that you do not have to search for the latest versions in different places. The next planned feature will be to offer the Teachers and Students an option/switch to display only recent courses instead of displaying the whole myCourses-List with a lot of courses the teachers might have forgotten to unenrol the students.

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

For completeness I am uploading version 1.9.10 (Build 2012112101) to the Modules & Plugins Database. As I do not know whether more than one version can stay there for download, I will eventually upload it here again in two chunks.

I backported the option to toggle on/off old/not visited courses from myCourses 07b and 2301, so that you can still continue to use it on Moodle 1.9

Next Version is 2301 to be used on Moodle 2.3

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Version 1.9.10 is also in the Modules&Plugins Database.

And Version 1.9.11 with minor corrections will follow too.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

I just finished a first version of mycourses for Moodle 2.3, so I will apply the same code changes also to sitenavigation (the merged version). This will be version 2301, the first two digits meaning the Moodle version 2.3 on which it has been tested.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Just finished and uploaded into the Modules&Plugins database.

Please note that you can not install the mycourses block for Moodle 2.3 at the same time you install sitenavigation for 2.3 as sitenavigation contains also the mycourses block. Remember this is the merged version in which you can show/hide each block individually.

Rosario

In reply to Rosario Carcò

Re: New siteNavigation block released

by Rosario Carcò -

Just uploaded Version 23.02 as I had to rewrite the code for storing the user session-files outside the yourMoodle/data directory when using the popUp-Window mode. This was necessary because in Moodle 2.3 the new file API does no longer serve files with file.php