<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Description of filemanager_admin
 *
 * @author Igor Ratsun
 */
class filemanager_admin  extends MX_Controller {
    
    public function manage() {
        // Unset left menu
        $this->admin_lib->content['user_left_menu'] = '';
        // Set top menu active
        $this->admin_lib->content['active_menu'] = 3;
        
        $this->lang->load('filemanager/install');
        $this->lang->load('filemanager/admin');
        
        $allowedPages = array('images', 'files', 'flash');
        
        $type = $this->uri->get_next_segment('manage');
        
        if (!in_array($type, $allowedPages)) {
            $type = 'images';
        }
        
        $content = array(
            'lang' => $this->config->item('language_short'),
            'type' => $type
        );
        
        // Add nav
        foreach ($allowedPages as $page) {
            $content['tabs'][] = array(
                'url' => '/' . $this->config->item('admin_page') . '/mconfig/index/filemanager/manage/' . $page,
                'name' => $this->lang->line($page),
                'active' => ($type == $page) ? 'class="active"' : ''
            );
        }
        
        return array(
            'content' => $this->parser->parse('filemanager/template', $content, TRUE),
            'title' => $this->lang->line('module_name')
        );
    }
    
}

