当前位置: 首页>>代码示例>>PHP>>正文


PHP eZDateTime::setMDYHMS方法代码示例

本文整理汇总了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;
                                     }
                                 }
                             }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:67,代码来源:ezooimport.php

示例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;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:37,代码来源:ezdatetimetype.php

示例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();
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:15,代码来源:eznewsletterhandler.php


注:本文中的eZDateTime::setMDYHMS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。