* @copyright Deakin University 2007,2008 * @package queXS * @subpackage functions * @link http://www.deakin.edu.au/dcarf/ queXS was writen for DCARF - Deakin Computer Assisted Research Facility * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2 * */ /** * Display a valid XHTML Strict header * * @param string $title HTML title * @param bool $body True if to display the end of the head/body * @param bool|array $css False for no CSS otherwise array of CSS include files * @param bool|array $javascript False for no Javascript otherwise array of Javascript include files * @param string $bodytext Space in the body element: good for onload='top.close()' to close validly * @param bool|int $refresh False or 0 for no refresh otherwise the number of seconds to refresh * @param bool $clearrefresh False if we want to pass on any GET request in header, True to clear * * @see xhtml_foot() */ function xhtml_head($title="",$body=true,$css=false,$javascript=false,$bodytext=false,$refresh=false,$clearrefresh=false) { print ""; ?> <?php if (empty($title)) print "queXS"; else print "queXS: $title"; ?> "; if ($javascript) foreach ($javascript as $j) print ""; if ($refresh && ALLOW_PAGE_REFRESH) { print " "; } if (!$body) return; ?> "; else print ""; } /** * Display a valid XHTML Strict footer * * @see xhtml_head() */ function xhtml_foot() { ?> "; if ($head) { print ""; foreach ($head as $e) print"$e"; print ""; } foreach($content as $row) { if ($highlight && isset($row[key($highlight)]) && $row[key($highlight)] == current($highlight)) print ""; else print ""; foreach ($fields as $e) { print ""; if (isset($row[$e])) print $row[$e]; print ""; if ($total && in_array($e,$total)) { if (!isset($tot[$e])) $tot[$e] = 0; $tot[$e] += $row[$e]; } } print ""; } if ($total) { print ""; foreach ($fields as $e) { print ""; if (in_array($e,$total)) print $tot[$e]; print ""; } print ""; } print ""; } /** * Display a drop down list based on a given array * * Example SQL: * SELECT questionnaire_id as value,description, CASE WHEN questionnaire_id = '$questionnaire_id' THEN 'selected=\'selected\'' ELSE '' END AS selected * FROM questionnaire * * * @param array $elements An array of arrays containing a value and a description and if selected (3 elements) * @param string $selectid The ID of the element * @param string $var The var name of the return string * @param bool $useblank Add a blank element to the start of the list * @param string|bool $pass Anything to pass along in the return string (remember to separate with &) * @param bool $js Whether to use JS or not * @param bool $indiv Whether to display in a div or not * @param array|bool $select The element to select manually (element,string) (not using selected=\'selected\' in array) * */ function display_chooser($elements, $selectid, $var, $useblank = true, $pass = false, $js = true, $indiv = true, $selected = false) { if ($indiv) print "
"; print ""; if ($indiv) print "
"; } function xhtml_object($data, $id, $class="embeddedobject") { if (browser_ie()) print ''; else print '

Error, try with Firefox

'; } /** * Detect if the user is running on internet explorer * * @return bool True if MSIE is detected otherwise false */ function browser_ie() { if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) return true; else return false; } ?>