<?php require_once('includes/requirecompere.inc.php'); $op=TGET('op'); $mb_id=current_mb_id(); $qn_id=TGET('qn_id'); $focus=TGET('focus'); $dataset['QUESTION-MANAGE']=array(0); $dataset['DISPLAY-QUESTIONNAIRE-LIST']=array(0); $DBConn->connect(true); $dataset['QUESTION']=db_load_questions($DBConn,$mb_id); foreach ($dataset['QUESTION'] as &$quest) { $quest['TYPE-'.$quest['q_type']]=array(0); } $dataset['QUESTIONNAIRE']=db_load_questionnaires($DBConn,$mb_id); $qn_id_list=array_projection($dataset['QUESTIONNAIRE'],'qn_id'); $qnsizes=db_count_questionnaire_questions($DBConn,$qn_id_list); $qn_id2count=rowset2map($qnsizes,'qn_id','count'); foreach ($dataset['QUESTIONNAIRE'] as &$qn) $qn['question_count']=0+$qn_id2count[$qn['qn_id']]; $dataset['QUESTION-NONE']=$dataset['QUESTION']?array():array(0); $dataset['QUESTION-SAVED']=$op=='question.saved'?array(0):array(); $dataset['QUESTION-DELETED']=$op=='question.deleted'?array(0):array(); $dataset['focus']=$focus; $dataset['FOCUS-QUESTION']=$focus=='question' || !$focus?array(0):array(); $dataset['FOCUS-QUESTIONNAIRE']=$focus=='questionnaire'?array(0):array(); $dataset['QUESTIONNAIRE-NONE']=$dataset['QUESTIONNAIRE']?array():array(0); $dataset['QUESTIONNAIRE-SAVED']=$op=='questionnaire.saved'?array(0):array(); $dataset['QUESTIONNAIRE-DELETED']=$op=='questionnaire.deleted'?array(0):array(); $dataset['ERROR-QUESTION-SELECT-NONE']=$op=='noquestion.selected'?array(0):array(); $dataset['ERROR-QUESTIONNAIRE-SELECT-NONE']=$op=='noquestionnaire.selected'?array(0):array(); $dataset['question_addable']=get_compere_limit($DBConn,$mb_id,'question.count')-sizeof($dataset['QUESTION']); $dataset['questionnaire_addable']=get_compere_limit($DBConn,$mb_id,'questionnaire.count')-sizeof($dataset['QUESTIONNAIRE']); $dataset['QUESTION-ADDABLE']=$dataset['question_addable']>0?array(0):array(); $dataset['QUESTIONNAIRE-ADDABLE']=$dataset['questionnaire_addable']>0?array(0):array(); ?>