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


PHP Grid::detectData方法代码示例

本文整理汇总了PHP中Grid::detectData方法的典型用法代码示例。如果您正苦于以下问题:PHP Grid::detectData方法的具体用法?PHP Grid::detectData怎么用?PHP Grid::detectData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Grid的用法示例。


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

示例1: getFields

 function getFields($table, $f_id, $subtable_fields = false, $f_id_field = false, $order_by = false, $order_asc = false, $record_id = false, $limit_is_curdate = false)
 {
     global $CFG;
     $f_id = $f_id > 0 ? $f_id : $record_id;
     if (!($f_id > 0)) {
         return false;
     }
     if (!is_array($subtable_fields)) {
         $subtable_fields = array('*');
     }
     $field_info = GridDB::getTableFields($table);
     $f_id_field = $f_id_field ? $f_id_field : 'id';
     if (!strstr($f_id_field, ',')) {
         $sql = "SELECT " . implode(',', $subtable_fields) . " FROM {$table} WHERE {$f_id_field} = {$f_id}";
         if ($order_by) {
             if ($field_info[$order_by]['Type'] == 'datetime' && $limit_is_curdate) {
                 $sql .= " AND {$order_by} >= '" . date('Y-m-d 00:00:00') . "' ";
             }
             $order_asc = $order_asc ? 'ASC' : 'DESC';
             $sql .= " ORDER BY {$order_by} {$order_asc}";
         }
         $sql .= " LIMIT 0,1 ";
         $result = db_query_array($sql);
         $row = $result[0];
     } else {
         $join_path = explode(',', $f_id_field);
         if (is_array($join_path)) {
             foreach ($join_path as $join_field) {
                 $join_field_parts = explode('.', $join_field);
                 $where_name = $select_name == 'id' ? $join_field_parts[1] : 'id';
                 $select_name = $join_field_parts[1];
                 $join_table = $join_field_parts[0];
                 $sql = "SELECT {$select_name} FROM {$join_table} WHERE {$where_name} = {$f_id}";
                 $result = db_query_array($sql);
                 $row = $result[0];
                 $f_id = $row[$select_name];
             }
         }
         $sql = "SELECT " . implode(',', $subtable_fields) . " FROM {$table} WHERE id = {$f_id}";
         $result = db_query_array($sql);
         $row = $result[0];
     }
     if (is_array($field_info) && is_array($row)) {
         foreach ($row as $name => $value) {
             $row[$name] = '<span class="record_component">' . Grid::detectData($name, $value, $field_info) . '</span>';
         }
     }
     return $row;
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:49,代码来源:RecordDB.php

示例2: indicator

 function indicator($name, $formula, $caption = false, $subtable = false, $subtable_fields = false, $concat_char = false, $f_id_field = false, $formula_f_id_field = false, $link_url = false, $link_is_tab = false, $run_in_sql = false, $in_form = false)
 {
     global $CFG;
     if (!$CFG->pm_editor) {
         if (!$run_in_sql) {
             $formula = String::doFormulaReplacements($formula, $this->row, 1);
         } else {
             if ($this->record_id > 0) {
                 $formula = String::replaceConditionals($formula, $this->row, $formula_f_id_field);
             }
         }
         $result = @eval("{$formula}");
         //echo $formula.' | '.$result .' ||| ';
         if ($subtable && $this->record_id > 0) {
             $f_id_field = $f_id_field ? $f_id_field : 'id';
             $db_output = DB::getSubTable($subtable, $subtable_fields, $result, $concat_char, $f_id_field);
             $key = key($db_output);
             $text = $db_output[$key];
         } else {
             $text = Grid::detectData($name, $result, $this->db_fields);
             if ($link_url) {
                 $text = Link::url($link_url, $text, "{$name}={$id}&is_tab={$link_is_tab}&action=record");
             }
         }
     }
     if ($CFG->pm_editor && !$this->in_grid) {
         $method_name = Form::peLabel($CFG->method_id, 'indicator');
     }
     $HTML = "<div class=\"label_extend\"></div><div class=\"indicator\"><b class=\"record_label\">{$caption}</b><span class=\"record_item\">{$method_name} {$text}</span></div>";
     if (!$in_form) {
         $this->HTML[] = $HTML;
     } else {
         return $HTML;
     }
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:35,代码来源:Record.php

示例3: displayItems

 private function displayItems($tables, $rows = false, $f_id = 0, $level = 1, $p_id = 0)
 {
     global $CFG;
     $pm_method = $CFG->pm_editor ? ' class="pm_method"' : '';
     if ($tables) {
         $parent_id = $rows ? $p_id : $f_id;
         $this->levels[$level][$parent_id] = $parent_id;
         $HTML = '';
         foreach ($tables as $name => $properties) {
             $HTML .= "<ul id=\"mlist_{$this->i}_level_{$level}_{$parent_id}\" class=\"mlist_{$this->i}_level_{$level}\">";
             $properties['url'] = empty($properties['url']) ? $CFG->url : $properties['url'];
             $properties['url_is_tab'] = empty($properties['url_is_tab']) ? $CFG->is_tab : $properties['url_is_tab'];
             if (!empty($properties['parent']) && $f_id == 0) {
                 continue;
             }
             $HTML .= "<input id=\"table\" type=\"hidden\" name=\"table\" value=\"{$name}\" />";
             $HTML .= "<input id=\"enabled\" type=\"hidden\" name=\"enabled\" value=\"{$this->dragdrop}\" />";
             $HTML .= "<input id=\"p_id\" type=\"hidden\" name=\"p_id\" value=\"{$p_id}\" />";
             $HTML .= "<input id=\"f_id\" type=\"hidden\" name=\"f_id\" value=\"{$f_id}\" />";
             if ($CFG->pm_editor) {
                 $HTML .= Form::peLabel($properties['method_id'], 'addTable');
             }
             $table = $rows ? $rows : DB::getCats($name, $f_id);
             if ($table) {
                 foreach ($table as $id => $row) {
                     $hidden = $row['row']['hidden'] == 'Y' ? 'hidden' : '';
                     $HTML .= "<li id=\"{$row['row']['id']}\" class=\"li_{$level} ml_li {$hidden}\">";
                     $HTML .= !empty($row['children']) ? '<div onclick="ml_expand(this)" class="more"></div><div onclick="ml_collapse(this)" class="less"></div>' : '';
                     $HTML .= "<div class=\"ml_item\">";
                     if ($CFG->url == 'edit_tabs' && !empty($row['row']['url'])) {
                         $is_tab = $name == 'admin_tabs' ? '1' : '0';
                         if (User::permission(0, 0, $properties['url'], false, $properties['url_is_tab']) > 1) {
                             $HTML .= '<a class="edit_page" href="index.php?current_url=edit_page&table=' . $name . '&id=' . $row['row']['id'] . '&is_tab=' . $is_tab . '"></a>';
                         }
                     }
                     if (is_array($properties['table_fields'])) {
                         foreach ($properties['table_fields'] as $field) {
                             $value = Grid::detectData($field, $row['row'][$field], $this->fields[$name]);
                             $HTML .= !empty($properties['url']) ? Link::url($properties['url'], $row['row'][$field], "table={$name}&id={$row['row']['id']}&f_id={$row['row']['f_id']}&p_id={$row['row']['p_id']}&action=record&is_tab=" . $properties['url_is_tab'], false, false, $properties['target_elem_id']) : $value;
                         }
                         $del_function = $CFG->url == 'edit_tabs' ? 'deletePage(this)' : 'ml_delete(this)';
                         if (User::permission(0, 0, $properties['url'], false, $properties['url_is_tab']) > 1) {
                             $HTML .= Link::url($properties['url'], false, "table={$name}&id={$row['row']['id']}&f_id={$row['row']['f_id']}&p_id={$row['row']['p_id']}&action=record&is_tab=" . $properties['url_is_tab'], false, false, $properties['target_elem_id'], 'view', false, false, false, false, $CFG->view_hover_caption) . Link::url($properties['url'], false, "table={$name}&id={$row['row']['id']}&f_id={$row['row']['f_id']}&p_id={$row['row']['p_id']}&action=form&is_tab=" . $properties['url_is_tab'], false, false, $properties['target_elem_id'], 'edit', false, false, false, false, $CFG->edit_hover_caption) . "<a href=\"#\" class=\"delete\" title=\"{$CFG->delete_hover_caption}\" onclick=\"{$del_function}\" class=\"button\"></a>";
                         }
                     } else {
                         foreach ($row['row'] as $field) {
                             $HTML .= '<span>' . $field . '</span>';
                         }
                     }
                     $HTML .= $this->row_end_button ? $this->row_end_button : '';
                     if (User::permission(0, 0, $properties['url'], false, $properties['url_is_tab']) > 1 && $accepts_children) {
                         $HTML .= $properties['accept_children'] ? Link::url($properties['url'], '<div class="add_new"></div>' . $CFG->add_new_caption, "table={$name}&f_id={$f_id}&p_id={$p_id}&action=form&is_tab=" . $properties['url_is_tab'], false, false, $properties['target_elem_id']) : '';
                     }
                     $HTML .= '</div>';
                     if (!empty($row['children'])) {
                         $HTML .= MultiList::displayItems(array($name => $properties), $row['children'], false, $level + 1, $id);
                     }
                     foreach ($this->tables as $name1 => $properties1) {
                         if ($properties1['parent'] == $name) {
                             $HTML .= MultiList::displayItems(array($name1 => $properties1), false, $id, $level + 1);
                         }
                     }
                     $HTML .= '</li>';
                 }
             }
             $HTML .= '</ul>';
             $HTML .= "<div class=\"add_elem\">" . Link::url($properties['url'], '<div class="add_new"></div>' . $CFG->add_new_caption, "table={$name}&f_id={$f_id}&p_id={$p_id}&action=form&is_tab=" . $CFG->is_tab, false, false, $properties['target_elem_id']) . "</div>";
         }
         return $HTML;
     }
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:71,代码来源:MultiList.php

示例4: printEvents

    private function printEvents($events, $s_time = false, $e_time = false, $day = 0, $f_id = 0)
    {
        global $CFG;
        if (is_array($events)) {
            $HTML = '';
            foreach ($events as $timestamp => $events) {
                if (is_array($events)) {
                    foreach ($events as $event) {
                        $table = $event['table'];
                        $sdate_field = $this->tables[$table]['sdate_field'];
                        $edate_field = $this->tables[$table]['edate_field'];
                        $color_field = $this->tables[$table]['color_field'];
                        if (is_array($this->fields[$table])) {
                            foreach ($this->fields[$table] as $field) {
                                $name = $field['name'];
                                if ($name == $color_field) {
                                    continue;
                                }
                                $value = $field['is_placeholder'] ? $field['value'] : Grid::detectData($name, $event[$name], $this->tables[$table]['table_fields']);
                                $value = $field['print_caption'] ? '<div class="print_line"><span class="print_label">' . $field['print_caption'] . '</span>:<span>' . $value . '</span></div>' : '<div class="print_line">' . $value . '</div>';
                                if ($field['in_title']) {
                                    $title_fields[] = $value;
                                } else {
                                    $details_fields[] = $value;
                                }
                            }
                        }
                        $HTML .= '
						<div class="cal_print_item">
							<div class="title">' . @implode('', $title_fields) . '<div class="clear"></div></div>
							<div class="details">' . @implode('', $details_fields) . '<div class="clear"></div></div>
						</div>';
                        unset($title_fields);
                        unset($details_fields);
                    }
                }
            }
        }
        return $HTML;
    }
开发者ID:mbassan,项目名称:backstage2,代码行数:40,代码来源:Calendar.php

示例5: getSubTable

 function getSubTable($table, $table_fields = false, $f_id = 0, $concat_char = false, $f_id_field = false)
 {
     $concat_char = $concat_char ? $concat_char : ' ';
     $sql = "SELECT ";
     if (is_array($table_fields)) {
         $sql .= "{$table}.id,";
         foreach ($table_fields as $field) {
             $sql .= "{$table}.{$field},";
         }
         $sql = substr($sql, 0, -1);
     } else {
         $sql .= "{$table}.*";
     }
     $sql .= " FROM {$table} WHERE 1 ";
     if (is_numeric($f_id)) {
         $f_id_field = $f_id_field ? $f_id_field : 'f_id';
         $sql .= " AND {$table}.{$f_id_field} = {$f_id} ";
     }
     if (@in_array('order', $table_fields)) {
         $sql .= " ORDER BY {$table}.order, {$table}.{$table_fields[0]} ASC ";
     } elseif (is_array($table_fields)) {
         if (!empty($table_fields[0])) {
             $sql .= " ORDER BY {$table}.{$table_fields[0]} ASC ";
         }
     }
     $result = db_query_array($sql);
     $fields_array = array();
     if ($result) {
         $table_info = GridDB::getTableFields($table);
         foreach ($result as $row) {
             $r_id = $row['id'];
             if (!in_array('id', $table_fields)) {
                 unset($row['id']);
             }
             if (is_array($row)) {
                 foreach ($row as $name => $field) {
                     $row[$name] = Grid::detectData($name, $field, $table_info);
                 }
             }
             $fields_array[$r_id] = implode($concat_char, $row);
         }
     }
     return $fields_array;
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:44,代码来源:FormDB.php


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