Esempio n. 1
0
function task_list()
{
    global $base_path, $msg, $charset, $type_task_id;
    $tasks = new taches();
    print "\n\t\t<script type='text/javascript'>\n\t\t\tfunction show_taches(id) {\n\t\t\t\tif (document.getElementById(id).style.display=='none') {\n\t\t\t\t\tdocument.getElementById(id).style.display='';\n\t\t\t\t} else {\n\t\t\t\t\tdocument.getElementById(id).style.display='none';\n\t\t\t\t}\n\t\t\t}\n\t\t\tfunction expand_taches_all() {";
    foreach ($tasks->types_taches as $type_tache) {
        print "if (document.getElementById('" . $type_tache->name . "').style.display=='none') {\n\t\t\t\t\t\tdocument.getElementById('" . $type_tache->name . "').style.display='';\n\t\t\t\t\t}";
    }
    print "}\n\t\t\tfunction collapse_taches_all() {";
    foreach ($tasks->types_taches as $type_tache) {
        print "if (document.getElementById('" . $type_tache->name . "').style.display=='') {\n\t\t\t\t\t\tdocument.getElementById('" . $type_tache->name . "').style.display='none';\n\t\t\t\t\t} ";
    }
    print "}\n\t\t</script>\n\t\t<script type='text/javascript' src='" . $base_path . "/javascript/tablist.js'></script>\n\t\t<a href='javascript:expand_taches_all()'><img border='0' id='expandall' src='./images/expand_all.gif'></a>\t\t\n\t\t<a href='javascript:collapse_taches_all()'><img border='0' id='collapseall' src='" . $base_path . "/images/collapse_all.gif'></a>\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<th>&nbsp;</th>\n\t\t\t\t<th>" . $msg["planificateur_type_task"] . "</th>\n\t\t\t\t<th>" . $msg["planificateur_task"] . "</th>\n\t\t\t\t<th>&nbsp;</th>\n\t\t\t</tr>";
    $pair_impair = 0;
    $parity = 0;
    //on affiche chaque type de tache
    foreach ($tasks->types_taches as $type_tache) {
        $pair_impair = $parity++ % 2 ? "even" : "odd";
        //recherche du nombre de tâches planifiées
        $n_taches = $tasks->get_nb_tasks($type_tache->id_type);
        $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"if (event) e=event; else e=window.event; if (e.srcElement) target=e.srcElement; else target=e.target; if ((target.nodeName!='IMG')&&(target.nodeName!='INPUT')) document.location='./admin.php?categ=planificateur&sub=manager&act=modif&type_task_id=" . $type_tache->id_type . "';\" ";
        print "<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer' title='" . htmlentities($type_tache->comment, ENT_QUOTES, $charset) . "' alter='" . htmlentities($type_tache->comment, ENT_QUOTES, $charset) . "' id='tr" . $type_tache->id_type . "'><td>" . ($n_taches ? "<img src='images/plus.gif' class='img_plus' onClick='if (event) e=event; else e=window.event; e.cancelBubble=true; if (e.stopPropagation) e.stopPropagation(); show_taches(\"" . addslashes($type_tache->name) . "\"); '/>" : "&nbsp;") . "</td><td>" . htmlentities($type_tache->comment, ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>" . $n_taches . " " . $msg["planificateur_count_tasks"] . "</td><td style='text-align:right'><input type='button' value='" . $msg["planificateur_task_add"] . "' class='bouton_small' onClick='document.location=\"admin.php?categ=planificateur&sub=manager&act=task&type_task_id=" . $type_tache->id_type . "\"'/></td></tr>\n";
        print "<tr class='{$pair_impair}' style='display:none' id='" . $type_tache->name . "'><td>&nbsp;</td><td colspan='3'><table style='border:1px solid'>";
        $tasks->get_tasks($type_tache->id_type);
        print "</table></td></tr>";
    }
    print "</table>";
}