ÿØÿà JFIF    ÿÛ „  ( %"1!%)+...383,7(-.+  -+++--++++---+-+-----+---------------+---+-++7-----ÿÀ  ß â" ÿÄ     ÿÄ H    !1AQaq"‘¡2B±ÁÑð#R“Ò Tbr‚²á3csƒ’ÂñDS¢³$CÿÄ   ÿÄ %  !1AQa"23‘ÿÚ   ? ôÿ ¨pŸªáÿ —åYõõ\?àÒü©ŠÄï¨pŸªáÿ —åYõõ\?àÓü©ŠÄá 0Ÿªáÿ Ÿå[úƒ ú®ði~TÁbqÐ8OÕpÿ ƒOò¤Oè`–RÂáœá™êi€ßÉ< FtŸI“öÌ8úDf´°å}“¾œ6  öFá°y¥jñÇh†ˆ¢ã/ÃÐ:ªcÈ "Y¡ðÑl>ÿ ”ÏËte:qž\oäŠe÷󲍷˜HT4&ÿ ÓÐü6ö®¿øþßèô Ÿ•7Ñi’•j|“ñì>b…þS?*Óôÿ ÓÐü*h¥£ír¶ü UãS炟[AÐaè[ûª•õ&õj?†Éö+EzP—WeÒírJFt ‘BŒ†Ï‡%#tE Øz ¥OÛ«!1›üä±Í™%ºÍãö]°î(–:@<‹ŒÊö×òÆt¦ãº+‡¦%ÌÁ²h´OƒJŒtMÜ>ÀÜÊw3Y´•牋4ǍýʏTì>œú=Íwhyë,¾Ôò×õ¿ßÊa»«þˆѪQ|%6ž™A õ%:øj<>É—ÿ Å_ˆCbõ¥š±ý¯Ýƒï…¶|RëócÍf溪“t.СøTÿ *Ä¿-{†çàczůŽ_–^XþŒ±miB[X±d 1,é”zEù»& î9gœf™9Ð'.;—™i}!ôšåîqêÛ٤ёý£½ÆA–àôe"A$˝Úsäÿ ÷Û #°xŸëí(l »ý3—¥5m! rt`†0~'j2(]S¦¦kv,ÚÇ l¦øJA£Šƒ J3E8ÙiŽ:cÉžúeZ°€¯\®kÖ(79«Ž:¯X”¾³Š&¡* ….‰Ž(ÜíŸ2¥ª‡×Hi²TF¤ò[¨íÈRëÉ䢍mgÑ.Ÿ<öäS0í„ǹÁU´f#Vß;Õ–…P@3ío<ä-±»Ž.L|kªÀê›fÂ6@»eu‚|ÓaÞÆŸ…¨ááå>åŠ?cKü6ùTÍÆ”†sĤÚ;H2RÚ†õ\Ö·Ÿn'¾ ñ#ºI¤Å´%çÁ­‚â7›‹qT3Iï¨ÖÚ5I7Ë!ÅOóŸ¶øÝñØôת¦$Tcö‘[«Ö³šÒ';Aþ ¸èíg A2Z"i¸vdÄ÷.iõ®§)¿]¤À†–‡É&ä{V¶iŽ”.Ó×Õÿ û?h¬Mt–íª[ÿ Ñÿ ÌV(í}=ibÔ¡›¥¢±b Lô¥‡piη_Z<‡z§èŒ)iÖwiÇ 2hÙ3·=’d÷8éŽ1¦¸c¤µ€7›7Ø ð\á)} ¹fËí›pAÃL%âc2 í§æQz¿;T8sæ°qø)QFMð‰XŒÂ±N¢aF¨…8¯!U  Z©RÊ ÖPVÄÀÍin™Ì-GˆªÅËŠ›•zË}º±ŽÍFò¹}Uw×#ä5B¤{î}Ð<ÙD é©¤&‡ïDbàÁôMÁ.. use core_external\external_api; use core_external\external_function_parameters; use core_external\external_multiple_structure; use core_external\external_single_structure; use core_external\external_value; /** * External interface library for customfields component * * @package core_customfield * @copyright 2018 David Matamoros * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class core_customfield_external extends external_api { /** * Parameters for delete_field * * @return external_function_parameters */ public static function delete_field_parameters() { return new external_function_parameters( array('id' => new external_value(PARAM_INT, 'Custom field ID to delete', VALUE_REQUIRED)) ); } /** * Delete custom field function * * @param int $id */ public static function delete_field($id) { $params = self::validate_parameters(self::delete_field_parameters(), ['id' => $id]); $record = \core_customfield\field_controller::create($params['id']); $handler = $record->get_handler(); if (!$handler->can_configure()) { throw new moodle_exception('nopermissionconfigure', 'core_customfield'); } $handler->delete_field_configuration($record); } /** * Return for delete_field */ public static function delete_field_returns() { } /** * Parameters for reload template function * * @return external_function_parameters */ public static function reload_template_parameters() { return new external_function_parameters( array( 'component' => new external_value(PARAM_COMPONENT, 'component', VALUE_REQUIRED), 'area' => new external_value(PARAM_ALPHANUMEXT, 'area', VALUE_REQUIRED), 'itemid' => new external_value(PARAM_INT, 'itemid', VALUE_REQUIRED) ) ); } /** * Reload template function * * @param string $component * @param string $area * @param int $itemid * @return array|object|stdClass */ public static function reload_template($component, $area, $itemid) { global $PAGE; $params = self::validate_parameters(self::reload_template_parameters(), ['component' => $component, 'area' => $area, 'itemid' => $itemid]); $PAGE->set_context(context_system::instance()); $handler = \core_customfield\handler::get_handler($params['component'], $params['area'], $params['itemid']); self::validate_context($handler->get_configuration_context()); if (!$handler->can_configure()) { throw new moodle_exception('nopermissionconfigure', 'core_customfield'); } $output = $PAGE->get_renderer('core_customfield'); $outputpage = new \core_customfield\output\management($handler); return $outputpage->export_for_template($output); } /** * Ajax returns on reload template. * * @return external_single_structure */ public static function reload_template_returns() { return new external_single_structure( array( 'component' => new external_value(PARAM_COMPONENT, 'component'), 'area' => new external_value(PARAM_ALPHANUMEXT, 'area'), 'itemid' => new external_value(PARAM_INT, 'itemid'), 'usescategories' => new external_value(PARAM_BOOL, 'view has categories'), 'categories' => new external_multiple_structure( new external_single_structure( array( 'id' => new external_value(PARAM_INT, 'id'), 'nameeditable' => new external_value(PARAM_RAW, 'inplace editable name'), 'addfieldmenu' => new external_value(PARAM_RAW, 'addfieldmenu'), 'fields' => new external_multiple_structure( new external_single_structure( array( 'name' => new external_value(PARAM_NOTAGS, 'name'), 'shortname' => new external_value(PARAM_NOTAGS, 'shortname'), 'type' => new external_value(PARAM_NOTAGS, 'type'), 'id' => new external_value(PARAM_INT, 'id'), ) ) , '', VALUE_OPTIONAL), ) ) ), ) ); } /** * Parameters for delete category * * @return external_function_parameters */ public static function delete_category_parameters() { return new external_function_parameters( array('id' => new external_value(PARAM_INT, 'category ID to delete', VALUE_REQUIRED)) ); } /** * Delete category function * * @param int $id */ public static function delete_category($id) { $category = core_customfield\category_controller::create($id); $handler = $category->get_handler(); self::validate_context($handler->get_configuration_context()); if (!$handler->can_configure()) { throw new moodle_exception('nopermissionconfigure', 'core_customfield'); } $handler->delete_category($category); } /** * Return for delete category */ public static function delete_category_returns() { } /** * Parameters for create category * * @return external_function_parameters */ public static function create_category_parameters() { return new external_function_parameters( array( 'component' => new external_value(PARAM_COMPONENT, 'component', VALUE_REQUIRED), 'area' => new external_value(PARAM_ALPHANUMEXT, 'area', VALUE_REQUIRED), 'itemid' => new external_value(PARAM_INT, 'itemid', VALUE_REQUIRED) ) ); } /** * Create category function * * @param string $component * @param string $area * @param int $itemid * @return mixed */ public static function create_category($component, $area, $itemid) { $params = self::validate_parameters(self::create_category_parameters(), ['component' => $component, 'area' => $area, 'itemid' => $itemid]); $handler = \core_customfield\handler::get_handler($params['component'], $params['area'], $params['itemid']); self::validate_context($handler->get_configuration_context()); if (!$handler->can_configure()) { throw new moodle_exception('nopermissionconfigure', 'core_customfield'); } return $handler->create_category(); } /** * Return for create category */ public static function create_category_returns() { return new external_value(PARAM_INT, 'Id of the category'); } /** * Parameters for move field. * * @return external_function_parameters */ public static function move_field_parameters() { return new external_function_parameters( ['id' => new external_value(PARAM_INT, 'Id of the field to move', VALUE_REQUIRED), 'categoryid' => new external_value(PARAM_INT, 'New parent category id', VALUE_REQUIRED), 'beforeid' => new external_value(PARAM_INT, 'Id of the field before which it needs to be moved', VALUE_DEFAULT, 0)] ); } /** * Move/reorder field. Move a field to another category and/or change sortorder of fields * * @param int $id field id * @param int $categoryid * @param int $beforeid */ public static function move_field($id, $categoryid, $beforeid) { $params = self::validate_parameters(self::move_field_parameters(), ['id' => $id, 'categoryid' => $categoryid, 'beforeid' => $beforeid]); $field = \core_customfield\field_controller::create($params['id']); $handler = $field->get_handler(); self::validate_context($handler->get_configuration_context()); if (!$handler->can_configure()) { throw new moodle_exception('nopermissionconfigure', 'core_customfield'); } $handler->move_field($field, $params['categoryid'], $params['beforeid']); } /** * Return for move field */ public static function move_field_returns() { } /** * Return for move category * * @return external_function_parameters */ public static function move_category_parameters() { return new external_function_parameters( ['id' => new external_value(PARAM_INT, 'Category ID to move', VALUE_REQUIRED), 'beforeid' => new external_value(PARAM_INT, 'Id of the category before which it needs to be moved', VALUE_DEFAULT, 0)] ); } /** * Reorder categories. Move category to the new position * * @param int $id category id * @param int $beforeid */ public static function move_category(int $id, int $beforeid) { $params = self::validate_parameters(self::move_category_parameters(), ['id' => $id, 'beforeid' => $beforeid]); $category = core_customfield\category_controller::create($id); $handler = $category->get_handler(); self::validate_context($handler->get_configuration_context()); if (!$handler->can_configure()) { throw new moodle_exception('nopermissionconfigure', 'core_customfield'); } $handler->move_category($category, $params['beforeid']); } /** * Return for move category */ public static function move_category_returns() { } }