course_arr=array("python1"=>"Beginners Python","ef1"=>"EF: IT for Beginners","ef2"=>"EF: Advanced IT","linux1"=>"Linux for beginners","linux4"=>"Linux for the technically minded","linux2"=>"Advanced Linux","linux3"=>"Linux Security","php1"=>"PHP for beginners","php3"=>"Practical PHP","php2"=>"Advanced PHP","perl1"=>"Perl for beginners","perl2"=>"Advanced Perl","ruby1"=>"Ruby for beginners and introduction to Rails","mysql1"=>"MySQL for beginners","pgsql1"=>"PostgreSQL for beginners","mysql2"=>"Advanced MySQL","pgsql2"=>"Advanced PostgreSQL","uml1"=>"UML for beginners","pattern1"=>"Design Patterns","cpp1"=>"C++ for beginners","c1"=>"C for beginners","java1"=>"Java for beginners","java4"=>"Java web development with Spring and Hibernate","java3"=>"Advanced Java","java2"=>"J2EE for beginners","xml1"=>"XML for beginners","xhtml1"=>"Web design with XHTML and CSS","xhtml2"=>"Advanced web design","word1"=>"MS Word for beginners","ppt1"=>"MS Powerpoint for beginners","excel1"=>"MS Excel for beginners","access1"=>"MS Access for beginners","mssql1"=>"MS SQL Server for beginners","csharp1"=>"C# for beginners","csharp2"=>"Advanced C#"); $this->location_arr=array("Bedford","Birmingham","Cambridge","London","Norwich","Peterborough","Edinburgh","Manchester","Newcastle","Cardiff"); } function get_weekdays($arr) { $start_date = explode(" ",$arr['start_date']); $end_date = explode(" ",$arr['end_date']); $start_weekday = date("D", strtotime($start_date[0])); $end_weekday = date("D", strtotime($end_date[0])); if ($start_weekday == $end_weekday) { return $start_weekday; } else { return $start_weekday." - ".$end_weekday; } } function transform_date($cd, $link = 1) { $util=new util(); $cd[start_date]=str_replace("0:00","0",$cd['start_date']); $start=explode(" ",$cd[start_date]); $cd[end_date]=str_replace("0:00","0",$cd[end_date]); $end=explode(" ",$cd[end_date]); if($link==1)$br="
"; if($start[0]==$end[0]) { $end[0]=" "; } else { $end[0]=$util->pgdate_to_date($end[0]);$end[0]=" - ".$end[0]; } $start[0]=$util->pgdate_to_date($start[0]); if(trim($cd[location])=="" OR trim($cd[location])==$domain) { $dates=$dates."".$start[0].$end[0]." $br(".$this->get_weekdays($cd).", ".$start[1]." - ".$end[1].")"; if ($link == 1) { $dates .= "
Click here to book


"; } } return $dates; } function get_courses_from_other_citys($id) { $sql = 'SELECT * FROM course_location_specific WHERE course_id = '.$id.' AND start_date>now() order by start_date LIMIT 0,11'; $db = new database_connection_ltd(); $course_other_citys = $db->send_query($sql); return $course_other_citys; } function get_town_names_by_id($town_id) { $sql = 'SELECT name FROM town WHERE id = '.$town_id; $db = new database_connection_ltd(); $town_names = $db->send_query($sql); return $town_names; } function get_course_arr() { return $this->course_arr; } function get_course_descr_by_name($name) { $sql = 'SELECT * FROM course WHERE name = "'.$name.'"'; $db = new database_connection_ltd(); $course_descr = $db->send_query($sql); return $course_descr; } function get_course_descr_by_id($id) { $sql = 'SELECT * FROM course WHERE id = '.$id; $db = new database_connection_ltd(); $course_descr = $db->send_query($sql); return $course_descr; } function get_course_details_by_id($course_id, $town_id) { $query="SELECT * FROM course_location_specific WHERE course_id=$course_id AND town_id=$town_id AND start_date>now() ORDER BY start_date"; $db=new database_connection_ltd(); $arr=$db->send_query($query); return $arr; } function get_courses_by_date($town_id) { $query="SELECT * FROM course_location_specific WHERE town_id=$town_id AND start_date>now() ORDER BY start_date LIMIT 0,6"; $db=new database_connection_ltd(); $arr=$db->send_query($query); return $arr; } //used in old db function get_course_details_by_name($name) { $query="SELECT id,start,end,location,price,name,description FROM cic_courses WHERE name LIKE '$name-%' AND start>now() ORDER BY start"; $db=new database_connection(); $arr=$db->send_query($query); //var_dump($arr); return $arr; } // used in old db function get_courses_ordered_by_date() { $query="SELECT * FROM cic_courses WHERE start>now() ORDER BY start"; $db=new database_connection(); $arr=$db->send_query($query); //var_dump($arr); return $arr; } function get_courses_dropdown($course_name) { $arr=$this->course_arr; //var_dump($arr); foreach($arr as $k=>$v) { if($course_name==$k)$dropdown=$dropdown.""; else $dropdown=$dropdown.""; } $dropdown=""; return $dropdown; } function get_courses_location_dropdown($course_location) { $arr=$this->location_arr; //var_dump($arr); foreach($arr as $k=>$v) { if($course_location==$v)$dropdown=$dropdown.""; else $dropdown=$dropdown.""; } $dropdown=""; return $dropdown; } } ?>