Technology Temerity

Class – Forms

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
<?php
 
class class_forms {
 
    /*
    Utility
    Damon Vaughn Caskey
    2013_01_21
     
    Miscellaneous form input functions.
    */
         
    /* Constants */
    const FORMS_ID_USE_NAME                     = NULL;     //Use name to generate ID.
    const FORMS_ITEM_ADDITIONS_NONE             = NULL;     //No manual additions to generated item list.
    const FORMS_LABEL_NONE                      = NULL;     //No label for fieldset item.
    const FORMS_LABEL_BLANK                     = 1;        //Blank label for fieldset item.
    const FORMS_LABEL_USE_ITEM_KEY              = 2;        //Use the item key of a field for its fieldset label or visible selection.
    const FORMS_LABEL_USE_ITEM_NAME             = 3;        //Use the item name of a field for its fieldset label or visible selection.
    const FORMS_LABEL_USE_ITEM_VALUE            = 4;        //Use the items value of a field for its fieldset label or visible selection.
    const FORMS_LABEL_TYPE_FIELDSET             = 0;        //Fieldset label.
    const FORMS_LABEL_TYPE_INLINE               = 1;        //Label text only; no formatting.
    const FORMS_LEGEND_NONE                     = NULL;     //No legend for fieldset.
    const FORMS_QUERY_PARAMETERS_NONE           = NULL;     //No query parameters.
    const FORMS_TYPE_RADIO                      = 0;        //Radio type list.
    const FORMS_TYPE_SELECT                     = 1;        //Select type list.
    const FORMS_VALUE_CURRENT_NONE              = NULL;     //Current (last selected) value.
    const FORMS_VALUE_DEFAULT_NONE              = NULL;     //Default selected value.
    const FORMS_VALUE_DEFAULT_NOW               = -1;       //Default to current time for specific field.
    const FORMS_EVENTS_NONE                     = NULL;     //No events attached to fieldset item.
    const FORMS_READ_ONLY_OFF                   = FALSE;
    const FORMS_READ_ONLY_ON                    = TRUE;
         
    public $cItemsList                          = NULL;     //Array of items list for select/radio/etc.
    public $cFormElement                        = NULL;     //Arracy to store completed element markup that will be placed in a fieldset.
    public $cFormElementActions                 = NULL;     //Array of actions tied to form element (onchange, onclick, etc.).
    public $cFieldset                           = NULL;     //Array of completed fieldset markups ready to echo into page.
    public $cFieldsetAddsA                      = NULL;     //Array of additional instructions, links, etc. that may be added to fieldset above items.
                 
    function __construct($oDep)
    {
        /*
        Constructor
        Damon Vaughn Caskey
        2013-01-21
         
        Class constructor.
        */
         
        /* Import object dependencies. */
        //$this->oUtl = $oDep['Utl'];
        $this->oDB   = $oDep['DB'];
        //$this->Err = $oDep['Err'];
                 
        /* Verify object dependencies. */
        //if(!$this->oUtl)   trigger_error("Missing object dependency: Utility.", E_USER_ERROR);    
        if(!$this->oDB)      trigger_error("Missing object dependency: Database.", E_USER_ERROR);
        //if(!$this->Err)        trigger_error("Missing object dependency: Errors.", E_USER_ERROR);
    }  
     
    private function forms_events_markup($cEvents=self::FORMS_EVENTS_NONE)
    {
        /*
        forms_events_markup
        Damon Vaughn Caskey
        2013-03-26
         
        Prepare HTML markup string for fieldset form item events (onchange, onclick, etc.).
        */
         
        if(isset($cEvents))
        {      
            foreach ($cEvents as $cKey => $cValue)
            {
                 
                $cEvent .= $cKey.'="'.$cValue.'"';
            }
        }
        return $cEvent;
    }
     
    public function test()
    {
        echo self::FORMS_LABEL_USE_ITEM_VALUE;
    }
     
