$valeur ) { $headers_brut .= $nom . ': ' . $valeur . "\r\n"; } return $headers_brut; } function get_EtudInfos_page($nip, $dept) { global $sco_user; global $sco_pw; global $sco_url; $donnees = array( 'code_nip' => $nip, '__ac_name' => $sco_user, '__ac_password' => $sco_pw ); // Création du contenu brut de la requête $contenu = http_build_query( $donnees ); // Définition des headers $headers = http_build_headers( array( 'Content-Type' => 'application/x-www-form-urlencoded', 'Content-Length' => strlen( $contenu) ) ); // Définition du contexte $options = array( 'http' => array( 'user_agent' => $user_agent, 'method' => 'POST', 'content' => $contenu, 'header' => $headers ) ); // Création du contexte $contexte = stream_context_create($options); // Envoi du formulaire POST $retour = file_get_contents( $sco_url . $dept . '/Scolarite/Notes/XMLgetEtudInfos', false, $contexte ); return ($retour); } function get_bulletinetud_page($nip, $sem, $dept) { global $sco_user; global $sco_pw; global $sco_url; $donnees = array( 'format' => 'xml', 'code_nip' => $nip, 'formsemestre_id' => $sem, 'version' => 'selectedevals', '__ac_name' => $sco_user, '__ac_password' => $sco_pw ); // Création du contenu brut de la requête $contenu = http_build_query( $donnees ); // Définition des headers $headers = http_build_headers( array( 'Content-Type' => 'application/x-www-form-urlencoded', 'Content-Length' => strlen( $contenu) ) ); // Définition du contexte $options = array( 'http' => array( 'user_agent' => $user_agent, 'method' => 'POST', 'content' => $contenu, 'header' => $headers ) ); // Création du contexte $contexte = stream_context_create($options); // Envoi du formulaire POST $retour = file_get_contents( $sco_url . $dept . '/Scolarite/Notes/formsemestre_bulletinetud', false, $contexte ); return ($retour); } function get_semestre_info($sem, $dept) { global $sco_user; global $sco_pw; global $sco_url; $donnees = array( 'formsemestre_id' => $sem, '__ac_name' => $sco_user, '__ac_password' => $sco_pw ); // Création du contenu brut de la requête $contenu = http_build_query( $donnees ); // Définition des headers $headers = http_build_headers( array( 'Content-Type' => 'application/x-www-form-urlencoded', 'Content-Length' => strlen( $contenu) ) ); // Définition du contexte $options = array( 'http' => array( 'user_agent' => $user_agent, 'method' => 'POST', 'content' => $contenu, 'header' => $headers ) ); // Création du contexte $contexte = stream_context_create($options); // Envoi du formulaire POST $retour = file_get_contents( $sco_url . $dept . '/Scolarite/Notes/XMLgetFormsemestres', false, $contexte ); return ($retour); } function get_all_semestres($xml_data) { $data = array(); $xml = simplexml_load_string($xml_data); foreach ($xml->insemestre as $s) { $sem = (array) $s['formsemestre_id']; $data[] = $sem[0]; } return $data; } function get_current_semestre($xml_data) { $xml = simplexml_load_string($xml_data); foreach ($xml->insemestre as $s) { if ($s['current'] == 1) $sem = (array) $s['formsemestre_id']; return ($sem[0]); } } function print_semestres_list($sems, $dept, $sem) { echo 'Semestre : '; } function print_semestre($xml_data, $sem, $dept, $show_moy=False) { $xml = simplexml_load_string($xml_data); echo '

' . $xml->etudiant['sexe'] . ' ' . $xml->etudiant['prenom'] . ' ' . $xml->etudiant['nom'] . '

'; echo '
'; $retour = get_semestre_info($sem, $dept); $xml2 = simplexml_load_string($retour); echo $xml2->formsemestre['titre_num']; echo '

'; echo ' '; if ($show_moy) { echo ''; } foreach ($xml->ue as $ue) { $coef = 0; foreach ($ue->module as $mod) { $coef += $mod['coefficient']; } echo ' '; if ($show_moy) { echo ' '; } else { echo ' '; } echo ' '; foreach ($ue->module as $mod) { echo ' '; if ($show_moy) { echo ' '; } else { echo ' '; } echo ' '; if (!$show_moy) { foreach ($mod->evaluation as $eval) { echo ''; } } } } echo '
UE Module Evaluation Note/20 Coef
Moyenne générale:' . $xml->note['value'] . '
-' . $ue['acronyme'] . ' ' . $ue->note['value'] . '' . $coef . '
' . $mod['code'] . ' ' . $mod->note['value'] . '' . $mod['coefficient'] . '
' . $eval['description'] . ' ' . $eval->note['value'] . '

'; if ($show_moy) { echo $xml->situation; } } function get_dept($nip) { global $sco_url; $dept = file_get_contents( $sco_url . 'get_etud_dept?code_nip=' . $nip); return ($dept); } echo ' Bulletin de notes '; echo '
'; $dept = get_dept($nip); if ($dept) { $retour = get_EtudInfos_page($nip, $dept); $sems = get_all_semestres($retour); $sem_current = get_current_semestre($retour); if (isset($_POST["sem"])) { $sem = $_POST["sem"]; } else { $sem = $sem_current; } print_semestres_list($sems, $dept, $sem); $retour = get_bulletinetud_page($nip, $sem, $dept); if ($sem == $sem_current) { print_semestre($retour, $sem, $dept, False); } else { print_semestre($retour, $sem, $dept, True); } $erreur=0; // Tout est OK } else { echo "Numéro étudiant inconnu : " . $nip . ". Contactez votre Chef de département."; } echo '
'; echo ' '; ?>