File Manager
<?php
class formbuilder_utils
{
public static function is_CMS2()
{
return version_compare('1.999.999.999', CMS_VERSION, '<');
}
public static function create_input_text(
$id, $name, $value='',
$size='10', $maxlength='255',
$addttext='', $type='text', $required=false, $n=null
)
{
$id = cms_htmlentities($id);
$name = cms_htmlentities($name);
$cssid = $name;
if(intval($n))
{
$cssid .= '_' . intval($n);
}
$value = htmlspecialchars($value);
$size = cms_htmlentities($size);
$maxlength = cms_htmlentities($maxlength);
$text = '<input type="' . $type . '" class="cms_' . $type
. '" name="' . $id.$name . '" id="' . $cssid . '" value="' . $value . '" size="' . $size
. '" maxlength="'.$maxlength.'"';
if ($addttext != '')
{
$text .= ' '.$addttext;
}
if ($required)
{
$text .= ' required="required"';
}
$text .= " />\n";
return $text;
}
public static function create_input_checkbox($id, $name, $value='', $selectedvalue='', $addttext='', $n=null)
{
$id = cms_htmlentities($id);
$name = cms_htmlentities($name);
$cssid = $name;
if(intval($n))
{
$cssid .= '_' . intval($n);
}
$value = cms_htmlentities($value);
$selectedvalue = cms_htmlentities($selectedvalue);
$text = '<input type="checkbox" class="cms_checkbox" name="'.$id.$name.'" id="'.$cssid.'" value="'.$value.'"';
if ($selectedvalue == $value)
{
$text .= ' ' . 'checked="checked"';
}
if ($addttext != '')
{
$text .= ' '.$addttext;
}
$text .= " />\n";
return $text;
}
public static function create_label($id, $name, $labeltext='', $addttext='')
{
$text = '<label class="cms_label" for="'.$name.'"';
if ($addttext != '')
{
$text .= ' ' . $addttext;
}
$text .= '>'.$labeltext.'</label>'."\n";
return $text;
}
public static function create_textarea($enablewysiwyg, $id, $name, $text, $cols='80', $rows='15', $addtext='', $required=false)
{
if($required)
{
$addtext .= ' required="required"';
}
return create_textarea($enablewysiwyg, $text, $id.$name, 'cms_textarea', $name, '', '', $cols, $rows, '', '',$addtext);
}
public static function create_input_dropdown($id, $name, $items, $selectedindex, $selectedvalue, $addttext='', $required=false)
{
$id = cms_htmlentities($id);
$name = cms_htmlentities($name);
$selectedindex = cms_htmlentities($selectedindex);
$selectedvalue = cms_htmlentities($selectedvalue);
$text = '<select class="cms_dropdown" name="'.$id.$name.'" id="'.$name.'"';
if(!empty($addttext))
{
$text .= ' ' . $addttext;
}
if($required)
{
$text .= ' required="required"';
}
$text .= '>';
$count = 0;
if (is_array($items) && count($items) > 0)
{
foreach ($items as $key=>$value)
{
$text .= '<option value="'.$value.'"';
if ($selectedindex == $count || $selectedvalue == $value)
{
$text .= ' ' . 'selected="selected"';
}
$text .= '>';
$text .= $key;
$text .= '</option>';
$count++;
}
}
$text .= '</select>'."\n";
return $text;
}
}
?>
File Manager Version 1.0, Coded By Lucas
Email: hehe@yahoo.com