Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1887 → Rev 1903

/branches/grupo3/impl/conf/WEB-INF/struts/struts-courses.xml
168,7 → 168,18
 
 
 
<!-- -->
<action path="/user/courseReport"
type="pt.estgp.estgweb.web.controllers.courses.CoursesServicesController"
name="WidgetModelForm"
scope="request"
parameter="dispatch"
validate="true"
input="page.widget.json.fail.validations">
</action>
 
 
 
</action-mappings>
 
</struts-config>
/branches/grupo3/impl/conf/WEB-INF/web.xml
89,7 → 89,8
/layout/themes,
/wsjson/api,
/wsjson/api/app/,
/auth/
/auth/,
/engSoftTest
</param-value>
</init-param>
<init-param>
208,8 → 209,15
<!---->
<!--SERVLETS-->
 
//teste
<servlet>
<servlet-name>EngSoft</servlet-name>
<servlet-class>pt.estgp.estgweb.web.controllers.SubServlet</servlet-class>
</servlet>
 
 
 
 
<servlet>
<servlet-name>WsJson</servlet-name>
<servlet-class>pt.estgp.estgweb.web.json.JsonHandler</servlet-class>
371,7 → 379,15
<!--MAPPINGS-->
 
<!--SOAP Tutorial-->
 
//Teste
<servlet-mapping>
<servlet-name>EngSoft</servlet-name>
<url-pattern>/engSoftTest/*</url-pattern>
</servlet-mapping>
 
 
<servlet-mapping>
<servlet-name>ws</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
/branches/grupo3/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesServicesController.java
New file
0,0 → 1,46
package pt.estgp.estgweb.web.controllers.courses;
 
import org.apache.struts.action.ActionForm;
import org.json.JSONObject;
import pt.estgp.estgweb.web.controllers.utils.AbstractWidgetAjaxController;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
/**
* Created by jorgemachado on 06/01/17.
*/
public class CoursesServicesController extends AbstractWidgetAjaxController
{
 
 
/**
* See also CoursesServicesWidgetController for WS-API services
*/
 
/**
*
* @param form
* @param request
* @param response
* @return
* @throws Throwable
*/
 
public JSONObject generateGlobalLearningResultsChartImg(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Throwable {
 
String courseReportDocument = request.getParameter("courseReportDocument");
 
 
IServiceManager sm = ServiceManager.getInstance();
String json = (String) sm.execute(RequestUtils.getRequester(request, response),
"CourseReportGenerateGlobalLearningResultsChartImg",
new Object[]{courseReportDocument});
return new JSONObject(json);
}
 
 
}
/branches/grupo3/impl/src/web/examples/angular/directives/angular-directive.jsp
New file
0,0 → 1,95
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="bacoTags" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="logic" uri="/WEB-INF/tlds/struts-logic.tld" %>
<html>
<head></head>
<body ng-app="BacoAngularApp">
<jsp:include page="/layout/themes/scripts-default.jsp"/>
<jsp:include page="/layout/headerTools.jsp"/>
 
 
<div id="demoApp" ng-app="demoApp" ng-controller="demoAppController">
 
 
<h1>Uso de Directivas com Templates</h1>
<p>Este exemplo mostra como deve ser usada uma template para podermos incluir uma função
de controlo especifica da template usando directivas</p>
<p>Mostra ainda que dentro da template o scope é uma fusão dos scopes da ngApp e da propria directiva</p>
<p>Mostra também como podemos escolher dinamicamente a template ou as funcionalidades dependendo de atributos que passamos à template</p>
<script>
 
var demoApp = angular.module('demoApp', []);
GLOBAL_BacoAngularAppDependencies.push('demoApp');
 
 
//demoApp..directive('tpl', function() {
//ou
angular.module('demoApp').directive('tpl', function() {
 
return {
restrict: 'E', //A ou E define se é o nome do elemento ou um atributo
link: function(scope, element, attrs) {
// concatenating the directory to the ver attr to select the correct excerpt for the day
 
 
 
scope.teste = "teste";
scope.move = function(){
 
scope.teste = "teste2";
scope.testeSuper = "testeSuper2";
}
},
// passing in contentUrl variable
templateUrl: function(elem,attrs) {
return attrs.templatename;
}
}
});
 
 
demoApp.controller('demoAppController', function ($scope) {
 
 
$scope.testeSuper = "testeSuper";
 
}
);
 
</script>
 
<p>campo testeSuper no mainmodule {{testeSuper}}</p>
 
<p>Se incluirmos o tpl2.html apenas vamos ter acesso às variaveis do scope da aplicação, neste caso o teste, a template pode estar declarada fora da app, não há problema</p>
<p>Por acaso neste exemplo temos acesso ao testeSuper porque a directiva adiciona funcionalidade ao scope da aplicação onde é chamada, mas se não chamarmos nenhuma directiva
a var testeSuper não aparece</p>
<div ng-include="'tpl2.html'"></div>
 
 
<h2>Invocando a tpl de html com directiva</h2>
<tpl templatename="tpl.html"></tpl>
 
<h2>Invocando a tpl de de javascript com directiva</h2>
<tpl templatename="tpl2.html"></tpl>
 
 
 
 
 
 
</div>
 
 
 
<!--TEMPLATE RECURSIVO-->
<script type="text/ng-template" id="tpl2.html">
<div>
<h1>Usando um template de Script</h1>
<p>TESTE</p>
<p>{{teste}}</p>
<p>{{testeSuper}}</p>
<button ng-click="move()">Muda Textos</button>
</div>
</script>
</body>
</html>
/branches/grupo3/impl/src/web/examples/angular/directives/tpl.html
New file
0,0 → 1,5
<h1>Template de HTML</h1>
<p>TESTE</p>
<p>{{teste}}</p>
<p>{{testeSuper}}</p>
<button ng-click="move()">Muda Textos</button>
/branches/grupo3/impl/src/web/examples/angular/directives/angular-directive-module.jsp
New file
0,0 → 1,36
<%--
Created by IntelliJ IDEA.
User: jorgemachado
Date: 11/11/17
Time: 10:20
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title></title>
</head>
<body ng-app="BacoAngularApp">
<jsp:include page="/layout/themes/scripts-default.jsp"/>
<jsp:include page="/layout/headerTools.jsp"/>
 
<div class="container">
<h1>Uso de Templates Generalizados e cada um com sua template</h1>
<p>O caso em questão é a existencia de um esqueleto principal para um modulo (mainmodule)</p>
<p>O main module inclui templates para cada componente usando o ng-include</p>
<p>Esse ng-include é referente ao campo @class de cada componente</p>
<p>vamos incluir esse esqueleto e todas as templates especificas dos nossos modulos</p>
<p>incluimos ainda as directivas que estiverem nos nossos modulos</p>
<p>o template do ng-include irá colocar a directiva desejada caso seja necessário</p>
<p>com a directiva podemos ter funcionalidade de scope associada ao subcomponente, que é desconhecido do main module</p>
<p>caso necessite o includemodule também tem acesso ao scope da app principal</p>
<p>o unico requesito é passar ao include module o nome da app onde ele vai inserir as directivas</p>
 
 
 
<jsp:include page="angular-directive-mainmodule.jsp"/>
<jsp:include page="angular-directive-includemodule.jsp"/>
 
</div>
</body>
</html>
/branches/grupo3/impl/src/web/examples/angular/directives/angular-directive-includemodule.jsp
New file
0,0 → 1,60
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
 
<p>Modulo Incluido contem as directivas e os templates necessários</p>
<p>Este módulo conhece o nome do módulo da App onde vai ser incluido</p>
 
<script>
angular.module("demoApp").directive('tpl', function() {
var contentUrl;
return {
restrict: 'E', //A ou E define se é o nome do elemento ou um atributo
link: function(scope, element, attrs) {
// concatenating the directory to the ver attr to select the correct excerpt for the day
//contentUrl = attrs.templatename + '.html';
 
//console.log(contentUrl);
 
scope.teste = "teste";
scope.move = function(){
 
scope.teste = "teste2modules";
//scope.testeSuper = "testeSuper2modules";
angular.element("#demoApp").scope().testeSuper = "testeSuper2modules";
}
scope.mudaCompName = function(comp){
 
comp.name = "NOVO NOME DO COMP MUDADO NA DIRECTIVA";
}
},
// passing in contentUrl variable
templateUrl: function(elem,attrs) {
return "templateDirectiva";
}
}
});
</script>
 
<script type="text/ng-template" id="directive_class">
<div style="border: 1px solid #000000">
<h1>DIRECTIVE CLASS TEMPLATE</h1>
<p>COMP ELEMENTO DIRECTIVA:{{comp.name}}</p>
<p><input type="text" ng-model="comp.name"></p>
<tpl></tpl>
<p>Teste no scope da directiva<p>
<pre>
{{teste | json}}
</pre>
</div>
</script>
 
<script type="text/ng-template" id="templateDirectiva">
<div style="border: 1px solid green">
<h1>templateDirectiva</h1>
<p>TESTE</p>
<p>{{teste}}</p>
<p>{{testeSuper}}</p>
<p>COMP ELEMENTO DIRECTIVA:{{comp.name}}</p>
<button ng-click="move()">Muda Textos</button>
<button ng-click="mudaCompName(comp)">Muda COMP NAME</button>
</div>
</script>
/branches/grupo3/impl/src/web/examples/angular/directives/angular-directive-mainmodule.jsp
New file
0,0 → 1,50
 
 
<div id="demoApp" ng-app="demoApp" ng-controller="demoAppController">
 
 
 
<script>
 
var demoApp = angular.module('demoApp', []);
GLOBAL_BacoAngularAppDependencies.push('demoApp');
 
 
demoApp.controller('demoAppController', function ($scope) {
 
$scope.testeSuper = "testeSuper";
 
$scope.data =
{
comps : [
{
"@class" : "directive_class",
"name" : "componente de teste"
}
]
}
 
}
);
 
</script>
 
 
<h1>Campo testeSuper no mainmodule "{{testeSuper}}"</h1>
<h1>Campo data.comps[0].name no mainmodule "{{data.comps[0].name}}"</h1>
 
<h2>Template chamado atraves de um template de classe intermedio</h2>
<div ng-repeat="comp in data.comps" ng-include="comp['@class']">
 
</div>
 
 
<pre>
{{testeSuper | json}}
</pre>
<pre>
{{data | json}}
</pre>
 
 
</div>
/branches/grupo3/impl/src/web/user/courses/coursereport/templates.jsp
New file
0,0 → 1,694
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultYear" %>
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultSemester" %>
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultUc" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
 
<!--
@section objeto com seccoes e componentes
@optional @chapter capitulo do documento para esta seccao para contcatenar às subsections
-->
 
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_CourseUnitsReportsSection">
<div class="sections">
<a name="indexCus"></a>
<span ng-repeat="cu in section.sections" ng-init="cu.taxaAprovacao = 100 * cu.courseUnitEvaluation.numAlunosAprovTotal/(cu.courseUnitEvaluation.numAlunosInscritos - cu.courseUnitEvaluation.numAlunosSemElementosAvaliacao)">
<a href="#cu{{$index}}" ng-class="{ 'alert-danger': (cu.courseUnitEvaluation.cumprimentoProgramaPercent &lt; 100) || cu.taxaAprovacao &lt; 75 || !cu.courseUnitEvaluation.closed || !cu.courseUnitEvaluation.teacherComplete}">
{{cu.title}}
</a> |
</span>
<div ng-repeat="cu in section.sections"
class="section panel-primary">
 
<a name="cu{{$index}}"></a>
<span ng-if="$index != 0" class="glyphicon glyphicon-backward" ></span><a ng-if="$index != 0" href="#indexCus"> Voltar atrás</a>
<div class="panel-heading"><h2>{{cu.title}}</h2></div>
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Estado do Relatório</label></h3></div>
 
<div ng-if="cu.courseUnitEvaluation.closed">
Entregue e Aceite
</div>
<div class="alert-danger" ng-if="cu.courseUnitEvaluation.closed && !cu.courseUnitEvaluation.teacherComplete">
Entregue mas não foi aprovado pela comissão
</div>
<div class="alert-danger" ng-if="!cu.courseUnitEvaluation.closed && !cu.courseUnitEvaluation.teacherComplete">
Não foi entregue pelo docente para validação
</div>
 
</div>
 
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Resultados</label></h3></div>
<div>
<table class="tablesorter-blue" width="100%">
<tr>
<th rowspan="2">
Nº Alunos Inscritos
</th>
<th rowspan="2">
Nº de alunos sem elementos de avaliação
</th>
<th colspan="5">
Nº de alunos aprovados em
</th>
<th colspan="2">
Aprovados com a classificação entre 10 e 13 valores
</th>
<th colspan="2">
Aprovados com a classificação entre 14 e 16 valores
</th>
<th colspan="2">
Aprovados com a classificação entre 17 e 20 valores
</th>
</tr>
<tr>
<th>Avaliação de frequência</th>
<th>Exame Época Normal</th>
<th>Exame Época Recurso</th>
<th>Exame Época Especial</th>
<th>Total</th>
<th>Nº</th>
<th>%</th>
<th>Nº</th>
<th>%</th>
<th>Nº</th>
<th>%</th>
</tr>
<tr>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosInscritos}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosSemElementosAvaliacao}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovFrequencia}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovNormal}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovRecurso}}
</td>
<td style="text-align: center">
{{cu.courseUnitEvaluation.numAlunosAprovEspecial}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovTotal}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1013}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1013Percent}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1416}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1416Percent}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1720}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1720Percent}}
</td>
</tr>
</table>
</div>
</div>
 
<div style="padding-left:20px" >
<div><h3><label class="label label-primary">Taxa de Aprovação</label></h3></div>
<div ng-class="{ 'alert-danger': cu.taxaAprovacao &lt; 75 }">{{cu.taxaAprovacao}}%</div>
</div>
 
 
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação dos resultados quantitativos obtidos pelos estudantes</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoQuantitivos}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação do funcionamento da UC</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoUC}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Percentagem de cumprimento do programa da UC</label></h3></div>
<div ng-class="{ 'alert-danger': (cu.courseUnitEvaluation.cumprimentoProgramaPercent &lt; 100) }">
{{cu.courseUnitEvaluation.cumprimentoProgramaPercent}}%
</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação do cumprimento do programa da UC</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoCumprimentoPrograma}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Conclusões</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualConclusoes}}</div>
</div>
</div>
</div>
</script>
 
 
 
<style>
.dtpstats td, .dtpstats th{
text-align: center !important;
}
</style>
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_reportucsummary_UnitsDtpTable">
<div class="sections">
 
<table class="table dtpstats">
<thead>
<tr>
<th rowspan="2">Unidade Curricular</th>
<th colspan="2">Planeamento</th>
<th rowspan="2">Ficha Curricular</th>
<th rowspan="2">Sumários</th>
<th colspan="2">Avaliação</th>
<th rowspan="2">Relatório de Avaliação</th>
<th rowspan="2">Inquerito Pedagógico</th>
</tr>
<tr>
<th>Conteúdos</th>
<th>Calendarização</th>
<th>Enunciados</th>
<th>Pautas</th>
</tr>
</thead>
<tbody>
<tr>
<th colspan="9">Semestre 1</th>
</tr>
<tr ng-repeat="dtpStat in comp.semester1.courseUnitDtpStats">
<td>{{dtpStat.name}}</td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoConteudos }"><input type="checkbox" ng-model="dtpStat.planeamentoConteudos"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoCalendarizacao }"><input type="checkbox" ng-model="dtpStat.planeamentoCalendarizacao"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.ficha }"><input type="checkbox" ng-model="dtpStat.ficha"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.sumarios }"><input type="checkbox" ng-model="dtpStat.sumarios"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoEnunciados }"><input type="checkbox" ng-model="dtpStat.avaliacaoEnunciados"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoPautas }"><input type="checkbox" ng-model="dtpStat.avaliacaoPautas"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.relatorio }"><input type="checkbox" ng-model="dtpStat.relatorio"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.inquerito }"><input type="checkbox" ng-model="dtpStat.inquerito"/></td>
</tr>
<tr>
<th colspan="9">Semestre 2</th>
</tr>
<tr ng-repeat="dtpStat in comp.semester2.courseUnitDtpStats">
<td>{{dtpStat.name}}</td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoConteudos }"><input type="checkbox" ng-model="dtpStat.planeamentoConteudos"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoCalendarizacao }"><input type="checkbox" ng-model="dtpStat.planeamentoCalendarizacao"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.ficha }"><input type="checkbox" ng-model="dtpStat.ficha"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.sumarios }"><input type="checkbox" ng-model="dtpStat.sumarios"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoEnunciados }"><input type="checkbox" ng-model="dtpStat.avaliacaoEnunciados"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoPautas }"><input type="checkbox" ng-model="dtpStat.avaliacaoPautas"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.relatorio }"><input type="checkbox" ng-model="dtpStat.relatorio"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.inquerito }"><input type="checkbox" ng-model="dtpStat.inquerito"/></td>
</tr>
</tbody>
</table>
</div>
</script>
 
 
 
<style>
.learning td
{
font-size: 0.7em;
}
.learning td input{
width: 50px;
}
 
.learning td input:read-only{
width: 50px;
background-color: #cccccc;
}
.learning tr.year td {
vertical-align: top;
background-color: #aaaaaa;
 
font-weight: bold;
}
.learning tr.period td {
vertical-align: top;
background-color: #dfdfdf;
 
}
</style>
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_UnitsLearningResultsTable">
<unitslearningresultstable>
</unitslearningresultstable>
</script>
 
 
 
<script>
angular.module("courseReportApp").directive('boundModel', function() {
return {
require: 'ngModel',
link: function(scope, elem, attrs, ngModel) {
scope.$watch(attrs.boundModel, function(newValue, oldValue) {
if(newValue != oldValue) {
ngModel.$setViewValue(newValue);
ngModel.$render();
}
});
}
}
});
angular.module("courseReportApp").directive('unitslearningresultstable', function() {
 
return {
restrict: 'E',
link: function($scope, element, attrs)
{
 
$scope.checkedDocuments = [];
$scope.checkUnit = function(document,collection)
{
if(document.checked)
{
var docContainer =
{
"document" : document,
"collection" : collection
}
$scope.checkedDocuments.push(docContainer);
}
else
{
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
if(documentContainer.document == document)
{
var index = $scope.checkedDocuments.indexOf(documentContainer);
$scope.checkedDocuments.splice(index, 1);
}
});
}
}
$scope.changeDocumentCollection = function(collection)
{
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
collection.ucs.push(documentContainer.document);
delete documentContainer.document.checked;
});
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
var index = documentContainer.collection.ucs.indexOf(documentContainer.document);
documentContainer.collection.ucs.splice(index, 1);
});
$scope.checkedDocuments = [];
}
$scope.avg = function(field,container, childs)
{
if(!childs || childs.length == 0)
return 0;
var sum = 0;
var c;
for(c in childs)
{
if(childs[c] && childs[c][field])
sum += 1*childs[c][field];
}
container[field] = sum / childs.length;
return container[field];
}
$scope.percent = function(n,total)
{
if(!n || n == 0 || !total || total == 0)
return 0;
return 100 * n / total;
}
$scope.reprovados = function(comp)
{
if(comp.alunosInscritos && comp.semElementos && comp.aprovados)
return comp.alunosInscritos - comp.semElementos - comp.aprovados;
return 0;
}
$scope.removeComponent = function(index,list)
{
list.splice(index,1);
}
$scope.hasYearUnits = function(year)
{
for(s in year.semesters)
{
if(year.semesters[s].ucs && year.semesters[s].ucs.length > 0)
return true;
}
return false;
}
$scope.isInvalidAnfHaveUcs = function(year,years,index)
{
if(year.ano > 0)
return false;
 
var s;
for(s in year.semesters)
{
if(year.semesters[s].ucs && year.semesters[s].ucs.length > 0)
return true;
}
years.splice(index,1);
return false;
}
$scope.addUc = function(semestre)
{
semestre.ucs.push(
{
"@class" : "<%=UnitsLearningResultUc.class.getName()%>",
manual : true,
periodo : semestre.semestre,
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
sigesCode : 0
}
);
}
$scope.addAno = function(comp)
{
if(!comp.years)
comp.years = [];
comp.years.push(
{
ano : 1,
"@class" : "<%=UnitsLearningResultYear.class.getName()%>",
manual : true,
"alunosInscritos": 0,
"aprovados": 0,
"aprovados1013": 0,
"aprovados1013Percent": 0,
"aprovados1416": 0,
"aprovados1416Percent": 0,
"aprovados1720": 0,
"aprovados1720Percent": 0,
"aprovadosPercent": 0,
"cumprimentoProgramaPercent": 0,
"reprovados": 0,
"reprovadosPercent": 0,
"semElementos": 0,
"semElementosPercent": 0,
semesters : [
{
"@class" : "<%=UnitsLearningResultSemester.class.getName()%>",
manual : true,
semestre : "S1",
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
ucs : []
},
{
"@class" : "<%=UnitsLearningResultSemester.class.getName()%>",
manual : true,
semestre: "S2",
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
ucs : []
}
]
}
);
}
 
},
templateUrl: function(elem,attrs) {
return "unitslearningresultstable";
}
}
});
</script>
<script type="text/ng-template" id="unitslearningresultstable">
 
 
<div class="sections">
<button class="btn btn-success" ng-click="addAno(comp)"><span class="glyphicon glyphicon-plus"></span> Ano Manual</button>
<table class="table learning">
<thead>
<tr>
<th rowspan="2">Mover</th>
<th rowspan="2">Código</th>
<th rowspan="2">Unidade Curricular</th>
<th rowspan="2">Cumprimento do Programa</th>
<th rowspan="2">Alunos Inscritos</th>
<th colspan="2">Sem Elementos</th>
<th colspan="2">Reprovados</th>
<th colspan="2">Aprovados</th>
<th colspan="2">Aprovados 10-13</th>
<th colspan="2">Aprovados 14-16</th>
<th colspan="2">Aprovados 17-20</th>
</tr>
<tr>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
</tr>
</thead>
<tbody>
<tr colspan="17" ng-if="false" ng-repeat-start="year in comp.years"></tr>
<tr class="year">
<td colspan="3" ng-if="year.ano &gt; 0">
 
