Talk:Portfolio API

Jump to: navigation, search

Comments on specification

Please leave your name and indent according to reply structure.

Comments from Tim Hunt

Do we have to restrict it so that only admins can configure repositories

Here is an example user story:

A course somewhere out there about good online teaching requires students to participate in an online community, say, Moodle.org, and record evidence of their activity to their Portfolio. Moodle.org is a nice open place, so wants to help this sort of thing. Therefore, Martin configures it so that any user can go to their user profile, and configure any portfolio plugin for their own use, so students on this course can easily export from moodle.org to their own Portfolio.

Similarly, this may be a way to deal with Facebook authentication issues. Each student configures the facebook plugin for themselves, including some sort of secret key.

Penny's reply

Hmm. I agree with your user story but I'm not sure of the implications of it. At any rate, the portfolio plugin system must support multiple instances of a plugin being configured (iirc, this will be the first instance of this in moodle?) but then in terms of permissions I'm not sure how it would work - it's almost a new context level - so that any user could configure a plugin instance and then grant access. I think it should definitely be able to be turned off though (by an admin)

Martin Dougiamas 04:11, 24 June 2008 (CDT) Absolutely agree with Tim's picture, that is the same way the repositories API will work. Yes, the admin should choose to allow users to configure their own portfolios. This is basically saving user preferences for each plugin type, and could be part of the "save" process (use checkbox to save this portfolio for next time).

Yeah but still we have the model of admins creating instances of plugins and users can just configure them. They can't create their own instances - Penny Leach

Do we really need transport APIs

I am not if transport layers really need to be pluggable APIs as such. Surely almost all Portfolio plugins will use a single transport method.

Of course, each transport method will have a library of code, for example a SOAP library, or the mnet libraries, and the Portfolio plugins will use these, but I don't see any need for all the transport mechanisms to implement some common interface. Different transport mechanisms work very differently, and tend to have different interfaces in their standard libraries. Trying to put a common wrapper round all of them seems difficult and unnecessary to me.

Penny's reply

Well theoretically moodle-moodle and moodle-mahara would both use mnet, although I guess you're right that it might be overly difficult. I was trying to avoid multiple wrappers around the same library. We started off as having formats as a plugin too and moved away from it in favour of libraries. I wonder if we gain anything in terms of test framework by adhering to one API for transport layers (think mock objects).. I'll ask Nico.

Nico's reply

I am fine with the idea of using libraries directly in portfolio/repository code, BUT with the following requirements:

  • Libraries must be object-oriented
  • The Transport object must be a member variable of the Portfolio class

There is no way to do proper unit testing without proper object orientation. If there is to be only one transport method per portfolio instance, then it should be a private member with public setters/getters. This will allow unit tests to mock the transport object, and test the portfolio code without having to worry about the transport code.

Here is some pseudo-code:

 <?php
 $portfolio = new PortFolio();
 $transport = new Transport_Mnet();
 $portfolio->set_transport($transport);
 ?>
 <?php
 class Portfolio {
   private $transport;
 
   function query($query) {
     $this->transport->query($query);
   }
 }


Comments from Gavin Henrick

Content & Formats / Meta data

3 examples to think on:

  1. A user exports his thesis to his portfolio, you get the meta data from the install/course/grade/anything he adds and the file (any type)
  2. A user exports his forum post to his portfolio, you get the meta data from the install/course/grade/forum, you get his content of his post (txt/html?) and optionally have a file (any type)
  3. A user exports his case history from a database module which has 4 graphics files in it. you get the meta data from the install/course/grade/database instance, you get his content of entry(txt/html?) and the files


IN the first case, you end up with meta data and a file of some type to export, how can a user define export format when its unlikely all will have servers capable of transforming to the chosen format.

In the second case, you have data, content (txt) and a file of some format - again how can you transpose the content and the file and data into any given format?


When we did the export we had the the end result as up to N files, the xml file(this is the meta data and could be csv,rtf, or html too), the html content file and the raw files which may be attached. Depending on where it is going, the meta data may end up as fields being pushed with the file, or so on. but i think holding it in a workable object (xml object or something else would be useful.


Therefore I would propose that txt level output + files this be the lowest common denominator since everyone can generate it. xml,csv, or html for the meta data, and txt or html or rtf (since not all will be able to generate pdfs, and some content isnt that great in some pdf engines).

Obviously the design leaves room for those who may xpose into pdf the doc, ppt etc attachments, and so on (we automate this for some clients on a seperate box using open office)

User Actions

Pertaining mostly to portfolios, and perhaps student workspaces, some have asked about automating this completely. I think if you look at the stages - initiating xfer - meta data

Could we not have a flag (per course? or instance or student?) perhaps to automate the transfer once something is complete (submitted graded etc..). It may also be useful to have an admin action to initiate this for all students "send all student data to portfolio"

Could we not have a flag to not prompt students for more data as the people we have talked to mostly want this to be a "2 click" event, choose to export and confirm. I think it may be more difficult and create a barrier to use if students are prompted for meta data, so having this optional at admin level would be good.

So a default simple install would automatically xfer all finalised content on enable modules to the students portfolio so they have it whether they forget to do so or not.