Location: PHPKode > projects > ConPortal > conportal/inc/prefs/display.php
<?php
/*
 *  ConPortal - Pomona College ITS & Bucknell University Library & IT scheduling appplication
 *  Copyright (C) 2005-2008  Pomona College, Bucknell University
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of version 2 of the GNU General Public License
 *  as published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

/*
Implemented in this file
	editPrefsForm
 */

function editPrefsForm()
{

$prefArray = getPrefs();

?>

<strong>Welcome to the Preference Setting Page!</strong><br />
Here you can set lots of values related to the functioning of your copy of ConPortal.  Please note that because you are a ConPortal admin, ConPortal assumes you know - more or less - what you're doing here.  While changing these values is, in and of itself, perfectly safe, make sure you have a good understanding of what a value is before you change it. Ask your friendly neighborhood ConPortal guru if you're not certain. <br />Typical values will be numbers, email addresses, or the choice of Yes and No.  The values displayed are the current values.  Enjoy!  
<br /><br /><br />
<form method='post' action='redirects/edit_prefs.php' id='edit_prefs'>
<table>
<?

	$i=0;
	foreach($prefArray as $pref)
	{
		?>
		<tr class='d<?= $i++ % 2 ?>' onmouseover='javascript:highlight(this)'
      	  onmouseout='javascript:unhighlight(this)'
		<?
		if(($pref["pid"] % 100) == 0)
		{
			echo "<td width=\"100%\"><h2>" . $pref["pref_description"];	
			echo "</h2></td></tr>";
		}
		else
		{
			echo "<td width=\"50%\">" . $pref["pref_description"];	
			echo "</td><td>";
			if($pref["pref_value"] == "TRUE" || $pref["pref_value"] == "FALSE")
			{
				YesNoDropdown($pref["pref_name"], $pref["pref_value"]);
			}
			else
			{
				echo "<input type=\"text\" size=\"90\" maxlength=\"254\" name=\"" . $pref["pref_name"] . 
				"\" value=\"" . $pref["pref_value"] . "\">";
			}
			echo "</td></tr>";
		}	

		$i++;
	}

?>
</table>
<input type='submit' value='Make the changes!  Do it!'/>&nbsp;&nbsp;
	<button onclick='javascript:window.location = "<?= BASE_URL ?>index.php"; return false;'>I'm scared! Return me to main page without changing anything!</button>
</form>
<?

}

function YesNoDropdown($name, $value)
{
	echo "<select name =\"" . $name . "\">";
	if($value == "TRUE")
	{
		echo "<option selected value=\"TRUE\">Yes</option>";
		echo "<option value=\"FALSE\">No</option>";
	}
	else
	{
		echo "<option value=\"TRUE\">Yes</option>";
		echo "<option selected value=\"FALSE\">No</option>";
	}
	echo "</select>"; 

}

Return current item: ConPortal