    private function forms_label_markup($iStyle=self::FORMS_LABEL_NONE, $iType=self::FORMS_LABEL_TYPE_FIELDSET, $cName=NULL, $cID=NULL, $cKey=NULL, $cValue=NULL)
    {
        /*
        forms_label_markup
        Damon Vaughn Caskey
        2013-03-26
         
        Prepare HTML markup string for fieldset form item labels.
         
        Preconditions:
            $cName:     Name of item.
            $cID:       ID of item.
            $cKey:      Array key of item.
            $cValue:    Array value of item.
            $iStyle:    How to arrange label markup.
                self::FORMS_LABEL_USE_ITEM_KEY = The item's Key will be used as a label.
                self::FORMS_LABEL_USE_ITEM_VALUE = The item's Value will be used as label.
                self::FORMS_LABEL_BLANK = The label will be left blank.
                self::FORMS_LABEL_NONE = No label markuop at all.
         
        Postconditions:
            Return finished label markup string.       
        */
         
        $cClosing = NULL;
        $cLabel = NULL;
         
        if($iType == self::FORMS_LABEL_TYPE_FIELDSET)
        {
            /* Prepare opening label markup. */
            $cLabel = '<div class="'.$cClass['Container_Label'].'"><label for="'.$cID.'">';
            $cClosing = '</label></div>';  
        }                          
             
        switch($iStyle)
        {
            case self::FORMS_LABEL_USE_ITEM_KEY:               
                 
                $cLabel .= $cKey.$cClosing;                                
                break;
         
            case self::FORMS_LABEL_USE_ITEM_NAME:          
                 
                $cLabel .= $cName.$cClosing;                                   
                break;
             
            case self::FORMS_LABEL_USE_ITEM_VALUE:
                 
                $cLabel .= $cValue.$cClosing;                                          
                break;
             
            case self::FORMS_LABEL_BLANK:
             
                $cLabel .= $cClosing;
                break;             
             
            case self::FORMS_LABEL_NONE:
             
                $cLabel = NULL;
                break;
                 
            default:
                 
                $cLabel .= $iStyle.$cClosing;                          
        }
         
        /* Return label markup string. */
        return $cLabel;
    }
     
    public function forms_list_array_from_query($cQuery=NULL, $cParams=array(self::FORMS_QUERY_PARAMETERS_NONE), $cAddsT=self::FORMS_ITEM_ADDITIONS_NONE, $cAddsB=self::FORMS_ITEM_ADDITIONS_NONE){    
         
        /*
        forms_list_array_from_query
        Damon Vaughn Caskey
        2012-12-19
         
        Create list array directly from query results.
         
        $iType:     Select, options, etc.      
        $cQuery:    SQL query string.
        $cParams:   Parameter array.
        $cDefault:  Default selection.
        $cCurrent:  Current selection.
        $bKey:      Use key as item label?
        $cAddsT:    Additional items to place at top of generated list.
        $cAddsB:    Additional items to place at bottom of generated list.
        */
     
        $i      =   NULL;       //Counter.
        $cList  =   NULL;       //Output string.
        $cKey   =   NULL;
         
        $cList  =   array();
         
        /* Query for list items. */
        $this->oDB->db_basic_select($cQuery, $cParams);
                 
        /* Populate list variable. */
        while($this->oDB->db_line(SQLSRV_FETCH_NUMERIC))
        {  
            /* Get key (used for items visible to user). */
            $cKey = $this->oDB->cDBLine[1];
             
            /* If fields exist beyond first key, append to a single key value. */
            if($this->oDB->iDBFCount > 2)
            {  
                /* Start with field #2 (third field) and append to key string until last field is reached. */
                for($i = 2; $i <= ($this->oDB->iDBFCount-1); $i++)
                {
                    $cKey .= "; ". $this->oDB->cDBLine[$i];  
                }
            }
             
            /* Populate list array using visible portion of list values as key. */          
            $cList[$cKey] = $this->oDB->cDBLine[0];                                  
        }
         
        /* Merge Additions. (As of 5.4 array_merge() will always reorder indexes). */
        if($cAddsT && is_array($cAddsT))
        {  
            $cList = $cAddsT + $cList
        }
         
        if($cAddsB && is_array($cAddsB))
        {  
            $cList += $cAddsB
        }  
         
        $this->cItemsList = $cList;
         
        /* Output final list value. */
        return $this->cItemsList;
    }
     
