Add new directory structure. Tags will contain current and past releases, and stable will contain any bug fixes to the current stable release so users won't have to get the potentially broken trunk build to fix a screwup in stable.

Trunk updated to 0.9

git-svn-id: http://kusabax.cultnet.net/svn/repo/stable@176 73d99b7e-4f53-4972-b7b7-2ecd3c4d89ee
This commit is contained in:
Sazpaimon committed 2009-05-27 06:37:50 +00:00
commit 88bacfad9c
316 files changed
+79806

No files matched your search

+226
View File
@@ -0,0 +1,226 @@
<?php
// Generic Menu Module
eval('class menu_EXTENDER extends ' . $last_module . '_ADOConnection { }');
class menu_ADOConnection extends menu_EXTENDER
{
}
eval('class menu_resultset_EXTENDER extends ' . $last_module . '_ResultSet { }');
class menu_ResultSet extends menu_resultset_EXTENDER
{
// Requires $ADODB_FETCH_MODE = ADODB_FETCH_NUM
function GetMenu($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='', $compareFields0=true)
{
$hasvalue = false;
if($multiple or is_array($defstr))
{
if($size==0)
$size=5;
$attr = ' multiple size="'.$size.'"';
if(!strpos($name,'[]'))
$name .= '[]';
}
else if($size)
$attr = ' size="'.$size.'"';
else $attr ='';
$s = '<select name="'.$name.'"'.$attr.' '.$selectAttr.'>';
if($blank1stItem)
if(is_string($blank1stItem))
{
$barr = explode(':',$blank1stItem);
if(sizeof($barr) == 1)
$barr[] = '';
$s .= "\n<option value=\"".$barr[0]."\">".$barr[1]."</option>";
} else $s .= "\n<option></option>";
if($this->FieldCount() > 1)
$hasvalue=true;
else $compareFields0 = true;
$value = '';
$optgroup = null;
$firstgroup = true;
$fieldsize = $this->FieldCount();
while(!$this->EOF)
{
$zval = rtrim(reset($this->fields));
if($blank1stItem && $zval=="")
{
$this->MoveNext();
continue;
}
if($fieldsize > 1)
{
if(isset($this->fields[1]))
$zval2 = rtrim($this->fields[1]);
else
$zval2 = rtrim(next($this->fields));
}
$selected = ($compareFields0) ? $zval : $zval2;
$group = '';
if($fieldsize > 2)
{
$group = rtrim($this->fields[2]);
}
if($optgroup != $group)
{
$optgroup = $group;
if($firstgroup)
{
$firstgroup = false;
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
}
else
{
$s .="\n</optgroup>";
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
}
}
if($hasvalue)
$value = " value='".htmlspecialchars($zval2)."'";
if(is_array($defstr))
{
if(in_array($selected,$defstr))
$s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
else
$s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
}
else
{
if(strcasecmp($selected,$defstr)==0)
$s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
else
$s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
}
$this->MoveNext();
} // while
// closing last optgroup
if($optgroup != null)
{
$s .= "\n</optgroup>";
}
return $s ."\n</select>\n";
}
function GetMenu2($name,$defstr='',$blank1stItem=true,$multiple=false,$size=0, $selectAttr='')
{
return $this->GetMenu($name, $defstr, $blank1stItem, $multiple, $size, $selectAttr, false);
}
function GetMenu3($name, $defstr='', $blank1stItem=true, $multiple=false, $size=0, $selectAttr='')
{
$hasvalue = false;
if($multiple or is_array($defstr))
{
if($size==0)
$size=5;
$attr = ' multiple size="'.$size.'"';
if(!strpos($name,'[]'))
$name .= '[]';
}
else if($size)
$attr = ' size="'.$size.'"';
else $attr ='';
$s = '<select name="'.$name.'"'.$attr.' '.$selectAttr.'>';
if($blank1stItem)
if(is_string($blank1stItem))
{
$barr = explode(':',$blank1stItem);
if(sizeof($barr) == 1)
$barr[] = '';
$s .= "\n<option value=\"".$barr[0]."\">".$barr[1]."</option>";
} else $s .= "\n<option></option>";
if($this->FieldCount() > 1)
$hasvalue=true;
else $compareFields0 = true;
$value = '';
$optgroup = null;
$firstgroup = true;
$fieldsize = sizeof($this->fields);
while(!$this->EOF)
{
$zval = rtrim(reset($this->fields));
if($blank1stItem && $zval=="")
{
$this->MoveNext();
continue;
}
if($fieldsize > 1)
{
if(isset($this->fields[1]))
$zval2 = rtrim($this->fields[1]);
else
$zval2 = rtrim(next($this->fields));
}
$selected = ($compareFields0) ? $zval : $zval2;
$group = '';
if(isset($this->fields[2]))
{
$group = rtrim($this->fields[2]);
}
if($optgroup != $group)
{
$optgroup = $group;
if($firstgroup)
{
$firstgroup = false;
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
}
else
{
$s .="\n</optgroup>";
$s .="\n<optgroup label='". htmlspecialchars($group) ."'>";
}
}
if($hasvalue)
$value = " value='".htmlspecialchars($zval2)."'";
if(is_array($defstr))
{
if(in_array($selected,$defstr))
$s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
else
$s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
}
else
{
if(strcasecmp($selected,$defstr)==0)
$s .= "\n<option selected='selected'$value>".htmlspecialchars($zval).'</option>';
else
$s .= "\n<option".$value.'>'.htmlspecialchars($zval).'</option>';
}
$this->MoveNext();
} // while
// closing last optgroup
if($optgroup != null)
{
$s .= "\n</optgroup>";
}
return $s ."\n</select>\n";
}
}
?>