本文整理汇总了PHP中eZDateTime::setMDYHMS方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDateTime::setMDYHMS方法的具体用法?PHP eZDateTime::setMDYHMS怎么用?PHP eZDateTime::setMDYHMS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDateTime
的用法示例。
在下文中一共展示了eZDateTime::setMDYHMS方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
//.........这里部分代码省略.........
continue;
}
$dateString = strip_tags($xmlTextArray[$sectionName]);
$dateArray = explode("/", $dateString);
if (count($dateArray) == 3) {
$year = $dateArray[2];
$month = $dateArray[1];
$day = $dateArray[0];
$date = new eZDate();
$contentClassAttribute = $dataMap[$attributeIdentifier];
$date->setMDY($month, $day, $year);
$dataMap[$attributeIdentifier]->setAttribute('data_int', $date->timeStamp());
$dataMap[$attributeIdentifier]->store();
}
break;
case "ezdatetime":
// Only support date formats as a single paragraph in a section with the format:
// day/month/year 14:00
if (!isset($xmlTextArray[$sectionName])) {
continue;
}
$dateString = trim(strip_tags($xmlTextArray[$sectionName]));
$dateTimeArray = explode(" ", $dateString);
$dateArray = explode("/", $dateTimeArray[0]);
$timeArray = explode(":", $dateTimeArray[1]);
if (count($dateArray) == 3 and count($timeArray) == 2) {
$year = $dateArray[2];
$month = $dateArray[1];
$day = $dateArray[0];
$hour = $timeArray[0];
$minute = $timeArray[1];
$dateTime = new eZDateTime();
$contentClassAttribute = $dataMap[$attributeIdentifier];
$dateTime->setMDYHMS($month, $day, $year, $hour, $minute, 0);
$dataMap[$attributeIdentifier]->setAttribute('data_int', $dateTime->timeStamp());
$dataMap[$attributeIdentifier]->store();
}
break;
case "ezimage":
$hasImage = false;
// Images are treated as an image object inside a paragrah.
// We fetch the first image object if there are multiple and ignore the rest
if (is_object($sectionNodeHash[$sectionName])) {
// Look for paragraphs in the section
foreach ($sectionNodeHash[$sectionName]->childNodes as $paragraph) {
if (!$paragraph->hasChildNodes()) {
continue;
}
// Look for frame node
foreach ($paragraph->childNodes as $frame) {
// finally look for the image node
$children = $frame->childNodes;
$imageNode = $children->item(0);
if ($imageNode && $imageNode->localName == "image") {
$fileName = ltrim($imageNode->getAttributeNS(self::NAMESPACE_XLINK, 'href'), '#');
$filePath = $this->ImportDir . $fileName;
if (file_exists($filePath)) {
$imageContent = $dataMap[$attributeIdentifier]->attribute('content');
$imageContent->initializeFromFile($filePath, false, basename($filePath));
$imageContent->store($dataMap[$attributeIdentifier]);
$dataMap[$attributeIdentifier]->store();
}
$hasImage = true;
}
}
}
示例2: fetchCollectionAttributeHTTPInput
function fetchCollectionAttributeHTTPInput( $collection, $collectionAttribute, $http, $base, $contentObjectAttribute )
{
$contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
$useSeconds = ( $contentClassAttribute->attribute( self::USE_SECONDS_FIELD ) == 1 );
if ( $http->hasPostVariable( $base . '_datetime_year_' . $contentObjectAttribute->attribute( 'id' ) ) and
$http->hasPostVariable( $base . '_datetime_month_' . $contentObjectAttribute->attribute( 'id' ) ) and
$http->hasPostVariable( $base . '_datetime_day_' . $contentObjectAttribute->attribute( 'id' ) ) and
$http->hasPostVariable( $base . '_datetime_hour_' . $contentObjectAttribute->attribute( 'id' ) ) and
$http->hasPostVariable( $base . '_datetime_minute_' . $contentObjectAttribute->attribute( 'id' ) ) and
( !$useSeconds or $http->hasPostVariable( $base . '_datetime_second_' . $contentObjectAttribute->attribute( 'id' ) ) ) )
{
$year = $http->postVariable( $base . '_datetime_year_' . $contentObjectAttribute->attribute( 'id' ) );
$month = $http->postVariable( $base . '_datetime_month_' . $contentObjectAttribute->attribute( 'id' ) );
$day = $http->postVariable( $base . '_datetime_day_' . $contentObjectAttribute->attribute( 'id' ) );
$hour = $http->postVariable( $base . '_datetime_hour_' . $contentObjectAttribute->attribute( 'id' ) );
$minute = $http->postVariable( $base . '_datetime_minute_' . $contentObjectAttribute->attribute( 'id' ) );
$second = $useSeconds ? $http->postVariable( $base . '_datetime_second_' . $contentObjectAttribute->attribute( 'id' ) ) : 0;
$dateTime = new eZDateTime();
$contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
if ( ( $year == '' and $month == ''and $day == '' and
$hour == '' and $minute == '' and ( !$useSeconds or $second == '' ) ) or
!checkdate( $month, $day, $year ) or $year < 1970 )
{
$dateTime->setTimeStamp( 0 );
}
else
{
$dateTime->setMDYHMS( $month, $day, $year, $hour, $minute, $second );
}
$collectionAttribute->setAttribute( 'data_int', $dateTime->timeStamp() );
return true;
}
return false;
}
示例3: getTimestamp
function getTimestamp($http, $id)
{
$day = $http->postVariable('newsletter_datetime_day_' . $id);
$month = $http->postVariable('newsletter_datetime_month_' . $id);
$year = $http->postVariable('newsletter_datetime_year_' . $id);
$hour = $http->postVariable('newsletter_datetime_hour_' . $id);
$minute = $http->postVariable('newsletter_datetime_minute_' . $id);
$dateTime = new eZDateTime();
if ($year == '' and $month == '' and $day == '' and $hour == '' and $minute == '' or !checkdate($month, $day, $year) or $year < 1970) {
$dateTime->setTimeStamp(0);
} else {
$dateTime->setMDYHMS($month, $day, $year, $hour, $minute, 0);
}
return $dateTime->timeStamp();
}