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

Commit

Permalink
Aggiunta orario
Browse files Browse the repository at this point in the history
Aggiunta la visualizzazione dell'orario
Aggiunti gli obiettivi nei voti
Cambiata la barra per la navigazione da mobile
  • Loading branch information
Lettly committed Oct 5, 2019
1 parent 40ad966 commit 0b44769
Show file tree
Hide file tree
Showing 16 changed files with 371 additions and 21 deletions.
2 changes: 2 additions & 0 deletions api/ajax/comunicazioni.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
header('Content-Type: text/plane; charset=utf-8');

// server should keep session data for AT LEAST 1 hour
ini_set('session.gc_maxlifetime', 7200);

Expand Down
2 changes: 2 additions & 0 deletions api/ajax/mediaMateria.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
header('Content-Type: text/plane; charset=utf-8');

// server should keep session data for AT LEAST 1 hour
ini_set('session.gc_maxlifetime', 7200);

Expand Down
41 changes: 41 additions & 0 deletions api/ajax/orario.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
header('Content-Type: text/plane; charset=utf-8');

// server should keep session data for AT LEAST 1 hour
ini_set('session.gc_maxlifetime', 7200);

// each client should remember their session id for EXACTLY 1 hour
session_set_cookie_params(7200);

session_start(); // ready to go!

//Controllo login
if (strpos($_SERVER['PHP_SELF'], 'login') === false) {
if (empty($_SESSION["cookies"]["__AntiXsrfToken"]) || empty($_SESSION["cookies"]["ASP.NET_SessionId"]) || $_SESSION["expire"] < time()){
header("location: /login?page=".$_SERVER['PHP_SELF']);
exit;
}
}

include "../../vendor/autoload.php";
include "../class.php";

use DiDom\Document;
use DiDom\Query;
use DiDom\Element;

$axios = new axios;

$axios->postREFamilyData = $_SESSION["getPostREFamily"];
$axios->QuadrimestreFT = $_COOKIE["QuadrimestreFT"];
$axios->QuadrimestreFTAll = $_SESSION["QuadrimestreFTAll"];
$axios->student = $_SESSION["getStudentId"][$_COOKIE['studentNumber']];
$axios->cookies = $_SESSION["cookies"];

$result = $axios->getSchedule();
// echo "<pre>";
// print_r($result);
// var_dump($result);
echo json_encode($result);


2 changes: 2 additions & 0 deletions api/ajax/oreAssenza.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
header('Content-Type: text/plane; charset=utf-8');

// server should keep session data for AT LEAST 1 hour
ini_set('session.gc_maxlifetime', 7200);

Expand Down
2 changes: 2 additions & 0 deletions api/ajax/registro.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
header('Content-Type: text/plane; charset=utf-8');

// server should keep session data for AT LEAST 1 hour
ini_set('session.gc_maxlifetime', 7200);

Expand Down
2 changes: 2 additions & 0 deletions api/ajax/voti.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
header('Content-Type: text/plane; charset=utf-8');

// server should keep session data for AT LEAST 1 hour
ini_set('session.gc_maxlifetime', 7200);

