Example #1
0
 /**
  * Get the records
  *
  * @param int                                            $startPage
  * @param array                                          $basePages
  * @param Tx_GoogleServices_Controller_SitemapController $obj
  *
  * @return array|Tx_GoogleServices_Domain_Model_Node
  */
 public function getRecords($startPage, $basePages, Tx_GoogleServices_Controller_SitemapController $obj)
 {
     $nodes = array();
     foreach ($basePages as $uid) {
         $images = $this->getImagesByPages(array($uid));
         if (!sizeof($images)) {
             continue;
         }
         $imageNodes = array();
         foreach ($images as $imageReference) {
             /** @var $imageReference \TYPO3\CMS\Core\Resource\FileReference */
             $url = GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST') . '/' . $imageReference->getOriginalFile()->getPublicUrl();
             // Build Node
             $nodeImage = new Tx_GoogleServices_Domain_Model_Node_Image();
             $nodeImage->setLoc($url);
             $nodeImage->setTitle($imageReference->getTitle());
             $nodeImage->setCaption($imageReference->getDescription());
             $imageNodes[] = $nodeImage;
         }
         // Build URL
         $url = $obj->getUriBuilder()->setTargetPageUid($uid)->build();
         // can't generate a valid url
         if (!strlen($url)) {
             continue;
         }
         // Get Record
         $record = BackendUtility::getRecord('pages', $uid);
         // exclude Doctypes
         if (in_array($record['doktype'], array(4))) {
             continue;
         }
         // Build Node
         $node = new Tx_GoogleServices_Domain_Model_Node();
         $node->setLoc($url);
         $node->setPriority($this->getPriority($startPage, $record));
         $node->setChangefreq(\Tx_GoogleServices_Service_SitemapDataService::mapTimeout2Period($record['cache_timeout']));
         $node->setLastmod($this->getModifiedDate($record));
         $node->setImages($imageNodes);
         $nodes[] = $node;
     }
     return $nodes;
 }