Admin
[ class tree: Admin ] [ index: Admin ] [ all elements ]

Source for file UserView.php

Documentation is available at UserView.php

  1. <?php
  2. /**
  3. * DotBoost Technologies Inc.
  4. * DotKernel Application Framework
  5. *
  6. @category   DotKernel
  7. @package    Admin
  8. @copyright  Copyright (c) 2009 DotBoost  Technologies (http://www.dotboost.com)
  9. @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
  10. @version    $Id: UserView.php 165 2010-07-02 07:25:12Z teo $
  11. */
  12.  
  13. /**
  14. * User View Class
  15. * class that prepare output related to User controller
  16. @category   DotKernel
  17. @package    Admin
  18. @author     DotKernel Team <team@dotkernel.com>
  19. */
  20.  
  21. class User_View extends View
  22. {
  23.     /**
  24.      * Constructor
  25.      * @access public
  26.      * @param Dot_Template $tpl 
  27.      */
  28.     public function __construct($tpl)
  29.     {
  30.         $this->tpl $tpl;
  31.     }
  32.     /**
  33.      * List users
  34.      * @access public
  35.      * @param string $templateFile 
  36.      * @param array $list 
  37.      * @param int $page 
  38.      * @param bool $ajax - Using ajax, parse only the list content
  39.      * @return void 
  40.      */
  41.     public function listUser($templateFile$list$page$ajax false)
  42.     {
  43.         $this->tpl->setFile('tpl_main''user/' $templateFile '.tpl');
  44.         $this->tpl->setBlock('tpl_main''list''list_block');
  45.         $this->tpl->paginator($list['paginatorAdapter'],$page);
  46.         $this->tpl->setVar('PAGE'$page);
  47.         $this->tpl->setVar('ACTIVE_URL''/admin/user/activate/');
  48.         foreach ($list['data'as $k => $v)
  49.         {
  50.             $this->tpl->setVar('BG'$k%2+1);
  51.             $this->tpl->setVar('ID'$v['id']);
  52.             $this->tpl->setVar('USERNAME'$v['username']);
  53.             $this->tpl->setVar('EMAIL'$v['email']);
  54.             $this->tpl->setVar('FIRSTNAME'$v['firstName']);
  55.             $this->tpl->setVar('LASTNAME'$v['lastName']);
  56.             $this->tpl->setVar('DATE_CREATED'Dot_Kernel::timeFormat($v['dateCreated']'long'));
  57.             $this->tpl->setVar('ISACTIVE'$v['isActive']*(-1)+1);
  58.             $this->tpl->setVar('ACTIVE_IMG'$v['isActive'== 'active' 'inactive');
  59.             $this->tpl->parse('list_block''list'true);
  60.         }
  61.         if($ajax)
  62.         {
  63.             $this->tpl->pparse('AJAX''tpl_main');exit;
  64.         }
  65.     }
  66.     /**
  67.      * Display user details. It is used for add and update actions
  68.      * @access public
  69.      * @param string $templateFile 
  70.      * @param array $data [optional]
  71.      * @return void 
  72.      */
  73.     public function details($templateFile$data=array())
  74.     {
  75.         $this->tpl->setFile('tpl_main''user/' $templateFile '.tpl');
  76.         $this->tpl->setVar('ACTIVE_1''checked');        
  77.         foreach ($data as $k=>$v)
  78.         {
  79.             $this->tpl->setVar(strtoupper($k)$v);            
  80.             if('isActive' == $k)
  81.             {
  82.                 $this->tpl->setVar('ACTIVE_'.$v'checked');
  83.                 $this->tpl->setVar('ACTIVE_'.$v*(-1)+1'');
  84.             }
  85.         }
  86.     }
  87.     /**
  88.      * Display user logins list
  89.      * @access public
  90.      * @param string $templateFile 
  91.      * @param array $list 
  92.      * @param int $page 
  93.      * @return void 
  94.      */
  95.     public function loginsUser($templateFile$list$page)
  96.     {
  97.         $dotGeoip new Dot_Geoip();
  98.         $this->tpl->setFile('tpl_main''user/' $templateFile '.tpl');
  99.         $this->tpl->setBlock('tpl_main''list''list_block');
  100.         $this->tpl->paginator($list['paginatorAdapter'],$page);
  101.         $this->tpl->setVar('PAGE'$page);
  102.         foreach ($list['data'as $k => $v)
  103.         {
  104.             $country $dotGeoip->getCountryByIp($v['ip']);
  105.             $this->tpl->setVar('BG'$k%2+1);
  106.             $this->tpl->setVar('ID'$k+1);
  107.             $this->tpl->setVar('USERID'$v['userId']);
  108.             $this->tpl->setVar('USERNAME'$v['username']);
  109.             $this->tpl->setVar('IP'$v['ip']);
  110.             $this->tpl->setVar('COUNTRYIMAGE'strtolower($country[0]));
  111.             $this->tpl->setVar('COUNTRYNAME'$country[1]);
  112.             $this->tpl->setVar('REFERER'$v['referer']);
  113.             $this->tpl->setVar('USERAGENT'$v['userAgent']);
  114.             $this->tpl->setVar('BROWSERIMAGE'Dot_Kernel::getBrowserIcon($v['userAgent']));
  115.             $os Dot_Kernel::getOsIcon($v['userAgent']);            
  116.             $this->tpl->setVar('OSIMAGE'$os['icon']);
  117.             $this->tpl->setVar('OSMAJOR'$os['major']);
  118.             $this->tpl->setVar('OSMINOR'$os['minor']);
  119.             $this->tpl->setVar('DATELOGIN'Dot_Kernel::timeFormat($v['dateLogin']'long'));
  120.             $this->tpl->parse('list_block''list'true);
  121.         }
  122.     }
  123. }

Documentation generated on Wed, 21 Jul 2010 07:34:47 +0000 by phpDocumentor 1.4.3