    function forms_list_numeric($iType=NULL, $cQuery=NULL, $cParams=NULL, $cDefault=NULL, $cCurrent=NULL, $bKey=self::FORMS_LABEL_USE_ITEM_KEY, $iStart=0, $cAddsT=NULL, $cAddsB=NULL)
    {      
        /*
        forms_list_numeric
        Damon V. Caskey
        2012-12-19     
         
        Generate a simple numeric list with maximum value based number of rows returned by query.
         
        $iType:    
        $cQuery:    SQL query string.
        $cParams:   Parameter array.
        $cDefault:  Default selection.
        $cCurrent:  Current selection.
        $bKey:      Use key as item label?
        $iStart:    First numeric value of generated list.
        $cAddsT:    Additional items to place at top of generated list.
        $cAddsB:    Additional items to place at bottom of generated list.
        */
         
        $i      = NULL; //Counter.
        $cList  = NULL; //Item list array.                 
         
        $cList  = array();
                 
        $this->oDB->db_basic_select($cQuery, $cParams);  
                                 
        for($i = $iStart; $i <= $this->oDB->iDBRowCount; $i++)
        {      
            $cList[$i] = $i;
        }              
         
        /* Merge Additions. (As of 5.4 array_merge() will always reorder indexes). */
        if($cAddsT && is_array($cAddsT))
        {  
            $cList = $cAddsT + $cList
        }
         
        if($cAddsB && is_array($cAddsB))
        {  
            $cList += $cAddsB
        }
         
        switch ($iType)
        {
            case self::FORMS_TYPE_RADIO:
                //$this->cDLListCode = $this->forms_select_options($cList, $cDefault, $cCurrent, $bKey);
            default:
                $this->cDLListCode = $this->forms_select_options($cList, $cDefault, $cCurrent, $bKey);
        }
         
        return $this->cDLListCode;
    }
                          
    public function forms_phone($cName=NULL, $cID=self::FORMS_ID_USE_NAME, $cLabel=self::FORMS_LABEL_NONE, $cDefault=array("cc" => "1", "ac" => "859", "lc" => NULL, "pn" => NULL), $cCurrent=self::FORMS_VALUE_CURRENT_NONE, $cClass=NULL, $cEvents=NULL)
    {  
        /*
        forms_phone
        Damon Vaughn Caskey
        2013-01-21
         
        Output form phone input markup.
        */
     
        $cMarkup    =   NULL;   //Final markup to echo.
        $cEvent     =   NULL;   //Event string.
         
        $cMarkup .='<div class="'.$cClass['Container_All'].'">';
                 
        /* Set ID to name? */
        $cID = $cID != self::FORMS_ID_USE_NAME ? $cID : $cName;
         
        /* If current value empty or NULL, set "No current" cosntant */
        $cCurrent = $cCurrent ? $cCurrent : self::FORMS_VALUE_CURRENT_NONE;
         
        $cDefault = $cDefault == self::FORMS_VALUE_DEFAULT_NONE ? NULL : $cDefault;
         
        /* If no current value is available, use default. */
        if(!$cCurrent || $cCurrent == self::FORMS_VALUE_CURRENT_NONE)
        {
            $cCurrent = $cDefault;
        }
                 
        /* Parse event actions. */
        $cEvent = $this->forms_events_markup($cEvents);         
         
        /* Prepare label markup. */
        $cMarkup .= $this->forms_label_markup($cLabel, self::FORMS_LABEL_TYPE_FIELDSET, $cName, $cID, $cKey, $cValue);      
         
        $cMarkup .= '<div class="'.$cClass['Container_Item'].'"><input type="text" name="'.$cName.'_cc" id="'.$cID.'_cc" class="'.$cClass.'" value="'.$cDefault['cc'].'" size="1" maxlength="1" />
                          (
                            <input type="text" name="'.$cName.'_ac" id="'.$cID.'_ac" class="'.$cClass.'" value="'.$cDefault['ac'].'" size="3" maxlength="3" />
                            )
                            <input type="text" name="'.$cName.'_lc" id="'.$cID.'_lc" class="'.$cClass.'" value="'.$cDefault['lc'].'" size="3" maxlength="3" />
                          -
                          <input type="text" name="'.$cName.'_pn" id="'.$cID.'_pn" class="'.$cClass.'" value="'.$cDefault['pn'].'" size="4" maxlength="4" />               
                    </div></div>';     
        /*
        Return end result.
        */
        return $cMarkup;
    }  
                     
