Show
Ignore:
Timestamp:
11/30/2007 01:05:23 AM (12 months ago)
Author:
Shadowhand
Message:

Updated Kodoc module.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/kodoc/controllers/kodoc.php

    r1297 r1329  
    11<?php defined('SYSPATH') or die('No direct script access.'); 
    22 
    3 class Kodoc_Controller extends Controller { 
     3class Kodoc_Controller extends Template_Controller { 
    44 
     5        protected $template = 'kodoc/template'; 
     6 
     7        // Kodoc instance 
    58        protected $kodoc; 
     9 
     10        public function __construct() 
     11        { 
     12                parent::__construct(); 
     13 
     14                $active = $this->uri->segment(2) ? $this->uri->segment(2) : 'core'; 
     15 
     16                // Add the menu to the template 
     17                $this->template->menu = new View('kodoc_menu', array('active' => $active)); 
     18        } 
    619 
    720        public function index() 
    821        { 
    9                 print new View('kodoc_menu'); 
     22                $this->template->content = 'hi'; 
     23        } 
     24 
     25        public function media() 
     26        { 
     27                // Get the filename 
     28                $file = implode('/', $this->uri->segment_array(1)); 
     29 
     30                // Disable auto-rendering 
     31                $this->auto_render = FALSE; 
     32 
     33                try 
     34                { 
     35                        // Attempt to display the output 
     36                        echo new View('kodoc/'.$file); 
     37                } 
     38                catch (Kohana_Exception $e) 
     39                { 
     40                        Event::run('system.404'); 
     41                } 
    1042        } 
    1143 
     
    4981                                $file = Kohana::find_file($type, $file); 
    5082                        } 
    51                 } 
    52                 else 
    53                 { 
    54                         // Nothing to document 
    55                         url::redirect('kodoc'); 
     83 
     84                        if (in_array($type, Kodoc::get_types())) 
     85                        { 
     86                                // Load Kodoc 
     87                                $this->kodoc = new Kodoc($type, $file); 
     88 
     89                                // Set the title 
     90                                $this->template->title = implode('/', $this->uri->segment_array(1)); 
     91 
     92                                // Load documentation for this file 
     93                                $this->template->content = new View('kodoc_html'); 
     94 
     95                                // Exit this method 
     96                                return; 
     97                        } 
    5698                } 
    5799 
    58                 if (in_array($type, Kodoc::get_types())); 
    59                 { 
    60                         $this->kodoc = new Kodoc($type, $file); 
    61  
    62                         $content = new View('kodoc_html'); 
    63  
    64                         print $content; 
    65                 } 
    66  
    67                 print Kohana::lang('core.stats_footer'); 
     100                // Nothing to document 
     101                url::redirect('kodoc'); 
    68102        } 
    69103 
    70 } 
     104} // End Kodoc Controller