Skip to content
This repository was archived by the owner on Dec 6, 2022. It is now read-only.

Commit 0b44769

Browse files
committed
Aggiunta orario
Aggiunta la visualizzazione dell'orario Aggiunti gli obiettivi nei voti Cambiata la barra per la navigazione da mobile
1 parent 40ad966 commit 0b44769

16 files changed

Lines changed: 371 additions & 21 deletions

api/ajax/comunicazioni.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
header('Content-Type: text/plane; charset=utf-8');
3+
24
// server should keep session data for AT LEAST 1 hour
35
ini_set('session.gc_maxlifetime', 7200);
46

api/ajax/mediaMateria.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
header('Content-Type: text/plane; charset=utf-8');
3+
24
// server should keep session data for AT LEAST 1 hour
35
ini_set('session.gc_maxlifetime', 7200);
46

api/ajax/orario.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
header('Content-Type: text/plane; charset=utf-8');
3+
4+
// server should keep session data for AT LEAST 1 hour
5+
ini_set('session.gc_maxlifetime', 7200);
6+
7+
// each client should remember their session id for EXACTLY 1 hour
8+
session_set_cookie_params(7200);
9+
10+
session_start(); // ready to go!
11+
12+
//Controllo login
13+
if (strpos($_SERVER['PHP_SELF'], 'login') === false) {
14+
if (empty($_SESSION["cookies"]["__AntiXsrfToken"]) || empty($_SESSION["cookies"]["ASP.NET_SessionId"]) || $_SESSION["expire"] < time()){
15+
header("location: /login?page=".$_SERVER['PHP_SELF']);
16+
exit;
17+
}
18+
}
19+
20+
include "../../vendor/autoload.php";
21+
include "../class.php";
22+
23+
use DiDom\Document;
24+
use DiDom\Query;
25+
use DiDom\Element;
26+
27+
$axios = new axios;
28+
29+
$axios->postREFamilyData = $_SESSION["getPostREFamily"];
30+
$axios->QuadrimestreFT = $_COOKIE["QuadrimestreFT"];
31+
$axios->QuadrimestreFTAll = $_SESSION["QuadrimestreFTAll"];
32+
$axios->student = $_SESSION["getStudentId"][$_COOKIE['studentNumber']];
33+
$axios->cookies = $_SESSION["cookies"];
34+
35+
$result = $axios->getSchedule();
36+
// echo "<pre>";
37+
// print_r($result);
38+
// var_dump($result);
39+
echo json_encode($result);
40+
41+

api/ajax/oreAssenza.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
header('Content-Type: text/plane; charset=utf-8');
3+
24
// server should keep session data for AT LEAST 1 hour
35
ini_set('session.gc_maxlifetime', 7200);
46

api/ajax/registro.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
header('Content-Type: text/plane; charset=utf-8');
3+
24
// server should keep session data for AT LEAST 1 hour
35
ini_set('session.gc_maxlifetime', 7200);
46

api/ajax/voti.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
header('Content-Type: text/plane; charset=utf-8');
3+
24
// server should keep session data for AT LEAST 1 hour
35
ini_set('session.gc_maxlifetime', 7200);
46

api/class.php

Lines changed: 167 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -788,10 +788,13 @@ public function getVote()
788788
$output[$counter]["realVote"] = explode("Valore: ", $value->title)[1];//Ottieni il voto reale
789789
$output[$counter]["vote"] = $value->text();//Ottieni il voto
790790
break;
791-
case '4'://Commento
791+
case '4'://Obiettivi
792+
$output[$counter]["target"] = $value->text();//Ottieni gli Obiettivi
793+
break;
794+
case '5'://Commento
792795
$output[$counter]["comment"] = $value->text();//Ottieni il commento
793796
break;
794-
case '5'://Professore
797+
case '6'://Professore
795798
$output[$counter]["teacher"] = $value->text();//Ottieni il nome del professore
796799
break;
797800
}
@@ -1189,4 +1192,165 @@ public function getAbsencesTotalHours()
11891192
return $assenze;
11901193
}
11911194

