It looks like you're new here. If you want to get involved, click one of these buttons!
CREATE TABLE IF NOT EXISTS `projects` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(150) NOT NULL,
`description` text NOT NULL,
`manager_id` int(5) NOT NULL,
`start_date` datetime NOT NULL COMMENT 'Enter the date on which the project is supposed to begin.',
`due_date` datetime NOT NULL COMMENT 'Enter the date on which the project is due.',
`end_date` datetime NOT NULL COMMENT 'Enter the date on which the project was completed.',
`notes` text NOT NULL COMMENT 'Enter notes. Can be used as a project diary.',
`active` enum('yes','no') NOT NULL DEFAULT 'no',
`completed` enum('yes','no') NOT NULL DEFAULT 'no',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
require_once(FUEL_PATH.'models/base_module_model.php');
class Projects_model extends Base_module_model {
public $required = array('title');
//public $foreign_keys = array('manager_id' => 'cms_users_model');
function __construct()
{
parent::__construct('projects'); //table
}
function list_items($limit = NULL, $offset = NULL, $col = 'due_date', $order = 'asc')
{
$this->db->join('fuel_users', 'projects.manager_id = fuel_users.id', 'left');
$this->db->select('projects.id, projects.title as project_title, DATE_FORMAT(projects.due_date,"%m/%d/%Y") as due_date, fuel_users.user_name as assigned_to, projects.active, projects.completed', FALSE);
$data = parent::list_items($limit, $offset, $col, $order);
return $data;
}
}
110308 11:24:49 31 Init DB intrajasent
31 Query SET NAMES 'utf8' COLLATE 'utf8_general_ci'
31 Query SHOW COLUMNS FROM `projects`
31 Query SELECT projects.id, projects.title as project_title, DATE_FORMAT(projects.due_date, "%m/%d/%Y") as due_date, fuel_users.user_name as assigned_to, projects.active, projects.completed
FROM (projects)
LEFT JOIN `fuel_users` ON `projects`.`manager_id` = `fuel_users`.`id`
ORDER BY due_date asc
21 Init DB intrajasent
21 Query SET NAMES 'utf8' COLLATE 'utf8_general_ci'
21 Query SHOW COLUMNS FROM `projects`
21 Query SELECT projects.id, projects.title as project_title, DATE_FORMAT(projects.due_date, "%m/%d/%Y") as due_date, fuel_users.user_name as assigned_to, projects.active, projects.completed
FROM (projects)
LEFT JOIN `fuel_users` ON `projects`.`manager_id` = `fuel_users`.`id`
ORDER BY due_date asc
21 Query SELECT projects.id, projects.title as project_title, DATE_FORMAT(projects.due_date, "%m/%d/%Y") as due_date, fuel_users.user_name as assigned_to, projects.active, projects.completed
FROM (projects)
LEFT JOIN fuel_users ON projects.manager_id = fuel_users.id
ORDER BY name asc
LIMIT 25
21 Query ROLLBACK
21 Query SET AUTOCOMMIT=1
function list_items($limit = NULL, $offset = NULL, $col = 'tasks.due_date', $order = 'asc')
{
$this->db->join('projects', 'projects.id = tasks.project_id', 'left');
$this->db->select('tasks.id, DATE_FORMAT(tasks.due_date,"%m/%d/%Y") as due_date, projects.title as project_title, tasks.name as task_name, tasks.completed', FALSE);
$data = parent::list_items($limit, $offset, $col, $order);
return $data;
}
110308 11:45:24 39 Init DB intrajasent
39 Query SET NAMES 'utf8' COLLATE 'utf8_general_ci'
39 Query SHOW COLUMNS FROM `tasks`
39 Query SELECT tasks.id, DATE_FORMAT(tasks.due_date, "%m/%d/%Y") as due_date, projects.title as project_title, tasks.name as task_name, tasks.completed
FROM (tasks)
LEFT JOIN `projects` ON `projects`.`id` = `tasks`.`project_id`
ORDER BY tasks.due_date asc
110308 11:45:25 27 Init DB intrajasent
27 Query SET NAMES 'utf8' COLLATE 'utf8_general_ci'
27 Query SHOW COLUMNS FROM `tasks`
27 Query SELECT tasks.id, DATE_FORMAT(tasks.due_date, "%m/%d/%Y") as due_date, projects.title as project_title, tasks.name as task_name, tasks.completed
FROM (tasks)
LEFT JOIN `projects` ON `projects`.`id` = `tasks`.`project_id`
ORDER BY tasks.due_date asc
27 Query SELECT tasks.id, DATE_FORMAT(tasks.due_date, "%m/%d/%Y") as due_date, projects.title as project_title, tasks.name as task_name, tasks.completed
FROM (tasks)
LEFT JOIN projects ON projects.id = tasks.project_id
ORDER BY name asc
LIMIT 25
Comments
Do you have a default_col property set for your module in your fuel/application/config/MY_fuel_modules.php file? Also, you may need to try logging out then back in because FUEL will save page state in a session including sorting parameters.
http://www.getfuelcms.com/user_guide/modules/simple
$config['modules']['projects'] = array( 'module_name' => 'Projects', 'model_name' => 'projects_model', 'default_col' => 'due_date', 'instructions' => 'Here you can manage your projects.' );
https://help.github.com/articles/using-pull-requests
The 1.0 User Guide repo:
https://github.com/daylightstudio/FUEL-CMS-User-Guide-Module