本文整理汇总了PHP中ListbuilderHandler::unpack方法的典型用法代码示例。如果您正苦于以下问题:PHP ListbuilderHandler::unpack方法的具体用法?PHP ListbuilderHandler::unpack怎么用?PHP ListbuilderHandler::unpack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListbuilderHandler
的用法示例。
在下文中一共展示了ListbuilderHandler::unpack方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* 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;
}
示例2: readInputData
/**
* 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'));
}
示例3: execute
/**
* 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;
}
示例4: isValid
/**
* 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;
}
}
示例5: execute
/**
* @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);
}
示例6: readInputData
/**
* @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'));
}
示例7: execute
/**
* @copydoc Form::execute()
*/
function execute($request)
{
ListbuilderHandler::unpack($request, $this->getData('roles'));
}
示例8: execute
/**
* @copydoc Form::execute()
*/
function execute($request)
{
ListbuilderHandler::unpack($request, $this->getData('roles'), array($this, 'deleteEntry'), array($this, 'insertEntry'), array($this, 'updateEntry'));
}
示例9: execute
//.........这里部分代码省略.........
$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;
}
示例10: execute
/**
* 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;
}
示例11: execute
/**
* Assign user to copyedit the selected files
* @see Form::execute()
*/
function execute($request)
{
// Decode the "files" list
import('lib.pkp.classes.controllers.listbuilder.ListbuilderHandler');
ListbuilderHandler::unpack($request, $this->getData('files'));
// Send the message to the user
$submission = $this->getSubmission();
import('lib.pkp.classes.mail.SubmissionMailTemplate');
$email = new SubmissionMailTemplate($submission, 'AUDITOR_REQUEST', null, null, null, false);
$email->setBody($this->getData('personalMessage'));
$userDao = DAORegistry::getDAO('UserDAO');
/* @var $userDao UserDAO */
// FIXME: How to validate user IDs?
$user = $userDao->getById($this->getData('userId'));
import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider');
list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission, $user->getId());
$dispatcher = $request->getDispatcher();
$auditUrl = $dispatcher->url($request, ROUTE_PAGE, null, $page, $operation, array('submissionId' => $submission->getId()));
// Other parameters assigned above; see bug #7090.
$email->assignParams(array('auditorName' => $user->getFullName(), 'auditorUserName' => $user->getUsername(), 'auditUrl' => $auditUrl));
$email->addRecipient($user->getEmail(), $user->getFullName());
$email->setEventType($this->getEventType());
if (!$this->getData('skipEmail')) {
$email->send($request);
}
}
示例12: readInputData
/**
* @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);
}
示例13: execute
/**
* @copydoc Form::execute()
*/
function execute($request)
{
$footerCategoryDao = DAORegistry::getDAO('FooterCategoryDAO');
$footerCategory = $this->getFooterCategory();
if (!$footerCategory) {
// this is a new footerCategory
$footerCategory = $footerCategoryDao->newDataObject();
$footerCategory->setContextId($this->getContextId());
$existingFooterCategory = false;
} else {
$existingFooterCategory = true;
}
$footerCategory->setTitle($this->getData('title'), null);
// localized
$footerCategory->setDescription($this->getData('description'), null);
// localized
$footerCategory->setPath($this->getData('path'));
if ($existingFooterCategory) {
$footerCategoryDao->updateObject($footerCategory);
$footerCategoryId = $footerCategory->getId();
} else {
$footerCategoryId = $footerCategoryDao->insertObject($footerCategory);
$this->setFooterCategory($footerCategory);
// so insertEntry() has it for new FooterLinks
}
// for the footer links in the listbuilder.
ListbuilderHandler::unpack($request, $this->getData('footerLinks'));
return $footerCategoryId;
}
示例14: execute
/**
* @copydoc Form::execute()
*/
function execute($request)
{
$site = $request->getSite();
$site->updateSetting('categoriesEnabled', (int) $this->getData('categoriesEnabled'));
ListbuilderHandler::unpack($request, $this->getData('categories'));
}
示例15: execute
/**
* @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
}
}