1192-
}
1195+
public function getSchedule()
1196+
{
1197+
//Vai alla pagina delle assenze e invia il numero dello studente
1198+
$ch = curl_init("https://family.axioscloud.it/Secret/REFamily.aspx");
1199+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
1200+
curl_setopt($ch, CURLOPT_HEADER, 1);
1201+
1202+
curl_setopt($ch, CURLOPT_REFERER, "https://family.axioscloud.it/Secret/RELogin.aspx"); //link da cui provieni
1203+
1204+
curl_setopt($ch, CURLOPT_COOKIE, "__AntiXsrfToken=" . $this->cookies['__AntiXsrfToken'] . "; ASP.NET_SessionId=" . $this->cookies['ASP.NET_SessionId']);
1205+
1206+
curl_setopt($ch, CURLOPT_POST, 1);
1207+
$post = [
1208+
trim($this->postREFamilyData['name'][1][0], "\"") => trim($this->postREFamilyData['value'][1][0], "\""),
1209+
trim($this->postREFamilyData['name'][1][1], "\"") => trim($this->postREFamilyData['value'][1][1], "\""),
1210+
trim($this->postREFamilyData['name'][1][2], "\"") => trim($this->postREFamilyData['value'][1][2], "\""),
1211+
'__EVENTARGUMENT' => "Orario",
1212+
'__EVENTTARGET' => "FAMILY",
1213+
//Dati dell'alunno
1214+
'ctl00$ContentPlaceHolderBody$txtIDAluSelected' => $this->student['num'],
1215+
'ctl00$ContentPlaceHolderBody$txtAluSelected' => $this->student['id'],
1216+
];
1217+
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
1218+
1219+
$result = curl_exec($ch);
1220+
curl_close($ch);
1221+
1222+
1223+
//Trova la tabella
1224+
$document = new Document($result);
1225+
$tabella = $document->find('table')[3];
1226+
1227+
// $tabella->child(0)-> child(0)-> child(1)->
1228+
// ^^^0 lista giorni e date ^^^Table row (obbligatorio) ^^^1 lunedi 2 martedi...
1229+
// child(0)
1230+
// ^^^ 0 Nome girno della settimana / 2 data
1231+
1232+
// $tabella->child(1)-> child(0)->
1233+
// ^^^ 1 Dati Tabella ^^^Ora(pari) e materia(dispari)
1234+
// child(0)->
1235+
// ^^^0 (se il precedente pari)numero ora / (se il precedente dispari) giorni della settimana 0 lunedi 1 martedi...
1236+
// child(0)
1237+
// ^^^ (se il precedinte è giorni della settimana) 0 materia / 2 insegnante ... 4 materia / 6 insegnante ...
1238+
1239+
$orario = [];
1240+
1241+
//Ottieni i girni e le date della settimana
1242+
foreach ($tabella->child(0)->child(0)->children() as $key => $value) {
1243+
//ignora l'elemento data
1244+
if ($key == 0)
1245+
continue;
1246+
1247+
//ottieni giorno e data
1248+
$temp["day"] = $value->child(0)->text();
1249+
$temp["date"] = $value->child(2)->text();
1250+
1251+
//inseriscili nell'array
1252+
array_push($orario, $temp);
1253+
}
1254+
1255+
$subject = [];
1256+
$time = [];
1257+
// return $tabella->child(1)->children()[5]->children()[4]->children();
1258+
foreach ($tabella->child(1)->children() as $key => $value) {
1259+
# code...
1260+
if ($key%2) {
1261+
// Dispari Materia
1262+
1263+
$day = 0;
1264+
foreach ($value->children() as $key_giorni => $value_giorni) {
1265+
// giorni della settimana 0 lunedi 1 martedi
1266+
if (null === $subject[$day]) {
1267+
$subject[$day] = [];
1268+
}
1269+
1270+
unset($temp_array);
1271+
1272+
1273+
unset($temp);
1274+
$temp = $value_giorni->child(2);
1275+
if (!empty($temp)) {
1276+
$temp_array["schedule"][0]["teachers"] = trim($temp->text(), "/ ");
1277+
1278+
unset($temp);
1279+
$temp = $value_giorni->child(0);
1280+
$temp_array["schedule"][0]["subject"] = trim($temp->text(), "/ ");
1281+
1282+
}
1283+
1284+
unset($temp);
1285+
$temp = $value_giorni->child(4);
1286+
if (!empty($temp)) {
1287+
$temp_array["schedule"][1]["subject"] = trim($temp->text(), "/ ");
1288+
}
1289+
1290+
unset($temp);
1291+
$temp = $value_giorni->child(6);
1292+
if (!empty($temp)) {
1293+
$temp_array["schedule"][1]["teachers"] = trim($temp->text(), "/ ");
1294+
}
1295+
1296+
if (!empty($temp_array))
1297+
array_push($subject[$day], $temp_array);
1298+
1299+
1300+
if (empty($subject[$day]))
1301+
unset($subject[$day]);
1302+
1303+
$day++;
1304+
}
1305+
1306+
} else {
1307+
//Pari orario
1308+
1309+
$day = 0;
1310+
foreach ($value->children() as $key_giorni => $value_giorni) {
1311+
if ($key_giorni == 0) {
1312+
continue;
1313+
}
1314+
// giorni della settimana 0 lunedi 1 martedi
1315+
if (null === $time[$day]) {
1316+
$time[$day] = [];
1317+
}
1318+
1319+
unset($temp_array);
1320+
1321+
unset($temp);
1322+
$temp = $value_giorni->child(0)->text();
1323+
if (!empty($temp)) {
1324+
$temp_array["start"] = explode("-", $temp)[0];
1325+
$temp_array["end"] = explode("-", $temp)[1];
1326+
}
1327+
1328+
1329+
if (!empty($temp_array))
1330+
array_push($time[$day], $temp_array);
1331+
1332+
1333+
if (empty($time[$day]))
1334+
unset($time[$day]);
1335+
1336+
$day++;
1337+
}
1338+
1339+
1340+
}
1341+
// $temp["schedule"][]
1342+
}
1343+
1344+
foreach ($subject as $key => $value) {
1345+
1346+
$output[$key]["schedule"] = $value;
1347+
$output[$key]["date"] = $orario[$key];
1348+
foreach ($value as $key1 => $value1) {
1349+
$output[$key]["schedule"][$key1]["info"] = $time[$key][$key1];
1350+
}
1351+
}
1352+
1353+
return $output;
1354+
}
1355+
1356+
}

