Example #1
0
    /**
     * 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>';
    }