本文整理汇总了PHP中Core::getCurrentDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::getCurrentDate方法的具体用法?PHP Core::getCurrentDate怎么用?PHP Core::getCurrentDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::getCurrentDate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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';
}
}
示例2: logEvent
/**
* Add a new event log entry with the specified parameters
* @param $request object
* @param $submission object
* @param $eventType int
* @param $messageKey string
* @param $params array optional
* @return object SubmissionLogEntry iff the event was logged
*/
static function logEvent($request, $submission, $eventType, $messageKey, $params = array())
{
// Create a new entry object
$submissionEventLogDao = DAORegistry::getDAO('SubmissionEventLogDAO');
$entry = $submissionEventLogDao->newDataObject();
// Set implicit parts of the log entry
$entry->setDateLogged(Core::getCurrentDate());
$entry->setIPAddress($request->getRemoteAddr());
if (Validation::isLoggedInAs()) {
// If user is logged in as another user log with real userid
$sessionManager = SessionManager::getManager();
$session = $sessionManager->getUserSession();
$userId = $session->getSessionVar('signedInAs');
if ($userId) {
$entry->setUserId($userId);
}
} else {
$user = $request->getUser();
if ($user) {
$entry->setUserId($user->getId());
}
}
$entry->setSubmissionId($submission->getId());
// Set explicit parts of the log entry
$entry->setEventType($eventType);
$entry->setMessage($messageKey);
$entry->setParams($params);
$entry->setIsTranslated(0);
// Legacy for old entries. All messages now use locale keys.
// Insert the resulting object
$submissionEventLogDao->insertObject($entry);
return $entry;
}
示例3: 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;
}
}
示例4: addEntry
function addEntry(&$logEntry, $file = null)
{
if (!isset($file)) {
$file = $this->getLogFilename();
}
$stamp = strtr(Core::getCurrentDate(), "\t", " ");
$user = strtr($logEntry->getUser(), "\t", " ");
$site = strtr($logEntry->getSite(), "\t", " ");
$journal = strtr($logEntry->getJournal(), "\t", " ");
$publisher = strtr($logEntry->getPublisher(), "\t", " ");
$printIssn = strtr($logEntry->getPrintIssn(), "\t", " ");
$onlineIssn = strtr($logEntry->getOnlineIssn(), "\t", " ");
$type = strtr($logEntry->getType(), "\t", " ");
$value = strtr($logEntry->getValue(), "\t", " ");
$journalUrl = strtr($logEntry->getJournalUrl(), "\t", " ");
$line = "{$stamp}\t{$user}\t{$site}\t{$journal}\t{$publisher}\t{$printIssn}\t{$onlineIssn}\t{$type}\t{$value}\t{$journalUrl}\n";
$fp = fopen($file, 'a');
if (!$fp) {
return false;
}
if (!flock($fp, LOCK_EX)) {
fclose($fp);
return false;
}
fwrite($fp, $line);
fclose($fp);
}
示例5: executeActions
/**
* @see ScheduledTask::executeActions()
*/
function executeActions()
{
if (!$this->_plugin) {
return false;
}
if (!$this->_depositUrl) {
$this->addExecutionLogEntry(__('plugins.generic.alm.senderTask.error.noDepositUrl'), SCHEDULED_TASK_MESSAGE_TYPE_ERROR);
return false;
}
$plugin = $this->_plugin;
$journals = $this->_getJournals();
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
/* @var $publishedArticleDao PublishedArticleDAO */
foreach ($journals as $journal) {
$journalId = $journal->getId();
$lastExport = $plugin->getSetting($journalId, 'lastExport');
$articles =& $publishedArticleDao->getPublishedArticlesByJournalId($journalId, null, true);
$articlesSinceLast = array();
while ($article =& $articles->next()) {
if (strtotime($article->getDatePublished()) > $lastExport) {
$articlesSinceLast[] = $article;
} else {
break;
}
unset($article);
}
if ($this->_exportArticles($journal, $articlesSinceLast)) {
$plugin->updateSetting($journalId, 'lastExport', Core::getCurrentDate(), 'date');
}
}
if (empty($journals)) {
$this->addExecutionLogEntry(__('plugins.generic.alm.senderTask.warning.noJournal'), SCHEDULED_TASK_MESSAGE_TYPE_WARNING);
}
return true;
}
示例6: redeemGift
/**
* Redeem a gift for a user.
* @param $assocType int
* @param $assocId int
* @param $userId int
* @param $giftId int
* @return int Status code indicating whether gift could be redeemed
*/
function redeemGift($assocType, $assocId, $userId, $giftId)
{
// Ensure user has this gift
if (!$this->recipientHasGift($assocType, $assocId, $userId, $giftId)) {
return GIFT_REDEEM_STATUS_ERROR_NO_GIFT_TO_REDEEM;
}
// Ensure user has not already redeemed this gift
if (!$this->recipientHasNotRedeemedGift($assocType, $assocId, $userId, $giftId)) {
return GIFT_REDEEM_STATUS_ERROR_GIFT_ALREADY_REDEEMED;
}
// Retrieve and try to redeem the gift
$gift = $this->getGift($giftId);
switch ($gift->getGiftType()) {
case GIFT_TYPE_SUBSCRIPTION:
$returner = $this->_redeemGiftSubscription($gift);
break;
default:
$returner = GIFT_REDEEM_STATUS_ERROR_GIFT_INVALID;
}
// If all went well, mark gift as redeemed
if ($returner == GIFT_REDEEM_STATUS_SUCCESS) {
$gift->setStatus(GIFT_STATUS_REDEEMED);
$gift->setDatetimeRedeemed(Core::getCurrentDate());
$this->updateObject($gift);
}
return $returner;
}
示例7: incrementViewCount
/**
* Increment the view count for a published article
* @param $journalId int
* @param $pubId int
* @param $ipAddress string
* @param $userAgent string
*/
function incrementViewCount($journalId, $articleId, $galleyId = null, $ipAddress = null, $userAgent = null)
{
$this->update(sprintf('INSERT INTO timed_views_log
(submission_id, galley_id, journal_id, date, ip_address, user_agent)
VALUES
(?, ?, ?, %s, ?, ?)', $this->datetimeToDB(Core::getCurrentDate())), array((int) $articleId, isset($galleyId) ? (int) $galleyId : null, (int) $journalId, $ipAddress, $userAgent));
}
示例8: execute
/**
* Add the comment.
*/
function execute()
{
// Personalized execute() method since now there are possibly two comments contained within each form submission.
$commentDao = DAORegistry::getDAO('PaperCommentDAO');
$this->insertedComments = array();
// Assign all common information
$comment = new PaperComment();
$comment->setCommentType($this->commentType);
$comment->setRoleId($this->roleId);
$comment->setPaperId($this->paper->getPaperId());
$comment->setAssocId($this->assocId);
$comment->setAuthorId($this->user->getId());
$comment->setCommentTitle($this->getData('commentTitle'));
$comment->setDatePosted(Core::getCurrentDate());
// If comments "For authors and director" submitted
if ($this->getData('authorComments') != null) {
$comment->setComments($this->getData('authorComments'));
$comment->setViewable(1);
array_push($this->insertedComments, $commentDao->insertPaperComment($comment));
}
// If comments "For director" submitted
if ($this->getData('comments') != null) {
$comment->setComments($this->getData('comments'));
$comment->setViewable(null);
array_push($this->insertedComments, $commentDao->insertPaperComment($comment));
}
}
示例9: submission
/**
* View an assigned submission's layout editing page.
* @param $args array ($articleId)
*/
function submission($args)
{
$articleId = isset($args[0]) ? $args[0] : 0;
list($journal, $submission) = SubmissionLayoutHandler::validate($articleId);
parent::setupTemplate(true, $articleId);
import('submission.proofreader.ProofreaderAction');
ProofreaderAction::layoutEditorProofreadingUnderway($submission);
$layoutAssignment =& $submission->getLayoutAssignment();
if ($layoutAssignment->getDateNotified() != null && $layoutAssignment->getDateUnderway() == null) {
// Set underway date
$layoutAssignment->setDateUnderway(Core::getCurrentDate());
$layoutDao =& DAORegistry::getDAO('LayoutEditorSubmissionDAO');
$layoutDao->updateSubmission($submission);
}
$disableEdit = !SubmissionLayoutHandler::layoutEditingEnabled($submission);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('submission', $submission);
$templateMgr->assign('disableEdit', $disableEdit);
$templateMgr->assign('useProofreaders', $journal->getSetting('useProofreaders'));
$templateMgr->assign('templates', $journal->getSetting('templates'));
$templateMgr->assign('helpTopicId', 'editorial.layoutEditorsRole.layout');
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getArticleId());
if ($publishedArticle) {
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getIssueById($publishedArticle->getIssueId());
$templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
$templateMgr->assign_by_ref('issue', $issue);
}
$templateMgr->display('layoutEditor/submission.tpl');
}
示例10: uploadProfileImage
/**
* Upload a profile image.
* @return boolean True iff success.
*/
function uploadProfileImage()
{
import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$user = $this->getUser();
$type = $publicFileManager->getUploadedFileType('uploadedFile');
$extension = $publicFileManager->getImageExtension($type);
if (!$extension) {
return false;
}
$uploadName = 'profileImage-' . (int) $user->getId() . $extension;
if (!$publicFileManager->uploadSiteFile('uploadedFile', $uploadName)) {
return false;
}
$filePath = $publicFileManager->getSiteFilesPath();
list($width, $height) = getimagesize($filePath . '/' . $uploadName);
if ($width > PROFILE_IMAGE_MAX_WIDTH || $height > PROFILE_IMAGE_MAX_HEIGHT || $width <= 0 || $height <= 0) {
$userSetting = null;
$user->updateSetting('profileImage', $userSetting);
$publicFileManager->removeSiteFile($filePath);
return false;
}
$user->updateSetting('profileImage', array('name' => $publicFileManager->getUploadedFileName('uploadedFile'), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate()));
return true;
}
示例11: resubmit
function resubmit($args)
{
$articleId = isset($args[0]) ? (int) $args[0] : 0;
$sectionDecisionDao = DAORegistry::getDAO('SectionDecisionDAO');
$lastDecision = $sectionDecisionDao->getLastSectionDecision($articleId);
$authorSubmissionDao =& DAORegistry::getDAO('AuthorSubmissionDAO');
$authorSubmission = $authorSubmissionDao->getAuthorSubmission($articleId);
$lastDecisionValue = $lastDecision->getDecision();
if ($lastDecisionValue == SUBMISSION_SECTION_DECISION_INCOMPLETE || $lastDecisionValue == SUBMISSION_SECTION_DECISION_RESUBMIT) {
$newSectionDecision =& new SectionDecision();
$newSectionDecision->setArticleId($articleId);
$newSectionDecision->setReviewType($lastDecision->getReviewType());
$newSectionDecision->setRound($lastDecision->getRound() + 1);
$newSectionDecision->setSectionId($lastDecision->getSectionId());
$newSectionDecision->setDecision(0);
$newSectionDecision->setDateDecided(date(Core::getCurrentDate()));
$authorSubmission->addDecision($newSectionDecision);
$authorSubmissionDao->updateAuthorSubmission($authorSubmission);
$step = 2;
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$articleDao->changeArticleStatus($articleId, STATUS_QUEUED);
$articleDao->changeArticleProgress($articleId, $step);
Request::redirect(null, null, 'submit', $step, array('articleId' => $articleId));
} else {
Request::redirect(null, 'author', '');
}
}
示例12: execute
/**
* Save changes to monograph.
* @return int the monograph ID
*/
function execute()
{
$monographDao =& DAORegistry::getDAO('MonographDAO');
$authorDao =& DAORegistry::getDAO('AuthorDAO');
// Update monograph
$monograph =& $this->monograph;
$monograph->setTitle($this->getData('title'), null);
// Localized
$monograph->setAbstract($this->getData('abstract'), null);
// Localized
if (is_array($this->getData('agenciesKeywords'))) {
$monograph->setSupportingAgencies(implode(", ", $this->getData('agenciesKeywords')), null);
}
// Localized
if (is_array($this->getData('disciplinesKeywords'))) {
$monograph->setDiscipline(implode(", ", $this->getData('disciplinesKeywords')), null);
}
// Localized
if (is_array($this->getData('keywordKeywords'))) {
$monograph->setSubject(implode(", ", $this->getData('keywordKeywords')), null);
}
// Localized
if ($monograph->getSubmissionProgress() <= $this->step) {
$monograph->setDateSubmitted(Core::getCurrentDate());
$monograph->stampStatusModified();
$monograph->setSubmissionProgress(0);
}
// Assign the default users to the submission workflow stage
import('classes.submission.common.Action');
Action::assignDefaultStageParticipants($monograph->getId(), WORKFLOW_STAGE_ID_SUBMISSION);
// Save the monograph
$monographDao->updateMonograph($monograph);
return $this->monographId;
}
示例13: submission
/**
* View an assigned submission's layout editing page.
* @param $args array ($articleId)
*/
function submission($args)
{
$articleId = isset($args[0]) ? $args[0] : 0;
$journal =& Request::getJournal();
$submissionLayoutHandler = new SubmissionLayoutHandler();
$submissionLayoutHandler->validate($articleId);
$submission =& $submissionLayoutHandler->submission;
$this->setupTemplate(true, $articleId);
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
import('classes.submission.proofreader.ProofreaderAction');
ProofreaderAction::proofreadingUnderway($submission, 'SIGNOFF_PROOFREADING_LAYOUT');
$layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $articleId);
if ($layoutSignoff->getDateNotified() != null && $layoutSignoff->getDateUnderway() == null) {
// Set underway date
$layoutSignoff->setDateUnderway(Core::getCurrentDate());
$signoffDao->updateObject($layoutSignoff);
}
$disableEdit = !$this->layoutEditingEnabled($submission);
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign_by_ref('submission', $submission);
$templateMgr->assign('disableEdit', $disableEdit);
$templateMgr->assign('useProofreaders', $journal->getSetting('useProofreaders'));
$templateMgr->assign('templates', $journal->getSetting('templates'));
$templateMgr->assign('helpTopicId', 'editorial.layoutEditorsRole.layout');
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId($submission->getArticleId());
if ($publishedArticle) {
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getIssueById($publishedArticle->getIssueId());
$templateMgr->assign_by_ref('publishedArticle', $publishedArticle);
$templateMgr->assign_by_ref('issue', $issue);
}
$templateMgr->display('layoutEditor/submission.tpl');
}
示例14: sendReminder
function sendReminder($reviewAssignment, $article, $journal)
{
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$userDao =& DAORegistry::getDAO('UserDAO');
$reviewId = $reviewAssignment->getReviewId();
$reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
if (!isset($reviewer)) {
return false;
}
import('mail.ArticleMailTemplate');
$reviewerAccessKeysEnabled = $journal->getSetting('reviewerAccessKeysEnabled');
$email =& new ArticleMailTemplate($article, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_AUTO_ONECLICK' : 'REVIEW_REMIND_AUTO', null, false, $journal);
$email->setJournal($journal);
$email->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
$email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
$email->setAssoc(ARTICLE_EMAIL_REVIEW_REMIND, ARTICLE_EMAIL_TYPE_REVIEW, $reviewId);
$email->setSubject($email->getSubject($journal->getPrimaryLocale()));
$email->setBody($email->getBody($journal->getPrimaryLocale()));
$urlParams = array();
if ($reviewerAccessKeysEnabled) {
import('security.AccessKeyManager');
$accessKeyManager =& new AccessKeyManager();
// Key lifetime is the typical review period plus four weeks
$keyLifetime = ($journal->getSetting('numWeeksPerReview') + 4) * 7;
$urlParams['key'] = $accessKeyManager->createKey('ReviewerContext', $reviewer->getUserId(), $reviewId, $keyLifetime);
}
$submissionReviewUrl = Request::url($journal->getPath(), 'reviewer', 'submission', $reviewId, $urlParams);
$paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'journalUrl' => $journal->getUrl(), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime($reviewAssignment->getDateDue())), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getJournalTitle(), 'passwordResetUrl' => Request::url($journal->getPath(), 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getUserId()))), 'submissionReviewUrl' => $submissionReviewUrl);
$email->assignParams($paramArray);
$email->send();
$reviewAssignment->setDateReminded(Core::getCurrentDate());
$reviewAssignment->setReminderWasAutomatic(1);
$reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
}
示例15: insertCompletedPayment
/**
* Insert a new completed payment.
* @param $completedPayment OJSCompletedPayment
*/
function insertCompletedPayment(&$completedPayment)
{
$this->update(sprintf('INSERT INTO completed_payments
(timestamp, payment_type, journal_id, user_id, assoc_id, amount, currency_code_alpha, payment_method_plugin_name)
VALUES
(%s, ?, ?, ?, ?, ?, ?, ?)', $this->datetimeToDB(Core::getCurrentDate())), array($completedPayment->getType(), $completedPayment->getJournalId(), $completedPayment->getUserId(), $completedPayment->getAssocId(), $completedPayment->getAmount(), $completedPayment->getCurrencyCode(), $completedPayment->getPayMethodPluginName()));
return $this->getInsertCompletedPaymentId();
}