<button ng-disabled="hasYearUnits(year)" class="btn btn-danger btn-xs" ng-click="removeComponent($index,comp.years)"><span class="glyphicon glyphicon-remove"></span></button>
<span ng-if="!year.manual">{{year.ano}}ª ano</span>
<span ng-if="year.manual">
<select ng-model="year.ano" ng-options="c.v as c.n for c in [{v:1,n:'1º Ano'},{v:2,n:'2º Ano'},{v:3,n:'3º Ano'},{v:4,n:'4º Ano'},{v:5,n:'5º Ano'}]">
</select>
</span>
 
</td>
<td colspan="3" style="font-size: 1.0em !important" ng-if="isInvalidAnfHaveUcs(year,comp.years,$index)">
Unidades que não constam do plano (Verifique a situação com os serviços Académicos antes de continuar)
poderão constar de um plano antigo ou ter o código siges desatualizado.
</td>
<td><input readonly="true" type="number" ng-model="year.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.alunosInscritos" bound-model="avg('alunosInscritos',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.semElementos" bound-model="avg('semElementos',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.semElementosPercent" bound-model="percent(year.semElementos,year.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="year.reprovados" bound-model="reprovados(year)"></td>
<td><input readonly="true" type="number" ng-model="year.reprovadosPercent" bound-model="percent(year.reprovados,year.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados" bound-model="year.aprovados1013*1 + year.aprovados1416*1 + year.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="year.aprovadosPercent" bound-model="percent(year.aprovados,year.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="year.aprovados1013" bound-model="avg('aprovados1013',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1013Percent" bound-model="percent(year.aprovados1013,year.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1416" bound-model="avg('aprovados1416',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1416Percent" bound-model="percent(year.aprovados1416,year.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1720" bound-model="avg('aprovados1720',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1720Percent" bound-model="percent(year.aprovados1720,year.aprovados)"></td>
</tr>
 
<tr ng-if="false" ng-repeat-start="s in year.semesters" ></tr>
<tr class="period" ng-if="year.ano &gt; 0 || s.ucs.length > 0">
<td colspan="3" class="period">Semestre {{s.semestre}} <button ng-click="changeDocumentCollection(s)" data-toggle="tooltip" title="Mover unidades para aqui" class="btn btn-xs btn-warning" ng-show="checkedDocuments.length"><span class="glyphicon glyphicon-arrow-left"></span></button>
 
<button class="btn btn-success pull-right" ng-click="addUc(s)"><span class="glyphicon glyphicon-plus"></span> UC Manual</button>
</td>
<td><input readonly="true" type="number" ng-model="s.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.alunosInscritos" bound-model="avg('alunosInscritos',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.semElementos" bound-model="avg('semElementos',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.semElementosPercent" bound-model="percent(s.semElementos,s.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="s.reprovados" bound-model="reprovados(s)"></td>
<td><input readonly="true" type="number" ng-model="s.reprovadosPercent" bound-model="percent(s.reprovados,s.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados" bound-model="s.aprovados1013*1 + s.aprovados1416*1 + s.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="s.aprovadosPercent" bound-model="percent(s.aprovados,s.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="s.aprovados1013" bound-model="avg('aprovados1013',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1013Percent" bound-model="percent(s.aprovados1013,s.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1416" bound-model="avg('aprovados1416',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1416Percent" bound-model="percent(s.aprovados1416,s.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1720" bound-model="avg('aprovados1720',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1720Percent" bound-model="percent(s.aprovados1720,s.aprovados)"></td>
</tr>
<tr ng-repeat="u in s.ucs" ng-class="{'alert-danger': u.error}" >
<td><input ng-model="u.error" type="hidden" bound-model="u.alunosInscritos < (u.aprovados*1 + u.semElementos*1)">
<input ng-model="u.checked" ng-click="checkUnit(u,s)" type="checkbox"></td>
<td><input type="text" ng-readonly="!u.manual || u.manual == false" ng-model="u.sigesCode"></td>
<td>
 
<input type="text" style="width: 150px" ng-if="!(!u.manual || u.manual == false)" ng-model="u.name">
<span ng-if="(!u.manual || u.manual == false)">{{u.name}}</span>
<button class="btn btn-danger btn-xs pull-right" ng-if="!(!u.manual || u.manual == false)" ng-click="removeComponent(index,s.ucs)"><span class="glyphicon glyphicon-remove"></span></button>
</td>
<td><input type="number" ng-model="u.cumprimentoProgramaPercent"></td>
<td><input type="number" ng-model="u.alunosInscritos"></td>
<td><input type="number" ng-model="u.semElementos"></td>
<td><input readonly="true" type="number" ng-model="u.semElementosPercent" bound-model="percent(u.semElementos,u.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="u.reprovados" bound-model="reprovados(u)"></td>
<td><input readonly="true" type="number" ng-model="u.reprovadosPercent" bound-model="percent(u.reprovados,u.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados" bound-model="u.aprovados1013*1 + u.aprovados1416*1 + u.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="u.aprovadosPercent" bound-model="percent(u.aprovados,u.alunosInscritos)"></td>
 
<td><input type="number" ng-model="u.aprovados1013"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1013Percent" bound-model="percent(u.aprovados1013,u.aprovados)"></td>
<td><input type="number" ng-model="u.aprovados1416"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1416Percent" bound-model="percent(u.aprovados1416,u.aprovados)"></td>
<td><input type="number" ng-model="u.aprovados1720"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1720Percent" bound-model="percent(u.aprovados1720,u.aprovados)"></td>
</tr>
<tr ng-if="false" ng-repeat-end></tr>
<tr ng-if="false" ng-repeat-end></tr>
<tr class="year">
<td colspan="3">Resultados Globais</td>
 
 
<td><input readonly="true" type="number" ng-model="comp.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.alunosInscritos" bound-model="avg('alunosInscritos',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.semElementos" bound-model="avg('semElementos',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.semElementosPercent" bound-model="percent(comp.semElementos,comp.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="comp.reprovados" bound-model="reprovados(comp)"></td>
<td><input readonly="true" type="number" ng-model="comp.reprovadosPercent" bound-model="percent(comp.reprovados,comp.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados" bound-model="comp.aprovados1013*1 + comp.aprovados1416*1 + comp.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovadosPercent" bound-model="percent(comp.aprovados,comp.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="comp.aprovados1013" bound-model="avg('aprovados1013',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1013Percent" bound-model="percent(comp.aprovados1013,comp.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1416" bound-model="avg('aprovados1416',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1416Percent" bound-model="percent(comp.aprovados1416,comp.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1720" bound-model="avg('aprovados1720',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1720Percent" bound-model="percent(comp.aprovados1720,comp.aprovados)"></td>
</tr>
</tbody>
</table>
<%--<pre class="code">{{ comp | json }}</pre>--%>
</div>
</script>
 
 
 
 
 
 
 
 
 
 
 
 
 
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_GlobalLearningResultsChartImg">
<globallearningresultschartimg>
</globallearningresultschartimg>
</script>
<script>
angular.module("courseReportApp").directive('globallearningresultschartimg', function() {
 
return {
restrict: 'E',
link: function($scope, element, attrs)
{
$scope.generateChart = function(comp)
{
 
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/courseReport.do",
"generateGlobalLearningResultsChartImg",
{
"courseReportDocument" : BacoJS.stringifyOrdered(angular.element($("#courseReportApp")).scope().report)
},
"#courseReportApp",
function(repositoryFile4JsonView)
{
comp.image = repositoryFile4JsonView;
comp.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + comp.image.identifier + "?" + new Date().getTime();
angular.element($("#courseReportApp")).scope().$apply();
},
function(){}
);
}
 
 
},
templateUrl: function(elem,attrs) {
return "globallearningresultschartimg";
}
}
});
</script>
<script type="text/ng-template" id="globallearningresultschartimg">
<div class="imageComponent component">
 
<div class="componentBody">
<div class="form-group clearfix">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<button class="btn btn-default" ng-click="generateChart(comp)">Refrescar/Gerar Gráfico</button>
</div>
<div class="col-md-10">
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img ng-if="comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
<img ng-if="!comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{'<%=request.getContextPath()%>/repositoryStream/' + comp.image.identifier}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
</div>
</div>
</div>
</div>
</script>
/branches/grupo3/impl/src/web/user/courses/courseReportEdit.jsp
326,7 → 326,7
 
<div class="form-vertical">
<div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController">
 
<div class="web-mensages"></div>
<div ng-init="section=report;" ng-include="'pt_estgp_estgweb_utils_documentBuilder_DocumentSection'">
 
</div>
/branches/grupo5/impl/conf/WEB-INF/struts/struts-json-ws.xml
52,13 → 52,12
<action path="/secure/ws-teacher-list" forward="/user/jsonModel.do?dispatch=executeService&amp;serviceJson=wsListTeachers"/>
<action path="/secure/ws-coordinators-list" forward="/user/jsonModel.do?dispatch=executeService&amp;serviceJson=wsListCoordinators"/>
 
<!--SERVICOS ABERTOS POR ENQUANTO-->
<!--SERVICOS ABERTOS POR ENQUANTO--> <!--Erros porque Struts não aguento mais do que dois hops -->
<action path="/ws-units-report-list" forward="/json/coursesServices.do?dispatch=executeService&amp;serviceJson=getCourseUnitsEvaluations"/>
<action path="/ws-course-pedagogic-results-list" forward="/json/coursesServices.do?dispatch=executeService&amp;serviceJson=findPedagogicReport4Period"/>
<action path="/ws-units-dtp-stats" forward="/json/coursesServices.do?dispatch=executeService&amp;serviceJson=getCourseUnitDtpStats"/>
<action path="/ws-course-unit-plan-year" forward="/json/coursesServices.do?dispatch=executeService&amp;serviceJson=loadPlanYearForCourseUnitCode"/>
 
 
</action-mappings>
 
 
/branches/grupo6/impl/conf/WEB-INF/web.xml
89,7 → 89,8
/layout/themes,
/wsjson/api,
/wsjson/api/app/,
/auth/
/auth/,
/minhaservlet
</param-value>
</init-param>
<init-param>
366,12 → 367,20
<servlet-class>pt.estgp.estgweb.web.controllers.configuration.SchedullerTasksJson</servlet-class>
</servlet>
 
<servlet>
<servlet-name>minhaServlet</servlet-name>
<servlet-class>pt.estgp.estgweb.web.controllers.SubServlet</servlet-class>
</servlet>
 
 
<!--MAPPINGS-->
 
<!--SOAP Tutorial-->
<servlet-mapping>
<servlet-name>minhaServlet</servlet-name>
<url-pattern>/minhaServlet</url-pattern>
</servlet-mapping>
 
<servlet-mapping>
<servlet-name>ws</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
/branches/grupo6/impl/src/web/user/courses/coursereport/templates.jsp
New file
0,0 → 1,694
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultYear" %>
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultSemester" %>
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultUc" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
 
<!--
@section objeto com seccoes e componentes
@optional @chapter capitulo do documento para esta seccao para contcatenar às subsections
-->
 
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_CourseUnitsReportsSection">
<div class="sections">
<a name="indexCus"></a>
<span ng-repeat="cu in section.sections" ng-init="cu.taxaAprovacao = 100 * cu.courseUnitEvaluation.numAlunosAprovTotal/(cu.courseUnitEvaluation.numAlunosInscritos - cu.courseUnitEvaluation.numAlunosSemElementosAvaliacao)">
<a href="#cu{{$index}}" ng-class="{ 'alert-danger': (cu.courseUnitEvaluation.cumprimentoProgramaPercent &lt; 100) || cu.taxaAprovacao &lt; 75 || !cu.courseUnitEvaluation.closed || !cu.courseUnitEvaluation.teacherComplete}">
{{cu.title}}
</a> |
</span>
<div ng-repeat="cu in section.sections"
class="section panel-primary">
 
<a name="cu{{$index}}"></a>
<span ng-if="$index != 0" class="glyphicon glyphicon-backward" ></span><a ng-if="$index != 0" href="#indexCus"> Voltar atrás</a>
<div class="panel-heading"><h2>{{cu.title}}</h2></div>
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Estado do Relatório</label></h3></div>
 
<div ng-if="cu.courseUnitEvaluation.closed">
Entregue e Aceite
</div>
<div class="alert-danger" ng-if="cu.courseUnitEvaluation.closed && !cu.courseUnitEvaluation.teacherComplete">
Entregue mas não foi aprovado pela comissão
</div>
<div class="alert-danger" ng-if="!cu.courseUnitEvaluation.closed && !cu.courseUnitEvaluation.teacherComplete">
Não foi entregue pelo docente para validação
</div>
 
</div>
 
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Resultados</label></h3></div>
<div>
<table class="tablesorter-blue" width="100%">
<tr>
<th rowspan="2">
Nº Alunos Inscritos
</th>
<th rowspan="2">
Nº de alunos sem elementos de avaliação
</th>
<th colspan="5">
Nº de alunos aprovados em
</th>
<th colspan="2">
Aprovados com a classificação entre 10 e 13 valores
</th>
<th colspan="2">
Aprovados com a classificação entre 14 e 16 valores
</th>
<th colspan="2">
Aprovados com a classificação entre 17 e 20 valores
</th>
</tr>
<tr>
<th>Avaliação de frequência</th>
<th>Exame Época Normal</th>
<th>Exame Época Recurso</th>
<th>Exame Época Especial</th>
<th>Total</th>
<th>Nº</th>
<th>%</th>
<th>Nº</th>
<th>%</th>
<th>Nº</th>
<th>%</th>
</tr>
<tr>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosInscritos}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosSemElementosAvaliacao}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovFrequencia}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovNormal}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovRecurso}}
</td>
<td style="text-align: center">
{{cu.courseUnitEvaluation.numAlunosAprovEspecial}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovTotal}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1013}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1013Percent}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1416}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1416Percent}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1720}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1720Percent}}
</td>
</tr>
</table>
</div>
</div>
 
<div style="padding-left:20px" >
<div><h3><label class="label label-primary">Taxa de Aprovação</label></h3></div>
<div ng-class="{ 'alert-danger': cu.taxaAprovacao &lt; 75 }">{{cu.taxaAprovacao}}%</div>
</div>
 
 
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação dos resultados quantitativos obtidos pelos estudantes</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoQuantitivos}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação do funcionamento da UC</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoUC}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Percentagem de cumprimento do programa da UC</label></h3></div>
<div ng-class="{ 'alert-danger': (cu.courseUnitEvaluation.cumprimentoProgramaPercent &lt; 100) }">
{{cu.courseUnitEvaluation.cumprimentoProgramaPercent}}%
</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação do cumprimento do programa da UC</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoCumprimentoPrograma}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Conclusões</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualConclusoes}}</div>
</div>
</div>
</div>
</script>
 
 
 
<style>
.dtpstats td, .dtpstats th{
text-align: center !important;
}
</style>
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_reportucsummary_UnitsDtpTable">
<div class="sections">
 
<table class="table dtpstats">
<thead>
<tr>
<th rowspan="2">Unidade Curricular</th>
<th colspan="2">Planeamento</th>
<th rowspan="2">Ficha Curricular</th>
<th rowspan="2">Sumários</th>
<th colspan="2">Avaliação</th>
<th rowspan="2">Relatório de Avaliação</th>
<th rowspan="2">Inquerito Pedagógico</th>
</tr>
<tr>
<th>Conteúdos</th>
<th>Calendarização</th>
<th>Enunciados</th>
<th>Pautas</th>
</tr>
</thead>
<tbody>
<tr>
<th colspan="9">Semestre 1</th>
</tr>
<tr ng-repeat="dtpStat in comp.semester1.courseUnitDtpStats">
<td>{{dtpStat.name}}</td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoConteudos }"><input type="checkbox" ng-model="dtpStat.planeamentoConteudos"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoCalendarizacao }"><input type="checkbox" ng-model="dtpStat.planeamentoCalendarizacao"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.ficha }"><input type="checkbox" ng-model="dtpStat.ficha"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.sumarios }"><input type="checkbox" ng-model="dtpStat.sumarios"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoEnunciados }"><input type="checkbox" ng-model="dtpStat.avaliacaoEnunciados"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoPautas }"><input type="checkbox" ng-model="dtpStat.avaliacaoPautas"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.relatorio }"><input type="checkbox" ng-model="dtpStat.relatorio"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.inquerito }"><input type="checkbox" ng-model="dtpStat.inquerito"/></td>
</tr>
<tr>
<th colspan="9">Semestre 2</th>
</tr>
<tr ng-repeat="dtpStat in comp.semester2.courseUnitDtpStats">
<td>{{dtpStat.name}}</td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoConteudos }"><input type="checkbox" ng-model="dtpStat.planeamentoConteudos"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoCalendarizacao }"><input type="checkbox" ng-model="dtpStat.planeamentoCalendarizacao"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.ficha }"><input type="checkbox" ng-model="dtpStat.ficha"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.sumarios }"><input type="checkbox" ng-model="dtpStat.sumarios"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoEnunciados }"><input type="checkbox" ng-model="dtpStat.avaliacaoEnunciados"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoPautas }"><input type="checkbox" ng-model="dtpStat.avaliacaoPautas"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.relatorio }"><input type="checkbox" ng-model="dtpStat.relatorio"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.inquerito }"><input type="checkbox" ng-model="dtpStat.inquerito"/></td>
</tr>
</tbody>
</table>
</div>
</script>
 
 
 
<style>
.learning td
{
font-size: 0.7em;
}
.learning td input{
width: 50px;
}
 
.learning td input:read-only{
width: 50px;
background-color: #cccccc;
}
.learning tr.year td {
vertical-align: top;
background-color: #aaaaaa;
 
font-weight: bold;
}
.learning tr.period td {
vertical-align: top;
background-color: #dfdfdf;
 
}
</style>
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_UnitsLearningResultsTable">
<unitslearningresultstable>
</unitslearningresultstable>
</script>
 
 
 
<script>
angular.module("courseReportApp").directive('boundModel', function() {
return {
require: 'ngModel',
link: function(scope, elem, attrs, ngModel) {
scope.$watch(attrs.boundModel, function(newValue, oldValue) {
if(newValue != oldValue) {
ngModel.$setViewValue(newValue);
ngModel.$render();
}
});
}
}
});
angular.module("courseReportApp").directive('unitslearningresultstable', function() {
 
return {
restrict: 'E',
link: function($scope, element, attrs)
{
 
$scope.checkedDocuments = [];
$scope.checkUnit = function(document,collection)
{
if(document.checked)
{
var docContainer =
{
"document" : document,
"collection" : collection
}
$scope.checkedDocuments.push(docContainer);
}
else
{
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
if(documentContainer.document == document)
{
var index = $scope.checkedDocuments.indexOf(documentContainer);
$scope.checkedDocuments.splice(index, 1);
}
});
}
}
$scope.changeDocumentCollection = function(collection)
{
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
collection.ucs.push(documentContainer.document);
delete documentContainer.document.checked;
});
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
var index = documentContainer.collection.ucs.indexOf(documentContainer.document);
documentContainer.collection.ucs.splice(index, 1);
});
$scope.checkedDocuments = [];
}
$scope.avg = function(field,container, childs)
{
if(!childs || childs.length == 0)
return 0;
var sum = 0;
var c;
for(c in childs)
{
if(childs[c] && childs[c][field])
sum += 1*childs[c][field];
}
container[field] = sum / childs.length;
return container[field];
}
$scope.percent = function(n,total)
{
if(!n || n == 0 || !total || total == 0)
return 0;
return 100 * n / total;
}
$scope.reprovados = function(comp)
{
if(comp.alunosInscritos && comp.semElementos && comp.aprovados)
return comp.alunosInscritos - comp.semElementos - comp.aprovados;
return 0;
}
$scope.removeComponent = function(index,list)
{
list.splice(index,1);
}
$scope.hasYearUnits = function(year)
{
for(s in year.semesters)
{
if(year.semesters[s].ucs && year.semesters[s].ucs.length > 0)
return true;
}
return false;
}
$scope.isInvalidAnfHaveUcs = function(year,years,index)
{
if(year.ano > 0)
return false;
 
var s;
for(s in year.semesters)
{
if(year.semesters[s].ucs && year.semesters[s].ucs.length > 0)
return true;
}
years.splice(index,1);
return false;
}
$scope.addUc = function(semestre)
{
semestre.ucs.push(
{
"@class" : "<%=UnitsLearningResultUc.class.getName()%>",
manual : true,
periodo : semestre.semestre,
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
sigesCode : 0
}
);
}
$scope.addAno = function(comp)
{
if(!comp.years)
comp.years = [];
comp.years.push(
{
ano : 1,
"@class" : "<%=UnitsLearningResultYear.class.getName()%>",
manual : true,
"alunosInscritos": 0,
"aprovados": 0,
"aprovados1013": 0,
"aprovados1013Percent": 0,
"aprovados1416": 0,
"aprovados1416Percent": 0,
"aprovados1720": 0,
"aprovados1720Percent": 0,
"aprovadosPercent": 0,
"cumprimentoProgramaPercent": 0,
"reprovados": 0,
"reprovadosPercent": 0,
"semElementos": 0,
"semElementosPercent": 0,
semesters : [
{
"@class" : "<%=UnitsLearningResultSemester.class.getName()%>",
manual : true,
semestre : "S1",
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
ucs : []
},
{
"@class" : "<%=UnitsLearningResultSemester.class.getName()%>",
manual : true,
semestre: "S2",
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
ucs : []
}
]
}
);
}
 
},
templateUrl: function(elem,attrs) {
return "unitslearningresultstable";
}
}
});
</script>
<script type="text/ng-template" id="unitslearningresultstable">
 
 
<div class="sections">
<button class="btn btn-success" ng-click="addAno(comp)"><span class="glyphicon glyphicon-plus"></span> Ano Manual</button>
<table class="table learning">
<thead>
<tr>
<th rowspan="2">Mover</th>
<th rowspan="2">Código</th>
<th rowspan="2">Unidade Curricular</th>
<th rowspan="2">Cumprimento do Programa</th>
<th rowspan="2">Alunos Inscritos</th>
<th colspan="2">Sem Elementos</th>
<th colspan="2">Reprovados</th>
<th colspan="2">Aprovados</th>
<th colspan="2">Aprovados 10-13</th>
<th colspan="2">Aprovados 14-16</th>
<th colspan="2">Aprovados 17-20</th>
</tr>
<tr>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
</tr>
</thead>
<tbody>
<tr colspan="17" ng-if="false" ng-repeat-start="year in comp.years"></tr>
<tr class="year">
<td colspan="3" ng-if="year.ano &gt; 0">
 
<button ng-disabled="hasYearUnits(year)" class="btn btn-danger btn-xs" ng-click="removeComponent($index,comp.years)"><span class="glyphicon glyphicon-remove"></span></button>
<span ng-if="!year.manual">{{year.ano}}ª ano</span>
<span ng-if="year.manual">
<select ng-model="year.ano" ng-options="c.v as c.n for c in [{v:1,n:'1º Ano'},{v:2,n:'2º Ano'},{v:3,n:'3º Ano'},{v:4,n:'4º Ano'},{v:5,n:'5º Ano'}]">
</select>
</span>
 
</td>
<td colspan="3" style="font-size: 1.0em !important" ng-if="isInvalidAnfHaveUcs(year,comp.years,$index)">
Unidades que não constam do plano (Verifique a situação com os serviços Académicos antes de continuar)
poderão constar de um plano antigo ou ter o código siges desatualizado.
</td>
<td><input readonly="true" type="number" ng-model="year.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.alunosInscritos" bound-model="avg('alunosInscritos',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.semElementos" bound-model="avg('semElementos',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.semElementosPercent" bound-model="percent(year.semElementos,year.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="year.reprovados" bound-model="reprovados(year)"></td>
<td><input readonly="true" type="number" ng-model="year.reprovadosPercent" bound-model="percent(year.reprovados,year.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados" bound-model="year.aprovados1013*1 + year.aprovados1416*1 + year.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="year.aprovadosPercent" bound-model="percent(year.aprovados,year.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="year.aprovados1013" bound-model="avg('aprovados1013',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1013Percent" bound-model="percent(year.aprovados1013,year.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1416" bound-model="avg('aprovados1416',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1416Percent" bound-model="percent(year.aprovados1416,year.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1720" bound-model="avg('aprovados1720',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1720Percent" bound-model="percent(year.aprovados1720,year.aprovados)"></td>
</tr>
 
<tr ng-if="false" ng-repeat-start="s in year.semesters" ></tr>
<tr class="period" ng-if="year.ano &gt; 0 || s.ucs.length > 0">
<td colspan="3" class="period">Semestre {{s.semestre}} <button ng-click="changeDocumentCollection(s)" data-toggle="tooltip" title="Mover unidades para aqui" class="btn btn-xs btn-warning" ng-show="checkedDocuments.length"><span class="glyphicon glyphicon-arrow-left"></span></button>
 
<button class="btn btn-success pull-right" ng-click="addUc(s)"><span class="glyphicon glyphicon-plus"></span> UC Manual</button>
</td>
<td><input readonly="true" type="number" ng-model="s.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.alunosInscritos" bound-model="avg('alunosInscritos',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.semElementos" bound-model="avg('semElementos',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.semElementosPercent" bound-model="percent(s.semElementos,s.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="s.reprovados" bound-model="reprovados(s)"></td>
<td><input readonly="true" type="number" ng-model="s.reprovadosPercent" bound-model="percent(s.reprovados,s.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados" bound-model="s.aprovados1013*1 + s.aprovados1416*1 + s.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="s.aprovadosPercent" bound-model="percent(s.aprovados,s.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="s.aprovados1013" bound-model="avg('aprovados1013',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1013Percent" bound-model="percent(s.aprovados1013,s.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1416" bound-model="avg('aprovados1416',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1416Percent" bound-model="percent(s.aprovados1416,s.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1720" bound-model="avg('aprovados1720',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1720Percent" bound-model="percent(s.aprovados1720,s.aprovados)"></td>
</tr>
<tr ng-repeat="u in s.ucs" ng-class="{'alert-danger': u.error}" >
<td><input ng-model="u.error" type="hidden" bound-model="u.alunosInscritos < (u.aprovados*1 + u.semElementos*1)">
<input ng-model="u.checked" ng-click="checkUnit(u,s)" type="checkbox"></td>
<td><input type="text" ng-readonly="!u.manual || u.manual == false" ng-model="u.sigesCode"></td>
<td>
 
<input type="text" style="width: 150px" ng-if="!(!u.manual || u.manual == false)" ng-model="u.name">
<span ng-if="(!u.manual || u.manual == false)">{{u.name}}</span>
<button class="btn btn-danger btn-xs pull-right" ng-if="!(!u.manual || u.manual == false)" ng-click="removeComponent(index,s.ucs)"><span class="glyphicon glyphicon-remove"></span></button>
</td>
<td><input type="number" ng-model="u.cumprimentoProgramaPercent"></td>
<td><input type="number" ng-model="u.alunosInscritos"></td>
<td><input type="number" ng-model="u.semElementos"></td>
<td><input readonly="true" type="number" ng-model="u.semElementosPercent" bound-model="percent(u.semElementos,u.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="u.reprovados" bound-model="reprovados(u)"></td>
<td><input readonly="true" type="number" ng-model="u.reprovadosPercent" bound-model="percent(u.reprovados,u.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados" bound-model="u.aprovados1013*1 + u.aprovados1416*1 + u.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="u.aprovadosPercent" bound-model="percent(u.aprovados,u.alunosInscritos)"></td>
 
<td><input type="number" ng-model="u.aprovados1013"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1013Percent" bound-model="percent(u.aprovados1013,u.aprovados)"></td>
<td><input type="number" ng-model="u.aprovados1416"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1416Percent" bound-model="percent(u.aprovados1416,u.aprovados)"></td>
<td><input type="number" ng-model="u.aprovados1720"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1720Percent" bound-model="percent(u.aprovados1720,u.aprovados)"></td>
</tr>
<tr ng-if="false" ng-repeat-end></tr>
<tr ng-if="false" ng-repeat-end></tr>
<tr class="year">
<td colspan="3">Resultados Globais</td>
 
 
<td><input readonly="true" type="number" ng-model="comp.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.alunosInscritos" bound-model="avg('alunosInscritos',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.semElementos" bound-model="avg('semElementos',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.semElementosPercent" bound-model="percent(comp.semElementos,comp.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="comp.reprovados" bound-model="reprovados(comp)"></td>
<td><input readonly="true" type="number" ng-model="comp.reprovadosPercent" bound-model="percent(comp.reprovados,comp.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados" bound-model="comp.aprovados1013*1 + comp.aprovados1416*1 + comp.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovadosPercent" bound-model="percent(comp.aprovados,comp.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="comp.aprovados1013" bound-model="avg('aprovados1013',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1013Percent" bound-model="percent(comp.aprovados1013,comp.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1416" bound-model="avg('aprovados1416',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1416Percent" bound-model="percent(comp.aprovados1416,comp.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1720" bound-model="avg('aprovados1720',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1720Percent" bound-model="percent(comp.aprovados1720,comp.aprovados)"></td>
</tr>
</tbody>
</table>
<%--<pre class="code">{{ comp | json }}</pre>--%>
</div>
</script>
 
 
 
 
 
 
 
 
 
 
 
 
 
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_GlobalLearningResultsChartImg">
<globallearningresultschartimg>
</globallearningresultschartimg>
</script>
<script>
angular.module("courseReportApp").directive('globallearningresultschartimg', function() {
 
return {
restrict: 'E',
link: function($scope, element, attrs)
{
$scope.generateChart = function(comp)
{
 
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/courseReport.do",
"generateGlobalLearningResultsChartImg",
{
"courseReportDocument" : BacoJS.stringifyOrdered(angular.element($("#courseReportApp")).scope().report)
},
"#courseReportApp",
function(repositoryFile4JsonView)
{
comp.image = repositoryFile4JsonView;
comp.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + comp.image.identifier + "?" + new Date().getTime();
angular.element($("#courseReportApp")).scope().$apply();
},
function(){}
);
}
 
 
},
templateUrl: function(elem,attrs) {
return "globallearningresultschartimg";
}
}
});
</script>
<script type="text/ng-template" id="globallearningresultschartimg">
<div class="imageComponent component">
 
<div class="componentBody">
<div class="form-group clearfix">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<button class="btn btn-default" ng-click="generateChart(comp)">Refrescar/Gerar Gráfico</button>
</div>
<div class="col-md-10">
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img ng-if="comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
<img ng-if="!comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{'<%=request.getContextPath()%>/repositoryStream/' + comp.image.identifier}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
</div>
</div>
</div>
</div>
</script>
/branches/grupo7/impl/src/web/examples/angular/directives/angular-directive.jsp
New file
0,0 → 1,95
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="bacoTags" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="logic" uri="/WEB-INF/tlds/struts-logic.tld" %>
<html>
<head></head>
<body ng-app="BacoAngularApp">
<jsp:include page="/layout/themes/scripts-default.jsp"/>
<jsp:include page="/layout/headerTools.jsp"/>
 
 
<div id="demoApp" ng-app="demoApp" ng-controller="demoAppController">
 
 
<h1>Uso de Directivas com Templates</h1>
<p>Este exemplo mostra como deve ser usada uma template para podermos incluir uma função
de controlo especifica da template usando directivas</p>
<p>Mostra ainda que dentro da template o scope é uma fusão dos scopes da ngApp e da propria directiva</p>
<p>Mostra também como podemos escolher dinamicamente a template ou as funcionalidades dependendo de atributos que passamos à template</p>
<script>
 
var demoApp = angular.module('demoApp', []);
GLOBAL_BacoAngularAppDependencies.push('demoApp');
 
 
//demoApp..directive('tpl', function() {
//ou
angular.module('demoApp').directive('tpl', function() {
 
return {
restrict: 'E', //A ou E define se é o nome do elemento ou um atributo
link: function(scope, element, attrs) {
// concatenating the directory to the ver attr to select the correct excerpt for the day
 
 
 
scope.teste = "teste";
scope.move = function(){
 
scope.teste = "teste2";
scope.testeSuper = "testeSuper2";
}
},
// passing in contentUrl variable
templateUrl: function(elem,attrs) {
return attrs.templatename;
}
}
});
 
 
demoApp.controller('demoAppController', function ($scope) {
 
 
$scope.testeSuper = "testeSuper";
 
}
);
 
</script>
 
<p>campo testeSuper no mainmodule {{testeSuper}}</p>
 
<p>Se incluirmos o tpl2.html apenas vamos ter acesso às variaveis do scope da aplicação, neste caso o teste, a template pode estar declarada fora da app, não há problema</p>
<p>Por acaso neste exemplo temos acesso ao testeSuper porque a directiva adiciona funcionalidade ao scope da aplicação onde é chamada, mas se não chamarmos nenhuma directiva
a var testeSuper não aparece</p>
<div ng-include="'tpl2.html'"></div>
 
 
<h2>Invocando a tpl de html com directiva</h2>
<tpl templatename="tpl.html"></tpl>
 
<h2>Invocando a tpl de de javascript com directiva</h2>
<tpl templatename="tpl2.html"></tpl>
 
 
 
 
 
 
</div>
 
 
 
<!--TEMPLATE RECURSIVO-->
<script type="text/ng-template" id="tpl2.html">
<div>
<h1>Usando um template de Script</h1>
<p>TESTE</p>
<p>{{teste}}</p>
<p>{{testeSuper}}</p>
<button ng-click="move()">Muda Textos</button>
</div>
</script>
</body>
</html>
/branches/grupo7/impl/src/web/examples/angular/directives/tpl.html
New file
0,0 → 1,5
<h1>Template de HTML</h1>
<p>TESTE</p>
<p>{{teste}}</p>
<p>{{testeSuper}}</p>
<button ng-click="move()">Muda Textos</button>
/branches/grupo7/impl/src/web/examples/angular/directives/angular-directive-module.jsp
New file
0,0 → 1,36
<%--
Created by IntelliJ IDEA.
User: jorgemachado
Date: 11/11/17
Time: 10:20
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title></title>
</head>
<body ng-app="BacoAngularApp">
<jsp:include page="/layout/themes/scripts-default.jsp"/>
<jsp:include page="/layout/headerTools.jsp"/>
 
<div class="container">
<h1>Uso de Templates Generalizados e cada um com sua template</h1>
<p>O caso em questão é a existencia de um esqueleto principal para um modulo (mainmodule)</p>
<p>O main module inclui templates para cada componente usando o ng-include</p>
<p>Esse ng-include é referente ao campo @class de cada componente</p>
<p>vamos incluir esse esqueleto e todas as templates especificas dos nossos modulos</p>
<p>incluimos ainda as directivas que estiverem nos nossos modulos</p>
<p>o template do ng-include irá colocar a directiva desejada caso seja necessário</p>
<p>com a directiva podemos ter funcionalidade de scope associada ao subcomponente, que é desconhecido do main module</p>
<p>caso necessite o includemodule também tem acesso ao scope da app principal</p>
<p>o unico requesito é passar ao include module o nome da app onde ele vai inserir as directivas</p>
 
 
 
<jsp:include page="angular-directive-mainmodule.jsp"/>
<jsp:include page="angular-directive-includemodule.jsp"/>
 
</div>
</body>
</html>
/branches/grupo7/impl/src/web/examples/angular/directives/angular-directive-includemodule.jsp
New file
0,0 → 1,60
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
 
<p>Modulo Incluido contem as directivas e os templates necessários</p>
<p>Este módulo conhece o nome do módulo da App onde vai ser incluido</p>
 
<script>
angular.module("demoApp").directive('tpl', function() {
var contentUrl;
return {
restrict: 'E', //A ou E define se é o nome do elemento ou um atributo
link: function(scope, element, attrs) {
// concatenating the directory to the ver attr to select the correct excerpt for the day
//contentUrl = attrs.templatename + '.html';
 
//console.log(contentUrl);
 
scope.teste = "teste";
scope.move = function(){
 
scope.teste = "teste2modules";
//scope.testeSuper = "testeSuper2modules";
angular.element("#demoApp").scope().testeSuper = "testeSuper2modules";
}
scope.mudaCompName = function(comp){
 
comp.name = "NOVO NOME DO COMP MUDADO NA DIRECTIVA";
}
},
// passing in contentUrl variable
templateUrl: function(elem,attrs) {
return "templateDirectiva";
}
}
});
</script>
 
<script type="text/ng-template" id="directive_class">
<div style="border: 1px solid #000000">
<h1>DIRECTIVE CLASS TEMPLATE</h1>
<p>COMP ELEMENTO DIRECTIVA:{{comp.name}}</p>
<p><input type="text" ng-model="comp.name"></p>
<tpl></tpl>
<p>Teste no scope da directiva<p>
<pre>
{{teste | json}}
</pre>
</div>
</script>
 
<script type="text/ng-template" id="templateDirectiva">
<div style="border: 1px solid green">
<h1>templateDirectiva</h1>
<p>TESTE</p>
<p>{{teste}}</p>
<p>{{testeSuper}}</p>
<p>COMP ELEMENTO DIRECTIVA:{{comp.name}}</p>
<button ng-click="move()">Muda Textos</button>
<button ng-click="mudaCompName(comp)">Muda COMP NAME</button>
</div>
</script>
/branches/grupo7/impl/src/web/examples/angular/directives/angular-directive-mainmodule.jsp
New file
0,0 → 1,50
 
 
<div id="demoApp" ng-app="demoApp" ng-controller="demoAppController">
 
 
 
<script>
 
var demoApp = angular.module('demoApp', []);
GLOBAL_BacoAngularAppDependencies.push('demoApp');
 
 
demoApp.controller('demoAppController', function ($scope) {
 
$scope.testeSuper = "testeSuper";
 
$scope.data =
{
comps : [
{
"@class" : "directive_class",
"name" : "componente de teste"
}
]
}
 
}
);
 
</script>
 
 
<h1>Campo testeSuper no mainmodule "{{testeSuper}}"</h1>
<h1>Campo data.comps[0].name no mainmodule "{{data.comps[0].name}}"</h1>
 
<h2>Template chamado atraves de um template de classe intermedio</h2>
<div ng-repeat="comp in data.comps" ng-include="comp['@class']">
 
</div>
 
 
<pre>
{{testeSuper | json}}
</pre>
<pre>
{{data | json}}
</pre>
 
 
</div>
/branches/grupo7/impl/src/web/user/courses/coursereport/templates.jsp
New file
0,0 → 1,694
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultYear" %>
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultSemester" %>
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultUc" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
 
<!--
@section objeto com seccoes e componentes
@optional @chapter capitulo do documento para esta seccao para contcatenar às subsections
-->
 
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_CourseUnitsReportsSection">
<div class="sections">
<a name="indexCus"></a>
<span ng-repeat="cu in section.sections" ng-init="cu.taxaAprovacao = 100 * cu.courseUnitEvaluation.numAlunosAprovTotal/(cu.courseUnitEvaluation.numAlunosInscritos - cu.courseUnitEvaluation.numAlunosSemElementosAvaliacao)">
<a href="#cu{{$index}}" ng-class="{ 'alert-danger': (cu.courseUnitEvaluation.cumprimentoProgramaPercent &lt; 100) || cu.taxaAprovacao &lt; 75 || !cu.courseUnitEvaluation.closed || !cu.courseUnitEvaluation.teacherComplete}">
{{cu.title}}
</a> |
</span>
<div ng-repeat="cu in section.sections"
class="section panel-primary">
 
<a name="cu{{$index}}"></a>
<span ng-if="$index != 0" class="glyphicon glyphicon-backward" ></span><a ng-if="$index != 0" href="#indexCus"> Voltar atrás</a>
<div class="panel-heading"><h2>{{cu.title}}</h2></div>
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Estado do Relatório</label></h3></div>
 
<div ng-if="cu.courseUnitEvaluation.closed">
Entregue e Aceite
</div>
<div class="alert-danger" ng-if="cu.courseUnitEvaluation.closed && !cu.courseUnitEvaluation.teacherComplete">
Entregue mas não foi aprovado pela comissão
</div>
<div class="alert-danger" ng-if="!cu.courseUnitEvaluation.closed && !cu.courseUnitEvaluation.teacherComplete">
Não foi entregue pelo docente para validação
</div>
 
</div>
 
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Resultados</label></h3></div>
<div>
<table class="tablesorter-blue" width="100%">
<tr>
<th rowspan="2">
Nº Alunos Inscritos
</th>
<th rowspan="2">
Nº de alunos sem elementos de avaliação
</th>
<th colspan="5">
Nº de alunos aprovados em
</th>
<th colspan="2">
Aprovados com a classificação entre 10 e 13 valores
</th>
<th colspan="2">
Aprovados com a classificação entre 14 e 16 valores
</th>
<th colspan="2">
Aprovados com a classificação entre 17 e 20 valores
</th>
</tr>
<tr>
<th>Avaliação de frequência</th>
<th>Exame Época Normal</th>
<th>Exame Época Recurso</th>
<th>Exame Época Especial</th>
<th>Total</th>
<th>Nº</th>
<th>%</th>
<th>Nº</th>
<th>%</th>
<th>Nº</th>
<th>%</th>
</tr>
<tr>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosInscritos}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosSemElementosAvaliacao}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovFrequencia}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovNormal}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovRecurso}}
</td>
<td style="text-align: center">
{{cu.courseUnitEvaluation.numAlunosAprovEspecial}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovTotal}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1013}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1013Percent}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1416}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1416Percent}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1720}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1720Percent}}
</td>
</tr>
</table>
</div>
</div>
 
<div style="padding-left:20px" >
<div><h3><label class="label label-primary">Taxa de Aprovação</label></h3></div>
<div ng-class="{ 'alert-danger': cu.taxaAprovacao &lt; 75 }">{{cu.taxaAprovacao}}%</div>
</div>
 
 
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação dos resultados quantitativos obtidos pelos estudantes</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoQuantitivos}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação do funcionamento da UC</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoUC}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Percentagem de cumprimento do programa da UC</label></h3></div>
<div ng-class="{ 'alert-danger': (cu.courseUnitEvaluation.cumprimentoProgramaPercent &lt; 100) }">
{{cu.courseUnitEvaluation.cumprimentoProgramaPercent}}%
</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação do cumprimento do programa da UC</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoCumprimentoPrograma}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Conclusões</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualConclusoes}}</div>
</div>
</div>
</div>
</script>
 
 
 
<style>
.dtpstats td, .dtpstats th{
text-align: center !important;
}
</style>
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_reportucsummary_UnitsDtpTable">
<div class="sections">
 
<table class="table dtpstats">
<thead>
<tr>
<th rowspan="2">Unidade Curricular</th>
<th colspan="2">Planeamento</th>
<th rowspan="2">Ficha Curricular</th>
<th rowspan="2">Sumários</th>
<th colspan="2">Avaliação</th>
<th rowspan="2">Relatório de Avaliação</th>
<th rowspan="2">Inquerito Pedagógico</th>
</tr>
<tr>
<th>Conteúdos</th>
<th>Calendarização</th>
<th>Enunciados</th>
<th>Pautas</th>
</tr>
</thead>
<tbody>
<tr>
<th colspan="9">Semestre 1</th>
</tr>
<tr ng-repeat="dtpStat in comp.semester1.courseUnitDtpStats">
<td>{{dtpStat.name}}</td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoConteudos }"><input type="checkbox" ng-model="dtpStat.planeamentoConteudos"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoCalendarizacao }"><input type="checkbox" ng-model="dtpStat.planeamentoCalendarizacao"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.ficha }"><input type="checkbox" ng-model="dtpStat.ficha"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.sumarios }"><input type="checkbox" ng-model="dtpStat.sumarios"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoEnunciados }"><input type="checkbox" ng-model="dtpStat.avaliacaoEnunciados"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoPautas }"><input type="checkbox" ng-model="dtpStat.avaliacaoPautas"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.relatorio }"><input type="checkbox" ng-model="dtpStat.relatorio"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.inquerito }"><input type="checkbox" ng-model="dtpStat.inquerito"/></td>
</tr>
<tr>
<th colspan="9">Semestre 2</th>
</tr>
<tr ng-repeat="dtpStat in comp.semester2.courseUnitDtpStats">
<td>{{dtpStat.name}}</td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoConteudos }"><input type="checkbox" ng-model="dtpStat.planeamentoConteudos"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoCalendarizacao }"><input type="checkbox" ng-model="dtpStat.planeamentoCalendarizacao"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.ficha }"><input type="checkbox" ng-model="dtpStat.ficha"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.sumarios }"><input type="checkbox" ng-model="dtpStat.sumarios"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoEnunciados }"><input type="checkbox" ng-model="dtpStat.avaliacaoEnunciados"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoPautas }"><input type="checkbox" ng-model="dtpStat.avaliacaoPautas"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.relatorio }"><input type="checkbox" ng-model="dtpStat.relatorio"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.inquerito }"><input type="checkbox" ng-model="dtpStat.inquerito"/></td>
</tr>
</tbody>
</table>
</div>
</script>
 
 
 
<style>
.learning td
{
font-size: 0.7em;
}
.learning td input{
width: 50px;
}
 
.learning td input:read-only{
width: 50px;
background-color: #cccccc;
}
.learning tr.year td {
vertical-align: top;
background-color: #aaaaaa;
 
font-weight: bold;
}
.learning tr.period td {
vertical-align: top;
background-color: #dfdfdf;
 
}
</style>
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_UnitsLearningResultsTable">
<unitslearningresultstable>
</unitslearningresultstable>
</script>
 
 
 
<script>
angular.module("courseReportApp").directive('boundModel', function() {
return {
require: 'ngModel',
link: function(scope, elem, attrs, ngModel) {
scope.$watch(attrs.boundModel, function(newValue, oldValue) {
if(newValue != oldValue) {
ngModel.$setViewValue(newValue);
ngModel.$render();
}
});
}
}
});
angular.module("courseReportApp").directive('unitslearningresultstable', function() {
 
return {
restrict: 'E',
link: function($scope, element, attrs)
{
 
$scope.checkedDocuments = [];
$scope.checkUnit = function(document,collection)
{
if(document.checked)
{
var docContainer =
{
"document" : document,
"collection" : collection
}
$scope.checkedDocuments.push(docContainer);
}
else
{
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
if(documentContainer.document == document)
{
var index = $scope.checkedDocuments.indexOf(documentContainer);
$scope.checkedDocuments.splice(index, 1);
}
});
}
}
$scope.changeDocumentCollection = function(collection)
{
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
collection.ucs.push(documentContainer.document);
delete documentContainer.document.checked;
});
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
var index = documentContainer.collection.ucs.indexOf(documentContainer.document);
documentContainer.collection.ucs.splice(index, 1);
});
$scope.checkedDocuments = [];
}
$scope.avg = function(field,container, childs)
{
if(!childs || childs.length == 0)
return 0;
var sum = 0;
var c;
for(c in childs)
{
if(childs[c] && childs[c][field])
sum += 1*childs[c][field];
}
container[field] = sum / childs.length;
return container[field];
}
$scope.percent = function(n,total)
{
if(!n || n == 0 || !total || total == 0)
return 0;
return 100 * n / total;
}
$scope.reprovados = function(comp)
{
if(comp.alunosInscritos && comp.semElementos && comp.aprovados)
return comp.alunosInscritos - comp.semElementos - comp.aprovados;
return 0;
}
$scope.removeComponent = function(index,list)
{
list.splice(index,1);
}
$scope.hasYearUnits = function(year)
{
for(s in year.semesters)
{
if(year.semesters[s].ucs && year.semesters[s].ucs.length > 0)
return true;
}
return false;
}
$scope.isInvalidAnfHaveUcs = function(year,years,index)
{
if(year.ano > 0)
return false;
 
var s;
for(s in year.semesters)
{
if(year.semesters[s].ucs && year.semesters[s].ucs.length > 0)
return true;
}
years.splice(index,1);
return false;
}
$scope.addUc = function(semestre)
{
semestre.ucs.push(
{
"@class" : "<%=UnitsLearningResultUc.class.getName()%>",
manual : true,
periodo : semestre.semestre,
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
sigesCode : 0
}
);
}
$scope.addAno = function(comp)
{
if(!comp.years)
comp.years = [];
comp.years.push(
{
ano : 1,
"@class" : "<%=UnitsLearningResultYear.class.getName()%>",
manual : true,
"alunosInscritos": 0,
"aprovados": 0,
"aprovados1013": 0,
"aprovados1013Percent": 0,
"aprovados1416": 0,
"aprovados1416Percent": 0,
"aprovados1720": 0,
"aprovados1720Percent": 0,
"aprovadosPercent": 0,
"cumprimentoProgramaPercent": 0,
"reprovados": 0,
"reprovadosPercent": 0,
"semElementos": 0,
"semElementosPercent": 0,
semesters : [
{
"@class" : "<%=UnitsLearningResultSemester.class.getName()%>",
manual : true,
semestre : "S1",
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
ucs : []
},
{
"@class" : "<%=UnitsLearningResultSemester.class.getName()%>",
manual : true,
semestre: "S2",
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
ucs : []
}
]
}
);
}
 
},
templateUrl: function(elem,attrs) {
return "unitslearningresultstable";
}
}
});
</script>
<script type="text/ng-template" id="unitslearningresultstable">
 
 
<div class="sections">
<button class="btn btn-success" ng-click="addAno(comp)"><span class="glyphicon glyphicon-plus"></span> Ano Manual</button>
<table class="table learning">
<thead>
<tr>
<th rowspan="2">Mover</th>
<th rowspan="2">Código</th>
<th rowspan="2">Unidade Curricular</th>
<th rowspan="2">Cumprimento do Programa</th>
<th rowspan="2">Alunos Inscritos</th>
<th colspan="2">Sem Elementos</th>
<th colspan="2">Reprovados</th>
<th colspan="2">Aprovados</th>
<th colspan="2">Aprovados 10-13</th>
<th colspan="2">Aprovados 14-16</th>
<th colspan="2">Aprovados 17-20</th>
</tr>
<tr>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
</tr>
</thead>
<tbody>
<tr colspan="17" ng-if="false" ng-repeat-start="year in comp.years"></tr>
<tr class="year">
<td colspan="3" ng-if="year.ano &gt; 0">
 
<button ng-disabled="hasYearUnits(year)" class="btn btn-danger btn-xs" ng-click="removeComponent($index,comp.years)"><span class="glyphicon glyphicon-remove"></span></button>
<span ng-if="!year.manual">{{year.ano}}ª ano</span>
<span ng-if="year.manual">
<select ng-model="year.ano" ng-options="c.v as c.n for c in [{v:1,n:'1º Ano'},{v:2,n:'2º Ano'},{v:3,n:'3º Ano'},{v:4,n:'4º Ano'},{v:5,n:'5º Ano'}]">
</select>
</span>
 
