示例#1
0
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 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);
     }
 }
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);
}
示例#5
0
 /**
  * Shortcut to output the current datetime in any defined format.  Follows the same
  * formatting mechanism as __toString.  This is basically a shortcut to doing:
  *    $dttNow = new QDateTime(QDateTime::Now);
  *    $dttNow->__toString($strFormat);
  *
  * @param string $strFormat the format of the datetime
  * @return string the formatted current datetime as a string
  */
 public static function NowToString($strFormat = null)
 {
     if (is_null($strFormat)) {
         $strFormat = QDateTime::$DefaultFormat;
     }
     $dttNow = new QDateTime(QDateTime::Now);
     return $dttNow->__toString($strFormat);
 }
示例#6
0
 public static function NowToString($strFormat = null)
 {
     $dttNow = new QDateTime(QDateTime::Now);
     return $dttNow->__toString($strFormat);
 }
示例#7
0
		Using <b>$blnForceUpdate</b> to avoid the <b>Optimistic Locking Exception</b><br/>
		<input type="submit" id="double_force" name="double_force" value="Force Update Second Object"/><br/><br/><br/>
	</div></form>

<?php 
// Load the Two Person objects (same instance -- let them both be Person ID #4)
$objPerson1 = PersonWithLock::Load(5);
$objPerson2 = PersonWithLock::Load(5);
// Some RDBMS Vendors' TIMESTAMP is only precise to the second
// Let's force a delay to the next second to ensure timestamp functionality
// Note: on most web applications, because Optimistic Locking are more application user-
// level constraints instead of systematic ones, this delay is inherit with the web
// application paradigm.  The following delay is just to simulate that paradigm.
$dttNow = new QDateTime(QDateTime::Now);
while ($objPerson1->SysTimestamp == $dttNow->__toString(QDateTime::FormatIso)) {
    $dttNow = new QDateTime(QDateTime::Now);
}
// Make Changes to the Object so that the Save Will Update Something
if ($objPerson1->FirstName == 'Al') {
    $objPerson1->FirstName = 'Alfred';
    $objPerson2->FirstName = 'Al';
} else {
    $objPerson1->FirstName = 'Al';
    $objPerson2->FirstName = 'Alfred';
}
switch (true) {
    case array_key_exists('single', $_POST):
        $objPerson1->Save();
        _p('Person Id #' . $objPerson1->Id . ' saved.  Name is now ' . $objPerson1->FirstName);
        _p('.<br/>', false);
示例#8
0
文件: index.php 项目: alcf/chms
 public function colDate_Render(SimpleXmlElement $objErrorXml)
 {
     $dttDate = new QDateTime($objErrorXml->isoDateTime);
     return $dttDate->__toString('MMM D') . '<br/><span class="meta">' . $dttDate->__toString('h:mm:ss&nbsp;z') . '</span>';
 }
 /**
  * Displays the timezone of a given datetime WITH a link to the user's "Edit Profile" page (to update
  * his/her timezone preferences) if the user is logged in.
  * @param QDateTime $dttDateTime
  * @param boolean $blnDisplayOutput whether or not to print the actual output, or just return it
  * @return string the html to be outputted
  */
 public static function DisplayTimezoneLink(QDateTime $dttDateTime, $blnDisplayOutput = true)
 {
     if ($dttDateTime) {
         if (QApplication::$Person) {
             $strToReturn = '<a href="/profile/edit.php" title="update timezone settings">' . $dttDateTime->__toString('ttt') . '</a>';
         } else {
             $strToReturn = $dttDateTime->__toString('ttt');
         }
     } else {
         $strToReturn = '';
     }
     if ($blnDisplayOutput) {
         print $strToReturn;
     }
     return $strToReturn;
 }