Beispiel #1
0
 /**
  * @copydoc Form::fetch()
  */
 function fetch($request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $templateMgr->assign('readOnly', $this->isReadOnly());
     $templateMgr->assign('selectedTypeId', $this->getData('typeId'));
     $announcementDao = DAORegistry::getDAO('AnnouncementDAO');
     $announcement = $announcementDao->getById($this->announcementId);
     $templateMgr->assign('announcement', $announcement);
     $announcementTypeDao = DAORegistry::getDAO('AnnouncementTypeDAO');
     list($assocType, $assocId) = $this->_getAnnouncementTypesAssocId();
     $announcementTypeFactory = $announcementTypeDao->getByAssoc($assocType, $assocId);
     $announcementTypeOptions = array();
     if (!$announcementTypeFactory->wasEmpty()) {
         $announcementTypeOptions = array(0 => __('common.none'));
     }
     while ($announcementType = $announcementTypeFactory->next()) {
         $announcementTypeOptions[$announcementType->getId()] = $announcementType->getLocalizedTypeName();
     }
     $templateMgr->assign('announcementTypes', $announcementTypeOptions);
     return parent::fetch($request, 'controllers/grid/announcements/form/announcementForm.tpl');
 }