Allow local custom profile fields also be accessible via webservices

Bug #1892794 reported by Robert Lyon on 2020-08-25
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Wishlist
Robert Lyon

Bug Description

What is wanted:

Have the mahara_user_external.php webservice function be able to set / fetch the information for local custom fields.

Currently we have to hardcode in the extra fields in the _parameters() or _returns() functions

It would be better if the local/lib/artefact_internal.php had a function to call to fetch webservice info for the local profile fields

So in your local/lib/artefact_internal.php file you would need something like so:

class PluginArtefactInternalLocal extends PluginArtefactInternal {

    public static function get_artefact_types() {
        return array(
            'cat',
            'dog',
        );
    }

    public static function get_profile_artefact_types() {
      return array(
          'cat',
          'dog',
      );
    }

    public static function get_contactinfo_artefact_types() {
      return array(
          'cat',
          'dog',
      );
    }

    public static function get_webservice_options() {
      return array(
          'cat' => new external_value(PARAM_TEXT, 'Cat name', VALUE_OPTIONAL),
          'dog' => new external_value(PARAM_TEXT, 'Dog name', VALUE_OPTIONAL),
      );
    }
}

class ArtefactTypeProfileLocal extends ArtefactTypeProfile {
    public static function get_all_fields() {
        $out = array(
            'cat' => 'text',
            'dog' => 'text',
        );
        return $out;
    }
}

class ArtefactTypeCat extends ArtefactTypeProfileField {}
class ArtefactTypeDog extends ArtefactTypeProfileField {}

Changed in mahara:
milestone: none → 20.10.0
status: New → In Progress
summary: - Allow local custom profile fileds also be accessible via webservices
+ Allow local custom profile fields also be accessible via webservices

Reviewed: https://reviews.mahara.org/11186
Committed: https://git.mahara.org/mahara/mahara/commit/0ca96efc73b3b2a9120584cfe5a7d1c3ed06cb25
Submitter: Cecilia Vela Gurovic (<email address hidden>)
Branch: master

commit 0ca96efc73b3b2a9120584cfe5a7d1c3ed06cb25
Author: Robert Lyon <email address hidden>
Date: Wed Aug 26 12:59:54 2020 +1200

Bug 1892794: Allowing custom profile fields have custom titles

Currently all profile fields title/label named via the artefacttype
But if we want different titles in differnet contexts we can now do
this by adding to our ArtefactTypeWhatever class something like

public static function static_display_title() {
if (... some condition ...) {
return get_string('altoption', 'artefact.internal');
}
return get_string('option', 'artefact.internal');
}

Change-Id: I32cfdc821442a7ba8729d76a18e6ddc1f7a62c95
Signed-off-by: Robert Lyon <email address hidden>

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/11178
Committed: https://git.mahara.org/mahara/mahara/commit/d57289185e6205a51a39ac75d0be6d9be2eeafc0
Submitter: Cecilia Vela Gurovic (<email address hidden>)
Branch: master

commit d57289185e6205a51a39ac75d0be6d9be2eeafc0
Author: Robert Lyon <email address hidden>
Date: Tue Aug 25 12:01:08 2020 +1200

Bug 1892794: mahara_user_external to fetch local profile options better

To fetch them from the local/lib/artefact_internal.php file

Change-Id: Ie31ef36823287e7013a4a2d56de91fdfcf9be4af
Signed-off-by: Robert Lyon <email address hidden>

Changed in mahara:
assignee: nobody → Robert Lyon (robertl-9)
status: In Progress → Fix Committed
tags: added: newfeature
Robert Lyon (robertl-9) on 2020-10-22
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers