예제 #1
0
파일: index.php 프로젝트: paddyez/tq_seo
    /**
     * Create setting (root) entry for website (website-rootpage)
     *
     * @return	string
     */
    public function executeCreateSettingForPage()
    {
        global $BE_USER;
        global $TYPO3_DB;
        $rootPageList = tx_tqseo_backend_tools::getRootPageList();
        $rootSettingList = tx_tqseo_backend_tools::getRootPageSettingList();
        $pid = null;
        if (!empty($this->_moduleArgs['pid'])) {
            $pid = (int) $this->_moduleArgs['pid'];
        }
        if (empty($rootPageList[$pid])) {
            return $this->executeMain();
        }
        if (empty($rootSettingList[$pid])) {
            $data = array('pid' => $pid, 'crdate' => time(), 'tstamp' => time(), 'cruser_id' => $BE_USER->user['uid']);
            $TYPO3_DB->exec_INSERTquery('tx_tqseo_setting_root', $data);
            $uid = $TYPO3_DB->sql_insert_id();
        } else {
            $uid = $rootSettingList[$pid];
        }
        // Maybe there is a better solution than this js-redirect!?
        $link = t3lib_BEfunc::editOnClick('&edit[tx_tqseo_setting_root][' . $uid . ']=edit', $this->doc->backPath);
        return '<script type="text/javascript">
			function tq_redirect() {
				' . $link . '
			}
			tq_redirect();
			</script>';
    }
예제 #2
0
파일: index.php 프로젝트: paddyez/tq_seo
    /**
     * Sitemap list module
     *
     * @return	string
     */
    public function executeSitemapList()
    {
        global $TYPO3_DB, $LANG, $BACK_PATH;
        if (empty($this->_moduleArgs['rootPid'])) {
            return $this->executeMain();
        }
        $this->_menuBackLink = $this->_moduleLink('sitemap');
        $rootPageList = tx_tqseo_backend_tools::getRootPageList();
        $rootPid = (int) $this->_moduleArgs['rootPid'];
        $rootPage = $rootPageList[$rootPid];
        ###############################
        # Fetch
        ###############################
        $pageTsConf = t3lib_BEfunc::getPagesTSconfig($rootPid);
        $languageFullList = array(0 => array('label' => $LANG->getLL('default_language'), 'flag' => ''));
        if (!empty($pageTsConf['mod.']['SHARED.']['defaultLanguageFlag'])) {
            $languageFullList[0]['flag'] = $pageTsConf['mod.']['SHARED.']['defaultLanguageFlag'];
        }
        if (!empty($pageTsConf['mod.']['SHARED.']['defaultLanguageLabel'])) {
            $languageFullList[0]['label'] = $pageTsConf['mod.']['SHARED.']['defaultLanguageLabel'];
        }
        // Fetch other flags
        $res = $TYPO3_DB->exec_SELECTquery('uid, title, flag', 'sys_language', 'hidden = 0');
        while ($row = $TYPO3_DB->sql_fetch_assoc($res)) {
            $languageFullList[$row['uid']] = array('label' => htmlspecialchars($row['title']), 'flag' => htmlspecialchars($row['flag']));
        }
        // Langauges
        $languageList = array();
        $languageList[] = array(-1, $LANG->getLL('empty_search_page_language'));
        foreach ($languageFullList as $langId => $langRow) {
            $flag = '';
            // Flag (if available)
            if (!empty($langRow['flag'])) {
                $flag .= '<span class="t3-icon t3-icon-flags t3-icon-flags-' . $langRow['flag'] . ' t3-icon-' . $langRow['flag'] . '"></span>';
                $flag .= '&nbsp;';
            }
            // label
            $label = $langRow['label'];
            $languageList[] = array($langId, $label, $flag);
        }
        // Depth
        $depthList = array();
        $depthList[] = array(-1, $LANG->getLL('empty_search_page_depth'));
        $res = $TYPO3_DB->exec_SELECTquery('DISTINCT page_depth', 'tx_tqseo_sitemap', 'page_rootpid = ' . (int) $rootPid);
        while ($row = $TYPO3_DB->sql_fetch_assoc($res)) {
            $depth = $row['page_depth'];
            $depthList[] = array($depth, $depth);
        }
        ###############################
        # HTML
        ###############################
        $this->pageRenderer->addJsFile($BACK_PATH . t3lib_extMgm::extRelPath('tq_seo') . 'res/backend/js/Ext.ux.plugin.FitToParent.js');
        $this->pageRenderer->addJsFile($BACK_PATH . t3lib_extMgm::extRelPath('tq_seo') . 'res/backend/js/TQSeo.sitemap.js');
        // Include Ext JS inline code
        $this->pageRenderer->addJsInlineCode('TQSeo.sitemap', 'Ext.namespace("TQSeo.sitemap");

			TQSeo.sitemap.conf = {
				ajaxController			: ' . json_encode($this->doc->backPath . 'ajax.php?ajaxID=tx_tqseo_backend_ajax::sitemap') . ',
				pid						: ' . (int) $rootPid . ',
				renderTo				: "tx-tqseo-sitemap-grid",

				pagingSize				: 50,

				sortField				: "crdate",
				sortDir					: "DESC",

				filterIcon				: ' . json_encode(t3lib_iconWorks::getSpriteIcon('actions-system-tree-search-open')) . ',

				dataLanguage			: ' . json_encode($languageList) . ',
				dataDepth				: ' . json_encode($depthList) . ',

				criteriaFulltext		: "",
				criteriaPageUid			: "",
				criteriaPageLanguage	: "",
				criteriaPageDepth		: "",

				languageFullList		: ' . json_encode($languageFullList) . ',
			};

			// Localisation:
			TQSeo.sitemap.conf.lang = {
				title					: ' . json_encode(sprintf($LANG->getLL('title_sitemap_list'), $rootPage['title'], $rootPid)) . ',
				pagingMessage			: ' . json_encode($LANG->getLL('pager_results')) . ',
				pagingEmpty				: ' . json_encode($LANG->getLL('pager_noresults')) . ',
				sitemap_page_uid		: ' . json_encode($LANG->getLL('header_sitemap_page_uid')) . ',
				sitemap_page_url		: ' . json_encode($LANG->getLL('header_sitemap_page_url')) . ',
				sitemap_page_depth		: ' . json_encode($LANG->getLL('header_sitemap_page_depth')) . ',
				sitemap_page_language	: ' . json_encode($LANG->getLL('header_sitemap_page_language')) . ',
				sitemap_tstamp			: ' . json_encode($LANG->getLL('header_sitemap_tstamp')) . ',
				sitemap_crdate			: ' . json_encode($LANG->getLL('header_sitemap_crdate')) . ',

				labelSearchFulltext		: ' . json_encode($LANG->getLL('label_search_fulltext')) . ',
				emptySearchFulltext		: ' . json_encode($LANG->getLL('empty_search_fulltext')) . ',

				labelSearchPageUid		: ' . json_encode($LANG->getLL('label_search_page_uid')) . ',
				emptySearchPageUid		: ' . json_encode($LANG->getLL('empty_search_page_uid')) . ',

				labelSearchPageLanguage	: ' . json_encode($LANG->getLL('label_search_page_language')) . ',
				emptySearchPageLanguage	: ' . json_encode($LANG->getLL('empty_search_page_language')) . ',

				labelSearchPageDepth	: ' . json_encode($LANG->getLL('label_search_page_depth')) . ',
				emptySearchPageDepth	: ' . json_encode($LANG->getLL('empty_search_page_depth')) . ',

				buttonYes				: ' . json_encode($LANG->getLL('button_yes')) . ',
				buttonNo				: ' . json_encode($LANG->getLL('button_no')) . ',


				buttonDelete			: ' . json_encode($LANG->getLL('button_delete')) . ',
				buttonDeleteHint		: ' . json_encode($LANG->getLL('button_delete_hint')) . ',

				messageDeleteTitle			: ' . json_encode($LANG->getLL('message_delete_title')) . ',
				messageDeleteQuestion		: ' . json_encode($LANG->getLL('message_delete_question')) . ',
				errorDeleteFailedMessage	: ' . json_encode($LANG->getLL('message_delete_failed_body')) . ',

				errorNoSelectedItemsBody	: ' . json_encode($LANG->getLL('message_no_selected_items')) . ',

				today						: ' . json_encode($LANG->getLL('today')) . ',
				yesterday					: ' . json_encode($LANG->getLL('yesterday')) . '
			};
		');
        ###############################
        # Build HTML
        ###############################
        $ret = '<div id="tx-tqseo-sitemap-grid"></div>';
        return $ret;
    }
예제 #3
0
    /**
     * Return sitemap entry list for root tree
     *
     * @return	array
     */
    protected function _executeGetList()
    {
        global $TYPO3_DB;
        // Init
        $rootPageList = tx_tqseo_backend_tools::getRootPageList();
        $rootPid = (int) $this->_postVar['pid'];
        $offset = (int) $this->_postVar['start'];
        $limit = (int) $this->_postVar['limit'];
        $itemsPerPage = (int) $this->_postVar['pagingSize'];
        $searchFulltext = trim((string) $this->_postVar['criteriaFulltext']);
        $searchPageUid = trim((int) $this->_postVar['criteriaPageUid']);
        $searchPageLanguage = trim((string) $this->_postVar['criteriaPageLanguage']);
        $searchPageDepth = trim((string) $this->_postVar['criteriaPageDepth']);
        ###############################
        # Critera
        ###############################
        $where = array();
        // Root pid limit
        $where[] = 'page_rootpid = ' . (int) $rootPid;
        // Fulltext
        if (!empty($searchFulltext)) {
            $where[] = 'page_url LIKE ' . $TYPO3_DB->fullQuoteStr('%' . $searchFulltext . '%', 'tx_tqseo_sitemap');
        }
        // Page id
        if (!empty($searchPageUid)) {
            $where[] = 'page_uid = ' . (int) $searchPageUid;
        }
        // Lannguage
        if ($searchPageLanguage != -1 && strlen($searchPageLanguage) >= 1) {
            $where[] = 'page_language = ' . (int) $searchPageLanguage;
        }
        // Depth
        if ($searchPageDepth != -1 && strlen($searchPageDepth) >= 1) {
            $where[] = 'page_depth = ' . (int) $searchPageDepth;
        }
        // Build where
        $where = '( ' . implode(' ) AND ( ', $where) . ' )';
        ###############################
        # Pager
        ###############################
        // Fetch total count of items with this filter settings
        $res = $TYPO3_DB->exec_SELECTquery('COUNT(*) as count', 'tx_tqseo_sitemap', $where);
        $row = $TYPO3_DB->sql_fetch_assoc($res);
        $itemCount = $row['count'];
        ###############################
        # Sort
        ###############################
        // default sort
        $sort = 'page_depth ASC, page_uid ASC';
        if (!empty($this->_sortField) && !empty($this->_sortDir)) {
            // already filered
            $sort = $this->_sortField . ' ' . $this->_sortDir;
        }
        ###############################
        # Fetch sitemap
        ###############################
        $list = $TYPO3_DB->exec_SELECTgetRows('uid,
			 page_rootpid,
			 page_uid,
			 page_language,
			 page_url,
			 page_depth,
			 FROM_UNIXTIME(tstamp) as tstamp,
			 FROM_UNIXTIME(crdate) as crdate', 'tx_tqseo_sitemap', $where, '', $sort, $offset . ', ' . $itemsPerPage);
        $ret = array('results' => $itemCount, 'rows' => $list);
        return $ret;
    }