[eluser]xtremer360[/eluser]
I'm using the HMVC module separator plugin by wiredesignz and wanted to know why i keep getting an invalid argument supplied in my controller.
Controller Dashboard (found in normal controllers folder inside of application)
Code:
$categoriesDB = $this->news->getNewsCategories($this->data['userData']->usersRolesID);
print_r($categoriesDB);
$categories = array();
foreach ($categoriesDB AS $category)
{
$category[$category->id] = $category->categoryName;
}
$this->data['categories'] = $categories;
News library (found in application/modules/news/libraries/news.php)
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* News Library
*
* News Library for Code Igniter
*
* @package KOW Manager
* @author Jeffrey Davidson
* @version 1.0.0
* @copyright 2012
*/
class News
{
function __construct()
{
//assign the CI superglobal to $CI
$this->ci =& get_instance();
$this->ci->load->model('news/news');
}
/**
* Get roster list
*
* @param integer
* @return object/NULL
*/
function getNewsCategories($usersRolesID)
{
// Check args
if(!is_numeric($usersRolesID)) { throw new Exception('Non-numeric $usersRolesID provided to getNewsCategories()'); }
if (($usersRolesID == 3) || ($usersRolesID == 4) || ($usersRolesID == 5))
{
return $this->ci->news->getNewsCategories(2);
}
else
{
return $this->ci->news->getNewsCategories(1);
}
}
}
News Model (found in application/modules/news/models/news.php)
Code:
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* News
*
* This model represents user authentication data.
*
* @package KOW Manager
* @author Jeffrey Davidson
* @version 1.0.0
* @copyright 2012
*/
class News extends CI_Model
{
function __construct()
{
parent::__construct();
}
/**
* Get list of categories
*
* @param integer
* @return object/NULL
*/
function getNewsCategories($permissionID)
{
// Check args
if (!is_numeric($permissionID)) { throw new Exception('Non-numeric $permissionID provided to getNewsCategories()'); }
$this->db->select('id');
$this->db->select('categoryName');
$this->db->from('siteNewsCategories');
$this->db->where('newsPermissionsID', $permissionID);
$this->db->order_by('categoryName');
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->result();
}
return null;
}
}