{% extends "page.html" %}
{% load i18n thumbnail remote %}

{% block meta_title %}Fiche Projet : {{ item }}{% endblock %}

{% block stylesheet %}
    <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4/leaflet.css" />
    <!--[if lte IE 8]>
         <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.4/leaflet.ie.css" />
    <![endif]-->
    {{ block.super }}
{% endblock stylesheet %}

{% block javascript %}
    {{ block.super }}
    <script type="text/javascript" src="http://leaflet.cloudmade.com/dist/leaflet.js"></script>
    <script type="text/javascript" src="http://maps.stamen.com/js/tile.stamen.js?v1.1.3"></script>
    <!--
    <script src="http://cdn.leafletjs.com/leaflet-0.4/leaflet.js"></script>
    -->
{% endblock javascript %}


{% block article %}

        <h2 class="like-h1">Fiche Projet : {{ item }}</h2>
        <h3>Porteur du projet</h3>
        <a href="{{ item.organization.get_absolute_url }}">
            {{ item.organization }}</a> ({{ item.organization.get_statut_display }})

            <br>
                <!--  -->
   <div id="map-projects" ></div>
   <div id="map" class="block" style="width: 300px; height: 300px; float:right;margin-left:20px;margin-bottom:10px"></div>


    <script>
        var map = new L.Map('map');
        var ailleurs = new L.LatLng(45.654827, 3.430401); // geographical point (longitude and latitude)
        var noms = new L.StamenTileLayer("toner-labels");
        var fond = new L.StamenTileLayer("watercolor");


        var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
            cloudmadeAttribution = 'OSM/Cloudmade/Stamen',
            cloudmade = new L.tileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution});

        map.addLayer(cloudmade);

        map.addLayer(fond);
        map.addLayer(noms);

        $(function(){

            $.getJSON('/projet/{{ item.id }}/map/', function(data) {

                var eadGeojsonLayer = new L.geoJson(data, {

                }).addTo(map);

                map.fitBounds(eadGeojsonLayer.getBounds().pad(0.3));

             });

            $(".leaflet-control-attribution").hide();

        });


    </script>
<!-- -->



        {% if item.support.all %}
        <h3>Partenaires</h3>
        <ul>
            {% for p in item.project.all %}
            <li><u>{{ p.collaboration_type }}</u> : <a href="{{ p.partner.get_absolute_url }}">
                {{ p.partner.label }}</a> ({{ p.partner.get_statut_display }})</li>
            {% endfor %}
        </ul>
        {% endif %}


        <h3>Description</h3>
        {{ item.description|safe }}





        <h3>Objectifs pédagogiques</h3>
        {{ item.ead_objectifs|safe }}



        <h3>Renseignements complémentaires</h3>
            <dl class="attr_table">


                {% if item.person or item.remote_person_label %}
                    <dt>Auteur</dt>
                    {% local_or_remote uri article person as author_uri %}
                    {% local_or_remote label article person as author_label %}
                    <dd>{% if author_uri %}<a href="{{author_uri}}">{% endif %}
                        {{ author_label }}
                        {% if author_uri %}</a>{% endif %}</dd>
                {% endif %}

                {% if item.organization or item.remote_organization_label %}
                    <dt>Structure</dt>
                    {% local_or_remote uri item organization as org_uri %}
                    {% local_or_remote label item organization as org_label %}
                    <dd>{% if org_uri %}<a href="{{org_uri}}">{% endif %}
                        {{ org_label }}
                        {% if org_uri %}</a>{% endif %}</dd>
                {% endif %}


                <dt>Déroulement</dt>
                    <dd>Du {{ item.start|date:"d F o"}} au {{ item.end|date:"d F o"}}</dd>

                {% if item.zone %}
                    <dt>Zone géographique</dt>
                    <dd>{{ item.zone.label }}</dd>
                {% endif %}

                {% if item.budget %}
                    <dt>Budget</dt>
                    <dd>{{ item.budget }} €</dd>
                {% endif %}

                {% if item.status %}
                    <dt>Statut</dt>
                    <dd>{{ item.get_status_display }}</dd>
                {% endif %}

                {% if item.ead_disciplines.all %}
                    <dt>Discipline associée</dt>
                    <dd>{% for d in item.ead_disciplines.all %}
                        {{ d }}{% if not forloop.last %}, {% endif %}
                        {% endfor %}</dd>
                {% endif %}

                    <dt>Eleves</dt>
                    <dd>{{item.ead_nb_eleves}} élèves en {% for d in item.ead_niveaux.all %}
                        {{ d }}{% if forloop.last %}.{% else %}, {% endif %}
                        {% endfor %}</dd>

                <dt>Personnel enseignant</dt>
                    <dd>{{item.ead_nb_profs}} personnes.</dd>

                {% if item.tags.all %}
                    <dt>Mots-clés</dt>
                    <dd>{% for tag in item.tags.all %}
                        <a href="{{ tag.get_absolute_url }}">{{ tag }}</a>{% if not forloop.last %}, {% endif %}
                        {% endfor %}</dd>
                {% endif %}

            </dl>






{% endblock article %}