    public function forms_radio($cName=NULL, $cID=self::FORMS_ID_USE_NAME, $iLabelStyle=self::FORMS_LABEL_USE_ITEM_KEY, $cList=array(NULL), $cDefault=NULL, $cCurrent=self::FORMS_VALUE_CURRENT_NONE, $cClass=array("Item" => "Standard"), $cEvents=NULL)
    {
        /*
        forms_radio
        Damon Vaughn Caskey
        2013-03-24 
        */
                                 
        $cKey       =   NULL;   //Array key.
        $cValue     =   NULL;   //Array value.
        $cChecked   =   NULL;   //Checked (default/current)?
        $cMarkup    =   NULL;   //Final markup to echo.
        $cLabel     =   NULL;   //Item label markup.
        $cIDFinal   =   NULL;   //Final ID inserted into markup.
        $cEvent     =   NULL;  
         
        $cMarkup .='<div class="'.$cClass['Container_All'].'">';
         
        /* Set ID to name? */
        $cID = $cID != self::FORMS_ID_USE_NAME ? $cID : $cName;
         
        /* If current value empty or NULL, set "No current" cosntant */
        $cCurrent = $cCurrent ? $cCurrent : self::FORMS_VALUE_CURRENT_NONE;
         
        /* Parse event actions. */
        $cEvent = $this->forms_events_markup($cEvents);     
         
        foreach ($cList as $cKey => $cValue)
        {              
            /* If $cValue matches $cCurrent, or $cCurrent not provided but $cValue matches $cDefault, add 'checked' to make this the default list item selected. */
            if ($cCurrent == $cValue || ($cCurrent == self::FORMS_VALUE_CURRENT_NONE && $cValue == $cDefault))
            {
                $cChecked = 'checked="checked"';
            }
            else
            {
                $cChecked = NULL;
            }      
                     
            /* IDs must be unique, so we'll combine ID with value. */
            $cIDFinal = $cID."_".$cValue;          
             
            /* Prepare label markup. */
            $cMarkup .= $this->forms_label_markup($iLabelStyle, self::FORMS_LABEL_TYPE_FIELDSET, $cName, $cIDFinal, $cKey, $cValue);        
             
            $cMarkup .= '<div class="'.$cClass['Container_Item'].'"><input type="radio" name="'.$cName.'" id="'.$cIDFinal.'" value="'.$cValue.'" '.$cChecked.' '.$cEvent.' /></div>';        
        }                  
         
        $cMarkup .= '</div>';
         
        /*
        Return end result.
        */
        return $cMarkup;
     
    }
     
