Example #1
0
 function getObjectStructure()
 {
     global $user;
     //Load Libraries for lookup values
     $libraryList = array();
     if ($user->hasRole('opacAdmin')) {
         $library = new Library();
         $library->orderBy('displayName');
         $library->find();
         $libraryList[-1] = 'All Libraries';
         while ($library->fetch()) {
             $libraryList[$library->libraryId] = $library->displayName;
         }
     } elseif ($user->hasRole('libraryAdmin') || $user->hasRole('contentEditor')) {
         $homeLibrary = Library::getPatronHomeLibrary();
         $libraryList[$homeLibrary->libraryId] = $homeLibrary->displayName;
     }
     $structure = array('id' => array('property' => 'id', 'type' => 'hidden', 'label' => 'Id', 'description' => 'The unique id of the list widget file.', 'primaryKey' => true, 'storeDb' => true), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), 'name' => array('property' => 'name', 'type' => 'text', 'label' => 'Name', 'description' => 'The name of the widget.', 'maxLength' => 255, 'size' => 100, 'serverValidation' => 'validateName', 'storeDb' => true), 'description' => array('property' => 'description', 'type' => 'textarea', 'rows' => 3, 'cols' => 80, 'label' => 'Description', 'description' => 'A description for the widget', 'storeDb' => true, 'hideInLists' => true), 'showTitleDescriptions' => array('property' => 'showTitleDescriptions', 'type' => 'checkbox', 'label' => 'Should the description pop-up be shown when hovering over titles?', 'storeDb' => true, 'default' => true, 'hideInLists' => true), 'showMultipleTitles' => array('property' => 'showMultipleTitles', 'type' => 'checkbox', 'label' => 'Should multiple titles by shown in in the widget or should only one title be shown at a time?', 'storeDb' => true, 'default' => true, 'hideInLists' => true), 'style' => array('property' => 'style', 'type' => 'enum', 'label' => 'The style to use when displaying the list widget', 'values' => array('horizontal' => 'Horizontal', 'vertical' => 'Vertical', 'single' => 'Single Title'), 'storeDb' => true, 'default' => 'horizontal', 'hideInLists' => true), 'autoRotate' => array('property' => 'autoRotate', 'type' => 'checkbox', 'label' => 'Should the widget automatically rotate between titles?', 'storeDb' => true, 'hideInLists' => true), 'onSelectCallback' => array('property' => 'onSelectCallback', 'type' => 'text', 'label' => 'On Select Callback', 'description' => 'A javascript callback to invoke when a title is selected to override the default behavior.', 'storeDb' => true, 'hideInLists' => true), 'customCss' => array('property' => 'customCss', 'type' => 'url', 'label' => 'Custom CSS File', 'maxLength' => 255, 'size' => 100, 'description' => 'The URL to an external css file to be included when rendering as an iFrame.', 'storeDb' => true, 'required' => false, 'hideInLists' => true), 'listDisplayType' => array('property' => 'listDisplayType', 'type' => 'enum', 'values' => array('tabs' => 'Tabbed Display', 'dropdown' => 'Drop Down List'), 'label' => 'Display lists as', 'description' => 'The URL to an external css file to be included wen rendering as an iFrame.', 'storeDb' => true, 'hideInLists' => true), 'lists' => array('property' => 'lists', 'type' => 'oneToMany', 'keyThis' => 'id', 'keyOther' => 'listWidgetId', 'subObjectType' => 'ListWidgetList', 'structure' => ListWidgetList::getObjectStructure(), 'label' => 'Lists', 'description' => 'The lists to be displayed within the widget.', 'sortable' => true, 'storeDb' => true, 'serverValidation' => 'validateLists', 'editLink' => 'ListWidgetsListsLinks', 'hideInLists' => true));
     foreach ($structure as $fieldName => $field) {
         $field['propertyOld'] = $field['property'] . 'Old';
         $structure[$fieldName] = $field;
     }
     return $structure;
 }
