function tableRowStyled($style, $values) { #---------------------------------------------------------------------- global $tableOddRow, $tableAttributes, $tableColumns; # debug $tc = count($values); assertFoo($tc == $tableColumns, "Wrong number of table row cells ({$tc} instead of {$tableColumns})"); if ($style) { $style = " style='{$style}'"; } echo "<tr{$style}" . (($tableOddRow = !$tableOddRow) ? "" : " class='e'") . ">"; $columnCtr = 0; foreach ($values as $value) { if (!$value) { $value = ' '; } $attr = ""; if (isset($tableAttributes[$columnCtr])) { $attr = " " . $tableAttributes[$columnCtr]; } echo "<td{$attr}>{$value}</td>"; $columnCtr++; } echo "</tr>\n"; }
function computeMedia ( $mediaType ) { #---------------------------------------------------------------------- global $chosenCompetitionId; assertFoo( preg_match( '/^(article|report|multimedia)$/', $mediaType) , "Bad call of function 'computeMedia', must be article|report|multimedia" ); $media = dbQuery(" SELECT * FROM CompetitionsMedia WHERE competitionId = '$chosenCompetitionId' AND type = '$mediaType' AND status = 'accepted' ORDER BY timestampDecided DESC "); $mediaList = ""; foreach( $media as $medium ){ extract($medium); $mediaList .= '[{' . $text . '}{' . $uri . '}]'; } return $mediaList; }