Enlever contenu et ressources

This commit is contained in:
alazo 2017-04-06 16:08:55 +02:00
parent 27ddf8883a
commit 82f87a5841
5 changed files with 115 additions and 30 deletions

View file

@ -78,7 +78,14 @@ class Domaine(models.Model):
color = settings.DOMAINE_COULEURS[self.code] color = settings.DOMAINE_COULEURS[self.code]
return svg.format(20, height_frame , color) + txt.format(50, self.__str__()) return svg.format(20, height_frame , color) + txt.format(50, self.__str__())
def json(self):
dic_js = {}
dic_js['{code'] = self.code
dic_js['nom'] = self.nom
dic_js['resp'] = self.responsable.nom
return '{'
class Processus(models.Model): class Processus(models.Model):

View file

@ -162,6 +162,7 @@ def Preformatted_left(text):
def Preformatted_right(text): def Preformatted_right(text):
return Preformatted(text, style_normal, maxLineLength=110) return Preformatted(text, style_normal, maxLineLength=110)
class EvaluationView(ListView): class EvaluationView(ListView):
template_name = 'cms/evaluation.html' template_name = 'cms/evaluation.html'
model = Processus model = Processus
@ -211,9 +212,9 @@ class ModulePDF(DetailView):
[Preformatted_left('Processus'), Preformatted_right(m.processus.__str__())], [Preformatted_left('Processus'), Preformatted_right(m.processus.__str__())],
[Preformatted_left('Situation emblématique'), Preformatted_right(m.situation)], [Preformatted_left('Situation emblématique'), Preformatted_right(m.situation)],
[Preformatted_left('Compétences visées'), Preformatted_right(str_comp)], [Preformatted_left('Compétences visées'), Preformatted_right(str_comp)],
[Preformatted_left('Ressources à acquérir'), Preformatted_right(str_res)], #[Preformatted_left('Ressources à acquérir'), Preformatted_right(str_res)],
[Preformatted_left('Objectifs à atteindre'), Preformatted_right(str_obj)], [Preformatted_left('Objectifs à atteindre'), Preformatted_right(str_obj)],
[Preformatted_left('Contenu'), Preformatted_right(str_con)], #[Preformatted_left('Contenu'), Preformatted_right(str_con)],
[Preformatted_left('Evaluation'), Preformatted_right(m.evaluation)], [Preformatted_left('Evaluation'), Preformatted_right(m.evaluation)],
[Preformatted_left('Type'), Preformatted_right('{0}, obligatoire'.format(m.type))], [Preformatted_left('Type'), Preformatted_right('{0}, obligatoire'.format(m.type))],
[Preformatted_left('Semestre'), Preformatted_right('Sem. {0}'.format(m.semestre))], [Preformatted_left('Semestre'), Preformatted_right('Sem. {0}'.format(m.semestre))],
@ -282,8 +283,9 @@ class PeriodePDFView(TemplateView):
[context['sem1'][1], '{0} h.'.format(context['sem1'][1].sem1),'', context['sem2'][1], '{0} h.'.format(context['sem2'][1].sem2) ], [context['sem1'][1], '{0} h.'.format(context['sem1'][1].sem1),'', context['sem2'][1], '{0} h.'.format(context['sem2'][1].sem2) ],
[context['sem1'][2], '{0} h.'.format(context['sem1'][2].sem1),'', context['sem2'][2], '{0} h.'.format(context['sem2'][2].sem2) ], [context['sem1'][2], '{0} h.'.format(context['sem1'][2].sem1),'', context['sem2'][2], '{0} h.'.format(context['sem2'][2].sem2) ],
[context['sem1'][3], '{0} h.'.format(context['sem1'][3].sem1),'', context['sem2'][3], '{0} h.'.format(context['sem2'][3].sem2) ], [context['sem1'][3], '{0} h.'.format(context['sem1'][3].sem1),'', context['sem2'][3], '{0} h.'.format(context['sem2'][3].sem2) ],
[context['sem1'][4], '{0} h.'.format(context['sem1'][4].sem1),'', '', ''], [context['sem1'][4], '{0} h.'.format(context['sem1'][4].sem1),'', context['sem2'][4], '{0} h.'.format(context['sem2'][4].sem2) ],
[context['sem1'][5], '{0} h.'.format(context['sem1'][5].sem1),'', '', ''], [context['sem1'][5], '{0} h.'.format(context['sem1'][5].sem1),'', context['sem2'][5], '{0} h.'.format(context['sem2'][5].sem2) ],
[context['sem1'][6], '{0} h.'.format(context['sem1'][6].sem1),'', '', ''],
['Semestre 3', '{0} h.'.format(context['tot3']['sem3__sum']),'', 'Semestre 4', '{0} h.'.format(context['tot4']['sem4__sum'])], ['Semestre 3', '{0} h.'.format(context['tot3']['sem3__sum']),'', 'Semestre 4', '{0} h.'.format(context['tot4']['sem4__sum'])],
@ -294,13 +296,15 @@ class PeriodePDFView(TemplateView):
[context['sem3'][4], '{0} h.'.format(context['sem3'][4].sem3),'', context['sem4'][4], '{0} h.'.format(context['sem4'][4].sem4) ], [context['sem3'][4], '{0} h.'.format(context['sem3'][4].sem3),'', context['sem4'][4], '{0} h.'.format(context['sem4'][4].sem4) ],
[context['sem3'][5], '{0} h.'.format(context['sem3'][5].sem3),'', context['sem4'][5], '{0} h.'.format(context['sem4'][5].sem4) ], [context['sem3'][5], '{0} h.'.format(context['sem3'][5].sem3),'', context['sem4'][5], '{0} h.'.format(context['sem4'][5].sem4) ],
['Semestre 5', '{0} h.'.format(context['tot5']['sem5__sum']),'', 'Semestre 6', '{0} h.'.format(context['tot6']['sem6__sum'])], ['Semestre 5', '{0} h.'.format(context['tot5']['sem5__sum']),'', 'Semestre 6', '{0} h.'.format(context['tot6']['sem6__sum'])],
[context['sem5'][0], '{0} h.'.format(context['sem5'][0].sem5),'', context['sem6'][0], '{0} h.'.format(context['sem6'][0].sem6) ], [context['sem5'][0], '{0} h.'.format(context['sem5'][0].sem5),'', context['sem6'][0], '{0} h.'.format(context['sem6'][0].sem6) ],
[context['sem5'][1], '{0} h.'.format(context['sem5'][1].sem5),'', context['sem6'][1], '{0} h.'.format(context['sem6'][1].sem6) ], [context['sem5'][1], '{0} h.'.format(context['sem5'][1].sem5),'', context['sem6'][1], '{0} h.'.format(context['sem6'][1].sem6) ],
[context['sem5'][2], '{0} h.'.format(context['sem5'][2].sem5),'', context['sem6'][2], '{0} h.'.format(context['sem6'][2].sem6) ], [context['sem5'][2], '{0} h.'.format(context['sem5'][2].sem5),'', context['sem6'][2], '{0} h.'.format(context['sem6'][2].sem6) ],
[context['sem5'][3], '{0} h.'.format(context['sem5'][3].sem5),'', context['sem6'][3], '{0} h.'.format(context['sem6'][3].sem6) ], [context['sem5'][3], '{0} h.'.format(context['sem5'][3].sem5),'', context['sem6'][3], '{0} h.'.format(context['sem6'][3].sem6) ],
[context['sem5'][4], '{0} h.'.format(context['sem5'][4].sem5),'', '', '' ], [context['sem5'][4], '{0} h.'.format(context['sem5'][4].sem5),'', context['sem6'][4], '{0} h.'.format(context['sem6'][4].sem6) ],
[context['sem5'][5], '{0} h.'.format(context['sem5'][5].sem5),'', '', '' ], [context['sem5'][5], '{0} h.'.format(context['sem5'][5].sem5),'', '', '' ],
[context['sem5'][6], '{0} h.'.format(context['sem5'][6].sem5),'', '', '' ],
] ]
t = Table(data, colWidths=[6.5*cm,1*cm, 1*cm, 6.5*cm, 1*cm], spaceBefore=2*cm, spaceAfter=1.5*cm) t = Table(data, colWidths=[6.5*cm,1*cm, 1*cm, 6.5*cm, 1*cm], spaceBefore=2*cm, spaceAfter=1.5*cm)
@ -313,15 +317,15 @@ class PeriodePDFView(TemplateView):
('LINEBELOW', (0,0), (1,0), 1, colors.black), ('LINEBELOW', (0,0), (1,0), 1, colors.black),
('LINEBELOW', (3,0), (-1,0), 1, colors.black), ('LINEBELOW', (3,0), (-1,0), 1, colors.black),
('TOPPADDING', (0,7), (-1,7), 15), ('TOPPADDING', (0,8), (-1,8), 15),
('LINEBELOW', (0,7), (1,7), 1, colors.black), ('LINEBELOW', (0,8), (1,8), 1, colors.black),
('LINEBELOW', (3,7), (-1,7), 1, colors.black), ('LINEBELOW', (3,8), (-1,8), 1, colors.black),
('TOPPADDING', (0,14), (-1,14), 15), ('TOPPADDING', (0,15), (-1,15), 15),
('LINEBELOW', (0,14), (1,14), 1, colors.black), ('LINEBELOW', (0,15), (1,15), 1, colors.black),
('LINEBELOW', (3,14), (-1,14), 1, colors.black), ('LINEBELOW', (3,15), (-1,15), 1, colors.black),
('FONT', (0, 0), (-1, 0), 'Helvetica-Bold'), ('FONT', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONT', (0, 7), (-1, 7), 'Helvetica-Bold'), ('FONT', (0, 8), (-1, 8), 'Helvetica-Bold'),
('FONT', (0, 14), (-1, 14), 'Helvetica-Bold'), ('FONT', (0, 15), (-1, 15), 'Helvetica-Bold'),
])) ]))
t.hAlign = 0 t.hAlign = 0

