summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Luka Šijanec <sijanecantonluka@gmail.com>2019-11-08 20:36:21 +0100
committerAnton Luka Šijanec <sijanecantonluka@gmail.com>2019-11-08 20:36:21 +0100
commitcc3c85222268c0497e06432523c88bd55f31d250 (patch)
treedacb7f586f58a7b51d4e2ad78234348ce3f3ace5
parentgimsisextClientEndpoint -> gimsisextclient (diff)
downloadgimsisextclient-cc3c85222268c0497e06432523c88bd55f31d250.tar
gimsisextclient-cc3c85222268c0497e06432523c88bd55f31d250.tar.gz
gimsisextclient-cc3c85222268c0497e06432523c88bd55f31d250.tar.bz2
gimsisextclient-cc3c85222268c0497e06432523c88bd55f31d250.tar.lz
gimsisextclient-cc3c85222268c0497e06432523c88bd55f31d250.tar.xz
gimsisextclient-cc3c85222268c0497e06432523c88bd55f31d250.tar.zst
gimsisextclient-cc3c85222268c0497e06432523c88bd55f31d250.zip
-rw-r--r--main.php45
1 files changed, 44 insertions, 1 deletions
diff --git a/main.php b/main.php
index 52d4616..fc8bff8 100644
--- a/main.php
+++ b/main.php
@@ -54,7 +54,7 @@ Errors:
class gimsisextClient {
private $username;
private $password;
- public $version = array(0, 7, 1);
+ public $version = array(0, 7, 2);
private $programname = "gimsisextclient";
private $programdomain = 'gimsisextclient.gimb.tk';
private $cookiedir; // set at runtime, ker je get_curerent_user, v login()
@@ -723,5 +723,48 @@ Errors:
if(strlen($odg) < strlen($odg2)) return $odg2;
}
}
+ public function fetchocene() {
+ $ch = $this->login();
+ if(!curl_getinfo($ch)) {
+ if(!empty($ch)){return $ch;}else{return -2;}
+ }
+ curl_setopt($ch, CURLOPT_URL, $this->gimsisextocene);
+ curl_setopt($ch, CURLOPT_POST, 0);
+ $ocene_output = curl_exec($ch);
+ $xmlDoc = new DOMDocument();
+ $xmlDoc->loadHTML( $ocene_output );
+ $spanNode = $xmlDoc->getElementsByTagName( "span" );
+ $ocene = array();
+ foreach ($spanNode as $sn) {
+ if($sn->getAttribute('class') == "txtVOcObd") {
+ $is = $sn->getElementsByTagName("span")[0]; // innerspan je is, innerspantitle je pa ist, hehe
+ $ist = explode("\n", $is->getAttribute("title"));
+ $datum = explode(": ", $ist[0])[1];
+ $ucitelj = explode(": ", $ist[1])[1];
+ $predmet = explode(": ", $ist[2])[1];
+ $ocenjevanje = explode(": ", $ist[3])[1];
+ $vrsta = explode(": ", $ist[4])[1];
+ $rok = explode(": ", $ist[5])[1];
+ $ocena = DOMinnerHTML($is);
+ if(explode(" ", $is->getAttribute("class"))[1] == "ocVmesna") {
+ $zacasna = 1;
+ } else {
+ $zacasna = 0;
+ }
+ $ocene[] = array(
+ "datum" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $datum))),
+ "profesor" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $ucitelj))),
+ "predmet" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $predmet))),
+ "naslov" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $ocenjevanje))),
+ "vrsta" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $vrsta))),
+ "rok" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $rok))),
+ "rok" => str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $rok))),
+ "ocena" => intval(str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $ocena)))),
+ "zacasna" => boolval(str_replace("\n", null, str_replace("\r", null, str_replace(" ", null, $zacasna))))
+ );
+ }
+ }
+ return $ocene;
+ }
}
?>