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

Commit

Permalink
Rework Generale
Browse files Browse the repository at this point in the history
Aggiunta sistema ajax su voti e registro.
Aggiunta la sezione circolari.
Aggiunta la possibilità di avere più componenti nello stesso account.
  • Loading branch information
Lettly committed Sep 5, 2019
1 parent 0f79fb5 commit 40ad966
Show file tree
Hide file tree
Showing 2,340 changed files with 1,164,525 additions and 468 deletions.
37 changes: 37 additions & 0 deletions api/ajax/comunicazioni.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
// 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->getCommunication();

echo json_encode($result);


2 changes: 2 additions & 0 deletions api/ajax/mediaMateria.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
$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"];

Expand Down
2 changes: 2 additions & 0 deletions api/ajax/oreAssenza.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
$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"];

Expand Down
37 changes: 37 additions & 0 deletions api/ajax/registro.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
// 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->getHomeworkFull($_GET["date"]);

echo json_encode($result);


2 changes: 2 additions & 0 deletions api/ajax/voti.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
$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"];

Expand Down
77 changes: 59 additions & 18 deletions api/class.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class setting
Maggiori informazioni sulla wiki (link)
*/
public $mysql_ip_private_key = "localhost";
public $mysql_user_private_key = "user";
public $mysql_user_private_key = "registro_elettronico";
public $mysql_password_private_key = "password";
public $mysql_database_private_key = "registro_elettronico";

Expand Down Expand Up @@ -42,6 +42,9 @@ class axios extends setting

public $postREFamilyData; //Vari input inseriti a caso nella pagina (perché axios non sa fare niente)

public $QuadrimestreFT; //Indica il periodo dell' anno, se è invalido esplode (es. FT01, FT02...)
public $QuadrimestreFTAll; //Indica tutti i periodi dell' anno [array]

public function checkKey()
{
// Create connection
Expand Down Expand Up @@ -380,6 +383,32 @@ public function getStudentId()
return $output;
}

public function getPeriodYear()
{
//Ottieni il numero dello studente
$ch = curl_init("https://family.axioscloud.it/Secret/REFamily.aspx");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 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']);

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

$document = new Document($result);

$periodi = $document->find('#ContentPlaceHolderMenu_ddlFT')[0]; //Trova La lista dei periodi dell' anno
foreach ($periodi->find('option') as $key => $value) { //Per ogni opzione nel select
if (!empty($value->getAttribute('selected'))) {
$output["selected"] = $value->getAttribute('value'); //ottieni il value (es: FT01, FT02...)
} else {
$output[] = $value->getAttribute('value'); //ottieni il value (es: FT01, FT02...)
}
}
return $output;
}

