$file, 'link' => $path, 'conc_id' => (isset($concours_info['conc_id']) ? $concours_info['conc_id'] : "0"), 'conc_name' => (isset($concours_info['conc_name']) ? $concours_info['conc_name'] : "N/A"), 'conc_descr' => (isset($concours_info['conc_descr']) ? $concours_info['conc_descr'] : "N/A") ); // Try to search on database if the concours is already present to recover name ans description } } } closedir($dir); uasort($csvfile, 'name_compare'); } return $csvfile; } // Get name and description of a concours with resulte file name function get_info_concours_from_csvfile($csvfile = "") { $query = 'SELECT id_concours as conc_id, CONC.name as conc_name, CONC.descr as conc_descr' .' FROM ' .CONCOURS_RESULT_TABLE .' INNER JOIN '.CONCOURS_TABLE.' AS CONC ON CONC.id = id_concours' .' WHERE file_name = "'.$csvfile .'"' .';'; $result = pwg_query($query); if ($result) return mysql_fetch_assoc($result); else return false; } // check if a result is already present in the database function has_result($concours_id) { // recover all img_id from the category $query = 'SELECT DISTINCT(id_concours)' .' FROM ' .CONCOURS_RESULT_TABLE .' WHERE id_concours = '.$concours_id .';'; $result = pwg_query($query); // For each images if (mysql_fetch_assoc($result)) return true; else return false; } // check if a file is already generated and return the link function has_file($concours_id) { // recover all img_id from the category $query = 'SELECT DISTINCT(file_name)' .' FROM ' .CONCOURS_RESULT_TABLE .' WHERE id_concours = '.$concours_id .';'; $result = pwg_query($query); // For each images if ($row = mysql_fetch_assoc($result)) return $row['file_name']; else return false; } // Get list of inactive concours // return array with concours id function get_inactive_concours() { $concours_list=array(); $query = ' SELECT * FROM ' . CONCOURS_TABLE .' WHERE time_to_sec(TIMEDIFF(begin_date, now())) > 0 ORDER BY id ;'; $result = pwg_query($query); //echo $query; while ($row = mysql_fetch_assoc($result)) { array_push($concours_list, $row); } return $concours_list; } // Get list of active concours // return array with concours id function get_active_concours() { $concours_list=array(); $query = ' SELECT * FROM ' . CONCOURS_TABLE .' WHERE time_to_sec(TIMEDIFF(begin_date, now())) < 0 AND time_to_sec(TIMEDIFF(now(), end_date)) < 0 ORDER BY id ;'; $result = pwg_query($query); //echo $query; while ($row = mysql_fetch_assoc($result)) { array_push($concours_list, $row); } return $concours_list; } // Get list of closed concours // return array with concours id function get_closed_concours() { $concours_list=array(); $query = ' SELECT * FROM ' . CONCOURS_TABLE .' WHERE time_to_sec(TIMEDIFF(now(), end_date)) > 0 ORDER BY id ' // .'AND id != 0' .';'; $result = pwg_query($query); //echo $query; while ($row = mysql_fetch_assoc($result)) { array_push($concours_list, $row); } return $concours_list; } function get_html_groups_selection( $groups, $fieldname, $selecteds = array() ) { global $conf; if (count ($groups) == 0 ) { return ''; } $output = '