00001 <?php
00002
00015 import('controllers.listbuilder.settings.SetupListbuilderHandler');
00016
00017 class FooterLinkListbuilderHandler extends SetupListbuilderHandler {
00018
00020 var $_footerCategoryId;
00021
00025 function FooterLinkListbuilderHandler() {
00026 parent::SetupListbuilderHandler();
00027 $this->addRoleAssignment(
00028 ROLE_ID_PRESS_MANAGER,
00029 array('fetchOptions')
00030 );
00031 }
00032
00033
00034
00035
00036
00040 function initialize(&$request) {
00041 parent::initialize($request);
00042 AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER);
00043 $footerCategoryId = (int)$request->getUserVar('footerCategoryId');
00044 $press =& $request->getPress();
00045
00046 $footerCategoryDao =& DAORegistry::getDAO('FooterCategoryDAO');
00047 $footerCategory =& $footerCategoryDao->getById($footerCategoryId, $press->getId());
00048 if ($footerCategoryId && !isset($footerCategory)) {
00049 fatalError('Footer Category does not exist within this press context.');
00050 } else {
00051 $this->_footerCategoryId = $footerCategoryId;
00052 }
00053
00054
00055 $this->setTitle('grid.content.navigation.footer.FooterLink');
00056 $this->setSourceType(LISTBUILDER_SOURCE_TYPE_TEXT);
00057 $this->setSaveType(LISTBUILDER_SAVE_TYPE_EXTERNAL);
00058 $this->setSaveFieldName('footerLinks');
00059
00060
00061 $titleColumn = new MultilingualListbuilderGridColumn($this, 'title', 'common.title', null, null, null, null, array('tabIndex' => 1));
00062 import('controllers.listbuilder.content.navigation.FooterLinkListbuilderGridCellProvider');
00063 $titleColumn->setCellProvider(new FooterLinkListbuilderGridCellProvider());
00064 $this->addColumn($titleColumn);
00065
00066 $urlColumn = new ListbuilderGridColumn($this, 'url', 'common.url', null, null, null, array('tabIndex' => 2));
00067 $urlColumn->setCellProvider(new FooterLinkListbuilderGridCellProvider());
00068 $this->addColumn($urlColumn);
00069 }
00070
00074 function loadData(&$request) {
00075 $press =& $this->getPress();
00076 $footerLinkDao =& DAORegistry::getDAO('FooterLinkDAO');
00077 $footerLinks =& $footerLinkDao->getByCategoryId($this->_getFooterCategoryId(), $press->getId());
00078
00079 return $footerLinks;
00080 }
00081
00087 function getRowDataElement(&$request, $rowId) {
00088
00089 if ( !empty($rowId) ) {
00090 return parent::getRowDataElement($request, $rowId);
00091 }
00092
00093
00094 $rowData = $this->getNewRowId($request);
00095 import('controllers.grid.content.navigation.form.FooterCategoryForm');
00096 $press =& $request->getPress();
00097 $footerCategoryForm = new FooterCategoryForm($press->getId());
00098 $footerLink =& $footerCategoryForm->getFooterLinkFromRowData($request, $rowData);
00099
00100 return $footerLink;
00101 }
00102
00107 function _getFooterCategoryId() {
00108 return $this->_footerCategoryId;
00109 }
00110 }
00111 ?>