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


PHP String::doFormulaReplacements方法代码示例

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


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

示例1: get


//.........这里部分代码省略.........
                     foreach ($tokenizer_values as $r_name1 => $r_value1) {
                         $sql .= " {$w_table}.{$r_name} = {$r_value1} OR";
                     }
                     $sql = substr($sql, 0, -2);
                     $sql .= ") ";
                 }
             } else {
                 $r_name_parts = explode(',', $r_name);
                 $r_name_orig_parts = explode(',', $r_name_orig);
                 $r_name_sql = false;
                 $equals = $r_properties['not_equals'] ? '!=' : '=';
                 $sql .= ' AND (';
                 foreach ($r_name_parts as $k1 => $r_name_part) {
                     if (strstr($r_name_part, '.')) {
                         $r_orig_name = explode('.', $r_name_orig_parts[$k1]);
                         if (!empty($join_tables[$r_orig_name[0]])) {
                             $r_name_sql[] = " {$r_name_orig_parts[$k1]} {$equals} '{$r_value}' ";
                         }
                         $r_name_sql[] = " {$r_name_part} {$equals} '{$r_value}' ";
                     } else {
                         $r_name_sql[] = " {$table}.{$r_name_part} {$equals} '{$r_value}' ";
                     }
                 }
                 $sql .= implode('OR', $r_name_sql);
                 $sql .= ' ) ';
             }
         }
     }
     if (($f_id > 0 || $f_id === 0 || $f_id === '0') && $f_id_field) {
         if (strstr($f_id_field, ',')) {
             $parts = explode(',', $f_id_field);
             $c = count($parts) - 1;
             $r_parts = explode('.', $parts[$c]);
             $j_table = $joined_tables[$r_parts[0]] ? $joined_tables[$r_parts[0]] : $r_parts[0];
             $r_table = $j_table . '.' . $r_parts[1];
             $sql .= " AND {$r_table} = {$f_id} ";
         } elseif (strstr($f_id_field, '.')) {
             $r_parts = explode('.', $f_id_field);
             $j_table = $joined_tables[$r_parts[0]] ? $joined_tables[$r_parts[0]] : $r_parts[0];
             $sql .= " AND {$j_table}.{$r_parts[1]} = {$f_id} ";
         } else {
             $sql .= " AND {$table}.{$f_id_field} = {$f_id} ";
         }
     }
     if (!$calendar_mode) {
         if ($s_date && $s_date_field) {
             $sql .= " AND {$table}.{$s_date_field} >= '" . date('Y-m-d', $s_date) . "' ";
         }
         if ($e_date && $e_date_field) {
             $sql .= " AND {$table}.{$e_date_field} <= '" . date('Y-m-d', $e_date) . "' ";
         }
     } else {
         if ($s_date && $s_date_field && ($e_date && $e_date_field)) {
             $sql .= " AND (DATE({$table}.{$s_date_field}) <= '" . date('Y-m-d', $e_date) . "' AND (DATE({$table}.{$e_date_field}) >= '" . date('Y-m-d', $s_date) . "' OR DATE({$table}.{$e_date_field}) < '1980-01-01')) ";
         } else {
             $sql .= " AND (DATE({$table}.{$s_date_field}) >= '" . date('Y-m-d', $s_date) . "' AND DATE({$table}.{$s_date_field}) <= '" . date('Y-m-d', $e_date) . "') ";
         }
     }
     if ($filters) {
         foreach ($filters as $filter) {
             if ($filter) {
                 $filter = String::doFormulaReplacements($filter);
                 $filter = self::replaceTables($filter, $joined_tables);
                 $sql .= " AND {$filter} ";
             }
         }
     }
     if (!$count && !$get_average && !$get_total || $having) {
         if (!$no_group_by) {
             $group_field = $group_by ? $group_by : "{$table}.id";
             $sql .= " GROUP BY {$group_field} ";
         }
     }
     if ($having) {
         $sql .= " HAVING 1 " . $having;
     }
     if (!$count && !$get_average && !$get_total) {
         if ($order_by) {
             $order_by = !strstr('.', $order_by) && !$fields[$order_by]['is_op'] ? $table . '.' . $order_by : '`' . $order_by . '`';
             $sql .= " ORDER BY {$order_by} {$order_asc} ";
         } else {
             $sql .= " ORDER BY {$table}.id {$order_string} ";
         }
         if ($start_row > 0 || $per_page > 0) {
             $sql .= " LIMIT {$start_row},{$per_page} ";
         }
     }
     //echo $sql.'<br><br>';
     $result = db_query_array($sql);
     if ($count && $having) {
         $result[0]['total'] = count($result);
     }
     if ($count) {
         return $result[0]['total'];
     } elseif ($get_total || $get_average) {
         return $result[0]['grand_total'];
     } else {
         return $result;
     }
 }
