示例#1
0
function JB_init_category_tables($cat)
{
    global $AVAILABLE_LANGS;
    // loop for each language
    foreach ($AVAILABLE_LANGS as $key => $val) {
        // get the category_name from the categories table, which also has a translation in the
        // cat_name_translations table
        $sql = "SELECT categories.category_id, categories.category_name, lang FROM cat_name_translations, categories WHERE categories.category_id=cat_name_translations.category_id AND categories.category_id='" . jb_escape_sql($cat) . "' AND lang='" . jb_escape_sql($key) . "' ";
        $result = JB_mysql_query($sql) or die(mysql_error());
        // if the above query return no rows then it means that the row does not exist in
        // the cat_name_translations table.
        // So we create a new row for the translation
        if (mysql_num_rows($result) == 0) {
            $cat_row = JB_get_category($cat);
            $sql = "REPLACE INTO `cat_name_translations` (`category_id`, `lang`, `category_name`) VALUES ('" . jb_escape_sql($cat) . "', '" . jb_escape_sql($key) . "', '" . addslashes($cat_row['category_name']) . "')";
            //echo "<b>$sql</b>";
            JB_mysql_query($sql) or die(mysql_error() . $sql);
        }
    }
    // Update the search set for the category
    $search_set = JB_get_search_set($cat);
    $sql = "UPDATE categories set search_set='" . jb_escape_sql($search_set) . "' WHERE category_id='" . jb_escape_sql($cat) . "'";
    JB_mysql_query($sql) or die(mysql_error() . $sql);
    // This is a recursive function, so here we get the children categories
    // and call this function on the children.
    $query = "SELECT * FROM categories WHERE parent_category_id='" . jb_escape_sql($cat) . "' ";
    $result = JB_mysql_query($query) or die(mysql_error() . $query);
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        JB_init_category_tables($row['category_id']);
    }
}
示例#2
0
}
?>
</h3>
</div>



