当前位置: 首页>>代码示例>>PHP>>正文


PHP get_label函数代码示例

本文整理汇总了PHP中get_label函数的典型用法代码示例。如果您正苦于以下问题:PHP get_label函数的具体用法?PHP get_label怎么用?PHP get_label使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_label函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_prev_text

 function get_prev_text($step, $target_element)
 {
     global $process_dictionary;
     global $local_string;
     $target_meta_array = $process_dictionary[$step]['elements'][$target_element];
     $prev_display_text = "";
     foreach ($target_meta_array['bottom']['options'] as $key => $option_array) {
         if ($option_array['text_type'] == "static") {
             $vname = '';
             if ($this->workflow_object->type == "Time" && isset($option_array['vname_time'])) {
                 $vname = $option_array['vname_time'];
             } else {
                 $vname = $option_array['vname'];
             }
             if ($this->local_strings != null) {
                 $prev_display_text .= get_label($vname, $this->local_strings) . " ";
             } else {
                 $prev_display_text .= translate_label($vname) . " ";
             }
         }
         if ($option_array['text_type'] == "dynamic") {
             $trans_ele = $this->translate_element($option_array);
             if ($trans_ele === false) {
                 return false;
             }
             $prev_display_text .= $trans_ele . " ";
         }
         //end for each option
     }
     return $prev_display_text;
     //end function get_prev_text
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:32,代码来源:ProcessView.php

示例2: render_property

function render_property($graph, $me, $property)
{
    $property = $graph->resource($property);
    echo "<p>" . get_label($property) . ":&nbsp;";
    render_property_values($me, $property, $onto_file);
    echo "</p>";
}
开发者ID:sdgdsffdsfff,项目名称:LOD,代码行数:7,代码来源:Individual.php

示例3: render_thing

function render_thing($o)
{
    $label = get_label($o);
    if (!$o->isBnode()) {
        echo "&nbsp;<a href='#" . $o->localname() . "'>" . $label . "</a>&nbsp;";
    }
}
开发者ID:sdgdsffdsfff,项目名称:docs-1,代码行数:7,代码来源:ontology.php

示例4: mf_shortcodes

function mf_shortcodes($atts)
{
    global $post, $FIELD_TYPES;
    extract(shortcode_atts(array('field' => 'no field defined or field name is wrong', 'eip' => FALSE, 'filtered' => FALSE, 'imgtag' => FALSE, 'label' => "", 'loop' => FALSE, 'loopseparator' => "|", 'checked' => "yes", 'groupindex' => 1, 'fieldindex' => 1), $atts));
    if ($loop && RCCWP_CustomField::GetFieldDuplicates($post->ID, $field, $groupindex) > 1) {
        $fieldduplicatedata = get_field_duplicate($field);
    } else {
        $fielddata = RCCWP_CustomField::GetDataField($field, $groupindex, $fieldindex, $post->ID);
    }
    $fieldType = $fielddata['type'];
    $fieldID = $fielddata['id'];
    $fieldObject = $fielddata['properties'];
    $fieldValues = (array) $fielddata['meta_value'];
    $fieldMetaID = $fielddata['meta_id'];
    $fieldresults = GetProcessedFieldValue($fieldValues, $fieldType, $fieldObject);
    $shortcode_data = $fieldresults;
    if ($fielddata['type'] == $FIELD_TYPES['multiline_textbox'] && $filtered) {
        $shortcode_data = apply_filters('the_content', $fieldresults);
    }
    if ($fielddata['type'] == $FIELD_TYPES['image']) {
        $imgresults = split('&', $fieldresults);
        if ($imgtag) {
            $shortcode_data = "<img src=\"{$imgresults['0']}\"/>";
        } else {
            $shortcode_data = $imgresults[0];
        }
    }
    if ($fielddata['type'] == $FIELD_TYPES['listbox']) {
        $shortcode_data = implode(",", $fieldresults);
    }
    if ($fielddata['type'] == $FIELD_TYPES['checkbox_list']) {
        $shortcode_data = implode(",", $fieldresults);
    }
    if ($fielddata['type'] == $FIELD_TYPES['checkbox']) {
        if ($fieldresults) {
            $shortcode_data = $checked;
        }
    }
    if ($shortcode_data || $fieldduplicatedata) {
        if ($label) {
            $shortcode_data = $label . $shortcode_data;
        } else {
            $shortcode_data = get_label($field) . " : " . $shortcode_data;
        }
        /////
        if ($field == "duplicate") {
            if ($loop) {
                return implode($loopseparator, $fieldduplicatedata);
            } else {
                return $shortcode_data;
            }
        } else {
            return $shortcode_data;
        }
        /////
    } else {
        return "no data found, please check the field name";
    }
}
开发者ID:ahsaeldin,项目名称:projects,代码行数:59,代码来源:shortcodes.php

示例5: render_property_as_row

function render_property_as_row($graph, $me, $p)
{
    $property = $graph->resource($p);
    echo "<p>" . get_label($property) . ":&nbsp;";
    foreach ($me->all($property) as $o) {
        $label = get_label($o);
        if (!$o->isBnode()) {
            echo "&nbsp;" . link_to($label, 'uri=' . urlencode($o)) . "&nbsp;";
        }
    }
    echo "</p>";
}
开发者ID:sdgdsffdsfff,项目名称:LOD,代码行数:12,代码来源:rdf_helper.php

示例6: render_property

function render_property($graph, $me, $p)
{
    $property = $graph->resource($p);
    //echo "<p>" . $property->label('zh') . ":&nbsp;";
    echo "<p>" . get_label($property) . ":&nbsp;";
    foreach ($me->all($property) as $o) {
        $label = $o->label();
        if (!$label) {
            $label = $o->getUri();
        }
        if ($o->isBnode()) {
            //echo "&nbsp;$label&nbsp;";
        } else {
            echo "&nbsp;" . link_to_self($label, 'uri=' . urlencode($o)) . "&nbsp;";
        }
    }
    echo "</p>";
}
开发者ID:sdgdsffdsfff,项目名称:LOD,代码行数:18,代码来源:class.php

示例7: sak_record_form

function sak_record_form($params, $field_meta, $field_mapping = null)
{
    global $config;
    $table_info2qf['varchar'] = 'text';
    $table_info2qf['string'] = 'textarea';
    $table_info2qf['int4'] = 'text';
    $table_info2qf['int'] = 'text';
    $table_info2qf['date'] = 'date';
    $table_info2qf['timestamp'] = 'date';
    $table_info2qf['text'] = 'textarea';
    $table_info2qf['blob'] = 'textarea';
    $type_options['date'] = array('language' => 'es', 'format' => 'dMY');
    $type_options['text'] = array('size' => 64);
    $type_options['textarea'] = array('rows' => 5, 'cols' => 64);
    $date_defaults = array('d' => date('d'), 'M' => date('m'), 'Y' => date('Y'));
    $table = $params['table'];
    $primary_key = $params['primary_key'];
    $op = $params['op'];
    if ($op == 'update') {
        $record_id = $params['record_id'];
    }
    $db = DB::connect($config['db']);
    if (PEAR::isError($db)) {
        var_dump($db);
        die($db->getMessage());
    }
    $params_f = params_encode($params);
    $form =& new HTML_QuickForm('form_record', 'post');
    $form->setRequiredNote('<span style="color:#ff0000;">*</span> = campos requeridos.');
    $form->addElement('hidden', 'action', 'table');
    $form->addElement('hidden', 'params', $params_f);
    $table_info = $db->tableInfo($table);
    foreach ($table_info as $field_info) {
        $name = $field_info['name'];
        $element_type = null;
        $element_options = null;
        if (isset($field_meta['type'][$op][$name])) {
            if ($field_meta['type'][$op][$name] == 'disable') {
                continue;
            } else {
                $element_type = $field_meta['type'][$op][$name];
            }
        }
        //        if ($name == $primary_key)
        //            continue;
        $element_type = $element_type == '' ? $table_info2qf[$field_info['type']] : $element_type;
        if (isset($field_mapping[$field_info['name']])) {
            $label = $field_mapping[$field_info['name']];
        } else {
            $label = get_label($field_info['name']);
        }
        $size = $field_info['len'];
        $element_options = $type_options[$element_type];
        if (isset($field_meta['select'][$name])) {
            $element_type = 'select';
            if (isset($field_meta['select'][$name]['data'])) {
                $element_options = $field_meta['select'][$name]['data'];
            } else {
                $lookup_sql = $field_meta['select'][$name]['sql'];
                $element_options = $db->getAssoc($lookup_sql);
            }
        }
        $element_name = "new_row[{$name}]";
        if (isset($field_meta['defaults'][$name])) {
            $defaults[$element_name] = $field_meta['defaults'][$name];
        }
        $form->addElement($element_type, $element_name, $label, $element_options);
        if ($field_info['flags'] != '') {
            $not_null = strpos($field_info['flags'], 'not_null');
            if (!($not_null === false)) {
                $form->addRule($element_name, 'Campo obligatorio', 'required');
            }
        }
        if ($field_info['type'] == 'int4') {
            $form->addRule($element_name, 'Campo numerico', 'numeric');
        }
    }
    if ($op == 'update') {
        $edit_sql = "select * from {$table} where {$primary_key} = ?";
        $edit_sql_data = array($record_id);
        $edit_row = $db->getRow($edit_sql, $edit_sql_data, DB_FETCHMODE_ASSOC);
        foreach ($edit_row as $key => $value) {
            $defaults['new_row[' . $key . ']'] = stripslashes($value);
        }
    }
    //    echo '<pre>';
    //    var_dump($defaults);
    //    echo '</pre>';
    if (isset($defaults)) {
        $form->setDefaults($defaults);
    }
    return $form;
}
开发者ID:sergiokessler,项目名称:perio,代码行数:93,代码来源:data_manage.php

示例8: print_table


//.........这里部分代码省略.........
                        $output_row .= '><a href="' . $row['mergedcode'] . '.html">' . $row['type'] . ' ' . $row['name'] . '</a></th>';
                    } else {
                        $output_row .= '><a href="?base=' . $base_table . '&amp;code=' . $row['mergedcode'] . '">' . $row['type'] . ' ' . $row['name'] . '</a></th>';
                    }
                } else {
                    $output_row .= '>' . $row['type'] . ' ' . $row['name'] . '</th>';
                }
            }
            # Информацию классификатора отобразили. Если элемента Викиданных с таким кодом не нашлось, выводим пустые ячейки и переходим к следующему объекту.
            if (!isset($row_w['item'])) {
                if ($level == 1) {
                    $output_row .= '<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>' . "\n";
                } else {
                    $output_row .= '<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>' . "\n";
                }
                if ($mode == 'html') {
                    fwrite($handle, $output_row);
                } else {
                    echo $output_row;
                }
                # Выводим строку таблицы
                $rowspan = '';
                $num_items = 1;
                continue;
            }
            # Элемент для текущего объекта есть. Выводим его свойства.
            # Идентификатор
            $output_row .= '<td class="numeric"><a href="https://www.wikidata.org/wiki/' . $row_w['item'] . '" target="blank">' . $row_w['item'] . '</a></td>';
            $output_row .= '<td>';
            # Метка
            $output_row .= '<p class="label">' . $row_w['label'] . '</p>';
            # Псевдонимы
            while ($row_a = mysqli_fetch_array($result_a, MYSQLI_ASSOC)) {
                $output_row .= '<p>' . $row_a['alias'] . '</p>';
            }
            mysqli_free_result($result_a);
            $output_row .= '</td>';
            $output_row .= '<td>';
            # Типы объекта (область, город, район, округ, столица ...)
            while ($row_t = mysqli_fetch_array($result_t, MYSQLI_ASSOC)) {
                $output_row .= '<p><a href="https://www.wikidata.org/wiki/' . $row_t['type'] . '" target="blank">' . $row_t['label'] . '</a></p>';
            }
            mysqli_free_result($result_t);
            # Описание
            $output_row .= '</td>';
            $output_row .= '<td>' . $row_w['description'] . '</td>';
            $output_row .= '<td class="numeric';
            # Отметим неожиданный код, если есть
            if ($base_bad) {
                $output_row .= ' bad';
            }
            # Код в Викиданных по текущему классификатору
            $output_row .= '">' . $row_w["{$base_table}"] . '</td>';
            $output_row .= '<td class="numeric';
            if ($alter_bad) {
                $output_row .= ' bad';
            }
            # Код по альтернативному классификатору
            $output_row .= '">' . $row_w["{$alter_table}"] . '</td>';
            # Ссылка на элемент Викиданных в роли административно-территориальной единицы...
            if (isset($row_w['ate'])) {
                $output_row .= '<td><a href="https://www.wikidata.org/wiki/' . $row_w['ate'] . '" target="blank">' . get_label($link, $row_w['ate']) . '</a></td>';
            } else {
                $output_row .= '<td></td>';
            }
            # ... и административного центра
            if (isset($row_w['centrum'])) {
                $output_row .= '<td><a href="https://www.wikidata.org/wiki/' . $row_w['centrum'] . '" target="blank">' . get_label($link, $row_w['centrum']) . '</a></td>';
            } else {
                $output_row .= '<td></td>';
            }
            # Широта, долгота, телефонный код, почтовый индекс
            if ($level != 1) {
                $output_row .= '<td class="numeric">' . $row_w['lat'] . '</td>';
                $output_row .= '<td class="numeric">' . $row_w['lon'] . '</td>';
                $output_row .= '<td class="numeric">' . $row_w['phone'] . '</td>';
                $output_row .= '<td class="numeric">' . $row_w['post'] . '</td>';
            }
            $output_row .= '</tr>' . "\n";
            # В зависимости от режима работы, выводим в файл, либо в браузер.
            if ($mode == 'html') {
                fwrite($handle, $output_row);
            } else {
                echo $output_row;
            }
            # Выводим строку таблицы
            # Вывод дубликатов обработали. инициализируем переменные
            $rowspan = '';
            $num_items = 1;
        } while ($row_w = mysqli_fetch_array($result_w, MYSQLI_ASSOC));
        # Пробуем взять ещё дубликат
        mysqli_free_result($result_w);
    }
    if ($mode == 'html') {
        fwrite($handle, "</table></body></html>\n");
    } else {
        echo '</table></body></html>' . "\n";
    }
    mysqli_free_result($result);
}
开发者ID:allardais,项目名称:validwd,代码行数:101,代码来源:library.php