Expand Down
170 changes: 167 additions & 3 deletions api/class.php
Original file line number Diff line number Diff line change
Expand Up @@ -788,10 +788,13 @@ public function getVote()
$output[$counter]["realVote"] = explode("Valore: ", $value->title)[1];//Ottieni il voto reale
$output[$counter]["vote"] = $value->text();//Ottieni il voto
break;
case '4'://Commento
case '4'://Obiettivi
$output[$counter]["target"] = $value->text();//Ottieni gli Obiettivi
break;
case '5'://Commento
$output[$counter]["comment"] = $value->text();//Ottieni il commento
break;
case '5'://Professore
case '6'://Professore
$output[$counter]["teacher"] = $value->text();//Ottieni il nome del professore
break;
}
Expand Down Expand Up @@ -1189,4 +1192,165 @@ public function getAbsencesTotalHours()
return $assenze;
}

}
public function getSchedule()
{
//Vai alla pagina delle assenze e invia il numero dello studente
$ch = curl_init("https://family.axioscloud.it/Secret/REFamily.aspx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);

curl_setopt($ch, CURLOPT_REFERER, "https://family.axioscloud.it/Secret/RELogin.aspx"); //link da cui provieni

curl_setopt($ch, CURLOPT_COOKIE, "__AntiXsrfToken=" . $this->cookies['__AntiXsrfToken'] . "; ASP.NET_SessionId=" . $this->cookies['ASP.NET_SessionId']);

curl_setopt($ch, CURLOPT_POST, 1);
$post = [
trim($this->postREFamilyData['name'][1][0], "\"") => trim($this->postREFamilyData['value'][1][0], "\""),
trim($this->postREFamilyData['name'][1][1], "\"") => trim($this->postREFamilyData['value'][1][1], "\""),
trim($this->postREFamilyData['name'][1][2], "\"") => trim($this->postREFamilyData['value'][1][2], "\""),
'__EVENTARGUMENT' => "Orario",
'__EVENTTARGET' => "FAMILY",
//Dati dell'alunno
'ctl00$ContentPlaceHolderBody$txtIDAluSelected' => $this->student['num'],
'ctl00$ContentPlaceHolderBody$txtAluSelected' => $this->student['id'],
];
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

$result = curl_exec($ch);
curl_close($ch);


//Trova la tabella
$document = new Document($result);
$tabella = $document->find('table')[3];

// $tabella->child(0)-> child(0)-> child(1)->
// ^^^0 lista giorni e date ^^^Table row (obbligatorio) ^^^1 lunedi 2 martedi...
// child(0)
// ^^^ 0 Nome girno della settimana / 2 data

// $tabella->child(1)-> child(0)->
// ^^^ 1 Dati Tabella ^^^Ora(pari) e materia(dispari)
// child(0)->
// ^^^0 (se il precedente pari)numero ora / (se il precedente dispari) giorni della settimana 0 lunedi 1 martedi...
// child(0)
// ^^^ (se il precedinte è giorni della settimana) 0 materia / 2 insegnante ... 4 materia / 6 insegnante ...

$orario = [];

//Ottieni i girni e le date della settimana
foreach ($tabella->child(0)->child(0)->children() as $key => $value) {
//ignora l'elemento data
if ($key == 0)
continue;

//ottieni giorno e data
$temp["day"] = $value->child(0)->text();
$temp["date"] = $value->child(2)->text();

//inseriscili nell'array
array_push($orario, $temp);
}

$subject = [];
$time = [];
// return $tabella->child(1)->children()[5]->children()[4]->children();
foreach ($tabella->child(1)->children() as $key => $value) {
# code...
if ($key%2) {
// Dispari Materia

$day = 0;
foreach ($value->children() as $key_giorni => $value_giorni) {
// giorni della settimana 0 lunedi 1 martedi
if (null === $subject[$day]) {
$subject[$day] = [];
}

unset($temp_array);


unset($temp);
$temp = $value_giorni->child(2);
if (!empty($temp)) {
$temp_array["schedule"][0]["teachers"] = trim($temp->text(), "/ ");

unset($temp);
$temp = $value_giorni->child(0);
$temp_array["schedule"][0]["subject"] = trim($temp->text(), "/ ");

}

unset($temp);
$temp = $value_giorni->child(4);
if (!empty($temp)) {
$temp_array["schedule"][1]["subject"] = trim($temp->text(), "/ ");
}

unset($temp);
$temp = $value_giorni->child(6);
if (!empty($temp)) {
$temp_array["schedule"][1]["teachers"] = trim($temp->text(), "/ ");
}

if (!empty($temp_array))
array_push($subject[$day], $temp_array);


if (empty($subject[$day]))
unset($subject[$day]);

$day++;
}

} else {
//Pari orario

$day = 0;
foreach ($value->children() as $key_giorni => $value_giorni) {
if ($key_giorni == 0) {
continue;
}
// giorni della settimana 0 lunedi 1 martedi
if (null === $time[$day]) {
$time[$day] = [];
}

unset($temp_array);

unset($temp);
$temp = $value_giorni->child(0)->text();
if (!empty($temp)) {
$temp_array["start"] = explode("-", $temp)[0];
$temp_array["end"] = explode("-", $temp)[1];
}


if (!empty($temp_array))
array_push($time[$day], $temp_array);


if (empty($time[$day]))
unset($time[$day]);

$day++;
}


}
// $temp["schedule"][]
}

foreach ($subject as $key => $value) {

$output[$key]["schedule"] = $value;
$output[$key]["date"] = $orario[$key];
foreach ($value as $key1 => $value1) {
$output[$key]["schedule"][$key1]["info"] = $time[$key][$key1];
}
}

return $output;
}

}
7 changes: 4 additions & 3 deletions dist/css/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ a.article:hover {
#sidebar {
margin-left: 0;
}
#sidebarCollapse span {
/* #sidebarCollapse span {
display: none;
}
} */