    public function forms_select($cName=NULL, $cID=self::FORMS_ID_USE_NAME, $iLabelStyle=self::FORMS_LABEL_USE_ITEM_KEY, $iKeyStyle=self::FORMS_LABEL_USE_ITEM_KEY, $cList=array(NULL => NULL), $cDefault=NULL, $cCurrent=self::FORMS_VALUE_CURRENT_NONE, $cClass=array("Item" => "Standard", "Container_All" => "Show Me"), $cEvents=NULL)
    {
        /*
        forms_radio
        Damon Vaughn Caskey
        2013-03-24 
        */
                                 
        $cKey       =   NULL;   //Array key.
        $cValue     =   NULL;   //Array value.
        $cChecked   =   NULL;   //Checked (default/current)?
        $cMarkup    =   NULL;   //Final markup to echo.
        $cLabel     =   NULL;   //Item label markup.
        $cEvent     =   NULL;  
        $cItems     =   NULL;   //Select options.
         
        $cMarkup .='<div class="'.$cClass['Container_All'].'">';
         
        /* Set ID to name? */
        $cID = $cID != self::FORMS_ID_USE_NAME ? $cID : $cName;    
         
        /* Parse event actions. */
        $cEvent = $this->forms_events_markup($cEvents);     
         
        if (!is_array($cList))
        {
            $cList = array(NULL => NULL);
        }
         
        foreach ($cList as $cKey => $cValue)
        {              
            /* If $cValue matches $cCurrent, or $cCurrent not provided but $cValue matches $cDefault, add 'checked' to make this the default list item selected. */
            if ($cCurrent == $cValue || ($cCurrent == self::FORMS_VALUE_CURRENT_NONE && $cValue == $cDefault))
            {
                $cChecked = 'selected';
            }
            else
            {
                $cChecked = NULL;
            }      
                     
            /* Prepare label markup. */
            $cLabel = $this->forms_label_markup(self::FORMS_LABEL_USE_ITEM_KEY, self::FORMS_LABEL_TYPE_INLINE, $cName, $cID, $cKey, $cValue);   
             
            $cItems.='<option value="'.$cValue.'" '.$cChecked.'>' . $cLabel . '</option>';         
        }              
         
         
        /* Prepare label markup. */
        $cLabel = $this->forms_label_markup($iLabelStyle, self::FORMS_LABEL_TYPE_FIELDSET, $cName, $cID, $cKey, $cValue);   
 
        $cMarkup .= $cLabel.'<div class="'.$cClass['Container_Item'].'"><select type="select" name="'.$cName.'" id="'.$cID.'" class="'.$cClass['Item'].'" '.$cEvent.'>'.$cItems.'</select></div></div>';
         
        /*
        Return end result.
        */
        return $cMarkup;
     
    }
                     
    public function forms_text($cName=NULL, $cID=self::FORMS_ID_USE_NAME, $cLabel=self::FORMS_LABEL_NONE, $cDefault=self::FORMS_VALUE_DEFAULT_NONE, $cCurrent=self::FORMS_VALUE_CURRENT_NONE, $cClass=array("Item" => "Standard"), $cEvents=NULL)
    {  
        /*
        forms_text
        Damon Vaughn Caskey
        2013-01-21
         
        Output form text input markup.             
        */
     
        $cMarkup    =   NULL;   //Final markup to echo.
        $cEvent     =   NULL;   //Event string.
         
        $cMarkup .='<div class="'.$cClass['Container_All'].'">';
                 
        /* Set ID to name? */
        $cID = $cID != self::FORMS_ID_USE_NAME ? $cID : $cName;
         
        /* If current value empty or NULL, set "No current" cosntant */
        $cCurrent = $cCurrent ? $cCurrent : self::FORMS_VALUE_CURRENT_NONE;
         
        $cDefault = $cDefault == self::FORMS_VALUE_DEFAULT_NONE ? NULL : $cDefault;
         
        /* If no current value is available, use default. */
        if(!$cCurrent || $cCurrent == self::FORMS_VALUE_CURRENT_NONE)
        {
            $cCurrent = $cDefault;
        }
                 
        /* Parse event actions. */
        $cEvent = $this->forms_events_markup($cEvents);         
         
        /* Prepare label markup. */
        $cMarkup .= $this->forms_label_markup($cLabel, self::FORMS_LABEL_TYPE_FIELDSET, $cName, $cID, $cKey, $cValue);
                     
        $cMarkup .= '<div class="'.$cClass['Container_Item'].'"><input type="text" name="'.$cName.'" id="'.$cID.'" class="'.$cClass['Item'].'" value="'.$cCurrent.'" '.$cEvent.' /></div></div>';
         
        /*
        Return end result.
        */
        return $cMarkup;
    }
     
