/**
  * Need to add additional data to the template via the fetch method
  * @see Form::fetch()
  * @param $args array
  * @param $request PKPRequest
  */
 function fetch($args, &$request)
 {
     $router =& $request->getRouter();
     $monographId = $request->getUserVar('monographId');
     $additionalVars = array('monographId' => $monographId, 'addUrl' => $router->url($request, array(), null, 'addItem', null, array('monographId' => $monographId)), 'deleteUrl' => $router->url($request, array(), null, 'deleteItems', null, array('monographId' => $monographId)));
     return parent::fetch($args, &$request, $additionalVars);
 }
 /**
  * Save changes to submission.
  * @param $args array
  * @param $request PKPRequest
  * @return int the submission ID
  */
 function execute($args, $request)
 {
     parent::execute($args, $request);
     // handle category assignment.
     ListbuilderHandler::unpack($request, $this->getData('categories'), array($this, 'deleteEntry'), array($this, 'insertEntry'), array($this, 'updateEntry'));
     return $this->submissionId;
 }
 /**
  * Assign form data to user-submitted data.
  */
 function readInputData()
 {
     parent::readInputData();
     $this->readUserVars(array('categories', 'seriesId', 'seriesPosition'));
     $application = PKPApplication::getApplication();
     $request = $application->getRequest();
     ListbuilderHandler::unpack($request, $this->getData('categories'), array($this, 'deleteEntry'), array($this, 'insertEntry'), array($this, 'updateEntry'));
 }
 /**
  * Save changes to submission.
  * @param $args array
  * @param $request PKPRequest
  * @return int the submission ID
  */
 function execute($args, $request)
 {
     parent::execute($args, $request);
     // handle category assignment.
     ListbuilderHandler::unpack($request, $this->getData('categories'));
     $submissionDao = Application::getSubmissionDAO();
     $submission = $submissionDao->getById($this->submissionId);
     // Send author notification email
     import('classes.mail.MonographMailTemplate');
     $mail = new MonographMailTemplate($submission, 'SUBMISSION_ACK', null, null, null, false);
     $authorMail = new MonographMailTemplate($submission, 'SUBMISSION_ACK_NOT_USER', null, null, null, false);
     $context = $request->getContext();
     $router = $request->getRouter();
     if ($mail->isEnabled()) {
         // submission ack emails should be from the contact.
         $mail->setReplyTo($this->context->getSetting('contactEmail'), $this->context->getSetting('contactName'));
         $authorMail->setReplyTo($this->context->getSetting('contactEmail'), $this->context->getSetting('contactName'));
         $user = $request->getUser();
         $primaryAuthor = $submission->getPrimaryAuthor();
         if (!isset($primaryAuthor)) {
             $authors = $submission->getAuthors();
             $primaryAuthor = $authors[0];
         }
         $mail->addRecipient($user->getEmail(), $user->getFullName());
         if ($user->getEmail() != $primaryAuthor->getEmail()) {
             $authorMail->addRecipient($primaryAuthor->getEmail(), $primaryAuthor->getFullName());
         }
         if ($context->getSetting('copySubmissionAckPrimaryContact')) {
             $authorMail->addBcc($context->getSetting('contactEmail'), $context->getSetting('contactName'));
         }
         if ($copyAddress = $context->getSetting('copySubmissionAckAddress')) {
             $authorMail->addBcc($copyAddress);
         }
         $assignedAuthors = $submission->getAuthors();
         foreach ($assignedAuthors as $author) {
             $authorEmail = $author->getEmail();
             // only add the author email if they have not already been added as the primary author
             // or user creating the submission.
             if ($authorEmail != $primaryAuthor->getEmail() && $authorEmail != $user->getEmail()) {
                 $authorMail->addRecipient($author->getEmail(), $author->getFullName());
             }
         }
         $mail->bccAssignedSeriesEditors($submission->getId(), WORKFLOW_STAGE_ID_SUBMISSION);
         $mail->assignParams(array('authorName' => $user->getFullName(), 'authorUsername' => $user->getUsername(), 'editorialContactSignature' => $context->getSetting('contactName') . "\n" . $context->getLocalizedName(), 'submissionUrl' => $router->url($request, null, 'authorDashboard', 'submission', $submission->getId())));
         $authorMail->assignParams(array('submitterName' => $user->getFullName(), 'editorialContactSignature' => $context->getSetting('contactName') . "\n" . $context->getLocalizedName()));
         $mail->send($request);
         $recipients = $authorMail->getRecipients();
         if (!empty($recipients)) {
             $authorMail->send($request);
         }
     }
     // Log submission.
     import('lib.pkp.classes.log.SubmissionLog');
     import('classes.log.SubmissionEventLogEntry');
     // constants
     SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_SUBMISSION_SUBMIT, 'submission.event.submissionSubmitted');
     return $this->submissionId;
 }
 /**
  * Check the number of lisbuilder rows. If it's equal to 0, return false.
  *
  * @see FormValidator::isValid()
  * @return boolean
  */
 function isValid()
 {
     $value = $this->getFieldValue();
     import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler');
     ListbuilderHandler::unpack($request, $value);
     if ($this->_valid) {
         return true;
     } else {
         return false;
     }
 }
 /**
  * @copydoc GridHandler::getRowDataElement
  */
 protected function getRowDataElement($request, &$rowId)
 {
     // fallback on the parent if a rowId is found
     if (!empty($rowId)) {
         return parent::getRowDataElement($request, $rowId);
     }
     // Otherwise return from the newRowId
     // FIXME: Validate user ID?
     $newRowId = $this->getNewRowId($request);
     $userId = (int) $newRowId['name'];
     $userDao = DAORegistry::getDAO('UserDAO');
     return $userDao->getById($userId);
 }
 /**
  * @copydoc GridHandler::getRowDataElement
  */
 protected function getRowDataElement($request, &$rowId)
 {
     // fallback on the parent if a rowId is found
     if (!empty($rowId)) {
         return parent::getRowDataElement($request, $rowId);
     }
     // Otherwise return from the $newRowId
     $rowData = $this->getNewRowId($request);
     $categoryDao = DAORegistry::getDAO('CategoryDAO');
     $category = $categoryDao->getEntryDao()->newDataObject();
     $category->setName($rowData['name'], null);
     // Localized
     return $category;
 }
