16 import(
'lib.pkp.classes.form.Form');
31 function __construct($monograph, $publicationFormat, $publication) {
32 parent::__construct(
'controllers/grid/catalogEntry/form/formatForm.tpl');
39 $this->
addCheck(
new FormValidator($this,
'entryKey',
'required',
'grid.catalogEntry.publicationFormatRequired'));
61 $this->_publicationFormat = $publicationFormat;
77 $this->_monograph = $monograph;
94 $this->_publication = $publication;
108 $this->_data = array(
109 'entryKey' => $format->getEntryKey(),
110 'name' => $format->getName(
null),
111 'isPhysicalFormat' => $format->getPhysicalFormat()?
true:
false,
112 'remoteURL' => $format->getRemoteURL(),
113 'urlPath' => $format->getData(
'urlPath'),
116 $this->
setData(
'entryKey',
'DA');
123 function fetch($request, $template =
null, $display =
false) {
126 $templateMgr->assign(
'entryKeys', $onixCodelistItemDao->getCodes(
'List7'));
129 $templateMgr->assign(
'submissionId', $monograph->getId());
131 if ($publicationFormat !=
null) {
132 $templateMgr->assign(
'representationId', $publicationFormat->getId());
134 $templateMgr->assign(
'publicationId', $this->
getPublication()->getId());
135 return parent::fetch($request, $template, $display);
157 function execute(...$functionParams) {
158 parent::execute(...$functionParams);
162 if (!$publicationFormat) {
164 $publicationFormat = $publicationFormatDao->newDataObject();
165 $publicationFormat->setData(
'publicationId', $this->
getPublication()->getId());
166 $existingFormat =
false;
168 $existingFormat =
true;
169 if ($this->
getPublication()->getId() != $publicationFormat->getData(
'publicationId')) {
170 throw new Exception(
'Invalid publication format');
174 $publicationFormat->setName($this->
getData(
'name'));
175 $publicationFormat->setEntryKey($this->
getData(
'entryKey'));
176 $publicationFormat->setPhysicalFormat($this->
getData(
'isPhysicalFormat')?
true:
false);
177 $publicationFormat->setRemoteURL($this->
getData(
'remoteURL'));
178 $publicationFormat->setData(
'urlPath', $this->
getData(
'urlPath'));
180 if ($existingFormat) {
181 $publicationFormatDao->updateObject($publicationFormat);
182 $representationId = $publicationFormat->getId();
184 $representationId = $publicationFormatDao->insertObject($publicationFormat);
186 import(
'lib.pkp.classes.log.SubmissionLog');
187 import(
'classes.log.SubmissionEventLogEntry');
191 return $representationId;