Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Nedeľa, 27. november 2022

Súbor: [Platon] / web-apps / task-manager / index.php (stiahnutie)

Revízia 1.2, Wed Nov 16 16:08:49 2005 UTC (17 years ago) by nepto


Zmeny od 1.1: +3 -1 [lines]

Added database disconnect at the end of execution

<?php

/*
 * index.php
 *
 * Developed by Ondrej Jombik <nepto@platon.sk>
 * 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: web-apps/task-manager/index.php,v 1.1 2004/08/19 09:11:41 nepto Exp $ */

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).'&nbsp;MD';
    }
    return $num.'&nbsp;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');
}

$dbh->disconnect();

/* Modeline for ViM {{{
 * vim: set ts=4:
 * vim600: fdm=marker fdl=0 fdc=0:
 * }}} */

?>

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok