* @author Brady Miller * @copyright Copyright (c) 2018 Brady Miller * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 */ /**get all the validation on the page * @param $title * @return array of validation rules and forms names */ function collectValidationPageRules($title, $active = true) { // Note from Rod: Not sure what the purpose is of $active because nothing calls it with a false value. if ($active) { $sql = sqlStatement("SELECT * " . "FROM `list_options` WHERE list_id=? AND activity=? AND title = ?", array('page_validation',1,$title)); } else { $sql = sqlStatement("SELECT * " . "FROM `list_options` WHERE list_id=? AND title=?", array('page_validation', $title)); } $dataArray = array(); while ($row = sqlFetchArray($sql)) { $formPageNameArray = explode('#', $row['option_id']); $dataArray[$formPageNameArray[1]] = array('page_name' => $formPageNameArray[0] ,'rules' => $row['notes']); } return $dataArray; } /**this function creates client side validation rules for each
declared in list : Patient Validation - patient_validation * @param $fileNamePath * @output a generated javascript tag with the validation */ function validateUsingPageRules($fileNamePath) { $path = ''; if ($GLOBALS['webroot'] != '') { $path = str_replace($GLOBALS['webroot'], '', $fileNamePath); } else { $path = $fileNamePath; } print ''; //if we would like to get all the page forms rules we need to call collectValidationPageRules($title) this way there is a $collectThis = collectValidationPageRules($path); if ($collectThis) { print ''; print ''; echo("\r\n"); //Not lbf forms use the new validation, please make sure you have the corresponding values in the list Page validation $use_validate_js = 1; require_once($GLOBALS['srcdir'] . "/validation/validation_script.js.php"); echo("\r\n"); print ''); print ''; } }