SAM V2:customization
Revision as of 14:00, 17 May 2011 by Srunkle3X (talk | contribs) (→How to Add a Field to a Table and Form)
Since SAM V2 is open-source software, it is easily customized with a working knowledge of HTML, PHP, MySQL, and the SAM source code/database structure.
Tables Names and Directory Structure
Table Name | Subdirectory Name | |
---|---|---|
Student | students | student |
Disabilities | disabilities | disability |
Accommodations | accommodations | accommodation |
Consents | consent_types | consent |
Referrals | referrals | referral |
Case Notes | case_notes | case |
Tasks | tasks | task |
Documentation | documentation | doc |
Tests | tests | test |
Class Schedules | class_schedules | schedule |
Orders | orders | order |
How to Add a Field to a Table and Form
1. Add the field to the underlying table in MySQL. For example, to add a field called Evaluator Name to the disabilities table, you would execute a SQL statement similar to:
alter table disabilities add column evaluator_name varchar(50) …
Or you could use the MySQL workbench to alter the table.
2. In the disability subdirectory, you will need to modify the programs add.php, edit.php, and view.php to handle the new evaluator_name field.
3. In add.php, you would add a table row for the new field with 2 table columns, one for the label, and one for the input of the value for evaluator_name.
<h2>Add a New Disability</h2> <?php if(lookupPermission("disabilities","add","yes")=="0") return; ?> <?php if (isset($i)) { $result = mysql_query("SELECT * FROM students WHERE sid = '$i'"); $row = mysql_fetch_array($result); $id = $row['id']; $first_name = $row['first_name']; $middle_name = $row['middle_name']; $last_name = $row['last_name']; } if (isset($m)) { echo '<p><font color="red">'.stripslashes($m).'</font></p>'; } ?> <div class="box"> <form method="post" onsubmit="return validateForm(this)" enctype="multipart/form-data" action="dbaction.php"> <table class="size8"> <tr> <td align="right"><strong>Student</strong></td> <td><?php echo trim(trim($id . ' ' . $first_name . ' ' . $middle_name) . ' ' . $last_name); ?></td> </tr> <tr> <td align="right"><font color="red">* </font><label for="disability"><strong>Disability</strong></label></td> <td> <select name="disability" id="disability"> <option value=""></option> <?php selectList("disabilities","disability",null); ?> </select> </td> </tr> <tr> <td align="right"><label for="specification"><strong>Specification</strong></label></td> <td> <select name="specification"> <option value=""></option> <?php selectList("disabilities","specification",null); ?> </select> </td> </tr> <tr> <td align="right"><font color="red">* </font><label for="type"><strong>Type</strong></label></td> <td> <select name="type"> <option value=""></option> <?php selectList("disabilities","type",null); ?> </select> </td> </tr> <tr> <td align="right"><label for="expiration"><strong>Expiration Date</strong></label></td> <td><input type="text" name="expiration" size="20" maxlength="10" value="<?php echo $expiration; ?>" /> <a href="javascript:NewCal('expiration','MMddyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a Date" /></a> </td> </tr> <tr> <td align="right"><label for="expiration"><strong>Expiration Date</strong></label></td> <td><input type="text" name="expiration" size="20" maxlength="10" value="<?php echo $expiration; ?>" /> <a href="javascript:NewCal('expiration','MMddyyyy')"><img src="cal.gif" width="16" height="16" border="0" alt="Pick a Date" /></a> </td> </tr> '''<tr>''' <td align="right"><label for="evaluator_name"><strong>Evaluator Name</strong></label></td> <td> <input type=”text” name=”evaluator_name” /> </td> </tr> <tr> <td align="right"><label for="notes"><strong>Notes</strong></label></td> <td><textarea name="notes" cols="50" rows="5"><?php echo $notes; ?></textarea></td> </tr> <tr> <td colspan="2"><br /><font color="red">* required fields</font></td> </tr> </table> <input type="submit" name="submit" value="Add" /> <input type="reset" name="reset" value="Reset" /> <input type="button" name="back" value="Back" onclick="history.go(-1);" /> <input type="hidden" name="t" value="disabilities" /> <input type="hidden" name="i" value="<?php echo $i; ?>" /> </form> </div> <script type="text/javascript" language="javascript"> function validateForm(theForm) { if(theForm.disability.selectedIndex == 0) { alert('Please select a value for the "Disability" field.'); theForm.disability.focus(); return (false); } if(theForm.type.selectedIndex == 0) { alert('Please select a value for the "Type" field.'); theForm.type.focus(); return (false); } if(theForm.expiration.value != "") { if(!theForm.expiration.value.match(/^\d{1,2}\-\d{1,2}\-\d{4}$/)) { alert('Please enter the "Expiration Date" in the format MM-DD-YYYY.'); theForm.expiration.focus(); return (false); } } } </script> <script type="text/javascript" language="javascript"> document.getElementById('disability').focus(); </script>