public function GetEndScript() { $strToReturn = parent::GetEndScript(); if (QDateTime::$Translate) { $strShortNameArray = array(); $strLongNameArray = array(); $strDayArray = array(); $dttMonth = new QDateTime('2000-01-01'); for ($intMonth = 1; $intMonth <= 12; $intMonth++) { $dttMonth->Month = $intMonth; $strShortNameArray[] = '"' . $dttMonth->ToString('MMM') . '"'; $strLongNameArray[] = '"' . $dttMonth->ToString('MMMM') . '"'; } $dttDay = new QDateTime('Sunday'); for ($intDay = 1; $intDay <= 7; $intDay++) { $strDay = $dttDay->ToString('DDD'); $strDay = html_entity_decode($strDay, ENT_COMPAT, QApplication::$EncodingType); if (function_exists('mb_substr')) { $strDay = mb_substr($strDay, 0, 2); } else { // Attempt to account for multibyte day -- may not work if the third character is multibyte $strDay = substr($strDay, 0, strlen($strDay) - 1); } $strDay = QApplication::HtmlEntities($strDay); $strDayArray[] = '"' . $strDay . '"'; $dttDay->Day++; } $strArrays = sprintf('new Array(new Array(%s), new Array(%s), new Array(%s))', implode(', ', $strLongNameArray), implode(', ', $strShortNameArray), implode(', ', $strDayArray)); $strToReturn .= sprintf('qc.regCAL("%s", "%s", "%s", "%s", %s); ', $this->strControlId, $this->dtxLinkedControl->ControlId, QApplication::Translate('Today'), QApplication::Translate('Cancel'), $strArrays); } else { $strToReturn .= sprintf('qc.regCAL("%s", "%s", "%s", "%s", null); ', $this->strControlId, $this->dtxLinkedControl->ControlId, QApplication::Translate('Today'), QApplication::Translate('Cancel')); } return $strToReturn; }
public function dtgItems_Bind() { $intYear = QApplication::PathInfo(0); $dttStart = new QDateTime($intYear . '-01-01'); $dttEnd = new QDateTime($dttStart); $dttEnd->Year += 1; $dttStart->SetTime(null, null, null); $dttEnd->SetTime(null, null, null); $objPersonCursor = Person::QueryCursor(QQ::AndCondition(QQ::GreaterOrEqual(QQN::Person()->StewardshipContribution->DateCredited, $dttStart), QQ::LessThan(QQN::Person()->StewardshipContribution->DateCredited, $dttEnd)), QQ::Clause(QQ::Distinct(), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName))); $strNameArray = array(); $strNameValueArray = array(); while ($objPerson = Person::InstantiateCursor($objPersonCursor)) { $strToken = strtolower($objPerson->FirstName . '|' . $objPerson->LastName); $strToken = str_replace(' ', '', $strToken); $strToken = str_replace('.', '', $strToken); $strToken = str_replace(',', '', $strToken); $strToken = str_replace('-', '', $strToken); $strToken = str_replace('_', '', $strToken); $strToken = str_replace('/', '', $strToken); if (array_key_exists($strToken, $strNameArray)) { $strNameValueArray[$strToken] = $objPerson->FirstName . ' ' . $objPerson->LastName; } $strNameArray[$strToken] = true; } $this->dtgItems->DataSource = $strNameValueArray; }
/** * Validate the control. * @return bool */ public function Validate() { if (!parent::Validate()) { return false; } if ($this->strText != '') { $dttDateTime = new QDateTime($this->strText, null, QDateTime::DateOnlyType); if ($dttDateTime->IsDateNull()) { $this->ValidationError = QApplication::Translate("Invalid date"); return false; } if (!is_null($this->Minimum)) { if ($dttDateTime->IsEarlierThan($this->Minimum)) { if ($this->strMinDateErrorMsg) { $this->ValidationError = $this->strMinDateErrorMsg; } else { $this->ValidationError = QApplication::Translate("Date is earlier than minimum allowed"); } return false; } } if (!is_null($this->Maximum)) { if ($dttDateTime->IsLaterThan($this->Maximum)) { if ($this->strMaxDateErrorMsg) { $this->ValidationError = $this->strMaxDateErrorMsg; } else { $this->ValidationError = QApplication::Translate("Date is later than maximum allowed"); } return false; } } } return true; }
public function testQueryCount() { $someDate = new QDateTime(); $someDate->setDate(2006, 1, 1); $intItemCount = Milestone::QueryCount(QQ::GreaterThan(QQN::Milestone()->Project->StartDate, $someDate), QQ::Distinct()); $this->assertEqual($intItemCount, 3); $intItemCount2 = Milestone::QueryCount(QQ::GreaterThan(QQN::Milestone()->Project->StartDate, $someDate), QQ::Clause(QQ::Distinct(), QQ::Distinct())); $this->assertEqual($intItemCount2, 3); }
public static function Q(QDateTime $objQDateTime) { if ($objQDateTime->IsTimeNull()) { //error_log("NotNUll: " . sprintf("'%s'", $objQDateTime->__toString('YYYY-MM-DD'))); return $objQDateTime->__toString('YYYY-MM-DD'); } else { //error_log("IS NULL: " . sprintf("'%s'", $objQDateTime->__toString(QDateTime::FormatIso))); return $objQDateTime->__toString(QDateTime::FormatIso); } }
public function dtgItems_Bind() { $intYear = QApplication::PathInfo(0); $dttStart = new QDateTime($intYear . '-01-01'); $dttEnd = new QDateTime($dttStart); $dttEnd->Year += 1; $dttStart->SetTime(null, null, null); $dttEnd->SetTime(null, null, null); $this->dtgItems->DataSource = Person::QueryArray(QQ::AndCondition(QQ::GreaterOrEqual(QQN::Person()->StewardshipContribution->DateCredited, $dttStart), QQ::LessThan(QQN::Person()->StewardshipContribution->DateCredited, $dttEnd), QQ::IsNull(QQN::Person()->PrimaryAddressText), QQ::IsNull(QQN::Person()->StewardshipAddressId)), QQ::Clause(QQ::Distinct(), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName))); }
public function testQueryArray() { $someDate = new QDateTime(); $someDate->setDate(2006, 1, 1); $objItems = Milestone::QueryArray(QQ::GreaterThan(QQN::Milestone()->Project->StartDate, $someDate), QQ::OrderBy(QQN::Milestone()->Project->Name)); $this->assertEqual(sizeof($objItems), 3); $this->assertEqual($objItems[0]->Name, "Milestone F"); $this->assertEqual($objItems[0]->Project->Name, "Blueman Industrial Site Architecture"); $this->assertEqual($objItems[1]->Name, "Milestone D"); $this->assertEqual($objItems[1]->Project->Name, "State College HR System"); $this->assertEqual($objItems[2]->Name, "Milestone E"); $this->assertEqual($objItems[2]->Project->Name, "State College HR System"); }
public function ParsePostData() { $blnChanged = false; $dttNewDateTime = new QDateTime(); // Update Date Component switch ($this->strCalendarType) { case QCalendarType::DateOnly: case QCalendarType::DateTime: case QCalendarType::DateTimeSeconds: $strKey = $this->strControlId . "_intTimestamp"; if (array_key_exists($strKey, $_POST)) { // If no date was set, set to null and return $intTimestamp = $_POST[$strKey]; if (!$intTimestamp) { $this->intTimestamp = null; return; } // Otherwise, set up a new date object, and update dttNewDateTime accordingly $blnChanged = true; $dttSelectedDate = new QDateTime($_POST[$strKey]); $dttNewDateTime->SetDate($dttSelectedDate->Year, $dttSelectedDate->Month, $dttSelectedDate->Day); } } // Update Time Component switch ($this->strCalendarType) { case QCalendarType::TimeOnly: case QCalendarType::TimeSecondsOnly: case QCalendarType::DateTime: case QCalendarType::DateTimeSeconds: // Hour $strKey = $this->strControlId . "_intHour"; if (array_key_exists($strKey, $_POST)) { $blnChanged = true; $dttNewDateTime->SetTime($_POST[$strKey], $dttNewDateTime->Minute, $dttNewDateTime->Second); } // Minute $strKey = $this->strControlId . "_intMinute"; if (array_key_exists($strKey, $_POST)) { $blnChanged = true; $dttNewDateTime->SetTime($dttNewDateTime->Hour, $_POST[$strKey], $dttNewDateTime->Second); } // Second $strKey = $this->strControlId . "_intSecond"; if (array_key_exists($strKey, $_POST)) { $blnChanged = true; $dttNewDateTime->SetTime($dttNewDateTime->Hour, $dttNewDateTime->Minute, $_POST[$strKey]); } } // Update local intTimestamp $this->intTimestamp = $dttNewDateTime->Timestamp; }
public function __get($strName) { switch ($strName) { case 'GeneratedDescription': if ($this->strLocation || $this->dttDateStart || $this->dttDateEnd) { $strToReturn = ', to be held'; if ($this->strLocation) { $strToReturn .= ' at ' . $this->strLocation; } if ($this->dttDateStart && $this->dttDateEnd) { $dttCompare1 = new QDateTime($this->dttDateStart); $dttCompare2 = new QDateTime($this->dttDateEnd); $dttCompare1->SetTime(null, null, null); $dttCompare2->SetTime(null, null, null); if ($dttCompare1->IsEqualTo($dttCompare2)) { $strToReturn .= ' on ' . $this->dttDateStart->ToString('MMMM D YYYY'); $strToReturn .= ' from ' . $this->dttDateStart->ToString('h:mm z'); $strToReturn .= ' to ' . $this->dttDateEnd->ToString('h:mm z'); } else { $strToReturn .= ' from ' . $this->dttDateStart->ToString('MMMM D'); $strToReturn .= ' to ' . $this->dttDateEnd->ToString('MMMM D YYYY'); } } else { if ($this->dttDateStart) { $strToReturn .= ' on ' . $this->dttDateStart->ToString('MMMM D YYYY'); if ($this->dttDateStart->Hour || $this->dttDateStart->Minute) { $strToReturn .= ' @ ' . $this->dttDateStart->ToString('h:mm z'); } } else { if ($this->dttDateEnd) { $strToReturn .= ' until ' . $this->dttDateEnd->ToString('MMMM D YYYY'); if ($this->dttDateStart->Hour || $this->dttDateEnd->Minute) { $strToReturn .= ' @ ' . $this->dttDateEnd->ToString('h:mm z'); } } } } return $strToReturn; } else { return null; } break; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * Returns an array of 2-item arrays, where each item has the following index: * 0: stewardship_fund_id * 1; total amount YTD * for a given month * @param QDateTime $dttMonth * @return string[][] */ public static function GetReportYtdByFundForMonth(QDateTime $dttMonth) { $dttMonth->Day = 1; $dttMonth->SetTime(null, null, null); $dttNextMonth = new QDateTime($dttMonth); $dttNextMonth->Month++; $dttNextMonth->SetTime(null, null, null); $dttMonth->Month = 1; $objResult = StewardshipPostAmount::GetDatabase()->Query(sprintf("SELECT stewardship_fund_id, SUM(amount) AS sum_amount FROM stewardship_post_amount, stewardship_post, stewardship_batch WHERE\n\t\t\t\tstewardship_batch_id=stewardship_batch.id AND\n\t\t\t\tstewardship_post_id=stewardship_post.id AND date_credited >= '%s' AND date_credited < '%s' GROUP BY stewardship_fund_id ORDER BY SUM(amount) DESC;", $dttMonth->ToString('YYYY-MM-DD'), $dttNextMonth->ToString('YYYY-MM-DD'))); $strToReturn = array(); while ($objRow = $objResult->GetNextRow()) { $strToReturn[] = array($objRow->GetColumn('stewardship_fund_id'), $objRow->GetColumn('sum_amount')); } return $strToReturn; }
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; }
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); } } }
/** * 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); }
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); }
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()); } } }
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()); }
/** * @param DleUsers $objDleUsers The DB ORM object to process */ protected function process_object($objDleUsers) { // wp: ID, user_login, user_nicename, user_email, user_registered, display_name // dl: user_id, name, name, email, FROM_UNIXTIME( reg_date ), fullname $strEmail = $objDleUsers->Email; if ($strEmail && strlen($strEmail)) { // check if already copied if (!WpUsers::QueryCount(QQ::Equal(QQN::WpUsers()->UserEmail, $strEmail))) { $objWpUsers = new WpUsers(); $objWpUsers->Initialize(); // set defaults $objWpUsers->UserLogin = $objDleUsers->Name; $objWpUsers->UserNicename = $objDleUsers->Name; $objWpUsers->UserEmail = $objDleUsers->Email; $objWpUsers->UserRegistered = QDateTime::FromTimestamp(intval($objDleUsers->RegDate)); $objWpUsers->DisplayName = $objDleUsers->Fullname; $objWpUsers->UserPass = ''; $objWpUsers->UserUrl = ''; $objWpUsers->UserActivationKey = ''; $objWpUsers->UserStatus = 0; $objWpUsers->Save(); $this->intUserCount++; } } }
protected function Form_Create() { $this->lstYear = new QListBox($this); for ($intYear = 2002; $intYear <= date('Y'); $intYear++) { $this->lstYear->AddItem($intYear, $intYear, QApplication::PathInfo(0) ? QApplication::PathInfo(0) == $intYear : $intYear == QDateTime::Now()->Year); } $this->lstMonth = new QListBox($this); for ($intMonth = 1; $intMonth <= 12; $intMonth++) { $dttDate = new QDateTime('2000-' . $intMonth . '-01'); $this->lstMonth->AddItem($dttDate->ToString('MMMM'), $intMonth, QApplication::PathInfo(1) ? QApplication::PathInfo(1) == $intMonth : $intMonth == QDateTime::Now()->Month); } $this->lstYear->AddAction(new QChangeEvent(), new QAjaxAction('lstDate_Change')); $this->lstMonth->AddAction(new QChangeEvent(), new QAjaxAction('lstDate_Change')); $this->dtgReport = new QDataGrid($this); $this->dtgReport->AddColumn(new QDataGridColumn('Fund', '<?= $_FORM->RenderRow($_ITEM); ?><?= StewardshipFund::Load($_ITEM[0])->Name; ?>', 'Width=400px')); $this->dtgReport->AddColumn(new QDataGridColumn('Monthly Total', '<?= QApplication::DisplayCurrency($_ITEM[1]); ?>', 'Width=400px')); $this->dtgReport->AddColumn(new QDataGridColumn('YTD', '<?= QApplication::DisplayCurrency($_ITEM[2]); ?>', 'Width=400px')); $this->dttDate = new QDateTime($this->lstYear->SelectedValue . '-' . $this->lstMonth->SelectedValue . '-01'); $this->dttDate->SetTime(null, null, null); // Get the Data $objReportArray = StewardshipPost::GetReportByFundAndMonth($this->dttDate); $objReportYtdArray = StewardshipPost::GetReportYtdByFundForMonth($this->dttDate); // Setup the data holders $this->fltTotal = 0; $this->fltTotalYtd = 0; $objArray = array(); foreach ($objReportArray as $objLineItem) { $objFund = StewardshipFund::Load($objLineItem[0]); if ($objFund->AccountNumber == '7011.010' || substr($objFund->AccountNumber, 0, 1) == '4') { $this->fltTotal += $objLineItem[1]; $objArray[$objLineItem[0]] = array($objLineItem[0], $objLineItem[1], null); } } foreach ($objReportYtdArray as $objLineItem) { $objFund = StewardshipFund::Load($objLineItem[0]); if ($objFund->AccountNumber == '7011.010' || substr($objFund->AccountNumber, 0, 1) == '4') { $this->fltTotalYtd += $objLineItem[1]; if (array_key_exists($objLineItem[0], $objArray)) { $objArray[$objLineItem[0]][2] = $objLineItem[1]; } else { $objArray[$objLineItem[0]] = array($objLineItem[0], null, $objLineItem[1]); } } } // Bind the data $this->dtgReport->DataSource = $objArray; }
protected function setUp() { $this->dttOne = new QDateTime(); $this->dttTwo = new QDateTime(); $this->arrTimes = array(QDateTime::FromTimeOnly('00:00:00'), QDateTime::FromTimeOnly('06:35:00'), QDateTime::FromTimeOnly('23:59:59')); $this->arrDates = array(new QDateTime('1980-06-13'), new QDateTime('today')); $this->arrDatetimes = array(new QDateTime('1980-06-13 04:34'), new QDateTime(QDateTime::Now)); }
public function btnSave_Click() { if (!$this->mctComments->EditMode) { $this->mctComments->Comment->DatePosted = QDateTime::Now(); } $this->mctComments->SaveComment(); QApplication::ExecuteJavaScript('document.location="#comments";'); }
function RefreshGitData($strRepository, $strRegistryName) { $strXml = file_get_contents('https://github.com/qcodo/' . $strRepository . '/commits/master.atom'); $objXml = new SimpleXMLElement($strXml); $objMostRecentCommit = $objXml->entry[0]; $dttCommit = new QDateTime((string) $objMostRecentCommit->updated); $strMessage = trim((string) $objMostRecentCommit->title); $strDate = $dttCommit->__toString('DDDD, MMMM D, YYYY'); $strUrl = (string) $objMostRecentCommit->link['href']; // Cleanup Message if (($intPosition = strpos($strMessage, "\n")) !== false) { $strMessage = trim(substr($strMessage, 0, $intPosition)); } Registry::SetValue('gitinfo_' . $strRegistryName . '_message', $strMessage); Registry::SetValue('gitinfo_' . $strRegistryName . '_date', $strDate); Registry::SetValue('gitinfo_' . $strRegistryName . '_url', $strUrl); }
function RefreshGitData($strRepository, $strRegistryName) { $strXml = file_get_contents('http://github.com/api/v2/xml/commits/list/qcodo/' . $strRepository . '/master'); $objXml = new SimpleXMLElement($strXml); $objMostRecentCommit = $objXml->commit[0]; $strNodeName = 'committed-date'; $dttCommit = new QDateTime((string) $objMostRecentCommit->{$strNodeName}); $strMessage = trim((string) $objMostRecentCommit->message); $strDate = $dttCommit->__toString('DDDD, MMMM D, YYYY'); $strUrl = (string) $objMostRecentCommit->url; // Cleanup Message if (($intPosition = strpos($strMessage, "\n")) !== false) { $strMessage = trim(substr($strMessage, 0, $intPosition)); } Registry::SetValue('gitinfo_' . $strRegistryName . '_message', $strMessage); Registry::SetValue('gitinfo_' . $strRegistryName . '_date', $strDate); Registry::SetValue('gitinfo_' . $strRegistryName . '_url', $strUrl); }
/** * 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; }
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(); } }
/** * 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; }
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); }
function calculateValues(Group $objGroup) { global $startDate; global $endDate; //global $tempDate; global $objPersonArray; global $monthCount; $objGroupParticipationArray = $objGroup->GetGroupParticipationArray(); foreach ($objGroupParticipationArray as $objParticipation) { // If role is Volunteer or Volunteer Leader if ($objParticipation->GroupRole->GroupRoleTypeId == 1 || $objParticipation->GroupRole->GroupRoleTypeId == 3) { // If a volunteer, then instantiate arrays $tempDate = new QDateTime($startDate); while ($tempDate->IsEarlierOrEqualTo($endDate)) { if ($objParticipation->DateStart < $tempDate && ($objParticipation->DateEnd > $tempDate || $objParticipation->DateEnd == null)) { // Verify unique person each time if (!in_array($objParticipation->PersonId, $objPersonArray[$tempDate->__toString('MMM YYYY')])) { $objPersonArray[$tempDate->__toString('MMM YYYY')][] = $objParticipation->PersonId; $monthCount[$tempDate->__toString('MMM YYYY')]++; } } $tempDate->AddMonths(1); } } } }
public static function ParseForDateTimeValue($strText) { // Trim and Clean $strText = strtolower(trim($strText)); while (strpos($strText, ' ') !== false) { $strText = str_replace(' ', ' ', $strText); } $strText = str_replace('.', '', $strText); $strText = str_replace('@', ' ', $strText); // Are we ATTEMPTING to parse a Time value? if (strpos($strText, ':') === false && strpos($strText, 'am') === false && strpos($strText, 'pm') === false) { // There is NO TIME VALUE $dttToReturn = new QDateTime($strText); if ($dttToReturn->IsDateNull()) { return null; } else { return $dttToReturn; } } // Add ':00' if it doesn't exist AND if 'am' or 'pm' exists if (strpos($strText, 'pm') !== false && strpos($strText, ':') === false) { $strText = str_replace(' pm', ':00 pm', $strText, $intCount); if (!$intCount) { $strText = str_replace('pm', ':00 pm', $strText, $intCount); } } else { if (strpos($strText, 'am') !== false && strpos($strText, ':') === false) { $strText = str_replace(' am', ':00 am', $strText, $intCount); if (!$intCount) { $strText = str_replace('am', ':00 am', $strText, $intCount); } } } $dttToReturn = new QDateTime($strText); if ($dttToReturn->IsDateNull()) { return null; } else { return $dttToReturn; } }
/** * 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(); }
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(); } }