static function getObjectStructure() { global $user; //Load Libraries for lookup values $library = new Library(); $library->orderBy('displayName'); if ($user->hasRole('libraryAdmin')) { $homeLibrary = Library::getPatronHomeLibrary(); $library->libraryId = $homeLibrary->libraryId; } $library->find(); $libraryList = array(); while ($library->fetch()) { $libraryList[$library->libraryId] = $library->displayName; } require_once ROOT_DIR . '/sys/Browse/BrowseCategory.php'; $browseCategories = new BrowseCategory(); $browseCategories->orderBy('label'); $browseCategories->find(); $browseCategoryList = array(); while ($browseCategories->fetch()) { $browseCategoryList[$browseCategories->textId] = $browseCategories->label . " ({$browseCategories->textId})"; } $structure = array('id' => array('property' => 'id', 'type' => 'label', 'label' => 'Id', 'description' => 'The unique id of the hours within the database'), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), 'browseCategoryTextId' => array('property' => 'browseCategoryTextId', 'type' => 'enum', 'values' => $browseCategoryList, 'label' => 'Browse Category', 'description' => 'The browse category to display '), 'weight' => array('property' => 'weight', 'type' => 'numeric', 'label' => 'Weight', 'weight' => 'Defines how lists are sorted within the widget. Lower weights are displayed to the left of the screen.', 'required' => true)); foreach ($structure as $fieldName => $field) { $field['propertyOld'] = $field['property'] . 'Old'; $structure[$fieldName] = $field; } return $structure; }
function getAllObjects() { $browseCategory = new BrowseCategory(); $browseCategory->orderBy('label'); $browseCategory->find(); $list = array(); while ($browseCategory->fetch()) { $list[$browseCategory->id] = clone $browseCategory; } return $list; }
static function listBrowseCategories() { $browseCategoryList = array(); require_once ROOT_DIR . '/sys/Browse/BrowseCategory.php'; $browseCategories = new BrowseCategory(); $browseCategories->orderBy('label'); $browseCategories->find(); while ($browseCategories->fetch()) { $browseCategoryList[$browseCategories->id] = $browseCategories->label . " ({$browseCategories->textId})"; } return $browseCategoryList; }