示例9: insert_popup_header

$form->assign("TRIGGER_TYPE", $workflow_object->type);
$form->assign("TYPE", $focus->type);
//Check multi_trigger filter conditions
if (!empty($_REQUEST['frame_type']) && $_REQUEST['frame_type'] == "Secondary") {
    $form->assign("FRAME_TYPE", $_REQUEST['frame_type']);
} else {
    $form->assign("FRAME_TYPE", "Primary");
}
insert_popup_header();
$form->parse("embeded");
$form->out("embeded");
////////Middle Items/////////////////////////////
$temp_module = BeanFactory::getBean($workflow_object->base_module);
$display_field_name = $temp_module->field_defs[$focus->field]['vname'];
$current_module_strings = return_module_language($current_language, $workflow_object->base_module);
$display_field_name = "<i><b>\" " . get_label($display_field_name, $current_module_strings) . " \"</i></b>";
$form->assign("SPECIFIC_FIELD", $display_field_name);
if ($workflow_object->type == "Normal") {
    //set exp_meta_type to normal_trigger
    $form->assign("EXP_META_TYPE", "normal_trigger");
} else {
    //set exp_meta_type to time_trigger
    $form->assign("EXP_META_TYPE", "time_trigger");
}
//SET Previous Display Text
require_once 'include/ListView/ProcessView.php';
$ProcessView = new ProcessView($workflow_object, $focus);
$prev_display_text = $ProcessView->get_prev_text("TriggersCreateStep1", $focus->type);
$form->assign("PREV_DISPLAY_TEXT", $prev_display_text);
//////////////////BEGIN Future Object	/////////////////////////////////
$future_object = BeanFactory::getBean('Expressions');
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:31,代码来源:CreateStepSpecific.php

