Subversion-Projekte lars-tiefland.content-management

Revision

Blame | Letzte Änderung | Log anzeigen | RSS feed

<?php

    /**
     * @package   Content-management
     * @author    Lars Tiefland <tiefland@weban.de>
     * @copyright 2010 Webagentur Niewerth
     * @license   propietary http://www.weban.de
     * @version   $Rev: 3931 $
     * @filesource
     * 
     */

    /**
     * 
     * @package   Content-management
     * @author    Lars Tiefland <tiefland@weban.de>
     * @copyright 2010 Webagentur Niewerth
     */

    // SVN: $Id: logbuch.php 3931 2011-09-16 08:17:57Z tiefland $

    define( "Range", 100 );

    require_once "common.php";
    require_once "smarty/libs/SmartyPaginate.class.php";
    require_once "includes/pagination.php";

    $daten = array();

    $filter = array( "mode" => array( "filter" => FILTER_CALLBACK, "options" =>
        "check_mode" ), "id" => FILTER_SANITIZE_NUMBER_INT, );
    $out = filter_input_array( INPUT_GET, $filter );

    $mode = $out["mode"];
    $id = $out["id"];

    $rufname = $mode;

    $sql = "SELECT SQL_CALC_FOUND_ROWS
            lb.*,
            lba.name AS art,
            a.user
        FROM
            logbuch lb
        JOIN
            logbuch_arten lba
        ON
            lba.ID=lb.art
        JOIN
            content_management.Access AS a
        ON
            a.ID=lb.user
        WHERE
            rufname='$rufname'
        AND
            lb.vorgang=$id
        ORDER BY
            datum DESC
        LIMIT 
        " . SmartyPaginate::getcurrentIndex() . ", " . Range . "
    ";
    switch ( $mode )
    {
        case "bestellung":
            $skript = "/Warenwirtschaft/bestellungen.php";
            $param = "Bestellung";
            break;
        case "artikel":
            $skript = "/Online-Shop/artikel.php";
            $param = "action=edit&ID";
            break;
        case "directory":
            $skript = "/Online-Shop/directory.php";
            $param = "action=edit&ID";
            break;
        default:
            $sql = "SELECT SQL_CALC_FOUND_ROWS
                    lb.*,
                    lba.name AS art,
                    lba.rufname,
                    a.user
                FROM
                    logbuch lb
                JOIN
                    logbuch_arten lba
                ON
                    lba.ID=lb.art
                JOIN
                    content_management.Access AS a
                ON
                    a.ID=lb.user
                ORDER BY
                    datum DESC
                LIMIT 
                " . SmartyPaginate::getcurrentIndex() . ", " . Range . "
            ";
            break;
    }
    $res = mysql_query( $sql );
    $sql_2 = "SELECT
            FOUND_ROWS() AS total
    ";
    $res_2 = mysql_query( $sql_2 );
    $row_2 = mysql_fetch_assoc( $res_2 );
    $total = $row_2["total"];
    pagination( $total );
    while ( $row = mysql_fetch_assoc( $res ) )
    {
        if ( isset( $row["rufname"] ) )
        {
            switch ( $row["rufname"] )
            {
                case "bestellung":
                    $row["skript"] = "/Warenwirtschaft/bestellungen.php";
                    $row["param"] = "Bestellung";
                    break;
                case "artikel":
                    $row["skript"] = "/Online-Shop/artikel.php";
                    $row["param"] = "action=edit&ID";
                    break;
                case "directory":
                    $row["skript"] = "/Online-Shop/directory.php";
                    $row["param"] = "action=edit&ID";
                    break;
            }
        }
        else
        {
            $row["skript"] = $script;
            $row["param"] = $param;
        }
        $daten[] = $row;
    }
    $GLOBALS["ui"]->assign( "daten", $daten );
    if ( $mode )
    {
        $GLOBALS["ui"]->display( "common/logbuch.tpl" );
    }
    else
    {
        $GLOBALS["ui"]->assign( "file", "common/logbuch.tpl" );
        $GLOBALS["ui"]->display( "common/page.tpl" );
    }
    function check_mode()
    {
        $modes = array( "bestellung", "directory", "artikel", "" );
        if ( in_array( $_GET["mode"], $modes ) )
        {
            return $_GET["mode"];
        }
        else
        {
            return null;
        }
    } ?>