<?php 
if ($edit == '') {
    //echo "<tr>";
    JB_add_new_cat_form($_REQUEST['cat']);
    //echo"</tr>";
    echo "<hr>";
}
if ($edit != '') {
    $row = JB_get_category($edit);
    ?>
<P>
	<form action="<?php 
    echo htmlentities($_SERVER['PHP_SELF']);
    ?>
?action=edit" method="post">
	<table border="0">
		<tr>
			<td>
				<font size="2">Edit Category Name:</font>
			</td>
			<td>
				<input type="text" name="new_name" size="35" value="<?php 
    echo jb_escape_html($row['NAME']);
    ?>
示例#3
0
 function JBJobCategoryPage($cat_id, $offset, $admin = false)
 {
     $this->cat_id = (int) $cat_id;
     $this->list_mode = 'BY_CATEGORY';
     $this->page_name = "CATEGORY_PAGE";
     // load the posts in the category
     $this->category = JB_get_category($this->cat_id);
     $this->vars = array('cat_id' => $this->cat_id, 'CAT_NAME' => JB_getCatName($this->cat_id), 'CAT_PATH' => JB_getPath_templated($this->cat_id), 'CAT_STRUCT' => JB_getCatStruct($this->cat_id, $_SESSION["LANG"], 1), 'category' => &$this->category, 'admin' => $admin);
     JBPLUG_do_callback('init_job_category_page_vars', $this->vars);
     // register the header_tags() method so that JBMarkup can call it back
     global $JBMarkup;
     $JBMarkup->set_handler('header', $this, 'header_tags');
 }
示例#4
0
    function display_form_section($mode, $section, $admin, $dont_break_container = false)
    {
        global $label;
        # HTML output for this function comes from JBDynamicFormMarkup Class
        # include/themes/default/JBDynamicFormMarkup.php
        # Any HTML customizations should be done there.
        # Please copy this class in to your custom theme directory, and
        # customize form there
        $DFM =& $this->get_DynamicFormMarkup();
        $this->set_mode($mode);
        $cache_key = 'field_list_' . $section . '_' . $this->form_id . '_' . $_SESSION['LANG'];
        if (!($field_list = jb_cache_get($cache_key))) {
            $sql = "SELECT t2.field_label AS FLABEL, t1.*, t1.field_id 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='" . JB_escape_sql($_SESSION['LANG']) . "' AND section='" . JB_escape_sql($section) . "' AND form_id='" . JB_escape_sql($this->form_id) . "' ORDER BY field_sort  ";
            $result = JB_mysql_query($sql) or die(mysql_error());
            $field_list = array();
            while ($field_row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                $field_list[] = $field_row;
            }
            jb_cache_add($cache_key, $field_list);
        }
        if (!$dont_break_container) {
            $DFM->open_container();
            // put in a tag to start the element containing the form
        }
        if (!sizeof($field_list)) {
        }
        // There are no fields in this section to render...
        $i = 0;
        foreach ($field_list as $field_row) {
            $i++;
            if (method_exists($DFM, 'set_field_row')) {
                $DFM->set_field_row($field_row);
            }
            if ($DFM->get_mode() == 'EDIT' && $_REQUEST['field_id'] == $field_row['field_id']) {
                // edit the form via Admin, and the field is being edited
                $bg_selected = ' style="background-color: #FFFFCC;" ';
            } else {
                $bg_selected = '';
            }
            // load init value...
            if ($this->data[$field_row['field_id']] == '') {
                $this->data[$field_row['field_id']] = $field_row['field_init'];
            }
            // For blocked fields, has the user chosen to remain annonymous?
            $is_restricted = JB_process_field_restrictions($this->data, $field_row, $DFM->get_mode(), $admin);
            JBPLUG_do_callback('pre_process_field', $this->data, $field_row);
            ########################
            JBPLUG_do_callback('display_custom_2col_field', $field_row, $this->data, $admin, $DFM->get_mode());
            // your plugin should set $field_row['field_type'] to 'PLUGIN' to signal that it printed something out
            if ($field_row['is_hidden'] == 'Y' && $DFM->get_mode() == 'view' && !$admin) {
                # Hidden Fields, do not appear on website (view mode)
            } elseif ($field_row['field_type'] == 'PLUGIN') {
                // do nothing, already printed by plugin
            } elseif ($field_row['field_type'] == 'SEPERATOR') {
                $DFM->field_start();
                $DFM->seperator_open($bg_selected);
                if ($DFM->get_mode() == 'EDIT') {
                    JB_echo_order_arrows($field_row);
                    echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-"> ';
                }
                $DFM->seperator_display();
                // display the label
                if ($DFM->get_mode() == 'EDIT') {
                    echo '</a>';
                }
                $DFM->seperator_close();
                $DFM->field_end();
            } elseif ($field_row['field_type'] == "SKILL_MATRIX") {
                $DFM->field_start($bg_selected);
                $DFM->skill_matrix_field_open($bg_selected);
                if ($DFM->get_mode() == 'EDIT') {
                    JB_echo_order_arrows($field_row);
                    echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-"> ';
                }
                $DFM->skill_matrix_field_label();
                if ($DFM->get_mode() == 'EDIT') {
                    echo '</a>';
                    ?>
					<br>
					- 
					<a href=""
					onclick="window.open('build_matrix.php?field_id=<?php 
                    echo $field_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 
                }
                $DFM->skill_matrix_field_close();
                $DFM->skill_matrix_value_open($bg_selected);
                if ($is_restricted) {
                    echo $this->data[$field_row['field_id']];
                } else {
                    $DFM->skill_matrix_form();
                }
                $DFM->skill_matrix_value_close();
                $DFM->field_end();
            } elseif ($field_row['field_type'] == 'YOUTUBE') {
                if ($DFM->get_mode() == 'view' && $this->data[$field_row['field_id']] == '') {
                    // do not show the youtube field if it is blank
                    continue;
                }
                $DFM->field_start();
                $DFM->youtube_field_open($bg_selected);
                if ($DFM->get_mode() == 'EDIT') {
                    JB_echo_order_arrows($field_row);
                    echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">';
                }
                $DFM->youtube_label();
                if ($DFM->get_mode() == 'EDIT') {
                    echo '</a>';
                }
                if ($DFM->get_mode() == 'EDIT' && JB_is_reserved_template_tag($field_row['template_tag'])) {
                    $alt = JB_get_reserved_tag_description($field_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_video' . $field_row['field_id']] != '') {
                    // delete video
                    if (!$admin) {
                        $user_sql = " AND user_id='" . JB_escape_sql($_SESSION['JB_ID']) . "' ";
                    } else {
                        $user_sql = " AND user_id='" . JB_escape_sql($this->data['user_id']) . "'";
                    }
                    $where = ' 1=2 ';
                    if (is_numeric($_REQUEST['resume_id'])) {
                        $where = " `resume_id`='" . JB_escape_sql($_REQUEST['resume_id']) . "' ";
                    } elseif (is_numeric($_REQUEST['post_id'])) {
                        $where = " `post_id`='" . JB_escape_sql($_REQUEST['post_id']) . "' ";
                    } elseif (is_numeric($_REQUEST['profile_id'])) {
                        $where = " `profile_id`='" . JB_escape_sql($_REQUEST['profile_id']) . "' ";
                    } elseif (is_numeric($_REQUEST['user_id'])) {
                        $where = " `ID`='" . JB_escape_sql($_REQUEST['user_id']) . "' ";
                    }
                    $table_name = JB_get_table_name_by_id($this->form_id);
                    $sql = "UPDATE `" . $table_name . "` SET `" . JB_escape_sql($field_row['field_id']) . "` = '' WHERE {$where} {$user_sql} ";
                    JB_mysql_query($sql) or die(mysql_error());
                    $this->data[$field_row['field_id']] = '';
                    $_REQUEST[$field_row['field_id']] = '';
                }
                if ($this->data[$field_row['field_id']] != '') {
                    if ($is_restricted) {
                        echo $this->data[$field_row['field_id']];
                    } else {
                        // embed the field
                        if ($field_row['field_width'] < 30) {
                            $field_row['field_width'] = 325;
                        }
                        if ($field_row['field_height'] < 30) {
                            $field_row['field_height'] = 250;
                        }
                        $DFM->youtube_display();
                        // embed youtube vid
                    }
                }
                if (strtolower($DFM->get_mode()) == 'edit') {
                    // display input fields for the form
                    if (!$this->data[$field_row['field_id']]) {
                        $DFM->youtube_field();
                        // input youtube url
                    } else {
                        $DFM->youtube_delete_button();
                    }
                }
                $DFM->youtube_field_close();
                $DFM->field_end();
            } elseif ($field_row['field_type'] == "IMAGE") {
                $DFM->field_start();
                $DFM->image_field_open($bg_selected);
                if ($DFM->get_mode() == 'EDIT') {
                    // admin's form editor
                    JB_echo_order_arrows($field_row);
                    echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">';
                }
                if ($field_row['is_required'] == 'Y' && $DFM->get_mode() != 'view') {
                    echo $DFM->get_required_mark();
                }
                $DFM->image_label($field_row);
                if ($DFM->get_mode() == 'EDIT') {
                    echo '</a>';
                }
                if ($DFM->get_mode() == 'EDIT' && JB_is_reserved_template_tag($field_row['template_tag'])) {
                    $alt = JB_get_reserved_tag_description($field_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 ($this->data[$field_row['field_id']] != '') {
                    if ($is_restricted) {
                        echo $this->data[$field_row['field_id']];
                    } else {
                        // display the field
                        if ($_REQUEST['del_image' . $field_row['field_id']] != '') {
                            if ($admin || strpos($this->data[$field_row['field_id']], $_SESSION['JB_ID'] . '_') === 0) {
                                // if Admin or the filename starts with the user's id
                                JB_delete_image($this->data[$field_row['field_id']]);
                            }
                        }
                        if (JB_image_thumb_file_exists($this->data[$field_row['field_id']])) {
                            // display the image
                            if (JB_KEEP_ORIGINAL_IMAGES == 'YES' && JB_image_original_file_exists($this->data[$field_row['field_id']])) {
                                $DFM->image_linked_display();
                            } else {
                                $DFM->image_thumb_display();
                            }
                        } else {
                            // no image (but value exists in the database!)
                            $DFM->image_display_null();
                        }
                    }
                } else {
                    // no data uploaded
                    $DFM->image_display_null();
                }
                if (strtolower($DFM->get_mode()) == 'edit') {
                    // display input fields for the form
                    // delete image button
                    if (JB_image_thumb_file_exists($this->data[$field_row['field_id']]) && $this->data[$field_row['field_id']] != '') {
                        $DFM->image_delete_button();
                    } else {
                        // upload image form
                        $DFM->image_field();
                    }
                }
                $DFM->image_field_close();
                $DFM->field_end();
            } elseif ($field_row['field_type'] == 'FILE') {
                $DFM->field_start();
                $DFM->file_field_open($bg_selected);
                if ($DFM->get_mode() == 'EDIT') {
                    JB_echo_order_arrows($field_row);
                    echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">';
                }
                $DFM->file_label();
                if ($DFM->get_mode() == 'EDIT') {
                    echo '</a>';
                }
                if ($field_row['is_required'] == 'Y' && $DFM->get_mode() != 'view') {
                    echo $DFM->get_required_mark();
                }
                if ($DFM->get_mode() == 'EDIT' && JB_is_reserved_template_tag($field_row['template_tag'])) {
                    $alt = JB_get_reserved_tag_description($field_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' . $field_row['field_id']] != '') {
                    if ($admin || strpos($this->data[$field_row['field_id']], $_SESSION['JB_ID'] . '_') === 0) {
                        // if admin or the filename starts with the user's id
                        JB_delete_file($this->data[$field_row['field_id']]);
                    }
                }
                if ($is_restricted) {
                    echo $this->data[$field_row['field_id']];
                } elseif (JB_upload_file_exists($this->data[$field_row['field_id']])) {
                    $DFM->file_display_link();
                } elseif ($DFM->get_mode() == 'view') {
                    $DFM->file_not_uploaded();
                }
                if (strtolower($DFM->get_mode()) == 'edit') {
                    if (JB_upload_file_exists($this->data[$field_row['field_id']]) && $this->data[$field_row['field_id']] != '') {
                        $DFM->file_delete_button();
                    } else {
                        $DFM->file_field();
                    }
                }
                $DFM->file_field_close();
                $DFM->field_end();
            } elseif ($field_row['field_type'] == 'NOTE') {
                if ($DFM->get_mode() == 'view') {
                    // note is only shown when edting the form
                } else {
                    $DFM->field_start();
                    $DFM->note_open($bg_selected);
                    if ($DFM->get_mode() == 'EDIT') {
                        JB_echo_order_arrows($field_row);
                        echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-"> ';
                    }
                    $DFM->note_field();
                    if ($DFM->get_mode() == 'EDIT') {
                        echo '</a>';
                    }
                    if ($DFM->get_mode() == 'EDIT' && JB_is_reserved_template_tag($field_row['template_tag'])) {
                        $alt = JB_get_reserved_tag_description($field_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 
                    }
                    $DFM->note_close();
                    $DFM->field_end();
                }
            } elseif ($field_row['field_type'] == 'GMAP') {
                // Google map
                if ($DFM->get_mode() == 'view' && JB_GMAP_SHOW_IF_MAP_EMPTY != 'YES' && $this->data[$field_row['field_id'] . '_lat'] == 0) {
                    continue;
                    // do not show this field
                }
                require_once JB_basedirpath() . 'include/classes/JBGoogleMap.php';
                $DFM->field_start();
                $DFM->gmap_open($bg_selected);
                if ($DFM->get_mode() == 'EDIT') {
                    JB_echo_order_arrows($field_row);
                    echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">';
                }
                if ($field_row['is_required'] == 'Y' && $DFM->get_mode() != 'view') {
                    echo $DFM->get_required_mark();
                }
                $DFM->gmap_field_label();
                if ($DFM->get_mode() == 'EDIT') {
                    echo '</a>';
                }
                if ($DFM->get_mode() == 'view') {
                    if ($is_restricted) {
                        echo $this->data[$field_row['field_id']];
                    } else {
                        $DFM->gmap_show();
                    }
                } else {
                    $DFM->gmap_mark();
                }
                $DFM->gmap_close();
                $DFM->field_end();
            } else {
                // Fields below are made from two sides
                // Left side: field_left_open()
                //  - The left side is used to display the field's label
                //
                // Right side: field_right_open()
                //  - The right side is where the form widget is displayed when
                // editing the form, or where the data value is displayed
                // close with field_right_clode()
                if ($field_row['FLABEL'] == '') {
                    // field label is blank?
                    $field_row['FLABEL'] = $DFM->get_blank_field_label();
                }
                $DFM->field_start();
                $DFM->field_left_open($bg_selected);
                if ($DFM->get_mode() == 'EDIT') {
                    JB_echo_order_arrows($field_row);
                    echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT"><IMG SRC="../admin/edit.gif" WIDTH="16" HEIGHT="16" align="middle" BORDER="0" ALT="-">';
                }
                $DFM->field_label();
                if ($DFM->get_mode() == 'EDIT') {
                    echo '</a>';
                }
                if ($field_row['is_required'] == 'Y' && $DFM->get_mode() != 'view') {
                    echo $DFM->get_required_mark();
                }
                if ($DFM->get_mode() == 'EDIT' && JB_is_reserved_template_tag($field_row['template_tag'])) {
                    $alt = JB_get_reserved_tag_description($field_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 ($DFM->get_mode() == 'EDIT' && $field_row['field_type'] == 'BLANK') {
                    echo '<a href="' . htmlentities($_SERVER['PHP_SELF']) . '?field_id=' . $field_row['field_id'] . '&mode=EDIT">[]</a>';
                }
                $DFM->field_left_close();
                $DFM->field_right_open($bg_selected);
                if ($is_restricted) {
                    echo $this->data[$field_row['field_id']];
                    // display blocked field message
                } else {
                    switch ($field_row['field_type']) {
                        case 'URL':
                            $val = $this->get_template_value($field_row['template_tag'], $admin);
                            if ($DFM->get_mode() == 'view') {
                                echo $DFM->get_url_templated($val);
                            } else {
                                $DFM->text_field();
                            }
                            break;
                        case "TEXT":
                        case "URL":
                        case "CURRENCY":
                        case "NUMERIC":
                        case "INTEGER":
                            if ($DFM->get_mode() == 'view') {
                                // $this->get_template_value() will get and process the data value
                                // for example, if CURRENCY, then it format in to a currency
                                $val = $this->get_template_value($field_row['template_tag'], $admin);
                                $val = JB_email_at_replace($val);
                                $DFM->_print($val);
                            } else {
                                $DFM->text_field();
                            }
                            break;
                        case 'EDITOR':
                            if ($DFM->get_mode() == 'view') {
                                $val = $this->get_template_value($field_row['template_tag'], $admin);
                                if (!preg_match("/<.*?>/U", $val)) {
                                    // Not text mode?
                                    $val = preg_replace('/\\n/', '<br>', $val);
                                }
                                if (JB_EMAIL_AT_REPLACE != 'NO') {
                                    // eliminate tags with mailto:
                                    $val = preg_replace('@<a href=["|\']mailto:.*["|\'] *>(.*)</a>@Ui', '$1', $val);
                                    $val = JB_email_at_replace($val);
                                }
                                #
                                $DFM->_print($val);
                            } else {
                                $DFM->editor_field();
                            }
                            break;
                        case "TEXTAREA":
                            if ($DFM->get_mode() == 'view') {
                                $val = $this->get_template_value($field_row['template_tag'], $admin);
                                $val = str_replace("\n", "<br>", $val);
                                $val = JB_email_at_replace($val);
                                echo $DFM->_print($val);
                            } else {
                                $DFM->textarea_field();
                            }
                            break;
                        case "CATEGORY":
                            if ($DFM->get_mode() == 'view') {
                                if ($this->form_id != 1 || strpos($_SERVER['PHP_SELF'], 'index.php') === false) {
                                    // not posting form, not index.php, assuming index.php is the home page. Only the home page has functionality for displaying the category after the links are clicked
                                    // not linked to the category
                                    $DFM->_print($this->get_template_value($field_row['template_tag'], $admin));
                                } elseif (JB_CAT_PATH_ONLY_LEAF == 'YES') {
                                    // with link
                                    $cat = array();
                                    $cat = JB_get_category($this->data[$field_row['field_id']]);
                                    $cat_url = JB_cat_url_write($this->data[$field_row['field_id']], $cat['NAME'], $cat['seo_fname']);
                                    $DFM->category_link($cat_url, $cat['NAME']);
                                } else {
                                    // Multiple links -
                                    // Output the category using breadcrumb navigation
                                    // eg. Location -> Australia -> NSW
                                    $DFM->category_breadcrumbs();
                                }
                            } else {
                                $DFM->category_field();
                            }
                            break;
                        case "DATE":
                        case "DATE_CAL":
                            if ($DFM->get_mode() == 'view') {
                                $val = $this->get_template_value($field_row['template_tag'], $admin);
                                $DFM->_print($val);
                            } else {
                                if ($field_row['field_type'] == 'DATE') {
                                    // traditional date input
                                    if ($this->data[$field_row['field_id']] == '0000-00-00 00:00:00' || $this->data[$field_row['field_id']] == '') {
                                        $year = '';
                                        $day = '';
                                        $month = '';
                                    } else {
                                        preg_match("/(\\d+)-(\\d+)-(\\d+)/", $this->data[$field_row['field_id']], $m);
                                        // Year - Month - Day (database output format)
                                        $year = $m[1];
                                        $day = $m[3];
                                        $month = $m[2];
                                    }
                                    $DFM->date_field($day, $month, $year);
                                } else {
                                    // scw input
                                    $DFM->date_field_scw();
                                }
                            }
                            break;
                        case "SELECT":
                            if ($DFM->get_mode() == 'view') {
                                $val = $this->get_template_value($field_row['template_tag'], $admin);
                                $DFM->_print($val);
                            } else {
                                $DFM->select_field();
                            }
                            if ($DFM->get_mode() == 'EDIT') {
                                ?>
								<a href=""  onclick="window.open('maintain_codes.php?field_id=<?php 
                                echo $field_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 ($DFM->get_mode() == 'view') {
                                $val = $this->get_template_value($field_row['template_tag'], $admin);
                                $DFM->_print($val);
                            } else {
                                $DFM->radio_field();
                            }
                            if ($DFM->get_mode() == 'EDIT') {
                                ?>
								<a href=""
								onclick="window.open('maintain_codes.php?field_id=<?php 
                                echo $field_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":
                            if ($DFM->get_mode() == 'view') {
                                $val = $this->get_template_value($field_row['template_tag'], $admin);
                                $DFM->_print($val);
                            } else {
                                $DFM->checkbox_field();
                            }
                            if ($DFM->get_mode() == 'EDIT') {
                                ?>
								<a href=""
								onclick="window.open('maintain_codes.php?field_id=<?php 
                                echo $field_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":
                            if ($DFM->get_mode() == 'view') {
                                $val = $this->get_template_value($field_row['template_tag'], $admin);
                                $DFM->_print($val);
                            } else {
                                $DFM->multiple_select_field();
                            }
                            if ($DFM->get_mode() == 'EDIT') {
                                ?>
								<a href=""
								onclick="window.open('maintain_codes.php?field_id=<?php 
                                echo $field_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 "BLANK":
                            $DFM->blank_field();
                            break;
                        default:
                            JBPLUG_do_callback('display_custom_field', $field_row, $this->data, $admin, $DFM->get_mode());
                            // Your module should change $field_row['field_type'] to 'PLUGIN'
                            break;
                    }
                }
                $DFM->field_right_close();
                $DFM->field_end();
            }
        }
        if (!$dont_break_container) {
            $DFM->close_container();
        }
    }