Beispiel #8
0
 /**
  * @copydoc ContextSettingsForm::execute()
  * @param $request Request
  */
 function execute($request)
 {
     $journal = $request->getContext();
     if ($journal->getEnabled() !== $this->getData('journalEnabled')) {
         $journalDao = DAORegistry::getDAO('JournalDAO');
         $journal->setEnabled($this->getData('journalEnabled'));
         $journalDao->updateObject($journal);
     }
     // Save block plugins context positions.
     import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler');
     $this->categories = null;
     ListbuilderHandler::unpack($request, $request->getUserVar('categories'));
     $this->setData('categories', $this->categories);
     parent::execute($request);
 }
 /**
  * @see PKPHandler::initialize()
  */
 function initialize(&$request)
 {
     parent::initialize($request);
     $userId = (int) $request->getUserVar('userId');
     $this->setUserId($userId);
     // Basic configuration
     $this->setTitle($request->getUserVar('title'));
     $this->setSourceTitle('manager.users.availableRoles');
     $this->setSourceType(LISTBUILDER_SOURCE_TYPE_SELECT);
     $this->setListTitle('manager.users.currentRoles');
     $this->setAdditionalData(array('userId' => $userId));
     $this->_loadPossibleItemList($request);
     $this->_loadList($request);
     $this->addColumn(new GridColumn('item', 'common.name'));
     $this->addColumn(new GridColumn('attribute', 'common.designation'));
 }
 /**
  * @copydoc GridHandler::getRowDataElement
  */
 function getRowDataElement($request, &$rowId)
 {
     // fallback on the parent if a rowId is found
     if (!empty($rowId)) {
         return parent::getRowDataElement($request, $rowId);
     }
     // A new row is being bounced back to the user.
     // Supply a new ID from the specified key.
     $newRowId = $request->getUserVar('newRowId');
     $rowId = $newRowId['key'];
     // Send the value specified back to the user for formatting.
     return $newRowId['value'];
 }
 /**
  * @see ListbuilderHandler::fetch()
  */
 function fetch($args, &$request)
 {
     $userGroupId = (int) $request->getUserVar('userGroupId');
     $monograph =& $this->getMonograph();
     $params = array('monographId' => $monograph->getId(), 'userGroupId' => $userGroupId, 'stageId' => $this->getStageId());
     $router =& $request->getRouter();
     $additionalVars = array('addUrl' => $router->url($request, array(), null, 'addItem', null, $params), 'deleteUrl' => $router->url($request, array(), null, 'deleteItems', null, $params));
     return parent::fetch($args, &$request, $additionalVars);
 }
