Example #1
0
 function myList()
 {
     $sql = " select ga_id,groupe_analytique.pa_id,pa_name,ga_description " . " from groupe_analytique " . " join plan_analytique using (pa_id)";
     $r = $this->db->exec_sql($sql);
     $array = Database::fetch_all($r);
     $res = array();
     if (!empty($array)) {
         foreach ($array as $m) {
             $obj = new Anc_Group($this->db);
             $obj->get_from_array($m);
             $obj->pa_name = $m['pa_name'];
             $res[] = clone $obj;
         }
     }
     return $res;
 }
Example #2
0
//----------------------------------------------------------------------
// REMOVE
if (isset($_POST['remove'])) {
    if (isset($_POST['ck'])) {
        foreach ($_POST['ck'] as $m) {
            $obj = new Anc_Group($cn);
            $obj->ga_id = $m;
            $obj->remove();
        }
    }
}
//----------------------------------------------------------------------
// INSERT
if (isset($_POST['add'])) {
    $obj = new Anc_Group($cn);
    $obj->get_from_array($_POST);
    echo $obj->insert();
}
$array = $r->myList();
echo '<div class="content" >';
echo '<form method="post">';
echo dossier::hidden();
echo '<table class="result"  >';
echo '<tr> <th>' . _("Code") . " </th><th>" . _("Plan") . " </td><th>" . _("Description") . '</th></tr>';
foreach ($array as $idx => $m) {
    echo '<tr>';
    echo '<td>' . h($m->ga_id) . '</td>';
    echo '<td>' . h($m->pa_name) . '</td>';
    echo '<td>' . h($m->ga_description) . '</td>';
    echo '<td> Effacer <input type="Checkbox" name="ck[]" value="' . $m->ga_id . '">' . '</td>';
    echo '</tr>';