source: extensions/ContestResults/include/functions.php @ 8804

Last change on this file since 8804 was 6782, checked in by mistic100, 14 years ago

Fixs some errors. Add results previews. Code revision.

File size: 681 bytes
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4// Racourcis un texte et ajoute une ellipse
5function CR_cut_string($string, $limit){
6        include_once(CR_PATH . 'include/cutstring.class.php');
7        if(strlen(str_replace("\r\n", "\n", strip_tags($string))) > $limit){
8                $output = new HtmlCutString($string, $limit);
9                return ($output->cut()).'...';
10        }else{
11                return $string;
12        }
13}
14
15// Recupère le nom d'un coucours à partir de l'id
16function get_contest_name($id){
17        $query = pwg_query("SELECT name FROM " . CR_TABLE_1 . " WHERE id = " . $id . ";");
18        if(pwg_db_num_rows($query)){
19                $result = pwg_db_fetch_assoc($query);
20                return $result['name'];
21        }else{
22                return null;
23        }
24}
25?>
Note: See TracBrowser for help on using the repository browser.