public function user_fieldvisibility($PA, $fobj)
 {
     $this->init();
     //init some class attributes
     $this->pageId = $PA['row']['pid'];
     $uid = $PA['row']['uid'];
     if (substr($uid, 0, 3) == 'NEW') {
         $this->isNewElement = TRUE;
     }
     if ($PA['table'] == 'pages' && !$this->isNewElement) {
         $this->pageId = $PA['row']['uid'];
     }
     $_modTSconfig = $GLOBALS["BE_USER"]->getTSConfig('mod.languagevisibility', t3lib_BEfunc::getPagesTSconfig($this->pageId));
     $this->modTSconfig = $_modTSconfig['properties'];
     ###
     $languageRep = t3lib_div::makeInstance('tx_languagevisibility_languagerepository');
     $dao = t3lib_div::makeInstance('tx_languagevisibility_daocommon');
     if (version_compare(TYPO3_version, '4.3.0', '<')) {
         $elementfactoryName = t3lib_div::makeInstanceClassName('tx_languagevisibility_elementFactory');
         $elementfactory = new $elementfactoryName($dao);
     } else {
         $elementfactory = t3lib_div::makeInstance('tx_languagevisibility_elementFactory', $dao);
     }
     $value = $PA['row'][$PA['field']];
     $table = $PA['table'];
     $isOverlay = tx_languagevisibility_beservices::isOverlayRecord($PA['row'], $table);
     $visivilitySetting = @unserialize($value);
     if (!is_array($visivilitySetting) && $value != '') {
         $content .= 'Visibility Settings seems to be corrupt:' . $value;
     }
     if ($isOverlay) {
         $uid = tx_languagevisibility_beservices::getOriginalUidOfTranslation($PA['row'], $table);
         $table = tx_languagevisibility_beservices::getOriginalTableOfTranslation($table);
         //This element is an overlay therefore we need to render the visibility field just for the language of the overlay
         $overlayRecordsLanguage = $languageRep->getLanguageById($PA['row']['sys_language_uid']);
         try {
             $originalElement = $elementfactory->getElementForTable($table, $uid);
         } catch (Exception $e) {
             return '';
         }
         $infosStruct = $this->_getLanguageInfoStructurListForElementAndLanguageList($originalElement, array($overlayRecordsLanguage), $PA['itemFormElName'], true);
     } else {
         //This element is an original element (no overlay)
         try {
             $originalElement = $elementfactory->getElementForTable($table, $uid);
         } catch (Exception $e) {
             return 'sorry this element supports no visibility settings';
         }
         $content .= $originalElement->getInformativeDescription();
         if ($originalElement->isMonolithicTranslated()) {
             return $content;
         }
         $languageList = $languageRep->getLanguages();
         $infosStruct = $this->_getLanguageInfoStructurListForElementAndLanguageList($originalElement, $languageList, $PA['itemFormElName'], false);
     }
     $content .= $this->_renderLanguageInfos($infosStruct);
     return '<div id="fieldvisibility">' . $content . '<a href="#" onclick="resetSelectboxes()">reset</a></div>' . $this->_javascript();
 }
 /**
  * This method is used to extend the tce_main process_cmdmap function. It provides the functionallity to
  * disallow users to move, cut or copy any element which has an overlay. Moving and Cutting of elements
  * with overlays is dangerous because the extisting overlays may also need to be moved.
  *
  *
  */
 function process_cmdmap()
 {
     if (t3lib_extMgm::isLoaded('languagevisibility') && $this->isCutCopyAndMoveObservationEnabled()) {
         require_once t3lib_extMgm::extPath("languagevisibility") . 'patch/lib/class.tx_languagevisibility_commandMap.php';
         //user has no rights to cut move copy or delete, therefore the commands need to be filtered
         $command_map = t3lib_div::makeInstance('tx_languagevisibility_commandMap');
         $command_map->setMap($this->cmdmap);
         $command_elements = $command_map->getElementsByCommands(array('cut', 'move', 'copy', 'delete'));
         if (is_array($command_elements)) {
             foreach ($command_elements as $command_element) {
                 try {
                     //get row
                     $table = $command_element['table'];
                     $uid = $command_element['uid'];
                     $row = tx_languagevisibility_daocommon::getRecord($uid, $table);
                     $command = $command_element['cmd'];
                     if (tx_languagevisibility_beservices::isOverlayRecord($row, $table)) {
                         //current element is an overlay -> restrict cut copy and move in general -> filter the command map
                         if (($command == 'move' || $command == 'cut' || $command == 'copy') && $this->isCutCopyAndMoveRestrictedForOverlays()) {
                             $this->newlog('The command ' . $command . ' can not be applied on overlays', 1);
                             //overlay records should no be move,copy or cutable but it should be possible to delete them
                             //therefore we remove all elements which have the comment cut, copy or move
                             $command_map->removeElement($command_element);
                         }
                     } else {
                         //current element is no overlay
                         if (!tx_languagevisibility_beservices::canCurrrentUserCutCopyMoveDelete()) {
                             //if the record has any translation disallow move, cut, copy and delete
                             $elementObj = tx_languagevisibility_beservices::getElement($uid, $table);
                             if ($elementObj->hasAnyTranslationInAnyWorkspace()) {
                                 $command_map->removeElement($command_element);
                                 $this->newlog('You have no rights to apply the command ' . $command . ' on elements with overlays', 1);
                             }
                         }
                     }
                 } catch (Exception $e) {
                     //element not supported by language visibility
                 }
             }
         }
         //overwrite the internal map an process the base tce_main method
         $this->cmdmap = $command_map->getMap();
     }
     //process parent method to use basic functionallity
     parent::process_cmdmap();
 }