Beispiel #12
0
 /**
  * @copydoc Form::execute()
  */
 function execute($request)
 {
     ListbuilderHandler::unpack($request, $this->getData('roles'));
 }
 /**
  * @copydoc GridHandler::getRowDataElement
  */
 function getRowDataElement($request, &$rowId)
 {
     // fallback on the parent if a rowId is found
     if (!empty($rowId)) {
         return parent::getRowDataElement($request, $rowId);
     }
     $id = 0;
     // Otherwise return from the newRowId
     $authorId = $this->getNewRowId($request);
     // this is an array:  Example: $authorId['name'] => 25
     if (isset($authorId['name'])) {
         $id = (int) $authorId['name'];
     }
     $authorDao = DAORegistry::getDAO('AuthorDAO');
     $monograph = $this->getMonograph();
     return $authorDao->getById($id, $monograph->getId());
 }
 /**
  * @copydoc GridHandler::getRowDataElement()
  */
 protected function getRowDataElement($request, &$rowId)
 {
     // fallback on the parent if a rowId is found
     if (!empty($rowId)) {
         return parent::getRowDataElement($request, $rowId);
     }
     // Otherwise return from the newRowId
     $newRowId = $this->getNewRowId($request);
     $fileId = (int) $newRowId['name'];
     $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
     $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
     /* @var $submissionFileDao SubmissionFileDAO */
     import('lib.pkp.classes.submission.SubmissionFile');
     // Bring in const
     $submissionFiles = $submissionFileDao->getLatestRevisions($submission->getId(), $this->getFileStage());
     foreach ($submissionFiles as $submissionFile) {
         if ($submissionFile->getFileId() == $fileId) {
             return $submissionFile;
         }
     }
     return null;
 }
 /**
  * @copydoc ListbuilderHandler::initialize()
  */
 function initialize($request)
 {
     $this->setContext($request->getContext());
     return parent::initialize($request);
 }
 /**
  * @see PKPHandler::setupTemplate()
  */
 function setupTemplate()
 {
     parent::setupTemplate();
     Locale::requireComponents(array(LOCALE_COMPONENT_OMP_EDITOR, LOCALE_COMPONENT_PKP_SUBMISSION));
 }
 /**
  * Save review form element.
  * @param $request PKPRequest
  * @return int Review form element ID
  */
 function execute($request)
 {
     $reviewFormElementDao = DAORegistry::getDAO('ReviewFormElementDAO');
     if ($this->reviewFormElementId) {
         $context = $request->getContext();
         $reviewFormElement = $reviewFormElementDao->getById($this->reviewFormElementId);
         $reviewFormDao = DAORegistry::getDAO('ReviewFormDAO');
         $reviewForm = $reviewFormDao->getById($reviewFormElement->getReviewFormId(), Application::getContextAssocType(), $context->getId());
         if (!$reviewForm) {
             fatalError('Invalid review form element ID!');
         }
     } else {
         $reviewFormElement = $reviewFormElementDao->newDataObject();
         $reviewFormElement->setReviewFormId($this->reviewFormId);
         $reviewFormElement->setSequence(REALLY_BIG_NUMBER);
     }
     $reviewFormElement->setQuestion($this->getData('question'), null);
     // Localized
     $reviewFormElement->setRequired($this->getData('required') ? 1 : 0);
     $reviewFormElement->setIncluded($this->getData('included') ? 1 : 0);
     $reviewFormElement->setElementType($this->getData('elementType'));
     if (in_array($this->getData('elementType'), ReviewFormElement::getMultipleResponsesElementTypes())) {
         $this->setData('possibleResponsesProcessed', $reviewFormElement->getPossibleResponses(null));
         ListbuilderHandler::unpack($request, $this->getData('possibleResponses'), array($this, 'deleteEntry'), array($this, 'insertEntry'), array($this, 'updateEntry'));
         $reviewFormElement->setPossibleResponses($this->getData('possibleResponsesProcessed'), null);
     } else {
         $reviewFormElement->setPossibleResponses(null, null);
     }
     if ($reviewFormElement->getId()) {
         $reviewFormElementDao->deleteSetting($reviewFormElement->getId(), 'possibleResponses');
         $reviewFormElementDao->updateObject($reviewFormElement);
     } else {
         $this->reviewFormElementId = $reviewFormElementDao->insertObject($reviewFormElement);
         $reviewFormElementDao->resequenceReviewFormElements($this->reviewFormId);
     }
     return $this->reviewFormElementId;
 }
 /**
  * @see ListbuilderHandler::getRowInstance()
  */
 protected function getRowInstance()
 {
     $row = parent::getRowInstance();
     // Currently we can't/don't need to delete a row inside multiple
     // lists listbuilder. If we need, we have to adapt this class
     // and its js handler.
     $row->setHasDeleteItemLink(false);
     return $row;
 }
