<?php function collect_info_request_lacked_fields($dbconn,$mb_id,$cs_id) { $ID_fields=db_get_course_info_requests($dbconn,$cs_id); $mbinfo=db_load_member_info($dbconn,$mb_id); $lack_fields=array(); foreach ($ID_fields as $row) { if ($row['id_field']=='mb_email') { if (db_count_member_email($dbconn,$mb_id)==0) array_push($lack_fields,$row['id_field']); } else if ($row['id_field']=='mb_phone') { if (db_count_member_phone($dbconn,$mb_id)==0) array_push($lack_fields,$row['id_field']); } else if ($row['id_field']=='mb_name' || $row['id_field']=='mb_name_read') { list($surname,$firstname)=explode('|',$mbinfo[$row['id_field']]); if (!$surname || !$firstname) array_push($lack_fields,$row['id_field']); } else if ($row['id_field']=='mb_birthday') { $timezone_bias=get_user_time_zone()*60; $cur_time=uniwits_time(null,$timezone_bias); $years_ago_100=$cur_time-3155673600; $years_ago_5=$cur_time-157680000; $birthday_sec=datetime_to_seconds($mbinfo['mb_birthday'],$timezone_bias); if ($birthday_sec<$years_ago_100 || $birthday_sec>$years_ago_5) array_push($lack_fields,$row['id_field']); } else if (!$mbinfo[$row['id_field']]) { array_push($lack_fields,$row['id_field']); } } return $lack_fields; } function prepare_timezone_dataset($selected_timezone,$ipdata) { $dataset=array(); $dataset['TIMEZONE']=array(); for ($tzi=-720;$tzi<=720;$tzi+=30) { array_push($dataset['TIMEZONE'], array( 'minutes'=>$tzi, 'name'=>get_timezone_name($tzi) ) ); } if ($selected_timezone=='') { array_assoc_set_iif( $dataset['TIMEZONE'], 'minutes', $ipdata['Gmtoffset']/60, 'SELECTED', array(0), 'UNSELECTED', array(0) ); } else { array_assoc_set_iif( $dataset['TIMEZONE'], 'minutes', $selected_timezone, 'SELECTED', array(0), 'UNSELECTED', array(0) ); } $dataset['timezone_name']=get_timezone_name($selected_timezone); return $dataset; } function prepare_country_dataset($selected_country_code) { $dataset=array(); $countrymap=loadCountryNames(); $countries=array_deassociate($countrymap,'code','name'); $dataset['COUNTRIES']=$countries; array_assoc_set_iif( $dataset['COUNTRIES'], 'code', $selected_country_code, 'SELECTED', array(0), 'UNSELECTED', array(0) ); $dataset['country_name']=$countrymap[$selected_country_code]; return $dataset; } ?>