/**
  * Returns a record by table and uid.
  *
  * @param $uid
  * @param $table
  * @return array
  */
 public static function getRecords($table, $where)
 {
     $cacheManager = tx_languagevisibility_cacheManager::getInstance();
     $isCacheEnabled = $cacheManager->isCacheEnabled();
     self::$recordCache = $cacheManager->get('daoRecordCache');
     if ($isCacheEnabled) {
         if (!isset(self::$recordCache[$table][$where])) {
             //!TODO we're still running two queries - this can be reduced to one with a tricky search criteria
             $rows = self::getRequestedRecords($table, $where);
             if ($rows) {
                 self::$recordCache[$table][$where] = $rows;
             }
         }
         $cacheManager->set('daoRecordCache', self::$recordCache);
         $result = self::$recordCache[$table][$where];
     } else {
         $result = self::getRequestedRecords($table, $where);
     }
     return $result;
 }
 /**
  * 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();
 }