websiteWebsite
codingteam CodingTeam
A free forge, lightweight and extensible.

 

Browse the code

Revision log Information on the revision
Revision: 381 (differences)
Author: xbright
Log message: * Fixed a few bugs (forge administrator can now enter all dashboards)
* Added the ability to report a bug even if there is no version registered
Change revision:
<?php
//   This file is a part of CodingTeam. Take a look at <http://codingteam.org>.
//   Copyright © 2007-2010 Erwan Briand <erwan@codingteam.net>
//
//   This program is free software: you can redistribute it and/or modify it
//   under the terms of the GNU Affero General Public License as published by
//   the Free Software Foundation, version 3 only.
//
//   This program is distributed in the hope that it will be useful, but
//   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
//   or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
//   License for more details.
//
//   You should have received a copy of the GNU Affero General Public License
//   along with this program. If not, see <http://www.gnu.org/licenses/>.
 
class ProjectsMenu {
    private $ct_db, $lang, $ct_session, $page, $xmlmodule;
    public $notepadmenu, $pagemenu;
    
    function __construct($db, $lang, $session, $page, $xmlmodule)
    {
        // Acces to database
        $this->ct_db = $db;
        $this->lang = $lang;
        $this->ct_session = $session;
        $this->page = $page;
        $this->xmlmodule = $xmlmodule;
 
        $views = array();
        foreach ($this->xmlmodule as $view)
            $views[(string) $view['name']] = (string) $view['active'];
 
        // Notepad menu
        $this->notepadmenu = array('module' => 'projects',
                                   'link' => 'projects',
                                   'title' => i18n('Projects'),
                                   'position' => 1,
                                   'force_login' => FALSE);
 
        // Page menu
        $this->pagemenu = '<ul id="rootmenu">';
 
        if ($views['default'] == 'TRUE')
            $this->pagemenu .= '<li '.( (!isset($this->page[2])) ?
                               'class="current"><a href="projects"><img src="public/images/icons/stock/form/stock_form-time-field.png" style="float: left;padding-right: 5px;" alt="time" />' :
                               '><a href="projects">' ).i18n('Latest projects').'</a></li>';
 
        if ($views['browse'] == 'TRUE')
        {
            $this->pagemenu .= '<li '.( (isset($this->page[2]) && $this->page[2] == 'browse') ?
                               'class="current"><a href="projects/browse"><img src="public/images/icons/actions/edit-find.png" style="float: left;padding-right: 5px;" alt="find" />' :
                               '><a href="projects/browse">' ).i18n('Browse all projects').' <img src="public/images/dropdown.png" alt="dropdown" /></a>
            <ul class="submenu">
 
              <li><a href="projects/browse/map#category"><span style="float: right;">»</span>'.i18n('Category').'</a>
                <ul class="subsubmenu">';
 
            require(CT_BASEDIR.'/inc/data/categories.php');
 
            asort($categories);
            foreach ($categories as $key => $value)
            {
                $catarray = explode('-', $key);
 
                if (empty($catarray[1]))
                {
                    $this->pagemenu .= '<li><a href="projects/browse/category/'.$key.'">'.$value.'</a></li>';
                }
 
            }
 
            $this->pagemenu .='</ul>
              </li>
 
              <li><a href="projects/browse/map#system"><span style="float: right;">»</span>'.i18n('System').'</a>
                <ul class="subsubmenu">';
 
            $systems = array('posix' => 'POSIX (GNU/Linux, BSD, UNIX)',
                             'bsd' => 'BSD (*BSD, Mac OS)',
                             'msdos' => 'MS-DOS - Microsoft Windows',
                             'others' => i18n('Others'),
                             'all' => i18n('Platform independant')
                            );
 
            foreach ($systems as $key => $value)
                $this->pagemenu .= '<li><a href="projects/browse/system/'.$key.'">'.$value.'</a></li>';
 
            $this->pagemenu .='</ul>
              </li>
 
              <li><a href="projects/browse/map#license"><span style="float: right;">»</span>'.i18n('License').'</a>
                <ul class="subsubmenu">';
 
            require(CT_BASEDIR.'/inc/data/licenses.php');
 
            asort($licenses);
            foreach ($licenses as $key => $value)
                $this->pagemenu .= '<li><a href="projects/browse/license/'.$key.'">'.$value.'</a></li>';
 
            $this->pagemenu .='</ul>
              </li>
 
              <li><a href="projects/browse/map#language">'.i18n('Language').'</a></li>
 
              <li><a href="projects/browse/map#translation">'.i18n('Translation').'</a></li>
 
            </ul>            
            </li>';
        }
 
        if ($views['tags'] == 'TRUE')
            $this->pagemenu .= '<li '.( (isset($this->page[2]) && $this->page[2] == 'tags') ?
                               'class="current"><a href="projects/tags"><img src="public/images/icons/status/weather-overcast.png" style="float: left;padding-right: 5px;" alt="tags" />' :
                               '><a href="projects/tags">' ).i18n('Tags cloud').'</a></li>';
 
        if ($views['add'] == 'TRUE')
            $this->pagemenu .= '<li '.( (isset($this->page[2]) && $this->page[2] == 'add') ?
                               'class="current"><a href="projects/add"><img src="public/images/icons/actions/list-add.png" style="float: left;padding-right: 5px;" alt="add" />' :
                               '><a href="projects/add">' ).i18n('Add a project').'</a></li>';         
 
        $this->pagemenu .= '</ul>';
    }
 
    function getNotepadMenu()
    {
        return $this->notepadmenu;
    }
 
    function getPageMenu()
    {
        return $this->pagemenu;
    }
}
?>