Subversion-Projekte lars-tiefland.ci

Revision

Revision 914 | Revision 916 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

class Scheduler extends CI_Controller
{
        public function __construct()
        {
                parent::__construct();
        }
        public function index()
        {
                $tasks = array();
                $sql = "SELECT
                                id,
                                name,
                                art,
                                skript,
                                parameter,
                                intervall,
                                user
                        FROM
                                schnittstellen
                        WHERE
                                nutzungsart IN ('dual','automatisch')
                        AND
                                user!=''
                        ORDER BY
                                user
                ";
                $res = $this->db->query($sql);
                while ($row = $res->unbuffered_row('array'))
                {
                        $tasks[] = $row;
                }
                $this->smarty->assign("tasks", $tasks);
                $this->smarty->view('scheduler.tpl');
        }

        public function edit($id = null)
        {
        $rep_hours[0] = "exakt";
        $rep_hours[1] = "jede Stunde";
        $hours[0] = 0;
        $hours[1] = 1;
        for ( $i = 2; $i <= 23; $i++ )
        {
            $hours[$i] = $i;
            $rep_hours[$i] = "Alle " . $i . " Stunden";
        }
        $rep_min[0] = "exakt";
        $rep_min[1] = "jede Minute";
        for ( $i = 2; $i <= 30; $i++ )
        {
            $rep_min[$i] = "Alle " . $i . " Minuten";
        }
        for ( $i = 0; $i <= 59; $i++ )
        {
            $minutes[$i] = $i;
        }
        $nutzungsarten = array(
            "" => "",
            "dual" => "dual",
            "automatisch" => "automatisch",
            );
        $tage = array(
            "Sonntag",
            "Montag",
            "Dienstag",
            "Mittwoch",
            "Donnerstag",
            "Freitag",
            "Samstag",
            );
        for ( $i = 1; $i <= 12; $i++ )
        {
            $mon = sprintf( "%02d", $i );
            $datum = "01." . $mon . "." . date( "Y" );
            $monate[$i] = strftime( "%B", strtotime( $datum ) );
        }
        $dom = array();
        for ( $i = 1; $i <= 31; $i++ )
        {
            $day = sprintf( "%02d", $i );
            $dom[$i] = $i;
        }
        $this->smarty->assign( "task", $task );
        $this->smarty->assign( "monate", $monate );
        $this->smarty->assign( "tage", $tage );
        $this->smarty->assign( "dom", $dom );
        $this->smarty->assign( "nutzungsarten", $nutzungsarten );
        $this->smarty->assign( "minutes", $minutes );
        $this->smarty->assign( "rep_min", $rep_min );
        $this->smarty->assign( "rep_hours", $rep_hours );
        $this->smarty->assign( "hours", $hours );
                $this->smarty->view('scheduler_edit.tpl');
        }
}