</td>
<td colspan="3" style="font-size: 1.0em !important" ng-if="isInvalidAnfHaveUcs(year,comp.years,$index)">
Unidades que não constam do plano (Verifique a situação com os serviços Académicos antes de continuar)
poderão constar de um plano antigo ou ter o código siges desatualizado.
</td>
<td><input readonly="true" type="number" ng-model="year.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.alunosInscritos" bound-model="avg('alunosInscritos',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.semElementos" bound-model="avg('semElementos',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.semElementosPercent" bound-model="percent(year.semElementos,year.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="year.reprovados" bound-model="reprovados(year)"></td>
<td><input readonly="true" type="number" ng-model="year.reprovadosPercent" bound-model="percent(year.reprovados,year.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados" bound-model="year.aprovados1013*1 + year.aprovados1416*1 + year.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="year.aprovadosPercent" bound-model="percent(year.aprovados,year.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="year.aprovados1013" bound-model="avg('aprovados1013',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1013Percent" bound-model="percent(year.aprovados1013,year.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1416" bound-model="avg('aprovados1416',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1416Percent" bound-model="percent(year.aprovados1416,year.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1720" bound-model="avg('aprovados1720',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1720Percent" bound-model="percent(year.aprovados1720,year.aprovados)"></td>
</tr>
 
<tr ng-if="false" ng-repeat-start="s in year.semesters" ></tr>
<tr class="period" ng-if="year.ano &gt; 0 || s.ucs.length > 0">
<td colspan="3" class="period">Semestre {{s.semestre}} <button ng-click="changeDocumentCollection(s)" data-toggle="tooltip" title="Mover unidades para aqui" class="btn btn-xs btn-warning" ng-show="checkedDocuments.length"><span class="glyphicon glyphicon-arrow-left"></span></button>
 
<button class="btn btn-success pull-right" ng-click="addUc(s)"><span class="glyphicon glyphicon-plus"></span> UC Manual</button>
</td>
<td><input readonly="true" type="number" ng-model="s.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.alunosInscritos" bound-model="avg('alunosInscritos',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.semElementos" bound-model="avg('semElementos',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.semElementosPercent" bound-model="percent(s.semElementos,s.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="s.reprovados" bound-model="reprovados(s)"></td>
<td><input readonly="true" type="number" ng-model="s.reprovadosPercent" bound-model="percent(s.reprovados,s.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados" bound-model="s.aprovados1013*1 + s.aprovados1416*1 + s.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="s.aprovadosPercent" bound-model="percent(s.aprovados,s.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="s.aprovados1013" bound-model="avg('aprovados1013',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1013Percent" bound-model="percent(s.aprovados1013,s.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1416" bound-model="avg('aprovados1416',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1416Percent" bound-model="percent(s.aprovados1416,s.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1720" bound-model="avg('aprovados1720',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1720Percent" bound-model="percent(s.aprovados1720,s.aprovados)"></td>
</tr>
<tr ng-repeat="u in s.ucs" ng-class="{'alert-danger': u.error}" >
<td><input ng-model="u.error" type="hidden" bound-model="u.alunosInscritos < (u.aprovados*1 + u.semElementos*1)">
<input ng-model="u.checked" ng-click="checkUnit(u,s)" type="checkbox"></td>
<td><input type="text" ng-readonly="!u.manual || u.manual == false" ng-model="u.sigesCode"></td>
<td>
 
<input type="text" style="width: 150px" ng-if="!(!u.manual || u.manual == false)" ng-model="u.name">
<span ng-if="(!u.manual || u.manual == false)">{{u.name}}</span>
<button class="btn btn-danger btn-xs pull-right" ng-if="!(!u.manual || u.manual == false)" ng-click="removeComponent(index,s.ucs)"><span class="glyphicon glyphicon-remove"></span></button>
</td>
<td><input type="number" ng-model="u.cumprimentoProgramaPercent"></td>
<td><input type="number" ng-model="u.alunosInscritos"></td>
<td><input type="number" ng-model="u.semElementos"></td>
<td><input readonly="true" type="number" ng-model="u.semElementosPercent" bound-model="percent(u.semElementos,u.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="u.reprovados" bound-model="reprovados(u)"></td>
<td><input readonly="true" type="number" ng-model="u.reprovadosPercent" bound-model="percent(u.reprovados,u.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados" bound-model="u.aprovados1013*1 + u.aprovados1416*1 + u.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="u.aprovadosPercent" bound-model="percent(u.aprovados,u.alunosInscritos)"></td>
 
<td><input type="number" ng-model="u.aprovados1013"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1013Percent" bound-model="percent(u.aprovados1013,u.aprovados)"></td>
<td><input type="number" ng-model="u.aprovados1416"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1416Percent" bound-model="percent(u.aprovados1416,u.aprovados)"></td>
<td><input type="number" ng-model="u.aprovados1720"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1720Percent" bound-model="percent(u.aprovados1720,u.aprovados)"></td>
</tr>
<tr ng-if="false" ng-repeat-end></tr>
<tr ng-if="false" ng-repeat-end></tr>
<tr class="year">
<td colspan="3">Resultados Globais</td>
 
 
<td><input readonly="true" type="number" ng-model="comp.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.alunosInscritos" bound-model="avg('alunosInscritos',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.semElementos" bound-model="avg('semElementos',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.semElementosPercent" bound-model="percent(comp.semElementos,comp.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="comp.reprovados" bound-model="reprovados(comp)"></td>
<td><input readonly="true" type="number" ng-model="comp.reprovadosPercent" bound-model="percent(comp.reprovados,comp.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados" bound-model="comp.aprovados1013*1 + comp.aprovados1416*1 + comp.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovadosPercent" bound-model="percent(comp.aprovados,comp.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="comp.aprovados1013" bound-model="avg('aprovados1013',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1013Percent" bound-model="percent(comp.aprovados1013,comp.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1416" bound-model="avg('aprovados1416',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1416Percent" bound-model="percent(comp.aprovados1416,comp.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1720" bound-model="avg('aprovados1720',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1720Percent" bound-model="percent(comp.aprovados1720,comp.aprovados)"></td>
</tr>
</tbody>
</table>
<%--<pre class="code">{{ comp | json }}</pre>--%>
</div>
</script>
 
 
 
 
 
 
 
 
 
 
 
 
 
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_GlobalLearningResultsChartImg">
<globallearningresultschartimg>
</globallearningresultschartimg>
</script>
<script>
angular.module("courseReportApp").directive('globallearningresultschartimg', function() {
 
return {
restrict: 'E',
link: function($scope, element, attrs)
{
$scope.generateChart = function(comp)
{
 
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/courseReport.do",
"generateGlobalLearningResultsChartImg",
{
"courseReportDocument" : BacoJS.stringifyOrdered(angular.element($("#courseReportApp")).scope().report)
},
"#courseReportApp",
function(repositoryFile4JsonView)
{
comp.image = repositoryFile4JsonView;
comp.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + comp.image.identifier + "?" + new Date().getTime();
angular.element($("#courseReportApp")).scope().$apply();
},
function(){}
);
}
 
 
},
templateUrl: function(elem,attrs) {
return "globallearningresultschartimg";
}
}
});
</script>
<script type="text/ng-template" id="globallearningresultschartimg">
<div class="imageComponent component">
 
<div class="componentBody">
<div class="form-group clearfix">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<button class="btn btn-default" ng-click="generateChart(comp)">Refrescar/Gerar Gráfico</button>
</div>
<div class="col-md-10">
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img ng-if="comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
<img ng-if="!comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{'<%=request.getContextPath()%>/repositoryStream/' + comp.image.identifier}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
</div>
</div>
</div>
</div>
</script>
/branches/grupo1/impl/conf/WEB-INF/struts/struts-courses.xml
37,7 → 37,7
 
 
 
 
<action path="/courseController"
type="pt.estgp.estgweb.web.controllers.courses.CoursesController"
name="CourseForm"
166,6 → 166,14
<action path="/user/loadCourseReportTools" forward="page.course.report.tools.load"/>
<action path="/user/editCourseReport" forward="page.course.report.edit"/>
 
<action path="/user/courseReport"
type="pt.estgp.estgweb.web.controllers.courses.CoursesServicesController"
name="WidgetModelForm"
scope="request"
parameter="dispatch"
validate="true"
input="page.widget.json.fail.validations">
</action>
 
 
 
/branches/grupo1/impl/conf/berserk/sd.xml
832,7 → 832,7
<chain name="OwnersEdit"/>
</filterChains>
</service>
 
<service>
<name>LoadUserById</name>
<implementationClass>pt.estgp.estgweb.services.profile.LoadUserByIdService</implementationClass>
996,18 → 996,18
</filterChains>
</service>
 
<!--<service>
<name>DeleteCourseUnit</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.UpdateCourseUnitService</implementationClass>
<description>Update course unit objectives and program file</description>
<isTransactional>true</isTransactional>
<defaultMethod>delete</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Supers"/>
</filterChains>
</service>-->
<!--<service>
<name>DeleteCourseUnit</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.UpdateCourseUnitService</implementationClass>
<description>Update course unit objectives and program file</description>
<isTransactional>true</isTransactional>
<defaultMethod>delete</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="Supers"/>
</filterChains>
</service>-->
<service>
<name>LoadCourseUnit</name>
<implementationClass>pt.estgp.estgweb.services.courseunits.LoadCourseUnitService</implementationClass>
1079,9 → 1079,9
<service>
<name>SaveCourseUnitProgram</name>
<!--Args
ourseUnitProgramView programView,
long unitId used in filters
-->
ourseUnitProgramView programView,
long unitId used in filters
-->
<implementationClass>pt.estgp.estgweb.services.courseunits.SaveCourseUnitProgram</implementationClass>
<description>Save course unit program</description>
<isTransactional>true</isTransactional>
1123,9 → 1123,9
<service>
<name>SaveCourseUnitEvaluation</name>
<!--Args
CourseUnitEvaluationView evaluationView,
long unitId used in filters
-->
CourseUnitEvaluationView evaluationView,
long unitId used in filters
-->
<implementationClass>pt.estgp.estgweb.services.courseunits.SaveCourseUnitEvaluation</implementationClass>
<description>Save course unit evaluation</description>
<isTransactional>true</isTransactional>
1157,8 → 1157,8
<service>
<name>InitCourseUnitEvaluationClearances</name>
<!--Parameters
CourseUnitView cuv, Long courseUnitId
-->
CourseUnitView cuv, Long courseUnitId
-->
<implementationClass>pt.estgp.estgweb.services.courseunits.SaveCourseUnitEvaluation</implementationClass>
<description>Open course unit evaluation for edition</description>
<isTransactional>true</isTransactional>
1509,9 → 1509,9
</filterChains>
</service>
 
 
 
 
<!--CourseUnitAssignements Backups-->
<service>
<name>CreateCourseUnitDirPackage</name>
1592,11 → 1592,11
<chain name="Session"/>
</filterChains>
</service>
 
 
 
 
 
<!--COURSES-->
<service>
<name>LoadCourseByCode</name>
1855,7 → 1855,7
<chain name="Logger"/>
</filterChains>
</service>
<service>
<service>
<name>LoadCoursesImportYearByType</name>
<implementationClass>pt.estgp.estgweb.services.courses.CoursesService</implementationClass>
<description>Load All Courses</description>
2367,7 → 2367,7
</filterChains>
</service>
<service>
<name>GenerateSurveyStatsCsv</name>
<name>GenerateSurveyStatsCsv</name>
<implementationClass>pt.estgp.estgweb.services.surveys.GenerateSurveyStatsCsvService</implementationClass>
<description>Generate all survey stats on a csv file</description>
<isTransactional>true</isTransactional>
2403,7 → 2403,7
 
 
 
<!--Filipe Matos-->
<!--Filipe Matos-->
<!--Assessments-->
<service>
<name>CreateEditAssessment</name>
2920,18 → 2920,18
</service>
 
<!--
<service>
<name>AddUpdateDirtyRolesTranslation</name>
<implementationClass>pt.estgp.estgweb.services.users.UserRoleConfigService</implementationClass>
<description></description>
<isTransactional>true</isTransactional>
<defaultMethod>addUpdateDirtRolesTranslation</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="RoleAddRemoveManager"/>
</filterChains>
</service>-->
<service>
<name>AddUpdateDirtyRolesTranslation</name>
<implementationClass>pt.estgp.estgweb.services.users.UserRoleConfigService</implementationClass>
<description></description>
<isTransactional>true</isTransactional>
<defaultMethod>addUpdateDirtRolesTranslation</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
<chain name="RoleAddRemoveManager"/>
</filterChains>
</service>-->
 
<service>
<name>AddUpdateRoleTranslation</name>
3901,8 → 3901,8
 
 
<!--/****************************************************************************/
/* COURSE REPORTS
/****************************************************************************/-->
/* COURSE REPORTS
/****************************************************************************/-->
 
 
 
3944,16 → 3944,16
</service>
 
<!--
PRECISO DE UM IMPORTAR NOVAMENTE TABELA DE RESULTADOS DE APRENDIZAGEM
Ha de ser um subservico do de cima que tem usar
o servico LoadCourseEvaluationSections novamente
PRECISO DE UM IMPORTAR NOVAMENTE TABELA DE RESULTADOS DE APRENDIZAGEM
Ha de ser um subservico do de cima que tem usar
o servico LoadCourseEvaluationSections novamente
 
PRECISO DE UM SERVICO PARA GERAR OS GRAFICOS DE APRENDIZAGEM
-->
PRECISO DE UM SERVICO PARA GERAR OS GRAFICOS DE APRENDIZAGEM
-->
 
<!--/****************************************************************************/
/* SERVICOS WS-API TODO Seguranca em falta
/****************************************************************************/-->
/* SERVICOS WS-API TODO Seguranca em falta
/****************************************************************************/-->
 
<service>
<name>LoadCourseEvaluationSections</name>
4008,7 → 4008,6
</filterChains>
</service>
 
 
<service>
<name>LoadPlanYearForCourseUnitCode</name>
<implementationClass>pt.estgp.estgweb.services.courses.CourseReportServices</implementationClass>
4025,10 → 4024,8
</filterChains>
</service>
 
 
<!-- SERVICOS DE GERACAO DE RELATORIO DE CURSO -->
 
 
<service>
<name>CourseReportGenerateGlobalLearningResultsChartImg</name>
<implementationClass>pt.estgp.estgweb.services.courses.CourseReportServices</implementationClass>
4047,6 → 4044,22
</filterChains>
</service>
 
<service>
<name>CourseReportGenerateGlobalLearningResultsChartYearImg</name>
<implementationClass>pt.estgp.estgweb.services.courses.CourseReportServices</implementationClass>
<description>
@reportCourseDocument documento course report em json
Serviço de suporte para gerar um grafico
Coloca o grafico no report documento
e salva o documento no curso
Devolve uma classe RepositoryFile4JsonView serializada em JSON
</description>
<isTransactional>true</isTransactional>
<defaultMethod>generateGenerateGlobalLearningResultsChartYearImg</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
</filterChains>
</service>
 
 
</serviceDefinitions>
/branches/grupo1/impl/src/java/pt/estgp/estgweb/services/courses/CourseReportServices.java
448,11 → 448,41
return view.toJson();
}
 
public String generateGenerateGlobalLearningResultsChartYearImg(String reportDocumentJson,UserSession session) throws IOException {
 
CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson);
LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class);
LearningGlobalAnalysisSection learningGlobalAnalysisSection = (LearningGlobalAnalysisSection) learningResultsSection.findSection(LearningGlobalAnalysisSection.class);
GlobalLearningResultsChartImg chartImg = (GlobalLearningResultsChartImg) learningGlobalAnalysisSection.findDocComponent(GlobalLearningResultsChartImg.class);
 
UnitsLearningResultsTable table = (UnitsLearningResultsTable) learningResultsSection.findDocComponent(UnitsLearningResultsTable.class);
 
 
FileUploaded fileUploaded = chartImg.generateChart2tmp(table,reportDocument);
 
RepositoryService repositoryService = new RepositoryService();
 
boolean imageInitialized = chartImg.getImage() != null
&&
chartImg.getImage().getIdentifier() != null;
 
RepositoryFile4JsonView view;
if(imageInitialized)
{
String identifier = chartImg.getImage().getIdentifier();
view = repositoryService.replaceRepositoryFileFromFileUpload(identifier, fileUploaded, ResourceAccessControlEnum.privateDomain, session);
}
else
{
view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.privateDomain,session);
}
chartImg.setImage(view);
//TODO FALTA GUARDAR O JSON NO CURSO
return view.toJson();
}
 
 
 
/****************************************************************************/
/*
 
/branches/grupo1/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesServicesController.java
New file
0,0 → 1,55
package pt.estgp.estgweb.web.controllers.courses;
 
import org.apache.struts.action.ActionForm;
import org.json.JSONObject;
import pt.estgp.estgweb.web.controllers.utils.AbstractWidgetAjaxController;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
/**
* Created by jorgemachado on 06/01/17.
*/
public class CoursesServicesController extends AbstractWidgetAjaxController
{
 
 
/**
* See also CoursesServicesWidgetController for WS-API services
*/
 
/**
*
* @param form
* @param request
* @param response
* @return
* @throws Throwable
*/
 
public JSONObject generateGlobalLearningResultsChartImg(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Throwable {
 
String courseReportDocument = request.getParameter("courseReportDocument");
 
 
IServiceManager sm = ServiceManager.getInstance();
String json = (String) sm.execute(RequestUtils.getRequester(request, response),
"CourseReportGenerateGlobalLearningResultsChartImg",
new Object[]{courseReportDocument});
return new JSONObject(json);
}
 
public JSONObject generateGlobalLearningResultsChartYearImg(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Throwable {
String courseReportDocument = request.getParameter("courseReportDocument");
 
 
IServiceManager sm = ServiceManager.getInstance();
String json = (String) sm.execute(RequestUtils.getRequester(request, response),
"CourseReportGenerateGlobalLearningResultsChartYearImg",
new Object[]{courseReportDocument});
return new JSONObject(json);
}
}
/branches/grupo1/impl/src/web/examples/angular/directives/angular-directive.jsp
New file
0,0 → 1,95
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="bacoTags" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="logic" uri="/WEB-INF/tlds/struts-logic.tld" %>
<html>
<head></head>
<body ng-app="BacoAngularApp">
<jsp:include page="/layout/themes/scripts-default.jsp"/>
<jsp:include page="/layout/headerTools.jsp"/>
 
 
<div id="demoApp" ng-app="demoApp" ng-controller="demoAppController">
 
 
<h1>Uso de Directivas com Templates</h1>
<p>Este exemplo mostra como deve ser usada uma template para podermos incluir uma função
de controlo especifica da template usando directivas</p>
<p>Mostra ainda que dentro da template o scope é uma fusão dos scopes da ngApp e da propria directiva</p>
<p>Mostra também como podemos escolher dinamicamente a template ou as funcionalidades dependendo de atributos que passamos à template</p>
<script>
 
var demoApp = angular.module('demoApp', []);
GLOBAL_BacoAngularAppDependencies.push('demoApp');
 
 
//demoApp..directive('tpl', function() {
//ou
angular.module('demoApp').directive('tpl', function() {
 
return {
restrict: 'E', //A ou E define se é o nome do elemento ou um atributo
link: function(scope, element, attrs) {
// concatenating the directory to the ver attr to select the correct excerpt for the day
 
 
 
scope.teste = "teste";
scope.move = function(){
 
scope.teste = "teste2";
scope.testeSuper = "testeSuper2";
}
},
// passing in contentUrl variable
templateUrl: function(elem,attrs) {
return attrs.templatename;
}
}
});
 
 
demoApp.controller('demoAppController', function ($scope) {
 
 
$scope.testeSuper = "testeSuper";
 
}
);
 
</script>
 
<p>campo testeSuper no mainmodule {{testeSuper}}</p>
 
<p>Se incluirmos o tpl2.html apenas vamos ter acesso às variaveis do scope da aplicação, neste caso o teste, a template pode estar declarada fora da app, não há problema</p>
<p>Por acaso neste exemplo temos acesso ao testeSuper porque a directiva adiciona funcionalidade ao scope da aplicação onde é chamada, mas se não chamarmos nenhuma directiva
a var testeSuper não aparece</p>
<div ng-include="'tpl2.html'"></div>
 
 
<h2>Invocando a tpl de html com directiva</h2>
<tpl templatename="tpl.html"></tpl>
 
<h2>Invocando a tpl de de javascript com directiva</h2>
<tpl templatename="tpl2.html"></tpl>
 
 
 
 
 
 
</div>
 
 
 
<!--TEMPLATE RECURSIVO-->
<script type="text/ng-template" id="tpl2.html">
<div>
<h1>Usando um template de Script</h1>
<p>TESTE</p>
<p>{{teste}}</p>
<p>{{testeSuper}}</p>
<button ng-click="move()">Muda Textos</button>
</div>
</script>
</body>
</html>
/branches/grupo1/impl/src/web/examples/angular/directives/tpl.html
New file
0,0 → 1,5
<h1>Template de HTML</h1>
<p>TESTE</p>
<p>{{teste}}</p>
<p>{{testeSuper}}</p>
<button ng-click="move()">Muda Textos</button>
/branches/grupo1/impl/src/web/examples/angular/directives/angular-directive-module.jsp
New file
0,0 → 1,36
<%--
Created by IntelliJ IDEA.
User: jorgemachado
Date: 11/11/17
Time: 10:20
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title></title>
</head>
<body ng-app="BacoAngularApp">
<jsp:include page="/layout/themes/scripts-default.jsp"/>
<jsp:include page="/layout/headerTools.jsp"/>
 
<div class="container">
<h1>Uso de Templates Generalizados e cada um com sua template</h1>
<p>O caso em questão é a existencia de um esqueleto principal para um modulo (mainmodule)</p>
<p>O main module inclui templates para cada componente usando o ng-include</p>
<p>Esse ng-include é referente ao campo @class de cada componente</p>
<p>vamos incluir esse esqueleto e todas as templates especificas dos nossos modulos</p>
<p>incluimos ainda as directivas que estiverem nos nossos modulos</p>
<p>o template do ng-include irá colocar a directiva desejada caso seja necessário</p>
<p>com a directiva podemos ter funcionalidade de scope associada ao subcomponente, que é desconhecido do main module</p>
<p>caso necessite o includemodule também tem acesso ao scope da app principal</p>
<p>o unico requesito é passar ao include module o nome da app onde ele vai inserir as directivas</p>
 
 
 
<jsp:include page="angular-directive-mainmodule.jsp"/>
<jsp:include page="angular-directive-includemodule.jsp"/>
 
</div>
</body>
</html>
/branches/grupo1/impl/src/web/examples/angular/directives/angular-directive-includemodule.jsp
New file
0,0 → 1,60
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
 
<p>Modulo Incluido contem as directivas e os templates necessários</p>
<p>Este módulo conhece o nome do módulo da App onde vai ser incluido</p>
 
<script>
angular.module("demoApp").directive('tpl', function() {
var contentUrl;
return {
restrict: 'E', //A ou E define se é o nome do elemento ou um atributo
link: function(scope, element, attrs) {
// concatenating the directory to the ver attr to select the correct excerpt for the day
//contentUrl = attrs.templatename + '.html';
 
//console.log(contentUrl);
 
scope.teste = "teste";
scope.move = function(){
 
scope.teste = "teste2modules";
//scope.testeSuper = "testeSuper2modules";
angular.element("#demoApp").scope().testeSuper = "testeSuper2modules";
}
scope.mudaCompName = function(comp){
 
comp.name = "NOVO NOME DO COMP MUDADO NA DIRECTIVA";
}
},
// passing in contentUrl variable
templateUrl: function(elem,attrs) {
return "templateDirectiva";
}
}
});
</script>
 
<script type="text/ng-template" id="directive_class">
<div style="border: 1px solid #000000">
<h1>DIRECTIVE CLASS TEMPLATE</h1>
<p>COMP ELEMENTO DIRECTIVA:{{comp.name}}</p>
<p><input type="text" ng-model="comp.name"></p>
<tpl></tpl>
<p>Teste no scope da directiva<p>
<pre>
{{teste | json}}
</pre>
</div>
</script>
 
<script type="text/ng-template" id="templateDirectiva">
<div style="border: 1px solid green">
<h1>templateDirectiva</h1>
<p>TESTE</p>
<p>{{teste}}</p>
<p>{{testeSuper}}</p>
<p>COMP ELEMENTO DIRECTIVA:{{comp.name}}</p>
<button ng-click="move()">Muda Textos</button>
<button ng-click="mudaCompName(comp)">Muda COMP NAME</button>
</div>
</script>
/branches/grupo1/impl/src/web/examples/angular/directives/angular-directive-mainmodule.jsp
New file
0,0 → 1,48
<div id="demoApp" ng-app="demoApp" ng-controller="demoAppController">
 
 
 
<script>
 
var demoApp = angular.module('demoApp', []);
GLOBAL_BacoAngularAppDependencies.push('demoApp');
 
 
demoApp.controller('demoAppController', function ($scope) {
 
$scope.testeSuper = "testeSuper";
 
$scope.data =
{
comps : [
{
"@class" : "directive_class",
"name" : "componente de teste"
}
]
}
 
}
);
 
</script>
 
 
<h1>Campo testeSuper no mainmodule "{{testeSuper}}"</h1>
<h1>Campo data.comps[0].name no mainmodule "{{data.comps[0].name}}"</h1>
 
<h2>Template chamado atraves de um template de classe intermedio</h2>
<div ng-repeat="comp in data.comps" ng-include="comp['@class']">
 
</div>
 
 
<pre>
{{testeSuper | json}}
</pre>
<pre>
{{data | json}}
</pre>
 
 
</div>
/branches/grupo1/impl/src/web/user/courses/coursereport/templates.jsp
New file
0,0 → 1,756
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultYear" %>
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultSemester" %>
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultUc" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
 
<!--
@section objeto com seccoes e componentes
@optional @chapter capitulo do documento para esta seccao para contcatenar às subsections
-->
 
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_CourseUnitsReportsSection">
<div class="sections">
<a name="indexCus"></a>
<span ng-repeat="cu in section.sections" ng-init="cu.taxaAprovacao = 100 * cu.courseUnitEvaluation.numAlunosAprovTotal/(cu.courseUnitEvaluation.numAlunosInscritos - cu.courseUnitEvaluation.numAlunosSemElementosAvaliacao)">
<a href="#cu{{$index}}" ng-class="{ 'alert-danger': (cu.courseUnitEvaluation.cumprimentoProgramaPercent &lt; 100) || cu.taxaAprovacao &lt; 75 || !cu.courseUnitEvaluation.closed || !cu.courseUnitEvaluation.teacherComplete}">
{{cu.title}}
</a> |
</span>
<div ng-repeat="cu in section.sections"
class="section panel-primary">
 
<a name="cu{{$index}}"></a>
<span ng-if="$index != 0" class="glyphicon glyphicon-backward" ></span><a ng-if="$index != 0" href="#indexCus"> Voltar atrás</a>
<div class="panel-heading"><h2>{{cu.title}}</h2></div>
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Estado do Relatório</label></h3></div>
 
<div ng-if="cu.courseUnitEvaluation.closed">
Entregue e Aceite
</div>
<div class="alert-danger" ng-if="cu.courseUnitEvaluation.closed && !cu.courseUnitEvaluation.teacherComplete">
Entregue mas não foi aprovado pela comissão
</div>
<div class="alert-danger" ng-if="!cu.courseUnitEvaluation.closed && !cu.courseUnitEvaluation.teacherComplete">
Não foi entregue pelo docente para validação
</div>
 
</div>
 
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Resultados</label></h3></div>
<div>
<table class="tablesorter-blue" width="100%">
<tr>
<th rowspan="2">
Nº Alunos Inscritos
</th>
<th rowspan="2">
Nº de alunos sem elementos de avaliação
</th>
<th colspan="5">
Nº de alunos aprovados em
</th>
<th colspan="2">
Aprovados com a classificação entre 10 e 13 valores
</th>
<th colspan="2">
Aprovados com a classificação entre 14 e 16 valores
</th>
<th colspan="2">
Aprovados com a classificação entre 17 e 20 valores
</th>
</tr>
<tr>
<th>Avaliação de frequência</th>
<th>Exame Época Normal</th>
<th>Exame Época Recurso</th>
<th>Exame Época Especial</th>
<th>Total</th>
<th>Nº</th>
<th>%</th>
<th>Nº</th>
<th>%</th>
<th>Nº</th>
<th>%</th>
</tr>
<tr>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosInscritos}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosSemElementosAvaliacao}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovFrequencia}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovNormal}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovRecurso}}
</td>
<td style="text-align: center">
{{cu.courseUnitEvaluation.numAlunosAprovEspecial}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovTotal}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1013}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1013Percent}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1416}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1416Percent}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1720}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1720Percent}}
</td>
</tr>
</table>
</div>
</div>
 
<div style="padding-left:20px" >
<div><h3><label class="label label-primary">Taxa de Aprovação</label></h3></div>
<div ng-class="{ 'alert-danger': cu.taxaAprovacao &lt; 75 }">{{cu.taxaAprovacao}}%</div>
</div>
 
 
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação dos resultados quantitativos obtidos pelos estudantes</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoQuantitivos}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação do funcionamento da UC</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoUC}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Percentagem de cumprimento do programa da UC</label></h3></div>
<div ng-class="{ 'alert-danger': (cu.courseUnitEvaluation.cumprimentoProgramaPercent &lt; 100) }">
{{cu.courseUnitEvaluation.cumprimentoProgramaPercent}}%
</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação do cumprimento do programa da UC</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoCumprimentoPrograma}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Conclusões</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualConclusoes}}</div>
</div>
</div>
</div>
</script>
 
 
 
<style>
.dtpstats td, .dtpstats th{
text-align: center !important;
}
</style>
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_reportucsummary_UnitsDtpTable">
<div class="sections">
 
