From ce2b69675075444c9e40b72bcdd42ab7edbbe633 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 28 Jan 2011 22:51:06 +0100 Subject: update to CI 2.0 Signed-off-by: Florian Pritz --- system/scaffolding/Scaffolding.php | 291 ------------------------------- system/scaffolding/images/background.jpg | Bin 410 -> 0 bytes system/scaffolding/images/index.html | 10 -- system/scaffolding/images/logo.jpg | Bin 4518 -> 0 bytes system/scaffolding/index.html | 10 -- system/scaffolding/views/add.php | 32 ---- system/scaffolding/views/delete.php | 9 - system/scaffolding/views/edit.php | 33 ---- system/scaffolding/views/footer.php | 10 -- system/scaffolding/views/header.php | 29 --- system/scaffolding/views/index.html | 10 -- system/scaffolding/views/no_data.php | 8 - system/scaffolding/views/stylesheet.css | 143 --------------- system/scaffolding/views/view.php | 27 --- 14 files changed, 612 deletions(-) delete mode 100644 system/scaffolding/Scaffolding.php delete mode 100644 system/scaffolding/images/background.jpg delete mode 100644 system/scaffolding/images/index.html delete mode 100644 system/scaffolding/images/logo.jpg delete mode 100644 system/scaffolding/index.html delete mode 100644 system/scaffolding/views/add.php delete mode 100644 system/scaffolding/views/delete.php delete mode 100644 system/scaffolding/views/edit.php delete mode 100644 system/scaffolding/views/footer.php delete mode 100644 system/scaffolding/views/header.php delete mode 100644 system/scaffolding/views/index.html delete mode 100644 system/scaffolding/views/no_data.php delete mode 100644 system/scaffolding/views/stylesheet.css delete mode 100644 system/scaffolding/views/view.php (limited to 'system/scaffolding') diff --git a/system/scaffolding/Scaffolding.php b/system/scaffolding/Scaffolding.php deleted file mode 100644 index d110626b1..000000000 --- a/system/scaffolding/Scaffolding.php +++ /dev/null @@ -1,291 +0,0 @@ -CI =& get_instance(); - - $this->CI->load->database("", FALSE, TRUE); - $this->CI->load->library('pagination'); - - // Turn off caching - $this->CI->db->cache_off(); - - /** - * Set the current table name - * This is done when initializing scaffolding: - * $this->load->scaffolding('table_name') - * - */ - $this->current_table = $db_table; - - /** - * Set the path to the "view" files - * We'll manually override the "view" path so that - * the load->view function knows where to look. - */ - - $this->CI->load->_ci_view_path = BASEPATH.'scaffolding/views/'; - - // Set the base URL - $this->base_url = $this->CI->config->site_url().'/'.$this->CI->uri->segment(1).$this->CI->uri->slash_segment(2, 'both'); - $this->base_uri = $this->CI->uri->segment(1).$this->CI->uri->slash_segment(2, 'leading'); - - // Set a few globals - $data = array( - 'image_url' => $this->CI->config->system_url().'scaffolding/images/', - 'base_uri' => $this->base_uri, - 'base_url' => $this->base_url, - 'title' => $this->current_table - ); - - $this->CI->load->vars($data); - - // Load the language file and create variables - $this->lang = $this->CI->load->scaffold_language('scaffolding', '', TRUE); - $this->CI->load->vars($this->lang); - - // Load the helper files we plan to use - $this->CI->load->helper(array('url', 'form')); - - - log_message('debug', 'Scaffolding Class Initialized'); - } - - // -------------------------------------------------------------------- - - /** - * "Add" Page - * - * Shows a form representing the currently selected DB - * so that data can be inserted - * - * @access public - * @return string the HTML "add" page - */ - function add() - { - $data = array( - 'title' => ( ! isset($this->lang['scaff_add'])) ? 'Add Data' : $this->lang['scaff_add'], - 'fields' => $this->CI->db->field_data($this->current_table), - 'action' => $this->base_uri.'/insert' - ); - - $this->CI->load->view('add', $data); - } - - // -------------------------------------------------------------------- - - /** - * Insert the data - * - * @access public - * @return void redirects to the view page - */ - function insert() - { - if ($this->CI->db->insert($this->current_table, $_POST) === FALSE) - { - $this->add(); - } - else - { - redirect($this->base_uri.'/view/'); - } - } - - // -------------------------------------------------------------------- - - /** - * "View" Page - * - * Shows a table containing the data in the currently - * selected DB - * - * @access public - * @return string the HTML "view" page - */ - function view() - { - // Fetch the total number of DB rows - $total_rows = $this->CI->db->count_all($this->current_table); - - if ($total_rows < 1) - { - return $this->CI->load->view('no_data'); - } - - // Set the query limit/offset - $per_page = 20; - $offset = $this->CI->uri->segment(4, 0); - - // Run the query - $query = $this->CI->db->get($this->current_table, $per_page, $offset); - - // Now let's get the field names - $fields = $this->CI->db->list_fields($this->current_table); - - // We assume that the column in the first position is the primary field. - $primary = current($fields); - - // Pagination! - $this->CI->pagination->initialize( - array( - 'base_url' => $this->base_url.'/view', - 'total_rows' => $total_rows, - 'per_page' => $per_page, - 'uri_segment' => 4, - 'full_tag_open' => '

