Пример #1
0
<?php

include "../lib/start.php";
check_session();
check_permission(ADM_PERM);
header("Content-type: text/plain");
$sel_classi = "SELECT id_classe FROM classi ORDER BY id_classe";
try {
    $res_classi = $db->executeQuery($sel_classi);
} catch (MySQLException $ex) {
    print "ko;" . $ex->getQuery() . ";" . $ex->getMessage();
    exit;
}
$sel_anno = "SELECT * FROM anni ORDER BY id_anno DESC LIMIT 1";
$res_anno = $db->executeQuery($sel_anno);
$year = new AnnoScolastico($res_anno->fetch_assoc());
$anno = $year->get_ID();
while ($classe = $res_classi->fetch_assoc()) {
    $sel_materie = "SELECT id_materia FROM materie WHERE id_materia != 999 AND (id_materia < 12 OR id_materia > 20) ORDER BY id_materia";
    $res_materie = $db->executeQuery($sel_materie);
    while ($mat = $res_materie->fetch_assoc()) {
        $ins = "INSERT INTO cdc (id_anno, id_classe, id_docente, id_materia) VALUES ({$anno}, " . $classe['id_classe'] . ", NULL, " . $mat['id_materia'] . ")";
        try {
            $rs = $db->executeUpdate($ins);
        } catch (MySQLException $ex) {
            print "ko;" . $ex->getQuery() . ";" . $ex->getMessage();
            exit;
        }
    }
}
print "ok;";
Пример #2
0
check_permission(ADM_PERM);
/*
 * controllo per la presenza del nuovo anno
 */
$count = 0;
$sel_year = "SELECT COUNT(*) FROM anni WHERE data_inizio > NOW()";
try {
    $count = $db->executeCount($sel_year);
} catch (MySQLException $ex) {
    $ex->redirect();
}
/*
 * ultimo anno in archivio: controlli per evitare duplicazioni
 */
$sel_anno = "SELECT * FROM anni ORDER BY id_anno DESC LIMIT 1";
$res_anno = $db->executeQuery($sel_anno);
$year = new AnnoScolastico($res_anno->fetch_assoc());
$anno = $year->get_ID();
$quadrimestre = 1;
if (date("Ymd") > format_date($year->get_fine_quadrimestre(), IT_DATE_STYLE, SQL_DATE_STYLE, "")) {
    $quadrimestre = 2;
}
$sel_cdc = "SELECT COUNT(*) FROM cdc WHERE id_anno = {$anno}";
$exist_cdc = $db->executeCount($sel_cdc);
$sel_reg = "SELECT COUNT(*) FROM reg_classi WHERE id_anno = {$anno}";
$exist_reg = $db->executeCount($sel_reg);
$sel_sch = "SELECT COUNT(*) FROM orario WHERE anno = {$anno}";
$exist_sch = $db->executeCount($sel_sch);
$check_data = "SELECT COUNT(*) FROM scrutini WHERE anno = {$anno} AND quadrimestre = {$quadrimestre}";
$count_data = $db->executeCount($check_data);
include "index.html.php";
Пример #3
0
     		<tr>
     			<td colspan="2" style="text-align: right; margin-right: 50px; padding-bottom: 30px"><a href="index.php">Torna al menu</a></td>
     		</tr>
        </table>
    </div>
    	<div id="footer">
		<p>Design: Luka Cvrk - <a href="http://www.solucija.com" title="Free Web Templates">Solucija</a></p>
	</div>
	</div>		
</body>
</html>

<?php 
$sel_anno = "SELECT * FROM anni ORDER BY id_anno DESC LIMIT 1";
$res_anno = $db->executeQuery($sel_anno);
$anno = new AnnoScolastico($res_anno->fetch_assoc());
// calcolo del numero di queries
$num_classi = 34;
$first_day = format_date($anno->get_data_inizio_lezioni(), IT_DATE_STYLE, SQL_DATE_STYLE, "-");
$last_day = format_date($anno->get_data_termine_lezioni(), IT_DATE_STYLE, SQL_DATE_STYLE, "-");
$current_day = format_date($anno->get_data_inizio_lezioni(), IT_DATE_STYLE, SQL_DATE_STYLE, "-");
$days = 0;
while (strtotime($current_day) < strtotime($last_day)) {
    if (date("w", strtotime($current_day)) == "0") {
        // do nothing
    } else {
        $days++;
    }
    //print("$insert -> Inserito record per $current_day</br>");
    $current_day = date("Y-m-d", strtotime("{$current_day} +1 days"));
}
Пример #4
0
<?php

include "../lib/start.php";
check_session();
check_permission(ADM_PERM);
$action = "insert";
if (isset($_REQUEST['do'])) {
    $action = $_REQUEST['do'];
}
$sel_anno = "SELECT * FROM anni ORDER BY id_anno DESC LIMIT 1";
$res_anno = $db->executeQuery($sel_anno);
$year = new AnnoScolastico($res_anno->fetch_assoc());
if ($action == update) {
    $hol = array();
    foreach ($year->get_holydays() as $a) {
        $month = substr($a, 5, 2);
        if (!isset($hol[$month])) {
            $hol[$month] = array();
        }
        array_push($hol[$month], $a);
    }
}
include "new_year.html.php";