示例#1
0
	<?php 
    }
    ?>
</div>

<div class="clearfix"></div>
	<?php 
    if (strpos($page['reponses'][0]['nom_reponse'], 'textarea') == false) {
        ?>
	
 	<input  type="hidden" name="id_item" value="<?php 
        echo $page['item']['id_item'];
        ?>
"/>
 	<?php 
        if (has_resulat_item($page['item']['id_item']) || on_test($page['item']['id_item']) || $page['item']['id_etat'] > 2) {
            ?>
  	<input style="margin-bottom:7px;" type="button" name="crea_score" value="Enregistrer" class="btn-info disabled small"/>  
  	<?php 
        } else {
            ?>
   <input style="margin-bottom:7px;" type="submit" name="crea_score" value="Enregistrer" class="btn-info small"/> 
  	<?php 
        }
        ?>
  	<?php 
    }
    ?>
  	<input  type="hidden" name="revision" value="<?php 
    echo $page['item']['revision'];
    ?>
示例#2
0
function reponse_item()
{
    global $page;
    global $item;
    global $message;
    $page['message'] = "";
    $page['gabarit'] = "administration";
    if (isset($_SESSION['role_user']) && droit_acces($item['reponse_item'], $_SESSION['role_user'])) {
        $page['vue'] = "items/reponse_item.vue.php";
        $page['colonne'] = "items/sidebar_item.vue.php";
        $page['items'] = liste_item();
        if (isset($_GET['id'])) {
            $id = $_GET['id'];
        }
        if (isset($_POST['id_item'])) {
            $id = $_POST['id_item'];
        }
        if (is_proprietaire($id) || is_admin($_SESSION['id_user'])) {
            $page['dimension'] = liste_dimension();
            $page['item'] = get_item($id);
            $page['item'] = $page['item'][0];
            $page['reponses'] = get_reponse_item($id);
            $page['reponses_score'] = get_reponse_score_item($id);
            $page['0reponses'] = get_0reponse_item($id);
            $page['reponse_order'] = array();
            if (isset($page['reponses'][0]['nom_reponse'])) {
                $prec = $page['reponses'][0]['nom_reponse'];
                $page['reponse_order'][0]['nom_reponse'] = $prec;
                $i = 0;
                $nom_rep = array();
                $nom_rep[] = $prec;
                foreach ($page['reponses'] as $key => $rep) {
                    if ($prec != $rep['nom_reponse']) {
                        $i++;
                        $prec = $rep['nom_reponse'];
                        $page['reponse_order'][$i]['nom_reponse'] = $prec;
                        $nom_rep[] = $prec;
                    }
                    $page['reponse_order'][$i]['reponses'][] = $rep;
                }
                if (has_resulat_item($id) || on_test($id) || $page['item']['id_etat'] > 2) {
                    $page['message'] = $message['item_edition_disabled'];
                }
            }
            if (isset($_POST['crea_score'])) {
                if (is_current_version_item($_POST['id_item'], $_POST['revision'])) {
                    if (!has_resulat_item($_POST['id_item']) && !on_test($_POST['id_item']) && $page['item']['id_etat'] <= 2) {
                        update_revision_item($_POST['id_item']);
                        delete_dim_reponse_item($_POST['id_item']);
                        $i = 0;
                        $post = $_POST[$_POST['id_item']];
                        foreach ($_POST['dim'] as $val) {
                            enregistrement_non_reponse_item($_POST['id_item'], $_POST['dim'][$i], $post['score_0_rep'][$i]);
                            $i++;
                        }
                        if (isset($_POST['radio_elem'])) {
                            enregistrement_nb_rep_max($_POST['id_item'], 1);
                            $o = 0;
                            foreach ($page['reponses'] as $rep) {
                                $post = $_POST[$o];
                                $i = 0;
                                enregistrer_position_reponse($rep['id_reponse'], $post['position_rep']);
                                foreach ($post['dim'] as $val) {
                                    enregistement_dim_rep($_POST['id_item'], $rep['id_reponse'], $post['dim'][$i], $post['score_rep'][$i], $post['score_non_rep'][$i]);
                                    $i++;
                                }
                                $o++;
                            }
                        } elseif (isset($_POST['input_text'])) {
                            //enregistrement_nb_rep_max($_POST['id_item'],1);
                            $o = 0;
                            $reponses = explode(';', $_POST['combinaison']);
                            delete_reponse_item($_POST['id_item']);
                            foreach ($reponses as $rep) {
                                $id_rep = enregistrement_reponse_item($_POST['name_item'], $rep, $_POST['id_item']);
                                $post = $_POST[$_POST['id_item']];
                                $i = 0;
                                foreach ($post['dim'] as $val) {
                                    enregistement_dim_rep($_POST['id_item'], $id_rep, $post['dim'][$i], $post['score_rep'][$i], $post['score_non_rep'][$i]);
                                    $i++;
                                }
                                $o++;
                            }
                            if ($page['message'] == "") {
                                header("Location: index.php?controleur=item&tache=reponse_item&id=" . $_POST['id_item']);
                            }
                        } elseif (isset($_POST['type_check'])) {
                            $o = 0;
                            foreach ($page['reponses'] as $rep) {
                                $post = $_POST[$o];
                                enregistrer_position_reponse($rep['id_reponse'], $post['position_rep']);
                                $o++;
                            }
                            if (isset($_POST['nb_rep_max']) && $_POST['nb_rep_max'] >= 2) {
                                enregistrement_nb_rep_max($_POST['id_item'], $_POST['nb_rep_max']);
                            } else {
                                $page['message'] = $message['erreur_nb_max'];
                            }
                            if ($_POST['type_check'] == "combi") {
                                $o = 0;
                                if (isset($_POST['nb_rep_max']) && $_POST['nb_rep_max'] >= 2) {
                                    enregistrement_nb_rep_max($_POST['id_item'], $_POST['nb_rep_max']);
                                    foreach ($nom_rep as $nom) {
                                        $post = $_POST[$o];
                                        $id_combi = enregistrement_combinaison($_POST['id_item']);
                                        if (sizeof($_POST[$nom . '_combinaison']) >= 2) {
                                            foreach ($_POST[$nom . '_combinaison'] as $combi) {
                                                enregistrement_combinaison_reponse($id_combi, $combi);
                                            }
                                            $i = 0;
                                            foreach ($post['dim'] as $val) {
                                                if (isset($post['dim'][$i]) && isset($post['score_demi_rep_combi'][$i]) && isset($post['score_non_rep_combi'][$i]) && isset($post['score_rep_combi'][$i])) {
                                                    enregistement_dim_rep_combi($_POST['id_item'], $id_combi, $post['dim'][$i], $post['score_rep_combi'][$i], $post['score_non_rep_combi'][$i], $post['score_demi_rep_combi'][$i]);
                                                }
                                                $i++;
                                            }
                                        } else {
                                            $page['message'] = $message['erreur_combi'];
                                        }
                                    }
                                }
                                if ($page['message'] == "") {
                                    header("Location: index.php?controleur=item&tache=reponse_item&id=" . $_POST['id_item']);
                                }
                            } elseif ($_POST['type_check'] == "simple") {
                                if (isset($_POST['nb_rep_max']) && $_POST['nb_rep_max'] >= 1) {
                                    $o = 0;
                                    enregistrement_nb_rep_max($_POST['id_item'], $_POST['nb_rep_max']);
                                    for ($o = 0; $o < sizeof($page['reponses']); $o++) {
                                        $post = $_POST[$o];
                                        $i = 0;
                                        foreach ($post['dim'] as $val) {
                                            if (isset($post['dim'][$i]) && isset($post['score_rep'][$i]) && isset($post['score_non_rep'][$i])) {
                                                enregistement_dim_rep($_POST['id_item'], $page['reponses'][$o]['id_reponse'], $post['dim'][$i], $post['score_rep'][$i], $post['score_non_rep'][$i]);
                                            }
                                            $i++;
                                        }
                                    }
                                } else {
                                    $page['message'] = $message['erreur_nb_max'];
                                }
                                if ($page['message'] == "") {
                                    header("Location: index.php?controleur=item&tache=reponse_item&id=" . $_POST['id_item']);
                                }
                            }
                        } elseif (isset($_POST['type_trou']) && $_POST['type_trou'] == "simple") {
                            $o = 0;
                            foreach ($_POST['combinaisons'] as $rep) {
                                $post = $_POST[$_POST['id_item']];
                                $i = 0;
                                foreach ($post['dims'] as $val) {
                                    enregistement_dim_rep($_POST['id_item'], $rep, $post['dims'][$i], $post['score_rep'][$i], $post['score_non_rep'][$i]);
                                    $i++;
                                }
                                $o++;
                            }
                            if ($page['message'] == "") {
                                header("Location: index.php?controleur=item&tache=reponse_item&id=" . $_POST['id_item']);
                            }
                        } elseif (isset($_POST['type_trou']) && $_POST['type_trou'] == "combi") {
                            $o = 0;
                            $post = $_POST[$_POST['id_item']];
                            for ($i = 1; $i <= $_POST['nb_sequence']; $i++) {
                                $id_combi = enregistrement_combinaison($_POST['id_item'], 1);
                                foreach ($_POST['sequence_' . $i] as $combi) {
                                    enregistrement_combinaison_reponse($id_combi, $combi);
                                }
                                $x = 0;
                                foreach ($post['dim'] as $val) {
                                    enregistement_dim_rep_combi($_POST['id_item'], $id_combi, $post['dim'][$x], $post['score_rep_combi'][$x], $post['score_non_rep_combi'][$x], 0);
                                    $x++;
                                }
                            }
                            if ($page['message'] == "") {
                                header("Location: index.php?controleur=item&tache=reponse_item&id=" . $_POST['id_item']);
                            }
                        }
                    } else {
                        $page['message'] = $message['item_edition_disabled'];
                    }
                } else {
                    $page['message'] = $message['outdated_item'];
                }
            }
        } else {
            $page['message'] = $message['non_proprietaire'];
        }
    } else {
        $page['vue'] = "erreur_droit.vue.php";
    }
}
示例#3
0
    		