<table class="table dtpstats">
<thead>
<tr>
<th rowspan="2">Unidade Curricular</th>
<th colspan="2">Planeamento</th>
<th rowspan="2">Ficha Curricular</th>
<th rowspan="2">Sumários</th>
<th colspan="2">Avaliação</th>
<th rowspan="2">Relatório de Avaliação</th>
<th rowspan="2">Inquerito Pedagógico</th>
</tr>
<tr>
<th>Conteúdos</th>
<th>Calendarização</th>
<th>Enunciados</th>
<th>Pautas</th>
</tr>
</thead>
<tbody>
<tr>
<th colspan="9">Semestre 1</th>
</tr>
<tr ng-repeat="dtpStat in comp.semester1.courseUnitDtpStats">
<td>{{dtpStat.name}}</td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoConteudos }"><input type="checkbox" ng-model="dtpStat.planeamentoConteudos"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoCalendarizacao }"><input type="checkbox" ng-model="dtpStat.planeamentoCalendarizacao"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.ficha }"><input type="checkbox" ng-model="dtpStat.ficha"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.sumarios }"><input type="checkbox" ng-model="dtpStat.sumarios"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoEnunciados }"><input type="checkbox" ng-model="dtpStat.avaliacaoEnunciados"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoPautas }"><input type="checkbox" ng-model="dtpStat.avaliacaoPautas"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.relatorio }"><input type="checkbox" ng-model="dtpStat.relatorio"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.inquerito }"><input type="checkbox" ng-model="dtpStat.inquerito"/></td>
</tr>
<tr>
<th colspan="9">Semestre 2</th>
</tr>
<tr ng-repeat="dtpStat in comp.semester2.courseUnitDtpStats">
<td>{{dtpStat.name}}</td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoConteudos }"><input type="checkbox" ng-model="dtpStat.planeamentoConteudos"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoCalendarizacao }"><input type="checkbox" ng-model="dtpStat.planeamentoCalendarizacao"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.ficha }"><input type="checkbox" ng-model="dtpStat.ficha"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.sumarios }"><input type="checkbox" ng-model="dtpStat.sumarios"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoEnunciados }"><input type="checkbox" ng-model="dtpStat.avaliacaoEnunciados"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoPautas }"><input type="checkbox" ng-model="dtpStat.avaliacaoPautas"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.relatorio }"><input type="checkbox" ng-model="dtpStat.relatorio"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.inquerito }"><input type="checkbox" ng-model="dtpStat.inquerito"/></td>
</tr>
</tbody>
</table>
</div>
</script>
 
 
 
<style>
.learning td
{
font-size: 0.7em;
}
.learning td input{
width: 50px;
}
 
.learning td input:read-only{
width: 50px;
background-color: #cccccc;
}
.learning tr.year td {
vertical-align: top;
background-color: #aaaaaa;
 
font-weight: bold;
}
.learning tr.period td {
vertical-align: top;
background-color: #dfdfdf;
 
}
</style>
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_UnitsLearningResultsTable">
<unitslearningresultstable>
</unitslearningresultstable>
</script>
 
 
 
<script>
angular.module("courseReportApp").directive('boundModel', function() {
return {
require: 'ngModel',
link: function(scope, elem, attrs, ngModel) {
scope.$watch(attrs.boundModel, function(newValue, oldValue) {
if(newValue != oldValue) {
ngModel.$setViewValue(newValue);
ngModel.$render();
}
});
}
}
});
angular.module("courseReportApp").directive('unitslearningresultstable', function() {
 
return {
restrict: 'E',
link: function($scope, element, attrs)
{
 
$scope.checkedDocuments = [];
$scope.checkUnit = function(document,collection)
{
if(document.checked)
{
var docContainer =
{
"document" : document,
"collection" : collection
}
$scope.checkedDocuments.push(docContainer);
}
else
{
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
if(documentContainer.document == document)
{
var index = $scope.checkedDocuments.indexOf(documentContainer);
$scope.checkedDocuments.splice(index, 1);
}
});
}
}
$scope.changeDocumentCollection = function(collection)
{
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
collection.ucs.push(documentContainer.document);
delete documentContainer.document.checked;
});
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
var index = documentContainer.collection.ucs.indexOf(documentContainer.document);
documentContainer.collection.ucs.splice(index, 1);
});
$scope.checkedDocuments = [];
}
$scope.avg = function(field,container, childs)
{
if(!childs || childs.length == 0)
return 0;
var sum = 0;
var c;
for(c in childs)
{
if(childs[c] && childs[c][field])
sum += 1*childs[c][field];
}
container[field] = sum / childs.length;
return container[field];
}
$scope.percent = function(n,total)
{
if(!n || n == 0 || !total || total == 0)
return 0;
return 100 * n / total;
}
$scope.reprovados = function(comp)
{
if(comp.alunosInscritos && comp.semElementos && comp.aprovados)
return comp.alunosInscritos - comp.semElementos - comp.aprovados;
return 0;
}
$scope.removeComponent = function(index,list)
{
list.splice(index,1);
}
$scope.hasYearUnits = function(year)
{
for(s in year.semesters)
{
if(year.semesters[s].ucs && year.semesters[s].ucs.length > 0)
return true;
}
return false;
}
$scope.isInvalidAnfHaveUcs = function(year,years,index)
{
if(year.ano > 0)
return false;
 
var s;
for(s in year.semesters)
{
if(year.semesters[s].ucs && year.semesters[s].ucs.length > 0)
return true;
}
years.splice(index,1);
return false;
}
$scope.addUc = function(semestre)
{
semestre.ucs.push(
{
"@class" : "<%=UnitsLearningResultUc.class.getName()%>",
manual : true,
periodo : semestre.semestre,
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
sigesCode : 0
}
);
}
$scope.addAno = function(comp)
{
if(!comp.years)
comp.years = [];
comp.years.push(
{
ano : 1,
"@class" : "<%=UnitsLearningResultYear.class.getName()%>",
manual : true,
"alunosInscritos": 0,
"aprovados": 0,
"aprovados1013": 0,
"aprovados1013Percent": 0,
"aprovados1416": 0,
"aprovados1416Percent": 0,
"aprovados1720": 0,
"aprovados1720Percent": 0,
"aprovadosPercent": 0,
"cumprimentoProgramaPercent": 0,
"reprovados": 0,
"reprovadosPercent": 0,
"semElementos": 0,
"semElementosPercent": 0,
semesters : [
{
"@class" : "<%=UnitsLearningResultSemester.class.getName()%>",
manual : true,
semestre : "S1",
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
ucs : []
},
{
"@class" : "<%=UnitsLearningResultSemester.class.getName()%>",
manual : true,
semestre: "S2",
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
ucs : []
}
]
}
);
}
 
},
templateUrl: function(elem,attrs) {
return "unitslearningresultstable";
}
}
});
</script>
<script type="text/ng-template" id="unitslearningresultstable">
 
 
<div class="sections">
<button class="btn btn-success" ng-click="addAno(comp)"><span class="glyphicon glyphicon-plus"></span> Ano Manual</button>
<table class="table learning">
<thead>
<tr>
<th rowspan="2">Mover</th>
<th rowspan="2">Código</th>
<th rowspan="2">Unidade Curricular</th>
<th rowspan="2">Cumprimento do Programa</th>
<th rowspan="2">Alunos Inscritos</th>
<th colspan="2">Sem Elementos</th>
<th colspan="2">Reprovados</th>
<th colspan="2">Aprovados</th>
<th colspan="2">Aprovados 10-13</th>
<th colspan="2">Aprovados 14-16</th>
<th colspan="2">Aprovados 17-20</th>
</tr>
<tr>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
</tr>
</thead>
<tbody>
<tr colspan="17" ng-if="false" ng-repeat-start="year in comp.years"></tr>
<tr class="year">
<td colspan="3" ng-if="year.ano &gt; 0">
 
<button ng-disabled="hasYearUnits(year)" class="btn btn-danger btn-xs" ng-click="removeComponent($index,comp.years)"><span class="glyphicon glyphicon-remove"></span></button>
<span ng-if="!year.manual">{{year.ano}}ª ano</span>
<span ng-if="year.manual">
<select ng-model="year.ano" ng-options="c.v as c.n for c in [{v:1,n:'1º Ano'},{v:2,n:'2º Ano'},{v:3,n:'3º Ano'},{v:4,n:'4º Ano'},{v:5,n:'5º Ano'}]">
</select>
</span>
 
