<?php require_once('includes/requirecompere.inc.php'); $type=TGET('type'); $idx=TGET('idx'); $lctr_id=TGET('lctr_id'); $mb_id_viewed=TGET('mb_id'); $init=TGET('init'); turnoff_mainmenu(); if ($init) { $DBConn->connect(true); $_SESSION['participant.info']['lctr_id']=$lctr_id; $_SESSION['participant.info']['data']=db_list_participants_fullinfo($DBConn,$lctr_id); $mb_ids=array_projection($_SESSION['participant.info']['data'],'mb_id'); $emails=db_load_member_emails($DBConn,$mb_ids,false); $phones=db_load_member_phones($DBConn,$mb_ids); $emailmap=rowset2multimap($emails,'mb_id','mb_email'); $phonemap=rowset2multimap($phones,'mb_id','mb_phone'); foreach ($_SESSION['participant.info']['data'] as &$par) { if ($emailmap[$par['mb_id']]) $par['mb_email']=implode("\n",$emailmap[$par['mb_id']]); if ($phonemap[$par['mb_id']]) $par['mb_phone']=implode("\n",$phonemap[$par['mb_id']]); } redirect("qx-cmd-participant.info-type-".$type."-idx-".$idx."-lctr_id-".$lctr_id.".html"); } else if (is_array($_SESSION['participant.info']) && $_SESSION['participant.info']['lctr_id']==$lctr_id) { $participants=$_SESSION['participant.info']['data']; $dataset['HAS-PREV']=$idx>0?array(0):array(); $dataset['HAS-NEXT']=$idx+1<sizeof($participants)?array(0):array(); $dataset['idx.prev']=$idx-1; $dataset['idx.next']=$idx+1; $dataset['idx']=$idx; $dataset['type']=$type; $dataset['lctr_id']=$lctr_id; $dataset['IS-POP']=$type=='pop'?array(0):array(); $cur_par=$participants[$idx]; $DBConn->connect(true); $idfields_allowed=db_get_info_disclose($DBConn,$cur_par['mb_id'],current_mb_id()); $idfields_allowed=array_projection($idfields_allowed,'id_field'); if ($idfields_allowed) $idfields_allowed=array_combine($idfields_allowed,$idfields_allowed); $valuemap=loadValueMap(); $dataset['mb_id']=$cur_par['mb_id']; $dataset['mb_nickname']=$cur_par['mb_nickname']; $idfields=loadInfoDisclosureFields(); $idfields=array_intersect_key($idfields,$idfields_allowed); $dataset['IDFIELD']=array(); foreach ($idfields as $key=>$text) { $mappedvalue=$valuemap[$key.'.'.$cur_par[$key]]; if ($key=='mb_name' || $key=='mb_name_read') $mappedvalue=str_replace('|','  ',$cur_par[$key]); array_push($dataset['IDFIELD'], array( 'text'=>$text, 'value'=>$mappedvalue?$mappedvalue:$cur_par[$key], 'SET'=>$cur_par[$key]?array(0):array(), 'UNSET'=>$cur_par[$key]?array():array(0) ) ); } } else if ($mb_id_viewed) { $dataset['IS-POP']=$type=='pop'?array(0):array(); $DBConn->connect(true); $member=db_load_member($DBConn,$mb_id_viewed); $member+=db_load_member_info($DBConn,$mb_id_viewed); $member['mb_email']=implode("\n",array_projection(db_load_member_emails($DBConn,$mb_id_viewed,false),'mb_email')); $member['mb_phone']=implode("\n",array_projection(db_load_member_phones($DBConn,$mb_id_viewed),'mb_phone')); $idfields_allowed=db_get_info_disclose($DBConn,$mb_id_viewed,current_mb_id()); $idfields_allowed=array_projection($idfields_allowed,'id_field'); if ($idfields_allowed) $idfields_allowed=array_combine($idfields_allowed,$idfields_allowed); $valuemap=loadValueMap(); $dataset['mb_id']=$mb_id_viewed; $dataset['mb_nickname']=$member['mb_nickname']; $idfields=loadInfoDisclosureFields(); $idfields=array_intersect_key($idfields,$idfields_allowed); $dataset['IDFIELD']=array(); foreach ($idfields as $key=>$text) { $mappedvalue=$valuemap[$key.'.'.$member[$key]]; if ($key=='mb_name' || $key=='mb_name_read') $mappedvalue=str_replace('|','  ',$member[$key]); array_push($dataset['IDFIELD'], array( 'text'=>$text, 'value'=>$mappedvalue?$mappedvalue:$member[$key], 'SET'=>$member[$key]?array(0):array(), 'UNSET'=>$member[$key]?array():array(0) ) ); } } else { $dataset['CLOSE']=array(0); } ?>