Beispiel #19
0
 /**
  * @copydoc ContextSettingsForm::execute()
  */
 function execute($request)
 {
     parent::execute($request);
     // Save block plugins context positions.
     import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler');
     ListbuilderHandler::unpack($request, $request->getUserVar('blocks'));
     // Activate the selected theme plugin
     $context = $request->getContext();
     $themePlugins = PluginRegistry::loadCategory('themes');
     $selectedThemePluginPath = $this->getData('themePluginPath');
     $selectedThemePlugin = null;
     foreach ($themePlugins as $themePlugin) {
         if (basename($themePlugin->getPluginPath()) != $selectedThemePluginPath) {
             if ($themePlugin->getEnabled()) {
                 $themePlugin->setEnabled(false);
             }
         } else {
             $selectedThemePlugin = $themePlugin;
         }
     }
     if ($selectedThemePlugin) {
         // Activate the selected theme to trigger a CSS recompile.
         $selectedThemePlugin->setEnabled(true);
     } else {
         assert(false);
         // Couldn't identify the selected theme plugin
     }
 }
Beispiel #20
0
 /**
  * Save series.
  * @param $args array
  * @param $request PKPRequest
  */
 function execute($args, $request)
 {
     $seriesDao = DAORegistry::getDAO('SeriesDAO');
     $press = $request->getPress();
     // Get or create the series object
     if ($this->getSeriesId()) {
         $series = $seriesDao->getById($this->getSeriesId(), $press->getId());
     } else {
         $series = $seriesDao->newDataObject();
         $series->setPressId($press->getId());
     }
     // Populate/update the series object from the form
     $series->setPath($this->getData('path'));
     $series->setFeatured($this->getData('featured'));
     $series->setTitle($this->getData('title'), null);
     // Localized
     $series->setDescription($this->getData('description'), null);
     // Localized
     $series->setPrefix($this->getData('prefix'), null);
     // Localized
     $series->setSubtitle($this->getData('subtitle'), null);
     // Localized
     $series->setEditorRestricted($this->getData('restricted'));
     $series->setOnlineISSN($this->getData('onlineIssn'));
     $series->setPrintISSN($this->getData('printIssn'));
     $series->setSortOption($this->getData('sortOption'));
     // Insert or update the series in the DB
     if ($this->getSeriesId()) {
         $seriesDao->updateObject($series);
     } else {
         $this->setSeriesId($seriesDao->insertObject($series));
     }
     // Handle the image upload if there was one.
     if ($temporaryFileId = $this->getData('temporaryFileId')) {
         // Fetch the temporary file storing the uploaded library file
         $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
         $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $this->_userId);
         $temporaryFilePath = $temporaryFile->getFilePath();
         import('lib.pkp.classes.file.ContextFileManager');
         $pressFileManager = new ContextFileManager($press->getId());
         $basePath = $pressFileManager->getBasePath() . '/series/';
         // Delete the old file if it exists
         $oldSetting = $series->getImage();
         if ($oldSetting) {
             $pressFileManager->deleteFile($basePath . $oldSetting['thumbnailName']);
             $pressFileManager->deleteFile($basePath . $oldSetting['name']);
         }
         // The following variables were fetched in validation
         assert($this->_sizeArray && $this->_imageExtension);
         // Generate the surrogate image.
         switch ($this->_imageExtension) {
             case '.jpg':
                 $image = imagecreatefromjpeg($temporaryFilePath);
                 break;
             case '.png':
                 $image = imagecreatefrompng($temporaryFilePath);
                 break;
             case '.gif':
                 $image = imagecreatefromgif($temporaryFilePath);
                 break;
             default:
                 $image = null;
                 // Suppress warn
         }
         assert($image);
         $coverThumbnailsMaxWidth = $press->getSetting('coverThumbnailsMaxWidth');
         $coverThumbnailsMaxHeight = $press->getSetting('coverThumbnailsMaxHeight');
         $thumbnailFilename = $series->getId() . '-series-thumbnail' . $this->_imageExtension;
         $xRatio = min(1, $coverThumbnailsMaxWidth / $this->_sizeArray[0]);
         $yRatio = min(1, $coverThumbnailsMaxHeight / $this->_sizeArray[1]);
         $ratio = min($xRatio, $yRatio);
         $thumbnailWidth = round($ratio * $this->_sizeArray[0]);
         $thumbnailHeight = round($ratio * $this->_sizeArray[1]);
         $thumbnail = imagecreatetruecolor($thumbnailWidth, $thumbnailHeight);
         imagecopyresampled($thumbnail, $image, 0, 0, 0, 0, $thumbnailWidth, $thumbnailHeight, $this->_sizeArray[0], $this->_sizeArray[1]);
         // Copy the new file over
         $filename = $series->getId() . '-series' . $this->_imageExtension;
         $pressFileManager->copyFile($temporaryFile->getFilePath(), $basePath . $filename);
         switch ($this->_imageExtension) {
             case '.jpg':
                 imagejpeg($thumbnail, $basePath . $thumbnailFilename);
                 break;
             case '.png':
                 imagepng($thumbnail, $basePath . $thumbnailFilename);
                 break;
             case '.gif':
                 imagegif($thumbnail, $basePath . $thumbnailFilename);
                 break;
         }
         imagedestroy($thumbnail);
         imagedestroy($image);
         $series->setImage(array('name' => $filename, 'width' => $this->_sizeArray[0], 'height' => $this->_sizeArray[1], 'thumbnailName' => $thumbnailFilename, 'thumbnailWidth' => $thumbnailWidth, 'thumbnailHeight' => $thumbnailHeight, 'uploadName' => $temporaryFile->getOriginalFileName(), 'dateUploaded' => Core::getCurrentDate()));
         // Clean up the temporary file
         import('lib.pkp.classes.file.TemporaryFileManager');
         $temporaryFileManager = new TemporaryFileManager();
         $temporaryFileManager->deleteFile($temporaryFileId, $this->_userId);
     }
     // Update series object to store image information.
     $seriesDao->updateObject($series);
     import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler');
     // Save the series editor associations.
     ListbuilderHandler::unpack($request, $this->getData('subEditors'), array(&$this, 'deleteSubEditorEntry'), array(&$this, 'insertSubEditorEntry'), array(&$this, 'updateSubEditorEntry'));
     // Save the category associations.
     ListbuilderHandler::unpack($request, $this->getData('categories'), array(&$this, 'deleteCategoryEntry'), array(&$this, 'insertCategoryEntry'), array(&$this, 'updateCategoryEntry'));
     return true;
 }
 /**
  * @copydoc Form::readInputData()
  */
 function readInputData($request)
 {
     $this->readUserVars(array('message', 'users', 'template'));
     import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler');
     $userData = $this->getData('users');
     ListbuilderHandler::unpack($request, $userData);
 }
