Skip to content
Browse files

revamped admin controller and eliminated sliders section, settings se…

…ction is now the one and only. bumped version numbers in readme and details. added a get_settings() method to slider model
  • Loading branch information...
1 parent e3a42fa commit 2c480512f909ed30ac9104339d271de50d6286ad @rpnzl committed May 8, 2012
Showing with 23 additions and 35 deletions.
  1. +1 −1 README.md
  2. +13 −31 controllers/admin.php
  3. +1 −1 details.php
  4. +7 −1 models/slider_m.php
  5. +1 −1 views/admin/index.php
View
2 README.md
@@ -3,7 +3,7 @@
* Author: Michael Giuliana
* Twitter: [@rpnzldesign](http://www.twitter.com/rpnzl)
* Website: [http://rpnzl.com/](http://rpnzl.com/)
-* Version: 1.0.2
+* Version: 1.1
## To Do
* Can have multiple sliders on a single page, but not multiple instances of *the same* slider. Could be remedied by altering the display id.
View
44 controllers/admin.php
@@ -30,39 +30,23 @@ class Admin extends Admin_Controller {
);
- /**
- * Constructor method
- *
- * Loads the form_validation library, the pages, pages layout
- * and navigation models along with the language for the pages
- * module.
- */
public function __construct()
{
parent::__construct();
- // Load the required classes
- $this->load->model(array(
- 'slider_m',
- 'files/file_folders_m',
- ));
+ // load classes, libs, language
$this->lang->load('sliders');
-
- // Load the validation library
$this->load->library('form_validation');
+ $this->load->model(array('slider_m', 'files/file_folders_m',));
- // Set the validation rules
+ // set validation rules
$this->form_validation->set_rules($this->_validation_rules);
- $this->template
- ->title($this->module_details['name']);
+ // template settings
+ $this->template->title($this->module_details['name']);
}
-
- /**
- * Index method
- */
public function index()
{
// If val is run
@@ -71,7 +55,7 @@ public function index()
// Get posted vars
$id = $this->input->post('id');
$props = array(
- 'jquery' => $this->input->post('jquery'),
+ 'jquery' => $this->input->post('jquery'),
'folder_id' => $this->input->post('folder_id'),
);
@@ -84,9 +68,7 @@ public function index()
$this->session->set_flashdata('error', 'Settings updated failed.');
}
- $this->input->post('btnAction') == 'save_exit' ?
- redirect('admin/sliders') :
- redirect('admin/sliders');
+ redirect('admin/sliders');
}
// Loop through each validation rule
@@ -95,17 +77,17 @@ public function index()
$slider_m->{$rule['field']} = set_value($rule['field']);
}
- $settings = $this->slider_m->get_all();
- $settings = $settings[0];
- $folders = $this->file_folders_m->get_all();
+ // Get folders for dropdown
+ $folders = $this->file_folders_m->get_all();
foreach($folders as $folder)
{
- $folder_opts[$folder->id] = $folder->name;
+ $select_folders[$folder->id] = $folder->name;
}
+ // set template vars and build
$this->template
- ->set('settings', $settings)
- ->set('folders', $folder_opts)
+ ->set('settings', $this->slider_m->get_settings())
+ ->set('folders', $select_folders)
->build('admin/index');
}
}
View
2 details.php
@@ -7,7 +7,7 @@
*/
class Module_Sliders extends Module {
- public $version = '1.0.2';
+ public $version = '1.1';
public function info()
{
View
8 models/slider_m.php
@@ -7,5 +7,11 @@
*/
class Slider_m extends MY_Model
{
- // stuff
+ public function get_settings()
+ {
+ $settings = parent::get_all();
+ $settings = $settings[0];
+
+ return $settings;
+ }
}
View
2 views/admin/index.php
@@ -16,7 +16,7 @@
<li class="<?php echo alternator('even', ''); ?>">
<label for="jquery"><?php echo lang('sliders.jquery_label');?></label>
- <?php echo form_dropdown('jquery', array(1 => 'Yes', 2 => 'No'), $settings->jquery); ?>
+ <?php echo form_dropdown('jquery', array(1 => 'Yes', 0 => 'No'), $settings->jquery); ?>
</li>
</ul>
</fieldset>

0 comments on commit 2c48051

Please sign in to comment.
Something went wrong with that request. Please try again.