'PROJECT / Project Tracking & Management'

@staticmethod
def project():

    settings = current.deployment_settings
    activities = (lambda i: settings.get_project_activities())
    activity_types = (lambda i: settings.get_project_activity_types())
    community = settings.get_project_community()
    if community:
        IMPORT = 'Import    Project    Communities'
    else:
        IMPORT = 'Import    Project    Locations'
    community_volunteers = (lambda i: settings.get_project_community_volunteers())
    demographics = (lambda i: settings.get_project_demographics())
    hazards = (lambda i: settings.get_project_hazards())
    programmes = (lambda i: settings.get_project_programmes())
    sectors = (lambda i: settings.get_project_sectors())
    stats = (lambda i: settings.has_module('stats'))
    themes = (lambda i: settings.get_project_themes())
    menu = M(c='project')
    if settings.get_project_mode_3w():
        if community:
            menu(M('Programs', f='programme', check=programmes)(M('Create', m='create')), M('Projects', f='project')(M('Create', m='create')), M('Communities', f='location')(M('Map', m='map'), M('Community    Contacts', f='location_contact'), M('Community    Volunteers', f='volunteer', check=community_volunteers)))
        else:
            menu(M('Programs', f='programme', check=programmes)(M('Create', m='create')), M('Projects', f='project')(M('Create', m='create'), M('Map', f='location', m='map')))
        menu(M('Reports', f='location', m='report')(M('3W', f='location', m='report'), M('Beneficiaries', f='beneficiary', m='report', check=stats), M('Funding', f='organisation', m='report')), M('Import', f='project', m='import', p='create')(M('Import    Projects', m='import', p='create'), M('Import    Project    Organizations', f='organisation', m='import', p='create'), M(IMPORT, f='location', m='import', p='create'), M('Import    Activities', f='activity', m='import', p='create', check=activities)), M('Partner    Organizations', f='partners')(M('Create', m='create'), M('Import', m='import', p='create')), M('Activity    Types', f='activity_type', check=activity_types)(M('Create', m='create')), M('Beneficiary    Types', f='beneficiary_type', check=stats)(M('Create', m='create')), M('Demographics', f='demographic', check=demographics)(M('Create', m='create')), M('Hazards', f='hazard', check=hazards)(M('Create', m='create')), M('Sectors', f='sector', check=sectors)(M('Create', m='create')), M('Themes', f='theme', check=themes)(M('Create', m='create')))
    elif settings.get_project_mode_task():
        menu(M('Projects', f='project')(M('Create', m='create'), M('Open    Tasks    for    Project', vars={'tasks': 1})), M('Tasks', f='task')(M('Create', m='create')))
        if current.auth.s3_has_role('STAFF'):
            ADMIN = current.session.s3.system_roles.ADMIN
            menu(M('Daily    Work', f='time')(M('My    Logged    Hours', vars={'mine': 1}), M('My    Open    Tasks', f='task', vars={'mine': 1})), M('Admin', restrict=[ADMIN])(M('Activity    Types', f='activity_type'), M('Import    Tasks', f='task', m='import', p='create')), M('Reports', f='report')(M('Activity    Report', f='activity', m='report'), M("Last    Week's    Work", f='time', m='report', vars=Storage(rows='person_id', cols='day', fact='sum(hours)', week=1)), M("Last    Month's    Work", f='time', m='report', vars=Storage(rows='person_id', cols='week', fact='sum(hours)', month=1)), M('Project    Time    Report', f='time', m='report')))
    else:
        menu(M('Projects', f='project')(M('Create', m='create'), M('Import', m='import', p='create')))
    return menu
