예제 #1
0
 /**
  * Gets the entries for the action menu
  *
  * @return array Array of action menu entries
  * @author Steffen Kamper <*****@*****.**>
  * @author Ingo Renner <*****@*****.**>
  */
 protected function getActionEntries()
 {
     $actions = array();
     if ($GLOBALS['BE_USER']->isAdmin()) {
         $queryResource = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'sys_action', 'pid = 0 AND hidden=0', '', 'sys_action.sorting');
     } else {
         $groupList = 0;
         if ($GLOBALS['BE_USER']->groupList) {
             $groupList = $GLOBALS['BE_USER']->groupList;
         }
         $queryResource = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query('sys_action.*', 'sys_action', 'sys_action_asgr_mm', 'be_groups', ' AND be_groups.uid IN (' . $groupList . ') AND sys_action.pid = 0 AND sys_action.hidden = 0', 'sys_action.uid', 'sys_action.sorting');
     }
     if ($queryResource) {
         while ($actionRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($queryResource)) {
             $actions[] = array($actionRow['title'], 'mod.php?M=user_task&SET[mode]=tasks&SET[function]=sys_action.TYPO3\\CMS\\SysAction\\ActionTask&show=' . $actionRow['uid'], \t3lib_iconworks::getSpriteIconForRecord('sys_action', $actionRow));
         }
         $GLOBALS['TYPO3_DB']->sql_free_result($queryResource);
     }
     return $actions;
 }
