Chamilo-lms: Adding an option to hide teachers on courses list.

Created on 17 Apr 2017  路  19Comments  路  Source: chamilo/chamilo-lms

I saw earlier a similar enhancement idea but no one seems to have implemented it yet.

The idea is to have a switch button on top of the courses list to hide teachers list:
image.
Ideally, this preference should be kept for each user through sessions.
I had a few ideas (and @moy gave me some as well):

1. Adding a cookie:

Seems to be a bad idea since the option would be kept only for a specific device and browser.

2. Using JSON/XML fields already in database

I don't know if such fields already exists to save the user preferences. If they do, I could add the preference easily without modifying the database.

3. Other options I didn't think of.

If someone more familiar with the way preferences are saved have a better idea ?

Enhancement wontfix

Most helpful comment

Hi guys, there is no particular reason why the teachers are in the list or why they are not in the list. Some users want it to appear, some others don't.
Adding an option is always a little bit of an issue between minor versions because, for simplicity purposes, we do not accept database changes.
However, we do accept settings in configuration.php (which are registered in main/install/configuration.dist.php for Git) until the next major Chamilo version.
In this case, if you believe it is of any interest to users to hide the teachers in the courses list, you can simply submit a PR with the setting added to configuration.dist.php (the default value should be the current behaviour and not having this setting defined in configuration.php should be equivalent to have the default value, so we recommend the default value to be "false".
Something like this:

// Set to true to make the teacher name and info disappear from the courses list
$_configuration['hide_teachers_from_my_courses_list'] = false;

Then you can later use it in the code with:

if (api_get_configuration_value('hide_teachers_from_my_courses_list') === 'true') {
    //hide
} else {
    //show
}

However, please make sure you first check if there isn't an option of this kind already. Nobody knows all the available options of Chamilo by heart anymore... there are just too many.

All 19 comments

IMO this setting if approved, should be in Chamilo or course configuration, and set by admin or teacher, not on the open portal.
@SatyanJ , could not this be hidden by a CSS element property?

It can be hidden by a CSS element property. (on list-teachers).
I don't understand why it should be available for every users ? It would reduce course list size and facilitate navigation ?

@SatyanJ I'm not part of dev team, I'm a user like you. I just stated my opinion and seeked a solution.
I personally also think having the Teacher name on course list a waste of space but, generally thinking, there is use for some "Universities-like organizations" where teachers are the differential on courses.
One of my Clients is like this.

@marshel I know you are a user, I was asking for you opinion :+1: .
Maybe, it should be an option set by the admin to enable or disable the possibility to hide the teachers list.

Hi guys, there is no particular reason why the teachers are in the list or why they are not in the list. Some users want it to appear, some others don't.
Adding an option is always a little bit of an issue between minor versions because, for simplicity purposes, we do not accept database changes.
However, we do accept settings in configuration.php (which are registered in main/install/configuration.dist.php for Git) until the next major Chamilo version.
In this case, if you believe it is of any interest to users to hide the teachers in the courses list, you can simply submit a PR with the setting added to configuration.dist.php (the default value should be the current behaviour and not having this setting defined in configuration.php should be equivalent to have the default value, so we recommend the default value to be "false".
Something like this:

// Set to true to make the teacher name and info disappear from the courses list
$_configuration['hide_teachers_from_my_courses_list'] = false;

Then you can later use it in the code with:

if (api_get_configuration_value('hide_teachers_from_my_courses_list') === 'true') {
    //hide
} else {
    //show
}

However, please make sure you first check if there isn't an option of this kind already. Nobody knows all the available options of Chamilo by heart anymore... there are just too many.

@ywarnier using configutation.dist.php, the configuration would be the same for every users using the same installation so each users won't be able to hide/show teachers list ?

BTW: The global option already exists. My bad.
image

I also changed on tranaslate.chamilo.org, the Label of this option on Brazilian since there was a huge translation error.

@SatyanJ I guess this is limiting (having the option globally), but honestly, I don't think it would do much good to have users show the teachers and others not show them... In the sense that it would add confusion when reporting issues or exchanging between users on the use of the platform.
If you want to add it, you should consider doing that through the ExtraField class and the extra fields for users. However, adding a feature that depends on that will require adding the field as part of the installation process of Chamilo and, as such, will modify the database data for this version, which is not accepted for a minor version. So we have 2 solutions at this point (for this issue):

  1. you are OK with the global setting, and we close this issue
  2. you want to add the option by user, and we set the expected version to 2.0 (you can then send your change to the master branch immediately if you like)

@ywarnier I'm going to add that change to the master branch and (if approuved) it's going to be for version 2.0.
I'll take a look at the ExtraFields class.

Check the skype plugin. It gives a good example of how to add an user extra field through a plugin. In your case, it would not be through a plugin but directly through a database migration. Check app/Migrations/Schema/V200/ for that (you should create a new Versionxxx file, check the V111/ to see examples (in particular Version20160706145000.php whch is bang in what you're looking for).
Once you've got that inserted into the database, the field will appear in the list of user extra fields ("Profile" link in the Chamilo admin page, user block). Then you can query the value of that field with the ExtraField class.

My 2 cents on the question: personally, I never saw the advantage of having the list of teachers directly in the list of courses, it just wastes some space on the screen (my list of courses takes ~3 screens with the normal display, and it fits in one screen if I hack the CSS a bit with greasemonkey). But I can imagine an organization where course names are not relevant (e.g. they're just numbers that no one remembers and courses are known as "prof. X's course"), so an option is better than completely disabling it.

Now, I agree with @SatyanJ that a per-user is better. Chamilo instances can typically cover a wide range of classes (in Grenoble we have one Chamilo instance for 6 schools + 1 preparatory school for example, and each school has a different way to deal with list of courses). So a per-instance setting is probably not flexible enough.

As an additional info, you could add the code into 1.11.x checking the extra field, but the extra field itself could not be added through the installation process. As such, your installation of a 1.11.4 could have the dormant feature in the code, and you could just add the profile field manually through the profiling section in the admin page. Upon upgrading to 2.0, if you have put the relevant checks in the migration file to avoid creating the extrafield if it's already there, the feature would just "continue to work" instead of appearing then.

@ywarnier
How should I name the migration file ? VersionYYYYDDMMHHmmSS.php ?

Yes, that's correct. Your timezone doesn't really matter as we don't have so many changes to the database structure every day :-)

@ywarnier
I managed to make everything work, though I have two questions before making the pull-request:

  • To test if the data isn't already in the database i used REPLACE INTO, is there anything more appropiate ? (I'm not really familliar with mysql)
  • Just like LinkedInUrl, I didn't managed to get the name translated , though, Yes and No were translated correctly (plus the wrapping but with space it looks better).
    image

(@moy, if you want to take a look, it's in hide_teachers_list branch)

Related to (duplicate of?) #1903

Indeed. My understanding is that #1903 is a follow-up to this one.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I don't think we ever received a PR for this. I'm closing this issue but feel free to reopen if there's any change you want to contribute.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AldoAbdiel picture AldoAbdiel  路  3Comments

yourKatharsis picture yourKatharsis  路  7Comments

AngelFQC picture AngelFQC  路  5Comments

480419140 picture 480419140  路  5Comments

ywarnier picture ywarnier  路  3Comments