开发者ID:MirellJ,项目名称:backstage2,代码行数:101,代码来源:DB.php

示例2: createRecord

 function createRecord($table, $insert_array, $trigger_field = false, $trigger_value = false, $day = false, $month = false, $year = false, $send_condition = false, $any_modification = false, $register_changes = false, $on_new_record_only = false, $store_row = false, $if_not_exists = false, $run_in_cron = false)
 {
     global $CFG;
     if ($CFG->backstage_mode) {
         $HTML = '';
         if ($CFG->pm_editor) {
             if (!$this->edit_record) {
                 $this->HTML[] = "[create_record]" . self::peLabel($CFG->method_id, 'createRecord');
             } else {
                 $this->HTML[] = "[edit_record]" . self::peLabel($CFG->method_id, 'editRecord');
             }
         }
         /*
         			$HTML .= '
         			<input type="hidden" name="trigger_field1[]" value="'.$trigger_field.'" />
         			<input type="hidden" name="trigger_value1[]" value="'.$trigger_value.'" />
         			<input type="hidden" name="create_record_table[]" value="'.$table.'" />
         			';
         			$this->HTML[] = $HTML;
         */
     }
     if ($run_in_cron && !$CFG->in_cron) {
         return false;
     } elseif ($run_in_cron && $CFG->in_cron) {
         $modified = true;
     }
     //used to have this ($CFG->ignore_request == $table) return false. Don't remember why.
     if ((is_array($this->errors) || !($this->save_called || $CFG->save_called) || !$_REQUEST[$this->name] || $_REQUEST['bypass_create_record']) && !$CFG->in_cron) {
         return false;
     }
     if (!$on_new_record_only && $this->record_created && !$trigger_field || $on_new_record_only && !$this->record_created) {
         return false;
     }
     if ($send_condition) {
         $send_condition = String::doFormulaReplacements($send_condition, $this->info, 1);
         if (!eval("if ({$send_condition}) { return 1;} else { return 0;}")) {
             return false;
         }
     }
     if ($register_changes) {
         $changes = '<div class="show_details"><a onclick="showDetails(this);return false;" href="#">' . $CFG->comments_show_details . '</a><a onclick="hideDetails(this);return false;" style="display:none;" href="#">' . $CFG->comments_hide_details . '</a></div><div class="details" style="display:none;">';
     }
     if ($this->info && $register_changes) {
         foreach ($this->info as $name => $value) {
             $grid_input_modified = false;
             if (@in_array($name, $_REQUEST['grid_inputs'])) {
                 if (is_array($this->info[$name])) {
                     if (is_array($this->old_info[$name])) {
                         foreach ($this->old_info[$name] as $id => $row) {
                             foreach ($row as $k => $v) {
                                 $key = $row['id'];
                                 if (!empty($v) && $v != 'N' && $k != 'id' && $k != 'f_id') {
                                     $compare[$key][$k] = $v;
                                 }
                             }
                         }
                         if ($compare) {
                             ksort($compare);
                             $compare = array_values($compare);
                         }
                     }
                     $i = 0;
                     foreach ($this->info[$name] as $id => $row) {
                         foreach ($row as $k => $v) {
                             if (!empty($v)) {
                                 $filtered[$i] = $row;
                             }
                         }
                         $i++;
                     }
                     if ($filtered && $compare) {
                         $i = 0;
                         foreach ($filtered as $array) {
                             if (is_array($array)) {
                                 foreach ($array as $k => $v) {
                                     if ($v != $compare[$i][$k] && (!empty($v) && !empty($compare[$i][$k]))) {
                                         $grid_input_modified = true;
                                     }
                                 }
                             }
                             $i++;
                         }
                         if (!$grid_input_modified) {
                             if (count($filtered) != count($compare)) {
                                 $grid_input_modified = true;
                             }
                         }
                     } elseif ($compare && !$filtered || $filtered && !$compare) {
                         $grid_input_modified = true;
                     }
                 }
             }
             if ($name == 'cat_selects') {
                 if (is_array($this->info[$name])) {
                     @asort($this->info[$name]);
                     @asort($this->old_info[$name]);
                     $this->info[$name] = @array_values($this->info[$name]);
                     $this->old_info[$name] = @array_values($this->old_info[$name]);
                     foreach ($this->info[$name] as $key => $arr) {
                         @asort($arr);
//.........这里部分代码省略.........
开发者ID:mbassan,项目名称:backstage2,代码行数:101,代码来源:Form.php

示例3: startRestricted

 function startRestricted($groups = false, $only_admin = false, $users = false, $user_id_equals_field = false, $group_id_equals_field = false, $condition = false, $exclude_groups = false, $exclude_admin = false, $exclude_users = false)
 {
     global $CFG;
     if ($CFG->pm_editor) {
         $method_name = Form::peLabel($CFG->method_id, 'startRestricted');
     }
     if ($CFG->pm_editor) {
         $this->HTML[] = "\n\t\t\t{$legend} [start_restricted] {$method_name}";
     } else {
         if ($only_admin) {
             if ($condition) {
                 $condition = String::doFormulaReplacements($condition, $this->row);
                 $restricted = $restricted ? $restricted : @eval("if ({$condition}) { return 0;} else { return 1;}");
             }
         } else {
             if (is_array($users)) {
                 $restricted = !array_key_exists(User::$info['id'], $users);
             }
             if (is_array($groups)) {
                 $restricted = !$restricted ? !array_key_exists(User::$info['f_id'], $groups) : $restricted;
             }
             if (is_array($exclude_users)) {
                 $restricted = !$restricted ? array_key_exists(User::$info['id'], $exclude_users) : $restricted;
             }
             if (is_array($exclude_groups)) {
                 $restricted = !$restricted ? array_key_exists(User::$info['f_id'], $exclude_groups) : $restricted;
             }
             if ($exclude_admin) {
                 $restricted = !$restricted ? User::$info['is_admin'] == 'Y' : $restricted;
             }
             if ($user_id_equals_field) {
                 if (strstr($user_id_equals_field, ',')) {
                     $parts = explode(',', $user_id_equals_field);
                     $parts1 = explode('.', $parts[0]);
                     $first_table = $parts1[0];
                     $first_field = $parts1[1];
                     $c = count($parts) - 1;
                     $parts2 = explode('.', $parts[$c]);
                     $last_table = $parts2[0];
                     $last_field = $parts2[1];
                     $row = DB::getFields($last_table, $this->row[$first_field], array($last_field), $user_id_equals_field, false, false, false, false, 1);
                     $restricted = !$restricted ? $restricted : User::$info['id'] != $row[$last_field];
                 } else {
                     $restricted = !$restricted ? $restricted : User::$info['id'] != $this->row[$user_id_equals_field];
                 }
             }
             if ($group_id_equals_field) {
                 if (strstr($group_id_equals_field, ',')) {
                     $parts = explode(',', $group_id_equals_field);
                     $parts1 = explode('.', $parts[0]);
                     $first_table = $parts1[0];
                     $first_field = $parts1[1];
                     $c = count($parts) - 1;
                     $parts2 = explode('.', $parts[$c]);
                     $last_table = $parts2[0];
                     $last_field = $parts2[1];
                     $row = DB::getFields($last_table, $this->row[$first_field], array($last_field), $group_id_equals_field, false, false, false, false, 1);
                     $restricted = !$restricted ? $restricted : User::$info['f_id'] != $row[$last_field];
                 } else {
                     $restricted = !$restricted ? $restricted : User::$info['f_id'] != $this->row[$group_id_equals_field];
                 }
             }
             if ($condition) {
                 $condition = String::doFormulaReplacements($condition, $this->row);
                 $restricted = $restricted ? $restricted : eval("if ({$condition}) { return 0;} else { return 1;}");
             }
         }
         $restricted = User::$info['is_admin'] == 'Y' && !$exclude_admin ? false : $restricted;
         if ($restricted) {
             $this->HTML[] = "<restricted>";
         }
     }
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:73,代码来源:Record.php

示例4: show

    private function show($comments)
    {
        global $CFG;
        if ($comments) {
            echo '<ul>';
            foreach ($comments as $comment) {
                $elapsed = time() + Settings::mysqlTimeDiff() * 3600 - strtotime($comment['date']);
                if ($elapsed < 60) {
                    $time_ago = $CFG->comments_less_than_minute;
                } elseif ($elapsed > 60 && $elapsed < 60 * 60) {
                    $minutes = floor($elapsed / 60);
                    $time_ago = str_ireplace('[field]', $minutes, $CFG->comments_minutes_ago);
                } elseif ($elapsed > 60 * 60 && $elapsed < 60 * 60 * 24) {
                    $hours = floor($elapsed / 60 / 60);
                    $time_ago = str_ireplace('[field]', $hours, $CFG->comments_hours_ago);
                } elseif ($elapsed > 60 * 60 * 24 && $elapsed < 60 * 60 * 24 * 30.4) {
                    $days = floor($elapsed / 60 / 60 / 24);
                    $time_ago = str_ireplace('[field]', $days, $CFG->comments_days_ago);
                } else {
                    $months = floor($elapsed / 60 / 60 / 24 / 30.4);
                    $time_ago = str_ireplace('[field]', $months, $CFG->comments_months_ago);
                }
                if ($comment['user_id'] > 0) {
                    $user = DB::getRecord($this->user_table, $comment['user_id'], false, true);
                    $name = !empty($comment['website']) ? Link::url($comment['website'], $user['user']) : $user['user'];
                } else {
                    $name = !empty($comment['website']) ? Link::url($comment['website'], $comment['name']) : $comment['name'];
                }
                $short = $this->short_version ? '_short' : '';
                $icon = $comment['type'] ? eval('return $CFG->comment_type_' . $comment['type'] . ';') : $CFG->comment_type_1;
                $action = $comment['type'] ? eval('return $CFG->comments_action_' . $comment['type'] . $short . ';') : $CFG->comments_wrote_label;
                $action = String::doFormulaReplacements($action, unserialize($comment['f_table_row']), 1, 1);
                echo '
				<li id="comment_' . $comment['id'] . '" class="level_' . $comment['type'] . '">
					<div class="c_head">';
                if ($this->fields) {
                    foreach ($this->fields as $f_name => $field) {
                        $CFG->o_method_id = $field['method_id'];
                        $CFG->o_method_name = 'field';
                        $record = new Record($field['table'], $comment['record_id']);
                        echo '<div class="added_field">' . $record->field($field['name'], $field['caption'], $field['subtable'], $field['subtable_fields'], $field['link_url'], $field['concat_char'], true, $field['f_id_field'], $field['order_by'], $field['order_asc'], $comment['record_id'], $field['link_is_tab'], $field['limit_is_curdate'], false, $field['link_id_field']) . '</div>';
                    }
                }
                echo '
						' . $icon . ' ' . $name . ' (' . $time_ago . ') ' . $action . '
					</div>';
                if (!$this->short_version) {
                    echo '
						<div class="c_comment">
							' . (strlen($comment['comments']) != strlen(strip_tags($comment['comments'])) ? $comment['comments'] : nl2br($comment['comments'])) . '
						</div>';
                }
                echo '
					' . ($comment['type'] <= 1 && !$this->short_version ? '<div class="c_reply"><a href="#" onclick="showReplyBox(' . $comment['id'] . ',' . $this->i . ');return false;">' . $CFG->comments_reply_label . '</a></div>' : '') . '
					<div class="c_form"></div>
				</li>';
                if (is_array($comment['children'])) {
                    Comments::show($comment['children']);
                }
            }
            echo '<div style="clear:both;height:0;"></div></ul>';
        }
    }
开发者ID:mbassan,项目名称:backstage2,代码行数:63,代码来源:Comments.php

示例5: parseVariables

 public static function parseVariables($variables, $row, $record_id = 0, $url = false, $update_variable_values = false)
 {
     global $CFG;
     $reserved_keywords = array('current_url', 'action', 'bypass', 'is_tab');
     if (is_array($variables)) {
         foreach ($variables as $k => $v) {
             $is_formula = strstr($v, '(') && strstr($v, ')');
             $k1 = $url ? "{$url}[{$k}]" : $k;
             $v1 = $is_formula ? $v : str_replace('[', '', str_replace(']', '', $v));
             if (strstr($v1, '(') && strstr($v1, ')')) {
                 $formula = String::doFormulaReplacements($v1, $row, 1);
                 $v1 = eval("return ({$formula});");
             }
             if (in_array($k, $reserved_keywords)) {
                 $variables1[$k] = $v;
             } elseif ($k == 'record_id') {
                 $variables1[$k1] = $is_formula ? $v1 : $record_id;
             } elseif ($k == 'id') {
                 $variables1[$k] = $is_formula ? $v1 : $record_id;
                 if ($update_variable_values) {
                     $variables1['record_id'] = $is_formula ? $v1 : $record_id;
                 }
             } elseif ($v1 == 'id') {
                 $variables1[$k1] = $is_formula ? $v1 : $record_id;
             } elseif ($v1 == 'curdate') {
                 $variables1[$k1] = date('Y-m-d 00:00:00');
             } elseif ($v1 == 'curtime') {
                 $variables1[$k1] = date('Y-m-d H:i:s', time() + Settings::mysqlTimeDiff() * 3600);
             } elseif ($k == 'user_id') {
                 $variables1[$k1] = User::$info['id'];
             } elseif (strstr($v1, 'count')) {
                 $p = explode('(', $v1);
                 $v1 = str_replace(')', '', $p[1]);
                 $variables1[$k1] = DB::countRows($v1);
             } elseif (strstr($v1, '.')) {
                 $parts = explode('.', $v1);
                 $sql = "SELECT {$parts[1]} FROM {$parts[0]} WHERE f_id = {$record_id}";
                 $result = db_query_array($sql);
                 if ($result) {
                     $m1 = $parts[1];
                     $variables1[$k1] = $result[0][$m1];
                 }
             } elseif (strstr($v1, ',')) {
                 $variables1[$k1] = DB::getForeignValue(implode(',', $v1), $row);
             } else {
                 self::replaceSystemVars($v1);
                 if (strstr($v1, '++')) {
                     $v1 = $row[str_replace('++', '', $v1)] + 1;
                 } elseif (strstr($v1, '--')) {
                     $v1 = $row[str_replace('--', '', $v1)] - 1;
                 } else {
                     $v1 = array_key_exists($v1, $row) ? $row[$v1] : $v;
                 }
                 $variables1[$k1] = $v1;
             }
         }
     }
     if ($record_id > 0 && $update_variable_values) {
         $variables1['record_id'] = $record_id;
     }
     return $variables1;
 }
开发者ID:mbassan,项目名称:backstage2,代码行数:62,代码来源:String.php

示例6: display


//.........这里部分代码省略.........
                    } elseif ($value['is_form']) {
                        if ($CFG->pm_editor) {
                            $method_name = Form::peLabel($value['method_id'], 'inlineForm');
                        }
                        if ($value['header_caption']) {
                            $HTML .= "<th class=\"multiple_input\">" . $value['header_caption'] . $method_name . '</th>';
                        }
                        continue;
                    }
                    if ($CFG->pm_editor) {
                        $method_name = !$value['run_in_sql'] ? Form::peLabel($value['method_id'], 'field') : Form::peLabel($value['method_id'], 'aggregate');
                    }
                    if ($value['filter']) {
                        $order_asc = $this->order_asc ? false : true;
                        if ($this->order_by == $name) {
                            $dir_img = $this->order_asc ? $CFG->up : $CFG->down;
                        } else {
                            $dir_img = false;
                        }
                        $filter_results = $_REQUEST['form_filters' . $this->i];
                        $HTML .= "<th>" . Link::url($CFG->url, $value['header_caption'] . $dir_img, false, array('filter' . $this->i => $name, 'order_by' . $this->i => $this->order_by, 'order_asc' . $this->i => $order_asc, 'is_tab' => $this->is_tab, 'inset_id' => $this->inset_id, 'inset_id_field' => $this->inset_id_field, 'inset_i' => $this->inset_i, 'form_filters' . $this->i => $filter_results, 'search_fields' . $this->i => $_REQUEST['search_fields' . $this->i]), false, false, $this->inset_i > 0 ? 'inset_area_' . $this->inset_i : 'content') . $method_name . "</th>";
                    } else {
                        $HTML .= "<th>" . $value['header_caption'] . $method_name . '</th>';
                    }
                }
            }
            $HTML .= $this->show_buttons ? "<th>&nbsp;</th>" : '';
            $HTML .= '</tr>';
            if (is_array($data)) {
                $alt = false;
                foreach ($data as $row) {
                    $alt = $alt ? false : 'alt';
                    if ($this->alert_condition1) {
                        $condition = String::doFormulaReplacements($this->alert_condition1, $row, 1);
                        $alert_class1 = eval("if ({$condition}) { return 1;} else { return 0;}") ? 'alert1' : '';
                    }
                    if ($this->alert_condition2) {
                        $condition = String::doFormulaReplacements($this->alert_condition2, $row, 1);
                        $alert_class2 = eval("if ({$condition}) { return 1;} else { return 0;}") ? 'alert2' : '';
                    }
                    $HTML .= '<tr class="' . $alt . ' ' . $alert_class1 . ' ' . $alert_class2 . '">';
                    if (!is_array($this->fields)) {
                        continue;
                    }
                    if ($CFG->backstage_mode && !$this->links_out && $this->show_buttons && $CFG->is_ctrl_panel != 'Y') {
                        $HTML .= "<td><label for=\"checkbox{$row['id']}\"/><input id=\"checkbox{$row['id']}\" type=\"checkbox\" value=\"{$row['id']}\" class=\"grid_select checkbox_input\"/></td>";
                    }
                    foreach ($this->fields as $name => $properties) {
                        $key = $name;
                        if (strstr($name, 'lll')) {
                            $name_parts = explode('lll', $name);
                            $name = $name_parts[0];
                        }
                        if ($this->inset_id > 0) {
                            if ($properties['name'] == $this->inset_id_field) {
                                continue;
                            }
                            if (strstr($this->inset_id_field, '.')) {
                                $inset_field_parts = explode('.', $this->inset_id_field);
                                if ($properties['subtable'] == $inset_field_parts[0] && (in_array($inset_field_parts[1], $properties['subtable_fields']) || $inset_field_parts[1] == 'id')) {
                                    continue;
                                }
                            }
                        }
                        $value = $row[$key];
                        $link_id = $row[$name . '_id'] ? $row[$name . '_id'] : $value;
开发者ID:mbassan,项目名称:backstage2,代码行数:67,代码来源:Grid.php

示例7: display


//.........这里部分代码省略.........
                    $HTML .= '
						</div>
						<div class="folder" onclick="file_manager.select(this,event);" ondblclick="file_manager.openFolder(' . $folder['id'] . ')"></div>
						<div class="desc" onclick="file_manager.select(this,event);" ondblclick="file_manager.openFolder(' . $folder['id'] . ')">' . $folder['folder_name'] . '</div>
						<input type="hidden" id="id" value="' . $folder['id'] . '" />
					</div>';
                }
            } elseif ($this->folders['children']) {
                foreach ($this->folders['children'] as $folder) {
                    $HTML .= '
					<div class="folder_container">
						<div class="ops">';
                    if (User::permission(0, 0, $this->folder_table) > 0) {
                        $HTML .= Link::url($this->folder_table, false, 'id=' . $folder['id'] . '&action=record', false, false, 'edit_box', 'view', false, false, false, false, $CFG->view_hover_caption) . ' ';
                    }
                    if (User::permission(0, 0, $this->folder_table) > 1) {
                        $HTML .= Link::url($this->folder_table, false, 'id=' . $folder['id'] . '&action=form', false, false, 'edit_box', 'edit', false, false, false, false, $CFG->edit_hover_caption) . ' ';
                    }
                    if (User::permission(0, 0, $this->folder_table) > 1) {
                        $HTML .= '<a href="#" title="' . $CFG->delete_hover_caption . '" onclick="file_manager.deleteThis(' . $folder['id'] . ',\'' . $this->folder_table . '\',this)" class="delete"></a>';
                    }
                    $HTML .= '
						</div>
						<div class="folder" onclick="file_manager.select(this,event);" ondblclick="file_manager.openFolder(' . $folder['id'] . ')"></div>
						<div class="desc" onclick="file_manager.select(this,event);" ondblclick="file_manager.openFolder(' . $folder['id'] . ')">' . $folder['folder_name'] . '</div>
						<input type="hidden" id="id" value="' . $folder['id'] . '" />
					</div>';
                }
            }
            if ($this->data) {
                foreach ($this->data as $file) {
                    if ($file['alert_condition1']) {
                        $file_row = DB::getRecord($file['table'], $file['id']);
                        $condition = String::doFormulaReplacements($file['alert_condition1'], $file_row, 1);
                        $alert_class1 = eval("if ({$condition}) { return 1;} else { return 0;}") ? 'alert1' : '';
                    }
                    if ($file['alert_condition2']) {
                        $file_row = is_array($file_row) ? $file_row : DB::getRecord($file['table'], $file['id']);
                        $condition = String::doFormulaReplacements($file['alert_condition2'], $file_row, 1);
                        $alert_class2 = eval("if ({$condition}) { return 1;} else { return 0;}") ? 'alert2' : '';
                    }
                    $HTML .= '
					<div class="file_container ' . $alert_class1 . ' ' . $alert_class2 . '">
						<div class="ops">';
                    if (User::permission(0, 0, $file['url']) > 0) {
                        $HTML .= Link::url($file['url'], false, 'id=' . $file['id'] . '&action=record&is_tab=' . $file['link_is_tab'], false, false, $file['target_elem_id'], 'view', false, false, false, false, $CFG->view_hover_caption) . ' ';
                    }
                    if (User::permission(0, 0, $file['url']) > 1) {
                        $HTML .= Link::url($file['url'], false, 'id=' . $file['id'] . '&action=form&is_tab=' . $file['link_is_tab'], false, false, $file['target_elem_id'], 'edit', false, false, false, false, $CFG->edit_hover_caption) . ' ';
                    }
                    if (User::permission(0, 0, $file['url']) > 1) {
                        $HTML .= '<a href="#" title="' . $CFG->delete_hover_caption . '" onclick="file_manager.deleteThis(' . $file['id'] . ',\'' . $file['table'] . '\',this)" class="delete"></a>';
                    }
                    $is_tab = $file['link_is_tab'] ? $file['link_is_tab'] : 'false';
                    $HTML .= '
						</div>
						<div class="file" onclick="file_manager.select(this,event);" ondblclick="file_manager.showFile(\'' . $file['url'] . '\',' . $file['id'] . ',' . $is_tab . ',\'' . $file['target_elem_id'] . '\');"></div>
						<div class="desc" onclick="file_manager.select(this,event);" ondblclick="file_manager.showFile(\'' . $file['url'] . '\',' . $file['id'] . ',' . $is_tab . ',\'' . $file['target_elem_id'] . '\');">' . $file['file_name'] . '</div>
						<input type="hidden" id="id" value="' . $file['id'] . '" />
						<input type="hidden" id="table" value="' . $file['table'] . '" />
						<input type="hidden" id="folder_field" value="' . $file['folder_field'] . '" />
					</div>';
                }
            }
        } elseif ($this->mode == 'search') {
            if ($this->data) {
开发者ID:mbassan,项目名称:backstage2,代码行数:67,代码来源:FileManager.php


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