View file

@ -37,6 +37,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'chartjs',
'cms', 'cms',
] ]

View file

@ -10,30 +10,103 @@
{% block content %} {% block content %}
<script type="text/javascript" src="{% static 'js/Chart.min.js' %}"></script>
<style>
.container{
width: 1200px;
margin: 0 auto;
}
ul.tabs{
margin: 0px;
padding: 0px;
list-style: none;
}
ul.tabs li{
background: none;
color: #222;
display: inline-block;
padding: 10px 15px;
cursor: pointer;
}
ul.tabs li.current{
background: #ededed;
color: #222;
}
.tab-content{
display: none;
background: #ededed;
padding: 15px;
}
.tab-content.current{
display: inherit;
}
</style>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function(){
$("select.P01").change(function(){ $('select').change(function(){
cl = $(this).attr('class');
tot = 0 tt = 'select.' + cl +' option:selected'
$('select.P01 option:selected').each(function(){ tot = 0;
max = $(tt).length * 3;
$(tt).each(function(){
tot = tot + parseInt($(this).val()); tot = tot + parseInt($(this).val());
}); });
alert(tot); $('#tot_' + cl).text(Math.round(tot/max*100) + ' %');
}); });
$('ul.tabs li').click(function(){
var tab_id = $(this).attr('data-tab');
$('ul.tabs li').removeClass('current');
$('.tab-content').removeClass('current');
$(this).addClass('current');
$("#"+tab_id).addClass('current');
});
}); });
</script> </script>
<div id="content-main"> <div id="content-main">
<h1>Evaluation des compétences</h1> <h1>Evaluation des compétences</h1>
<table> <div class="container">
{% for p in object_list %} <div>
<tr><th>{{p}}</th><td></td></tr> <ul class="tabs">
{% for c in p.competence_set.all %} <li class="tab-link current" data-tab="P01">P01</li>
<tr><td>{{c}}</td><td><select class="{{p.code}}" ><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option></select></td></tr> <li class="tab-link" data-tab="P02">P02</li>
{% endfor %} <li class="tab-link" data-tab="P03">P03</li>
{% endfor %} <li class="tab-link" data-tab="P04">P04</li>
</table> <li class="tab-link" data-tab="P05">P05</li>
<li class="tab-link" data-tab="P06">P06</li>
<li class="tab-link" data-tab="P07">P07</li>
<li class="tab-link" data-tab="P08">P08</li>
</ul>
<hr/>
</div>
{% for p in object_list %}
<div id="{{p.code}}" class="tab-content">
<table>
<tr><th>{{p}}</th><td width="100px"><div id="tot_{{p.code}}"></div></td></tr>
{% for c in p.competence_set.all %}
<tr><td>{{c}}</td><td><select class="{{p.code}}" ><option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option></select></td></tr>
{% endfor %}
</table>
</div>
{% endfor %}
</div><!-- container -->
</div> </div>

