Example #1
0
    public function render_nav_bar()
    {
        global $my_app;
        $dir_id = $this->my_app->get_param('dir_id');
        $nav = new phpos_navigation();
        if (!$my_app->get_param('minus_index')) {
            $nav->next_index();
            $nav->add_item();
            $_SESSION['phpos_navigation_stopindex'][WIN_ID] = true;
        } else {
            $nav->set_index($my_app->get_param('set_index'));
            $nav->add_item();
            $my_app->set_param('minus_index', null);
            $my_app->set_param('set_index', null);
            cache_param('minus_index');
            cache_param('set_index');
        }
        //$nav->debug();
        //link_action($action, $params = null)
        //$navBar.='<img src="'.PHPOS_WEBROOT_URL.'_phpos/themes/default/windows/explorer_header_nav_back_transparent.png">';
        /*.............................................. */
        if ($nav->is_prev_index()) {
            global $my_app;
            $index = $nav->get_index();
            $link_index = $index - 1;
            $go_to_index = $nav->get_prev_index();
            $action = 'phpos.windowActionChange(\'' . WIN_ID . '\', \'' . $nav->get_action($go_to_index) . '\', \'' . $nav->parse_params($go_to_index) . ',minus_index:1,set_index:' . $link_index . '\');';
            $navBar .= '<a 
			class="easyui-tooltip" 
			title="' . txt('tip_nav_go_to') . ': ' . $link_index . '" 
			href="javascript:void(0);" 
			onclick="' . $action . '"><img 
			class="nav_back" 
			src="' . THEME_URL . 'windows/explorer_header_nav_back.png"></a>';
        } else {
            $navBar .= '<img 
			src="' . THEME_URL . 'windows/explorer_header_nav_back_transparent.png">';
        }
        /*.............................................. */
        if ($nav->is_next_index()) {
            global $my_app;
            $index = $nav->get_index();
            $link_index = $index + 1;
            $go_to_index = $nav->get_next_index();
            $action = 'phpos.windowActionChange(\'' . WIN_ID . '\', \'' . $nav->get_action($go_to_index) . '\', \'' . $nav->parse_params($go_to_index) . ',minus_index:0,set_index:' . $link_index . '\');';
            $navBar .= '<a 
			class="easyui-tooltip" 
			title="' . txt('tip_nav_go_to') . ': ' . $link_index . '" 
			href="javascript:void(0);" 
			onclick="' . $action . '"><img 
			class="nav_next" 
			src="' . THEME_URL . 'windows/explorer_header_nav_next.png"></a>';
        } else {
            $navBar .= '<img src="' . THEME_URL . 'windows/explorer_header_nav_next_transparent.png">';
        }
        /*.............................................. */
        if ($this->filesystem->have_parent($dir_id)) {
            $parent_dir = $this->filesystem->get_parent_dir($dir_id);
            $in_shared = $this->my_app->get_param('in_shared');
            if (!$in_shared) {
                // not shared
                $navBar .= '<a 
				class="easyui-tooltip" 
				title="' . txt('tip_nav_go_to') . ': ' . $parent_dir . '" 
				href="javascript:void(0);" 
				onclick="' . helper_reload(array('dir_id' => $parent_dir, 'dir_navigation_index' => $navigation['next']['index_id'])) . '"><img class="nav_top"  
				src="' . THEME_URL . 'windows/explorer_header_nav_top.png"></a>';
                /*.............................................. */
            } else {
                // shared, if(not) parent shared
                $shared = new phpos_shared();
                $check_dir_id = $dir_id;
                if (substr($check_dir_id, -1) == '/') {
                    $check_dir_id = substr($check_dir_id, 0, -1);
                }
                $check = $shared->find_shared($check_dir_id);
                /*.............................................. */
                if ($check == 0) {
                    // can up, parent is not outside shared
                    $navBar .= '<a 
					class="easyui-tooltip" 
					title="' . txt('tip_nav_go_to') . ': ' . $parent_dir . '" 
					href="javascript:void(0);" 
					onclick="' . helper_reload(array('dir_id' => $parent_dir, 'dir_navigation_index' => $navigation['next']['index_id'])) . '"><img 
					class="nav_top" 
					src="' . THEME_URL . 'windows/explorer_header_nav_top.png" /></a>';
                } else {
                    $navBar .= '<img 
					class="nav_top_inactive" 
					src="' . THEME_URL . 'windows/explorer_header_nav_top_transparent.png /">';
                }
            }
        } else {
            $navBar .= '<img class="nav_top_inactive" src="' . THEME_URL . 'windows/explorer_header_nav_top_transparent.png">';
        }
        return $navBar;
    }
} else {
    //$my_app->set_param('root_id', null);
    //$my_app->set_param('dir_id', null);
}
// If shared and readonly
$in_shared = $my_app->get_param('in_shared');
$readonly = $my_app->get_param('readonly');
/*.............................................. */
if ($in_shared == 1) {
    $shared = new phpos_shared();
    $share_dir_id = $my_app->get_param('dir_id');
    if (substr($share_dir_id, -1) == '/') {
        $share_dir_id = substr($share_dir_id, 0, -1);
    }
    //echo $share_dir_id;
    $shared_id = $shared->find_shared($share_dir_id);
    /*.............................................. */
    if (!empty($shared_id) && !$shared->is_my($shared_id)) {
        $shared->set_id($shared_id);
        $shared->get_shared();
        $readonly = $shared->get_readonly();
    }
    /*.............................................. */
    if ($readonly) {
        $my_app->set_param('readonly', 1);
    }
} else {
    $my_app->set_param('readonly', null);
}
/*.............................................. */
cache_param('readonly');