public function getHomework($date = null)
{
if ($date == null)
Expand Down Expand Up @@ -723,6 +752,8 @@ public function getVote()
trim($this->postREFamilyData['name'][1][2], "\"") => trim($this->postREFamilyData['value'][1][2], "\""),
'__EVENTARGUMENT' => "RED",
'__EVENTTARGET' => "FAMILY",
// Quadrimestre
'ctl00$ContentPlaceHolderMenu$ddlFT' => $this->QuadrimestreFT,
//Dati dell'alunno
'ctl00$ContentPlaceHolderBody$txtIDAluSelected' => $this->student['num'],
'ctl00$ContentPlaceHolderBody$txtAluSelected' => $this->student['id'],
Expand Down Expand Up @@ -776,7 +807,7 @@ public function getAverageVote()
{
//Vai alla pagina delle della tabella assenza e invia il numero dello studente
//Abilitazione delle comunicazioni
$base64id = base64_encode($this->student['id']."|AXIOSMERDA"); // base64 da inviare con l' id dello studente seguito da "|FT01"
$base64id = base64_encode($this->student['id']."|".$this->QuadrimestreFT); // base64 da inviare con l' id dello studente seguito da "|FT01"
$ch = curl_init("https://family.axioscloud.it/Secret/APP_Ajax_Get.aspx?Action=FAMILY_REGISTRO_DOCENTI_GRIGLIA&Others=".$base64id);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
Expand All @@ -786,6 +817,10 @@ public function getAverageVote()
curl_setopt($ch, CURLOPT_COOKIE, "__AntiXsrfToken=" . $this->cookies['__AntiXsrfToken'] . "; ASP.NET_SessionId=" . $this->cookies['ASP.NET_SessionId']);

curl_setopt($ch, CURLOPT_POST, 1);
$post = [
// Quadrimestre
'ctl00$ContentPlaceHolderMenu$ddlFT' => $this->QuadrimestreFT,
];

curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

Expand Down Expand Up @@ -1119,30 +1154,36 @@ public function getAbsencesTotalHours()
{
//Vai alla pagina delle della tabella assenza e invia il numero dello studente
//Abilitazione delle comunicazioni
$base64id = base64_encode($this->student['id']."|AXIOSMERDA"); // base64 da inviare con l' id dello studente seguito da "|FT01"
$ch = curl_init("https://family.axioscloud.it/Secret/APP_Ajax_Get.aspx?Action=FAMILY_REGISTRO_DOCENTI_GRIGLIA&Others=".$base64id);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$assenze = 0; //Imposta le ore di assenza a 0
foreach ($this->QuadrimestreFTAll as $key => $value) { //Per ogni periodo dell' anno aggingi le ore di assenza
$base64id = base64_encode($this->student['id']."|".$value); // base64 da inviare con l' id dello studente seguito da "|FTXX"
$ch = curl_init("https://family.axioscloud.it/Secret/APP_Ajax_Get.aspx?Action=FAMILY_REGISTRO_DOCENTI_GRIGLIA&Others=".$base64id);
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_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_COOKIE, "__AntiXsrfToken=" . $this->cookies['__AntiXsrfToken'] . "; ASP.NET_SessionId=" . $this->cookies['ASP.NET_SessionId']);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$post = [
// Quadrimestre
'ctl00$ContentPlaceHolderMenu$ddlFT' => $value,
];

curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);

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


$document = new Document($result);
$posts = $document->find('.assenza'); //trva tutto cio` che ha la casse assenza
$document = new Document($result);
$posts = $document->find('.assenza'); //trva tutto cio` che ha la casse assenza

$assenze = 0; //Imposta le ore di assenza a 0
foreach ($posts as $key => $value) { //ogni elemento trovato ottieni il testo
$ora_assenza = str_replace("A", "", $value->text()); //Rimpiazza tutte le A nelle ore per avere un intero
$assenze += $ora_assenza; //Somma alle ore di assenza
foreach ($posts as $key => $value) { //ogni elemento trovato ottieni il testo
$ora_assenza = str_replace("A", "", $value->text()); //Rimpiazza tutte le A nelle ore per avere un intero
$assenze += $ora_assenza; //Somma alle ore di assenza
}
}

return $assenze;
Expand Down
6 changes: 5 additions & 1 deletion assenze.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
$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"];

Expand Down Expand Up @@ -33,6 +35,7 @@
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">N</th>
<th scope="col">Data</th>
<th scope="col">Tipo</th>
<th scope="col">Giustificata</th>
Expand All @@ -42,7 +45,8 @@
<?php
foreach ($result as $key => $value) {
echo '<tr>
<th>' . $value["date"] . '</th>
<th>' . ($key+1) . '</th>
<td>' . $value["date"] . '</td>
<td>' . $value["type"] . '</td>
<td>' . $value["justified"] . '</td>
</tr>';
Expand Down
2 changes: 2 additions & 0 deletions comunicazioni.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
$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"];

Expand Down
6 changes: 5 additions & 1 deletion dist/css/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,8 @@
.table-responsive td {
display: table-row;
}
} */
} */

.bg-voto10 {
background-image: url(../../dist/img/voto-10.gif);
}
2 changes: 1 addition & 1 deletion dist/css/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ a.article:hover {
top: 0;
height: 100%;
/* background: #f3f3f3; */
z-index: 0;
z-index: 1000;
}

.swipe-area-activate {
Expand Down
Binary file added dist/img/Dictionary-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/Logo-REDignus-1-6464.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/Logo-REDignus-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/Logo-REDignus-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dist/img/voto-10.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 0 additions & 15 deletions dist/js/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,3 @@ if (null == $.cookie("tastomenu")) {
else if ($.parseJSON($.cookie("tastomenu"))) {
$('#tastomenu').show()
}


// Add to home
function newFunction() {
window.addEventListener('beforeinstallprompt', (e) => {
// Prevent Chrome 67 and earlier from automatically showing the prompt
e.preventDefault();
// Stash the event so it can be triggered later.
deferredPrompt = e;
// Update UI notify the user they can add to home screen
btnAdd.style.display = 'block';
});
}

newFunction();
54 changes: 54 additions & 0 deletions dist/php/registro/1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<form method="get">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">Data</div>
</div>
<input name="date" type="date" value="<?php echo $_GET["date"]; ?>" class="form-control" onchange="this.form.submit()">
</div>
</form>
<br>
<div class="table-responsive">
<table class="table table-bordered">
<thead class="thead-dark">
<tr>
<th scope="col">Data</th>
<th scope="col">Argomenti</th>
<th scope="col">Compiti</th>
</tr>
</thead>
<tbody>
<?php
foreach ($result as $key => $value) {
if ((!empty($value["homework"][0]["text"])) || (!empty($value["arguments"][0]["text"]))) {
//Data
echo '<tr><th>' . $value["info"]["date"] . '<br>' . $value["info"]["day"] . '</th>';

//Argomenti
echo '<td>';
if (!empty($value["arguments"][0]["text"])) {
foreach ($value["arguments"] as $key => $argument) {
if ($key != 0) {
echo '<br>';
}
echo '<b>' . $argument["name"] . ':</b> ' . $argument["text"];
}
}
echo '</td>';

//Compiti
echo '<td>';
if (!empty($value["homework"][0]["text"])) {
foreach ($value["homework"] as $key => $homework) {
if ($key != 0) {
echo '<br>';
}
echo '<b>' . $homework["name"] . ':</b> ' . $homework["text"];
}
}
echo '</td>';
}
}
?>
</tbody>
</table>
</div>
Loading

0 comments on commit 40ad966

Please sign in to comment.