Beispiel #22
0
 /**
  * @copydoc Form::execute()
  * @param $request PKPRequest
  */
 function execute($request)
 {
     $queryDao = DAORegistry::getDAO('QueryDAO');
     $query = $this->getQuery();
     $headNote = $query->getHeadNote();
     $headNote->setTitle($this->getData('subject'));
     $headNote->setContents($this->getData('comment'));
     $noteDao = DAORegistry::getDAO('NoteDAO');
     $noteDao->updateObject($headNote);
     import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler');
     ListbuilderHandler::unpack($request, $this->getData('users'));
     $queryDao->updateObject($query);
     // Notify the users of a new query.
     $notificationManager = new NotificationManager();
     $user = $request->getUser();
     foreach ($queryDao->getParticipantIds($query->getId()) as $userId) {
         // Skip sending a message to the current user.
         if ($user->getId() == $userId) {
             continue;
         }
         $notificationManager->createNotification($request, $userId, NOTIFICATION_TYPE_NEW_QUERY, $request->getContext()->getId(), ASSOC_TYPE_QUERY, $query->getId(), NOTIFICATION_LEVEL_TASK);
     }
 }
Beispiel #23
0
 /**
  * @copydoc ContextSettingsForm::execute()
  */
 function execute($request)
 {
     // Clear the template cache if theme has changed
     $context = $request->getContext();
     if ($this->getData('themePluginPath') != $context->getSetting('themePluginPath')) {
         $templateMgr = TemplateManager::getManager($request);
         $templateMgr->clearTemplateCache();
         $templateMgr->clearCssCache();
     }
     parent::execute($request);
     // Save block plugins context positions.
     import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler');
     ListbuilderHandler::unpack($request, $request->getUserVar('blocks'), array($this, 'deleteEntry'), array($this, 'insertEntry'), array($this, 'updateEntry'));
 }
