get('roleid'); $viewer = new Vtiger_Viewer(); $viewer->assign('MODULE', 'Home'); $viewer->assign('SELECTED_MENU_CATEGORY', 'MARKETING'); $viewer->assign('COMPANY_LOGO', Vtiger_CompanyDetails_Model::getInstanceById()->getLogo()); $viewer->assign('COMPANY_DETAILS_SETTINGS',new Settings_Vtiger_CompanyDetails_Model()); $viewer->assign('USER_MODEL', $current_user); $viewer->assign('CURRENT_USER_MODEL', $current_user); $viewer->assign('PAGETITLE','Creation'); $viewer->view('CustomDashboard.tpl'); if(isset($_POST['update'])) { $reseau = implode("::", $_POST['reseau'] ); $adb->pquery("UPDATE ent_qcm SET libelle_qcm = '".htmlentities($_POST['libelle'], ENT_QUOTES, "UTF-8")."' , date_debut = '". $_POST['dateD'] ."', date_fin = '". $_POST['dateF'] ."', heure_debut = '". $_POST['heureD'] ."', heure_fin = '". $_POST['heureF'] ."' ,type = '".htmlentities($_POST['type'], ENT_QUOTES, "UTF-8")."' , duree ='". $_POST['duree'] ."' ,reseau='".$reseau."' ,forme='".addslashes($_POST['forme'])."' ,memo='".addslashes($_POST['memo'])."' WHERE code_qcm='".$_SESSION['idExamen']."'"); $a=1; for ($x = 0; $x < sizeof($_POST['question']); $x++) { if($_POST['ids'][$x] <> 0){ $tableau="checkboxcChoix".$_POST['ids'][$x]; $comma_separated = implode("::", $_POST[$tableau]); $checkboxcChoix=$comma_separated; $adb->pquery("UPDATE lignes_qcm SET ordre ='".$_POST['ordre'][$x]."', question ='".htmlentities($_POST['question'][$x], ENT_QUOTES, "UTF-8")."', choix1 ='".htmlentities($_POST['choix1'][$x], ENT_QUOTES, "UTF-8")."' , choix2 ='".htmlentities($_POST['choix2'][$x], ENT_QUOTES, "UTF-8")."' , choix3 ='".htmlentities($_POST['choix3'][$x], ENT_QUOTES, "UTF-8")."', choix4 ='".htmlentities($_POST['choix4'][$x], ENT_QUOTES, "UTF-8")."', choix5 ='".htmlentities($_POST['choix5'][$x], ENT_QUOTES, "UTF-8")."', correction ='".$checkboxcChoix."', note ='".$_POST['note'][$x]."' where code_ligne='".$_POST['ids'][$x]."' and code_ent_qcm='".$_SESSION['idExamen']."'"); }else{ $tableau="checkboxcChoix".$a; $comma_separated = implode("::", $_POST[$tableau]); $checkboxcChoix=$comma_separated; $query2 = "INSERT INTO `lignes_qcm` (`ordre` , `code_ent_qcm`, `question`, `choix1`, `choix2`,`choix3`, `choix4`, `choix5`,`correction`,`note`) VALUES ('".$_POST['ordre'][$x]."','".$_SESSION['idExamen']."','".htmlentities($_POST['question'][$x], ENT_QUOTES, "UTF-8")."','".htmlentities($_POST['choix1'][$x], ENT_QUOTES, "UTF-8")."','".htmlentities($_POST['choix2'][$x], ENT_QUOTES, "UTF-8")."' ,'".htmlentities($_POST['choix3'][$x], ENT_QUOTES, "UTF-8")."','".htmlentities($_POST['choix4'][$x], ENT_QUOTES, "UTF-8")."' ,'".htmlentities($_POST['choix5'][$x],ENT_QUOTES, "UTF-8")."','".$checkboxcChoix."','".$_POST['note'][$x]."');"; $adb->query($query2); $a=$a+1; } } header("Location: index.php?module=QCMExamen&view=QCMExamen"); } if(isset($_POST['submit'])) { $_SESSION["idExamen"]=$_POST['idExamen']; $idExamen=$_SESSION["idExamen"]; $query3= "SELECT * FROM `ent_qcm` where code_qcm='".$idExamen."'"; $sql_get_result3 = $adb->query($query3); $recordinfo = $adb->fetch_array($sql_get_result3); $Examen[] = $recordinfo; $query4= "SELECT * FROM `lignes_qcm` where code_ent_qcm='".$idExamen."'"; $sql_get_result4 = $adb->query($query4); $lignesQuestion = array(); while ($recordinfo = $adb->fetch_array($sql_get_result4)) { $lignesQuestion[] = $recordinfo; } } function result($lignesQuestion){ echo '