Example #1
0
function display_form($form_id, $mode, $prams, $section)
{
    global $label;
    global $admin;
    global $subscr_block_status;
    //print_r( $prams);
    if (func_num_args() > 4) {
        $dont_break_table = func_get_arg(4);
    }
    $sql = "SELECT t2.field_label AS FLABEL, t1.* AS ID, t2.field_comment AS FCOMMENT FROM form_fields AS t1, form_field_translations AS t2 WHERE t1.field_id=t2.field_id AND lang='" . $_SESSION['MDS_LANG'] . "' AND section='{$section}' AND form_id='{$form_id}' {$where_sql} order by field_sort  ";
    //echo $sql;
    $result = mysql_query($sql) or die(mysql_error());
    if (!$dont_break_table) {
        ?>
	
	<table id="dynamic_form" class="dynamic_form" cellSpacing="1" cellPadding="3"  >


	<?php 
    }
    $count = mysql_num_rows($result);
    $i = 0;
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $i++;
        if ($mode == 'EDIT' && $_REQUEST['field_id'] == $row['field_id']) {
            $bg_selected = ' style="background-color: #FFFFCC;" ';
        } else {
            $bg_selected = '';
        }
        // load init value...
        if ($prams[$row['field_id']] == '') {
            $prams[$row['field_id']] = $row['field_init'];
        }
        ########################
        if ($row[is_hidden] == "Y" && $mode == "view" && !$admin) {
            # Hidden Fields, do not appear on website (view mode)
        } elseif ($row[field_type] == "SEPERATOR") {
            ?>

				<tr <?php 
            echo $bg_selected;
            ?>
>
				<td colspan="2" class="dynamic_form_seperator" ><font face="Arial" size="2"><b><?php 
            if ($mode == 'EDIT') {
                echo_order_arrows($row);
                echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-"> ';
            }
            echo $row[FLABEL];
            if ($mode == 'EDIT') {
                echo '</a>';
            }
            ?>
</b></font></td>
				</tr>

				<?php 
        } elseif ($row['field_type'] == "SKILL_MATRIX") {
            ?>

					<tr <?php 
            echo $bg_selected;
            ?>
>
					<td <?php 
            echo $bg_selected;
            ?>
 class="dynamic_form_field">
					<?php 
            if ($mode == 'EDIT') {
                echo_order_arrows($row);
                echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-"> ';
            }
            echo "<b>" . $row['FLABEL'] . "</b>";
            if ($mode == 'EDIT') {
                echo '</a>';
                ?>
					<br>
					- 
					<a href=""
					onclick="window.open('build_matrix.php?field_id=<?php 
                echo $row[field_id];
                ?>
', '', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=1,width=550,height=500,left = 50,top = 50');return false;"> [Skill Matrix Settings...]
					</a>

					<?php 
            }
            ?>
					</td>
				<td <?php 
            echo $bg_selected;
            ?>
 class="dynamic_form_value"><font face="Arial" size="2"><?php 
            if ($row['FCOMMENT'] != '') {
                echo " <br>" . $row['FCOMMENT'] . "";
            }
            display_matrix($row['field_id'], $prams, $mode);
            ?>
</b></font></td>
				</tr>

			
			<?php 
        } elseif ($row['field_type'] == "IMAGE") {
            ?>
				<tr>
				<td class="dynamic_form_2_col_field" nowrap valign="top"  colspan="2" <?php 
            echo $bg_selected;
            ?>
  >
				<?php 
            if ($mode == 'EDIT') {
                echo_order_arrows($row);
                echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">';
            }
            echo "<span class='dynamic_form_image_label'>" . $row['FLABEL'] . "</span><br>";
            if ($mode == 'EDIT') {
                echo '</a>';
            }
            if ($mode == 'EDIT' && is_reserved_template_tag($row['template_tag'])) {
                $alt = get_reserved_tag_description($row[template_tag]);
                ?>
					<a href="" onclick="alert('<?php 
                echo htmlentities($alt);
                ?>
');return false;">

					<IMG SRC="../admin/reserved.gif" WIDTH="13" HEIGHT="13" BORDER="0" ALT="<?php 
                echo $alt;
                ?>
">

					</a>
					
	
					<?php 
            }
            if ($prams[$row[field_id]] != '') {
                if ($is_hidden == 'Y' || $is_blocked == 'Y') {
                    echo $prams[$row[field_id]];
                } else {
                    if ($_REQUEST['del_image' . $row[field_id]] != '') {
                        unlink(UPLOAD_PATH . 'images/' . $prams[$row[field_id]]);
                        //@unlink (UPLOAD_PATH.''.$prams[$row[field_id]]);
                    }
                    if (file_exists(UPLOAD_PATH . 'images/' . $prams[$row[field_id]])) {
                        ?>
					<img alt="" src="<?php 
                        echo UPLOAD_HTTP_PATH . 'images/' . $prams[$row[field_id]];
                        ?>
" >
				<?php 
                    } else {
                        echo '<IMG SRC="' . UPLOAD_HTTP_PATH . 'images/no-image.gif" WIDTH="150" HEIGHT="150" BORDER="0" ALT="">';
                    }
                }
            } else {
                echo '<IMG SRC="' . UPLOAD_HTTP_PATH . 'images/no-image.gif" WIDTH="150" HEIGHT="150" BORDER="0" ALT="">';
            }
            if (strtolower($mode) == 'edit') {
                // delete image button
                if (file_exists(UPLOAD_PATH . 'images/' . $prams[$row[field_id]]) && $prams[$row[field_id]] != '') {
                    $image_field_id = $row[field_id];
                    echo "<br><input type='hidden' name='del_image" . $row[field_id] . "' value=''><input type='button' value='" . $label['delete_image_button'] . "' onclick='document.form1.del_image" . $row[field_id] . ".value=\"" . $image_field_id . "\"; document.form1.submit()'><br>";
                } else {
                    // upload image form
                    echo "<br>" . $label['upload_image'] . '<br> ' . form_image_field($row[field_id], $prams[$row[field_id]]);
                    if ($row['FCOMMENT'] != '') {
                        echo " <br>" . $row['FCOMMENT'] . "";
                    }
                }
            }
            ?>
 
				</td>
				</tr>
			
				<?php 
        } elseif ($row[field_type] == "FILE") {
            ?>
			
				<tr>
				<td valign="top" class="dynamic_form_2_col_field" colspan="2"   <?php 
            echo $bg_selected;
            ?>
 >
				<span >
				<?php 
            if ($mode == 'EDIT') {
                echo_order_arrows($row);
                echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">';
            }
            //if ($mode !='view') {
            echo "<span class=\"dynamic_form_image_label\" >" . $row[FLABEL] . "</span><br>";
            //}
            if ($mode == 'EDIT') {
                echo '</a>';
            }
            if ($mode == 'EDIT' && is_reserved_template_tag($row[template_tag])) {
                $alt = get_reserved_tag_description($row[template_tag]);
                ?>
					<a href="" onclick="alert('<?php 
                echo htmlentities($alt);
                ?>
');return false;">
					<IMG SRC="../admin/reserved.gif" WIDTH="13" HEIGHT="13" BORDER="0" ALT="<?php 
                echo $alt;
                ?>
">
					</a>
					<?php 
            }
            if ($_REQUEST['del_file' . $row[field_id]] != '') {
                @unlink(UPLOAD_PATH . 'docs/' . $prams[$row[field_id]]);
                //@unlink (IMG_PATH.''.$prams[$row[field_id]]);
            }
            if ($prams[$row[field_id]] != '' && file_exists(UPLOAD_PATH . '/docs' . $prams[$row[field_id]])) {
                ?>
					<a href="<?php 
                echo UPLOAD_HTTP_PATH . '' . $prams[$row[field_id]];
                ?>
" >
					
					<IMG alt="" src="../images/file.gif" width="20" height="20" border="0" alt=""> 
					<?php 
                echo $prams[$row[field_id]];
                ?>
 </a> - <?php 
                echo filesize(UPLOAD_PATH . "" . $prams[$row[field_id]]);
                ?>
 <?php 
                echo $label['bytes'] . "<br>";
                ?>
				<?php 
            } elseif ($mode == 'view') {
                echo '<i>' . $label['no_file_uploaded'] . '</i>';
            }
            if (strtolower($mode) == 'edit') {
                if (file_exists(UPLOAD_PATH . '/docs/' . $prams[$row[field_id]]) && $prams[$row[field_id]] != '') {
                    //if ($mode != 'view') {
                    $image_field_id = $row[field_id];
                    echo "<br><input type='hidden' name='del_file" . $row[field_id] . "' value=''><input type='button' value='" . $label['delete_file_button'] . "' onclick='document.form1.del_file" . $row[field_id] . ".value=\"" . $image_field_id . "\"; document.form1.submit()'><br>";
                    //}
                } else {
                    echo $label['upload_file'] . " " . form_file_field($row[field_id], $prams[$row[field_id]]);
                    if ($row['FCOMMENT'] != '') {
                        echo " <br>" . $row['FCOMMENT'] . "";
                    }
                }
            }
            ?>
					</span>
			</td> 
				</tr>
			
				<?php 
        } elseif ($row[field_type] == "NOTE") {
            if ($mode == 'view') {
            } else {
                ?>
				

				<tr>
				<td colspan="2" valign="top" class="dynamic_form_2_col_field" <?php 
                echo $bg_selected;
                ?>
 ><span class="dynamic_form_note_label"><?php 
                if ($mode == 'EDIT') {
                    echo_order_arrows($row);
                    echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-"> ';
                }
                echo $row[FLABEL];
                if ($mode == 'EDIT') {
                    echo '</a>';
                }
                if ($mode == 'EDIT' && is_reserved_template_tag($row[template_tag])) {
                    $alt = get_reserved_tag_description($row[template_tag]);
                    ?>
					<a href="" onclick="alert('<?php 
                    echo htmlentities($alt);
                    ?>
');return false;">

					<IMG SRC="../admin/reserved.gif" WIDTH="13" HEIGHT="13" BORDER="0" ALT="<?php 
                    echo $alt;
                    ?>
">

					</a>
	
					<?php 
                }
                ?>
</span></td>
				</tr>

			
				<?php 
            }
        } elseif ($row[field_type] == "MIME") {
            // do nothing. It is an extra field for FILE type fields..
        } else {
            if ($row[FLABEL] == '') {
                $row[FLABEL] = '&nbsp;&nbsp';
            }
            ?>
		  
			<tr >
				<td class="dynamic_form_field" <?php 
            echo $bg_selected;
            ?>
  valign="top" ><?php 
            if ($mode == 'EDIT') {
                echo_order_arrows($row);
                echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">';
            }
            echo $row[FLABEL];
            if ($mode == 'EDIT') {
                echo '</a>';
            }
            if ($row[is_required] == 'Y' && $mode != 'view') {
                echo "<FONT SIZE='4' COLOR='#FF0000'><b>*</B></FONT>";
            }
            if ($mode == 'EDIT' && is_reserved_template_tag($row[template_tag])) {
                $alt = get_reserved_tag_description($row[template_tag]);
                ?>
					<a href="" onclick="alert('<?php 
                echo htmlentities($alt);
                ?>
');return false;">

					<IMG SRC="../admin/reserved.gif" WIDTH="13" HEIGHT="13" BORDER="0" ALT="<?php 
                echo $alt;
                ?>
">

					</a>
	
					<?php 
            }
            if ($mode == 'EDIT' && $row[field_type] == 'BLANK') {
                echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $row['field_id'] . '&mode=EDIT">[]</a>';
            }
            ?>
</td>
				<td class="dynamic_form_value" <?php 
            echo $bg_selected;
            ?>
 >
				
				<?php 
            if ($is_hidden == 'Y' || $is_blocked == 'Y') {
                echo $prams[$row['field_id']];
                // display blocked field message
            } else {
                switch ($row[field_type]) {
                    case "TEXT":
                        if ($mode == 'view') {
                            $val = $prams[$row['field_id']];
                            $val = escape_html($val);
                            if (EMAIL_AT_REPLACE == "YES") {
                                $val = str_replace("@", '<IMG SRC="' . BASE_HTTP_PATH . 'images/at.gif" WIDTH="13" HEIGHT="9" BORDER="0" ALT="">', $val);
                            } elseif (EMAIL_AT_REPLACE == "YES_2") {
                                $val = str_replace("@", '&#64;', $val);
                            }
                            echo $val;
                        } else {
                            echo form_text_field($row['field_id'], $prams[$row['field_id']], $row['field_width']);
                            if ($row['FCOMMENT'] != '') {
                                echo " " . $row['FCOMMENT'] . "";
                            }
                        }
                        break;
                    case "SEPERATOR":
                        break;
                    case "EDITOR":
                        $val = $prams[$row['field_id']];
                        if ($mode == 'view') {
                            $val = process_for_html_output($val);
                            //echo '<font face="arial" size="2">'.$prams[$row[field_id]].'</font>';
                            echo $val;
                        } else {
                            if ($row['FCOMMENT'] != '') {
                                echo $row['FCOMMENT'] . "<br>";
                            }
                            echo form_editor_field($row['field_id'], $val, $row['field_width'], $row['field_height']);
                        }
                        break;
                    case "TEXTAREA":
                        if ($mode == 'view') {
                            //$val = process_for_html_output ($prams[$row[field_id]]);
                            $val = escape_html($prams[$row['field_id']]);
                            $val = str_replace("\n", "<br>", $val);
                            if (EMAIL_AT_REPLACE == "YES") {
                                $val = str_replace("@", '<IMG SRC="' . BASE_HTTP_PATH . 'images/at.gif" WIDTH="13" HEIGHT="9" BORDER="0" ALT="">', $val);
                            } elseif (EMAIL_AT_REPLACE == "YES_2") {
                                $val = str_replace("@", '&#64;', $val);
                            }
                            echo $val;
                        } else {
                            if ($row['FCOMMENT'] != '') {
                                $row['FCOMMENT'] . "<br>";
                            }
                            echo form_textarea_field($row['field_id'], $prams[$row['field_id']], $row['field_width'], $row['field_height']);
                        }
                        break;
                    case "CATEGORY":
                        $str = getPath($prams[$row['field_id']]);
                        //if (!$str) {
                        //$str = $prams[$row[field_id]];
                        //}
                        if ($mode == 'view') {
                            echo $str;
                        } else {
                            echo form_category_field($row['field_id'], $row['category_init_id'], $prams[$row['field_id']], $form_id);
                            if ($row['FCOMMENT'] != '') {
                                echo "" . $row['FCOMMENT'] . "<br>";
                            }
                        }
                        break;
                    case "DATE":
                    case "DATE_CAL":
                        if ($mode == 'view') {
                            if ($is_blocked == 'Y') {
                                // output a string
                                echo $prams[$row['field_id']];
                            } else {
                                // output a date
                                if ($prams[$row['field_id']] != '0000-00-00 00:00:00') {
                                    echo get_formatted_date($prams[$row['field_id']]);
                                } else {
                                    echo "";
                                }
                            }
                        } else {
                            if ($row['field_type'] == 'DATE') {
                                // traditional date input
                                preg_match("/(\\d+)-(\\d+)-(\\d+)/", $prams[$row['field_id']], $m);
                                // Year - Month - Day (database output format)
                                $year = $m[1];
                                $day = $m[3];
                                $month = $m[2];
                                echo form_date_field($row['field_id'], $day, $month, $year, "dynamic_form_date_style");
                            } else {
                                // scw input
                                ?>

										<input name="<?php 
                                echo $row['field_id'];
                                ?>
" onclick= "scwShow(this,this);" size="10" onfocus= "scwShow(this,this);" type="text" value="<?php 
                                echo trim_date($prams[$row['field_id']]);
                                ?>
">

										<?php 
                            }
                            if ($row['FCOMMENT'] != '') {
                                echo " " . $row['FCOMMENT'] . "";
                            }
                        }
                        break;
                    case "SELECT":
                        if ($mode == 'view') {
                            echo getCodeDescription($row['field_id'], $prams[$row['field_id']]);
                        } else {
                            form_select_field($row['field_id'], $prams[$row['field_id']]);
                        }
                        if ($mode == 'EDIT') {
                            ?>
							<a href=""
							onclick="window.open('maintain_codes.php?field_id=<?php 
                            echo $row['field_id'];
                            ?>
', '', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=1,width=400,height=500,left = 50,top = 50');return false;"> [Edit Options]
							</a>

							<?php 
                        }
                        break;
                    case "RADIO":
                        if ($mode == 'view') {
                            echo getCodeDescription($row['field_id'], $prams[$row['field_id']]);
                        } else {
                            form_radio_field($row['field_id'], $prams[$row['field_id']]);
                        }
                        if ($mode == 'EDIT') {
                            ?>
							<a href=""
							onclick="window.open('maintain_codes.php?field_id=<?php 
                            echo $row['field_id'];
                            ?>
', '', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=1,width=400,height=500,left = 50,top = 50');return false;"> [Edit Options]
							</a>

							<?php 
                        }
                        break;
                    case "CHECK":
                        form_checkbox_field($row['field_id'], $prams[$row['field_id']], $mode);
                        if ($mode == 'EDIT') {
                            ?>
							<a href=""
							onclick="window.open('maintain_codes.php?field_id=<?php 
                            echo $row['field_id'];
                            ?>
', '', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=1,width=400,height=500,left = 50,top = 50');return false;"> [Edit Options]
							</a>

							<?php 
                        }
                        break;
                    case "MSELECT":
                        form_mselect_field($row['field_id'], $prams[$row['field_id']], $row['field_height'], $mode);
                        if ($mode == 'EDIT') {
                            ?>
							<a href=""
							onclick="window.open('maintain_codes.php?field_id=<?php 
                            echo $row['field_id'];
                            ?>
', '', 'toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=1,width=400,height=500,left = 50,top = 50');return false;"> [Edit Options]
							</a>

							<?php 
                        }
                        break;
                    case "NOTE":
                        break;
                    case "MIME":
                        break;
                    case "BLANK":
                        echo "&nbsp;";
                        break;
                }
            }
            ?>
				
				</td>
			    </tr>
				
  <?php 
        }
    }
    if (!$dont_break_table) {
        ?>
	
		</table>
  

		<?php 
    }
}
Example #2
0
function echo_ad_list_data($admin)
{
    global $column_list, $column_info, $label, $cur_offset, $order_str, $q_offset, $show_emp, $cat, $list_mode;
    if ($_REQUEST['order_by'] != '') {
        $ord = $_REQUEST['ord'];
        if ($ord == 'asc') {
            $ord = 'desc';
        } elseif ($ord == 'desc') {
            $ord = 'asc';
        } else {
            $ord = 'desc';
        }
        $order_str = "&order_by=" . $_REQUEST['order_by'] . "&ord=" . $ord;
    }
    foreach ($column_list as $template_tag) {
        $val = get_template_value($template_tag, 1, $admin);
        //$val = $val.$template_tag;
        if ($column_info[$template_tag]['admin'] == 'Y' && !$admin) {
            continue;
            // do not render this column
        }
        if ($column_info[$template_tag]['trunc'] > 0) {
            $val = truncate_html_str($val, $column_info[$template_tag]['trunc'], $trunc_str_len);
        }
        // process the value depending on what kind of template tag it was given.
        if ($template_tag == 'DATE') {
            $init_date = strtotime(trim_date($val) . " GMT");
            // the last date modified
            $dst_date = strtotime(trim_date(gmdate("r")) . " GMT");
            // now
            if (!$init_date) {
                $days = "x";
            } else {
                $diff = $dst_date - $init_date;
                $days = floor($diff / 60 / 60 / 24);
            }
            //echo $days;
            $FORMATTED_DATE = get_formatted_date(get_local_time($val));
            $val = $FORMATTED_DATE . "<br>";
            if ($days == 0) {
                $val = $val . '<span class="today"><b>' . $label["ads_list_today"] . '</span>';
            } elseif ($days > 0 && $days < 2) {
                $val = $val . '<span class="days_ago">' . $days . " " . $label["ads_list_day_ago"] . "</span>";
            } elseif ($days > 1 && $days < 8) {
                $val = $val . '<span class="days_ago">' . $days . " " . $label["ads_list_days_ago"] . "</span>";
            } elseif ($days >= 8) {
                $val = $val . '<span class="days_ago2">' . $days . " " . $label["ads_list_days_ago"] . "</span>";
            }
        }
        if ($column_info[$template_tag]['is_bold'] == 'Y') {
            $b1 = "<b>";
            $b2 = "</b>";
        } else {
            $b1 = '';
            $b2 = '';
        }
        if ($column_info[$template_tag]['clean'] == 'Y') {
            // fix up punctuation spacing
            $val = preg_replace('/ *(,|\\.|\\?|!|\\/|\\\\) */i', '$1 ', $val);
        }
        if ($column_info[$template_tag]['link'] == 'Y') {
            // Render as a Link to the record?
            $AD_ID = get_template_value('AD_ID', 1, $admin);
            $val = '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?ad_id=' . $AD_ID . '&offset=' . $cur_offset . $order_str . $q_string . '"';
            /// IMAGE PREVIEW MOUSEOVER Code
            // Note: to have this feature working, you must have a template tag called 'IMAGE' defined in the resume form
            define('PREVIEW_AD', 'YES');
            if (PREVIEW_AD == 'YES') {
                $ALT_TEXT = get_template_value('ALT_TEXT', 1, $admin);
                //$AD_ID = get_template_value ('AD_ID', 1, $admin);
                $js_str = " onmousemove=\"sB(event,'" . htmlspecialchars(str_replace("'", "\\'", $ALT_TEXT)) . "',this, " . $AD_ID . ")\" onmouseout=\"hI()\" ";
                $val = $val . $js_str;
            }
            $val = $val . '>' . get_template_value($template_tag, 1, $admin) . "</a>";
        }
        ?>
		<td class="list_data_cell" <?php 
        if ($column_info[$template_tag]['no_wrap'] == 'Y') {
            echo ' nowrap ';
        }
        ?>
>
			<?php 
        echo $b1 . $val . $b2;
        ?>
		</td>

		<?php 
    }
}
Example #3
0
function date_input($fdate = '', $sdate = '')
{
    // form row with structured date input
    global $_before, $_say, $_ca, $_exact, $_after, $_between, $_or, $_from_to, $_Date, $_Sort_date;
    $fd_type[0] = $_before;
    $fd_type[1] = $_say;
    $fd_type[2] = $_ca;
    $fd_type[3] = $_exact;
    $fd_type[4] = $_after;
    $fd_type[5] = $_between;
    $fd_type[6] = $_or;
    $fd_type[7] = $_from_to;
    echo "<tr><td>{$_Date}:</td><td>";
    $fdate ? $ftype = substr($fdate, 8, 1) : ($ftype = 3);
    $fdate ? $fdate_1 = trim_date(substr($fdate, 0, 8)) : ($fdate_1 = '');
    $fdate ? $fdate_2 = trim_date(substr($fdate, 9, 8)) : ($fdate_2 = '');
    echo "<input type=\"text\" size=\"10\" name=\"date_1\" value=\"{$fdate_1}\" />\n";
    echo "<select name = \"date_type\">\n";
    for ($i = 0; $i < 8; $i++) {
        $option = "<option";
        if ($i == $ftype) {
            $option .= " selected=\"selected\"";
        }
        $option .= " value=\"{$i}\">";
        $option .= $fd_type[$i] . "</option>\n";
        echo $option;
    }
    echo "</select>\n";
    echo "<input type=\"text\" size=\"10\" name=\"date_2\" value=\"{$fdate_2}\" />";
    echo " {$_Sort_date}: ";
    echo "<input type=\"text\" size=\"20\" name=\"sort_date\" value=\"{$sdate}\" />";
    echo "</td></tr>\n";
}