<?php require_once('includes/requirecompere.inc.php'); require_once('includes/requirepost.inc.php'); $classroominfo=array( 'clsr_id'=>TPOST('clsr_id'), 'clsr_name'=>TPOST('clsr_name'), 'clsr_desc'=>TPOST('clsr_desc') ); $mb_id=current_mb_id(); $DBConn->connect(); $DBConn->begin(true); $clsr_count=db_count_classroom($DBConn,$mb_id); $errorareas=iif_array4(array( array($classroominfo['clsr_name'],'ERROR-NAME-INVALID',array(),array(0)), array($classroominfo['clsr_desc'],'ERROR-DESC-INVALID',array(),array(0)), array(TPOST('addnew') && $clsr_count>=get_compere_limit($DBConn,$mb_id,'classroom.count'),'ERROR-COUNT-LIMIT',array(0),array()) )); $dataset+=prepare_wizard_dataset(); if (count_true_entries($errorareas)>0) { $_SESSION['reserv.inputcache.data']=$classroominfo; $_SESSION['reserv.inputcache.domain']='classroom'; $_SESSION['reserv.inputcache.errorareas']=$errorareas; if (TPOST('addnew')) redirect("qx-cmd-classroom.addnew-op-revise".$dataset['WIZARD-PARAM-DBLHYP'].".html"); else if (TPOST('modify')) redirect("qx-cmd-classroom.modify-op-revise-clsr_id-".$classroominfo['clsr_id'].$dataset['WIZARD-PARAM-DBLHYP'].".html"); } else { if (TPOST('addnew')) { $classroominfo['mb_id_owner']=$mb_id; $classroominfo['clsr_status']='VALID'; db_insert_classroom($DBConn,$classroominfo); } else if (TPOST('modify')) { $oldci=db_load_classroom($DBConn,$classroominfo['clsr_id']); if ($oldci['mb_id_owner']==$mb_id) db_update_classroom($DBConn,$classroominfo); } purge_array_by_key_prefix($_SESSION,'reserv.inputcache'); redirect("qx-cmd-classroom.manage.html",array("publishcourse"=>"qx-cmd-course.assign.classroom-cs_id-".wizard_get_data('cs_id')."-wizard-publishcourse.html")); } $DBConn->commit(); ?>