コード例 #1
0
 /**
  * @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) {
         if ($this->currentLanguageUid) {
             $fields = $this->cObject->enableFields('pages_language_overlay');
             $overlay = $this->database->exec_SELECTgetSingleRow('uid', 'pages_language_overlay', ' pid = ' . intval($uid) . ' AND sys_language_uid = ' . $this->currentLanguageUid . $fields);
             if (!is_array($overlay)) {
                 continue;
             }
         }
         // Build URL
         $url = $obj->getUriBuilder()->setTargetPageUid($uid)->build();
         // can't generate a valid url
         if (!strlen($url)) {
             continue;
         }
         // Get Record
         $record = \TYPO3\CMS\Backend\Utility\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));
         #$geo = new Tx_GoogleServices_Domain_Model_Node_Geo();
         #$geo->setFormat('kml');
         #$node->setGeo($geo);
         $nodes[] = $node;
     }
     return $nodes;
 }
コード例 #2
0
 /**
  * Returns a single record. If TCA exists for a given table, then enable delete columns are taken into account.
  *
  * @param string $table The table to look in.
  * @param int $uid The uid to get.
  * @param string $fields The fields to get, all by default.
  * @param boolean $ignoreEnable Wether or not to ignore enable field delete.
  * @return mixed The resulting row array or false.
  */
 public function getRecord($table, $uid, $fields = '*', $ignoreEnable = false)
 {
     $whereParts = array($table . '.uid = ' . intval($uid));
     $ctrl = $GLOBALS['TCA'][$table]['ctrl'];
     if (is_array($ctrl)) {
         // Delete field check:
         if ($ctrl['delete']) {
             $whereParts[] = $table . '.' . $ctrl['delete'] . '=0';
         }
     }
     return $this->db->exec_SELECTgetSingleRow($fields, $table, implode(' AND ', $whereParts));
 }