From 0b44769dba14fcff9d47d2690e90f53de03193e9 Mon Sep 17 00:00:00 2001 From: Marco Giuseppini Date: Sat, 5 Oct 2019 18:11:25 +0200 Subject: [PATCH] Aggiunta orario Aggiunta la visualizzazione dell'orario Aggiunti gli obiettivi nei voti Cambiata la barra per la navigazione da mobile --- api/ajax/comunicazioni.php | 2 + api/ajax/mediaMateria.php | 2 + api/ajax/orario.php | 41 +++++++++ api/ajax/oreAssenza.php | 2 + api/ajax/registro.php | 2 + api/ajax/voti.php | 2 + api/class.php | 170 ++++++++++++++++++++++++++++++++++++- dist/css/sidebar.css | 7 +- dist/js/global.js | 5 +- home.php | 9 +- include/navbar.php | 19 ++++- include/sidebar.php | 6 ++ login.php | 5 +- opzioni.php | 6 +- orario.php | 104 +++++++++++++++++++++++ voti.php | 10 ++- 16 files changed, 371 insertions(+), 21 deletions(-) create mode 100644 api/ajax/orario.php create mode 100644 orario.php diff --git a/api/ajax/comunicazioni.php b/api/ajax/comunicazioni.php index bf83e69..8ea92b4 100644 --- a/api/ajax/comunicazioni.php +++ b/api/ajax/comunicazioni.php @@ -1,4 +1,6 @@ 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 "
";
+// print_r($result);
+// var_dump($result);
+echo json_encode($result);
+
+
diff --git a/api/ajax/oreAssenza.php b/api/ajax/oreAssenza.php
index 248b645..69f6e8a 100644
--- a/api/ajax/oreAssenza.php
+++ b/api/ajax/oreAssenza.php
@@ -1,4 +1,6 @@
 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;
                 }
@@ -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;
+    }
+
+}
\ No newline at end of file
diff --git a/dist/css/sidebar.css b/dist/css/sidebar.css
index 23d87c3..9d26357 100644
--- a/dist/css/sidebar.css
+++ b/dist/css/sidebar.css
@@ -252,9 +252,9 @@ a.article:hover {
     #sidebar {
         margin-left: 0;
     }
-    #sidebarCollapse span {
+    /* #sidebarCollapse span {
         display: none;
-    }
+    } */
 
     #sidebar ul li a {
         padding: 20px 10px;
@@ -279,7 +279,7 @@ a.article:hover {
 /* Swipe */
 .swipe-area {
     position: fixed;
-    width: 50px;
+    width: 0px;
     left: 0;
     top: 0;
     height: 100%;
@@ -294,6 +294,7 @@ a.article:hover {
     top: 0;
     height: 100%;
     /* background: rgba(0, 0, 0, 0.5); */
+    
     /* background: #000000; */
     z-index: 0;
 }
\ No newline at end of file
diff --git a/dist/js/global.js b/dist/js/global.js
index 1d47519..add974a 100644
--- a/dist/js/global.js
+++ b/dist/js/global.js
@@ -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');
@@ -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) {
diff --git a/home.php b/home.php
index 55f8f73..448fdaa 100644
--- a/home.php
+++ b/home.php
@@ -41,17 +41,21 @@
                             

Puoi contattarci su Telegram @REDignusHelpBot oppure se sei un po' più vecchio stile a info@redignus.it

-

Made with by three students of Federico Caffe.

+

Made with by Marco Giuseppini of Federico Caffe.

Changelog:


+ --------------(V 0.3.0)--------------
+ Aggiunta la visualizzazione dell'orario
+ Aggiunti gli obiettivi nei voti
+ Cambiata la barra per la navigazione da mobile
+ - Aggiunti nuovi bug per sistemarli in futuro
--------------(V 0.2.1)--------------
Aggiunta la possibilità di avere più componenti nello stesso account
Aggiunta una nuova visualizzazione dei voti [beta]
Aggiunta una nuova visualizzazione del registro [beta]
- - Aggiunti nuovi bug per sistemarli in futuro
--------------(V 0.1.2)--------------
Cambiato il funzionamento "tecnico" della sidebar
Attivate alcune opzioni
@@ -66,7 +70,6 @@

- Alcuni tasti della barra laterale non funzionano (Opzioni, Github, Contatti, FAQ...)
- - Se il tasto del menù è attivo: appare dopo qualche secondo, non istantaneamente

diff --git a/include/navbar.php b/include/navbar.php index 6f935eb..3d1fe51 100644 --- a/include/navbar.php +++ b/include/navbar.php @@ -1,8 +1,21 @@ -
+
+ + +
-