', - 'full_tag_close' => '

' - ) - ); - - $data = array( - 'title' => ( ! isset($this->lang['scaff_view'])) ? 'View Data' : $this->lang['scaff_view'], - 'query' => $query, - 'fields' => $fields, - 'primary' => $primary, - 'paginate' => $this->CI->pagination->create_links() - ); - - $this->CI->load->view('view', $data); - } - - // -------------------------------------------------------------------- - - /** - * "Edit" Page - * - * Shows a form representing the currently selected DB - * so that data can be edited - * - * @access public - * @return string the HTML "edit" page - */ - function edit() - { - if (FALSE === ($id = $this->CI->uri->segment(4))) - { - return $this->view(); - } - - // Fetch the primary field name - $primary = $this->CI->db->primary($this->current_table); - - // Run the query - $query = $this->CI->db->get_where($this->current_table, array($primary => $id)); - - $data = array( - 'title' => ( ! isset($this->lang['scaff_edit'])) ? 'Edit Data' : $this->lang['scaff_edit'], - 'fields' => $query->field_data(), - 'query' => $query->row(), - 'action' => $this->base_uri.'/update/'.$this->CI->uri->segment(4) - ); - - $this->CI->load->view('edit', $data); - } - - // -------------------------------------------------------------------- - - /** - * Update - * - * @access public - * @return void redirects to the view page - */ - function update() - { - // Fetch the primary key - $primary = $this->CI->db->primary($this->current_table); - - // Now do the query - $this->CI->db->update($this->current_table, $_POST, array($primary => $this->CI->uri->segment(4))); - - redirect($this->base_uri.'/view/'); - } - - // -------------------------------------------------------------------- - - /** - * Delete Confirmation - * - * @access public - * @return string the HTML "delete confirm" page - */ - function delete() - { - if ( ! isset($this->lang['scaff_del_confirm'])) - { - $message = 'Are you sure you want to delete the following row: '.$this->CI->uri->segment(4); - } - else - { - $message = $this->lang['scaff_del_confirm'].' '.$this->CI->uri->segment(4); - } - - $data = array( - 'title' => ( ! isset($this->lang['scaff_delete'])) ? 'Delete Data' : $this->lang['scaff_delete'], - 'message' => $message, - 'no' => anchor(array($this->base_uri, 'view'), ( ! isset($this->lang['scaff_no'])) ? 'No' : $this->lang['scaff_no']), - 'yes' => anchor(array($this->base_uri, 'do_delete', $this->CI->uri->segment(4)), ( ! isset($this->lang['scaff_yes'])) ? 'Yes' : $this->lang['scaff_yes']) - ); - - $this->CI->load->view('delete', $data); - } - - // -------------------------------------------------------------------- - - /** - * Delete - * - * @access public - * @return void redirects to the view page - */ - function do_delete() - { - // Fetch the primary key - $primary = $this->CI->db->primary($this->current_table); - - // Now do the query - $this->CI->db->where($primary, $this->CI->uri->segment(4)); - $this->CI->db->delete($this->current_table); - - header("Refresh:0;url=".site_url(array($this->base_uri, 'view'))); - exit; - } - -} - -/* End of file Scaffolding.php */ -/* Location: ./system/scaffolding/Scaffolding.php */ \ No newline at end of file diff --git a/system/scaffolding/images/background.jpg b/system/scaffolding/images/background.jpg deleted file mode 100644 index 9d5bdcea1..000000000 Binary files a/system/scaffolding/images/background.jpg and /dev/null differ diff --git a/system/scaffolding/images/index.html b/system/scaffolding/images/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/scaffolding/images/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/system/scaffolding/images/logo.jpg b/system/scaffolding/images/logo.jpg deleted file mode 100644 index d6cc9a76d..000000000 Binary files a/system/scaffolding/images/logo.jpg and /dev/null differ diff --git a/system/scaffolding/index.html b/system/scaffolding/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/scaffolding/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/system/scaffolding/views/add.php b/system/scaffolding/views/add.php deleted file mode 100644 index cbb12f6fb..000000000 --- a/system/scaffolding/views/add.php +++ /dev/null @@ -1,32 +0,0 @@ -load->view('header'); ?> - -

- - - - - - - -primary_key == 1) continue; ?> - - - - - type == 'blob'): ?> - - - - - - - -
name; echo ' '.$field->default; ?>
- - - - - -load->view('footer'); -/* End of file add.php */ -/* Location: ./system/scaffolding/views/add.php */ diff --git a/system/scaffolding/views/delete.php b/system/scaffolding/views/delete.php deleted file mode 100644 index d19542195..000000000 --- a/system/scaffolding/views/delete.php +++ /dev/null @@ -1,9 +0,0 @@ -load->view('header'); ?> - -

