예제 #1
0
    function display()
    {
        global $CFG;
        $tab_id = $CFG->pm_editor ? $CFG->id : Control::getPageId($CFG->url, 1);
        if (!$tab_id > 0) {
            return false;
        }
        $current_tab = DB::getRecord('admin_tabs', $tab_id, 0, 1);
        $pages = self::getPages($tab_id);
        if ($pages) {
            $HTML = '
			<div class="page_map">';
            foreach ($pages as $page) {
                if ($CFG->pm_editor) {
                    $edit = '<a href="#" title="' . $CFG->edit_hover_caption . '" class="edit" class="method_edit_button" onclick="pmPageEdit(' . $page['id'] . ',event);return false;"></a>';
                }
                $order = $page['order'];
                $icon = $page['icon'] ? '<div class="lnk">' . Link::url($page['url'], '<img src="' . $page['icon'] . '" title="' . $page['name'] . '" />', false, false, false, 'content') . '</div>' : '';
                $pages_array[$order][] = '
				<div class="page_map_page o">
					<input type="hidden" id="id" value="' . $page['id'] . '" />
					' . $icon . '
					<div class="lnk">' . Link::url($page['url'], $page['name'], false, false, false, 'content') . '</div>
					' . $edit . '
					<div class="clear"></div>
				</div>';
            }
            $total = max(array_keys($pages_array));
            $total = $total + count($this->areas_s);
            $total = $total + count($this->areas_e);
            for ($i = 0; $i <= $total; $i++) {
                if ($this->areas_s[$i]) {
                    foreach ($this->areas_s[$i] as $area) {
                        $HTML .= $area;
                    }
                }
                if ($pages_array[$i]) {
                    foreach ($pages_array[$i] as $p) {
                        $HTML .= $p;
                    }
                }
                if ($this->areas_e[$i]) {
                    foreach ($this->areas_e[$i] as $area) {
                        $HTML .= $area;
                    }
                }
            }
            $HTML .= '</div>';
        } else {
            $HTML .= '<div class="no_pages">' . $CFG->pagemap_nothing . '</div>';
        }
        echo $HTML;
    }
예제 #2
0
 function __construct($table, $record_id)
 {
     global $CFG;
     $this->table = $table;
     $this->record_id = $CFG->include_id > 0 ? $CFG->include_id : $record_id;
     $this->row = DB::getRecord($this->table, $this->record_id, 0, 1);
     $this->db_fields = DB::getTableFields($this->table);
     $this->db_subtables = DB::getSubtables($this->table);
     $this->db_subtables = !$this->db_subtables ? array() : $this->db_subtables;
     $this->area_i = 0;
     $this->current_area = 0;
     $page_id = Control::getPageId($CFG->url, $CFG->is_tab);
     $corresponding_form = Control::getControls($page_id, 'form', $CFG->is_tab);
     if ($corresponding_form) {
         $k = key($corresponding_form);
         if ($corresponding_form[$k]['params'] = 'Form') {
             foreach ($corresponding_form[$k]['methods'] as $method) {
                 $args = Control::parseArguments($method['arguments'], 'Form', $method['method']);
                 $name = $args['name'] ? $args['name'] : $args['value'];
                 $this->form_method_args[$name] = $args;
             }
         }
     }
 }
