* @package taoGroups */ class TestTakerForm { /** * Returns a form to modify the groups a user is part of * * @param core_kernel_classes_Resource $subject * @return string * * @throws \common_ext_ExtensionException */ public static function renderGroupTreeForm(core_kernel_classes_Resource $subject): string { // Ensure groups constants are loaded common_ext_ExtensionsManager::singleton()->getExtensionById('taoGroups'); $memberProperty = new core_kernel_classes_Property(GroupsService::PROPERTY_MEMBERS_URI); $groupForm = tao_helpers_form_GenerisTreeForm::buildTree($subject, $memberProperty); $groupForm->setData('title', __('Add to group')); return $groupForm->render(); } /** * Returns non-rendered form * @param core_kernel_classes_Resource $subject * @return tao_helpers_form_GenerisTreeForm * @throws \common_ext_ExtensionException */ public static function returnGroupTreeFormObject(core_kernel_classes_Resource $subject): tao_helpers_form_GenerisTreeForm { // Ensure groups constants are loaded common_ext_ExtensionsManager::singleton()->getExtensionById('taoGroups'); $memberProperty = new core_kernel_classes_Property(GroupsService::PROPERTY_MEMBERS_URI); $groupForm = tao_helpers_form_GenerisTreeForm::buildTree($subject, $memberProperty); $groupForm->setData('title', __('Add to group')); return $groupForm; } }