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


PHP t3lib_BEfunc::getWorkspaceVersionOfRecord方法代码示例

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


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

示例1: determineRecord

 /**
  * Determine record to use. Current or workspace record?
  *
  * @param	array			$row current tt_content record
  * @return	array			$record to use
  */
 protected function determineRecord(array $row)
 {
     if ($GLOBALS['BE_USER']->workspace !== 0) {
         $workspaceRecord = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, 'tt_content', intval($row['uid']));
         if ($workspaceRecord) {
             $row = $workspaceRecord;
         }
     }
     return $row;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:16,代码来源:class.tx_damttcontent_tt_content_drawItem.php

示例2: main

    /**
     * Main function, rendering the document with the iframe with the RTE in.
     *
     * @return	void
     */
    function main()
    {
        global $BE_USER, $LANG;
        // translate id to the workspace version:
        if ($versionRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->P['table'], $this->P['uid'], 'uid')) {
            $this->P['uid'] = $versionRec['uid'];
        }
        // If all parameters are available:
        if ($this->P['table'] && $this->P['field'] && $this->P['uid'] && $this->checkEditAccess($this->P['table'], $this->P['uid'])) {
            // Getting the raw record (we need only the pid-value from here...)
            $rawRec = t3lib_BEfunc::getRecord($this->P['table'], $this->P['uid']);
            t3lib_BEfunc::fixVersioningPid($this->P['table'], $rawRec);
            // Setting JavaScript, including the pid value for viewing:
            $this->doc->JScode = $this->doc->wrapScriptTags('
					function jumpToUrl(URL,formEl)	{	//
						if (document.editform)	{
							if (!TBE_EDITOR.isFormChanged())	{
								window.location.href = URL;
							} else if (formEl) {
								if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
							}
						} else window.location.href = URL;
					}
				' . ($this->popView ? t3lib_BEfunc::viewOnClick($rawRec['pid'], '', t3lib_BEfunc::BEgetRootLine($rawRec['pid'])) : '') . '
			');
            // Initialize TCeforms - for rendering the field:
            $tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
            $tceforms->initDefaultBEMode();
            // Init...
            $tceforms->disableWizards = 1;
            // SPECIAL: Disables all wizards - we are NOT going to need them.
            $tceforms->colorScheme[0] = $this->doc->bgColor;
            // SPECIAL: Setting background color of the RTE to ordinary background
            // Initialize style for RTE object:
            $RTEobj = t3lib_BEfunc::RTEgetObj();
            // Getting reference to the RTE object used to render the field!
            if ($RTEobj->ID == 'rte') {
                $RTEobj->RTEdivStyle = 'position:relative; left:0px; top:0px; height:100%; width:100%; border:solid 0px;';
                // SPECIAL: Setting style for the RTE <DIV> layer containing the IFRAME
            }
            // Fetching content of record:
            $trData = t3lib_div::makeInstance('t3lib_transferData');
            $trData->lockRecords = 1;
            $trData->fetchRecord($this->P['table'], $this->P['uid'], '');
            // Getting the processed record content out:
            reset($trData->regTableItems_data);
            $rec = current($trData->regTableItems_data);
            $rec['uid'] = $this->P['uid'];
            $rec['pid'] = $rawRec['pid'];
            // TSconfig, setting width:
            $fieldTSConfig = $tceforms->setTSconfig($this->P['table'], $rec, $this->P['field']);
            if (strcmp($fieldTSConfig['RTEfullScreenWidth'], '')) {
                $width = $fieldTSConfig['RTEfullScreenWidth'];
            } else {
                $width = '100%';
            }
            // Get the form field and wrap it in the table with the buttons:
            $formContent = $tceforms->getSoloField($this->P['table'], $rec, $this->P['field']);
            $formContent = '


			<!--
				RTE wizard:
			-->
				<table border="0" cellpadding="0" cellspacing="0" width="' . $width . '" id="typo3-rtewizard">
					<tr>
						<td width="' . $width . '" colspan="2" id="c-formContent">' . $formContent . '</td>
						<td></td>
					</tr>
				</table>';
            // Adding hidden fields:
            $formContent .= '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->R_URI) . '" />
						<input type="hidden" name="_serialNumber" value="' . md5(microtime()) . '" />' . t3lib_TCEforms::getHiddenTokenField('tceAction');
            // Finally, add the whole setup:
            $this->content .= $tceforms->printNeededJSFunctions_top() . $formContent . $tceforms->printNeededJSFunctions();
        } else {
            // ERROR:
            $this->content .= $this->doc->section($LANG->getLL('forms_title'), '<span class="typo3-red">' . $LANG->getLL('table_noData', 1) . '</span>', 0, 1);
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $this->content = $this->doc->startPage('');
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:93,代码来源:wizard_rte.php

示例3: getVersionSelector

    /**
     * Creates the version selector for the page id inputted.
     * Requires the core version management extension, "version" to be loaded.
     *
     * @param	integer		Page id to create selector for.
     * @param	boolean		If set, there will be no button for swapping page.
     * @return	void
     */
    function getVersionSelector($id, $noAction = FALSE)
    {
        if ($id > 0) {
            if (t3lib_extMgm::isLoaded('version') && $GLOBALS['BE_USER']->workspace == 0) {
                // Get Current page record:
                $curPage = t3lib_BEfunc::getRecord('pages', $id);
                // If the selected page is not online, find the right ID
                $onlineId = $curPage['pid'] == -1 ? $curPage['t3ver_oid'] : $id;
                // Select all versions of online version:
                $versions = t3lib_BEfunc::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_wsid,t3ver_id');
                // If more than one was found...:
                if (count($versions) > 1) {
                    $selectorLabel = '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionSelect.label', TRUE) . '</strong>';
                    // Create selector box entries:
                    $opt = array();
                    foreach ($versions as $vRow) {
                        if ($vRow['uid'] == $onlineId) {
                            //Live version
                            $label = '[' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionSelect.live', TRUE) . ']';
                        } else {
                            $label = $vRow['t3ver_label'] . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionId', TRUE) . ' ' . $vRow['t3ver_id'] . ($vRow['t3ver_wsid'] != 0 ? ' ' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:workspaceId', TRUE) . ' ' . $vRow['t3ver_wsid'] : '') . ')';
                        }
                        $opt[] = '<option value="' . htmlspecialchars(t3lib_div::linkThisScript(array('id' => $vRow['uid']))) . '"' . ($id == $vRow['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($label) . '</option>';
                    }
                    // Add management link:
                    $management = '<input type="button" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.mgm', TRUE) . '" onclick="window.location.href=\'' . htmlspecialchars($this->backPath . t3lib_extMgm::extRelPath('version') . 'cm1/index.php?table=pages&uid=' . $onlineId) . '\';" />';
                    // Create onchange handler:
                    $onChange = "window.location.href=this.options[this.selectedIndex].value;";
                    // Controls:
                    if ($id == $onlineId) {
                        $controls .= '<img' . t3lib_iconWorks::skinImg($this->backPath, 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="absmiddle" alt="" /> <strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.online', TRUE) . '</strong>';
                    } elseif (!$noAction) {
                        $controls .= '<a href="' . $this->issueCommand('&cmd[pages][' . $onlineId . '][version][swapWith]=' . $id . '&cmd[pages][' . $onlineId . '][version][action]=swap', t3lib_div::linkThisScript(array('id' => $onlineId))) . '" class="nobr">' . t3lib_iconWorks::getSpriteIcon('actions-version-swap-version', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swapPage', TRUE), 'style' => 'margin-left:5px;vertical-align:bottom;')) . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:ver.swap', TRUE) . '</strong></a>';
                    }
                    // Write out HTML code:
                    return '

						<!--
							Version selector:
						-->
						<table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
							<tr>
								<td>' . $selectorLabel . '</td>
								<td>
									<select onchange="' . htmlspecialchars($onChange) . '">
										' . implode('', $opt) . '
									</select></td>
								<td>' . $controls . '</td>
								<td>' . $management . '</td>
							</tr>
						</table>
					';
                }
            } elseif ($GLOBALS['BE_USER']->workspace !== 0) {
                // Write out HTML code:
                switch ($GLOBALS['BE_USER']->workspace) {
                    case 0:
                        $wsTitle = $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:live', TRUE);
                        break;
                    case -1:
                        $wsTitle = $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:draft', TRUE);
                        break;
                    default:
                        $wsTitle = $GLOBALS['BE_USER']->workspaceRec['title'];
                        break;
                }
                if (t3lib_BEfunc::isPidInVersionizedBranch($id) == 'branchpoint') {
                    return '

						<!--
							Version selector:
						-->
						<table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector">
							<tr>
								<td>' . $selectorLabel . '</td>
								<td>Workspace: "' . htmlspecialchars($wsTitle) . '"</td>
								<td><em>' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xml:versionSelect.inBranch', TRUE) . '</em></td>
							</tr>
						</table>
					';
                } else {
                    // Get Current page record:
                    $curPage = t3lib_BEfunc::getRecord('pages', $id);
                    // If the selected page is not online, find the right ID
                    $onlineId = $curPage['pid'] == -1 ? $curPage['t3ver_oid'] : $id;
                    // The version of page:
                    $verPage = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, 'pages', $onlineId);
                    if (!$verPage) {
                        if (!count(t3lib_BEfunc::countVersionsOfRecordsOnPage($GLOBALS['BE_USER']->workspace, $onlineId))) {
                            if ($GLOBALS['BE_USER']->workspaceVersioningTypeAccess(0)) {
                                $onClick = $this->issueCommand('&cmd[pages][' . $onlineId . '][version][action]=new&cmd[pages][' . $onlineId . '][version][treeLevels]=0', t3lib_div::linkThisScript(array('id' => $onlineId)));
                                $onClick = 'window.location.href=\'' . $onClick . '\'; return false;';
//.........这里部分代码省略.........
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:101,代码来源:template.php

示例4: link_hide

 /**
  * [Describe function...]
  *
  * @param	[type]		$label: ...
  * @param	[type]		$table: ...
  * @param	[type]		$uid: ...
  * @param	[type]		$hidden: ...
  * @param	[type]		$forced: ...
  * @param	integer			$usePid: ...
  * @return	[type]		...
  */
 function link_hide($label, $table, $uid, $hidden, $forced = FALSE, $usePid = 0)
 {
     if ($label) {
         $pid = $table == 'pages' ? $uid : $usePid;
         $calcPerms = $pid == 0 ? $this->calcPerms : $this->getCalcPerms($pid);
         if (($table == 'pages' && $calcPerms & 2 || $table != 'pages' && $calcPerms & 16) && (!$this->translatorMode || $forced)) {
             $workspaceRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $table, $uid);
             $workspaceId = $workspaceRec['uid'] > 0 ? $workspaceRec['uid'] : $uid;
             if ($table == "pages" && $this->currentLanguageUid) {
                 $params = '&data[' . $table . '][' . $workspaceId . '][hidden]=' . (1 - $hidden);
                 //	return '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '">'.$label.'</a>';
             } else {
                 $params = '&data[' . $table . '][' . $workspaceId . '][hidden]=' . (1 - $hidden);
                 //	return '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '">'.$label.'</a>';
                 /* the commands are indipendent of the position,
                  * so sortable doesn't need to update these and we
                  * can safely use '#'
                  */
                 if ($hidden) {
                     return '<a href="#" class="tpm-hide" onclick="sortable_unhideRecord(this, \'' . htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params, -1)) . '\');">' . $label . '</a>';
                 } else {
                     return '<a href="#" class="tpm-hide" onclick="sortable_hideRecord(this, \'' . htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($params, -1)) . '\');">' . $label . '</a>';
                 }
             }
         } else {
             return $label;
         }
     }
     return '';
 }
开发者ID:rod86,项目名称:t3sandbox,代码行数:41,代码来源:index.php

示例5: main

 /**
  * Find orphan records
  * VERY CPU and memory intensive since it will look up the whole page tree!
  *
  * @return	array
  */
 function main()
 {
     global $TYPO3_DB;
     // 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') ? t3lib_div::intInRange($this->cli_argValue('--pid'), 0) : 0;
     $depth = $this->cli_isArg('--depth') ? t3lib_div::intInRange($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=1 AND pid>=0' . t3lib_BEfunc::deleteClause($table));
             foreach ($placeHolders as $phrec) {
                 if (count(t3lib_BEfunc::selectVersionsOfRecord($table, $phrec['uid'], 'uid')) <= 1) {
                     $resultArray['versions_unused_placeholders'][t3lib_div::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 ((int) $cfg['ctrl']['versioningWS'] >= 2) {
             $placeHolders = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pid,t3ver_move_id,t3ver_wsid,t3ver_state', $table, 't3ver_state=3 AND pid>=0' . t3lib_BEfunc::deleteClause($table));
             foreach ($placeHolders as $phrec) {
                 $shortID = t3lib_div::shortmd5($table . ':' . $phrec['uid']);
                 if ((int) $phrec['t3ver_wsid'] != 0) {
                     $phrecCopy = $phrec;
                     if (t3lib_BEfunc::movePlhOL($table, $phrec)) {
                         if ($wsAlt = t3lib_BEfunc::getWorkspaceVersionOfRecord($phrecCopy['t3ver_wsid'], $table, $phrec['uid'], 'uid,pid,t3ver_state')) {
                             if ($wsAlt['t3ver_state'] != 4) {
                                 $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 ((int) $cfg['ctrl']['versioningWS'] >= 2) {
             $placeHolders = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,pid,t3ver_move_id,t3ver_wsid,t3ver_state', $table, 't3ver_move_id!=0' . t3lib_BEfunc::deleteClause($table));
             foreach ($placeHolders as $phrec) {
                 if ((int) $phrec['t3ver_state'] == 3) {
                     if ($phrec['pid'] != -1) {
                         // OK
                     } 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:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:83,代码来源:class.versions.php

示例6: processDatamap_afterDatabaseOperations

 /**
  * This method is used to initialize new Elements with the default
  *
  * @param unknown_type $status
  * @param unknown_type $table
  * @param unknown_type $id
  * @param unknown_type $fieldArray
  * @param unknown_type $reference
  */
 public function processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, &$reference)
 {
     if (in_array($table, tx_languagevisibility_visibilityService::getSupportedTables())) {
         /**
          * Now we set the default visibility for elements which did not get a defaultvisibility array.
          * This can happen, if a user creates a new element AND the user has no access for the languagevisibility_field
          */
         if ($status == 'new') {
             $row['uid'] = $reference->substNEWwithIDs[$id];
             if ($fieldArray['pid'] == '-1') {
                 $row = t3lib_BEfunc::getWorkspaceVersionOfRecord($fieldArray['t3ver_wsid'], $table, $row['uid'], $fields = '*');
             }
             require_once t3lib_extMgm::extPath("languagevisibility") . 'class.tx_languagevisibility_beservices.php';
             $newdata = array('tx_languagevisibility_visibility' => serialize(tx_languagevisibility_beservices::getDefaultVisibilityArray()));
             $where = "tx_languagevisibility_visibility = '' AND uid=" . $row['uid'];
             $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, $where, $newdata);
         }
         tx_languagevisibility_cacheManager::getInstance()->flushAllCaches();
     }
 }
开发者ID:raimundlandig,项目名称:winkel.de-DEV,代码行数:29,代码来源:class.tx_languagevisibility_hooks_t3lib_tcemain.php

示例7: resolvePid

 /**
  * Get the final pid based on $table and $pid ($destPid type... pos/neg)
  *
  * @param	string		Table name
  * @param	integer		"Destination pid" : If the value is >= 0 it's just returned directly (through intval() though) but if the value is <0 then the method looks up the record with the uid equal to abs($pid) (positive number) and returns the PID of that record! The idea is that negative numbers point to the record AFTER WHICH the position is supposed to be!
  * @return	integer
  */
 function resolvePid($table, $pid)
 {
     global $TCA;
     $pid = intval($pid);
     if ($pid < 0) {
         $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('pid', $table, 'uid=' . abs($pid));
         $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
         // Look, if the record UID happens to be an offline record. If so, find its live version. Offline uids will be used when a page is versionized as "branch" so this is when we must correct - otherwise a pid of "-1" and a wrong sort-row number is returned which we don't want.
         if ($lookForLiveVersion = t3lib_BEfunc::getLiveVersionOfRecord($table, abs($pid), 'pid')) {
             $row = $lookForLiveVersion;
         }
         $pid = intval($row['pid']);
     } elseif ($this->BE_USER->workspace !== 0 && $TCA[$table]['ctrl']['versioning_followPages']) {
         // PID points to page, the workspace is an offline space and the table follows page during versioning: This means we must check if the PID page has a version in the workspace with swapmode set to 0 (zero = page+content) and if so, change the pid to the uid of that version.
         if ($WSdestPage = t3lib_BEfunc::getWorkspaceVersionOfRecord($this->BE_USER->workspace, 'pages', $pid, 'uid,t3ver_swapmode')) {
             // Looks for workspace version of page.
             if ($WSdestPage['t3ver_swapmode'] == 0) {
                 // if swapmode is zero, then change pid value.
                 $pid = $WSdestPage['uid'];
             }
         }
     }
     return $pid;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:31,代码来源:class.t3lib_tcemain.php

示例8: getRecordForEdit

 /**
  * Get record for editing.
  *
  * @param	string		Table name
  * @param	integer		Record UID
  * @return	array		Returns record to edit, false if none
  */
 function getRecordForEdit($table, $theUid)
 {
     global $TCA;
     // Fetch requested record:
     $reqRecord = t3lib_BEfunc::getRecord($table, $theUid, 'uid,pid');
     if (is_array($reqRecord)) {
         // If workspace is OFFLINE:
         if ($GLOBALS['BE_USER']->workspace != 0) {
             // Check for versioning support of the table:
             if ($TCA[$table] && $TCA[$table]['ctrl']['versioningWS']) {
                 // If the record is already a version of "something" pass it by.
                 if ($reqRecord['pid'] == -1) {
                     // (If it turns out not to be a version of the current workspace there will be trouble, but that is handled inside TCEmain then and in the interface it would clearly be an error of links if the user accesses such a scenario)
                     return $reqRecord;
                 } else {
                     // The input record was online and an offline version must be found or made:
                     // Look for version of this workspace:
                     $versionRec = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $table, $reqRecord['uid'], 'uid,pid,t3ver_oid');
                     return is_array($versionRec) ? $versionRec : $reqRecord;
                 }
             } else {
                 return FALSE;
             }
             // This means that editing cannot occur on this record because it was not supporting versioning which is required inside an offline workspace.
         } else {
             return $reqRecord;
         }
         // In ONLINE workspace, just return the originally requested record:
     } else {
         return FALSE;
     }
     // Return false because the table/uid was not found anyway.
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:40,代码来源:alt_doc.php

示例9: _splitAndValidateReference

 /**
  * Split reference
  * FIXME Should also verify the integrity of the reference string since the rest of the application does NOT check it further.
  * NOTE: This function is deprecated. Use the newer class tx_templavoila_api instead.
  *
  * @param	string		Reference to a tt_content element in a flexform field of references to tt_content elements. Syntax is: [table]:[uid]:[sheet]:[lLanguage]:[FlexForm field name]:[vLanguage]:[index of reference position in field value]. Example: 'pages:78:sDEF:lDEF:field_contentarea:vDEF:0/tt_content:60'
  * @return	array		Array with each part between ':' in a value with numeric key (exploded)
  * @access	protected
  * @deprecated version - 1.0.0
  */
 function _splitAndValidateReference($string)
 {
     $refArr = explode(':', $string);
     if ($version = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $refArr[0], $refArr[1], 'uid')) {
         $refArr[1] = $version['uid'];
     }
     return $refArr;
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:18,代码来源:class.tx_templavoila_xmlrelhndl.php

示例10: moveRecord

 /**
  * hook for t3lib_TCEmain::moveRecord that cares about moving records that
  * are *not* in the live workspace
  *
  * @param string $table the table of the record
  * @param integer $id the ID of the record
  * @param integer $destPid Position to move to: $destPid: >=0 then it points to
  * 				a page-id on which to insert the record (as the first element).
  * 				<0 then it points to a uid from its own table after which to insert it
  * @param array $propArr Record properties, like header and pid (includes workspace overlay)
  * @param array $moveRec Record properties, like header and pid (without workspace overlay)
  * @param integer $resolvedPid The final page ID of the record
  * 				(workspaces and negative values are resolved)
  * @param boolean $recordWasMoved can be set so that other hooks or
  * 				TCEmain knows that the default move action doesn't have to be called
  * @param	$table	the table
  */
 public function moveRecord($table, $uid, $destPid, array $propArr, array $moveRec, $resolvedPid, &$recordWasMoved, t3lib_TCEmain $tcemainObj)
 {
     global $TCA;
     // Only do something in Draft workspace
     if ($tcemainObj->BE_USER->workspace !== 0) {
         $recordWasMoved = TRUE;
         // Get workspace version of the source record, if any:
         $WSversion = t3lib_BEfunc::getWorkspaceVersionOfRecord($tcemainObj->BE_USER->workspace, $table, $uid, 'uid,t3ver_oid');
         // If no version exists and versioningWS is in version 2, a new placeholder is made automatically:
         if (!$WSversion['uid'] && (int) $TCA[$table]['ctrl']['versioningWS'] >= 2 && (int) $moveRec['t3ver_state'] != 3) {
             $tcemainObj->versionizeRecord($table, $uid, 'Placeholder version for moving record');
             $WSversion = t3lib_BEfunc::getWorkspaceVersionOfRecord($tcemainObj->BE_USER->workspace, $table, $uid, 'uid,t3ver_oid');
             // Will not create new versions in live workspace though...
         }
         // Check workspace permissions:
         $workspaceAccessBlocked = array();
         // Element was in "New/Deleted/Moved" so it can be moved...
         $recIsNewVersion = (int) $moveRec['t3ver_state'] > 0;
         $destRes = $tcemainObj->BE_USER->workspaceAllowLiveRecordsInPID($resolvedPid, $table);
         $canMoveRecord = $recIsNewVersion || (int) $TCA[$table]['ctrl']['versioningWS'] >= 2;
         // Workspace source check:
         if (!$recIsNewVersion) {
             $errorCode = $tcemainObj->BE_USER->workspaceCannotEditRecord($table, $WSversion['uid'] ? $WSversion['uid'] : $uid);
             if ($errorCode) {
                 $workspaceAccessBlocked['src1'] = 'Record could not be edited in workspace: ' . $errorCode . ' ';
             } elseif (!$canMoveRecord && $tcemainObj->BE_USER->workspaceAllowLiveRecordsInPID($moveRec['pid'], $table) <= 0) {
                 $workspaceAccessBlocked['src2'] = 'Could not remove record from table "' . $table . '" from its page "' . $moveRec['pid'] . '" ';
             }
         }
         // Workspace destination check:
         // All records can be inserted if $destRes is greater than zero.
         // Only new versions can be inserted if $destRes is false.
         // NO RECORDS can be inserted if $destRes is negative which indicates a stage
         //  not allowed for use. If "versioningWS" is version 2, moving can take place of versions.
         if (!($destRes > 0 || $canMoveRecord && !$destRes)) {
             $workspaceAccessBlocked['dest1'] = 'Could not insert record from table "' . $table . '" in destination PID "' . $resolvedPid . '" ';
         } elseif ($destRes == 1 && $WSversion['uid']) {
             $workspaceAccessBlocked['dest2'] = 'Could not insert other versions in destination PID ';
         }
         if (!count($workspaceAccessBlocked)) {
             // If the move operation is done on a versioned record, which is
             // NOT new/deleted placeholder and versioningWS is in version 2, then...
             if ($WSversion['uid'] && !$recIsNewVersion && (int) $TCA[$table]['ctrl']['versioningWS'] >= 2) {
                 $this->moveRecord_wsPlaceholders($table, $uid, $destPid, $WSversion['uid'], $tcemainObj);
             } else {
                 // moving not needed, just behave like in live workspace
                 $recordWasMoved = FALSE;
             }
         } else {
             $tcemainObj->newlog("Move attempt failed due to workspace restrictions: " . implode(' // ', $workspaceAccessBlocked), 1);
         }
     }
 }
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:70,代码来源:class.tx_version_tcemain.php

示例11: workspaceAllowAutoCreation

 /**
  * Evaluates if auto creation of a version of a record is allowed.
  *
  * @param	string		Table of the record
  * @param	integer		UID of record
  * @param	integer		PID of record
  * @return	boolean		TRUE if ok.
  */
 function workspaceAllowAutoCreation($table, $id, $recpid)
 {
     // Auto-creation of version: In offline workspace, test if versioning is enabled and look for workspace version of input record. If there is no versionized record found we will create one and save to that.
     if ($this->workspace !== 0 && !$this->workspaceRec['disable_autocreate'] && $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] && $recpid >= 0 && !t3lib_BEfunc::getWorkspaceVersionOfRecord($this->workspace, $table, $id, 'uid') && !t3lib_BEfunc::isPidInVersionizedBranch($recpid, $table)) {
         // PID must NOT be in a versionized branch either
         return TRUE;
     }
 }
开发者ID:zsolt-molnar,项目名称:TYPO3-4.5-trunk,代码行数:16,代码来源:class.t3lib_userauthgroup.php

示例12: updateDataSourceFieldFromTemplateObjectField

	/**
	 * Finds data source value for the current template object and sets it to the
	 * $incomingFieldArray.
	 *
	 * @param	array	$incomingFieldArray	Array with fields
	 * @param	string	$dsField	Data source field name in the $incomingFieldArray
	 * @param	string	$toField	Template object field name in the $incomingFieldArray
	 * @param	t3lib_beUserAuth	$beUser	Current backend user for this operation
	 * @return	void
	 */
	protected function updateDataSourceFieldFromTemplateObjectField(array &$incomingFieldArray, $dsField, $toField, t3lib_beUserAuth &$beUser) {
		$toId = $incomingFieldArray[$toField];
		if (intval($toId) == 0) {
			$incomingFieldArray[$dsField] = '';
		}
		else {
			if ($beUser->workspace) {
				$record = t3lib_BEfunc::getWorkspaceVersionOfRecord($beUser->workspace, 'tx_templavoila_tmplobj', $toId, 'datastructure');
				if (!is_array($record)) {
					$record = t3lib_BEfunc::getRecord('tx_templavoila_tmplobj', $toId, 'datastructure');
				}
			}
			else {
				$record = t3lib_BEfunc::getRecord('tx_templavoila_tmplobj', $toId, 'datastructure');
			}
			if (is_array($record) && isset($record['datastructure'])) {
				$incomingFieldArray[$dsField] = $record['datastructure'];
			}
		}
	}
开发者ID:rafu1987,项目名称:t3bootstrap-project,代码行数:30,代码来源:class.tx_templavoila_tcemain.php

示例13: tt_content_drawItem

    /**
     * Draws the preview content for a content element
     *
     * @param	string		Content element
     * @param	boolean		Set if the RTE link can be created.
     * @return	string		HTML
     */
    function tt_content_drawItem($row, $isRTE = FALSE)
    {
        global $TCA;
        $out = '';
        $outHeader = '';
        // Make header:
        if ($row['header'] && $row['header_layout'] != 100) {
            $infoArr = array();
            $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
            $outHeader = ($row['date'] ? htmlspecialchars($this->itemLabels['date'] . ' ' . t3lib_BEfunc::date($row['date'])) . '<br />' : '') . $this->infoGif($infoArr) . '<b>' . $this->linkEditContent($this->renderText($row['header']), $row) . '</b><br />';
        }
        // Make content:
        $infoArr = array();
        switch ($row['CType']) {
            case 'header':
                if ($row['subheader']) {
                    $this->getProcessedValue('tt_content', 'layout', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
                }
                break;
            case 'text':
            case 'textpic':
            case 'image':
                if ($row['CType'] == 'text' || $row['CType'] == 'textpic') {
                    if ($row['bodytext']) {
                        $this->getProcessedValue('tt_content', 'text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
                        $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                    }
                }
                if ($row['CType'] == 'textpic' || $row['CType'] == 'image') {
                    if ($row['image']) {
                        $infoArr = array();
                        $this->getProcessedValue('tt_content', 'imageorient,imagecols,image_noRows,imageborder,imageheight,image_link,image_zoom,image_compression,image_effects,image_frames', $row, $infoArr);
                        $out .= $this->infoGif($infoArr) . $this->thumbCode($row, 'tt_content', 'image') . '<br />';
                        if ($row['imagecaption']) {
                            $infoArr = array();
                            $this->getProcessedValue('tt_content', 'imagecaption_position', $row, $infoArr);
                            $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
                        }
                    }
                    ###########
                    if ($row['tx_damttcontent_files']) {
                        require_once PATH_txdam . 'lib/class.tx_dam_image.php';
                        require_once PATH_txdam . 'lib/class.tx_dam_tcefunc.php';
                        require_once PATH_txdam . 'lib/class.tx_dam_guifunc.php';
                        $config = $TCA['tt_content']['columns']['tx_damttcontent_files']['config'];
                        if ($GLOBALS['BE_USER']->workspace !== 0) {
                            $workspaceRecord = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, 'tt_content', $row['uid']);
                            if ($workspaceRecord) {
                                $row = $workspaceRecord;
                            }
                        }
                        $filesArray = tx_dam_db::getReferencedFiles('tt_content', $row['uid'], $config['MM_match_fields'], $config['MM'], 'tx_dam.*');
                        foreach ($filesArray['rows'] as $rowDAM) {
                            $caption = tx_dam_guiFunc::meta_compileInfoData($rowDAM, '_caption:truncate:100', 'value-string');
                            #$imgAttributes['title'] = tx_dam_guiFunc::meta_compileHoverText($rowDAM);
                            #$thumb = tx_dam_image::previewImgTag($rowDAM, '', $imgAttributes);
                            $thumb = tx_dam_guiFunc::thumbnail($rowDAM);
                            $thumb = '<div style="float:left;width:56px; overflow:auto; margin: 2px 5px 2px 0; padding: 5px; background-color:#fff; border:solid 1px #ccc;">' . $thumb . '</div>';
                            $thumb = '<div>' . $thumb . $caption . '</div><div style="clear:both"></div>';
                            $out .= $thumb;
                        }
                    }
                    #############
                }
                break;
            case 'bullets':
                if ($row['bodytext']) {
                    $this->getProcessedValue('tt_content', 'layout,text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
            case 'table':
                if ($row['bodytext']) {
                    $this->getProcessedValue('tt_content', 'table_bgColor,table_border,table_cellspacing,cols,layout,text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
            case 'uploads':
                if ($row['media']) {
                    $this->getProcessedValue('tt_content', 'media,select_key,layout,filelink_size,table_bgColor,table_border,table_cellspacing', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
            case 'multimedia':
                if ($row['multimedia']) {
                    $out .= $this->renderText($row['multimedia']) . '<br />';
                    $out .= $this->renderText($row['parameters']) . '<br />';
                }
                break;
            case 'mailform':
                if ($row['bodytext']) {
                    $this->getProcessedValue('tt_content', 'pages,subheader', $row, $infoArr);
//.........这里部分代码省略.........
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:101,代码来源:class.ux_tx_cms_layout.php

示例14: workspaceAllowAutoCreation

 /**
  * Evaluates if auto creation of a version of a record is allowed.
  *
  * @param string $table Table of the record
  * @param integer $id UID of record
  * @param integer $recpid PID of record
  * @return boolean TRUE if ok.
  * @todo Define visibility
  */
 public function workspaceAllowAutoCreation($table, $id, $recpid)
 {
     // Auto-creation of version: In offline workspace, test if versioning is
     // enabled and look for workspace version of input record.
     // If there is no versionized record found we will create one and save to that.
     if ($this->workspace !== 0 && !$this->workspaceRec['disable_autocreate'] && $GLOBALS['TCA'][$table]['ctrl']['versioningWS'] && $recpid >= 0 && !t3lib_BEfunc::getWorkspaceVersionOfRecord($this->workspace, $table, $id, 'uid')) {
         // There must be no existing version of this record in workspace.
         return TRUE;
     } elseif ($this->workspaceRec['disable_autocreate']) {
         t3lib_div::deprecationLog('Usage of disable_autocreate feature is deprecated since 4.5.');
     }
 }
开发者ID:nicksergio,项目名称:TYPO3v4-Core,代码行数:21,代码来源:class.t3lib_userauthgroup.php

示例15: renderQuickEdit


//.........这里部分代码省略.........
        $this->deleteButton = t3lib_div::testInt($this->eRParts[1]) && $edit_record && ($this->eRParts[0] != 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] == 'pages' && $this->CALC_PERMS & 4);
        // If undo-button should be rendered (depends on available items in sys_history)
        $this->undoButton = 0;
        $undoRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('tstamp', 'sys_history', 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->eRParts[0], 'sys_history') . ' AND recuid=' . intval($this->eRParts[1]), '', 'tstamp DESC', '1');
        if ($this->undoButtonR = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($undoRes)) {
            $this->undoButton = 1;
        }
        // Setting up the Return URL for coming back to THIS script (if links take the user to another script)
        $R_URL_parts = parse_url(t3lib_div::getIndpEnv('REQUEST_URI'));
        $R_URL_getvars = t3lib_div::_GET();
        unset($R_URL_getvars['popView']);
        unset($R_URL_getvars['new_unique_uid']);
        $R_URL_getvars['edit_record'] = $edit_record;
        $this->R_URI = $R_URL_parts['path'] . '?' . t3lib_div::implodeArrayForUrl('', $R_URL_getvars);
        // Setting close url/return url for exiting this script:
        $this->closeUrl = $this->local_linkThisScript(array('SET' => array('function' => 1)));
        // Goes to 'Columns' view if close is pressed (default)
        if ($BE_USER->uc['condensedMode']) {
            $this->closeUrl = $BACK_PATH . 'alt_db_navframe.php';
        }
        if ($this->returnUrl) {
            $this->closeUrl = $this->returnUrl;
        }
        // Return-url for JavaScript:
        $retUrlStr = $this->returnUrl ? "+'&returnUrl='+'" . rawurlencode($this->returnUrl) . "'" : '';
        // Drawing the edit record selectbox
        $this->editSelect = '<select name="edit_record" onchange="' . htmlspecialchars('jumpToUrl(\'db_layout.php?id=' . $this->id . '&edit_record=\'+escape(this.options[this.selectedIndex].value)' . $retUrlStr . ',this);') . '">' . implode('', $opt) . '</select>';
        // Creating editing form:
        if ($BE_USER->check('tables_modify', $this->eRParts[0]) && $edit_record && ($this->eRParts[0] != 'pages' && $this->EDIT_CONTENT || $this->eRParts[0] == 'pages' && $this->CALC_PERMS & 1)) {
            // Splitting uid parts for special features, if new:
            list($uidVal, $ex_pid, $ex_colPos) = explode('/', $this->eRParts[1]);
            // Convert $uidVal to workspace version if any:
            if ($uidVal != 'new') {
                if ($draftRecord = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, $this->eRParts[0], $uidVal, 'uid')) {
                    $uidVal = $draftRecord['uid'];
                }
            }
            // Initializing transfer-data object:
            $trData = t3lib_div::makeInstance('t3lib_transferData');
            $trData->addRawData = TRUE;
            $trData->defVals[$this->eRParts[0]] = array('colPos' => intval($ex_colPos), 'sys_language_uid' => intval($this->current_sys_language));
            $trData->disableRTE = $this->MOD_SETTINGS['disableRTE'];
            $trData->lockRecords = 1;
            $trData->fetchRecord($this->eRParts[0], $uidVal == 'new' ? $this->id : $uidVal, $uidVal);
            // 'new'
            // Getting/Making the record:
            reset($trData->regTableItems_data);
            $rec = current($trData->regTableItems_data);
            if ($uidVal == 'new') {
                $new_unique_uid = uniqid('NEW');
                $rec['uid'] = $new_unique_uid;
                $rec['pid'] = intval($ex_pid) ? intval($ex_pid) : $this->id;
                $recordAccess = TRUE;
            } else {
                $rec['uid'] = $uidVal;
                // Checking internals access:
                $recordAccess = $BE_USER->recordEditAccessInternals($this->eRParts[0], $uidVal);
            }
            if (!$recordAccess) {
                // If no edit access, print error message:
                $content .= $this->doc->section($LANG->getLL('noAccess'), $LANG->getLL('noAccess_msg') . '<br /><br />' . ($BE_USER->errorMsg ? 'Reason: ' . $BE_USER->errorMsg . '<br /><br />' : ''), 0, 1);
            } elseif (is_array($rec)) {
                // If the record is an array (which it will always be... :-)
                // Create instance of TCEforms, setting defaults:
                $tceforms = t3lib_div::makeInstance('t3lib_TCEforms');
                $tceforms->backPath = $BACK_PATH;
开发者ID:NaveedWebdeveloper,项目名称:Test,代码行数:67,代码来源:db_layout.php


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