Esempio n. 1
0
//Affiche le calendrier
minicals($year, $month, $day, $id_groupe, 'consultation.php?');
echo "</div>\n";
//echo "<td style=\"text-align:center;\">\n";
//echo "<td class=\"ct_col_centre\" style=\"text-align:center;\">\n";
// Modification Régis : la colonne centrale doit être à la fin pour que son contenu se positionne entre les 2 autres
echo "<div class=\"ct_col_centre\">\n";
echo "<p>\n";
echo "<span class='grand'>Cahier de textes";
if ($current_group) {
    echo " - {$matiere_nom} ({$matiere_nom_court})";
}
if ($id_classe != null) {
    echo "<br />{$classe_nom}";
} elseif (isset($id_groupe) && is_numeric($id_groupe)) {
    $tmp_tab = get_classes_from_id_groupe($id_groupe);
    if (isset($tmp_tab['classlist_string'])) {
        echo "<br />" . $tmp_tab['classlist_string'];
    }
}
echo "</span>\n";
// Test si le cahier de texte est partagé
//if ($current_group) {
if ($current_group && isset($selected_eleve_classe)) {
    //echo "<br />\n<strong>(";
    echo "<br />\n<strong>(";
    $i = 0;
    foreach ($current_group["profs"]["users"] as $prof) {
        if ($i != 0) {
            echo ", ";
        }
Esempio n. 2
0
/**
 * Crée un formulaire avec une zone de sélection contenant les groupes 
 * 
 * $id_ref peut être soit l'ID d'une classe, auquel cas on affiche tous les groupes pour la classe,
 * soit le login d'un élève, auquel cas on affiche tous les groupes pour l'élève en question
 * 
 * @param text $link lien vers la page à atteindre ensuite
 * @param int|text $id_ref Id d'une classe ou login d'un élève
 * @param int|text $current Id de la classe courante
 * @param int $year Année
 * @param type $month Mois
 * @param type $day Jour
 * @param text $special
 * @return text La balise <form>
 */
function make_matiere_select_html($link, $id_ref, $current, $year, $month, $day, $special = '')
{
    // Pour le multisite, on doit récupérer le RNE de l'établissement
    $prof = "";
    $rne = isset($_GET['rne']) ? $_GET['rne'] : (isset($_POST['rne']) ? $_POST['rne'] : 'aucun');
    $aff_input_rne = $aff_get_rne = NULL;
    if ($rne != 'aucun') {
        $aff_input_rne = '<input type="hidden" name="rne" value="' . $rne . '" />' . "\n";
        $aff_get_rne = '&amp;rne=' . $rne;
    }
    $out_html = "<form id=\"matiere\"  method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">\n" . $aff_input_rne . "\n\n\t<h2 class='h2_label'> \n<label for=\"enseignement\"><strong><em>Matière :<br /></em></strong></label>\n</h2>\n<p>\n<select id=\"enseignement\" name=\"matiere\" onchange=\"matiere_go()\">\n ";
    if (is_numeric($id_ref)) {
        $out_html .= "<option value=\"" . $link . "?&amp;year=" . $year . "&amp;month=" . $month . "&amp;day=" . $day . "&amp;id_classe={$id_ref}\">(Choisissez un enseignement)</option>\n";
        if ($special != '') {
            $selected = "";
            if ($special == 'Toutes_matieres') {
                $selected = " selected='TRUE'";
            }
            if (is_numeric($id_ref)) {
                $link2 = "{$link}?&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;id_classe={$id_ref}&amp;id_groupe=Toutes_matieres" . $aff_get_rne;
            } else {
                $link2 = "{$link}?&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;login_eleve={$id_ref}&amp;id_groupe=Toutes_matieres" . $aff_get_rne;
            }
            $out_html .= "<option {$selected} value=\"{$link2}\"{$selected}>Toutes les matières</option>\n";
        }
        $sql = "select DISTINCT g.id, g.name, g.description from j_groupes_classes jgc, groupes g, ct_entry ct where (" . "jgc.id_classe='" . $id_ref . "' and " . "g.id = jgc.id_groupe and " . "jgc.id_groupe = ct.id_groupe" . ") order by g.name";
    } else {
        $out_html .= "<option value=\"" . $link . "?&amp;year=" . $year . "&amp;month=" . $month . "&amp;day=" . $day . "&amp;login_eleve={$id_ref}\">(Choisissez un enseignement)</option>\n";
        if ($special != '') {
            $selected = "";
            if ($special == 'Toutes_matieres') {
                $selected = " selected='TRUE'";
            }
            if (is_numeric($id_ref)) {
                $link2 = "{$link}?&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;id_classe={$id_ref}&amp;id_groupe=Toutes_matieres" . $aff_get_rne;
            } else {
                $link2 = "{$link}?&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;login_eleve={$id_ref}&amp;id_groupe=Toutes_matieres" . $aff_get_rne;
            }
            $out_html .= "<option {$selected} value=\"{$link2}\"{$selected}>Toutes les matières</option>\n";
        }
        $sql = "select DISTINCT g.id, g.name, g.description from j_eleves_groupes jec, groupes g, ct_entry ct where (" . "jec.login='******' and " . "g.id = jec.id_groupe and " . "jec.id_groupe = ct.id_groupe" . ") order by g.name";
    }
    $res = sql_query($sql);
    if ($res) {
        for ($i = 0; $row = sql_row($res, $i); $i++) {
            $test_prof = "SELECT nom, prenom FROM j_groupes_professeurs j, utilisateurs u WHERE (j.id_groupe='" . $row[0] . "' and u.login=j.login) ORDER BY nom, prenom";
            $res_prof = sql_query($test_prof);
            $chaine = "";
            for ($k = 0; $prof = sql_row($res_prof, $k); $k++) {
                if ($k != 0) {
                    $chaine .= ", ";
                }
                $chaine .= htmlspecialchars($prof[0]) . " " . mb_substr(htmlspecialchars($prof[1]), 0, 1) . ".";
            }
            $selected = $row[0] == $current ? "selected=\"selected\"" : "";
            if (is_numeric($id_ref)) {
                $link2 = "{$link}?&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;id_classe={$id_ref}&amp;id_groupe={$row['0']}" . $aff_get_rne;
            } else {
                $link2 = "{$link}?&amp;year={$year}&amp;month={$month}&amp;day={$day}&amp;login_eleve={$id_ref}&amp;id_groupe={$row['0']}" . $aff_get_rne;
            }
            $out_html .= "<option {$selected} value=\"{$link2}\" title=\"" . htmlspecialchars($row[2] . " - ") . " " . $chaine;
            $tmp_tab = get_classes_from_id_groupe($row[0]);
            if (isset($tmp_tab['classlist_string'])) {
                $out_html .= " en " . $tmp_tab['classlist_string'];
            }
            $out_html .= "\">" . htmlspecialchars($row[2] . " - ") . " " . $chaine . "</option>";
        }
    }
    $out_html .= "\n</select>\n</p>\n\n\t\n\t<script type=\"text/javascript\">\n\t<!--\n\tfunction matiere_go()\n\t{\n\t\tbox = document.forms[\"matiere\"].matiere;\n\t\tdestination = box.options[box.selectedIndex].value;\n\t\tif (destination) location.href = destination;\n\t}\n\t// -->\n\t</script>\n\t\n\t<noscript><p>\n";
    if (is_numeric($id_ref)) {
        $out_html .= "<input type=\"hidden\" name=\"id_classe\" value=\"{$id_ref}\" />\n";
    } else {
        $out_html .= "<input type=\"hidden\" name=\"login_eleve\" value=\"{$id_ref}\" />\n";
    }
    $out_html .= "<input type=\"hidden\" name=\"year\" value=\"{$year}\" />\n\t\t<input type=\"hidden\" name=\"month\" value=\"{$month}\" />\n\t\t<input type=\"hidden\" name=\"day\" value=\"{$day}\" />\n\t\t<input type=\"submit\" value=\"OK\" />\n\t\t</p>\n\t</noscript>\n\t</form>\n";
    return $out_html;
}