</td>
<td colspan="3" style="font-size: 1.0em !important" ng-if="isInvalidAnfHaveUcs(year,comp.years,$index)">
Unidades que não constam do plano (Verifique a situação com os serviços Académicos antes de continuar)
poderão constar de um plano antigo ou ter o código siges desatualizado.
</td>
<td><input readonly="true" type="number" ng-model="year.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.alunosInscritos" bound-model="avg('alunosInscritos',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.semElementos" bound-model="avg('semElementos',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.semElementosPercent" bound-model="percent(year.semElementos,year.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="year.reprovados" bound-model="reprovados(year)"></td>
<td><input readonly="true" type="number" ng-model="year.reprovadosPercent" bound-model="percent(year.reprovados,year.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados" bound-model="year.aprovados1013*1 + year.aprovados1416*1 + year.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="year.aprovadosPercent" bound-model="percent(year.aprovados,year.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="year.aprovados1013" bound-model="avg('aprovados1013',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1013Percent" bound-model="percent(year.aprovados1013,year.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1416" bound-model="avg('aprovados1416',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1416Percent" bound-model="percent(year.aprovados1416,year.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1720" bound-model="avg('aprovados1720',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1720Percent" bound-model="percent(year.aprovados1720,year.aprovados)"></td>
</tr>
 
<tr ng-if="false" ng-repeat-start="s in year.semesters" ></tr>
<tr class="period" ng-if="year.ano &gt; 0 || s.ucs.length > 0">
<td colspan="3" class="period">Semestre {{s.semestre}} <button ng-click="changeDocumentCollection(s)" data-toggle="tooltip" title="Mover unidades para aqui" class="btn btn-xs btn-warning" ng-show="checkedDocuments.length"><span class="glyphicon glyphicon-arrow-left"></span></button>
 
<button class="btn btn-success pull-right" ng-click="addUc(s)"><span class="glyphicon glyphicon-plus"></span> UC Manual</button>
</td>
<td><input readonly="true" type="number" ng-model="s.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.alunosInscritos" bound-model="avg('alunosInscritos',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.semElementos" bound-model="avg('semElementos',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.semElementosPercent" bound-model="percent(s.semElementos,s.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="s.reprovados" bound-model="reprovados(s)"></td>
<td><input readonly="true" type="number" ng-model="s.reprovadosPercent" bound-model="percent(s.reprovados,s.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados" bound-model="s.aprovados1013*1 + s.aprovados1416*1 + s.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="s.aprovadosPercent" bound-model="percent(s.aprovados,s.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="s.aprovados1013" bound-model="avg('aprovados1013',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1013Percent" bound-model="percent(s.aprovados1013,s.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1416" bound-model="avg('aprovados1416',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1416Percent" bound-model="percent(s.aprovados1416,s.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1720" bound-model="avg('aprovados1720',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1720Percent" bound-model="percent(s.aprovados1720,s.aprovados)"></td>
</tr>
<tr ng-repeat="u in s.ucs" ng-class="{'alert-danger': u.error}" >
<td><input ng-model="u.error" type="hidden" bound-model="u.alunosInscritos < (u.aprovados*1 + u.semElementos*1)">
<input ng-model="u.checked" ng-click="checkUnit(u,s)" type="checkbox"></td>
<td><input type="text" ng-readonly="!u.manual || u.manual == false" ng-model="u.sigesCode"></td>
<td>
 
<input type="text" style="width: 150px" ng-if="!(!u.manual || u.manual == false)" ng-model="u.name">
<span ng-if="(!u.manual || u.manual == false)">{{u.name}}</span>
<button class="btn btn-danger btn-xs pull-right" ng-if="!(!u.manual || u.manual == false)" ng-click="removeComponent(index,s.ucs)"><span class="glyphicon glyphicon-remove"></span></button>
</td>
<td><input type="number" ng-model="u.cumprimentoProgramaPercent"></td>
<td><input type="number" ng-model="u.alunosInscritos"></td>
<td><input type="number" ng-model="u.semElementos"></td>
<td><input readonly="true" type="number" ng-model="u.semElementosPercent" bound-model="percent(u.semElementos,u.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="u.reprovados" bound-model="reprovados(u)"></td>
<td><input readonly="true" type="number" ng-model="u.reprovadosPercent" bound-model="percent(u.reprovados,u.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados" bound-model="u.aprovados1013*1 + u.aprovados1416*1 + u.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="u.aprovadosPercent" bound-model="percent(u.aprovados,u.alunosInscritos)"></td>
 
<td><input type="number" ng-model="u.aprovados1013"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1013Percent" bound-model="percent(u.aprovados1013,u.aprovados)"></td>
<td><input type="number" ng-model="u.aprovados1416"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1416Percent" bound-model="percent(u.aprovados1416,u.aprovados)"></td>
<td><input type="number" ng-model="u.aprovados1720"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1720Percent" bound-model="percent(u.aprovados1720,u.aprovados)"></td>
</tr>
<tr ng-if="false" ng-repeat-end></tr>
<tr ng-if="false" ng-repeat-end></tr>
<tr class="year">
<td colspan="3">Resultados Globais</td>
 
 
<td><input readonly="true" type="number" ng-model="comp.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.alunosInscritos" bound-model="avg('alunosInscritos',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.semElementos" bound-model="avg('semElementos',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.semElementosPercent" bound-model="percent(comp.semElementos,comp.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="comp.reprovados" bound-model="reprovados(comp)"></td>
<td><input readonly="true" type="number" ng-model="comp.reprovadosPercent" bound-model="percent(comp.reprovados,comp.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados" bound-model="comp.aprovados1013*1 + comp.aprovados1416*1 + comp.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovadosPercent" bound-model="percent(comp.aprovados,comp.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="comp.aprovados1013" bound-model="avg('aprovados1013',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1013Percent" bound-model="percent(comp.aprovados1013,comp.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1416" bound-model="avg('aprovados1416',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1416Percent" bound-model="percent(comp.aprovados1416,comp.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1720" bound-model="avg('aprovados1720',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1720Percent" bound-model="percent(comp.aprovados1720,comp.aprovados)"></td>
</tr>
</tbody>
</table>
<%--<pre class="code">{{ comp | json }}</pre>--%>
</div>
</script>
 
 
 
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_GlobalLearningResultsChartImg">
<globallearningresultschartimg>
</globallearningresultschartimg>
</script>
<script>
angular.module("courseReportApp").directive('globallearningresultschartimg', function() {
 
return {
restrict: 'E',
link: function($scope, element, attrs)
{
$scope.generateChart = function(comp)
{
 
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/courseReport.do",
"generateGlobalLearningResultsChartImg",
{
"courseReportDocument" : BacoJS.stringifyOrdered(angular.element($("#courseReportApp")).scope().report)
},
"#courseReportApp",
function(repositoryFile4JsonView)
{
comp.image = repositoryFile4JsonView;
comp.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + comp.image.identifier + "?" + new Date().getTime();
angular.element($("#courseReportApp")).scope().$apply();
},
function(){}
);
}
 
 
},
templateUrl: function(elem,attrs) {
return "globallearningresultschartimg";
}
}
});
</script>
<script type="text/ng-template" id="globallearningresultschartimg">
<div class="imageComponent component">
 
<div class="componentBody">
<div class="form-group clearfix">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<button class="btn btn-default" ng-click="generateChart(comp)">Refrescar/Gerar Gráfico</button>
</div>
<div class="col-md-10">
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img ng-if="comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
<img ng-if="!comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{'<%=request.getContextPath()%>/repositoryStream/' + comp.image.identifier}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
</div>
</div>
</div>
</div>
</script>
 
 
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_GlobalLearningResultsChartYearImg">
<globallearninglesultschartyearimg>
</globallearninglesultschartyearimg>
</script>
 
<script>
angular.module("courseReportApp").directive('globallearninglesultschartyearimg', function() {
 
return {
restrict: 'E',
link: function($scope, element, attrs)
{
$scope.generateChart = function(comp)
{
 
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/courseReport.do",
"generateGlobalLearningResultsChartYearImg",
{
"courseReportDocument" : BacoJS.stringifyOrdered(angular.element($("#courseReportApp")).scope().report)
},
"#courseReportApp",
function(repositoryFile4JsonView)
{
comp.image = repositoryFile4JsonView;
comp.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + comp.image.identifier + "?" + new Date().getTime();
angular.element($("#courseReportApp")).scope().$apply();
},
function(){}
);
}
 
 
},
templateUrl: function(elem,attrs) {
return "globallearningresultschartimg";
}
}
});
</script>
<script type="text/ng-template" id="globallearninglesultschartyearimg">
<div class="imageComponent component">
 
<div class="componentBody">
<div class="form-group clearfix">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<button class="btn btn-default" ng-click="generateChart(comp)">Refrescar/Gerar Gráfico</button>
</div>
<div class="col-md-10">
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img ng-if="comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
<img ng-if="!comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{'<%=request.getContextPath()%>/repositoryStream/' + comp.image.identifier}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
</div>
</div>
</div>
</div>
</script>
/branches/grupo1/impl/src/web/user/utils/documentsBuilder.jsp
1,5 → 1,9
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
.sections
{
padding-left: 20px;
}
.buttonTools
{
border: 1px solid gray;
23,7 → 27,12
}
</style>
 
<!--Require templateObj-->
<script type="text/ng-template" id="callDocumentTemplate">
 
<div ng-include="class2id(templateObj)"></div>
</script>
 
<%--
customPane Need component customPane in variable customPane
docAppSelector selector usualy an html ID for ng-app example #docReport
46,64 → 55,63
<div class="clearfix" ng-repeat="subComp in comp.components" ng-init="parent=comp;comp=subComp" ng-include="class2id(subComp)">
 
</div>
<div>
</div>
</div></div>
</script>
 
<script type="text/ng-template" id="pt_estgp_estgweb_utils_documentBuilder_ImageComponent">
<div class="imageComponent component">
<div ng-if="parent['@class']=='pt.estgp.estgweb.utils.documentBuilder.CustomPane'" class="buttonTools clearfix">
<button class="btn btn-danger pull-right" type="button" ng-click="removeComponent($index,parent.components)">
<span class="glyphicon glyphicon-remove"></span>
</button>
<label>Componente de Imagem (Use esta funcinalidade para adicionar gráficos ou tabelas que ache necessárias)</label>
<button class="btn btn-danger pull-right" type="button" ng-click="removeComponent($index,parent.components)">
<span class="glyphicon glyphicon-remove"></span>
</button>
<label>Componente de Imagem (Use esta funcinalidade para adicionar gráficos ou tabelas que ache necessárias)</label>
</div>
 
<div class="componentBody" ng-if="comp['@class']=='pt.estgp.estgweb.utils.documentBuilder.ImageComponent'">
<div class="form-group clearfix" ng-if="comp.image.identifier">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
<div class="componentBody">
<div class="form-group clearfix" ng-if="comp.image.identifier">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<a class="btn btn-default" href="#" ng-model="comp"
data-title="Escolha Imagem"
data-showmetafields="false"
data-confirmonupload="true"
data-toggle="modal"
data-target="#filesUploadModal"
data-multiple="false"
data-allowed-extensions="jpg,png,gif"
data-callback-target-function="angular.element($('{{docAppSelector}}')).scope().callbackUploadedFiles">
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<a class="btn btn-default" href="#" ng-model="comp"
data-title="Escolha Imagem"
data-showmetafields="false"
data-confirmonupload="true"
data-toggle="modal"
data-target="#filesUploadModal"
data-multiple="false"
data-allowed-extensions="jpg,png,gif"
data-callback-target-function="angular.element($('{{docAppSelector}}')).scope().callbackUploadedFiles">
<span ng-if="comp.image.identifier">
Substituir Imagem
</span>
<span ng-if="!(comp.image.identifier)">
<span ng-if="!(comp.image.identifier)">
Carregar Imagem
</span>
 
<span class="glyphicon glyphicon-upload"/>
<span class="glyphicon glyphicon-upload"/>
 
</a>
</a>
</div>
 
<div class="col-md-10">
<div ng-if="!(comp.image.identifier)">
Clique em carregar imagens e escolha uma imagem para adicionar nesta secção.
</div>
 
<div class="col-md-10">
<div ng-if="!(comp.image.identifier)">
Clique em carregar imagens e escolha uma imagem para adicionar nesta secção.
</div>
 
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
</div>
</div>
</div>
</div>
135,4 → 143,33
</div>
</div>
</div>
</script>
 
<!--
@section objeto com seccoes e componentes
@optional @chapter capitulo do documento para esta seccao para contcatenar às subsections
-->
<script type="text/ng-template" id="pt_estgp_estgweb_utils_documentBuilder_DocumentSection">
<div class="sections">
<ul class="nav nav-tabs">
<li ng-model="section" class="separatorSectionNav"
ng-class="{ active : subSection.active}"
ng-repeat="subSection in section.sections">
<a ng-click="showSep(section,subSection)"> {{$chapter}}{{$index+1}} - {{subSection.title}}</a>
</li>
</ul>
<div ng-model="subSection"
ng-class="{ hidden: !subSection.active }"
ng-repeat="subSection in section.sections"
class="separatorSection clearfix">
<div ng-repeat="comp in subSection.components"
ng-include="class2id(comp)">
 
</div>
<div ng-if="subSection.sections"
ng-init="section=subSection;$chapter=$chapter+($index+1)+'.'"
ng-include="class2id(subSection)">
</div>
</div>
</div>
</script>
/branches/grupo2/impl/conf/WEB-INF/struts/struts-courses.xml
166,6 → 166,14
<action path="/user/loadCourseReportTools" forward="page.course.report.tools.load"/>
<action path="/user/editCourseReport" forward="page.course.report.edit"/>
 
<action path="/user/courseReport"
type="pt.estgp.estgweb.web.controllers.courses.CoursesServicesController"
name="WidgetModelForm"
scope="request"
parameter="dispatch"
validate="true"
input="page.widget.json.fail.validations">
</action>
 
 
 
/branches/grupo2/impl/conf/berserk/sd.xml
4044,4 → 4044,22
</filterChains>
</service>
 
<service>
<name>CourseReportGenerateGlobalLearningResultsChartYearImg</name>
<implementationClass>pt.estgp.estgweb.services.courses.CourseReportServices</implementationClass>
<description>
@reportCourseDocument documento course report em json
Serviço de suporte para gerar um grafico
Coloca o grafico no report documento
e salva o documento no curso
Devolve uma classe RepositoryFile4JsonView serializada em JSON
</description>
<isTransactional>true</isTransactional>
<defaultMethod>generateGenerateGlobalLearningResultsChartYearImg</defaultMethod>
<filterChains>
<chain name="Logger"/>
<chain name="Session"/>
</filterChains>
</service>
 
</serviceDefinitions>
/branches/grupo2/impl/src/java/pt/estgp/estgweb/services/courses/CourseReportServices.java
448,11 → 448,41
return view.toJson();
}
 
public String generateGenerateGlobalLearningResultsChartYearImg(String reportDocumentJson,UserSession session) throws IOException {
 
CourseReportDocument reportDocument = CourseReportDocument.fromJson(reportDocumentJson);
LearningResultsSection learningResultsSection = (LearningResultsSection) reportDocument.findDocumentSection(LearningResultsSection.class);
LearningGlobalAnalysisSection learningGlobalAnalysisSection = (LearningGlobalAnalysisSection) learningResultsSection.findSection(LearningGlobalAnalysisSection.class);
GlobalLearningResultsChartImg chartImg = (GlobalLearningResultsChartImg) learningGlobalAnalysisSection.findDocComponent(GlobalLearningResultsChartImg.class);
 
UnitsLearningResultsTable table = (UnitsLearningResultsTable) learningResultsSection.findDocComponent(UnitsLearningResultsTable.class);
 
 
FileUploaded fileUploaded = chartImg.generateChart2tmp(table,reportDocument);
 
RepositoryService repositoryService = new RepositoryService();
 
boolean imageInitialized = chartImg.getImage() != null
&&
chartImg.getImage().getIdentifier() != null;
 
RepositoryFile4JsonView view;
if(imageInitialized)
{
String identifier = chartImg.getImage().getIdentifier();
view = repositoryService.replaceRepositoryFileFromFileUpload(identifier, fileUploaded, ResourceAccessControlEnum.privateDomain, session);
}
else
{
view = repositoryService.storeRepositoryFileFromFileUpload(fileUploaded,ResourceAccessControlEnum.privateDomain,session);
}
chartImg.setImage(view);
//TODO FALTA GUARDAR O JSON NO CURSO
return view.toJson();
}
 
 
 
/****************************************************************************/
/*
 
/branches/grupo2/impl/src/java/pt/estgp/estgweb/web/controllers/courses/CoursesServicesController.java
New file
0,0 → 1,55
package pt.estgp.estgweb.web.controllers.courses;
 
import org.apache.struts.action.ActionForm;
import org.json.JSONObject;
import pt.estgp.estgweb.web.controllers.utils.AbstractWidgetAjaxController;
import pt.estgp.estgweb.web.utils.RequestUtils;
import pt.utl.ist.berserk.logic.serviceManager.IServiceManager;
import pt.utl.ist.berserk.logic.serviceManager.ServiceManager;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
/**
* Created by jorgemachado on 06/01/17.
*/
public class CoursesServicesController extends AbstractWidgetAjaxController
{
 
 
/**
* See also CoursesServicesWidgetController for WS-API services
*/
 
/**
*
* @param form
* @param request
* @param response
* @return
* @throws Throwable
*/
 
public JSONObject generateGlobalLearningResultsChartImg(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Throwable {
 
String courseReportDocument = request.getParameter("courseReportDocument");
 
 
IServiceManager sm = ServiceManager.getInstance();
String json = (String) sm.execute(RequestUtils.getRequester(request, response),
"CourseReportGenerateGlobalLearningResultsChartImg",
new Object[]{courseReportDocument});
return new JSONObject(json);
}
 
public JSONObject generateGlobalLearningResultsChartYearImg(ActionForm form,HttpServletRequest request, HttpServletResponse response) throws Throwable {
String courseReportDocument = request.getParameter("courseReportDocument");
 
 
IServiceManager sm = ServiceManager.getInstance();
String json = (String) sm.execute(RequestUtils.getRequester(request, response),
"CourseReportGenerateGlobalLearningResultsChartYearImg",
new Object[]{courseReportDocument});
return new JSONObject(json);
}
}
/branches/grupo2/impl/src/web/examples/angular/directives/angular-directive.jsp
New file
0,0 → 1,95
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="bacoTags" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="logic" uri="/WEB-INF/tlds/struts-logic.tld" %>
<html>
<head></head>
<body ng-app="BacoAngularApp">
<jsp:include page="/layout/themes/scripts-default.jsp"/>
<jsp:include page="/layout/headerTools.jsp"/>
 
 
<div id="demoApp" ng-app="demoApp" ng-controller="demoAppController">
 
 
<h1>Uso de Directivas com Templates</h1>
<p>Este exemplo mostra como deve ser usada uma template para podermos incluir uma função
de controlo especifica da template usando directivas</p>
<p>Mostra ainda que dentro da template o scope é uma fusão dos scopes da ngApp e da propria directiva</p>
<p>Mostra também como podemos escolher dinamicamente a template ou as funcionalidades dependendo de atributos que passamos à template</p>
<script>
 
var demoApp = angular.module('demoApp', []);
GLOBAL_BacoAngularAppDependencies.push('demoApp');
 
 
//demoApp..directive('tpl', function() {
//ou
angular.module('demoApp').directive('tpl', function() {
 
return {
restrict: 'E', //A ou E define se é o nome do elemento ou um atributo
link: function(scope, element, attrs) {
// concatenating the directory to the ver attr to select the correct excerpt for the day
 
 
 
scope.teste = "teste";
scope.move = function(){
 
scope.teste = "teste2";
scope.testeSuper = "testeSuper2";
}
},
// passing in contentUrl variable
templateUrl: function(elem,attrs) {
return attrs.templatename;
}
}
});
 
 
demoApp.controller('demoAppController', function ($scope) {
 
 
$scope.testeSuper = "testeSuper";
 
}
);
 
</script>
 
<p>campo testeSuper no mainmodule {{testeSuper}}</p>
 
<p>Se incluirmos o tpl2.html apenas vamos ter acesso às variaveis do scope da aplicação, neste caso o teste, a template pode estar declarada fora da app, não há problema</p>
<p>Por acaso neste exemplo temos acesso ao testeSuper porque a directiva adiciona funcionalidade ao scope da aplicação onde é chamada, mas se não chamarmos nenhuma directiva
a var testeSuper não aparece</p>
<div ng-include="'tpl2.html'"></div>
 
 
<h2>Invocando a tpl de html com directiva</h2>
<tpl templatename="tpl.html"></tpl>
 
<h2>Invocando a tpl de de javascript com directiva</h2>
<tpl templatename="tpl2.html"></tpl>
 
 
 
 
 
 
</div>
 
 
 
<!--TEMPLATE RECURSIVO-->
<script type="text/ng-template" id="tpl2.html">
<div>
<h1>Usando um template de Script</h1>
<p>TESTE</p>
<p>{{teste}}</p>
<p>{{testeSuper}}</p>
<button ng-click="move()">Muda Textos</button>
</div>
</script>
</body>
</html>
/branches/grupo2/impl/src/web/examples/angular/directives/tpl.html
New file
0,0 → 1,5
<h1>Template de HTML</h1>
<p>TESTE</p>
<p>{{teste}}</p>
<p>{{testeSuper}}</p>
<button ng-click="move()">Muda Textos</button>
/branches/grupo2/impl/src/web/examples/angular/directives/angular-directive-module.jsp
New file
0,0 → 1,36
<%--
Created by IntelliJ IDEA.
User: jorgemachado
Date: 11/11/17
Time: 10:20
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title></title>
</head>
<body ng-app="BacoAngularApp">
<jsp:include page="/layout/themes/scripts-default.jsp"/>
<jsp:include page="/layout/headerTools.jsp"/>
 
<div class="container">
<h1>Uso de Templates Generalizados e cada um com sua template</h1>
<p>O caso em questão é a existencia de um esqueleto principal para um modulo (mainmodule)</p>
<p>O main module inclui templates para cada componente usando o ng-include</p>
<p>Esse ng-include é referente ao campo @class de cada componente</p>
<p>vamos incluir esse esqueleto e todas as templates especificas dos nossos modulos</p>
<p>incluimos ainda as directivas que estiverem nos nossos modulos</p>
<p>o template do ng-include irá colocar a directiva desejada caso seja necessário</p>
<p>com a directiva podemos ter funcionalidade de scope associada ao subcomponente, que é desconhecido do main module</p>
<p>caso necessite o includemodule também tem acesso ao scope da app principal</p>
<p>o unico requesito é passar ao include module o nome da app onde ele vai inserir as directivas</p>
 
 
 
<jsp:include page="angular-directive-mainmodule.jsp"/>
<jsp:include page="angular-directive-includemodule.jsp"/>
 
</div>
</body>
</html>
/branches/grupo2/impl/src/web/examples/angular/directives/angular-directive-includemodule.jsp
New file
0,0 → 1,60
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
 
<p>Modulo Incluido contem as directivas e os templates necessários</p>
<p>Este módulo conhece o nome do módulo da App onde vai ser incluido</p>
 
<script>
angular.module("demoApp").directive('tpl', function() {
var contentUrl;
return {
restrict: 'E', //A ou E define se é o nome do elemento ou um atributo
link: function(scope, element, attrs) {
// concatenating the directory to the ver attr to select the correct excerpt for the day
//contentUrl = attrs.templatename + '.html';
 
//console.log(contentUrl);
 
scope.teste = "teste";
scope.move = function(){
 
scope.teste = "teste2modules";
//scope.testeSuper = "testeSuper2modules";
angular.element("#demoApp").scope().testeSuper = "testeSuper2modules";
}
scope.mudaCompName = function(comp){
 
comp.name = "NOVO NOME DO COMP MUDADO NA DIRECTIVA";
}
},
// passing in contentUrl variable
templateUrl: function(elem,attrs) {
return "templateDirectiva";
}
}
});
</script>
 
<script type="text/ng-template" id="directive_class">
<div style="border: 1px solid #000000">
<h1>DIRECTIVE CLASS TEMPLATE</h1>
<p>COMP ELEMENTO DIRECTIVA:{{comp.name}}</p>
<p><input type="text" ng-model="comp.name"></p>
<tpl></tpl>
<p>Teste no scope da directiva<p>
<pre>
{{teste | json}}
</pre>
</div>
</script>
 
<script type="text/ng-template" id="templateDirectiva">
<div style="border: 1px solid green">
<h1>templateDirectiva</h1>
<p>TESTE</p>
<p>{{teste}}</p>
<p>{{testeSuper}}</p>
<p>COMP ELEMENTO DIRECTIVA:{{comp.name}}</p>
<button ng-click="move()">Muda Textos</button>
<button ng-click="mudaCompName(comp)">Muda COMP NAME</button>
</div>
</script>
/branches/grupo2/impl/src/web/examples/angular/directives/angular-directive-mainmodule.jsp
New file
0,0 → 1,50
 
 
<div id="demoApp" ng-app="demoApp" ng-controller="demoAppController">
 
 
 
<script>
 
var demoApp = angular.module('demoApp', []);
GLOBAL_BacoAngularAppDependencies.push('demoApp');
 
 
demoApp.controller('demoAppController', function ($scope) {
 
$scope.testeSuper = "testeSuper";
 
$scope.data =
{
comps : [
{
"@class" : "directive_class",
"name" : "componente de teste"
}
]
}
 
}
);
 
</script>
 
 
<h1>Campo testeSuper no mainmodule "{{testeSuper}}"</h1>
<h1>Campo data.comps[0].name no mainmodule "{{data.comps[0].name}}"</h1>
 
<h2>Template chamado atraves de um template de classe intermedio</h2>
<div ng-repeat="comp in data.comps" ng-include="comp['@class']">
 
</div>
 
 
<pre>
{{testeSuper | json}}
</pre>
<pre>
{{data | json}}
</pre>
 
 
</div>
/branches/grupo2/impl/src/web/user/courses/coursereport/templates.jsp
New file
0,0 → 1,756
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultYear" %>
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultSemester" %>
<%@ page
import="pt.estgp.estgweb.services.courses.coursereport.documentmodel.learningresults.components.UnitsLearningResultUc" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
 
<!--
@section objeto com seccoes e componentes
@optional @chapter capitulo do documento para esta seccao para contcatenar às subsections
-->
 
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_CourseUnitsReportsSection">
<div class="sections">
<a name="indexCus"></a>
<span ng-repeat="cu in section.sections" ng-init="cu.taxaAprovacao = 100 * cu.courseUnitEvaluation.numAlunosAprovTotal/(cu.courseUnitEvaluation.numAlunosInscritos - cu.courseUnitEvaluation.numAlunosSemElementosAvaliacao)">
<a href="#cu{{$index}}" ng-class="{ 'alert-danger': (cu.courseUnitEvaluation.cumprimentoProgramaPercent &lt; 100) || cu.taxaAprovacao &lt; 75 || !cu.courseUnitEvaluation.closed || !cu.courseUnitEvaluation.teacherComplete}">
{{cu.title}}
</a> |
</span>
<div ng-repeat="cu in section.sections"
class="section panel-primary">
 
<a name="cu{{$index}}"></a>
<span ng-if="$index != 0" class="glyphicon glyphicon-backward" ></span><a ng-if="$index != 0" href="#indexCus"> Voltar atrás</a>
<div class="panel-heading"><h2>{{cu.title}}</h2></div>
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Estado do Relatório</label></h3></div>
 
<div ng-if="cu.courseUnitEvaluation.closed">
Entregue e Aceite
</div>
<div class="alert-danger" ng-if="cu.courseUnitEvaluation.closed && !cu.courseUnitEvaluation.teacherComplete">
Entregue mas não foi aprovado pela comissão
</div>
<div class="alert-danger" ng-if="!cu.courseUnitEvaluation.closed && !cu.courseUnitEvaluation.teacherComplete">
Não foi entregue pelo docente para validação
</div>
 
</div>
 
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Resultados</label></h3></div>
<div>
<table class="tablesorter-blue" width="100%">
<tr>
<th rowspan="2">
Nº Alunos Inscritos
</th>
<th rowspan="2">
Nº de alunos sem elementos de avaliação
</th>
<th colspan="5">
Nº de alunos aprovados em
</th>
<th colspan="2">
Aprovados com a classificação entre 10 e 13 valores
</th>
<th colspan="2">
Aprovados com a classificação entre 14 e 16 valores
</th>
<th colspan="2">
Aprovados com a classificação entre 17 e 20 valores
</th>
</tr>
<tr>
<th>Avaliação de frequência</th>
<th>Exame Época Normal</th>
<th>Exame Época Recurso</th>
<th>Exame Época Especial</th>
<th>Total</th>
<th>Nº</th>
<th>%</th>
<th>Nº</th>
<th>%</th>
<th>Nº</th>
<th>%</th>
</tr>
<tr>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosInscritos}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosSemElementosAvaliacao}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovFrequencia}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovNormal}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovRecurso}}
</td>
<td style="text-align: center">
{{cu.courseUnitEvaluation.numAlunosAprovEspecial}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprovTotal}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1013}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1013Percent}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1416}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1416Percent}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1720}}
</td>
<td class="text-center">
{{cu.courseUnitEvaluation.numAlunosAprov1720Percent}}
</td>
</tr>
</table>
</div>
</div>
 
<div style="padding-left:20px" >
<div><h3><label class="label label-primary">Taxa de Aprovação</label></h3></div>
<div ng-class="{ 'alert-danger': cu.taxaAprovacao &lt; 75 }">{{cu.taxaAprovacao}}%</div>
</div>
 
 
 
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação dos resultados quantitativos obtidos pelos estudantes</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoQuantitivos}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação do funcionamento da UC</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoUC}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Percentagem de cumprimento do programa da UC</label></h3></div>
<div ng-class="{ 'alert-danger': (cu.courseUnitEvaluation.cumprimentoProgramaPercent &lt; 100) }">
{{cu.courseUnitEvaluation.cumprimentoProgramaPercent}}%
</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Apreciação do cumprimento do programa da UC</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualApreciacaoCumprimentoPrograma}}</div>
</div>
<div style="padding-left:20px">
<div><h3><label class="label label-primary">Conclusões</label></h3></div>
<div>{{cu.courseUnitEvaluation.qualConclusoes}}</div>
</div>
</div>
</div>
</script>
 
 
 
<style>
.dtpstats td, .dtpstats th{
text-align: center !important;
}
</style>
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_reportucsummary_UnitsDtpTable">
<div class="sections">
 
<table class="table dtpstats">
<thead>
<tr>
<th rowspan="2">Unidade Curricular</th>
<th colspan="2">Planeamento</th>
<th rowspan="2">Ficha Curricular</th>
<th rowspan="2">Sumários</th>
<th colspan="2">Avaliação</th>
<th rowspan="2">Relatório de Avaliação</th>
<th rowspan="2">Inquerito Pedagógico</th>
</tr>
<tr>
<th>Conteúdos</th>
<th>Calendarização</th>
<th>Enunciados</th>
<th>Pautas</th>
</tr>
</thead>
<tbody>
<tr>
<th colspan="9">Semestre 1</th>
</tr>
<tr ng-repeat="dtpStat in comp.semester1.courseUnitDtpStats">
<td>{{dtpStat.name}}</td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoConteudos }"><input type="checkbox" ng-model="dtpStat.planeamentoConteudos"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoCalendarizacao }"><input type="checkbox" ng-model="dtpStat.planeamentoCalendarizacao"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.ficha }"><input type="checkbox" ng-model="dtpStat.ficha"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.sumarios }"><input type="checkbox" ng-model="dtpStat.sumarios"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoEnunciados }"><input type="checkbox" ng-model="dtpStat.avaliacaoEnunciados"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoPautas }"><input type="checkbox" ng-model="dtpStat.avaliacaoPautas"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.relatorio }"><input type="checkbox" ng-model="dtpStat.relatorio"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.inquerito }"><input type="checkbox" ng-model="dtpStat.inquerito"/></td>
</tr>
<tr>
<th colspan="9">Semestre 2</th>
</tr>
<tr ng-repeat="dtpStat in comp.semester2.courseUnitDtpStats">
<td>{{dtpStat.name}}</td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoConteudos }"><input type="checkbox" ng-model="dtpStat.planeamentoConteudos"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.planeamentoCalendarizacao }"><input type="checkbox" ng-model="dtpStat.planeamentoCalendarizacao"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.ficha }"><input type="checkbox" ng-model="dtpStat.ficha"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.sumarios }"><input type="checkbox" ng-model="dtpStat.sumarios"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoEnunciados }"><input type="checkbox" ng-model="dtpStat.avaliacaoEnunciados"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.avaliacaoPautas }"><input type="checkbox" ng-model="dtpStat.avaliacaoPautas"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.relatorio }"><input type="checkbox" ng-model="dtpStat.relatorio"/></td>
<td ng-class="{ 'alert-danger' : !dtpStat.inquerito }"><input type="checkbox" ng-model="dtpStat.inquerito"/></td>
</tr>
</tbody>
</table>
</div>
</script>
 
 
 
<style>
.learning td
{
font-size: 0.7em;
}
.learning td input{
width: 50px;
}
 
.learning td input:read-only{
width: 50px;
background-color: #cccccc;
}
.learning tr.year td {
vertical-align: top;
background-color: #aaaaaa;
 
font-weight: bold;
}
.learning tr.period td {
vertical-align: top;
background-color: #dfdfdf;
 
}
</style>
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_UnitsLearningResultsTable">
<unitslearningresultstable>
</unitslearningresultstable>
</script>
 
 
 
