当前位置: 首页>>代码示例>>PHP>>正文


PHP DAORegistry::getDAO方法代码示例

本文整理汇总了PHP中DAORegistry::getDAO方法的典型用法代码示例。如果您正苦于以下问题:PHP DAORegistry::getDAO方法的具体用法?PHP DAORegistry::getDAO怎么用?PHP DAORegistry::getDAO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DAORegistry的用法示例。


在下文中一共展示了DAORegistry::getDAO方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的DAORegistry::getDAO方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。