- -

  |   - -load->view('footer'); -/* End of file delete.php */ -/* Location: ./system/scaffolding/views/delete.php */ diff --git a/system/scaffolding/views/edit.php b/system/scaffolding/views/edit.php deleted file mode 100644 index fe553e591..000000000 --- a/system/scaffolding/views/edit.php +++ /dev/null @@ -1,33 +0,0 @@ -load->view('header'); ?> - - -

- - - - - - - -primary_key == 1) continue; ?> - - - - - type == 'blob'): ?> - - - - - - - -
name; ?>
- - - - - -load->view('footer'); -/* End of file edit.php */ -/* Location: ./system/scaffolding/views/edit.php */ \ No newline at end of file diff --git a/system/scaffolding/views/footer.php b/system/scaffolding/views/footer.php deleted file mode 100644 index 0e71401c9..000000000 --- a/system/scaffolding/views/footer.php +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/system/scaffolding/views/header.php b/system/scaffolding/views/header.php deleted file mode 100644 index 50f234a49..000000000 --- a/system/scaffolding/views/header.php +++ /dev/null @@ -1,29 +0,0 @@ - - - - -<?php echo $title; ?> - - - - - - - - - - - - -
-
\ No newline at end of file diff --git a/system/scaffolding/views/index.html b/system/scaffolding/views/index.html deleted file mode 100644 index c942a79ce..000000000 --- a/system/scaffolding/views/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - 403 Forbidden - - - -

Directory access is forbidden.

- - - \ No newline at end of file diff --git a/system/scaffolding/views/no_data.php b/system/scaffolding/views/no_data.php deleted file mode 100644 index bc81e7480..000000000 --- a/system/scaffolding/views/no_data.php +++ /dev/null @@ -1,8 +0,0 @@ -load->view('header'); ?> - -

-

- -load->view('footer'); -/* End of file no_data.php */ -/* Location: ./system/scaffolding/views/no_data.php */ \ No newline at end of file diff --git a/system/scaffolding/views/stylesheet.css b/system/scaffolding/views/stylesheet.css deleted file mode 100644 index 3f487dd0b..000000000 --- a/system/scaffolding/views/stylesheet.css +++ /dev/null @@ -1,143 +0,0 @@ -body { - margin: 0; - padding: 0; - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 11px; - color: #4F5155; - background: #fff url(background.jpg) repeat-x left top; -} - -a { - color: #8B0D00; - background-color: transparent; - text-decoration: none; - font-weight: bold; -} - -a:visited { - color: #8B0D00; - background-color: transparent; - text-decoration: none; -} - -a:hover { - color: #000; - text-decoration: none; - background-color: transparent; -} - - -#header { - margin: 0; - padding: 0; -} - -#header_left { - background-color: transparent; - float: left; - padding: 21px 0 0 32px; - margin: 0 -} - -#header_right { - background-color: transparent; - float: right; - text-align: right; - padding: 35px 50px 20px 0; - margin: 0 -} - -#footer { - margin: 20px 0 15px 0; - padding: 0; -} - -#footer p { - font-size: 10px; - color: #999; - text-align: center; -} - -#outer { - margin: 30px 40px 0 40px; -} - -img { - padding:0; - border: 0; - margin: 0; -} - -.nopad { - padding:0; - border: 0; - margin: 0; -} - -table { - background-color: #efefef; -} - -th { - background-color: #eee; - font-weight: bold; - padding: 6px; - text-align: left; -} - -td { - background-color: #fff; - padding: 6px; -} - - -form { - margin: 0; - padding: 0; -} - -.input { - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 11px; - width: 600px; - color: #333; - border: 1px solid #B3B4BD; - font-size: 11px; - height: 2em; - padding: 0; - margin: 0; -} - -.textarea { - font-family: Lucida Grande, Verdana, Geneva, Sans-serif; - font-size: 12px; - width: 600px; - color: #333; - border: 1px solid #B3B4BD; - padding: 0; - margin: 0; -} - -.select { - background-color: #fff; - font-size: 11px; - font-weight: normal; - color: #333; - padding: 0; - margin: 0 0 3px 0; -} - -.checkbox { - background-color: transparent; - padding: 0; - border: 0; -} - -.submit { - background-color: #8B0D00; - color: #FFF; - font-weight: normal; - border: 1px solid #000; - margin: 6px 0 0 0; - padding: 1px 5px 1px 5px; -} diff --git a/system/scaffolding/views/view.php b/system/scaffolding/views/view.php deleted file mode 100644 index a81241d39..000000000 --- a/system/scaffolding/views/view.php +++ /dev/null @@ -1,27 +0,0 @@ -load->view('header'); ?> - - - - - - - - - - -result() as $row): ?> - - - - - - - - -
EditDelete
 $primary), $scaff_edit); ?> $primary), $scaff_delete); ?>$field);?>
- - - -load->view('footer'); -/* End of file view.php */ -/* Location: ./system/scaffolding/views/view.php */ \ No newline at end of file -- cgit v1.2.3-24-g4f1b