Initial Commit of AgileBill Open Source

This commit is contained in:
unknown
2008-11-26 14:50:40 -08:00
parent ae5a0fc25e
commit 02306ccc47
2954 changed files with 410976 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
<?php
/*
* Smarty plugin
* -------------------------------------------------------------
* Type: function
* Name: html_menu
* Purpose: Get creates a html menu for associated records
* -------------------------------------------------------------
*/
function smarty_function_html_menu($params, &$smarty)
{
$conditions='';
extract($params);
if(empty($field)) $field = $name;
if(empty($id)) $id = $field;
$db = &DB();
$rs = & $db->Execute( $sql = sqlSelect($db, $assoc_table, "id,".$assoc_field, $conditions, $assoc_field));
#echo $sql;
$return = '<select id="'.$id.'" name="'. $field .'">';
if($default == "all" || $blank) $return .= '<option value="" selected></option>';
if($rs && $rs->RecordCount() > 0)
{
while(!$rs->EOF)
{
$return .= '<option value="' . $rs->fields['id'] . '"';
if($default == $rs->fields['id']) $return .= "selected";
$return .= '>' . $rs->fields["$assoc_field"] . '</option>';
$rs->MoveNext();
}
} else {
if( $default != "all") $return .= '<option value=""></option>';
}
$return .= '</select>';
echo $return;
}
?>