View file

@ -15,9 +15,9 @@
{% for c in object.competence_set.all %}- {{c.nom}} ({{c.code}})<br /> {% for c in object.competence_set.all %}- {{c.nom}} ({{c.code}})<br />
{% if user.is_authenticated %} {% if user.is_authenticated %}
{% for sc in c.souscompetence_set.all %}&nbsp;&nbsp;&nbsp; -- {{sc.nom}} <br />{%endfor %}{% endif %}{% endfor %}</td></tr> {% for sc in c.souscompetence_set.all %}&nbsp;&nbsp;&nbsp; -- {{sc.nom}} <br />{%endfor %}{% endif %}{% endfor %}</td></tr>
<tr><th>Ressources à acquérir</th><td>{% for c in object.ressource_set.all %}- {{c}}<br />{% endfor %}</td></tr> <!-- <tr><th>Ressources à acquérir</th><td>{% for c in object.ressource_set.all %}- {{c}}<br />{% endfor %}</td></tr> -->
<tr><th>Objectifs à atteindre</th><td>{% for c in object.objectif_set.all %}- {{c}}<br />{% endfor %}</td></tr> <tr><th>Objectifs à atteindre</th><td>{% for c in object.objectif_set.all %}- {{c}}<br />{% endfor %}</td></tr>
<tr><th>Contenu</th><td>{{object.contenu|linebreaksbr}}</td></tr> <!-- <tr><th>Contenu</th><td>{{object.contenu|linebreaksbr}}</td></tr> -->
<tr><th>Evaluation</th><td>{{object.evaluation|linebreaksbr}}</td></tr> <tr><th>Evaluation</th><td>{{object.evaluation|linebreaksbr}}</td></tr>
<tr><th>Type</th><td>{{object.type}}, obligatoire</td></tr> <tr><th>Type</th><td>{{object.type}}, obligatoire</td></tr>
<tr><th>Semestre</th><td>Sem. {{object.semestre}}</td></tr> <tr><th>Semestre</th><td>Sem. {{object.semestre}}</td></tr>