/** * 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(); } }
/** * Method to check if records of a given table support the languagevisibility feature * * @param string $table * @return boolean */ public static function isSupportedTable($table) { $supported = tx_languagevisibility_visibilityService::getSupportedTables(); if (in_array($table, $supported)) { return true; } else { return false; } }