Example #2
0
 function getObjectStructure()
 {
     global $user;
     //Load Libraries for lookup values
     $libraryList = array();
     if ($user->hasRole('opacAdmin')) {
         $library = new Library();
         $library->orderBy('displayName');
         $library->find();
         $libraryList[-1] = 'All Libraries';
         while ($library->fetch()) {
             $libraryList[$library->libraryId] = $library->displayName;
         }
     } elseif ($user->hasRole('libraryAdmin') || $user->hasRole('contentEditor')) {
         $homeLibrary = Library::getPatronHomeLibrary();
         $libraryList[$homeLibrary->libraryId] = $homeLibrary->displayName;
     }
     $structure = array('id' => array('property' => 'id', 'type' => 'hidden', 'label' => 'Id', 'description' => 'The unique id of the list widget file.', 'primaryKey' => true, 'storeDb' => true), 'libraryId' => array('property' => 'libraryId', 'type' => 'enum', 'values' => $libraryList, 'label' => 'Library', 'description' => 'A link to the library which the location belongs to'), 'name' => array('property' => 'name', 'type' => 'text', 'label' => 'Name', 'description' => 'The name of the widget.', 'maxLength' => 255, 'size' => 100, 'serverValidation' => 'validateName', 'storeDb' => true), 'description' => array('property' => 'description', 'type' => 'textarea', 'rows' => 3, 'cols' => 80, 'label' => 'Description', 'description' => 'A description for the widget', 'storeDb' => true, 'hideInLists' => true), 'showTitle' => array('property' => 'showTitle', 'type' => 'checkbox', 'label' => 'Should the title for the currently selected title be shown?', 'storeDb' => true, 'default' => true, 'hideInLists' => true), 'showAuthor' => array('property' => 'showAuthor', 'type' => 'checkbox', 'label' => 'Should the author for the currently selected title be shown?', 'storeDb' => true, 'default' => true, 'hideInLists' => true), 'showRatings' => array('property' => 'showRatings', 'type' => 'checkbox', 'label' => 'Should ratings widgets be shown under each cover?', 'storeDb' => true, 'default' => false, 'hideInLists' => true), 'style' => array('property' => 'style', 'type' => 'enum', 'label' => 'The style to use when displaying the list widget', 'values' => $this->styles, 'storeDb' => true, 'default' => 'horizontal', 'hideInLists' => true), 'autoRotate' => array('property' => 'autoRotate', 'type' => 'checkbox', 'label' => 'Should the widget automatically rotate between titles?', 'storeDb' => true, 'hideInLists' => true), 'coverSize' => array('property' => 'coverSize', 'type' => 'enum', 'label' => 'The cover size to use when showing a widget', 'values' => array('small' => 'Small', 'medium' => 'Medium'), 'storeDb' => true, 'default' => 'small', 'hideInLists' => true), 'customCss' => array('property' => 'customCss', 'type' => 'url', 'label' => 'Custom CSS File', 'maxLength' => 255, 'size' => 100, 'description' => 'The URL to an external css file to be included when rendering as an iFrame.', 'storeDb' => true, 'required' => false, 'hideInLists' => true), 'listDisplayType' => array('property' => 'listDisplayType', 'type' => 'enum', 'values' => $this->displayTypes, 'label' => 'Display lists as', 'description' => 'The method used to show the user the multiple lists associated with the widget.', 'storeDb' => true, 'hideInLists' => true), 'showListWidgetTitle' => array('property' => 'showListWidgetTitle', 'type' => 'checkbox', 'label' => 'Show the list widget\'s title bar', 'description' => 'Whether or not the widget\'s title bar is shown. (Enabling the Show More Link will force the title bar to be shown as well.)', 'storeDb' => true, 'hideInLists' => true, 'default' => true), 'showViewMoreLink' => array('property' => 'showViewMoreLink', 'type' => 'checkbox', 'label' => 'Show the View More link on the title bar of the widget.', 'storeDb' => true, 'hideInLists' => true, 'default' => false), 'viewMoreLinkMode' => array('property' => 'viewMoreLinkMode', 'type' => 'enum', 'values' => array('list' => 'List', 'covers' => 'Covers'), 'label' => 'Display mode for search results link', 'description' => 'The mode to show full search results in when the View More link is clicked.', 'storeDb' => true, 'hideInLists' => true), 'lists' => array('property' => 'lists', 'type' => 'oneToMany', 'keyThis' => 'id', 'keyOther' => 'listWidgetId', 'subObjectType' => 'ListWidgetList', 'structure' => ListWidgetList::getObjectStructure(), 'label' => 'Lists', 'description' => 'The lists to be displayed within the widget.', 'sortable' => true, 'storeDb' => true, 'serverValidation' => 'validateLists', 'editLink' => 'ListWidgetsListsLinks', 'hideInLists' => true));
     foreach ($structure as $fieldName => $field) {
         $field['propertyOld'] = $field['property'] . 'Old';
         $structure[$fieldName] = $field;
     }
     return $structure;
 }