本文整理汇总了PHP中ListbuilderHandler类的典型用法代码示例。如果您正苦于以下问题:PHP ListbuilderHandler类的具体用法?PHP ListbuilderHandler怎么用?PHP ListbuilderHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ListbuilderHandler类的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: fetch
/**
* @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);
}
示例7: execute
/**
* @copydoc Form::execute()
*/
function execute($request)
{
ListbuilderHandler::unpack($request, $this->getData('roles'));
}
示例8: initialize
/**
* @copydoc ListbuilderHandler::initialize()
*/
function initialize($request)
{
$this->setContext($request->getContext());
return parent::initialize($request);
}
示例9: 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;
}
示例10: getRowInstance
/**
* @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;
}
示例11: 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
}
}
示例12: 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;
}
示例13: fetch
/**
* 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);
}
示例14: getRowDataElement
/**
* @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);
}
示例15: getRowDataElement
/**
* @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;
}