예제 #1
0
 function &tag_to_search_init()
 {
     global $tag_to_search;
     $cache_key = 'tag_to_search_' . $this->form_id . '_' . $_SESSION['LANG'];
     $tag_to_search = JB_cache_get($cache_key);
     // tag_to_search_1_EN
     if (is_array($tag_to_search)) {
         return $tag_to_search;
     }
     $tag_to_search = array();
     $sql = "SeLeCT *, t2.field_label AS NAME FROM `form_fields` AS t1, `form_field_translations` AS t2 where t1.field_id=t2.field_id AND t1.form_id='" . JB_escape_sql($this->form_id) . "' AND is_in_search ='Y' AND t2.lang='" . JB_escape_sql($_SESSION['LANG']) . "' ORDER BY search_sort_order  ";
     $result = JB_mysql_query($sql) or die(mysql_error());
     # do a query for each field
     while ($fields = mysql_fetch_array($result, MYSQL_ASSOC)) {
         $tag_to_search[$fields['template_tag']]['field_id'] = $fields['field_id'];
         $tag_to_search[$fields['template_tag']]['field_type'] = $fields['field_type'];
         $tag_to_search[$fields['template_tag']]['field_label'] = $fields['NAME'];
         $tag_to_search[$fields['template_tag']]['field_init'] = $fields['field_init'];
         $tag_to_search[$fields['template_tag']]['category_init_id'] = $fields['category_init_id'];
         $tag_to_search[$fields['template_tag']]['field_height'] = $fields['field_height'];
         $tag_to_search[$fields['template_tag']]['is_cat_multiple'] = $fields['is_cat_multiple'];
         $tag_to_search[$fields['template_tag']]['cat_multiple_rows'] = $fields['cat_multiple_rows'];
         $tag_to_search[$fields['template_tag']]['multiple_sel_all'] = $fields['multiple_sel_all'];
         if ($fields['field_type'] == 'SKILL_MATRIX') {
             // skill matrix exists in the form
             $tag_to_search['smx_exists'] = true;
         }
     }
     JBPLUG_do_callback('tag_to_search_init', $tag_to_search, $this->form_id);
     jb_cache_add($cache_key, $tag_to_search);
     return $tag_to_search;
 }