Beispiel #24
0
 /**
  * @copydoc Form::execute()
  * @param $request PKPRequest
  */
 function execute($request)
 {
     $queryDao = DAORegistry::getDAO('QueryDAO');
     $query = $this->getQuery();
     $headNote = $query->getHeadNote();
     $headNote->setTitle($this->getData('subject'));
     $headNote->setContents($this->getData('comment'));
     $noteDao = DAORegistry::getDAO('NoteDAO');
     $noteDao->updateObject($headNote);
     import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler');
     ListbuilderHandler::unpack($request, $this->getData('users'));
     $queryDao->updateObject($query);
 }
 /**
  * @copydoc Form::readInputData()
  */
 function readInputData($request)
 {
     $this->readUserVars(array('message', 'users', 'template'));
     import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler');
     $this->setData('userIds', array($request->getUserVar('userId')));
     $userData = $this->getData('users');
     ListbuilderHandler::unpack($request, $userData, array($this, 'deleteEntry'), array($this, 'insertEntry'), array($this, 'updateEntry'));
 }
 /**
  * Configure the grid
  * @param PKPRequest $request
  */
 function initialize($request)
 {
     parent::initialize($request);
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_APP_SUBMISSION);
     // Basic configuration
     $this->setPress($request->getPress());
     $this->setTitle('submission.submit.placement.categories');
     $this->setSourceType(LISTBUILDER_SOURCE_TYPE_SELECT);
     $this->setSaveType(LISTBUILDER_SAVE_TYPE_EXTERNAL);
     $this->setSaveFieldName('categories');
     $this->setSubmissionId($request->getUserVar('submissionId'));
     // Name column
     $nameColumn = new ListbuilderGridColumn($this, 'name', 'common.name');
     import('controllers.listbuilder.categories.CategoryListbuilderGridCellProvider');
     $nameColumn->setCellProvider(new CategoryListbuilderGridCellProvider());
     $this->addColumn($nameColumn);
 }
 /**
  * @copydoc GridHandler::getRowDataElement
  */
 protected function getRowDataElement($request, &$rowId)
 {
     // fallback on the parent if a rowId is found
     if (!empty($rowId)) {
         return parent::getRowDataElement($request, $rowId);
     }
     // Otherwise return from the $newRowId
     $newRowId = $this->getNewRowId($request);
     $userGroupId = $newRowId['name'];
     $userGroupDao = DAORegistry::getDAO('UserGroupDAO');
     $context = $this->getContext();
     return $userGroupDao->getById($userGroupId, $context->getId());
 }
 /**
  * @copydoc Form::execute()
  */
 function execute($request)
 {
     $site = $request->getSite();
     $site->updateSetting('categoriesEnabled', (int) $this->getData('categoriesEnabled'));
     ListbuilderHandler::unpack($request, $this->getData('categories'));
 }
