dirroot.'/mod/gallery/lib.php'); // check to make sure global settings are correct if (!gallery_check_config()) { if (isadmin()) { notify(get_string('gallerynotconfiguredadmin', 'gallery', $CFG->wwwroot)); } else { notify(get_string('gallerynotconfigured', 'gallery')); } print_simple_box_end(); print_footer(); exit(); } gallery_init(); // Check that form variables have been initialised if (!isset($form->name)) { $form->name = ''; } if (!isset($form->albumid)) { $form->albumid = 0; $form->title = ''; $form->summary = ''; $form->description = ''; $form->keywords = ''; } else { // most information is stored in gallery, retrieve it list($ret, $album) = GalleryCoreApi::loadEntitiesById($form->albumid); $form->title = $album->gettitle(); $form->summary = $album->getsummary(); $form->description = $album->getdescription(); $form->keywords = $album->getkeywords(); gallery_r(); } if (!isset($form->permissions)) { $form->permissions = gallery_decode_permissions($CFG->gallery_studentpermissions); } else { $form->permissions = gallery_decode_permissions($form->permissions); } // For linking to other albums $rootalbums = array(); $linkedalbums = get_records_select_menu('gallery', "albumid != $form->albumid", '', 'id, albumid'); list($ret, $rootid) = GalleryCoreApi::getPluginParameter('module', 'core', 'id.rootAlbum'); if (!$ret) { // Get the root album list($ret, $rootalbum) = GalleryCoreApi::loadEntitiesById($rootid); if (!$ret) { // Load all children of root album list($ret, $subitemids) = GalleryCoreApi::fetchChildItemIds($rootalbum); if (!$ret) { foreach ($subitemids as $subitemid) { list($ret, $subitem) = GalleryCoreApi::loadEntitiesById($subitemid); if (!$ret) { // If it is an album and it is not already linked to a MGM instance, then add it if ($subitem->getentitytype() == 'GalleryAlbumItem' and !in_array($subitem->getId(), $linkedalbums)) { $rootalbums[$subitem->getId()] = $subitem->gettitle(); } } } } } } gallery_r(); ?>