<?php

/**
* @package Files
*/
class Files_menu extends NE_MenuHook
{
    var $modulesViews = array(
        array('files', 'FileOverview'),
        array('files', 'FileEdit'),
        array('files', 'CatEdit'),
        array('files', 'FileAdd'),
        array('files', 'CatAdd'),
    );

    var $menuDescription = /*T*/'Files repository'/*/T*/;

    function getMenuArr()
    {
        if (NE_Lib::isPublicDir() && $this->user->isAdmin()) {
            return;
        }

        $activeUser = $this->user->getStatus() == USER_STATUS_ACTIVE;

        if($activeUser){

            $tArray = array();
            $tSubArray = array();
            $navlinks = array();
            $class="";
    
            //************************
            //Main Menu Items
            //************************
            //Files Overview Main Menu Item
            if ($this->action == 'FileOverview') $class= "class='sel'";
            $tSubArray[0] = "<a href=\"index.php?fuse=files&amp;view=FileOverview\"  $class>".strtolower($this->user->lang("overview"))."</a>";
            $tSubArray[1] = 0;
            $tArray[] = $tSubArray;
    
            //************************
            //Action Menu Items
            //************************
    
            //Overview (default)
            if ($this->action == 'FileOverview') {
                 $tSubArray[0] = strtolower($this->user->lang("viewing overview"));
                 $tSubArray[1] = 1;
                 $tSubArray[2] = 1;
                 $tArray[] = $tSubArray;
                 $navlinks[] = $tSubArray[0];
            } else {
                 $tSubArray[0] = "<a href=\"index.php?fuse=files&amp;view=FileOverview\">".strtolower($this->user->lang("viewing overview"))."</a>";
                 $tSubArray[1] = 1;
                 $tSubArray[2] = 0;
                 $tArray[] = $tSubArray;
            }
    
            //file-edit - only show if action is active do not show an inactive button
            if($this->action == "FileEdit") {
                 $tSubArray[0] = strtolower($this->user->lang("Edit File"));
                 $tSubArray[1] = 1;
                 $tSubArray[2] = 1;
                 $tArray[] = $tSubArray;
                 $navlinks[] = $tSubArray[0];
            }
    
            //cat-edit  - only show if action is active do not show an inactive button
            if($this->action == "CatEdit") {
                 $tSubArray[0] = strtolower($this->user->lang("Edit Category"));
                 $tSubArray[1] = 1;
                 $tSubArray[2] = 1;
                 $tArray[] = $tSubArray;
                 $navlinks[] = $tSubArray[0];
            }
    
            //file-add  - only show if action is active do not show an inactive button
            if($this->action == "FileAdd") {
                 $tSubArray[0] = strtolower($this->user->lang("Adding File"));
                 $tSubArray[1] = 1;
                 $tSubArray[2] = 1;
                 $tArray[] = $tSubArray;
                 $navlinks[] = $tSubArray[0];
            }
    
            //cat-add  - only show if action is active do not show an inactive button
            if($this->action == "CatAdd") {
                 $tSubArray[0] = strtolower($this->user->lang("Adding Category"));
                 $tSubArray[1] = 1;
                 $tSubArray[2] = 1;
                 $tArray[] = $tSubArray;
                 $navlinks[] = $tSubArray[0];
            }
    
            return array('navlinks' => $navlinks, 'menus' => $tArray);
        }
    }
}

?>
