<?php require_once('includes/requirecompere.inc.php'); require_once('includes/requirepost.inc.php'); $qn_id=TPOST('qn_id'); $action=TPOST('action'); $qn_name=TPOST('qn_name'); $qn_desc=TPOST('qn_desc'); $mb_id=current_mb_id(); if ($action=='modify' && !$qn_id) { redirect("./"); return; } $DBConn->connect(); $questionnaire_addable=get_compere_limit($DBConn,$mb_id,'questionnaire.count')-db_count_compere_questionnaire($DBConn,$mb_id); $errorareas=iif_array4(array( array(!$qn_name,'ERROR-NAME-INVALID',array(0)), array(!$qn_desc,'ERROR-DESC-INVALID',array(0)), array($action=='addnew' && $questionnaire_addable<=0,'ERROR-COUNT-LIMIT',array(0)) )); if (count_true_entries($errorareas)>0) { $_SESSION['reserv.inputcache.domain']='questionnaire.'.$action; $_SESSION['reserv.inputcache.data']=array( 'qn_id'=>$qn_id, 'qn_name'=>$qn_name, 'qn_desc'=>$qn_desc ); $_SESSION['reserv.inputcache.errorareas']=$errorareas; if ($action=='addnew') redirect("qx-cmd-questionnaire.addnew-op-revise.html"); else redirect("qx-cmd-questionnaire.modify-qn_id-".$qn_id."-op-revise.html"); return; } $DBConn->begin(true); if ($action=='addnew') { db_insert_questionnaire($DBConn,$mb_id,$qn_name,$qn_desc); redirect("qx-cmd-question.manage-focus-questionnaire-op-questionnaire.saved.html"); } else if ($action=='modify') { db_update_questionnaire($DBConn,$qn_id,$mb_id,$qn_name,$qn_desc); redirect("qx-cmd-question.manage-focus-questionnaire-qn_id-".$qn_id."-op-questionnaire.saved.html"); } $DBConn->commit(); ?>