示例10: sak_display_record

function sak_display_record($params, $field_mapping = null)
{
    global $config;
    $sql = $params['sql_record'];
    $sql_data = array($params['record_id']);
    $db = DB::connect($config['db']) or die('Could connect to DB');
    // get the record
    $row = $db->getRow($sql, $sql_data, DB_FETCHMODE_ASSOC);
    if (PEAR::isError($row)) {
        die($row->getDebugInfo());
    }
    $html = '<table class="listado">';
    $html .= '<tbody>';
    $i = 0;
    foreach ($row as $field => $value) {
        if ($i % 2) {
            $tr_style = 'f1';
        } else {
            $tr_style = 'f2';
        }
        $i++;
        //        if ($value != '')
        //        {
        $html .= '<tr class="' . $tr_style . '">';
        $html .= '<td class="listado">';
        $html .= get_label($field);
        $html .= '</td>';
        $html .= '<td class="listado">';
        $html .= nl2br(stripslashes($value));
        $html .= '</td>';
        $html .= '</tr>';
        //        }
    }
    $html .= '</tbody>';
    $html .= '</table>';
    return $html;
}
开发者ID:sergiokessler,项目名称:perio,代码行数:37,代码来源:data_display.php

示例11: get_header

<?php

/*
 * Template name: Gallery
 */