<script>
angular.module("courseReportApp").directive('boundModel', function() {
return {
require: 'ngModel',
link: function(scope, elem, attrs, ngModel) {
scope.$watch(attrs.boundModel, function(newValue, oldValue) {
if(newValue != oldValue) {
ngModel.$setViewValue(newValue);
ngModel.$render();
}
});
}
}
});
angular.module("courseReportApp").directive('unitslearningresultstable', function() {
 
return {
restrict: 'E',
link: function($scope, element, attrs)
{
 
$scope.checkedDocuments = [];
$scope.checkUnit = function(document,collection)
{
if(document.checked)
{
var docContainer =
{
"document" : document,
"collection" : collection
}
$scope.checkedDocuments.push(docContainer);
}
else
{
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
if(documentContainer.document == document)
{
var index = $scope.checkedDocuments.indexOf(documentContainer);
$scope.checkedDocuments.splice(index, 1);
}
});
}
}
$scope.changeDocumentCollection = function(collection)
{
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
collection.ucs.push(documentContainer.document);
delete documentContainer.document.checked;
});
angular.forEach($scope.checkedDocuments, function(documentContainer, key)
{
var index = documentContainer.collection.ucs.indexOf(documentContainer.document);
documentContainer.collection.ucs.splice(index, 1);
});
$scope.checkedDocuments = [];
}
$scope.avg = function(field,container, childs)
{
if(!childs || childs.length == 0)
return 0;
var sum = 0;
var c;
for(c in childs)
{
if(childs[c] && childs[c][field])
sum += 1*childs[c][field];
}
container[field] = sum / childs.length;
return container[field];
}
$scope.percent = function(n,total)
{
if(!n || n == 0 || !total || total == 0)
return 0;
return 100 * n / total;
}
$scope.reprovados = function(comp)
{
if(comp.alunosInscritos && comp.semElementos && comp.aprovados)
return comp.alunosInscritos - comp.semElementos - comp.aprovados;
return 0;
}
$scope.removeComponent = function(index,list)
{
list.splice(index,1);
}
$scope.hasYearUnits = function(year)
{
for(s in year.semesters)
{
if(year.semesters[s].ucs && year.semesters[s].ucs.length > 0)
return true;
}
return false;
}
$scope.isInvalidAnfHaveUcs = function(year,years,index)
{
if(year.ano > 0)
return false;
 
var s;
for(s in year.semesters)
{
if(year.semesters[s].ucs && year.semesters[s].ucs.length > 0)
return true;
}
years.splice(index,1);
return false;
}
$scope.addUc = function(semestre)
{
semestre.ucs.push(
{
"@class" : "<%=UnitsLearningResultUc.class.getName()%>",
manual : true,
periodo : semestre.semestre,
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
sigesCode : 0
}
);
}
$scope.addAno = function(comp)
{
if(!comp.years)
comp.years = [];
comp.years.push(
{
ano : 1,
"@class" : "<%=UnitsLearningResultYear.class.getName()%>",
manual : true,
"alunosInscritos": 0,
"aprovados": 0,
"aprovados1013": 0,
"aprovados1013Percent": 0,
"aprovados1416": 0,
"aprovados1416Percent": 0,
"aprovados1720": 0,
"aprovados1720Percent": 0,
"aprovadosPercent": 0,
"cumprimentoProgramaPercent": 0,
"reprovados": 0,
"reprovadosPercent": 0,
"semElementos": 0,
"semElementosPercent": 0,
semesters : [
{
"@class" : "<%=UnitsLearningResultSemester.class.getName()%>",
manual : true,
semestre : "S1",
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
ucs : []
},
{
"@class" : "<%=UnitsLearningResultSemester.class.getName()%>",
manual : true,
semestre: "S2",
alunosInscritos: 0,
aprovados: 0,
aprovados1013: 0,
aprovados1013Percent: 0,
aprovados1416: 0,
aprovados1416Percent: 0,
aprovados1720: 0,
aprovados1720Percent: 0,
aprovadosPercent: 0,
cumprimentoProgramaPercent: 0,
reprovados: 0,
reprovadosPercent: 0,
semElementos: 0,
semElementosPercent: 0,
ucs : []
}
]
}
);
}
 
},
templateUrl: function(elem,attrs) {
return "unitslearningresultstable";
}
}
});
</script>
<script type="text/ng-template" id="unitslearningresultstable">
 
 
<div class="sections">
<button class="btn btn-success" ng-click="addAno(comp)"><span class="glyphicon glyphicon-plus"></span> Ano Manual</button>
<table class="table learning">
<thead>
<tr>
<th rowspan="2">Mover</th>
<th rowspan="2">Código</th>
<th rowspan="2">Unidade Curricular</th>
<th rowspan="2">Cumprimento do Programa</th>
<th rowspan="2">Alunos Inscritos</th>
<th colspan="2">Sem Elementos</th>
<th colspan="2">Reprovados</th>
<th colspan="2">Aprovados</th>
<th colspan="2">Aprovados 10-13</th>
<th colspan="2">Aprovados 14-16</th>
<th colspan="2">Aprovados 17-20</th>
</tr>
<tr>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
<th>N</th>
<th>%</th>
</tr>
</thead>
<tbody>
<tr colspan="17" ng-if="false" ng-repeat-start="year in comp.years"></tr>
<tr class="year">
<td colspan="3" ng-if="year.ano &gt; 0">
 
<button ng-disabled="hasYearUnits(year)" class="btn btn-danger btn-xs" ng-click="removeComponent($index,comp.years)"><span class="glyphicon glyphicon-remove"></span></button>
<span ng-if="!year.manual">{{year.ano}}ª ano</span>
<span ng-if="year.manual">
<select ng-model="year.ano" ng-options="c.v as c.n for c in [{v:1,n:'1º Ano'},{v:2,n:'2º Ano'},{v:3,n:'3º Ano'},{v:4,n:'4º Ano'},{v:5,n:'5º Ano'}]">
</select>
</span>
 
</td>
<td colspan="3" style="font-size: 1.0em !important" ng-if="isInvalidAnfHaveUcs(year,comp.years,$index)">
Unidades que não constam do plano (Verifique a situação com os serviços Académicos antes de continuar)
poderão constar de um plano antigo ou ter o código siges desatualizado.
</td>
<td><input readonly="true" type="number" ng-model="year.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.alunosInscritos" bound-model="avg('alunosInscritos',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.semElementos" bound-model="avg('semElementos',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.semElementosPercent" bound-model="percent(year.semElementos,year.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="year.reprovados" bound-model="reprovados(year)"></td>
<td><input readonly="true" type="number" ng-model="year.reprovadosPercent" bound-model="percent(year.reprovados,year.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados" bound-model="year.aprovados1013*1 + year.aprovados1416*1 + year.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="year.aprovadosPercent" bound-model="percent(year.aprovados,year.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="year.aprovados1013" bound-model="avg('aprovados1013',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1013Percent" bound-model="percent(year.aprovados1013,year.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1416" bound-model="avg('aprovados1416',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1416Percent" bound-model="percent(year.aprovados1416,year.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1720" bound-model="avg('aprovados1720',year,year.semesters)"></td>
<td><input readonly="true" type="number" ng-model="year.aprovados1720Percent" bound-model="percent(year.aprovados1720,year.aprovados)"></td>
</tr>
 
<tr ng-if="false" ng-repeat-start="s in year.semesters" ></tr>
<tr class="period" ng-if="year.ano &gt; 0 || s.ucs.length > 0">
<td colspan="3" class="period">Semestre {{s.semestre}} <button ng-click="changeDocumentCollection(s)" data-toggle="tooltip" title="Mover unidades para aqui" class="btn btn-xs btn-warning" ng-show="checkedDocuments.length"><span class="glyphicon glyphicon-arrow-left"></span></button>
 
<button class="btn btn-success pull-right" ng-click="addUc(s)"><span class="glyphicon glyphicon-plus"></span> UC Manual</button>
</td>
<td><input readonly="true" type="number" ng-model="s.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.alunosInscritos" bound-model="avg('alunosInscritos',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.semElementos" bound-model="avg('semElementos',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.semElementosPercent" bound-model="percent(s.semElementos,s.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="s.reprovados" bound-model="reprovados(s)"></td>
<td><input readonly="true" type="number" ng-model="s.reprovadosPercent" bound-model="percent(s.reprovados,s.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados" bound-model="s.aprovados1013*1 + s.aprovados1416*1 + s.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="s.aprovadosPercent" bound-model="percent(s.aprovados,s.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="s.aprovados1013" bound-model="avg('aprovados1013',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1013Percent" bound-model="percent(s.aprovados1013,s.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1416" bound-model="avg('aprovados1416',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1416Percent" bound-model="percent(s.aprovados1416,s.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1720" bound-model="avg('aprovados1720',s,s.ucs)"></td>
<td><input readonly="true" type="number" ng-model="s.aprovados1720Percent" bound-model="percent(s.aprovados1720,s.aprovados)"></td>
</tr>
<tr ng-repeat="u in s.ucs" ng-class="{'alert-danger': u.error}" >
<td><input ng-model="u.error" type="hidden" bound-model="u.alunosInscritos < (u.aprovados*1 + u.semElementos*1)">
<input ng-model="u.checked" ng-click="checkUnit(u,s)" type="checkbox"></td>
<td><input type="text" ng-readonly="!u.manual || u.manual == false" ng-model="u.sigesCode"></td>
<td>
 
<input type="text" style="width: 150px" ng-if="!(!u.manual || u.manual == false)" ng-model="u.name">
<span ng-if="(!u.manual || u.manual == false)">{{u.name}}</span>
<button class="btn btn-danger btn-xs pull-right" ng-if="!(!u.manual || u.manual == false)" ng-click="removeComponent(index,s.ucs)"><span class="glyphicon glyphicon-remove"></span></button>
</td>
<td><input type="number" ng-model="u.cumprimentoProgramaPercent"></td>
<td><input type="number" ng-model="u.alunosInscritos"></td>
<td><input type="number" ng-model="u.semElementos"></td>
<td><input readonly="true" type="number" ng-model="u.semElementosPercent" bound-model="percent(u.semElementos,u.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="u.reprovados" bound-model="reprovados(u)"></td>
<td><input readonly="true" type="number" ng-model="u.reprovadosPercent" bound-model="percent(u.reprovados,u.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados" bound-model="u.aprovados1013*1 + u.aprovados1416*1 + u.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="u.aprovadosPercent" bound-model="percent(u.aprovados,u.alunosInscritos)"></td>
 
<td><input type="number" ng-model="u.aprovados1013"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1013Percent" bound-model="percent(u.aprovados1013,u.aprovados)"></td>
<td><input type="number" ng-model="u.aprovados1416"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1416Percent" bound-model="percent(u.aprovados1416,u.aprovados)"></td>
<td><input type="number" ng-model="u.aprovados1720"></td>
<td><input readonly="true" type="number" ng-model="u.aprovados1720Percent" bound-model="percent(u.aprovados1720,u.aprovados)"></td>
</tr>
<tr ng-if="false" ng-repeat-end></tr>
<tr ng-if="false" ng-repeat-end></tr>
<tr class="year">
<td colspan="3">Resultados Globais</td>
 
 
<td><input readonly="true" type="number" ng-model="comp.cumprimentoProgramaPercent" bound-model="avg('cumprimentoProgramaPercent',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.alunosInscritos" bound-model="avg('alunosInscritos',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.semElementos" bound-model="avg('semElementos',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.semElementosPercent" bound-model="percent(comp.semElementos,comp.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="comp.reprovados" bound-model="reprovados(comp)"></td>
<td><input readonly="true" type="number" ng-model="comp.reprovadosPercent" bound-model="percent(comp.reprovados,comp.alunosInscritos)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados" bound-model="comp.aprovados1013*1 + comp.aprovados1416*1 + comp.aprovados1720*1"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovadosPercent" bound-model="percent(comp.aprovados,comp.alunosInscritos)"></td>
 
<td><input readonly="true" type="number" ng-model="comp.aprovados1013" bound-model="avg('aprovados1013',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1013Percent" bound-model="percent(comp.aprovados1013,comp.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1416" bound-model="avg('aprovados1416',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1416Percent" bound-model="percent(comp.aprovados1416,comp.aprovados)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1720" bound-model="avg('aprovados1720',comp,comp.years)"></td>
<td><input readonly="true" type="number" ng-model="comp.aprovados1720Percent" bound-model="percent(comp.aprovados1720,comp.aprovados)"></td>
</tr>
</tbody>
</table>
<%--<pre class="code">{{ comp | json }}</pre>--%>
</div>
</script>
 
 
 
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_GlobalLearningResultsChartImg">
<globallearningresultschartimg>
</globallearningresultschartimg>
</script>
<script>
angular.module("courseReportApp").directive('globallearningresultschartimg', function() {
 
return {
restrict: 'E',
link: function($scope, element, attrs)
{
$scope.generateChart = function(comp)
{
 
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/courseReport.do",
"generateGlobalLearningResultsChartImg",
{
"courseReportDocument" : BacoJS.stringifyOrdered(angular.element($("#courseReportApp")).scope().report)
},
"#courseReportApp",
function(repositoryFile4JsonView)
{
comp.image = repositoryFile4JsonView;
comp.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + comp.image.identifier + "?" + new Date().getTime();
angular.element($("#courseReportApp")).scope().$apply();
},
function(){}
);
}
 
 
},
templateUrl: function(elem,attrs) {
return "globallearningresultschartimg";
}
}
});
</script>
<script type="text/ng-template" id="globallearningresultschartimg">
<div class="imageComponent component">
 
<div class="componentBody">
<div class="form-group clearfix">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<button class="btn btn-default" ng-click="generateChart(comp)">Refrescar/Gerar Gráfico</button>
</div>
<div class="col-md-10">
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img ng-if="comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
<img ng-if="!comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{'<%=request.getContextPath()%>/repositoryStream/' + comp.image.identifier}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
</div>
</div>
</div>
</div>
</script>
 
 
<script type="text/ng-template" id="pt_estgp_estgweb_services_courses_coursereport_documentmodel_learningresults_components_GlobalLearningResultsChartYearImg">
<globallearninglesultschartyearimg>
</globallearninglesultschartyearimg>
</script>
 
<script>
angular.module("courseReportApp").directive('globallearninglesultschartyearimg', function() {
 
return {
restrict: 'E',
link: function($scope, element, attrs)
{
$scope.generateChart = function(comp)
{
 
widgetCallWithActionParameters(
"<%=request.getContextPath()%>/user/courseReport.do",
"generateGlobalLearningResultsChartYearImg",
{
"courseReportDocument" : BacoJS.stringifyOrdered(angular.element($("#courseReportApp")).scope().report)
},
"#courseReportApp",
function(repositoryFile4JsonView)
{
comp.image = repositoryFile4JsonView;
comp.imageUrl = "<%=request.getContextPath()%>/repositoryStream/" + comp.image.identifier + "?" + new Date().getTime();
angular.element($("#courseReportApp")).scope().$apply();
},
function(){}
);
}
 
 
},
templateUrl: function(elem,attrs) {
return "globallearningresultschartimg";
}
}
});
</script>
<script type="text/ng-template" id="globallearninglesultschartyearimg">
<div class="imageComponent component">
 
<div class="componentBody">
<div class="form-group clearfix">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<button class="btn btn-default" ng-click="generateChart(comp)">Refrescar/Gerar Gráfico</button>
</div>
<div class="col-md-10">
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img ng-if="comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
<img ng-if="!comp.imageUrl" style="width: 100%;height: 100%" ng-src="{{'<%=request.getContextPath()%>/repositoryStream/' + comp.image.identifier}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
</div>
</div>
</div>
</div>
</script>
/branches/grupo2/impl/src/web/user/courses/courseReportEdit.jsp
326,12 → 326,13
 
<div class="form-vertical">
<div id="courseReportApp" ng-app="courseReportApp" ng-controller="courseReportAppController">
<div class="web-messages"></div>
 
<div ng-init="section=report;" ng-include="'pt_estgp_estgweb_utils_documentBuilder_DocumentSection'">
 
</div>
 
<!-- <pre class="code">{{ report | json }}</pre>-->
<pre class="code">{{ report | json }}</pre>
 
 
 
/branches/grupo2/impl/src/web/user/utils/documentsBuilder.jsp
1,5 → 1,9
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<style>
.sections
{
padding-left: 20px;
}
.buttonTools
{
border: 1px solid gray;
23,7 → 27,12
}
</style>
 
<!--Require templateObj-->
<script type="text/ng-template" id="callDocumentTemplate">
 
<div ng-include="class2id(templateObj)"></div>
</script>
 
<%--
customPane Need component customPane in variable customPane
docAppSelector selector usualy an html ID for ng-app example #docReport
46,37 → 55,36
<div class="clearfix" ng-repeat="subComp in comp.components" ng-init="parent=comp;comp=subComp" ng-include="class2id(subComp)">
 
</div>
<div>
</div>
</div>
</script>
 
<script type="text/ng-template" id="pt_estgp_estgweb_utils_documentBuilder_ImageComponent">
<div class="imageComponent component">
<div ng-if="parent['@class']=='pt.estgp.estgweb.utils.documentBuilder.CustomPane'" class="buttonTools clearfix">
<button class="btn btn-danger pull-right" type="button" ng-click="removeComponent($index,parent.components)">
<span class="glyphicon glyphicon-remove"></span>
</button>
<label>Componente de Imagem (Use esta funcinalidade para adicionar gráficos ou tabelas que ache necessárias)</label>
<button class="btn btn-danger pull-right" type="button" ng-click="removeComponent($index,parent.components)">
<span class="glyphicon glyphicon-remove"></span>
</button>
<label>Componente de Imagem (Use esta funcinalidade para adicionar gráficos ou tabelas que ache necessárias)</label>
</div>
 
<div class="componentBody" ng-if="comp['@class']=='pt.estgp.estgweb.utils.documentBuilder.ImageComponent'">
<div class="form-group clearfix" ng-if="comp.image.identifier">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
<div class="componentBody">
<div class="form-group clearfix" ng-if="comp.image.identifier">
<label class="col-md-2 control-label">Legenda</label>
<div class="col-md-10">
<input type="text" class="form-control" rows="10" ng-model="comp.title">
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<a class="btn btn-default" href="#" ng-model="comp"
data-title="Escolha Imagem"
data-showmetafields="false"
data-confirmonupload="true"
data-toggle="modal"
data-target="#filesUploadModal"
data-multiple="false"
data-allowed-extensions="jpg,png,gif"
data-callback-target-function="angular.element($('{{docAppSelector}}')).scope().callbackUploadedFiles">
</div>
<div class="form-group clearfix">
<div class="col-md-2 control-label">
<a class="btn btn-default" href="#" ng-model="comp"
data-title="Escolha Imagem"
data-showmetafields="false"
data-confirmonupload="true"
data-toggle="modal"
data-target="#filesUploadModal"
data-multiple="false"
data-allowed-extensions="jpg,png,gif"
data-callback-target-function="angular.element($('{{docAppSelector}}')).scope().callbackUploadedFiles">
<span ng-if="comp.image.identifier">
Substituir Imagem
</span>
84,26 → 92,26
Carregar Imagem
</span>
 
<span class="glyphicon glyphicon-upload"/>
<span class="glyphicon glyphicon-upload"/>
 
</a>
</a>
</div>
 
<div class="col-md-10">
<div ng-if="!(comp.image.identifier)">
Clique em carregar imagens e escolha uma imagem para adicionar nesta secção.
</div>
 
<div class="col-md-10">
<div ng-if="!(comp.image.identifier)">
Clique em carregar imagens e escolha uma imagem para adicionar nesta secção.
</div>
 
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
<label ng-if="comp.image.identifier"> Limites do PDF </label>
<div ng-if="comp.image.identifier" style="text-align: center; width: 595px; border: 1px solid black; padding: 45px">
<center>
<div style="width: 200px;height: 200px; max-width: 500px; max-height: 750px" resizable on-resize="resize($evt, $ui, comp)">
<img style="width: 100%;height: 100%" ng-src="{{comp.imageUrl}}">
</div>
(Se desejar altere o tamanho da imagem arrastando no canto inferior direito)
</center>
</div>
</div>
</div>
</div>
</div>
135,4 → 143,33
</div>
</div>
</div>
</script>
</script>
 
<!--
@section objeto com seccoes e componentes
@optional @chapter capitulo do documento para esta seccao para contcatenar às subsections
-->
<script type="text/ng-template" id="pt_estgp_estgweb_utils_documentBuilder_DocumentSection">
<div class="sections">
<ul class="nav nav-tabs">
<li ng-model="section" class="separatorSectionNav"
ng-class="{ active : subSection.active}"
ng-repeat="subSection in section.sections">
<a ng-click="showSep(section,subSection)"> {{$chapter}}{{$index+1}} - {{subSection.title}}</a>
</li>
</ul>
<div ng-model="subSection"
ng-class="{ hidden: !subSection.active }"
ng-repeat="subSection in section.sections"
class="separatorSection clearfix">
<div ng-repeat="comp in subSection.components"
ng-include="class2id(comp)">
 
</div>
<div ng-if="subSection.sections"
ng-init="section=subSection;$chapter=$chapter+($index+1)+'.'"
ng-include="class2id(subSection)">
</div>
</div>
</div>
</script>