예제 #2
0
function JB_display_available_languages()
{
    global $JBMarkup, $lang;
    if (!($av_langs = jb_cache_get('av_langs'))) {
        $sql = "SELECT * FROM lang WHERE is_active='Y' ";
        $result = JB_mysql_query($sql);
        while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
            $av_langs[] = $row;
        }
        jb_cache_add('av_langs', $av_langs);
    }
    if (sizeof($av_langs) > 1) {
        $JBMarkup->available_langs_heading();
        foreach ($av_langs as $row) {
            $JBMarkup->available_langs_item($row['lang_code'], $row['name']);
        }
    }
}
예제 #3
0
function JB_init_lang_vars()
{
    //global $jb_mysql_link;
    global $label;
    global $AVAILABLE_LANGS;
    global $ACT_LANG_FILES;
    // active languages
    global $LANG_FILES;
    // all language files
    global $FCK_LANG_FILES;
    // FCK editor language
    global $JB_LANG_THEMES;
    $AVAILABLE_LANGS = array();
    $ACT_LANG_FILES = array();
    // active languages
    $LANG_FILES = array();
    // all language files
    $FCK_LANG_FILES = array();
    // FCK editor language
    $JB_LANG_THEMES = array();
    if ($lang_vars = jb_cache_get('lang_vars')) {
        $AVAILABLE_LANGS = $lang_vars['AVAILABLE_LANGS'];
        $ACT_LANG_FILES = $lang_vars['ACT_LANG_FILES'];
        $LANG_FILES = $lang_vars['LANG_FILES'];
        $FCK_LANG_FILES = $lang_vars['FCK_LANG_FILES'];
        $JB_LANG_THEMES = $lang_vars['JB_LANG_THEMES'];
        $lang_vars = null;
    } else {
        $sql = "SELECT * FROM lang ";
        if ($result = jb_mysql_query($sql)) {
            // load languages into array.. map the language code to the filename
            // if mapping didn't work, default to english..
            while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                $lang_code = strtoupper($row['lang_code']);
                $AVAILABLE_LANGS[$lang_code] = $row['name'];
                $LANG_FILES[$lang_code] = $row['lang_filename'];
                $FCK_LANG_FILES[$lang_code] = $row['fckeditor_lang'];
                if ($row['is_active'] == 'Y') {
                    $ACT_LANG_FILES[$lang_code] = $row['lang_filename'];
                }
                $JB_LANG_THEMES[$lang_code] = $row['theme'];
            }
            $lang_vars['AVAILABLE_LANGS'] = $AVAILABLE_LANGS;
            $lang_vars['ACT_LANG_FILES'] = $ACT_LANG_FILES;
            $lang_vars['LANG_FILES'] = $LANG_FILES;
            $lang_vars['FCK_LANG_FILES'] = $FCK_LANG_FILES;
            $lang_vars['JB_LANG_THEMES'] = $JB_LANG_THEMES;
            jb_cache_add('lang_vars', $lang_vars);
        } else {
            $DB_ERROR = mysql_error();
        }
    }
    if (isset($_REQUEST['jb_theme']) && $_SESSION['ADMIN']) {
        // do this if the theme is being changed in Admin
        preg_match('#([a-z0-9_\\-]+)#i', stripslashes($_REQUEST['jb_theme']), $m);
        $lang = isset($_SESSION['LANG']) ? $_SESSION['LANG'] : 'EN';
        $sql = "UPDATE `lang` SET `theme`='" . jb_escape_sql($m[1]) . "' WHERE lang_code='" . jb_escape_sql($lang) . "' ";
        jb_mysql_query($sql);
        jb_cache_delete('lang_vars');
    }
    if (!$DB_ERROR) {
        // the $label array is used to store all the language strings loaded from
        // the language file.
        if (!isset($label)) {
            $label = array();
            if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . $LANG_FILES[$_SESSION["LANG"]])) {
                // load the currently selected language
                include dirname(__FILE__) . DIRECTORY_SEPARATOR . $LANG_FILES[$_SESSION["LANG"]];
            } else {
                // default to eng
                include dirname(__FILE__) . DIRECTORY_SEPARATOR . "english.php";
            }
        }
    }
}
예제 #4
0
function JB_display_dynamic_search_form($form_id, $NO_COLS = 2, $search_form_mode = null)
{
    $SearchFormObj =& getDynamicSearchFormObject($form_id);
    // we can cache these search form on the home page,
    // employer's resume search
    // candidate's job browse / search
    if (!$search_form_mode && (strpos($_SERVER['PHP_SELF'], 'index.php') !== false || strpos($_SERVER['PHP_SELF'], JB_EMPLOYER_FOLDER . 'search.php') !== false || strpos($_SERVER['PHP_SELF'], JB_CANDIDATE_FOLDER . 'browse.php') !== false || strpos($_SERVER['PHP_SELF'], JB_EMPLOYER_FOLDER . 'search.php') !== false) && $_REQUEST['action'] != 'search') {
        // serve the cached version
        if (!($search_form = jb_cache_get('search_form_' . $form_id . '_cols_' . $NO_COLS . '_' . $_SESSION['LANG']))) {
            // cache miss, generate the search form, add to cache
            ob_start();
            $SearchFormObj->display_dynamic_search_form($NO_COLS);
            $search_form = ob_get_contents();
            ob_end_clean();
            jb_cache_add('search_form_' . $form_id . '_cols_' . $NO_COLS . '_' . $_SESSION['LANG'], $search_form);
        }
        // output the search form
        echo $search_form;
    } else {
        // generate & serve the search form
        $SearchFormObj->display_dynamic_search_form($NO_COLS, $search_form_mode);
    }
}
예제 #5
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();
        }
    }