<textarea style="display:none" id="content_item_html" name="content_item" rows="15" cols="15">

</textarea>
<div id="result_item"  >
<?php 
foreach ($page['item']['reponse'] as $r) {
    echo "<input type='hidden' name='repitem_" . $r['nom_reponse'] . "'  value='" . htmlentities($r['libelle_reponse']) . "'/>";
}
foreach ($page['item']['media'] as $m) {
    echo "<input type='hidden' name='media[]'  value='" . $m['url_media'] . "'/>";
}
?>
</div>
<?php 
if (!has_resulat_item($page['item']['id_item']) && !on_test($page['item']['id_item']) && $page['item']['id_etat'] <= 2) {
    ?>
    		<input style="margin-bottom: 7px;margin-top: 7px;" class="btn-info small" type="submit" name="edit_item"  onclick="javascript:item_to_img();" value="Enregistrer"/>
<input style="margin-bottom: 7px;margin-top: 7px;" class="btn-suppr small" type="button"  onclick="javascript:remove_all();" value="Effacer"/>
    		<?php 
} else {
    ?>
    		
    		<input style="margin-bottom: 7px;margin-top: 7px;" class="btn-info small disabled" type="button" name="edit_item"  value="Enregistrer"/>
<input style="margin-bottom: 7px;margin-top: 7px;" class="btn-suppr small disabled" type="button"  value="Effacer"/>
  
    		<?php 
}
?>
    		<input   type="hidden" id="couleur_item" name="couleur_item" value=""/>
    		<input   type="hidden" name="id_item" value="<?php