function handle_add_col() { $logger = new SlotLogger(); $logger->open($this->file); $this->get_edit_view(); require_once 'modules/DynamicLayout/LayoutTemplate.php'; $layoutTemplate = new LayoutTemplate(); $view = $this->contents; $counter = 0; $return_view = ''; $add_col = -1; $delete_col = -1; if (!empty($_REQUEST['add_col_MSI'])) { $add_col = $_REQUEST['add_col_MSI']; $logger->add_col($add_col); } if (!empty($_REQUEST['delete_col_MSI'])) { $delete_col = $_REQUEST['delete_col_MSI']; $logger->del_col($delete_col); } $logger->close(); for ($i = 0; $i < sizeof($this->slots); $i++) { $slot = $this->slots[$i]; $explode = explode($slot[0], $view, 2); $view = $explode[1]; if ($delete_col != $i) { $return_view .= $explode[0] . $slot[0]; if ($add_col == $i) { if (substr_count($this->file, 'ListView') > 0) { if ($i < sizeof($this->slots) / 2) { $return_view .= $layoutTemplate->get_list_view_header(); $offset = $this->get_key_for_col($i); $add_col = $this->cols[$offset + floor(sizeof($this->cols) / 2)]; } else { $return_view .= $layoutTemplate->get_list_view_column(); } } } } else { if ($i < sizeof($this->slots) / 2) { $offset = $this->get_key_for_col($i); $delete_col = $this->cols[$offset + floor(sizeof($this->cols) / 2)]; } } $counter++; } if (empty($return_view)) { return $this->contents; } return $return_view . $view; }
function handle_add_row() { $logger = new SlotLogger(); $logger->open($this->file); require_once 'modules/DynamicLayout/LayoutTemplate.php'; $layoutTemplate = new LayoutTemplate(); $view = $this->contents; $counter = 0; $return_view = ''; $add_row = -1; $delete_row = -1; if (!empty($_REQUEST['add_row_MSI'])) { $add_row = $_REQUEST['add_row_MSI']; $logger->add_row($add_row); } if (!empty($_REQUEST['delete_row_MSI'])) { $delete_row = $_REQUEST['delete_row_MSI']; $logger->del_row($delete_row); } $logger->close(); for ($i = 0; $i < sizeof($this->slots); $i++) { $slot = $this->slots[$i]; $explode = explode($slot[0], $view, 2); if ($delete_row != $i) { $return_view .= $explode[0] . $slot[0]; if ($add_row == $i) { if (substr_count($this->file, 'EditView') > 0 || substr_count($this->file, 'SearchForm') > 0) { $return_view .= $layoutTemplate->get_edit_source_row(); } if (substr_count($this->file, 'DetailView') > 0) { $return_view .= $layoutTemplate->get_detail_source_row(); } } } else { $return_view .= $explode[0]; } $view = $explode[1]; $counter++; } if (empty($return_view)) { return $this->contents; } return $return_view . $view; }