dist/css/sidebar.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ a.article:hover {
252252
#sidebar {
253253
margin-left: 0;
254254
}
255-
#sidebarCollapse span {
255+
/* #sidebarCollapse span {
256256
display: none;
257-
}
257+
} */
258258

259259
#sidebar ul li a {
260260
padding: 20px 10px;
@@ -279,7 +279,7 @@ a.article:hover {
279279
/* Swipe */
280280
.swipe-area {
281281
position: fixed;
282-
width: 50px;
282+
width: 0px;
283283
left: 0;
284284
top: 0;
285285
height: 100%;
@@ -294,6 +294,7 @@ a.article:hover {
294294
top: 0;
295295
height: 100%;
296296
/* background: rgba(0, 0, 0, 0.5); */
297+
297298
/* background: #000000; */
298299
z-index: 0;
299300
}

dist/js/global.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if (isTouchDevice() === true) {
2626

2727
//Se il tasto #sidebarCollapse è premuto toogle sidebar
2828
$(document).ready(function () {
29-
$('#sidebarCollapse').on('click', function () {
29+
$('.sidebarCollapse').on('click', function () {
3030
$('#sidebar').toggleClass('active');
3131
$('html, body').toggleClass('disable-x-scroll');
3232
$('.swipe-area').toggleClass('swipe-area-activate');
@@ -45,8 +45,7 @@ $(".swipe-area").click(function () {
4545
$('#sidebar').addClass('active');
4646
$('html, body').removeClass('disable-x-scroll');
4747
$('.swipe-area').removeClass('swipe-area-activate');
48-
}
49-
48+
}
5049
});
5150
$(".swipe-area").swipe({
5251
swipeStatus: function (event, phase, direction, distance, duration, fingers) {

home.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,21 @@
4141
</p>
4242
</div>
4343
<p>Puoi contattarci su <a href="https://t.me/REDignusHelpBot">Telegram @REDignusHelpBot</a> oppure se sei un po' più vecchio stile a <a href="mailto:info@redignus.it">info@redignus.it</a></p>
44-
<p>Made with <i class="fas fa-heart" style="color: #ff6b6b;"></i> by three students of Federico Caffe.</p>
44+
<p>Made with <i class="fas fa-heart" style="color: #ff6b6b;"></i> by <a href="https://giuseppini.me/">Marco Giuseppini</a> of Federico Caffe.</p>
4545
</div>
4646
<div class="jumbotron">
4747
<h3>Changelog:</h3>
4848
<br>
4949
<p>
50+
--------------(V 0.3.0)--------------<br>
51+
<b>Aggiunta</b> la visualizzazione dell'orario<br>
52+
<b>Aggiunti</b> gli obiettivi nei voti<br>
53+
<b>Cambiata</b> la barra per la navigazione da mobile<br>
54+
<small>- Aggiunti nuovi bug per sistemarli in futuro</small><br>
5055
--------------(V 0.2.1)--------------<br>
5156
<b>Aggiunta</b> la possibilità di avere più componenti nello stesso account<br>
5257
<b>Aggiunta</b> una nuova visualizzazione dei voti [beta]<br>
5358
<b>Aggiunta</b> una nuova visualizzazione del registro [beta]<br>
54-
<small>- Aggiunti nuovi bug per sistemarli in futuro</small><br>
5559
--------------(V 0.1.2)--------------<br>
5660
<b>Cambiato</b> il funzionamento "tecnico" della sidebar<br>
5761
<b>Attivate</b> alcune opzioni<br>
@@ -66,7 +70,6 @@
6670
<br>
6771
<p>
6872
- Alcuni tasti della barra laterale non funzionano (Opzioni, Github, Contatti, FAQ...)<br>
69-
- Se il tasto del menù è attivo: appare dopo qualche secondo, non istantaneamente
7073
</p>
7174
</div>
7275
</div>

0 commit comments

Comments
 (0)