本文整理汇总了PHP中DAORegistry类的典型用法代码示例。如果您正苦于以下问题:PHP DAORegistry类的具体用法?PHP DAORegistry怎么用?PHP DAORegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DAORegistry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: articleToTemporaryFile
/**
* Create a new temporary file from an article file.
* @param $articleFile object
* @param $userId int
* @return object The new TemporaryFile or false on failure
*/
function articleToTemporaryFile($articleFile, $userId)
{
// Get the file extension, then rename the file.
$fileExtension = $this->parseFileExtension($articleFile->getFileName());
if (!$this->fileExists($this->filesDir, 'dir')) {
// Try to create destination directory
$this->mkdirtree($this->filesDir);
}
$newFileName = basename(tempnam($this->filesDir, $fileExtension));
if (!$newFileName) {
return false;
}
if (copy($articleFile->getFilePath(), $this->filesDir . $newFileName)) {
$temporaryFileDao =& DAORegistry::getDAO('TemporaryFileDAO');
$temporaryFile = new TemporaryFile();
$temporaryFile->setUserId($userId);
$temporaryFile->setFileName($newFileName);
$temporaryFile->setFileType($articleFile->getFileType());
$temporaryFile->setFileSize($articleFile->getFileSize());
$temporaryFile->setOriginalFileName($articleFile->getOriginalFileName());
$temporaryFile->setDateUploaded(Core::getCurrentDate());
$temporaryFileDao->insertTemporaryFile($temporaryFile);
return $temporaryFile;
} else {
return false;
}
}
开发者ID:master3395,项目名称:CBPPlatform,代码行数:33,代码来源:TemporaryFileManager.inc.php
示例2: viewBookForReview
/**
* Public view book for review details.
*/
function viewBookForReview($args = array(), &$request)
{
$this->setupTemplate(true);
$journal =& $request->getJournal();
$journalId = $journal->getId();
$bfrPlugin =& PluginRegistry::getPlugin('generic', BOOKS_FOR_REVIEW_PLUGIN_NAME);
$bookId = !isset($args) || empty($args) ? null : (int) $args[0];
$bfrDao =& DAORegistry::getDAO('BookForReviewDAO');
// Ensure book for review is valid and for this journal
if ($bfrDao->getBookForReviewJournalId($bookId) == $journalId) {
$book =& $bfrDao->getBookForReview($bookId);
$bfrPlugin->import('classes.BookForReview');
// Ensure book is still available
if ($book->getStatus() == BFR_STATUS_AVAILABLE) {
$isAuthor = Validation::isAuthor();
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$coverPagePath = $request->getBaseUrl() . '/';
$coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('coverPagePath', $coverPagePath);
$templateMgr->assign('locale', AppLocale::getLocale());
$templateMgr->assign_by_ref('bookForReview', $book);
$templateMgr->assign('isAuthor', $isAuthor);
$templateMgr->display($bfrPlugin->getTemplatePath() . 'bookForReview.tpl');
}
}
$request->redirect(null, 'booksForReview');
}
开发者ID:yuricampos,项目名称:ojs,代码行数:32,代码来源:BooksForReviewHandler.inc.php
示例3: execute
/**
* Save group group.
*/
function execute()
{
$groupDao =& DAORegistry::getDAO('GroupDAO');
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
if (!isset($this->group)) {
$this->group = new Group();
}
$this->group->setAssocType(ASSOC_TYPE_SCHED_CONF);
$this->group->setAssocId($schedConf->getId());
$this->group->setTitle($this->getData('title'), null);
// Localized
$this->group->setPublishEmail($this->getData('publishEmail'));
// Eventually this will be a general Groups feature; for now,
// we're just using it to display conference team entries in About.
$this->group->setAboutDisplayed(true);
// Update or insert group group
if ($this->group->getId() != null) {
$groupDao->updateObject($this->group);
} else {
$this->group->setSequence(REALLY_BIG_NUMBER);
$groupDao->insertGroup($this->group);
// Re-order the groups so the new one is at the end of the list.
$groupDao->resequenceGroups($this->group->getAssocType(), $this->group->getAssocId());
}
}
开发者ID:ramonsodoma,项目名称:ocs,代码行数:29,代码来源:GroupForm.inc.php
示例4: array
/**
* Retrieve all published submissions associated with authors with
* the given first name, middle name, last name, affiliation, and country.
* @param $journalId int (null if no restriction desired)
* @param $firstName string
* @param $middleName string
* @param $lastName string
* @param $affiliation string
* @param $country string
*/
function &getPublishedArticlesForAuthor($journalId, $firstName, $middleName, $lastName, $affiliation, $country)
{
$publishedArticles = array();
$publishedArticleDao = DAORegistry::getDAO('PublishedArticleDAO');
$params = array('affiliation', $firstName, $middleName, $lastName, $affiliation, $country);
if ($journalId !== null) {
$params[] = (int) $journalId;
}
$result = $this->retrieve('SELECT DISTINCT
aa.submission_id
FROM authors aa
LEFT JOIN submissions a ON (aa.submission_id = a.submission_id)
LEFT JOIN author_settings asl ON (asl.author_id = aa.author_id AND asl.setting_name = ?)
WHERE aa.first_name = ?
AND a.status = ' . STATUS_PUBLISHED . '
AND (aa.middle_name = ?' . (empty($middleName) ? ' OR aa.middle_name IS NULL' : '') . ')
AND aa.last_name = ?
AND (asl.setting_value = ?' . (empty($affiliation) ? ' OR asl.setting_value IS NULL' : '') . ')
AND (aa.country = ?' . (empty($country) ? ' OR aa.country IS NULL' : '') . ') ' . ($journalId !== null ? ' AND a.context_id = ?' : ''), $params);
while (!$result->EOF) {
$row = $result->getRowAssoc(false);
$publishedArticle = $publishedArticleDao->getPublishedArticleByArticleId($row['submission_id']);
if ($publishedArticle) {
$publishedArticles[] = $publishedArticle;
}
$result->MoveNext();
}
$result->Close();
return $publishedArticles;
}
开发者ID:utslibrary,项目名称:ojs,代码行数:40,代码来源:AuthorDAO.inc.php
示例5: dataObjectEffect
/**
* @see DataObjectRequiredPolicy::dataObjectEffect()
*/
function dataObjectEffect()
{
$reviewId = (int) $this->getDataObjectId();
if (!$reviewId) {
return AUTHORIZATION_DENY;
}
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
/* @var $reviewAssignmentDao ReviewAssignmentDAO */
$reviewAssignment = $reviewAssignmentDao->getById($reviewId);
if (!is_a($reviewAssignment, 'ReviewAssignment')) {
return AUTHORIZATION_DENY;
}
// Ensure that the review assignment actually belongs to the
// authorized submission.
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
assert(is_a($submission, 'Submission'));
if ($reviewAssignment->getSubmissionId() != $submission->getId()) {
AUTHORIZATION_DENY;
}
// Ensure that the review assignment is for this workflow stage
$stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
if ($reviewAssignment->getStageId() != $stageId) {
return AUTHORIZATION_DENY;
}
// Save the review Assignment to the authorization context.
$this->addAuthorizedContextObject(ASSOC_TYPE_REVIEW_ASSIGNMENT, $reviewAssignment);
return AUTHORIZATION_PERMIT;
}
开发者ID:doana,项目名称:pkp-lib,代码行数:31,代码来源:ReviewAssignmentRequiredPolicy.inc.php
示例6: effect
/**
* @see AuthorizationPolicy::effect()
*/
function effect()
{
$request = $this->getRequest();
// Get the user
$user = $request->getUser();
if (!is_a($user, 'PKPUser')) {
return AUTHORIZATION_DENY;
}
// Get the submission file
$submissionFile = $this->getSubmissionFile($request);
if (!is_a($submissionFile, 'SubmissionFile')) {
return AUTHORIZATION_DENY;
}
// Check if it's associated with a note.
if ($submissionFile->getAssocType() != ASSOC_TYPE_NOTE) {
return AUTHORIZATION_DENY;
}
$noteDao = DAORegistry::getDAO('NoteDAO');
$note = $noteDao->getById($submissionFile->getAssocId());
if (!is_a($note, 'Note')) {
return AUTHORIZATION_DENY;
}
if ($note->getAssocType() != ASSOC_TYPE_QUERY) {
return AUTHORIZATION_DENY;
}
$queryDao = DAORegistry::getDAO('QueryDAO');
$query = $queryDao->getById($note->getAssocId());
if (!$query) {
return AUTHORIZATION_DENY;
}
if ($queryDao->getParticipantIds($note->getAssocId(), $user->getId())) {
return AUTHORIZATION_PERMIT;
}
return AUTHORIZATION_DENY;
}
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:38,代码来源:SubmissionFileAssignedQueryAccessPolicy.inc.php
示例7: fetch
/**
* Fetch the form
* @param $request Request
*/
function fetch($request)
{
$templateMgr = TemplateManager::getManager($request);
$baseUrl = $templateMgr->_request->getBaseUrl();
// Add extra java script required for ajax components
// FIXME: Must be removed after OMP->OJS backporting
// NOTE: I believe this needs attention. jquery.validate.min.js is
// loaded with our minifiedScripts.tpl list and includes some i18n
// features.
$templateMgr->addJavaScript('citation', $baseUrl . '/lib/pkp/js/functions/citation.js', array('contexts' => 'backend'));
$templateMgr->addJavaScript('jqueryValidate', $baseUrl . '/lib/pkp/js/lib/jquery/plugins/validate/jquery.validate.min.js', array('contexts' => 'backend'));
$templateMgr->addJavaScript('jqueryValidatorI18n', $baseUrl . '/lib/pkp/js/functions/jqueryValidatorI18n.js', array('contexts' => 'backend'));
//
// Citation editor filter configuration
//
// 1) Add the filter grid URLs
$dispatcher = $request->getDispatcher();
$parserFilterGridUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'grid.filter.ParserFilterGridHandler', 'fetchGrid');
$templateMgr->assign('parserFilterGridUrl', $parserFilterGridUrl);
$lookupFilterGridUrl = $dispatcher->url($request, ROUTE_COMPONENT, null, 'grid.filter.LookupFilterGridHandler', 'fetchGrid');
$templateMgr->assign('lookupFilterGridUrl', $lookupFilterGridUrl);
// 2) Create a list of all available citation output filters.
$router = $request->getRouter();
$journal = $router->getContext($request);
$filterDao = DAORegistry::getDAO('FilterDAO');
/* @var $filterDao FilterDAO */
$metaCitationOutputFilterObjects = $filterDao->getObjectsByGroup('nlm30-element-citation=>plaintext', $journal->getId());
foreach ($metaCitationOutputFilterObjects as $metaCitationOutputFilterObject) {
$metaCitationOutputFilters[$metaCitationOutputFilterObject->getId()] = $metaCitationOutputFilterObject->getDisplayName();
}
$templateMgr->assign_by_ref('metaCitationOutputFilters', $metaCitationOutputFilters);
return parent::fetch($request);
}
开发者ID:bkroll,项目名称:ojs,代码行数:37,代码来源:CitationsForm.inc.php
示例8: getTemplateVarsFromRowColumn
/**
* Extracts variables for a given column from a data element
* so that they may be assigned to template before rendering.
* @param $row GridRow
* @param $column GridColumn
* @return array
*/
function getTemplateVarsFromRowColumn(&$row, &$column)
{
$element =& $row->getData();
$columnId = $column->getId();
assert(is_a($element, 'MonographFile') && !empty($columnId));
// Numeric columns indicate a role-based column.
if (is_numeric($columnId)) {
if ($columnId == $element->getUserGroupId()) {
// Show that this column's user group is the submitter
return array('status' => 'uploaded');
}
// If column is not the submitter, cell is always empty.
return array('status' => '');
}
// all other columns
switch ($columnId) {
case 'select':
return array('rowId' => $element->getFileId() . "-" . $element->getRevision());
case 'name':
return array('label' => $element->getLocalizedName());
case 'type':
$genreDao =& DAORegistry::getDAO('GenreDAO');
$genre = $genreDao->getById($element->getGenreId());
return array('label' => $genre->getLocalizedName());
}
}
开发者ID:ramonsodoma,项目名称:omp,代码行数:33,代码来源:RevisionsGridCellProvider.inc.php
示例9: getTargetContext
/**
* Returns a "best-guess" journal, based in the request data, if
* a request needs to have one in its context but may be in a site-level
* context as specified in the URL.
* @param $request Request
* @param $journalsCount int Optional reference to receive journals count
* @return mixed Either a Journal or null if none could be determined.
*/
function getTargetContext($request, &$journalsCount = null)
{
// Get the requested path.
$router = $request->getRouter();
$requestedPath = $router->getRequestedContextPath($request);
if ($requestedPath === 'index' || $requestedPath === '') {
// No journal requested. Check how many journals the site has.
$journalDao = DAORegistry::getDAO('JournalDAO');
/* @var $journalDao JournalDAO */
$journals = $journalDao->getAll();
$journalsCount = $journals->getCount();
$journal = null;
if ($journalsCount === 1) {
// Return the unique journal.
$journal = $journals->next();
}
if (!$journal && $journalsCount > 1) {
// Get the site redirect.
$journal = $this->getSiteRedirectContext($request);
}
} else {
// Return the requested journal.
$journal = $router->getContext($request);
}
if (is_a($journal, 'Journal')) {
return $journal;
}
return null;
}
开发者ID:mosvits,项目名称:ojs,代码行数:37,代码来源:Handler.inc.php
示例10: dataObjectEffect
/**
* @see DataObjectRequiredPolicy::dataObjectEffect()
*/
function dataObjectEffect()
{
$queryId = (int) $this->getDataObjectId();
if (!$queryId) {
return AUTHORIZATION_DENY;
}
// Make sure the query belongs to the submission.
$queryDao = DAORegistry::getDAO('QueryDAO');
$query = $queryDao->getById($queryId);
if (!is_a($query, 'Query')) {
return AUTHORIZATION_DENY;
}
switch ($query->getAssocType()) {
case ASSOC_TYPE_SUBMISSION:
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
if (!is_a($submission, 'Submission')) {
return AUTHORIZATION_DENY;
}
if ($query->getAssocId() != $submission->getId()) {
return AUTHORIZATION_DENY;
}
break;
default:
return AUTHORIZATION_DENY;
}
// Save the query to the authorization context.
$this->addAuthorizedContextObject(ASSOC_TYPE_QUERY, $query);
return AUTHORIZATION_PERMIT;
}
开发者ID:jprk,项目名称:pkp-lib,代码行数:32,代码来源:QueryRequiredPolicy.inc.php
示例11: initialize
function initialize(&$request)
{
parent::initialize($request);
import('classes.file.LibraryFileManager');
$libraryFileManager = new LibraryFileManager();
// Fetch and validate fileType (validated in getNameFromType)
$fileType = (int) $request->getUserVar('fileType');
$this->setFileType($fileType);
$name = $libraryFileManager->getNameFromType($this->getFileType());
// Basic grid configuration
$this->setId('libraryFile' . ucwords(strtolower($name)));
$this->setTitle("grid.libraryFiles.{$name}.title");
Locale::requireComponents(array(LOCALE_COMPONENT_PKP_COMMON, LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_SUBMISSION));
// Elements to be displayed in the grid
$router =& $request->getRouter();
$context =& $router->getContext($request);
$libraryFileDao =& DAORegistry::getDAO('LibraryFileDAO');
$libraryFiles =& $libraryFileDao->getByPressId($context->getId(), $this->getFileType());
$this->setGridDataElements($libraryFiles);
// Add grid-level actions
$this->addAction(new LinkAction('addFile', new AjaxModal($router->url($request, null, null, 'addFile', null, array('fileType' => $this->getFileType())), __('grid.action.addItem'), 'fileManagement'), __('grid.action.addItem'), 'add_item'));
// Columns
// Basic grid row configuration
import('controllers.grid.settings.library.LibraryFileGridCellProvider');
$this->addColumn(new GridColumn('files', 'grid.libraryFiles.column.files', null, 'controllers/grid/gridCell.tpl', new LibraryFileGridCellProvider()));
}
开发者ID:jerico-dev,项目名称:omp,代码行数:26,代码来源:LibraryFileGridHandler.inc.php
示例12: getCellState
/**
* Gathers the state of a given cell given a $row/$column combination
* @param $row GridRow
* @param $column GridColumn
* @return string
*/
function getCellState(&$row, &$column)
{
$element =& $row->getData();
$columnId = $column->getId();
assert(is_a($element, 'DataObject') && !empty($columnId));
switch ($columnId) {
case 'name':
return $element->getDateCompleted() ? 'linkReview' : '';
case is_numeric($columnId):
// numeric implies a role column.
if ($element->getDateCompleted()) {
$viewsDao =& DAORegistry::getDAO('ViewsDAO');
$sessionManager =& SessionManager::getManager();
$session =& $sessionManager->getUserSession();
$user =& $session->getUser();
$lastViewed = $viewsDao->getLastViewDate(ASSOC_TYPE_REVIEW_RESPONSE, $element->getId(), $user->getId());
if ($lastViewed) {
return 'completed';
} else {
return 'new';
}
} else {
return '';
}
case 'reviewer':
if ($element->getDateCompleted()) {
return 'completed';
} elseif ($element->getDateDue() < Core::getCurrentDate()) {
return 'overdue';
} elseif ($element->getDateConfirmed()) {
return $element->getDeclined() ? 'declined' : 'accepted';
}
return 'new';
}
}
开发者ID:ramonsodoma,项目名称:omp,代码行数:41,代码来源:ReviewerGridCellProvider.inc.php
示例13: FileLoader
/**
* Constructor.
* @param $args array script arguments
*/
function FileLoader($args)
{
parent::ScheduledTask($args);
// Set an initial process id and load translations (required
// for email notifications).
AppLocale::requireComponents(LOCALE_COMPONENT_PKP_ADMIN);
$this->_newProcessId();
// Canonicalize the base path.
$basePath = rtrim($args[0], DIRECTORY_SEPARATOR);
$basePathFolder = basename($basePath);
// We assume that the parent folder of the base path
// does already exist and can be canonicalized.
$basePathParent = realpath(dirname($basePath));
if ($basePathParent === false) {
$basePath = null;
} else {
$basePath = $basePathParent . DIRECTORY_SEPARATOR . $basePathFolder;
}
$this->_basePath = $basePath;
// Configure paths.
if (!is_null($basePath)) {
$this->_stagePath = $basePath . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_STAGING;
$this->_archivePath = $basePath . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_ARCHIVE;
$this->_rejectPath = $basePath . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_REJECT;
$this->_processingPath = $basePath . DIRECTORY_SEPARATOR . FILE_LOADER_PATH_PROCESSING;
}
// Set admin email and name.
$siteDao = DAORegistry::getDAO('SiteDAO');
/* @var $siteDao SiteDAO */
$site = $siteDao->getSite();
/* @var $site Site */
$this->_adminEmail = $site->getLocalizedContactEmail();
$this->_adminName = $site->getLocalizedContactName();
}
开发者ID:doana,项目名称:pkp-lib,代码行数:38,代码来源:FileLoader.inc.php
示例14:
/**
* Return a list of countries eligible as publication countries.
* @return array
*/
function &_getCountries()
{
$countryDao =& DAORegistry::getDAO('CountryDAO');
/* @var $countryDao CountryDAO */
$countries =& $countryDao->getCountries();
return $countries;
}
开发者ID:yuricampos,项目名称:ojs,代码行数:11,代码来源:MedraSettingsForm.inc.php
示例15: createPKPAuthorNode
/**
* Create and return an author node.
* @param $doc DOMDocument
* @param $author PKPAuthor
* @return DOMElement
*/
function createPKPAuthorNode($doc, $author)
{
$deployment = $this->getDeployment();
$context = $deployment->getContext();
// Create the author node
$authorNode = $doc->createElementNS($deployment->getNamespace(), 'author');
if ($author->getPrimaryContact()) {
$authorNode->setAttribute('primary_contact', 'true');
}
if ($author->getIncludeInBrowse()) {
$authorNode->setAttribute('include_in_browse', 'true');
}
$userGroupDao = DAORegistry::getDAO('UserGroupDAO');
$userGroup = $userGroupDao->getById($author->getUserGroupId());
assert($userGroup);
$authorNode->setAttribute('user_group_ref', $userGroup->getName($context->getPrimaryLocale()));
// Add metadata
$authorNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'firstname', $author->getFirstName()));
$this->createOptionalNode($doc, $authorNode, 'middlename', $author->getMiddleName());
$authorNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'lastname', $author->getLastName()));
$this->createLocalizedNodes($doc, $authorNode, 'affiliation', $author->getAffiliation(null));
$this->createOptionalNode($doc, $authorNode, 'country', $author->getCountry());
$authorNode->appendChild($doc->createElementNS($deployment->getNamespace(), 'email', $author->getEmail()));
$this->createOptionalNode($doc, $authorNode, 'url', $author->getUrl());
$this->createLocalizedNodes($doc, $authorNode, 'biography', $author->getBiography(null));
return $authorNode;
}
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:33,代码来源:PKPAuthorNativeXmlFilter.inc.php
示例16: execute
/**
* Save changes to article.
* @param $request Request
* @return int the article ID
*/
function execute(&$request)
{
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$article =& $this->article;
$articleContact = new ArticleContact();
$articleContact->setArticleId($article->getId());
$articleContact->setPQName($this->getData('pqName'));
$articleContact->setPQAffiliation($this->getData('pqAffiliation'));
$articleContact->setPQAddress($this->getData('pqAddress'));
$articleContact->setPQCountry($this->getData('pqCountry'));
$articleContact->setPQPhone($this->getData('pqPhone'));
$articleContact->setPQFax($this->getData('pqFax'));
$articleContact->setPQEmail($this->getData('pqEmail'));
$articleContact->setSQName($this->getData('sqName'));
$articleContact->setSQAffiliation($this->getData('sqAffiliation'));
$articleContact->setSQAddress($this->getData('sqAddress'));
$articleContact->setSQCountry($this->getData('sqCountry'));
$articleContact->setSQPhone($this->getData('sqPhone'));
$articleContact->setSQFax($this->getData('sqFax'));
$articleContact->setSQEmail($this->getData('sqEmail'));
$article->setArticleContact($articleContact);
//update step
if ($article->getSubmissionProgress() <= $this->step) {
$article->stampStatusModified();
$article->setSubmissionProgress($this->step + 1);
} elseif ($article->getSubmissionProgress() == 9) {
$article->setSubmissionProgress(8);
}
parent::execute();
// Save the article
$articleDao->updateArticle($article);
return $this->articleId;
}
开发者ID:elavaud,项目名称:hrp_ct,代码行数:38,代码来源:AuthorSubmitStep6Form.inc.php
示例17: getHTMLContents
/**
* Return string containing the contents of the HTML file.
* This function performs any necessary filtering, like image URL replacement.
* @param $baseImageUrl string base URL for image references
* @return string
*/
function getHTMLContents()
{
import('file.ArticleFileManager');
$fileManager =& new ArticleFileManager($this->getArticleId());
$contents = $fileManager->readFile($this->getFileId());
$journal =& Request::getJournal();
// Replace media file references
$images =& $this->getImageFiles();
foreach ($images as $image) {
$imageUrl = Request::url(null, 'article', 'viewFile', array($this->getArticleId(), $this->getBestGalleyId($journal), $image->getFileId()));
$pattern = preg_quote(rawurlencode($image->getOriginalFileName()));
$contents = preg_replace('/([Ss][Rr][Cc]|[Hh][Rr][Ee][Ff]|[Dd][Aa][Tt][Aa])\\s*=\\s*"([^"]*' . $pattern . ')"/', '\\1="' . $imageUrl . '"', $contents);
// Replacement for Flowplayer
$contents = preg_replace('/[Uu][Rr][Ll]\\s*\\:\\s*\'(' . $pattern . ')\'/', 'url:\'' . $imageUrl . '\'', $contents);
// Replacement for other players (ested with odeo; yahoo and google player won't work w/ OJS URLs, might work for others)
$contents = preg_replace('/[Uu][Rr][Ll]=([^"]*' . $pattern . ')/', 'url=' . $imageUrl, $contents);
}
// Perform replacement for ojs://... URLs
$contents = String::regexp_replace_callback('/(<[^<>]*")[Oo][Jj][Ss]:\\/\\/([^"]+)("[^<>]*>)/', array(&$this, '_handleOjsUrl'), $contents);
// Perform variable replacement for journal, issue, site info
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getIssueByArticleId($this->getArticleId());
$journal =& Request::getJournal();
$site =& Request::getSite();
$paramArray = array('issueTitle' => $issue ? $issue->getIssueIdentification() : Locale::translate('editor.article.scheduleForPublication.toBeAssigned'), 'journalTitle' => $journal->getJournalTitle(), 'siteTitle' => $site->getSiteTitle(), 'currentUrl' => Request::getRequestUrl());
foreach ($paramArray as $key => $value) {
$contents = str_replace('{$' . $key . '}', $value, $contents);
}
return $contents;
}
开发者ID:Jouper,项目名称:jouper,代码行数:36,代码来源:ArticleHTMLGalley.inc.php
示例18: execute
/**
* Save email template.
*/
function execute()
{
$journal =& Request::getJournal();
$emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
$emailTemplate =& $emailTemplateDao->getLocaleEmailTemplate($this->emailKey, $journal->getJournalId());
if (!$emailTemplate) {
$emailTemplate =& new LocaleEmailTemplate();
$emailTemplate->setCustomTemplate(true);
$emailTemplate->setCanDisable(false);
$emailTemplate->setEnabled(true);
$emailTemplate->setEmailKey($this->getData('emailKey'));
} else {
$emailTemplate->setEmailId($this->getData('emailId'));
if ($emailTemplate->getCanDisable()) {
$emailTemplate->setEnabled($this->getData('enabled'));
}
}
$emailTemplate->setJournalId($journal->getJournalId());
$supportedLocales = $journal->getSupportedLocaleNames();
if (!empty($supportedLocales)) {
foreach ($journal->getSupportedLocaleNames() as $localeKey => $localeName) {
$emailTemplate->setSubject($localeKey, $this->_data['subject'][$localeKey]);
$emailTemplate->setBody($localeKey, $this->_data['body'][$localeKey]);
}
} else {
$localeKey = Locale::getLocale();
$emailTemplate->setSubject($localeKey, $this->_data['subject'][$localeKey]);
$emailTemplate->setBody($localeKey, $this->_data['body'][$localeKey]);
}
if ($emailTemplate->getEmailId() != null) {
$emailTemplateDao->updateLocaleEmailTemplate($emailTemplate);
} else {
$emailTemplateDao->insertLocaleEmailTemplate($emailTemplate);
}
}
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:38,代码来源:EmailTemplateForm.inc.php
示例19: saveSettings
function saveSettings()
{
RTAdminHandler::validate();
// Bring in the comments constants.
$commentDao =& DAORegistry::getDao('CommentDAO');
$journal = Request::getJournal();
if ($journal) {
$rtDao =& DAORegistry::getDAO('RTDAO');
$rt = $rtDao->getJournalRTByJournal($journal);
if (Request::getUserVar('version') == '') {
$rt->setVersion(null);
} else {
$rt->setVersion(Request::getUserVar('version'));
}
$rt->setEnabled(Request::getUserVar('enabled') == true);
$rt->setAbstract(Request::getUserVar('abstract') == true);
$rt->setCaptureCite(Request::getUserVar('captureCite') == true);
$rt->setViewMetadata(Request::getUserVar('viewMetadata') == true);
$rt->setSupplementaryFiles(Request::getUserVar('supplementaryFiles') == true);
$rt->setPrinterFriendly(Request::getUserVar('printerFriendly') == true);
$rt->setAuthorBio(Request::getUserVar('authorBio') == true);
$rt->setDefineTerms(Request::getUserVar('defineTerms') == true);
$rt->setEmailAuthor(Request::getUserVar('emailAuthor') == true);
$rt->setEmailOthers(Request::getUserVar('emailOthers') == true);
$rt->setFindingReferences(Request::getUserVar('findingReferences') == true);
$journal->updateSetting('enableComments', Request::getUserVar('enableComments') ? Request::getUserVar('enableCommentsMode') : COMMENTS_DISABLED);
$rtDao->updateJournalRT($rt);
}
Request::redirect(null, Request::getRequestedPage());
}
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:30,代码来源:RTSetupHandler.inc.php
示例20: fetchReviewRoundInfo
/**
* Fetch information for the author on the specified review round
* @param $args array
* @param $request Request
* @return JSONMessage JSON object
*/
function fetchReviewRoundInfo($args, $request)
{
$this->setupTemplate($request);
$templateMgr = TemplateManager::getManager($request);
$stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
if ($stageId !== WORKFLOW_STAGE_ID_INTERNAL_REVIEW && $stageId !== WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) {
fatalError('Invalid Stage Id');
}
$templateMgr->assign('stageId', $stageId);
$reviewRound = $this->getAuthorizedContextObject(ASSOC_TYPE_REVIEW_ROUND);
$templateMgr->assign('reviewRoundId', $reviewRound->getId());
$submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION);
$templateMgr->assign('submission', $submission);
// Review round request notification options.
$notificationRequestOptions = array(NOTIFICATION_LEVEL_NORMAL => array(NOTIFICATION_TYPE_REVIEW_ROUND_STATUS => array(ASSOC_TYPE_REVIEW_ROUND, $reviewRound->getId())), NOTIFICATION_LEVEL_TRIVIAL => array());
$templateMgr->assign('reviewRoundNotificationRequestOptions', $notificationRequestOptions);
// Editor has taken an action and sent an email; Display the email
import('classes.workflow.EditorDecisionActionsManager');
if (EditorDecisionActionsManager::getEditorTakenActionInReviewRound($reviewRound)) {
$submissionEmailLogDao = DAORegistry::getDAO('SubmissionEmailLogDAO');
$user = $request->getUser();
$submissionEmailFactory = $submissionEmailLogDao->getByEventType($submission->getId(), SUBMISSION_EMAIL_EDITOR_NOTIFY_AUTHOR, $user->getId());
$templateMgr->assign('submissionEmails', $submissionEmailFactory);
$templateMgr->assign('showReviewAttachments', true);
}
return $templateMgr->fetchJson('authorDashboard/reviewRoundInfo.tpl');
}
开发者ID:selwyntcy,项目名称:pkp-lib,代码行数:33,代码来源:AuthorDashboardReviewRoundTabHandler.inc.php
注:本文中的DAORegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论