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

Source for file AdminView.php

Documentation is available at AdminView.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: AdminView.php 165 2010-07-02 07:25:12Z teo $
  11. */
  12.  
  13. /**
  14. * Admin 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 Admin_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.         $this->settings Zend_Registry::get('settings');
  32.     }
  33.     /**
  34.      * Display the login form
  35.      * @access public
  36.      * @param string $templateFile 
  37.      * @return void 
  38.      */
  39.     public function loginForm($templateFile)
  40.     {
  41.         $this->tpl->setFile('tpl_main''admin/' $templateFile '.tpl');    
  42.     }
  43.     /**
  44.      * List the admin users
  45.      * @access public
  46.      * @param string $templateFile 
  47.      * @param array $list 
  48.      * @param int $page 
  49.      * @param bool $ajax - Using ajax, parse only the list content
  50.      * @return void 
  51.      */
  52.     public function listUser($templateFile$list$page$ajax false)
  53.     {
  54.         $this->tpl->setFile('tpl_main''admin/' $templateFile '.tpl');
  55.         $this->tpl->setBlock('tpl_main''list''list_block');
  56.         $this->tpl->paginator($list['paginatorAdapter'],$page);
  57.         $this->tpl->setVar('PAGE'$page);
  58.         $this->tpl->setVar('ACTIVE_URL''/admin/admin/activate/');
  59.         foreach ($list['data'as $k => $v)
  60.         {
  61.             $this->tpl->setVar('BG'$k%2+1);
  62.             $this->tpl->setVar('ID'$v['id']);
  63.             $this->tpl->setVar('USERNAME'$v['username']);
  64.             $this->tpl->setVar('EMAIL'$v['email']);
  65.             $this->tpl->setVar('FIRSTNAME'$v['firstName']);
  66.             $this->tpl->setVar('LASTNAME'$v['lastName']);
  67.             $this->tpl->setVar('DATE_CREATED'Dot_Kernel::timeFormat($v['dateCreated']'long'));
  68.             $this->tpl->setVar('ISACTIVE'$v['isActive']*(-1)+1);
  69.             $this->tpl->setVar('ACTIVE_IMG'$v['isActive'== 'active' 'inactive');
  70.             $this->tpl->parse('list_block''list'true);
  71.         }
  72.         if($ajax)
  73.         {
  74.             $this->tpl->pparse('AJAX''tpl_main');exit;
  75.         }
  76.     }
  77.     /**
  78.      * Display admin user details. It is used for add and update actions
  79.      * @access public
  80.      * @param string $templateFile 
  81.      * @param array $data [optional]
  82.      * @return void 
  83.      */
  84.     public function details($templateFile$data=array())
  85.     {
  86.         $this->tpl->setFile('tpl_main''admin/' $templateFile '.tpl');
  87.         $this->tpl->setVar('ACTIVE_1''checked');        
  88.         foreach ($data as $k=>$v)
  89.         {
  90.             $this->tpl->setVar(strtoupper($k)$v);            
  91.             if('isActive' == $k)
  92.             {
  93.                 $this->tpl->setVar('ACTIVE_'.$v'checked');
  94.                 $this->tpl->setVar('ACTIVE_'.$v*(-1)+1'');
  95.             }
  96.         }
  97.         //empty because password is encrypted with md5
  98.         $this->tpl->setVar('PASSWORD''');
  99.     }
  100.     /**
  101.      * Display user logins list
  102.      * @access public
  103.      * @param string $templateFile 
  104.      * @param array $list 
  105.      * @param int $page 
  106.      * @return void 
  107.      */
  108.     public function loginsUser($templateFile$list$page)
  109.     {
  110.         $dotGeoip new Dot_Geoip();
  111.         $this->tpl->setFile('tpl_main''admin/' $templateFile '.tpl');
  112.         $this->tpl->setBlock('tpl_main''list''list_block');
  113.         $this->tpl->paginator($list['paginatorAdapter'],$page);
  114.         $this->tpl->setVar('PAGE'$page);
  115.         foreach ($list['data'as $k => $v)
  116.         {
  117.             $country $dotGeoip->getCountryByIp($v['ip']);
  118.             $this->tpl->setVar('BG'$k%2+1);
  119.             $this->tpl->setVar('ID'$k+1);
  120.             $this->tpl->setVar('ADMINID'$v['adminId']);
  121.             $this->tpl->setVar('USERNAME'$v['username']);
  122.             $this->tpl->setVar('IP'$v['ip']);
  123.             $this->tpl->setVar('COUNTRYIMAGE'strtolower($country[0]));
  124.             $this->tpl->setVar('COUNTRYNAME'$country[1]);
  125.             $this->tpl->setVar('REFERER'$v['referer']);
  126.             $this->tpl->setVar('WHOISURL'$this->settings->whoisUrl);
  127.             $this->tpl->setVar('USERAGENT'$v['userAgent']);
  128.             $this->tpl->setVar('BROWSERIMAGE'Dot_Kernel::getBrowserIcon($v['userAgent']));
  129.             $os Dot_Kernel::getOsIcon($v['userAgent']);
  130.             $this->tpl->setVar('OSIMAGE'$os['icon']);
  131.             $this->tpl->setVar('OSMAJOR'$os['major']);
  132.             $this->tpl->setVar('OSMINOR'$os['minor']);
  133.             $this->tpl->setVar('DATELOGIN'Dot_Kernel::timeFormat($v['dateLogin']'long'));
  134.             $this->tpl->parse('list_block''list'true);
  135.         }
  136.     }
  137. }

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