예제 #2
0
 /**
  * Add entries for a single record
  *
  * @param string $table Table name
  * @param integer $uid Record uid
  * @param array $lines Output lines array (is passed by reference and modified)
  * @param string $preCode Pre-HTML code
  * @param boolean $checkImportInPidRecord If you want import validation, you can set this so it checks if the import can take place on the specified page.
  * @return void
  * @todo Define visibility
  */
 public function singleRecordLines($table, $uid, &$lines, $preCode, $checkImportInPidRecord = 0)
 {
     global $LANG;
     // Get record:
     $record = $this->dat['header']['records'][$table][$uid];
     unset($this->remainHeader['records'][$table][$uid]);
     if (!is_array($record) && !($table === 'pages' && !$uid)) {
         $this->error('MISSING RECORD: ' . $table . ':' . $uid, 1);
     }
     // Begin to create the line arrays information record, pInfo:
     $pInfo = array();
     $pInfo['ref'] = $table . ':' . $uid;
     // Unknown table name:
     if ($table === '_SOFTREF_') {
         $pInfo['preCode'] = $preCode;
         $pInfo['title'] = '<em>' . $GLOBALS['LANG']->getLL('impexpcore_singlereco_softReferencesFiles', 1) . '</em>';
     } elseif (!isset($GLOBALS['TCA'][$table])) {
         // Unknown table name:
         $pInfo['preCode'] = $preCode;
         $pInfo['msg'] = 'UNKNOWN TABLE \'' . $pInfo['ref'] . '\'';
         $pInfo['title'] = '<em>' . htmlspecialchars($record['title']) . '</em>';
     } else {
         // Otherwise, set table icon and title.
         // Import Validation (triggered by $this->display_import_pid_record) will show messages if import is not possible of various items.
         if (is_array($this->display_import_pid_record)) {
             if ($checkImportInPidRecord) {
                 if (!$GLOBALS['BE_USER']->doesUserHaveAccess($this->display_import_pid_record, $table === 'pages' ? 8 : 16)) {
                     $pInfo['msg'] .= '\'' . $pInfo['ref'] . '\' cannot be INSERTED on this page! ';
                 }
                 if (!$this->checkDokType($table, $this->display_import_pid_record['doktype']) && !$GLOBALS['TCA'][$table]['ctrl']['rootLevel']) {
                     $pInfo['msg'] .= '\'' . $table . '\' cannot be INSERTED on this page type (change page type to \'Folder\'.) ';
                 }
             }
             if (!$GLOBALS['BE_USER']->check('tables_modify', $table)) {
                 $pInfo['msg'] .= 'You are not allowed to CREATE \'' . $table . '\' tables! ';
             }
             if ($GLOBALS['TCA'][$table]['ctrl']['readOnly']) {
                 $pInfo['msg'] .= 'TABLE \'' . $table . '\' is READ ONLY! ';
             }
             if ($GLOBALS['TCA'][$table]['ctrl']['adminOnly'] && !$GLOBALS['BE_USER']->isAdmin()) {
                 $pInfo['msg'] .= 'TABLE \'' . $table . '\' is ADMIN ONLY! ';
             }
             if ($GLOBALS['TCA'][$table]['ctrl']['is_static']) {
                 $pInfo['msg'] .= 'TABLE \'' . $table . '\' is a STATIC TABLE! ';
             }
             if ($GLOBALS['TCA'][$table]['ctrl']['rootLevel']) {
                 $pInfo['msg'] .= 'TABLE \'' . $table . '\' will be inserted on ROOT LEVEL! ';
             }
             $diffInverse = FALSE;
             if ($this->update) {
                 // In case of update-PREVIEW we swap the diff-sources.
                 $diffInverse = TRUE;
                 $recInf = $this->doesRecordExist($table, $uid, $this->showDiff ? '*' : '');
                 $pInfo['updatePath'] = $recInf ? htmlspecialchars($this->getRecordPath($recInf['pid'])) : '<strong>NEW!</strong>';
                 // Mode selector:
                 $optValues = array();
                 $optValues[] = $recInf ? $LANG->getLL('impexpcore_singlereco_update') : $LANG->getLL('impexpcore_singlereco_insert');
                 if ($recInf) {
                     $optValues['as_new'] = $LANG->getLL('impexpcore_singlereco_importAsNew');
                 }
                 if ($recInf) {
                     if (!$this->global_ignore_pid) {
                         $optValues['ignore_pid'] = $LANG->getLL('impexpcore_singlereco_ignorePid');
                     } else {
                         $optValues['respect_pid'] = $LANG->getLL('impexpcore_singlereco_respectPid');
                     }
                 }
                 if (!$recInf && $GLOBALS['BE_USER']->isAdmin()) {
                     $optValues['force_uid'] = sprintf($LANG->getLL('impexpcore_singlereco_forceUidSAdmin'), $uid);
                 }
                 $optValues['exclude'] = $LANG->getLL('impexpcore_singlereco_exclude');
                 $pInfo['updateMode'] = $this->renderSelectBox('tx_impexp[import_mode][' . $table . ':' . $uid . ']', $this->import_mode[$table . ':' . $uid], $optValues);
             }
             // Diff vieiw:
             if ($this->showDiff) {
                 // For IMPORTS, get new id:
                 if ($newUid = $this->import_mapId[$table][$uid]) {
                     $diffInverse = FALSE;
                     $recInf = $this->doesRecordExist($table, $newUid, '*');
                     \TYPO3\CMS\Backend\Utility\BackendUtility::workspaceOL($table, $recInf);
                 }
                 if (is_array($recInf)) {
                     $pInfo['showDiffContent'] = $this->compareRecords($recInf, $this->dat['records'][$table . ':' . $uid]['data'], $table, $diffInverse);
                 }
             }
         }
         $pInfo['preCode'] = $preCode . \t3lib_iconworks::getSpriteIconForRecord($table, (array) $this->dat['records'][$table . ':' . $uid]['data'], array('title' => htmlspecialchars($table . ':' . $uid)));
         $pInfo['title'] = htmlspecialchars($record['title']);
         // View page:
         if ($table === 'pages') {
             $viewID = $this->mode === 'export' ? $uid : ($this->doesImport ? $this->import_mapId['pages'][$uid] : 0);
             if ($viewID) {
                 $pInfo['title'] = '<a href="#" onclick="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::viewOnClick($viewID, $GLOBALS['BACK_PATH'])) . 'return false;">' . $pInfo['title'] . '</a>';
             }
         }
     }
     $pInfo['class'] = $table == 'pages' ? 'bgColor4-20' : 'bgColor4';
     $pInfo['type'] = 'record';
     $pInfo['size'] = $record['size'];
     $lines[] = $pInfo;
     // File relations:
     if (is_array($record['filerefs'])) {
         $this->addFiles($record['filerefs'], $lines, $preCode);
     }
     // DB relations
     if (is_array($record['rels'])) {
         $this->addRelations($record['rels'], $lines, $preCode);
     }
     // Soft ref
     if (count($record['softrefs'])) {
         $preCode_A = $preCode . '&nbsp;&nbsp;&nbsp;&nbsp;';
         $preCode_B = $preCode . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
         foreach ($record['softrefs'] as $info) {
             $pInfo = array();
             $pInfo['preCode'] = $preCode_A . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-status-reference-soft');
             $pInfo['title'] = '<em>' . $info['field'] . ', "' . $info['spKey'] . '" </em>: <span title="' . htmlspecialchars($info['matchString']) . '">' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($info['matchString'], 60)) . '</span>';
             if ($info['subst']['type']) {
                 if (strlen($info['subst']['title'])) {
                     $pInfo['title'] .= '<br/>' . $preCode_B . '<strong>' . $LANG->getLL('impexpcore_singlereco_title', 1) . '</strong> ' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($info['subst']['title'], 60));
                 }
                 if (strlen($info['subst']['description'])) {
                     $pInfo['title'] .= '<br/>' . $preCode_B . '<strong>' . $LANG->getLL('impexpcore_singlereco_descr', 1) . '</strong> ' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($info['subst']['description'], 60));
                 }
                 $pInfo['title'] .= '<br/>' . $preCode_B . ($info['subst']['type'] == 'file' ? $LANG->getLL('impexpcore_singlereco_filename', 1) . ' <strong>' . $info['subst']['relFileName'] . '</strong>' : '') . ($info['subst']['type'] == 'string' ? $LANG->getLL('impexpcore_singlereco_value', 1) . ' <strong>' . $info['subst']['tokenValue'] . '</strong>' : '') . ($info['subst']['type'] == 'db' ? $LANG->getLL('impexpcore_softrefsel_record', 1) . ' <strong>' . $info['subst']['recordRef'] . '</strong>' : '');
             }
             $pInfo['ref'] = 'SOFTREF';
             $pInfo['size'] = '';
             $pInfo['class'] = 'bgColor3';
             $pInfo['type'] = 'softref';
             $pInfo['_softRefInfo'] = $info;
             $pInfo['type'] = 'softref';
             if ($info['error'] && !\TYPO3\CMS\Core\Utility\GeneralUtility::inList('editable,exclude', $this->softrefCfg[$info['subst']['tokenID']]['mode'])) {
                 $pInfo['msg'] .= $info['error'];
             }
             $lines[] = $pInfo;
             // Add relations:
             if ($info['subst']['type'] == 'db') {
                 list($tempTable, $tempUid) = explode(':', $info['subst']['recordRef']);
                 $this->addRelations(array(array('table' => $tempTable, 'id' => $tempUid, 'tokenID' => $info['subst']['tokenID'])), $lines, $preCode_B, array(), '');
             }
             // Add files:
             if ($info['subst']['type'] == 'file') {
                 $this->addFiles(array($info['file_ID']), $lines, $preCode_B, '', $info['subst']['tokenID']);
             }
         }
     }
 }
