repertoire_path.$expl->explnum_path); if($expl->repertoire_utf8) $path = utf8_encode($path); if($expl->ext) $file = substr($expl->nom,0,strpos($expl->nom,".")); else $file = $expl->nom; $exist = false; $i=0; while(!$exist){ $i++; $filename = ($i ? $file."_".$i : $file).($expl->ext ? ".".$expl->ext : ""); if(!file_exists($path.$filename)){ print $filename; $exist = true; } } } else print "0"; } else print "0"; } function get_associate_svg($explnum_id) { $explnum_associate_svg = new explnum_associate_svg($explnum_id); $svg = $explnum_associate_svg->getSvg(true); ajax_http_send_response($svg,"text/xml"); } function get_associate_js($explnum_id) { $explnum_associate_svg = new explnum_associate_svg($explnum_id); $js = $explnum_associate_svg->getJs(true); ajax_http_send_response($js,"text/xml"); } function update_associate_author($speaker_id, $author_id) { global $dbh; $query = 'update explnum_speakers set explnum_speaker_author = '.$author_id.' where explnum_speaker_id = '.$speaker_id; mysql_query($query, $dbh); } function update_associate_speaker($segment_id, $speaker_id) { global $dbh; $query = 'update explnum_segments set explnum_segment_speaker_num = '.$speaker_id.' where explnum_segment_id = '.$segment_id; mysql_query($query, $dbh); } function add_new_speaker($explnum_id) { global $dbh; $query = 'insert into explnum_speakers (explnum_speaker_explnum_num, explnum_speaker_speaker_num) values ('.$explnum_id.', "PMB")'; mysql_query($query, $dbh); } function delete_associate_speaker($speaker_id) { global $dbh; $query = 'delete from explnum_speakers where explnum_speaker_id = '.$speaker_id; mysql_query($query, $dbh); } function add_new_segment($explnum_id, $speaker_id, $start, $end) { global $dbh; if (!$speaker_id) { $query = 'insert into explnum_speakers (explnum_speaker_explnum_num, explnum_speaker_speaker_num) values ('.$explnum_id.', "PMB")'; mysql_query($query, $dbh); $speaker_id = mysql_insert_id(); } $duration = $end - $start; $query = 'insert into explnum_segments (explnum_segment_explnum_num, explnum_segment_speaker_num, explnum_segment_start, explnum_segment_duration, explnum_segment_end) value ('.$explnum_id.', '.$speaker_id.', '.$start.', '.$duration.', '.$end.')'; mysql_query($query, $dbh); } function delete_segments($segments_ids) { global $dbh; $query = 'delete from explnum_segments where explnum_segment_id in ('.$segments_ids.')'; mysql_query($query, $dbh); } function update_segment_time($segment_id, $start, $end) { global $dbh; $query = 'update explnum_segments set '; if ($start) { $query .= 'explnum_segment_start = '.$start.', '; } else { $select = 'select explnum_segment_start from explnum_segments where explnum_segment_id = '.$segment_id; $result = mysql_query($select, $dbh); if ($result && mysql_num_rows($result)) { if ($row = mysql_fetch_object($result)) { $start = $row->explnum_segment_start; } } } if ($end) { $query .= 'explnum_segment_end = '.$end.', '; } else { $select = 'select explnum_segment_end from explnum_segments where explnum_segment_id = '.$segment_id; $result = mysql_query($select, $dbh); if ($result && mysql_num_rows($result)) { if ($row = mysql_fetch_object($result)) { $end = $row->explnum_segment_end; } } } $duration = $end - $start; $query .= 'explnum_segment_duration = '.$duration.' where explnum_segment_id = '.$segment_id; mysql_query($query, $dbh); } ?>