Created
February 2, 2009 16:24
-
-
Save kodi/56961 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class user_shop extends DPLS_Controller{ | |
function __construct(){ | |
global $_user; | |
$this->_user=$_user; | |
global $db; | |
$this->db=$db; | |
} | |
public function defaultAction(){ | |
// GET SEGMENT (subdomain that corespond to store owners username) | |
$this->_segment=$this->_req->_segment; | |
// CHECK IS CURRENT USER STORE ADMINISTRATOR | |
$this->_user->isStoreAdmin=false; | |
if($this->_segment==$this->_user->username){ | |
$this->_user->isStoreAdmin=true; | |
} | |
// GET BASIC STORE INFO | |
$store=new Store($this->db); | |
$storeInfo=$store->getByUsername($this->_segment); | |
//GET PRODUCTS FROM STORE | |
$products=$store->getProducts($this->_segment); | |
// PASS VARIABLES TO TEMPLATE | |
$template= new DPLS_Template(); | |
$template->assign('store',$storeInfo); | |
$template->assign('user',$this->_user); | |
// RENDER TEMPLATE | |
$template->show('user_shop'); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment