本文整理汇总了PHP中QDateTime::Now方法的典型用法代码示例。如果您正苦于以下问题:PHP QDateTime::Now方法的具体用法?PHP QDateTime::Now怎么用?PHP QDateTime::Now使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDateTime
的用法示例。
在下文中一共展示了QDateTime::Now方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Form_Create
protected function Form_Create()
{
$this->txtDescription = new QTextBox($this);
$this->txtDescription->Name = 'Description';
$this->lstStackCount = new QListBox($this);
$this->lstStackCount->Name = 'Number of Stacks';
$this->calDateCredited = new QDateTimePicker($this);
$this->calDateCredited->MaximumYear = date('Y') + 5;
$this->calDateCredited->DateTime = QDateTime::Now();
$this->txtReportedTotals = array();
for ($i = 1; $i <= 20; $i++) {
$this->lstStackCount->AddItem($i, $i, $i == 1);
$txtReportedTotal = new QFloatTextBox($this, 'txtReportedTotal' . $i);
$txtReportedTotal->Name = 'Reported Total for Stack #' . $i;
$txtReportedTotal->Visible = false;
$this->txtReportedTotals[$i] = $txtReportedTotal;
}
$this->lstStackCount->AddAction(new QChangeEvent(), new QAjaxAction('lstStackCount_Change'));
$this->lstStackCount_Change();
$this->btnSave = new QButton($this);
$this->btnSave->Text = 'Create Stack';
$this->btnSave->CssClass = 'primary';
$this->btnSave->CausesValidation = true;
$this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click'));
$this->btnCancel = new QLinkButton($this);
$this->btnCancel->CssClass = 'cancel';
$this->btnCancel->Text = 'Cancel';
$this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click'));
$this->btnCancel->AddAction(new QClickEvent(), new QTerminateAction());
}
示例2: Log
/**
* This will log a message to the Qcodo Log. Location of the log file is defined in __QCODO_LOG__
*
* By default, this will log a "Normal" level log entry in the "default" Qcodo log file, which is
* located at __QCODO_LOG__/default.log.txt
*
* Either parameter can be overridden.
*
* @param string $strMessage
* @param integer $intLogLevel
* @param string $strLogModule
* @return void
*/
public static function Log($strMessage, $intLogLevel = QLogLevel::Normal, $strLogModule = 'default')
{
// Cancel out if log level is too low
if ($intLogLevel > self::$MinimumLogLevel) {
return;
}
// Setup Log Path
if (!defined('__QCODO_LOG__')) {
throw new QCallerException('__QCODO_LOG__ must be defined before running QLog::Log');
}
// Cancel out if log path is null
if (!__QCODO_LOG__) {
return;
}
// Create the Log Directory if it does NOT yet exist
if (!is_dir(__QCODO_LOG__)) {
QApplication::MakeDirectory(__QCODO_LOG__, 0777);
}
// Setup the Line
$strLine = sprintf("%5s | %s | %s | %s\r\n", getmypid(), QLogLevel::$NameArray[$intLogLevel], QDateTime::Now()->NowToString(QDateTime::FormatIso), self::FormatMessage($strMessage));
// Open the File for Writing
$strLogFilePath = __QCODO_LOG__ . '/' . $strLogModule . self::$Extension;
$objFile = fopen($strLogFilePath, 'a');
// Write the Line
fwrite($objFile, $strLine);
fclose($objFile);
}
示例3: btnOkay_Click
public function btnOkay_Click($strFormId, $strControlId, $strParameter)
{
$this->btnOkay->Enabled = true;
$blnNewTopic = false;
// Setup stuff if it's a NEW message being posted (either a NEW response or a NEW topic)
if (!$this->blnEditMode) {
// For NEW TOPIC in this Forum
if (!$this->mctMessage->Message->Topic) {
$objForum = Forum::Load($this->lstForum->SelectedValue);
$objNewTopic = $objForum->PostTopic(trim($this->txtTopicName->Text), trim($this->txtMessage->Text), QApplication::$Person);
QApplication::Redirect(sprintf('/forums/forum.php/%s/%s/', $objForum->Id, $objNewTopic->Id));
// Otherwise, it's a new POST in this TOPIC
} else {
$this->mctMessage->Message->PostDate = QDateTime::Now();
}
// Set the Reply Number for this New Message
$this->mctMessage->Message->ReplyNumber = $this->mctMessage->Message->Topic->GetNextReplyNumber();
}
// Save Everything Else
$this->mctMessage->SaveMessage();
$this->mctMessage->Message->RefreshCompiledHtml();
$this->mctMessage->SaveMessage();
// Refresh Stats and Stuff
$this->mctMessage->Message->Topic->RefreshStats();
$this->mctMessage->Message->Topic->RefreshSearchIndex();
$this->mctMessage->Message->TopicLink->RefreshStats();
// Send Alerts and Reset Read Flag on any NEW post
if (!$this->blnEditMode) {
$this->mctMessage->Message->SendAlerts();
$this->mctMessage->Message->Topic->UnassociateAllPeopleAsRead();
//Mark as read for poster
$this->mctMessage->Message->Topic->AssociatePersonAsRead(QApplication::$Person);
}
$this->ParentControl->CloseMessageDialog(true, !$this->blnEditMode);
}
示例4: Save
public function Save($blnForceInsert = false, $blnForceUpdate = false)
{
$this->intSuggestionWordCount = NarroString::WordCount($this->strSuggestionValue);
$this->intSuggestionCharCount = mb_strlen($this->strSuggestionValue);
$this->strSuggestionValueMd5 = md5($this->strSuggestionValue);
if (!isset($this->blnIsImported)) {
$this->blnIsImported = false;
}
if (!$this->__blnRestored || $blnForceInsert) {
$this->dttCreated = QDateTime::Now();
} else {
$this->dttModified = QDateTime::Now();
}
parent::Save($blnForceInsert, $blnForceUpdate);
/**
* Update all context infos with the has suggestion property
*/
$arrContextInfo = NarroContextInfo::QueryArray(QQ::AndCondition(QQ::Equal(QQN::NarroContextInfo()->Context->TextId, $this->intTextId), QQ::Equal(QQN::NarroContextInfo()->LanguageId, $this->intLanguageId), QQ::Equal(QQN::NarroContextInfo()->HasSuggestions, 0)));
foreach ($arrContextInfo as $objOneContextInfo) {
$objOneContextInfo->HasSuggestions = 1;
$objOneContextInfo->Modified = QDateTime::Now();
try {
$objOneContextInfo->Save();
} catch (Exception $objEx) {
NarroLogger::LogWarn($objEx->getMessage());
}
}
}
示例5: Log
private static function Log($strMessage, $intPriority, $intProjectId = null, $intLanguageId = null, $intUserId = null)
{
if (SERVER_INSTANCE != 'dev' && $intPriority == NarroLog::PRIORITY_DEBUG) {
return true;
}
$objLogEntry = new NarroLog();
$objLogEntry->Date = QDateTime::Now();
$objLogEntry->Priority = $intPriority;
$objLogEntry->Message = $strMessage;
$objLogEntry->ProjectId = is_null($intProjectId) ? is_null(self::$intProjectId) ? null : self::$intProjectId : $intProjectId;
$objLogEntry->LanguageId = is_null($intLanguageId) ? is_null(self::$intLanguageId) ? null : self::$intLanguageId : $intLanguageId;
$objLogEntry->UserId = is_null($intUserId) ? is_null(self::$intUserId) ? null : self::$intUserId : $intUserId;
try {
$objLogEntry->Save();
} catch (Exception $objEx) {
error_log($objEx->getMessage() . $objEx->getTraceAsString());
}
if (QFirebug::getEnabled()) {
switch ($intPriority) {
case NarroLog::PRIORITY_INFO:
QFirebug::info($objLogEntry->Message . ' / ' . $objLogEntry->UserId . ' / ' . $objLogEntry->ProjectId . ' / ' . $objLogEntry->LanguageId);
break;
case NarroLog::PRIORITY_WARN:
QFirebug::warn($objLogEntry->Message . ' / ' . $objLogEntry->UserId . ' / ' . $objLogEntry->ProjectId . ' / ' . $objLogEntry->LanguageId);
break;
case NarroLog::PRIORITY_ERROR:
QFirebug::error($objLogEntry->Message . ' / ' . $objLogEntry->UserId . ' / ' . $objLogEntry->ProjectId . ' / ' . $objLogEntry->LanguageId);
break;
default:
QFirebug::log($objLogEntry->Message . ' / ' . $objLogEntry->UserId . ' / ' . $objLogEntry->ProjectId . ' / ' . $objLogEntry->LanguageId);
}
}
}
示例6: SetupPanel
protected function SetupPanel()
{
$this->mctPledge = StewardshipPledgeMetaControl::Create($this, $this->strUrlHashArgument, QMetaControlCreateType::CreateOnRecordNotFound);
if (!$this->mctPledge->EditMode) {
// Trying to create a NEW comment
$this->mctPledge->StewardshipPledge->DateStarted = QDateTime::Now();
$this->mctPledge->StewardshipPledge->Person = $this->objPerson;
$this->mctPledge->StewardshipPledge->FulfilledFlag = false;
$this->mctPledge->StewardshipPledge->ActiveFlag = true;
$this->btnSave->Text = 'Create';
} else {
$this->btnSave->Text = 'Update';
$this->btnDelete = new QLinkButton($this);
$this->btnDelete->Text = 'Delete';
$this->btnDelete->CssClass = 'delete';
$this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction('Are you SURE you want to DELETE this pledge?'));
$this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
$this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction());
}
// Create Controls
$this->lstStewardshipFund = $this->mctPledge->lstStewardshipFund_Create(null, QQ::All(), array(QQ::OrderBy(QQN::StewardshipFund()->Name)));
$this->calDateStarted = $this->mctPledge->calDateStarted_Create();
$this->calDateEnded = $this->mctPledge->calDateEnded_Create();
$this->txtPledgeAmount = $this->mctPledge->txtPledgeAmount_Create();
$this->chkActiveFlag = $this->mctPledge->chkActiveFlag_Create();
$this->chkActiveFlag->Text = 'Note: All fulfilled pledges automatically considred "inactive".';
$this->calDateStarted->MinimumYear = 2000;
$this->calDateStarted->MaximumYear = date('Y') + 10;
$this->calDateEnded->MinimumYear = 2000;
$this->calDateEnded->MaximumYear = date('Y') + 10;
}
示例7: btnSave_Click
public function btnSave_Click()
{
if (!$this->mctComments->EditMode) {
$this->mctComments->Comment->DatePosted = QDateTime::Now();
}
$this->mctComments->SaveComment();
QApplication::ExecuteJavaScript('document.location="#comments";');
}
示例8: CreateWithRawMessage
/**
* Creates a new EmailMessage object with the raw data from a POP3 Server.
* @param string $strRawMessage
* @return EmailMessage
*/
public static function CreateWithRawMessage($strRawMessage)
{
$objEmailMessage = new EmailMessage();
$objEmailMessage->RawMessage = $strRawMessage;
$objEmailMessage->EmailMessageStatusTypeId = EmailMessageStatusType::NotYetAnalyzed;
$objEmailMessage->DateReceived = QDateTime::Now();
$objEmailMessage->Save();
return $objEmailMessage;
}
示例9: ParsePostData
public function ParsePostData()
{
if (key_exists('form_location', $_POST)) {
$arrParts = explode('/', $_POST['form_location']);
$this->fltLat = $arrParts[0];
$this->fltLong = $arrParts[1];
$this->dttUpdated = QDateTime::Now();
}
}
示例10: IsViewable
/**
* This will specifiy viewability based on (a) approval and (b) ensuring it's not yet expired
* @return boolean
*/
public function IsViewable()
{
if (!$this->blnApprovalFlag) {
return false;
}
if ($this->dttDateExpired->IsEarlierThan(QDateTime::Now())) {
return false;
}
return true;
}
示例11: Save
public function Save($blnForceInsert = false, $blnForceUpdate = false)
{
$this->intTextWordCount = NarroString::WordCount($this->strTextValue);
$this->intTextCharCount = strlen($this->strTextValue);
$this->strTextValueMd5 = md5($this->strTextValue);
if (!$this->__blnRestored || $blnForceInsert) {
$this->dttCreated = QDateTime::Now();
} else {
$this->dttModified = QDateTime::Now();
}
parent::Save($blnForceInsert, $blnForceUpdate);
}
示例12: QueueMessage
/**
* This will QUEUE a message for delivery.
* @param string $strToAddress
* @param string $strFromAddress if null, it will look up from Registry
* @param string $strSubject
* @param string $strBody
* @param string $strCc
* @param string $strBcc
*/
public static function QueueMessage($strToAddress, $strFromAddress, $strSubject, $strBody, $strCc = null, $strBcc = null)
{
$objEmailMessage = new OutgoingEmailQueue();
$objEmailMessage->ToAddress = $strToAddress;
$objEmailMessage->FromAddress = $strFromAddress ? $strFromAddress : Registry::GetValue('system_email_address');
$objEmailMessage->CcAddress = $strCc;
$objEmailMessage->BccAddress = $strBcc;
$objEmailMessage->Subject = $strSubject;
$objEmailMessage->Body = $strBody;
$objEmailMessage->DateQueued = QDateTime::Now();
$objEmailMessage->ErrorFlag = false;
$objEmailMessage->Save();
}
示例13: btnSave_Click
public function btnSave_Click()
{
if (trim($this->txtComment->Text)) {
$objComment = new NarroTextComment();
$objComment->UserId = QApplication::GetUserId();
$objComment->LanguageId = QApplication::GetLanguageId();
$objComment->TextId = $this->intTextId;
$objComment->Created = QDateTime::Now();
$objComment->CommentText = $this->txtComment->Text;
$objComment->CommentTextMd5 = md5($objComment->CommentText);
$objComment->Save();
$this->dtgComments->Refresh();
}
}
示例14: btnInactivate_Click
public function btnInactivate_Click()
{
$objConditions = QQ::AndCondition(QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $this->objGroup->Id), QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd));
$personArray = Person::QueryArray($objConditions, null);
foreach ($personArray as $objPerson) {
$groupParticipationArray = $objPerson->GetGroupParticipationArray();
foreach ($groupParticipationArray as $objGroupParticipation) {
if ($objGroupParticipation->GroupId == $this->objGroup->Id) {
$objGroupParticipation->DateEnd = QDateTime::Now();
$objGroupParticipation->Save();
}
}
}
$this->dtgMembers->Refresh();
}
示例15: btnSubmitPraise_Click
protected function btnSubmitPraise_Click($strFormId, $strControlId, $strParameter)
{
// Generate a praise object.
$objPraise = new Praises();
$objPraise->Email = $this->txtEmail->Text;
$objPraise->Name = $this->txtName->Text;
$objPraise->Subject = $this->txtSubject->Text;
$objPraise->Content = $this->txtContent->Text;
$objNowTime = new DateTime();
$objPraise->Date = QDateTime::Now();
$objPraise->Save();
//email success
$this->SendMessage();
// return to prayer page
QApplication::Redirect('/prayer/complete_submit_praise.php');
}