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_product_host
* Purpose: Autoselect for all active hosting plans
* -------------------------------------------------------------
*/
function smarty_function_html_menu_product_host($params, &$smarty)
{
$id = $params['id'];
$name = $params['name'];
$default = unserialize($params['default']);
$size = $params['size'];
$exclude = $params['exclude'];
if(empty($id)) $id = $name;
$db = &DB();
$p = AGILE_DB_PREFIX;
$q = "SELECT id,sku FROM {$p}product
WHERE host = 1
AND active = 1
AND price_type = 1
AND id != $exclude
AND site_id = " . DEFAULT_SITE;
$result = $db->Execute($q);
if($result && $result->RecordCount() > 0)
{
echo "<select id=\"$id\" name=\"{$name}[]\" size=\"$size\" multiple>";
while(!$result->EOF) {
$sel='';
foreach($default as $cur) if ($cur == $result->fields['id']) $sel = "selected";
echo "<option value=\"{$result->fields['id']}\"$sel>{$result->fields['sku']}</option>";
$result->MoveNext();
}
echo "</select>";
}
}
?>