当前位置: 首页>>代码示例>>PHP>>正文


PHP VersionState::cast方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Versioning\VersionState::cast方法的典型用法代码示例。如果您正苦于以下问题:PHP VersionState::cast方法的具体用法?PHP VersionState::cast怎么用?PHP VersionState::cast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Versioning\VersionState的用法示例。


在下文中一共展示了VersionState::cast方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getNewNode

 /**
  * Creates a node with the given record information
  *
  * @param array $record
  * @param int $mountPoint
  * @return \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode
  */
 public static function getNewNode($record, $mountPoint = 0)
 {
     if (self::$titleLength === NULL) {
         self::$useNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
         self::$addIdAsPrefix = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle');
         self::$addDomainName = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showDomainNameWithTitle');
         self::$backgroundColors = $GLOBALS['BE_USER']->getTSConfigProp('options.pageTree.backgroundColor');
         self::$titleLength = (int) $GLOBALS['BE_USER']->uc['titleLen'];
     }
     /** @var $subNode \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */
     $subNode = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode::class);
     $subNode->setRecord($record);
     $subNode->setCls($record['_CSSCLASS']);
     $subNode->setType('pages');
     $subNode->setId($record['uid']);
     $subNode->setMountPoint($mountPoint);
     $subNode->setWorkspaceId($record['_ORIG_uid'] ?: $record['uid']);
     $subNode->setBackgroundColor(self::$backgroundColors[$record['uid']]);
     $field = 'title';
     $text = $record['title'];
     if (self::$useNavTitle && trim($record['nav_title']) !== '') {
         $field = 'nav_title';
         $text = $record['nav_title'];
     }
     if (trim($text) === '') {
         $visibleText = '[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.no_title', TRUE) . ']';
     } else {
         $visibleText = $text;
     }
     $visibleText = GeneralUtility::fixed_lgd_cs($visibleText, self::$titleLength);
     $suffix = '';
     if (self::$addDomainName) {
         $domain = self::getDomainName($record['uid']);
         $suffix = $domain !== '' ? ' [' . $domain . ']' : '';
     }
     $qtip = str_replace(' - ', '<br />', htmlspecialchars(BackendUtility::titleAttribForPages($record, '', FALSE)));
     $prefix = '';
     $lockInfo = BackendUtility::isRecordLocked('pages', $record['uid']);
     if (is_array($lockInfo)) {
         $qtip .= '<br />' . htmlspecialchars($lockInfo['msg']);
         $prefix .= IconUtility::getSpriteIcon('status-warning-in-use', array('class' => 'typo3-pagetree-status'));
     }
     // Call stats information hook
     $stat = '';
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
         $_params = array('pages', $record['uid']);
         $fakeThis = NULL;
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
             $stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $fakeThis);
         }
     }
     $prefix .= htmlspecialchars(self::$addIdAsPrefix ? '[' . $record['uid'] . '] ' : '');
     $subNode->setEditableText($text);
     $subNode->setText(htmlspecialchars($visibleText), $field, $prefix, htmlspecialchars($suffix) . $stat);
     $subNode->setQTip($qtip);
     if ((int) $record['uid'] !== 0) {
         $spriteIconCode = IconUtility::getSpriteIconForRecord('pages', $record);
     } else {
         $spriteIconCode = IconUtility::getSpriteIcon('apps-pagetree-root');
     }
     $subNode->setSpriteIconCode($spriteIconCode);
     if (!$subNode->canCreateNewPages() || VersionState::cast($record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
         $subNode->setIsDropTarget(FALSE);
     }
     if (!$subNode->canBeEdited() || !$subNode->canBeRemoved() || VersionState::cast($record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
         $subNode->setDraggable(FALSE);
     }
     return $subNode;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:76,代码来源:Commands.php

示例2: movePlhOL

 /**
  * Checks if record is a move-placeholder (t3ver_state==VersionState::MOVE_PLACEHOLDER) and if so
  * it will set $row to be the pointed-to live record (and return TRUE)
  *
  * @param string $table Table name
  * @param array $row Row (passed by reference) - must be online record!
  * @return boolean TRUE if overlay is made.
  * @see PageRepository::movePlhOl()
  */
 public static function movePlhOL($table, &$row)
 {
     // Only for WS ver 2... (moving)
     if ($table == 'pages' || (int) $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) {
         // If t3ver_move_id or t3ver_state is not found, then find it... (but we like best if it is here...)
         if (!isset($row['t3ver_move_id']) || !isset($row['t3ver_state'])) {
             $moveIDRec = self::getRecord($table, $row['uid'], 't3ver_move_id, t3ver_state');
             $moveID = $moveIDRec['t3ver_move_id'];
             $versionState = VersionState::cast($moveIDRec['t3ver_state']);
         } else {
             $moveID = $row['t3ver_move_id'];
             $versionState = VersionState::cast($row['t3ver_state']);
         }
         // Find pointed-to record.
         if ($versionState->equals(VersionState::MOVE_PLACEHOLDER) && $moveID) {
             if ($origRow = self::getRecord($table, $moveID, implode(',', array_keys($row)))) {
                 $row = $origRow;
                 return TRUE;
             }
         }
     }
     return FALSE;
 }
开发者ID:samuweiss,项目名称:TYPO3-Site,代码行数:32,代码来源:BackendUtility.php

示例3: getIcon

 /**
  * Creates the icon for input table/row
  * Returns filename for the image icon, relative to PATH_typo3
  *
  * @param string $table The table name
  * @param array $row The table row ("enablefields" are at least needed for correct icon display and for pages records some more fields in addition!)
  * @param boolean $shaded If set, the icon will be grayed/shaded
  * @return string Icon filename
  * @see getIconImage()
  */
 public static function getIcon($table, $row = array(), $shaded = FALSE)
 {
     // Flags
     // If set, then the usergroup number will NOT be printed unto the icon. NOTICE.
     // The icon is generated only if a default icon for groups is not found... So effectively this is ineffective.
     $doNotRenderUserGroupNumber = TRUE;
     // Shadow
     if (!empty($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) && !empty($row['t3ver_state'])) {
         switch (VersionState::cast($row['t3ver_state'])) {
             case new VersionState(VersionState::NEW_PLACEHOLDER):
                 return 'gfx/i/shadow_hide.png';
                 break;
             case new VersionState(VersionState::DELETE_PLACEHOLDER):
                 return 'gfx/i/shadow_delete.png';
                 break;
             case new VersionState(VersionState::MOVE_PLACEHOLDER):
                 return 'gfx/i/shadow_moveto_plh.png';
                 break;
             case new VersionState(VersionState::MOVE_POINTER):
                 return 'gfx/i/shadow_moveto_pointer.png';
                 break;
         }
     }
     // First, find the icon file name. This can depend on configuration in TCA, field values and more:
     if ($table == 'pages') {
         $iconfile = $GLOBALS['PAGES_TYPES'][$row['doktype']]['icon'];
         if (!$iconfile) {
             $iconfile = $GLOBALS['PAGES_TYPES']['default']['icon'];
         }
     } else {
         if (!($iconfile = $GLOBALS['TCA'][$table]['ctrl']['typeicons'][$row[$GLOBALS['TCA'][$table]['ctrl']['typeicon_column']]])) {
             $iconfile = $GLOBALS['TCA'][$table]['ctrl']['iconfile'] ?: $table . '.gif';
         }
     }
     // Setting path of iconfile if not already set. Default is "gfx/i/"
     if (!strstr($iconfile, '/')) {
         $iconfile = 'gfx/i/' . $iconfile;
     }
     // Setting the absolute path where the icon should be found as a file:
     if (substr($iconfile, 0, 3) == '../') {
         $absfile = PATH_site . substr($iconfile, 3);
     } else {
         $absfile = PATH_typo3 . $iconfile;
     }
     // Initializing variables, all booleans except otherwise stated:
     $hidden = FALSE;
     $timing = FALSE;
     $futuretiming = FALSE;
     // In fact an integer value
     $user = FALSE;
     $deleted = FALSE;
     // Set, if a page-record (only pages!) has the extend-to-subpages flag set.
     $protectSection = FALSE;
     $noIconFound = $row['_NO_ICON_FOUND'] ? TRUE : FALSE;
     // + $shaded which is also boolean!
     // Icon state based on "enableFields":
     if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
         $enCols = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns'];
         // If "hidden" is enabled:
         if ($enCols['disabled']) {
             if ($row[$enCols['disabled']]) {
                 $hidden = TRUE;
             }
         }
         // If a "starttime" is set and higher than current time:
         if ($enCols['starttime']) {
             if ($GLOBALS['EXEC_TIME'] < (int) $row[$enCols['starttime']]) {
                 $timing = TRUE;
                 // And if "endtime" is NOT set:
                 if ((int) $row[$enCols['endtime']] === 0) {
                     $futuretiming = TRUE;
                 }
             }
         }
         // If an "endtime" is set:
         if ($enCols['endtime']) {
             if ((int) $row[$enCols['endtime']] > 0) {
                 if ((int) $row[$enCols['endtime']] < $GLOBALS['EXEC_TIME']) {
                     // End-timing applies at this point.
                     $timing = TRUE;
                 } else {
                     // End-timing WILL apply in the future for this element.
                     $futuretiming = TRUE;
                 }
             }
         }
         // If a user-group field is set:
         if ($enCols['fe_group']) {
             $user = $row[$enCols['fe_group']];
             if ($user && $doNotRenderUserGroupNumber) {
//.........这里部分代码省略.........
开发者ID:khanhdeux,项目名称:typo3test,代码行数:101,代码来源:IconUtility.php

示例4: getWhere

 /**
  * Helper function for getQuery(), creating the WHERE clause of the SELECT query
  *
  * @param string $table The table name
  * @param array $conf The TypoScript configuration properties
  * @param bool $returnQueryArray If set, the function will return the query not as a string but array with the various parts. RECOMMENDED!
  * @return mixed A WHERE clause based on the relevant parts of the TypoScript properties for a "select" function in TypoScript, see link. If $returnQueryArray is FALSE the where clause is returned as a string with WHERE, GROUP BY and ORDER BY parts, otherwise as an array with these parts.
  * @access private
  * @see getQuery()
  */
 public function getWhere($table, $conf, $returnQueryArray = false)
 {
     // Init:
     $query = '';
     $pid_uid_flag = 0;
     $enableFieldsIgnore = array();
     $queryParts = array('SELECT' => '', 'FROM' => '', 'WHERE' => '', 'GROUPBY' => '', 'ORDERBY' => '', 'LIMIT' => '');
     $tsfe = $this->getTypoScriptFrontendController();
     $considerMovePlaceholders = $tsfe->sys_page->versioningPreview && $table !== 'pages' && !empty($GLOBALS['TCA'][$table]['ctrl']['versioningWS']);
     if (trim($conf['uidInList'])) {
         $listArr = GeneralUtility::intExplode(',', str_replace('this', $tsfe->contentPid, $conf['uidInList']));
         if (count($listArr) === 1) {
             $comparison = '=' . (int) $listArr[0];
         } else {
             $comparison = ' IN (' . implode(',', $this->getDatabaseConnection()->cleanIntArray($listArr)) . ')';
         }
         // If move placeholder shall be considered, select via t3ver_move_id
         if ($considerMovePlaceholders) {
             $movePlaceholderComparison = $table . '.t3ver_state=' . VersionState::cast(VersionState::MOVE_PLACEHOLDER) . ' AND ' . $table . '.t3ver_move_id' . $comparison;
             $query .= ' AND (' . $table . '.uid' . $comparison . ' OR ' . $movePlaceholderComparison . ')';
         } else {
             $query .= ' AND ' . $table . '.uid' . $comparison;
         }
         $pid_uid_flag++;
     }
     // Static_* tables are allowed to be fetched from root page
     if (substr($table, 0, 7) === 'static_') {
         $pid_uid_flag++;
     }
     if (trim($conf['pidInList'])) {
         $listArr = GeneralUtility::intExplode(',', str_replace('this', $tsfe->contentPid, $conf['pidInList']));
         // Removes all pages which are not visible for the user!
         $listArr = $this->checkPidArray($listArr);
         if (GeneralUtility::inList($conf['pidInList'], 'root')) {
             $listArr[] = 0;
         }
         if (GeneralUtility::inList($conf['pidInList'], '-1')) {
             $listArr[] = -1;
             $enableFieldsIgnore['pid'] = true;
         }
         if (!empty($listArr)) {
             $query .= ' AND ' . $table . '.pid IN (' . implode(',', array_map('intval', $listArr)) . ')';
             $pid_uid_flag++;
         } else {
             // If not uid and not pid then uid is set to 0 - which results in nothing!!
             $pid_uid_flag = 0;
         }
     }
     // If not uid and not pid then uid is set to 0 - which results in nothing!!
     if (!$pid_uid_flag) {
         $query .= ' AND ' . $table . '.uid=0';
     }
     $where = isset($conf['where.']) ? trim($this->stdWrap($conf['where'], $conf['where.'])) : trim($conf['where']);
     if ($where) {
         $query .= ' AND ' . $where;
     }
     // Check if the table is translatable, and set the language field by default from the TCA information
     $languageField = '';
     if (!empty($conf['languageField']) || !isset($conf['languageField'])) {
         if (isset($conf['languageField']) && !empty($GLOBALS['TCA'][$table]['columns'][$conf['languageField']])) {
             $languageField = $conf['languageField'];
         } elseif (!empty($GLOBALS['TCA'][$table]['ctrl']['languageField']) && !empty($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'])) {
             $languageField = $table . '.' . $GLOBALS['TCA'][$table]['ctrl']['languageField'];
         }
     }
     if (!empty($languageField)) {
         // The sys_language record UID of the content of the page
         $sys_language_content = (int) $tsfe->sys_language_content;
         if ($tsfe->sys_language_contentOL && !empty($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'])) {
             // Sys language content is set to zero/-1 - and it is expected that whatever routine processes the output will
             // OVERLAY the records with localized versions!
             $languageQuery = $languageField . ' IN (0,-1)';
             // Use this option to include records that don't have a default translation
             // (originalpointerfield is 0 and the language field contains the requested language)
             $includeRecordsWithoutDefaultTranslation = isset($conf['includeRecordsWithoutDefaultTranslation.']) ? $this->stdWrap($conf['includeRecordsWithoutDefaultTranslation'], $conf['includeRecordsWithoutDefaultTranslation.']) : $conf['includeRecordsWithoutDefaultTranslation'];
             if (!empty(trim($includeRecordsWithoutDefaultTranslation))) {
                 $languageQuery .= ' OR (' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . ' = 0 AND ' . $languageField . ' = ' . $sys_language_content . ')';
             }
         } else {
             $languageQuery = $languageField . ' = ' . $sys_language_content;
         }
         $query .= ' AND (' . $languageQuery . ')';
     }
     // Enablefields
     if ($table === 'pages') {
         $query .= ' ' . $tsfe->sys_page->where_hid_del . $tsfe->sys_page->where_groupAccess;
     } else {
         $query .= $this->enableFields($table, false, $enableFieldsIgnore);
     }
     // MAKE WHERE:
//.........这里部分代码省略.........
开发者ID:vip3out,项目名称:TYPO3.CMS,代码行数:101,代码来源:ContentObjectRenderer.php

示例5: makeButtons

 /**
  * This creates the buttons for die modules
  *
  * @param string $function Identifier for function of module
  * @return void
  */
 protected function makeButtons($function = '')
 {
     $lang = $this->getLanguageService();
     // View page
     if (!VersionState::cast($this->pageinfo['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
         $viewButton = $this->buttonBar->makeLinkButton()->setOnClick(htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid']))))->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL))->setHref('#');
         $this->buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 3);
     }
     // Shortcut
     $shortcutButton = $this->buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setGetVariables(['id', 'M', 'edit_record', 'pointer', 'new_unique_uid', 'search_field', 'search_levels', 'showLimit'])->setSetVariables(array_keys($this->MOD_MENU));
     $this->buttonBar->addButton($shortcutButton);
     // Cache
     if (!$this->modTSconfig['properties']['disableAdvanced']) {
         $clearCacheButton = $this->buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl($this->moduleName, ['id' => $this->pageinfo['uid'], 'clear_cache' => '1']))->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', true))->setIcon($this->iconFactory->getIcon('actions-system-cache-clear', Icon::SIZE_SMALL));
         $this->buttonBar->addButton($clearCacheButton, ButtonBar::BUTTON_POSITION_RIGHT, 1);
     }
     if (!$this->modTSconfig['properties']['disableIconToolbar']) {
         // Move record
         if (MathUtility::canBeInterpretedAsInteger($this->eRParts[1])) {
             $urlParameters = ['table' => $this->eRParts[0], 'uid' => $this->eRParts[1], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
             $moveButton = $this->buttonBar->makeLinkButton()->setHref(BackendUtility::getModuleUrl('move_element', $urlParameters))->setTitle($lang->getLL('move_' . ($this->eRParts[0] == 'tt_content' ? 'record' : 'page'), true))->setIcon($this->iconFactory->getIcon('actions-' . ($this->eRParts[0] == 'tt_content' ? 'document' : 'page') . '-move', Icon::SIZE_SMALL));
             $this->buttonBar->addButton($moveButton, ButtonBar::BUTTON_POSITION_LEFT, 2);
         }
         // Edit page properties and page language overlay icons
         if ($this->pageIsNotLockedForEditors() && $this->getBackendUser()->checkLanguageAccess(0)) {
             // Edit localized page_language_overlay only when one specific language is selected
             if ($this->MOD_SETTINGS['function'] == 1 && $this->current_sys_language > 0) {
                 $overlayRecord = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid', 'pages_language_overlay', 'pid = ' . (int) $this->id . ' ' . 'AND sys_language_uid = ' . (int) $this->current_sys_language . BackendUtility::deleteClause('pages_language_overlay') . BackendUtility::versioningPlaceholderClause('pages_language_overlay'), '', '', '');
                 $editLanguageButton = $this->buttonBar->makeLinkButton()->setHref('#')->setTitle($lang->getLL('editPageLanguageOverlayProperties', true))->setOnClick(htmlspecialchars(BackendUtility::editOnClick('&edit[pages_language_overlay][' . $overlayRecord['uid'] . ']=edit')))->setIcon($this->iconFactory->getIcon('mimetypes-x-content-page-language-overlay', Icon::SIZE_SMALL));
                 $this->buttonBar->addButton($editLanguageButton, ButtonBar::BUTTON_POSITION_LEFT, 3);
             }
             $editPageButton = $this->buttonBar->makeLinkButton()->setHref('#')->setTitle($lang->getLL('editPageProperties', true))->setOnClick(htmlspecialchars(BackendUtility::editOnClick('&edit[pages][' . $this->id . ']=edit')))->setIcon($this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL));
             $this->buttonBar->addButton($editPageButton, ButtonBar::BUTTON_POSITION_LEFT, 3);
         }
         // Add CSH (Context Sensitive Help) icon to tool bar
         $contextSensitiveHelpButton = $this->buttonBar->makeHelpButton()->setModuleName($this->descrTable)->setFieldName($function === 'quickEdit' ? 'quickEdit' : 'columns_' . $this->MOD_SETTINGS['function']);
         $this->buttonBar->addButton($contextSensitiveHelpButton);
         // QuickEdit
         if ($function == 'quickEdit') {
             // Close Record
             $closeButton = $this->buttonBar->makeLinkButton()->setHref('#')->setOnClick(htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue($this->closeUrl) . '); return false;'))->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', true))->setIcon($this->iconFactory->getIcon('actions-document-close', Icon::SIZE_SMALL));
             $this->buttonBar->addButton($closeButton, ButtonBar::BUTTON_POSITION_LEFT, 0);
             // Save Record
             $saveButtonDropdown = $this->buttonBar->makeSplitButton();
             $saveButton = $this->buttonBar->makeInputButton()->setName('_savedok')->setValue('1')->setForm('PageLayoutController')->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', true))->setIcon($this->iconFactory->getIcon('actions-document-save', Icon::SIZE_SMALL));
             $saveButtonDropdown->addItem($saveButton);
             $saveAndCloseButton = $this->buttonBar->makeInputButton()->setName('_saveandclosedok')->setValue('1')->setForm('PageLayoutController')->setOnClick('document.editform.redirect.value=\'' . $this->closeUrl . '\';')->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', true))->setIcon($this->iconFactory->getIcon('actions-document-save-close', Icon::SIZE_SMALL));
             $saveButtonDropdown->addItem($saveAndCloseButton);
             $saveAndShowPageButton = $this->buttonBar->makeInputButton()->setName('_savedokview')->setValue('1')->setForm('PageLayoutController')->setOnClick('document.editform.redirect.value+=\'&popView=1\';')->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', true))->setIcon($this->iconFactory->getIcon('actions-document-save-view', Icon::SIZE_SMALL));
             $saveButtonDropdown->addItem($saveAndShowPageButton);
             $this->buttonBar->addButton($saveButtonDropdown, ButtonBar::BUTTON_POSITION_LEFT, 1);
             // Delete record
             if ($this->deleteButton) {
                 $deleteButton = $this->buttonBar->makeLinkButton()->setHref('#')->setOnClick(htmlspecialchars('return deleteRecord(' . GeneralUtility::quoteJSvalue($this->eRParts[0]) . ',' . GeneralUtility::quoteJSvalue($this->eRParts[1]) . ',' . GeneralUtility::quoteJSvalue(GeneralUtility::getIndpEnv('SCRIPT_NAME') . '?id=' . $this->id) . ');'))->setTitle($lang->getLL('deleteItem', true))->setIcon($this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL));
                 $this->buttonBar->addButton($deleteButton, ButtonBar::BUTTON_POSITION_LEFT, 4);
             }
             // History
             if ($this->undoButton) {
                 $undoButton = $this->buttonBar->makeLinkButton()->setHref('#')->setOnClick(htmlspecialchars('window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('record_history', array('element' => $this->eRParts[0] . ':' . $this->eRParts[1], 'revert' => 'ALL_FIELDS', 'sumUp' => -1, 'returnUrl' => $this->R_URI))) . '; return false;'))->setTitle(htmlspecialchars(sprintf($lang->getLL('undoLastChange'), BackendUtility::calcAge($GLOBALS['EXEC_TIME'] - $this->undoButtonR['tstamp'], $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears')))))->setIcon($this->iconFactory->getIcon('actions-edit-undo', Icon::SIZE_SMALL));
                 $this->buttonBar->addButton($undoButton, ButtonBar::BUTTON_POSITION_LEFT, 5);
                 $historyButton = $this->buttonBar->makeLinkButton()->setHref('#')->setOnClick(htmlspecialchars('jumpToUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('record_history', array('element' => $this->eRParts[0] . ':' . $this->eRParts[1], 'returnUrl' => $this->R_URI)) . '#latest') . ');return false;'))->setTitle($lang->getLL('recordHistory', true))->setIcon($this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL));
                 $this->buttonBar->addButton($historyButton, ButtonBar::BUTTON_POSITION_LEFT, 3);
             }
         }
     }
 }
开发者ID:CDRO,项目名称:TYPO3.CMS,代码行数:72,代码来源:PageLayoutController.php

示例6: overrideIconOverlay

 /**
  * Visualizes the deleted status for a versionized record.
  *
  * @param string $table Name of the table
  * @param array $row Record row containing the field values
  * @param array $status Status to be used for rendering the icon
  * @return void
  */
 public function overrideIconOverlay($table, array $row, array &$status)
 {
     if (isset($row['t3ver_state']) && VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
         $status['deleted'] = TRUE;
     }
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:14,代码来源:IconUtilityHook.php

示例7: getRecord

 /**
  * Get a single record row for a TCA table from the database.
  * \TYPO3\CMS\Backend\Form\DataPreprocessor is used for "upgrading" the
  * values, especially the relations.
  * Used in inline context
  *
  * @param string $table The table to fetch data from (= foreign_table)
  * @param string $uid The uid of the record to fetch, or the pid if a new record should be created
  * @param string $cmd The command to perform, empty or 'new'
  * @return array A record row from the database post-processed by \TYPO3\CMS\Backend\Form\DataPreprocessor
  * @internal
  */
 public function getRecord($table, $uid, $cmd = '')
 {
     $backendUser = $this->getBackendUserAuthentication();
     // Fetch workspace version of a record (if any):
     if ($cmd !== 'new' && $backendUser->workspace !== 0 && BackendUtility::isTableWorkspaceEnabled($table)) {
         $workspaceVersion = BackendUtility::getWorkspaceVersionOfRecord($backendUser->workspace, $table, $uid, 'uid,t3ver_state');
         if ($workspaceVersion !== FALSE) {
             $versionState = VersionState::cast($workspaceVersion['t3ver_state']);
             if ($versionState->equals(VersionState::DELETE_PLACEHOLDER)) {
                 return FALSE;
             }
             $uid = $workspaceVersion['uid'];
         }
     }
     /** @var $trData DataPreprocessor */
     $trData = GeneralUtility::makeInstance(DataPreprocessor::class);
     $trData->addRawData = TRUE;
     $trData->lockRecords = 1;
     // If a new record should be created
     $trData->fetchRecord($table, $uid, $cmd === 'new' ? 'new' : '');
     $rec = reset($trData->regTableItems_data);
     return $rec;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:35,代码来源:InlineRelatedRecordResolver.php

示例8: getWorkspacedUids

 /**
  * Substitute given list of uids in child table with workspace uid if needed
  *
  * @param array $connectedUids List of connected uids
  * @param string $childTableName Name of child table
  * @return array List of uids in workspace
  */
 protected function getWorkspacedUids(array $connectedUids, $childTableName)
 {
     $backendUser = $this->getBackendUser();
     $newConnectedUids = [];
     foreach ($connectedUids as $uid) {
         // Fetch workspace version of a record (if any):
         // @todo: Needs handling
         if ($backendUser->workspace !== 0 && BackendUtility::isTableWorkspaceEnabled($childTableName)) {
             $workspaceVersion = BackendUtility::getWorkspaceVersionOfRecord($backendUser->workspace, $childTableName, $uid, 'uid,t3ver_state');
             if ($workspaceVersion !== false) {
                 $versionState = VersionState::cast($workspaceVersion['t3ver_state']);
                 if ($versionState->equals(VersionState::DELETE_PLACEHOLDER)) {
                     return [];
                 }
                 $uid = $workspaceVersion['uid'];
             }
         }
         $newConnectedUids[] = $uid;
     }
     return $newConnectedUids;
 }
开发者ID:Torsten85,项目名称:TYPO3.CMS,代码行数:28,代码来源:TcaInline.php

示例9: movePlhOL

 /**
  * Checks if record is a move-placeholder (t3ver_state==VersionState::MOVE_PLACEHOLDER) and if so
  * it will set $row to be the pointed-to live record (and return TRUE)
  *
  * @param string $table Table name
  * @param array $row Row (passed by reference) - must be online record!
  * @return bool TRUE if overlay is made.
  * @see PageRepository::movePlhOl()
  */
 public static function movePlhOL($table, &$row)
 {
     if (static::isTableWorkspaceEnabled($table)) {
         // If t3ver_move_id or t3ver_state is not found, then find it... (but we like best if it is here...)
         if (!isset($row['t3ver_move_id']) || !isset($row['t3ver_state'])) {
             $moveIDRec = self::getRecord($table, $row['uid'], 't3ver_move_id, t3ver_state');
             $moveID = $moveIDRec['t3ver_move_id'];
             $versionState = VersionState::cast($moveIDRec['t3ver_state']);
         } else {
             $moveID = $row['t3ver_move_id'];
             $versionState = VersionState::cast($row['t3ver_state']);
         }
         // Find pointed-to record.
         if ($versionState->equals(VersionState::MOVE_PLACEHOLDER) && $moveID) {
             if ($origRow = self::getRecord($table, $moveID, implode(',', array_keys($row)))) {
                 $row = $origRow;
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:31,代码来源:BackendUtility.php

示例10: processVersionOverlays

 /**
  * Processes version overlays on the final result set.
  *
  * @param int[] $ids
  * @return int[]
  */
 protected function processVersionOverlays(array $ids)
 {
     if (empty($this->workspaceId) || !$this->isWorkspaceEnabled() || empty($ids)) {
         return $ids;
     }
     $ids = $this->processVersionMovePlaceholders($ids);
     $versions = $this->getDatabaseConnection()->exec_SELECTgetRows('uid,t3ver_oid,t3ver_state', $this->tableName, 'pid=-1 AND t3ver_oid IN (' . $this->intImplode(',', $ids) . ')' . ' AND t3ver_wsid=' . $this->workspaceId);
     if (!empty($versions)) {
         foreach ($versions as $version) {
             $liveReferenceId = $version['t3ver_oid'];
             $versionId = $version['uid'];
             if (isset($ids[$liveReferenceId])) {
                 if (!$this->keepDeletePlaceholder && VersionState::cast($version['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
                     unset($ids[$liveReferenceId]);
                 } else {
                     $ids[$liveReferenceId] = $versionId;
                 }
             }
         }
         $ids = $this->reindex($ids);
     }
     return $ids;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:29,代码来源:PlainDataResolver.php

示例11: mapRecordTypeToOverlayIdentifier

 /**
  * This helper functions checks if the DB record ($row) has any special status based on the TCA settings like hidden,
  * starttime etc, and then returns a specific icon overlay identifier for the overlay of this DB record
  * This method solely takes care of the overlay of this record, not any type
  *
  * @param string $table The TCA table
  * @param array $row The selected record
  * @return string The status with the highest priority
  */
 protected function mapRecordTypeToOverlayIdentifier($table, array $row)
 {
     $tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
     // Calculate for a given record the actual visibility at the moment
     $status = array('hidden' => false, 'starttime' => false, 'endtime' => false, 'futureendtime' => false, 'fe_group' => false, 'deleted' => false, 'protectedSection' => false, 'nav_hide' => (bool) $row['nav_hide']);
     // Icon state based on "enableFields":
     if (is_array($tcaCtrl['enablecolumns'])) {
         $enableColumns = $tcaCtrl['enablecolumns'];
         // If "hidden" is enabled:
         if (isset($enableColumns['disabled']) && !empty($row[$enableColumns['disabled']])) {
             $status['hidden'] = true;
         }
         // If a "starttime" is set and higher than current time:
         if (!empty($enableColumns['starttime']) && $GLOBALS['EXEC_TIME'] < (int) $row[$enableColumns['starttime']]) {
             $status['starttime'] = true;
         }
         // If an "endtime" is set
         if (!empty($enableColumns['endtime'])) {
             if ((int) $row[$enableColumns['endtime']] > 0) {
                 if ((int) $row[$enableColumns['endtime']] < $GLOBALS['EXEC_TIME']) {
                     // End-timing applies at this point.
                     $status['endtime'] = true;
                 } else {
                     // End-timing WILL apply in the future for this element.
                     $status['futureendtime'] = true;
                 }
             }
         }
         // If a user-group field is set
         if (!empty($enableColumns['fe_group']) && $row[$enableColumns['fe_group']]) {
             $status['fe_group'] = true;
         }
     }
     // If "deleted" flag is set (only when listing records which are also deleted!)
     if (isset($tcaCtrl['delete']) && !empty($row[$tcaCtrl['delete']])) {
         $status['deleted'] = true;
     }
     // Detecting extendToSubpages (for pages only)
     if ($table === 'pages' && (int) $row['extendToSubpages'] > 0) {
         $status['protectedSection'] = true;
     }
     if (isset($row['t3ver_state']) && VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
         $status['deleted'] = true;
     }
     // Now only show the status with the highest priority
     $iconName = '';
     foreach ($this->overlayPriorities as $priority) {
         if ($status[$priority]) {
             $iconName = $this->recordStatusMapping[$priority];
             break;
         }
     }
     return $iconName;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:63,代码来源:IconFactory.php

示例12: movePlhOL

 /**
  * Checks if record is a move-placeholder
  * (t3ver_state==VersionState::MOVE_PLACEHOLDER) and if so it will set $row to be
  * the pointed-to live record (and return TRUE) Used from versionOL
  *
  * @param string $table Table name
  * @param array $row Row (passed by reference) - only online records...
  * @return boolean TRUE if overlay is made.
  * @see \TYPO3\CMS\Backend\Utility\BackendUtility::movePlhOl()
  * @todo Define visibility
  */
 public function movePlhOL($table, &$row)
 {
     if (($table == 'pages' || (int) $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2) && (int) VersionState::cast($row['t3ver_state'])->equals(VersionState::MOVE_PLACEHOLDER)) {
         // Only for WS ver 2... (moving)
         // If t3ver_move_id is not found, then find it (but we like best if it is here)
         if (!isset($row['t3ver_move_id'])) {
             $moveIDRec = $this->getRawRecord($table, $row['uid'], 't3ver_move_id', TRUE);
             $moveID = $moveIDRec['t3ver_move_id'];
         } else {
             $moveID = $row['t3ver_move_id'];
         }
         // Find pointed-to record.
         if ($moveID) {
             $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(implode(',', array_keys($row)), $table, 'uid=' . (int) $moveID . $this->enableFields($table));
             $origRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
             $GLOBALS['TYPO3_DB']->sql_free_result($res);
             if ($origRow) {
                 $row = $origRow;
                 return TRUE;
             }
         }
     }
     return FALSE;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:35,代码来源:PageRepository.php

示例13: main

 /**
  * Find orphan records
  * VERY CPU and memory intensive since it will look up the whole page tree!
  *
  * @return array
  */
 public function main()
 {
     // Initialize result array:
     $resultArray = array('message' => $this->cli_help['name'] . LF . LF . $this->cli_help['description'], 'headers' => array('versions' => array('All versions', 'Showing all versions of records found', 0), 'versions_published' => array('All published versions', 'This is all records that has been published and can therefore be removed permanently', 1), 'versions_liveWS' => array('All versions in Live workspace', 'This is all records that are offline versions in the Live workspace. You may wish to flush these if you only use workspaces for versioning since then you might find lots of versions piling up in the live workspace which have simply been disconnected from the workspace before they were published.', 1), 'versions_lost_workspace' => array('Versions outside a workspace', 'Versions that has lost their connection to a workspace in TYPO3.', 3), 'versions_inside_versioned_page' => array('Versions in versions', 'Versions inside an already versioned page. Something that is confusing to users and therefore should not happen but is technically possible.', 2), 'versions_unused_placeholders' => array('Unused placeholder records', 'Placeholder records which are not used anymore by offline versions.', 2), 'versions_move_placeholders_ok' => array('Move placeholders', 'Move-to placeholder records which has good integrity', 0), 'versions_move_placeholders_bad' => array('Move placeholders with bad integrity', 'Move-to placeholder records which has bad integrity', 2), 'versions_move_id_check' => array('Checking if t3ver_move_id is correct', 't3ver_move_id must only be set with online records having t3ver_state=3.', 2)), 'versions' => array());
     $startingPoint = $this->cli_isArg('--pid') ? \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->cli_argValue('--pid'), 0) : 0;
     $depth = $this->cli_isArg('--depth') ? \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->cli_argValue('--depth'), 0) : 1000;
     $this->genTree($startingPoint, $depth, (int) $this->cli_argValue('--echotree'));
     $resultArray['versions'] = $this->recStats['versions'];
     $resultArray['versions_published'] = $this->recStats['versions_published'];
     $resultArray['versions_liveWS'] = $this->recStats['versions_liveWS'];
     $resultArray['versions_lost_workspace'] = $this->recStats['versions_lost_workspace'];
     $resultArray['versions_inside_versioned_page'] = $this->recStats['versions_inside_versioned_page'];
     // Finding all placeholders with no records attached!
     $resultArray['versions_unused_placeholders'] = array();
     foreach ($GLOBALS['TCA'] as $table => $cfg) {
         if ($cfg['ctrl']['versioningWS']) {
             $placeHolders = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pid', $table, 't3ver_state=' . new VersionState(VersionState::NEW_PLACEHOLDER) . ' AND pid>=0' . BackendUtility::deleteClause($table));
             foreach ($placeHolders as $phrec) {
                 if (count(BackendUtility::selectVersionsOfRecord($table, $phrec['uid'], 'uid', '*', null)) <= 1) {
                     $resultArray['versions_unused_placeholders'][GeneralUtility::shortMD5($table . ':' . $phrec['uid'])] = $table . ':' . $phrec['uid'];
                 }
             }
         }
     }
     asort($resultArray['versions_unused_placeholders']);
     // Finding all move placeholders with inconsistencies:
     $resultArray['versions_move_placeholders_ok'] = array();
     $resultArray['versions_move_placeholders_bad'] = array();
     foreach ($GLOBALS['TCA'] as $table => $cfg) {
         if (BackendUtility::isTableWorkspaceEnabled($table)) {
             $placeHolders = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pid,t3ver_move_id,t3ver_wsid,t3ver_state', $table, 't3ver_state=' . new VersionState(VersionState::MOVE_PLACEHOLDER) . ' AND pid>=0' . BackendUtility::deleteClause($table));
             foreach ($placeHolders as $phrec) {
                 $shortID = GeneralUtility::shortMD5($table . ':' . $phrec['uid']);
                 if ((int) $phrec['t3ver_wsid'] != 0) {
                     $phrecCopy = $phrec;
                     if (BackendUtility::movePlhOL($table, $phrec)) {
                         if ($wsAlt = BackendUtility::getWorkspaceVersionOfRecord($phrecCopy['t3ver_wsid'], $table, $phrec['uid'], 'uid,pid,t3ver_state')) {
                             if (!VersionState::cast($wsAlt['t3ver_state'])->equals(VersionState::MOVE_POINTER)) {
                                 $resultArray['versions_move_placeholders_bad'][$shortID] = array($table . ':' . $phrec['uid'], 'State for version was not "4" as it should be!', $phrecCopy);
                             } else {
                                 $resultArray['versions_move_placeholders_ok'][$shortID] = array($table . ':' . $phrec['uid'], 'PLH' => $phrecCopy, 'online' => $phrec, 'PNT' => $wsAlt);
                             }
                         } else {
                             $resultArray['versions_move_placeholders_bad'][$shortID] = array($table . ':' . $phrec['uid'], 'No version was found for online record to be moved. A version must exist.', $phrecCopy);
                         }
                     } else {
                         $resultArray['versions_move_placeholders_bad'][$shortID] = array($table . ':' . $phrec['uid'], 'Did not find online record for "t3ver_move_id" value ' . $phrec['t3ver_move_id'], $phrec);
                     }
                 } else {
                     $resultArray['versions_move_placeholders_bad'][$shortID] = array($table . ':' . $phrec['uid'], 'Placeholder was not assigned a workspace value in t3ver_wsid.', $phrec);
                 }
             }
         }
     }
     ksort($resultArray['versions_move_placeholders_ok']);
     ksort($resultArray['versions_move_placeholders_bad']);
     // Finding move_id_check inconsistencies:
     $resultArray['versions_move_id_check'] = array();
     foreach ($GLOBALS['TCA'] as $table => $cfg) {
         if (BackendUtility::isTableWorkspaceEnabled($table)) {
             $placeHolders = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pid,t3ver_move_id,t3ver_wsid,t3ver_state', $table, 't3ver_move_id<>0' . BackendUtility::deleteClause($table));
             foreach ($placeHolders as $phrec) {
                 if (VersionState::cast($phrec['t3ver_state'])->equals(VersionState::MOVE_PLACEHOLDER)) {
                     if ($phrec['pid'] != -1) {
                     } else {
                         $resultArray['versions_move_id_check'][] = array($table . ':' . $phrec['uid'], 'Record was offline, must not be!', $phrec);
                     }
                 } else {
                     $resultArray['versions_move_id_check'][] = array($table . ':' . $phrec['uid'], 'Record had t3ver_move_id set to "' . $phrec['t3ver_move_id'] . '" while having t3ver_state=' . $phrec['t3ver_state'], $phrec);
                 }
             }
         }
     }
     return $resultArray;
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:81,代码来源:VersionsCommand.php

示例14: movePlhOL

 /**
  * Checks if record is a move-placeholder
  * (t3ver_state==VersionState::MOVE_PLACEHOLDER) and if so it will set $row to be
  * the pointed-to live record (and return TRUE) Used from versionOL
  *
  * @param string $table Table name
  * @param array $row Row (passed by reference) - only online records...
  * @return bool TRUE if overlay is made.
  * @see BackendUtility::movePlhOl()
  */
 public function movePlhOL($table, &$row)
 {
     if (!empty($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) && (int) VersionState::cast($row['t3ver_state'])->equals(VersionState::MOVE_PLACEHOLDER)) {
         // Only for WS ver 2... (moving) - enabled by default with CMS7
         // If t3ver_move_id is not found, then find it (but we like best if it is here)
         if (!isset($row['t3ver_move_id'])) {
             $moveIDRec = $this->getRawRecord($table, $row['uid'], 't3ver_move_id', true);
             $moveID = $moveIDRec['t3ver_move_id'];
         } else {
             $moveID = $row['t3ver_move_id'];
         }
         // Find pointed-to record.
         if ($moveID) {
             $res = $this->getDatabaseConnection()->exec_SELECTquery(implode(',', array_keys($row)), $table, 'uid=' . (int) $moveID . $this->enableFields($table));
             $origRow = $this->getDatabaseConnection()->sql_fetch_assoc($res);
             $this->getDatabaseConnection()->sql_free_result($res);
             if ($origRow) {
                 $row = $origRow;
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:34,代码来源:PageRepository.php

示例15: canCreatePreviewLink

 /**
  * Determine whether this page for the current
  *
  * @param int $pageUid
  * @param int $workspaceUid
  * @return bool
  */
 public function canCreatePreviewLink($pageUid, $workspaceUid)
 {
     $result = true;
     if ($pageUid > 0 && $workspaceUid > 0) {
         $pageRecord = BackendUtility::getRecord('pages', $pageUid);
         BackendUtility::workspaceOL('pages', $pageRecord, $workspaceUid);
         if (!GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['FE']['content_doktypes'], $pageRecord['doktype']) || VersionState::cast($pageRecord['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
             $result = false;
         }
     } else {
         $result = false;
     }
     return $result;
 }
开发者ID:Gregpl,项目名称:TYPO3.CMS,代码行数:21,代码来源:WorkspaceService.php


注:本文中的TYPO3\CMS\Core\Versioning\VersionState::cast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。