PHP Classes

File: examples/cms/app/admin/controllers/admin.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   examples/cms/app/admin/controllers/admin.php   Download  
File: examples/cms/app/admin/controllers/admin.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Skeleton Framework
Extensive Web application development framework
Author: By
Last change:
Date: 8 years ago
Size: 2,025 bytes
 

Contents

Class file image Download
<?php

class admin extends A_Controller_Action {

    function
__construct($locator) {
       
parent::__construct($locator);
       
$this->usersession = $locator->get('UserSession');
       
$this->userdata = $this->usersession->get();
    }

   
/*
     * This function is called only if it exists. Front Controller pre-filter
     * calls it to get required groups for this controller
     */
   
public function _requireGroups(){
        return array(
'post','admin');
    }
   
/*
    // These are examples of Access Control done in the Action Controller
    // where the method called by the pre-filter acts as a forward

    public function denyAccess($locator){ //dump($this);
        // Start Sessions
        $Session = $locator->get('Session');
        $Session->start();
    // $UserSession = $locator->get('UserSession');dump($UserSession);
    // $Session = new A_Session();
    // $Session->start();
        $UserSession = new A_User_Session($Session);dump($UserSession);
        //$Session = $this->locator->get('Session');
        //$Session->start();
        //$UserSession = $this->locator->get('UserSession');
       
    // $UserSession->addRule(new A_User_Rule_Isloggedin());
    // $UserSession->addRule(new A_User_Rule_Ingroup('admin'));
        if($UserSession->isLoggedIn()) {
            // do somthint
        } else {
            echo 'user is not signed in';
        }
   
    // if($UserSession->isLoggedIn()){
    // echo 'user is signed in';
    // } else {
    // echo 'user is not signed in';
    // }
    }

    function denyAccess($locator) {

        if (! $this->usersession->isLoggedIn()) {

        // return $this->forward('','login','');
            $this->response->setRedirect('/');
        }
    }
*/
   
function index($locator) {
       
$content = 'This is the content for the admin section';
       
$subcontent = 'The sidebar of the admin section';
       
       
$template = $this->_load()->template('admin');
# $template->set('BASE', 'http://skeleton/examples/blog/' ); // $ConfigArray['BASE'] TODO: Fix this BASE/config mess
# $template->set('maincontent', $content);
# $template->set('subcontent', $subcontent);
       
       
$this->response->set('maincontent', $template->render());

    }

}