예제 #3
0
				<div class="desc" onclick="file_manager.select(this,event);" ondblclick="file_manager.openFolder(' . $row['id'] . ',' . $has_sub . ')">' . $row['name'] . '</div>
				<div class="clear"></div>
			</div>';
        }
    }
} elseif ($action == 'drop') {
    if ($_REQUEST['rows']) {
        foreach ($_REQUEST['rows'] as $id => $row) {
            DB::update($row['table'], array($row['folder_field'] => $row['p_id']), $id);
        }
        Messages::add($CFG->ajax_save_message);
        Messages::display();
    }
} elseif ($action == 'download') {
    if ($_REQUEST['download']) {
        $page_id = Control::getPageId($_REQUEST['current_url'], $_REQUEST['is_tab']);
        $controls = Control::getControls($page_id, 'form', $_REQUEST['is_tab']);
        $key = key($controls);
        $methods = $controls[$key]['methods'];
        if ($methods) {
            foreach ($methods as $method) {
                if ($method['method'] == 'fileInput' || $method['method'] == 'fileMultiple') {
                    $args = Control::parseArguments($method['arguments'], 'Form', $method['method']);
                    $field_names[] = $args['name'];
                    $image_sizes = DB::getImageSizes($args['name']);
                    end($image_sizes);
                    $suffixes[$args['name']] = key($image_sizes);
                }
            }
        }
        $filename = $CFG->dirroot . $CFG->temp_file_location . 'archivos_' . date('Y-m-d') . '.zip';
예제 #4
0
    function __construct($url, $action, $is_tab = false, $editor_mode = false)
    {
        global $CFG;
        if ($url && !User::permission(false, false, $url)) {
            return false;
        }
        date_default_timezone_set($CFG->default_timezone);
        String::magicQuotesOff();
        $page_id = is_numeric($url) ? $url : Control::getPageId($url, $is_tab);
        if (!($page_id > 0)) {
            return false;
        }
        $page_info = $is_tab ? DB::getRecord('admin_tabs', $page_id, 0, 1) : DB::getRecord('admin_pages', $page_id, 0, 1);
        if ($page_info['one_record'] == 'Y' && !$editor_mode) {
            $action = 'form';
            $_REQUEST['id'] = 1;
            $CFG->control_one_record = 1;
        }
        $controls = Control::getControls($page_id, $action, $is_tab);
        $CFG->editor_page_id = $page_id;
        $CFG->editor_is_tab = $is_tab;
        $CFG->is_ctrl_panel = $page_info['is_ctrl_panel'];
        if ($controls) {
            foreach ($controls as $c_id => $control) {
                $params = $control['params'];
                $is_static = $params['is_static'] == 'Y';
                $class = $params['class'];
                $CFG->control_pass_id = $params['id'];
                if ($_REQUEST['cal_bypass'] && $class != 'Calendar') {
                    continue;
                }
                if ($editor_mode) {
                    $pm_methods = array();
                    echo '<div class="pm_class_container" id="control_' . $params['id'] . '">
							<div class="control_label">' . $params['class'] . ' ' . $params['id'] . '
								<a href="#" title="' . $CFG->move_hover_caption . '" class="move_handle dont_disable"></a>
								<a class="edit dont_disable" title="' . $CFG->edit_hover_caption . '" onclick="pmControlEdit(\'control_' . $params['id'] . '\');"></a>
								<a class="delete dont_disable" title="' . $CFG->delete_hover_caption . '" onclick="pmControlDelete(\'control_' . $params['id'] . '\');"></a>
							</div>
							<input type="hidden" class="this_class" id="control_' . $params['id'] . '_class" value="' . $params['class'] . '"/>
							<input type="hidden" class="this_page_id" id="control_' . $params['id'] . '_page_id" value="' . $params['page_id'] . '"/>
							<input type="hidden" class="this_action" id="control_' . $params['id'] . '_action" value="' . $params['action'] . '"/>
							<input type="hidden" class="this_id" id="control_' . $params['id'] . '_id" value="' . $params['id'] . '"/>';
                }
                if (!$is_static) {
                    $ref = new ReflectionClass($class);
                    $args = Control::parseArguments($params['arguments'], $class, '__construct');
                    $this->class = $ref->newInstanceArgs($args);
                    if ($class == 'Form') {
                        if (!$CFG->in_include) {
                            $this->class->verify();
                            $this->class->save();
                            $this->class->show_errors();
                            $this->class->show_messages();
                            $this->class->get($page_info['url'] == 'my-account' || $url == 'my-account' ? User::$info['id'] : $_REQUEST['id']);
                        } else {
                            $this->class->get($CFG->include_id);
                        }
                        $this->class->info['p_id'] = $_REQUEST['p_id'];
                        $this->class->info['f_id'] = $_REQUEST['f_id'];
                        if ($page_info['url'] == 'my-account' || $url == 'my-account') {
                            $CFG->o_method_suppress = true;
                            $this->class->passiveField('id', 'ID');
                            $CFG->o_method_suppress = true;
                            $this->class->textInput('user', $CFG->user_username, true, false, false, false, false, false, false, false, 1, $CFG->user_unique_error);
                            $CFG->o_method_suppress = true;
                            $this->class->passwordInput('pass', $CFG->user_password, true);
                            $CFG->o_method_suppress = true;
                            $this->class->passwordInput('pass1', $CFG->user_password, true, false, false, false, false, false, 'pass');
                            $CFG->o_method_suppress = true;
                            $this->class->textInput('first_name', $CFG->user_first_name, true);
                            $CFG->o_method_suppress = true;
                            $this->class->textInput('last_name', $CFG->user_last_name, true);
                            $CFG->o_method_suppress = true;
                            $this->class->textInput('phone', $CFG->user_phone);
                            $CFG->o_method_suppress = true;
                            $this->class->textInput('email', $CFG->user_email);
                            if (User::$info['is_admin'] == 'Y') {
                                $CFG->o_method_suppress = true;
                                $this->class->selectInput('f_id', $CFG->user_group, false, $_REQUEST['f_id'], false, 'admin_groups', array('name'));
                                $CFG->o_method_suppress = true;
                                $this->class->checkBox('is_admin', $CFG->user_is_admin);
                            }
                        }
                    }
                    echo '<input type="hidden" id="control_' . $params['id'] . '_table" value="' . $args['table'] . '"/>';
                }
                if (is_array($control['methods'])) {
                    foreach ($control['methods'] as $method) {
                        if ($method['p_id'] > 0) {
                            continue;
                        }
                        //$method['method'] = ($method['method'] == 'selectInput') ? 'fauxSelect' : $method['method'];
                        $CFG->method_id = $method['id'];
                        $args = Control::parseArguments($method['arguments'], $class, $method['method']);
                        $inputs_array = self::getSubMethods($method['id'], $class);
                        if (is_array($inputs_array)) {
                            $args['inputs_array'] = $inputs_array;
                        }
                        if ($is_static) {
                            call_user_func_array("{$class}::{$method['method']}", $args);
                        } else {
                            $method_instance = $ref->getMethod($method['method']);
                            $method_instance->invokeArgs($this->class, $args);
                        }
                    }
                }
                $CFG->method_id = false;
                if ($class == 'Form' && !$CFG->pm_decouple_cancel) {
                    $this->class->cancelButton($CFG->cancel_button);
                }
                if ($class == 'Record' && !$CFG->pm_decouple_cancel) {
                    $d = new Form('dummy');
                    $d->cancelButton($CFG->ok_button);
                    $d->display();
                }
                if (!$is_static) {
                    if ($class == 'Grid') {
                        $this->class->display($_REQUEST['page' . $this->class->i]);
                    } else {
                        $this->class->display();
                    }
                }
                if ($editor_mode) {
                    echo '
					<div class="clear">&nbsp;</div></div>';
                }
                $this->class = false;
            }
        }
        if ($editor_mode) {
            echo '
			<script type="text/javascript">
				$(document).ready(function(){
					startEditor();
				});
			</script>';
        }
    }