get_header();
$pages = get_posts(array('post_type' => 'page', 'meta_key' => '_wp_page_template', 'meta_value' => 'gallery.php'));
$page = $pages[0];
$page_title = get_label('gallery');
$page_url = get_the_permalink($page);
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$gallery_posts_args = array('post_type' => 'gallery_post', 'posts_per_page' => 9, 'post_status' => array('publish'), 'paged' => $paged);
$gallery_posts_query = new WP_Query($gallery_posts_args);
if ($gallery_posts_query->have_posts()) {
    ?>
 
    <section class="full-page grey-background news gallery">
        <div class="bigger-container">
            <?php 
    include 'parts/breadcrumbs.php';
    ?>
            <div class="white-bg news-section">
                <div class="container">
                    <h1><?php 
    echo $page_title;
    ?>
</h1>
                    <?php 
    if ($page->post_content) {
        echo '<br><br>';
        $content = $page->post_content;
开发者ID:gencagushi,项目名称:tema,代码行数:31,代码来源:archive-gallery_post.php

示例12: sak_display_array_record

function sak_display_array_record($params, $field_mapping = null)
{
    global $config;
    // get the record
    $row = $params['data'];
    $html[] = '<table class="table table-striped table-bordered table-condensed">';
    $html[] = '<tbody>';
    foreach ($row as $field => $value) {
        //        if ($value != '')
        //        {
        $html[] = '<tr>';
        $html[] = '<td>';
        if (isset($field_mapping[$field])) {
            $html[] = $field_mapping[$field];
        } else {
            $html[] = get_label($field);
        }
        $html[] = '</td>';
        $html[] = '<td>';
        // setup the link, if any
        if (isset($params['link_view'][$field]) and !empty($value)) {
            $label = !empty($params['link_view'][$field]['label']) ? $params['link_view'][$field]['label'] : $value;
            $href = $params['link_view'][$field]['href'];
            $html[] = "<a href=\"{$href}\">{$label}</a>";
        } else {
            $html[] = nl2br(htmlentities(stripslashes($value)));
        }
        $html[] = '</td>';
        $html[] = '</tr>';
        //        }
    }
    $html[] = '</tbody>';
    $html[] = '</table>';
    return implode($html);
}
开发者ID:sergiokessler,项目名称:perio,代码行数:35,代码来源:data_display.php

示例13: mf_shortcodes

function mf_shortcodes($atts)
{
    global $post, $FIELD_TYPES;
    extract(shortcode_atts(array('field' => 'no field defined or field name is wrong', 'eip' => FALSE, 'filtered' => FALSE, 'imgtag' => FALSE, 'label' => "", 'loop' => FALSE, 'loopseparator' => "|", 'checked' => "yes", 'groupindex' => 1, 'fieldindex' => 1), $atts));
    if ($loop && RCCWP_CustomField::GetFieldDuplicates($post->ID, $field, $groupindex) > 1) {
        $fieldduplicatedata = get_field_duplicate($field);
    } else {
        $fielddata = RCCWP_CustomField::GetDataField($field, $groupindex, $fieldindex, $post->ID);
    }
    $fieldType = $fielddata['type'];
    $fieldID = $fielddata['id'];
    $fieldObject = $fielddata['properties'];
    $fieldValues = (array) $fielddata['meta_value'];
    $fieldMetaID = $fielddata['meta_id'];
    $fieldresults = GetProcessedFieldValue($fieldValues, $fieldType, $fieldObject);
    $shortcode_data = $fieldresults;
    if ($fielddata['type'] == $FIELD_TYPES['multiline_textbox'] && $filtered) {
        $shortcode_data = apply_filters('the_content', $fieldresults);
    }
    if ($fielddata['type'] == $FIELD_TYPES['image']) {
        $imgresults = split('&', $fieldresults);
        if ($imgtag) {
            $shortcode_data = "<img src=\"{$imgresults['0']}\"/>";
        } else {
            $shortcode_data = $imgresults[0];
        }
    }
    if ($fielddata['type'] == $FIELD_TYPES['listbox']) {
        $shortcode_data = implode(",", $fieldresults);
    }
    if ($fielddata['type'] == $FIELD_TYPES['checkbox_list']) {
        $shortcode_data = implode(",", $fieldresults);
    }
    if ($fielddata['type'] == $FIELD_TYPES['checkbox']) {
        if ($fieldresults) {
            $shortcode_data = $checked;
        }
    }
    // Prepare fields for EIP
    $enableEditnplace = RCCWP_Options::Get('enable-editnplace');
    if ($eip && $enableEditnplace == 1 && current_user_can('edit_posts', $post->ID)) {
        switch ($fielddata['type']) {
            case $FIELD_TYPES["textbox"]:
                if (!$results) {
                    $results = "&nbsp";
                }
                $shortcode_data = "<div class='" . EIP_textbox($fieldMetaID) . "' >" . $fieldresults . "</div>";
                break;
            case $FIELD_TYPES["multiline_textbox"]:
                if (!$results) {
                    $results = "&nbsp";
                }
                $shortcode_data = "<div class='" . EIP_mulittextbox($fieldMetaID) . "' >" . $shortcode_data . "</div>";
                break;
        }
    }
    if ($shortcode_data || $fieldduplicatedata) {
        if ($label) {
            $shortcode_data = $label . $shortcode_data;
        } else {
            $shortcode_data = get_label($field) . " : " . $shortcode_data;
        }
        /////
        if ($field == "duplicate") {
            if ($loop) {
                return implode($loopseparator, $fieldduplicatedata);
            } else {
                return $shortcode_data;
            }
        } else {
            return $shortcode_data;
        }
        /////
    } else {
        return "no data found, please check the field name";
    }
}
开发者ID:kaziel,项目名称:Magic-Fields,代码行数:77,代码来源:shortcodes.php

示例14: sak_record_form

function sak_record_form($params)
{
    global $config;
    $table_info2qf['varchar'] = 'text';
    $table_info2qf['int4'] = 'text';
    $table_info2qf['date'] = 'date';
    $table_info2qf['text'] = 'textarea';
    $date_options = array('language' => 'es', 'format' => 'dMY');
    $date_defaults = array('d' => date('d'), 'M' => date('m'), 'Y' => date('Y'));
    $campos_cortos = array('size' => 3);
    $campos_medios = array('size' => 8);
    $campos_largos = array('size' => 64);
    $table = $params['table'];
    $primary_key = $params['primary_key'];
    $op = $params['op'];
    if ($op == 'update') {
        $record_id = $params['record_id'];
    }
    $db = DB::connect($config['db']);
    if (PEAR::isError($db)) {
        die($db->getMessage());
    }
    $params_f = params_encode($params);
    $form =& new HTML_QuickForm('form_record', 'post');
    $form->addElement('hidden', 'action', 'table');
    $form->addElement('hidden', 'params', $params_f);
    $table_info = $db->tableInfo($table);
    foreach ($table_info as $field_info) {
        $name = $field_info['name'];
        $type = null;
        $options = null;
        if (isset($params['type'][$op][$name])) {
            $type = $params['type'][$op][$name];
        }
        if ($type == 'disable') {
            continue;
        }
        if ($name == $primary_key) {
            continue;
        }
        $type = $type == '' ? $table_info2qf[$field_info['type']] : $type;
        $label = get_label($field_info['name']);
        $size = $field_info['len'];
        if ($type == 'date') {
            $options = $date_options;
        }
        if ($type == 'textarea') {
            $options = array('rows' => 6, 'cols' => 70);
        }
        if ($type == 'text') {
            $options = array('size' => 40);
        }
        if (isset($params['options'][$name])) {
            $type = 'select';
            $options = $params['options'][$name];
        }
        if (isset($params['lookup'][$name])) {
            $type = 'select';
            $lookup_table = $params['lookup'][$name]['table'];
            $lookup_field_key = $params['lookup'][$name]['field_key'];
            $lookup_field_list = $params['lookup'][$name]['field_list'];
            $sql_options = "select {$lookup_field_key}, {$lookup_field_list} from {$lookup_table} order by {$lookup_field_list}";
            $options = array('' => '') + $db->getAssoc($sql_options);
        }
        if (isset($params['defaults'][$name])) {
            $defaults[$name] = $params['defaults'][$name];
        }
        $input_name = "new_row[{$name}]";
        $form->addElement($type, $input_name, $label, $options);
        if ($field_info['flags'] != '') {
            $not_null = strpos($field_info['flags'], 'not_null');
            if (!($not_null === false)) {
                $form->addRule($input_name, 'Campo obligatorio', 'required');
            }
        }
        if ($field_info['type'] == 'int4') {
            $form->addRule($input_name, 'Campo numerico', 'numeric');
        }
    }
    if ($op == 'update') {
        $edit_sql = "select * from {$table} where {$primary_key} = ?";
        $edit_sql_data = array($record_id);
        $edit_row = $db->getRow($edit_sql, $edit_sql_data, DB_FETCHMODE_ASSOC);
        foreach ($edit_row as $key => $value) {
            $defaults['new_row[' . $key . ']'] = stripslashes($value);
        }
        $form->setDefaults($defaults);
    }
    $form->addElement('submit', 'btnSubmit', 'Guardar');
    return $form;
}
开发者ID:sergiokessler,项目名称:perio,代码行数:91,代码来源:data_manage.php

示例15: sak_display_array_record

function sak_display_array_record($params, $field_mapping = null)
{
    global $config;
    // get the record
    $row = $params['data'];
    $html = '<table class="record">';
    $html .= '<tbody>';
    $i = 0;
    foreach ($row as $field => $value) {
        if ($i % 2) {
            $tr_style = 'record_f1';
        } else {
            $tr_style = 'record_f2';
        }
        $i++;
        //        if ($value != '')
        //        {
        $html .= '<tr class="' . $tr_style . '">';
        $html .= '<td class="record_field_name">';
        if (isset($field_mapping[$field])) {
            $html .= $field_mapping[$field];
        } else {
            $html .= get_label($field);
        }
        $html .= '</td>';
        $html .= '<td class="record_field_value">';
        $html .= nl2br(stripslashes($value));
        $html .= '</td>';
        $html .= '</tr>';
        //        }
    }
    $html .= '</tbody>';
    $html .= '</table>';
    return $html;
}
开发者ID:sergiokessler,项目名称:perio,代码行数:35,代码来源:data_display.php


注:本文中的get_label函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。