本文整理汇总了PHP中DAO::formatDateToDB方法的典型用法代码示例。如果您正苦于以下问题:PHP DAO::formatDateToDB方法的具体用法?PHP DAO::formatDateToDB怎么用?PHP DAO::formatDateToDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DAO
的用法示例。
在下文中一共展示了DAO::formatDateToDB方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDateExpire
/**
* @copydoc PKPAnnouncementForm::setDateExpire()
*/
function setDateExpire(&$announcement)
{
/* @var $announcement Announcement */
$dateExpire = $this->getData('dateExpire');
if ($dateExpire) {
$announcement->setDateExpire(DAO::formatDateToDB($dateExpire, null, false));
} else {
// No date passed but null is acceptable for
// announcements.
$announcement->setDateExpire(null);
}
return true;
}
示例2: setDueDates
/**
* Sets the due date for a review assignment.
* @param $request PKPRequest
* @param $submission Submission
* @param $reviewId int
* @param $dueDate string
* @param $numWeeks int
* @param $logEntry boolean
*/
function setDueDates($request, $submission, $reviewAssignment, $reviewDueDate = null, $responseDueDate = null, $logEntry = false)
{
$userDao = DAORegistry::getDAO('UserDAO');
$context = $request->getContext();
$reviewer = $userDao->getById($reviewAssignment->getReviewerId());
if (!isset($reviewer)) {
return false;
}
if ($reviewAssignment->getSubmissionId() == $submission->getId() && !HookRegistry::call('EditorAction::setDueDates', array(&$reviewAssignment, &$reviewer, &$reviewDueDate, &$responseDueDate))) {
// Set the review due date
$defaultNumWeeks = $context->getSetting('numWeeksPerReview');
$reviewAssignment->setDateDue(DAO::formatDateToDB($reviewDueDate, $defaultNumWeeks, false));
// Set the response due date
$defaultNumWeeks = $context->getSetting('numWeeksPerReponse');
$reviewAssignment->setDateResponseDue(DAO::formatDateToDB($responseDueDate, $defaultNumWeeks, false));
// update the assignment (with both the new dates)
$reviewAssignment->stampModified();
$reviewAssignmentDao = DAORegistry::getDAO('ReviewAssignmentDAO');
/* @var $reviewAssignmentDao ReviewAssignmentDAO */
$reviewAssignmentDao->updateObject($reviewAssignment);
// N.B. Only logging Date Due
if ($logEntry) {
// Add log
import('lib.pkp.classes.log.SubmissionLog');
import('classes.log.SubmissionEventLogEntry');
SubmissionLog::logEvent($request, $submission, SUBMISSION_LOG_REVIEW_SET_DUE_DATE, 'log.review.reviewDueDateSet', array('reviewerName' => $reviewer->getFullName(), 'dueDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime($reviewAssignment->getDateDue())), 'submissionId' => $submission->getId(), 'stageId' => $reviewAssignment->getStageId(), 'round' => $reviewAssignment->getRound()));
}
}
}