<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap {
    protected function _initAutoload() {
        $moduleLoader = new Zend_application_Module_Autoloader(
                array(
                        'namespace' => 'Todojsc',
                        'basePath' => APPLICATION_PATH.'/modules/Todojsc',
                        'resourceTypes' => array
                        (
                                'form' => array
                                (
                                        'path' => 'forms',
                                        'namespace' => 'Form',
                                ),
                                'resource' => array
                                (
                                        'path' => 'resources',
                                        'namespace' => 'Resource',
                                ),
                                'model' => array
                                (
                                        'path' => 'models',
                                        'namespace' => 'Model',
                                ),
                                'acl' => array
                                (
                                        'path' => 'acl',
                                        'namespace' => 'Acl',
                                )
                        )
                )
        );
        return $moduleLoader;
    }

    protected function _initViewHelpers() {
        $this->bootstrap('layout');
        $layout = $this->getResource('layout');
        $view = $layout->getView();
        $view->doctype('XHTML1_STRICT');
        $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
        $view->headTitle()->setSeparator(' - ');
        $view->headTitle(' Todojsc');

        // DOJO - Enable dojo and set approptiate stuff
        // We keep dojo disabled system wide, but it's ready to b e used.
        // When needed it is just needed to call $this->dojo()->enable() in the view
        // and be sure to have the dojo output line in the layout.
        Zend_Dojo::enableView($view);
        //Zend_Dojo_View_Helper_Dojo::setUseDeclarative ();
        $view->dojo()->setLocalPath('/js/dojo/dojo.js')
                //->setDjConfigOption ( 'usePlainJson', true )
                ->setDjConfigOption ( 'parseOnLoad', true )
//                ->setDjConfigOption ( 'debugAtAllCosts', true )
                ->addStyleSheetModule('dijit.themes.tundra')
                ->registerModulePath("todojscX","../todojscX"); // maybe this is unneeded
        $view->dojo()->disable();  // We enable dojo ONLY in the the views that need it
                                   // so each view that need dojo will have dojo->enable()
        $view->addHelperPath('Zend/Dojo/View/Helper', 'Zend_Dojo_View_Helper');
    }
}