Beispiel #29
0
 /**
  * Save section.
  * @param $args array
  * @param $request PKPRequest
  */
 function execute($args, $request)
 {
     $sectionDao = DAORegistry::getDAO('SectionDAO');
     $journal = $request->getJournal();
     // Get or create the section object
     if ($this->getSectionId()) {
         $section = $sectionDao->getById($this->getSectionId(), $journal->getId());
     } else {
         import('classes.journal.Section');
         $section = $sectionDao->newDataObject();
         $section->setJournalId($journal->getId());
     }
     // Populate/update the section object from the form
     $section->setTitle($this->getData('title'), null);
     // Localized
     $section->setAbbrev($this->getData('abbrev'), null);
     // Localized
     $reviewFormId = $this->getData('reviewFormId');
     if ($reviewFormId === '') {
         $reviewFormId = null;
     }
     $section->setReviewFormId($reviewFormId);
     $section->setMetaIndexed($this->getData('metaIndexed') ? 0 : 1);
     // #2066: Inverted
     $section->setMetaReviewed($this->getData('metaReviewed') ? 0 : 1);
     // #2066: Inverted
     $section->setAbstractsNotRequired($this->getData('abstractsNotRequired') ? 1 : 0);
     $section->setIdentifyType($this->getData('identifyType'), null);
     // Localized
     $section->setEditorRestricted($this->getData('editorRestriction') ? 1 : 0);
     $section->setHideTitle($this->getData('hideTitle') ? 1 : 0);
     $section->setHideAuthor($this->getData('hideAuthor') ? 1 : 0);
     $section->setHideAbout($this->getData('hideAbout') ? 1 : 0);
     $section->setPolicy($this->getData('policy'), null);
     // Localized
     $section->setAbstractWordCount($this->getData('wordCount'));
     $section = parent::execute($section);
     // Insert or update the section in the DB
     if ($this->getSectionId()) {
         $sectionDao->updateObject($section);
     } else {
         $section->setSequence(REALLY_BIG_NUMBER);
         $this->setSectionId($sectionDao->insertObject($section));
         $sectionDao->resequenceSections($journal->getId());
     }
     import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler');
     // Save the section editor associations.
     ListbuilderHandler::unpack($request, $this->getData('subEditors'), array(&$this, 'deleteSubEditorEntry'), array(&$this, 'insertSubEditorEntry'), array(&$this, 'updateSubEditorEntry'));
     return true;
 }
 /**
  * Fetch the listbuilder.
  * @param $args array
  * @param $request PKPRequest
  */
 function fetch($args, &$request)
 {
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign_by_ref('lists', $this->getLists());
     return parent::fetch($args, $request);
 }