* Copyright (c) 2004 Platon SDG, http://platon.sk/ * Licensed under terms of GNU General Public License. * All rights reserved. * * Changelog: * 2004-06-19 - created * */ /* $Platon$ */ require_once 'Smarty/Smarty.class.php'; require_once 'DB.php'; require_once 'config.inc.php'; require_once 'modules/User.php'; require_once 'modules/Customer.php'; require_once 'modules/Project.php'; require_once 'modules/Task.php'; function smarty_modifier_work_mh_md($num) /* {{{ */ { $num = intval($num); if ($num >= 8) { return round($num / 8).' MD'; } return $num.' MH'; } /* }}} */ // Smarty object initialization $smarty = new Smarty; $smarty->compile_check = true; $smarty->debugging = true; $smarty->caching = false; $smarty->register_modifier('work_mh_md', 'smarty_modifier_work_mh_md'); // PEAR:DB object initialization $dbh = DB::connect($cfg['dsn']); $dbh->setFetchMode(DB_FETCHMODE_ASSOC); if ($_REQUEST['action'] == 'user_list') { $smarty->assign('users', User::getListExtended()); $smarty->display('user_list.tpl'); } else if ($_REQUEST['action'] == 'customer_list') { $smarty->assign('customers', Customer::getListExtended()); $smarty->display('customer_list.tpl'); } else if ($_REQUEST['action'] == 'project_list') { $smarty->assign('projects', Project::getListExtended()); $smarty->display('project_list.tpl'); } else if ($_REQUEST['action'] == 'project_view') { $project_id = intval($_REQUEST['id']); $tasks = Task::getCategorizedList($project_id); $smarty->assign('tasks_done', $tasks['done']); $smarty->assign('tasks_scheduled', $tasks['scheduled']); $smarty->assign('tasks_processed', $tasks['processed']); $smarty->assign('project', Project::getExtended($project_id)); $smarty->display('project_view.tpl'); } else if ($_REQUEST['action'] == 'task_view') { $task_id = intval($_REQUEST['id']); $smarty->assign('task', Task::get($task_id)); $smarty->display('task_view.tpl'); } else { $smarty->display('welcome.tpl'); } /* Modeline for ViM {{{ * vim: set ts=4: * vim600: fdm=marker fdl=0 fdc=0: * }}} */ ?>