#sidebar ul li a {
padding: 20px 10px;
Expand All @@ -279,7 +279,7 @@ a.article:hover {
/* Swipe */
.swipe-area {
position: fixed;
width: 50px;
width: 0px;
left: 0;
top: 0;
height: 100%;
Expand All @@ -294,6 +294,7 @@ a.article:hover {
top: 0;
height: 100%;
/* background: rgba(0, 0, 0, 0.5); */

/* background: #000000; */
z-index: 0;
}
5 changes: 2 additions & 3 deletions dist/js/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if (isTouchDevice() === true) {

//Se il tasto #sidebarCollapse è premuto toogle sidebar
$(document).ready(function () {
$('#sidebarCollapse').on('click', function () {
$('.sidebarCollapse').on('click', function () {
$('#sidebar').toggleClass('active');
$('html, body').toggleClass('disable-x-scroll');
$('.swipe-area').toggleClass('swipe-area-activate');
Expand All @@ -45,8 +45,7 @@ $(".swipe-area").click(function () {
$('#sidebar').addClass('active');
$('html, body').removeClass('disable-x-scroll');
$('.swipe-area').removeClass('swipe-area-activate');
}

}
});
$(".swipe-area").swipe({
swipeStatus: function (event, phase, direction, distance, duration, fingers) {
Expand Down
9 changes: 6 additions & 3 deletions home.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,21 @@
</p>
</div>
<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>
<p>Made with <i class="fas fa-heart" style="color: #ff6b6b;"></i> by three students of Federico Caffe.</p>
<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>
</div>
<div class="jumbotron">
<h3>Changelog:</h3>
<br>
<p>
--------------(V 0.3.0)--------------<br>
<b>Aggiunta</b> la visualizzazione dell'orario<br>
<b>Aggiunti</b> gli obiettivi nei voti<br>
<b>Cambiata</b> la barra per la navigazione da mobile<br>
<small>- Aggiunti nuovi bug per sistemarli in futuro</small><br>
--------------(V 0.2.1)--------------<br>
<b>Aggiunta</b> la possibilità di avere più componenti nello stesso account<br>
<b>Aggiunta</b> una nuova visualizzazione dei voti [beta]<br>
<b>Aggiunta</b> una nuova visualizzazione del registro [beta]<br>
<small>- Aggiunti nuovi bug per sistemarli in futuro</small><br>
--------------(V 0.1.2)--------------<br>
<b>Cambiato</b> il funzionamento "tecnico" della sidebar<br>
<b>Attivate</b> alcune opzioni<br>
Expand All @@ -66,7 +70,6 @@
<br>
<p>
- Alcuni tasti della barra laterale non funzionano (Opzioni, Github, Contatti, FAQ...)<br>
- Se il tasto del menù è attivo: appare dopo qualche secondo, non istantaneamente
</p>
</div>
</div>
Expand Down
19 changes: 16 additions & 3 deletions include/navbar.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
<br>
<div class="pos-f-t d-md-none">
<!-- <div class="collapse" id="navbarToggleExternalContent">
<div style="background: #aa0836;" class="p-4">
<h5 class="text-white h4">Collapsed content</h5>
<span class="text-muted">Toggleable via the navbar brand.</span>
</div>
</div> -->
<nav style="background: #aa0836;" class="navbar navbar-dark">
<button class="navbar-toggler sidebarCollapse" type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand text-white sidebarCollapse">REDignus</a>
</nav>
</div>

<nav class="navbar d-md-none" id="tastomenu" style="display: none;">
<!-- <nav class="navbar d-md-none" id="tastomenu" style="display: none;">
<button type="button" id="sidebarCollapse" class="btn btn-outline-danger">
<i class="fas fa-align-left"></i>
Menù
</button>
</nav>
</nav> -->
6 changes: 6 additions & 0 deletions include/sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
Voti
</a>
</li>
<li>
<a href="orario">
<i class="fas fa-clock" href="orario"></i>
Orario
</a>
</li>
<li>
<a href="assenze">
<i class="fas fa-calendar-times" href="assenze"></i>
Expand Down
Loading

0 comments on commit 0b44769

Please sign in to comment.