예제 #3
0
    /**
     * Create configuration form
     *
     * @param	array		Form configurat data
     * @param	array		Table row accumulation variable. This is filled with table rows.
     * @return	void		Sets content in $this->content
     */
    function makeConfigurationForm($inData, &$row)
    {
        global $LANG;
        $nameSuggestion = '';
        // Page tree export options:
        if (isset($inData['pagetree']['id'])) {
            $nameSuggestion .= 'tree_PID' . $inData['pagetree']['id'] . '_L' . $inData['pagetree']['levels'];
            $row[] = '
				<tr class="tableheader bgColor5">
					<td colspan="2">' . $LANG->getLL('makeconfig_exportPagetreeConfiguration', 1) . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeCfg', $GLOBALS['BACK_PATH'], '') . '</td>
				</tr>';
            $row[] = '
				<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('makeconfig_pageId', 1) . '</strong></td>
					<td>' . htmlspecialchars($inData['pagetree']['id']) . '<input type="hidden" value="' . htmlspecialchars($inData['pagetree']['id']) . '" name="tx_impexp[pagetree][id]" /></td>
				</tr>';
            $row[] = '
				<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('makeconfig_tree', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeDisplay', $GLOBALS['BACK_PATH'], '') . '</td>
					<td>' . ($this->treeHTML ? $this->treeHTML : $LANG->getLL('makeconfig_noTreeExportedOnly', 1)) . '</td>
				</tr>';
            $opt = array('-2' => $LANG->getLL('makeconfig_tablesOnThisPage'), '-1' => $LANG->getLL('makeconfig_expandedTree'), '0' => $LANG->getLL('makeconfig_onlyThisPage'), '1' => $LANG->getLL('makeconfig_1Level'), '2' => $LANG->getLL('makeconfig_2Levels'), '3' => $LANG->getLL('makeconfig_3Levels'), '4' => $LANG->getLL('makeconfig_4Levels'), '999' => $LANG->getLL('makeconfig_infinite'));
            $row[] = '
				<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('makeconfig_levels', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeMode', $GLOBALS['BACK_PATH'], '') . '</td>
					<td>' . $this->renderSelectBox('tx_impexp[pagetree][levels]', $inData['pagetree']['levels'], $opt) . '</td>
				</tr>';
            $row[] = '
				<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('makeconfig_includeTables', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'pageTreeRecordLimit', $GLOBALS['BACK_PATH'], '') . '</td>
					<td>' . $this->tableSelector('tx_impexp[pagetree][tables]', $inData['pagetree']['tables'], 'pages') . '<br/>
						' . $LANG->getLL('makeconfig_maxNumberOfRecords', 1) . '<br/>
						<input type="text" name="tx_impexp[pagetree][maxNumber]" value="' . htmlspecialchars($inData['pagetree']['maxNumber']) . '"' . $this->doc->formWidth(10) . ' /><br/>
					</td>
				</tr>';
        }
        // Single record export:
        if (is_array($inData['record'])) {
            $row[] = '
				<tr class="tableheader bgColor5">
					<td colspan="2">' . $LANG->getLL('makeconfig_exportSingleRecord', 1) . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'singleRecord', $GLOBALS['BACK_PATH'], '') . '</td>
				</tr>';
            foreach ($inData['record'] as $ref) {
                $rParts = explode(':', $ref);
                $tName = $rParts[0];
                $rUid = $rParts[1];
                $nameSuggestion .= $tName . '_' . $rUid;
                $rec = t3lib_BEfunc::getRecordWSOL($tName, $rUid);
                $row[] = '
				<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('makeconfig_record', 1) . '</strong></td>
					<td>' . t3lib_iconworks::getSpriteIconForRecord($tName, $rec) . t3lib_BEfunc::getRecordTitle($tName, $rec, TRUE) . '<input type="hidden" name="tx_impexp[record][]" value="' . htmlspecialchars($tName . ':' . $rUid) . '" /></td>
				</tr>';
            }
        }
        // Single tables/pids:
        if (is_array($inData['list'])) {
            $row[] = '
				<tr class="tableheader bgColor5">
					<td colspan="2">' . $LANG->getLL('makeconfig_exportTablesFromPages', 1) . '</td>
				</tr>';
            $tblList = '';
            foreach ($inData['list'] as $ref) {
                $rParts = explode(':', $ref);
                $tName = $rParts[0];
                if ($GLOBALS['BE_USER']->check('tables_select', $tName)) {
                    $rec = t3lib_BEfunc::getRecordWSOL('pages', $rParts[1]);
                    $tblList .= 'Table "' . $tName . '" from ' . t3lib_iconworks::getSpriteIconForRecord('pages', $rec) . t3lib_BEfunc::getRecordTitle('pages', $rec, TRUE) . '<input type="hidden" name="tx_impexp[list][]" value="' . htmlspecialchars($ref) . '" /><br/>';
                }
            }
            $row[] = '
			<tr class="bgColor4">
				<td><strong>' . $LANG->getLL('makeconfig_tablePids', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'tableList', $GLOBALS['BACK_PATH'], '') . '</td>
				<td>' . $tblList . '</td>
			</tr>';
            $row[] = '
				<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('makeconfig_maxNumberOfRecords', 1) . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'tableListMaxNumber', $GLOBALS['BACK_PATH'], '') . '</strong></td>
					<td>
						<input type="text" name="tx_impexp[listCfg][maxNumber]" value="' . htmlspecialchars($inData['listCfg']['maxNumber']) . '"' . $this->doc->formWidth(10) . ' /><br/>
					</td>
				</tr>';
        }
        $row[] = '
			<tr class="tableheader bgColor5">
				<td colspan="2">' . $LANG->getLL('makeconfig_relationsAndExclusions', 1) . '</td>
			</tr>';
        // Add relation selector:
        $row[] = '
				<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('makeconfig_includeRelationsToTables', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'inclRelations', $GLOBALS['BACK_PATH'], '') . '</td>
					<td>' . $this->tableSelector('tx_impexp[external_ref][tables]', $inData['external_ref']['tables']) . '</td>
				</tr>';
        // Add static relation selector:
        $row[] = '
				<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('makeconfig_useStaticRelationsFor', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'staticRelations', $GLOBALS['BACK_PATH'], '') . '</td>
					<td>' . $this->tableSelector('tx_impexp[external_static][tables]', $inData['external_static']['tables']) . '<br/>
						<label for="checkShowStaticRelations">' . $LANG->getLL('makeconfig_showStaticRelations', 1) . '</label> <input type="checkbox" name="tx_impexp[showStaticRelations]" id="checkShowStaticRelations" value="1"' . ($inData['showStaticRelations'] ? ' checked="checked"' : '') . ' />
						</td>
				</tr>';
        // Exclude:
        $excludeHiddenFields = '';
        if (is_array($inData['exclude'])) {
            foreach ($inData['exclude'] as $key => $value) {
                $excludeHiddenFields .= '<input type="hidden" name="tx_impexp[exclude][' . $key . ']" value="1" />';
            }
        }
        $row[] = '
				<tr class="bgColor4">
					<td><strong>' . $LANG->getLL('makeconfig_excludeElements', 1) . '</strong>' . t3lib_BEfunc::cshItem('xMOD_tx_impexp', 'excludedElements', $GLOBALS['BACK_PATH'], '') . '</td>
					<td>' . $excludeHiddenFields . '
					' . (count($inData['exclude']) ? '<em>' . implode(', ', array_keys($inData['exclude'])) . '</em><hr/><label for="checkExclude">' . $LANG->getLL('makeconfig_clearAllExclusions', 1) . '</label> <input type="checkbox" name="tx_impexp[exclude]" id="checkExclude" value="1" />' : $LANG->getLL('makeconfig_noExcludedElementsYet', 1)) . '
					</td>
				</tr>';
        // Add buttons:
        $row[] = '
				<tr class="bgColor4">
					<td>&nbsp;</td>
					<td>
						<input type="submit" value="' . $LANG->getLL('makeadvanc_update', 1) . '" />
						<input type="hidden" name="tx_impexp[download_export_name]" value="' . substr($nameSuggestion, 0, 30) . '" />
					</td>
				</tr>';
    }
 /**
  * Action to edit records
  *
  * @param	array		$record: sys_action record
  * @return	string list of records
  */
 protected function viewEditRecord($record)
 {
     $content = '';
     $actionList = array();
     $dbAnalysis = t3lib_div::makeInstance('t3lib_loadDBGroup');
     $dbAnalysis->fromTC = 0;
     $dbAnalysis->start($record['t4_recordsToEdit'], '*');
     $dbAnalysis->getFromDB();
     // collect the records
     foreach ($dbAnalysis->itemArray as $el) {
         $path = t3lib_BEfunc::getRecordPath($el['id'], $this->taskObject->perms_clause, $GLOBALS['BE_USER']->uc['titleLen']);
         $record = t3lib_BEfunc::getRecord($el['table'], $dbAnalysis->results[$el['table']][$el['id']]);
         $title = t3lib_BEfunc::getRecordTitle($el['table'], $dbAnalysis->results[$el['table']][$el['id']]);
         $description = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$el['table']]['ctrl']['title'], 1);
         if (isset($record['crdate'])) {
             // @todo: which information could be  needfull
             $description .= ' - ' . t3lib_BEfunc::dateTimeAge($record['crdate']);
         }
         $actionList[$el['id']] = array('title' => $title, 'description' => t3lib_BEfunc::getRecordTitle($el['table'], $dbAnalysis->results[$el['table']][$el['id']]), 'descriptionHtml' => $description, 'link' => $GLOBALS['BACK_PATH'] . 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv("REQUEST_URI")) . '&edit[' . $el['table'] . '][' . $el['id'] . ']=edit', 'icon' => t3lib_iconworks::getSpriteIconForRecord($el['table'], $dbAnalysis->results[$el['table']][$el['id']], array('title' => htmlspecialchars($path))));
     }
     // render the record list
     $content .= $this->taskObject->renderListMenu($actionList);
     return $content;
 }