';
$this->field .= '';
$this->field .= 'After ';
$this->field .= 'Before ';
$this->field .= 'Exactly ';
$this->field .= 'Between ';
$this->field .= ' ';
$daylist = '';
for($i=1;$i<=31;$i++) {
$dom = $i;
$i = sprintf("%02d", $i);
$sel = '';
if($i==$dd_start) $sel='SELECTED';
$daylist.=''.$dom;
}
$daylist.=' ';
$monthlist ='';
for($i=1;$i<=12;$i++){
$mth = $i;
$sel = '';
$i = sprintf("%02d",$i);
if($i==$mm_start) $sel='SELECTED';
$monthlist.=''.$MonthsOfYear[$mth];
}
$monthlist.=' ';
$yearlist =' ';
foreach($order as $o) {
switch($o) {
case 'day':
$this->field .= str_replace('_whichone', '_start', $daylist);
break;
case 'month':
$this->field .= str_replace('_whichone', '_start', $monthlist);
break;
case 'year':
$this->field .= str_replace('_whichone', '_start', $yearlist);
break;
}
}
$daylist = '';
for($i=1;$i<=31;$i++) {
$dom = $i;
$i = sprintf("%02d", $i);
$sel = '';
if($i==$dd_end) $sel='SELECTED';
$daylist.=''.$dom;
}
$daylist.=' ';
$monthlist ='';
for($i=1;$i<=12;$i++){
$mth = $i;
$sel = '';
$i = sprintf("%02d",$i);
if($i==$mm_end) $sel='SELECTED';
$monthlist.=''.$MonthsOfYear[$mth];
}
$monthlist.=' ';
$yearlist =' ';
$display_two = ($enable == 'on' && $default_type == 'between') ? '' : 'none';
$this->field .= ' AND ';
foreach($order as $o) {
switch($o) {
case 'day':
$this->field .= str_replace('_whichone', '_end', $daylist);
break;
case 'month':
$this->field .= str_replace('_whichone', '_end', $monthlist);
break;
case 'year':
$this->field .= str_replace('_whichone', '_end', $yearlist);
break;
}
}
$this->field.= "
";
}
//////////////////////////////////
function DateTimeBoxes($info) {
list($name, $time) = explode(':', $info);
$dateinfo = getdate($time);
$MonthsOfYear=array(
1=>"Jan",
2=>"Feb",
3=>"Mar",
4=>"Apr",
5=>"May",
6=>"Jun",
7=>"Jul",
8=>"Aug",
9=>"Sep",
10=>"Oct",
11=>"Nov",
12=>"Dec"
);
$DaysOfMonth=array(
1=>"1st",
2=>"2nd",
3=>"3rd",
4=>"4th",
5=>"5th",
6=>"6th",
7=>"7th",
8=>"8th",
9=>"9th",
10=>"10th",
11=>"11th",
12=>"12th",
13=>"13th",
14=>"14th",
15=>"15th",
16=>"16th",
17=>"17th",
18=>"18th",
19=>"19th",
20=>"20th",
21=>"21st",
22=>"22nd",
23=>"23rd",
24=>"24th",
25=>"25th",
26=>"26th",
27=>"27th",
28=>"28th",
29=>"29th",
30=>"30th",
31=>"31st"
);
$this->field='';
for($i=1; $i<=24; $i++) {
$sel = '';
if(sprintf('%02d', $i) == $dateinfo['hours']) $sel = 'SELECTED';
$h = (($i < 12) ? $i . ' am' : ($i - 12) . ' pm');
if ($i == 12) $h = 'Midday';
if ($i == 24) $h = 'Midnight';
$this->field.=''. $h;
}
$this->field.=' ';
$this->field.='';
$list = array('0', '10', '20', '30', '40', '50', '60');
foreach($list as $pos => $timeoption) {
$sel = '';
if ($dateinfo['minutes'] >= $timeoption && $dateinfo['minutes'] < $list[($pos+1)])
{
$sel = ' SELECTED';
}
// we need to keep 60 in the array for the check above.. but we don't want it displayed in the array.
if ($timeoption == '60') continue;
$this->field.=''. $timeoption . ' mins';
}
$this->field.=' ';
$this->field .= ' Date:';
for($i=1; $i<=31; $i++) {
$dom = $i;
$i = sprintf("%02d", $i);
$sel = '';
if($i == $dateinfo['mday']) $sel = 'SELECTED';
$this->field.=''.$DaysOfMonth[$dom];
}
$this->field .= ' ';
$this->field.='';
for($i=1; $i<=12; $i++) {
$mth = $i;
$sel = '';
$i = sprintf("%02d",$i);
if($i == $dateinfo['mon']) $sel = 'SELECTED';
$this->field.=''.$MonthsOfYear[$mth];
}
$this->field.=' ';
$this->field.=' ';
$this->field.= MakeHelp($name);
}
//////////////////////////////////
function SubmitButton($info) {
$vars = explode(':', $info);
$label = $vars[0];
$extra = (isset($vars[1])) ? $vars[1] : '';
$cancelData = (isset($vars[2])) ? $vars[2] : '';
$extra=str_replace('$$COLON$$',":",$extra);
$this->field = '';
// Should we output a cancel button?
if($extra != "")
{
$arrCancel = explode("-", $extra);
$cancelMsg = (isset($arrCancel[2])) ? $arrCancel[2] : 'Are you sure you wish to cancel?';
if(is_array($arrCancel) && sizeof($arrCancel) > 1)
{
$this->field .= ' ';
}
}
$this->field .= ' ';
$this->field .= ' ';
}
//////////////////////////////////
function Button($info) {
$label = $extra = "";
list($label,$extra)=explode(":",$info);
$extra=str_replace('$$COLON$$',":",$extra);
$this->field=' ';
}
//////////////////////////////////
function Hidden($info) {
list($name,$value)=explode(":",$info);
$this->field=' ';
}
//////////////////////////////////
function Spacer($info) {
$this->field=''.$info.' ';
}
//////////////////////////////////
function Number($info) {
$vars = explode(':', $info);
$name = $vars[0];
$max = $vars[1];
$length = $vars[2];
$value = (isset($vars[3])) ? $vars[3] : '';
$readonly = (isset($vars[4])) ? $vars[4] : '';
$extra = (isset($vars[5])) ? $vars[5] : '';
$value=str_replace('$$COLON$$', ":", $value);
if($readonly)
$this->field=' ';
else
$this->field=' ';
$this->field .= $extra;
$this->field .= MakeHelp($name);
}
//////////////////////////////////
function MakeForm($BlockHeading = "") {
GLOBAL $items, $FORM_REQUIRED_ITEM, $FORM_NOT_REQUIRED_ITEM;
$need_attachment_header = false;
$form_heading = '';
if($BlockHeading != "")
{
$form_heading .= '';
$form_heading .= '';
$form_heading .= ' ' . $BlockHeading;
$form_heading .= ' ';
$form_heading .= ' ';
}
$add_end = true;
$whole_form_output = $submit_button = '';
foreach($this->items as $name=>$info) {
if ($name<0 || $name=="0") {
$name="";
} else {
if ($name != $FORM_NOT_REQUIRED_ITEM.' ') $name.=": ";
}
// we have to limit it, in case (in javascript) there is a || for " or " or something else in the text...
list($InputType, $Fields) = explode('|', $info, 2);
if ($add_end) {
if ($InputType != 'hidden') {
$whole_form_output.=''.$name.' ';
}
} else {
$whole_form_output .= " ";
$add_end = true;
}
if (strpos($Fields, '$$$BAR$$$') !== false) {
$Fields = str_replace('$$$BAR$$$', '', $Fields);
$add_end = false;
}
switch($InputType) {
case 'raw':
$this->Raw($Fields);
break;
case 'textarea':
$this->TextArea($Fields);
break;
case 'wysiwyg':
$this->WYSIWYG($Fields);
break;
case 'textfield':
$this->TextBox($Fields);
break;
case 'password':
$this->Password($Fields);
break;
case 'checkboxes':
$this->CheckBoxes($Fields);
break;
case 'checkbox':
$this->CheckBox($Fields);
break;
case 'select':
$this->SelectBox($Fields);
break;
case 'radio':
$this->RadioButtons($Fields);
break;
case 'hidden':
$this->Hidden($Fields);
break;
case 'spacer':
$this->Spacer($Fields);
break;
case 'submit':
$this->SubmitButton($Fields);
$display = true;
if (strpos($Fields, '|') !== false) {
list($Fields, $extra) = explode('|', $Fields);
if ($extra == 'once') $display = false;
}
$vars = explode(':', $Fields);
$label = $vars[0];
$submit_button = '';
if ($label != 'Proceed' && $display) {
$submit_button = $this->field;
}
if ($submit_button != '' || $label == 'Proceed' || !$display) {
$this->field = ' ' . $this->field;
}
break;
case 'button':
$this->Button($Fields);
break;
case 'dateboxes':
case 'datebox':
$this->DateBoxes($Fields);
break;
case 'dateboxsearch':
$this->DateBoxSearch($Fields);
break;
case 'datetimeboxes':
$this->DateTimeBoxes($Fields);
break;
case 'file':
$file_uploads = ini_get('file_uploads');
if (strtolower($file_uploads) == 'off') $file_uploads = false;
if (!$file_uploads) break;
if ($file_uploads) $need_attachment_header = true;
$this->FileUpload($Fields);
break;
case 'number':
$this->Number($Fields);
break;
}
$whole_form_output.=$this->field;
if ($add_end) {
if ($InputType != 'hidden') {
$whole_form_output.=' ';
}
}
}
$form_header = '';
if(!is_numeric(strpos($this->action, "DEADLINK")))
{
$form_header = '
";
if(!is_numeric(strpos($this->action, "DEADLINK")) && $this->dontCloseForm != true)
$form_output .= "";
$this->output = $form_output;
}
}
function MakeHelp($ControlName) {
global $HELP_ITEMS;
global $ROOTURL;
$output = "";
$r = rand(1, 10000);
if(isset($HELP_ITEMS[$ControlName]) && $HELP_ITEMS[$ControlName]['Title'] != '')
{
$title = $HELP_ITEMS[$ControlName]['Title'];
$content = $HELP_ITEMS[$ControlName]['Content'];
$output = ' ';
}
return $output;
}
/////////////////////////////////////////////////////////////////////
function MakeBox($BoxTitle,$BoxContent,$Width="100%",$Separator=" ") {
GLOBAL $t,$boxes;
$key=rand(10,1000);
$boxes[$key]=$BoxTitle;
$OUT='
'.$BoxTitle.'
'.$BoxContent.'
';
return $OUT;
}
/////////////////////////////////////////////////////////////////////
function MakePopup($url,$width,$height,$title,$args="",$argvals="") {
GLOBAL $OUTPUT;
srand(mktime());
$url=MakeAdminLink($url);
$PopUpName=$title.rand();
$FuncName=$title."Pop".rand();
$OUTPUT.="";
return "javascript: $FuncName($argvals)";
}
/////////////////////////////////////////////////////////////////////
function MakeLink($url,$title='',$confirm=0,$raw=0, $target="") {
if($raw!=1){$url=MakeAdminLink($url);}
if($confirm){
GLOBAL $OUTPUT;
srand((double) microtime() * 1000000);
$FuncName="ConfirmLink".rand();
$OUTPUT.="";
return ''.$title.' ';
}else{
if($target == "")
return ''.$title.' ';
else
return ''.$title.' ';
}
}
function MakeConfirmBox($url,$title='',$msg='Are you sure?') {
$url=MakeAdminLink($url);
GLOBAL $OUTPUT;
srand((double) microtime() * 1000000);
$FuncName="ConfirmLink".rand();
$OUTPUT.="";
return ''.$title.' ';
}
?>