    public function forms_time($cName=NULL, $cID=self::FORMS_ID_USE_NAME, $cLabel=self::FORMS_LABEL_NONE, $cDefault=NULL, $cCurrent=NULL, $cOptions="{dateFormat: 'yy-mm-dd', timeFormat: 'HH:mm:ss', controlType: 'select', changeYear: true, constrainInput: true}", $cFunction="datetimepicker", $bReadOnly=self::FORMS_READ_ONLY_ON, $cClass=NULL, $cEvents=NULL)
    {  
        /*
        forms_time
        Damon Vaughn Caskey
        2013-01-21
         
        Output form date/time input markup.
        */
     
        $cMarkup    =   NULL;   //Final markup to echo.
        $cEvent     =   NULL;   //Event string.
                 
        $cMarkup .='<div class="'.$cClass['Container_All'].'">';
                 
        /* Set ID to name? */
        $cID = $cID != self::FORMS_ID_USE_NAME ? $cID : $cName;
         
        /* If current value empty or NULL, set "No current" cosntant */
        $cCurrent = $cCurrent ? $cCurrent : self::FORMS_VALUE_CURRENT_NONE;
         
        $cDefault = $cDefault == self::FORMS_VALUE_DEFAULT_NONE ? NULL : $cDefault;
         
        /* If no current value is available, use default. */
        if(!$cCurrent || $cCurrent == self::FORMS_VALUE_CURRENT_NONE)
        {
            $cCurrent = $cDefault;
        }
                                 
        /* Parse event actions. */
        $cEvent = $this->forms_events_markup($cEvents);         
         
        /* Prepare label markup. */
        $cMarkup .= $this->forms_label_markup($cLabel, self::FORMS_LABEL_TYPE_FIELDSET, $cName, $cID, $cKey, $cValue);      
         
        $cMarkup .= "<script>$(function(){
                        $( '#".$cID."' ).".$cFunction."(".$cOptions.");
                    });</script>";
 
        $cMarkup .= "<input type='text' name='".$cName."' id='".$cID."' value='".$cCurrent."'";
         
        if ($bReadOnly==TRUE)
        {
            $cMarkup .= " readonly='readonly'";
        }
         
        $cMarkup .= " /></div>";
         
        /*  Return end result. */
        return $cMarkup;
    }
     
    public function forms_fieldset($cID=NULL, $cLegend=self::FORMS_LEGEND_NONE, $cElements=array(NULL), $cAddOns=array(NULL), $cClass=array("Div"=>"table_row_0", "Fieldset"=>"Standard"))
    {
        /*
        forms_fieldset
        Damon Vaughn Caskey
        2013-03-25
         
        Arrage form input items into a fieldset.
         
        $cID:       Fieldset ID.
        $cLegend:   Legend label, if any.
        $cElements: Markup of field list items (select lists, radio groups, text boxes, etc).
        $cClass:    Style classes.
        */
         
        $cElementKey    = NULL; //Single element key.
        $cElementVal    = NULL; //Single element value.
         
        $cMarkup = '<div class="'.$cClass['Div'].'"><fieldset id="'.$cID.'" class="'.$cClass['Fieldset'].'">';
         
         
        if($cLegend != self::FORMS_LEGEND_NONE)
        {
            $cMarkup .= '<legend>'.$cLegend.'</legend>';    
        }              
         
        foreach($cAddOns as $cElementKey => $cElementVal)
        {
            $cMarkup .= '<div class="'.$cElementKey.'">'.$cElementVal.'</div>';
        }  
         
        foreach($cElements as $cElementKey => $cElementVal)
        {
            $cMarkup .= '<div class="'.$cElementKey.'">'.$cElementVal.'</div>';
        }      
         
        $cMarkup .= '</fieldset></div>';
         
        $this->cFieldset[$cID] = $cMarkup;
         
        return $this->cFieldset[$cID];
    }
         
}
?>

Author: Damon Caskey

Hello all, Damon Caskey here - the esteemed owner of this little slice of cyberspace. Welcome!

Leave a Reply