/**
  * Returns the actions for the given node information's
  *
  * @param stdClass $node
  * @return array
  */
 public function getActionsForNodeArray($nodeData)
 {
     /** @var $node t3lib_tree_pagetree_Node */
     $node = t3lib_div::makeInstance('t3lib_tree_pagetree_Node', (array) $nodeData);
     $node->setRecord(t3lib_tree_pagetree_Commands::getNodeRecord($node->getId()));
     $this->initDataProvider();
     $this->dataProvider->setContextMenuType('table.' . $node->getType());
     $actionCollection = $this->dataProvider->getActionsForNode($node);
     if ($actionCollection instanceof t3lib_contextmenu_ActionCollection) {
         $actions = $actionCollection->toArray();
     }
     return $actions;
 }
 public function hidePageInMenu($show, $nodeData)
 {
     $node = t3lib_div::makeInstance('t3lib_tree_pagetree_Node', (array) $nodeData);
     try {
         $uid = $node->getId();
         $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'uid=' . $uid, array('nav_hide' => $show ? 0 : 1));
         //			t3lib_tree_pagetree_Commands::disableNode($node);
         $newNode = t3lib_tree_pagetree_Commands::getNode($uid);
         $newNode->setLeaf($node->isLeafNode());
         $returnValue = $newNode->toArray();
     } catch (Exception $exception) {
         $returnValue = array('success' => FALSE, 'message' => $exception->getMessage());
     }
     return $returnValue;
 }
    public function menuPage($nodeData) {
        /** @var $node t3lib_tree_pagetree_Node */
        $node = t3lib_div::makeInstance('t3lib_tree_pagetree_Node', (array) $nodeData);

        /** @var $dataProvider t3lib_tree_pagetree_DataProvider */
        $dataProvider = t3lib_div::makeInstance('t3lib_tree_pagetree_DataProvider');

        try {
            $data['pages'][$node->getWorkspaceId()]['doktype'] = 199;
            self::processTceCmdAndDataMap(array(), $data);
            
            $newNode = t3lib_tree_pagetree_Commands::getNode($node->getId());
            $newNode->setLeaf($node->isLeafNode());
            $returnValue = $newNode->toArray();
        } catch (Exception $exception) {
            $returnValue = array(
                'success' => FALSE,
                'message' => $exception->getMessage(),
            );
        }

        return $returnValue;
    }      
 /**
  * Inserts a new node directly after the destination node and returns the created node.
  *
  * @param stdClass $parentNodeData
  * @param int $destination
  * @param int $pageType
  * @return array
  */
 public function insertNodeAfterDestination($parentNodeData, $destination, $pageType)
 {
     /** @var $parentNode t3lib_tree_pagetree_Node */
     $parentNode = t3lib_div::makeInstance('t3lib_tree_pagetree_Node', (array) $parentNodeData);
     try {
         $newPageId = t3lib_tree_pagetree_Commands::createNode($parentNode, -$destination, $pageType);
         $returnValue = t3lib_tree_pagetree_Commands::getNode($newPageId)->toArray();
     } catch (Exception $exception) {
         $returnValue = array('success' => FALSE, 'message' => $exception->getMessage());
     }
     return $returnValue;
 }
 /**
  * Returns the language labels, sprites and configuration options for the pagetree
  *
  * @return void
  */
 public function loadResources()
 {
     $file = 'LLL:EXT:lang/locallang_core.xml:';
     $indicators = $this->getIndicators();
     $configuration = array('LLL' => array('copyHint' => $GLOBALS['LANG']->sL($file . 'tree.copyHint', TRUE), 'fakeNodeHint' => $GLOBALS['LANG']->sL($file . 'mess.please_wait', TRUE), 'activeFilterMode' => $GLOBALS['LANG']->sL($file . 'tree.activeFilterMode', TRUE), 'dropToRemove' => $GLOBALS['LANG']->sL($file . 'tree.dropToRemove', TRUE), 'buttonRefresh' => $GLOBALS['LANG']->sL($file . 'labels.refresh', TRUE), 'buttonNewNode' => $GLOBALS['LANG']->sL($file . 'tree.buttonNewNode', TRUE), 'buttonFilter' => $GLOBALS['LANG']->sL($file . 'tree.buttonFilter', TRUE), 'dropZoneElementRemoved' => $GLOBALS['LANG']->sL($file . 'tree.dropZoneElementRemoved', TRUE), 'dropZoneElementRestored' => $GLOBALS['LANG']->sL($file . 'tree.dropZoneElementRestored', TRUE), 'searchTermInfo' => $GLOBALS['LANG']->sL($file . 'tree.searchTermInfo', TRUE), 'temporaryMountPointIndicatorInfo' => $GLOBALS['LANG']->sl($file . 'labels.temporaryDBmount', TRUE), 'deleteDialogTitle' => $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang.xml:deleteItem', TRUE), 'deleteDialogMessage' => $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang.xml:deleteWarning', TRUE), 'recursiveDeleteDialogMessage' => $GLOBALS['LANG']->sL('LLL:EXT:cms/layout/locallang.xml:recursiveDeleteWarning', TRUE)), 'Configuration' => array('hideFilter' => $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.hideFilter'), 'displayDeleteConfirmation' => $GLOBALS['BE_USER']->jsConfirmation(4), 'canDeleteRecursivly' => $GLOBALS['BE_USER']->uc['recursiveDelete'] == TRUE, 'disableIconLinkToContextmenu' => $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu'), 'indicator' => $indicators['html'], 'temporaryMountPoint' => t3lib_tree_pagetree_Commands::getMountPointPath()), 'Sprites' => array('Filter' => t3lib_iconWorks::getSpriteIconClasses('actions-system-tree-search-open'), 'NewNode' => t3lib_iconWorks::getSpriteIconClasses('actions-page-new'), 'Refresh' => t3lib_iconWorks::getSpriteIconClasses('actions-system-refresh'), 'InputClear' => t3lib_iconWorks::getSpriteIconClasses('actions-input-clear'), 'TrashCan' => t3lib_iconWorks::getSpriteIconClasses('actions-edit-delete'), 'TrashCanRestore' => t3lib_iconWorks::getSpriteIconClasses('actions-edit-restore'), 'Info' => t3lib_iconWorks::getSpriteIconClasses('actions-document-info')));
     return $configuration;
 }
 /**
  * Returns the page tree mounts for the current user
  *
  * Note: If you add the search filter parameter, the nodes will be filtered by this string.
  *
  * @param string $searchFilter
  * @return array
  */
 public function getTreeMounts($searchFilter = '')
 {
     /** @var $nodeCollection t3lib_tree_pagetree_NodeCollection */
     $nodeCollection = t3lib_div::makeInstance('t3lib_tree_pagetree_NodeCollection');
     $isTemporaryMountPoint = FALSE;
     $mountPoints = intval($GLOBALS['BE_USER']->uc['pageTree_temporaryMountPoint']);
     if (!$mountPoints) {
         $mountPoints = array_map('intval', $GLOBALS['BE_USER']->returnWebmounts());
         $mountPoints = array_unique($mountPoints);
     } else {
         $isTemporaryMountPoint = TRUE;
         $mountPoints = array($mountPoints);
     }
     if (!count($mountPoints)) {
         return $nodeCollection;
     }
     $showRootlineAboveMounts = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPathAboveMounts');
     foreach ($mountPoints as $mountPoint) {
         if ($mountPoint === 0) {
             $sitename = 'TYPO3';
             if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] !== '') {
                 $sitename = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
             }
             $record = array('uid' => 0, 'title' => $sitename);
             $subNode = t3lib_tree_pagetree_Commands::getNewNode($record);
             $subNode->setLabelIsEditable(FALSE);
             $subNode->setType('pages_root');
         } else {
             if (in_array($mountPoint, $this->hiddenRecords)) {
                 continue;
             }
             $record = t3lib_BEfunc::getRecordWSOL('pages', $mountPoint, '*', '', TRUE);
             if (!$record) {
                 continue;
             }
             $subNode = t3lib_tree_pagetree_Commands::getNewNode($record, $mountPoint);
             if ($showRootlineAboveMounts && !$isTemporaryMountPoint) {
                 $rootline = t3lib_tree_pagetree_Commands::getMountPointPath($record['uid']);
                 $subNode->setReadableRootline($rootline);
             }
         }
         if (count($mountPoints) <= 1) {
             $subNode->setExpanded(TRUE);
             $subNode->setCls('typo3-pagetree-node-notExpandable');
         }
         $subNode->setIsMountPoint(TRUE);
         $subNode->setDraggable(FALSE);
         $subNode->setIsDropTarget(FALSE);
         if ($searchFilter === '') {
             $childNodes = $this->getNodes($subNode, $mountPoint);
         } else {
             $childNodes = $this->getFilteredNodes($subNode, $searchFilter, $mountPoint);
             $subNode->setExpanded(TRUE);
         }
         $subNode->setChildNodes($childNodes);
         $nodeCollection->append($subNode);
     }
     return $nodeCollection;
 }
 /**
  * Returns the mount point path for a temporary mount or the given id
  *
  * @static
  * @param int $uid
  * @return void
  */
 public static function getMountPointPath($uid = -1)
 {
     if ($uid === -1) {
         $uid = intval($GLOBALS['BE_USER']->uc['pageTree_temporaryMountPoint']);
     }
     if ($uid <= 0) {
         return '';
     }
     $useNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
     $rootline = array_reverse(t3lib_BEfunc::BEgetRootLine($uid));
     array_shift($rootline);
     $path = array();
     foreach ($rootline as $rootlineElement) {
         $record = t3lib_tree_pagetree_Commands::getNodeRecord($rootlineElement['uid']);
         $text = $record['title'];
         if ($useNavTitle && trim($record['nav_title']) !== '') {
             $text = $record['nav_title'];
         }
         $path[] = $text;
     }
     return htmlspecialchars('/' . implode('/', $path));
 }