<?php require_once('includes/courseinfo.inc.php'); require_once('includes/options.inc.php'); $CMD_TMPL_NAME='courseinfo'; $cs_id=0+TGET('cs_id'); $mb_id=current_mb_id(); $timezone_bias_seconds=get_user_time_zone()*60; $dataset['DETAIL']=array(0); $dataset['CONFIRMING']=array(0); $dataset['MANAGABLE']=array(0); $DBConn->connect(true); $course=db_load_course_by_id($DBConn,$cs_id); $course+=db_load_course_reserve_deadline($DBConn,$cs_id); $requests=db_get_course_info_requests($DBConn,$cs_id); $course['IDR']=array_projection($requests,'id_field'); $dataset+=db_load_compere($DBConn,$course['mb_id_owner']); $USE_THEME_BY_USER_ID=$course['mb_id_owner']; $lectures=db_load_lectures_of_course($DBConn,$cs_id); $now_utc=seconds_to_datetime(); $dataset['LECTURE']=$lectures; foreach ($dataset['LECTURE'] as &$lec) { $lec+=array_key_prepend(split_datetime($lec['lctr_since'],$timezone_bias_seconds),'since_'); $lec+=array_key_prepend(split_datetime($lec['lctr_expire'],$timezone_bias_seconds),'expire_'); $lec['since_weekday']=datetime_to_weekday($lec['lctr_since'],$timezone_bias_seconds); $lec['expire_weekday']=datetime_to_weekday($lec['lctr_expire'],$timezone_bias_seconds); if (datetime_datepart($lec['lctr_since'],$timezone_bias_seconds)==datetime_datepart($lec['lctr_expire'],$timezone_bias_seconds)) $lec['DATE-SAME']=array(0); else $lec['DATE-DIFF']=array(0); $lec['seat_count']=min($course['cs_member_max'],$lec['clsr_size'])-$lec['lctr_size']; if ($lec['lctr_deadline'] && $now_utc>$lec['lctr_deadline']) $lec['CLOSEDUP']=array(0); else if ($lec['seat_count']>0) $lec['RESERVABLE']=array(0); else $lec['FULL']=array(0); } $course['INFO']['ci_value']=rowset2map(db_load_course_info_by_course_id($DBConn,$cs_id),'ci_property','ci_value'); $course['INFO']['ci_property']=array_keys($course['INFO']['ci_value']); $dataset+=course_info_prepare_dataset($DBConn,$course); $dataset['MANAGABLE']=$course['mb_id_owner']!=$mb_id; $dataset['RESERVABLE']=$course['cs_initby']=='PARTICIPANT' || $lectures?array(0):array(); $dataset['NEW-LECTURE-ADDABLE']=$course['cs_initby']=='PARTICIPANT'?array(0):array(); $dataset['LECTURE-LIST']=$lectures?array(0):array(); $dataset['PLACE']=db_load_course_places($DBConn,$cs_id); $dataset['CLASSROOM']=db_list_classroom_summaries_by_course($DBConn,$cs_id); $dataset['IS-CS-OWNER']=$mb_id==$course['mb_id_owner']?array(0):array(); $dataset['NOT-CS-OWNER']=$mb_id==$course['mb_id_owner']?array():array(0); $dataset+=prepare_options_dataset($DBConn,$cs_id,null,null,array('for_course_detail'=>true,'is_cs_owner'=>$dataset['IS-CS-OWNER'])+$course); if ($course['mb_id_owner']) { $compereinfo=get_compere_info_requested($DBConn,$course['mb_id_owner']); $rss_url=$compereinfo['rss_url']; $dataset['rss_url']=$rss_url; $dataset['cpi_rss_hide_title']=$compereinfo['rss_hide_title']; $dataset['DISPLAY-RSS']=$rss_url?array(0):array(); } if (!$REMOTE_IS_SEARCHENGINE) { $dataset['course.view.count']=1+@file_get_contents($Config->Paths['counter.course'].'/'.$cs_id.'.cnt'); $dataset['COURSE-VIEW-COUNT']=array(0); if (!COOKIE('reserv_course_view_counted')) { SET_COOKIE('reserv_course_view_counted',1,$Config->CountingInterval); @mkdir($Config->Paths['counter.course'],0755,true); @file_put_contents($Config->Paths['counter.course'].'/'.$cs_id.'.cnt',$dataset['course.view.count']); } } ?>