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

Source for file SystemView.php

Documentation is available at SystemView.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: SystemView.php 158 2010-06-25 08:59:20Z teo $
  11. */
  12.  
  13. /**
  14. * System 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 System_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.      * Display dashboard
  34.      * @access public
  35.      * @param string $templateFile 
  36.      * @return void 
  37.      */
  38.     public function dashboard($templateFile)
  39.     {
  40.         $this->tpl->setFile('tpl_main''system/' $templateFile '.tpl');
  41.         // system overview
  42.         $db Zend_Registry::get('database');
  43.         $t=$db->fetchRow('select version() as ve');
  44.         $this->tpl->setVar('MYSQL',$t['ve']);
  45.         $this->tpl->setVar('PHP',phpversion());
  46.         $this->tpl->setVar('PHPAPI',php_sapi_name());
  47.         $this->tpl->setVar('ZFVERSION'Zend_Version::VERSION);
  48.     }
  49.     /**
  50.      * Display settings
  51.      * @access public
  52.      * @param string $templateFile 
  53.      * @param array $data 
  54.      * @return void 
  55.      */
  56.     public function displaySettings($templateFile$data)
  57.     {
  58.         $this->tpl->setFile('tpl_main''system/' $templateFile '.tpl');
  59.         $this->tpl->setBlock('tpl_main''textarea''textarea_row');
  60.         $this->tpl->setBlock('tpl_main''options''options_row');
  61.         $this->tpl->setBlock('tpl_main''option''option_row');
  62.         $this->tpl->setBlock('tpl_main''radios''radios_row');
  63.         $this->tpl->setBlock('tpl_main''radio''radio_row');
  64.         foreach ($data as $v)
  65.         {            
  66.             $this->tpl->setVar('NAME'$v['title']);
  67.             $this->tpl->setVar('VARIABLE'$v['key']);
  68.             $this->tpl->setVar('DEFAULT'$v['possibleValues']);
  69.             $this->tpl->setVar('EXPLANATION'$v['comment']);
  70.             switch ($v['type']
  71.             {
  72.                 case 'textarea':    
  73.                     $this->tpl->setVar('CURRENT_VALUE'$v['value']);
  74.                     $this->tpl->parse('textarea_row''textarea'true);
  75.                 break;
  76.                 case 'option':
  77.                     $this->tpl->parse('options_row''');
  78.                     $options explode(';'$v['possibleValues']);
  79.                     foreach ($options as $opt)
  80.                     {
  81.                         $this->tpl->setVar('LIST_OPTION'$opt);
  82.                         $optionSelect ($v['value'== $opt'selected' '';
  83.                         $this->tpl->setVar('SELECTED_OPTION'$optionSelect);
  84.                         $this->tpl->parse('options_row''options'true);                                                
  85.                     }
  86.                     $this->tpl->parse('option_row''option'true);
  87.                 break;
  88.                 case 'radio':
  89.                     $this->tpl->parse('radios_row''');
  90.                     $radios explode(';'$v['possibleValues']);
  91.                     foreach ($radios as $val)
  92.                     {
  93.                         $this->tpl->setVar('POSIBLE_VALUE'$val);
  94.                         $radioTxt ($val == 1'Yes' 'No';
  95.                         $this->tpl->setVar('POSIBLE_VALUE_TXT'$radioTxt);
  96.                         $radioCheck ($v['value'== $val'checked' '';
  97.                         $this->tpl->setVar('CHECKED_OPTION'$radioCheck);
  98.                         $this->tpl->parse('radios_row''radios'true);                                                
  99.                     }
  100.                     $this->tpl->parse('radio_row''radio'true);
  101.                 break;
  102.             }
  103.         }
  104.     }
  105.     /**
  106.      * Display phpinfo values
  107.      * @access public
  108.      * @param string $templateFile 
  109.      * @return void 
  110.      */
  111.     public function showPHPInfo($templateFile)
  112.     {
  113.         $this->tpl->setFile('tpl_main''system/' $templateFile '.tpl');
  114.         ob_start();
  115.         phpinfo();
  116.         $parsed ob_get_contents();
  117.         ob_end_clean();
  118.         preg_match"#<body>(.*)</body>#is" $parsed$match1 );
  119.         
  120.         $phpBody  $match1[1];
  121.         // PREVENT WRAP: Most cookies    
  122.         $phpBody  str_replace"; " ";<br />"   $phpBody );
  123.         // PREVENT WRAP: Very long string cookies
  124.         $phpBody  str_replace"%3B""<br />"    $phpBody );
  125.         // PREVENT WRAP: Serialized array string cookies
  126.         $phpBody  str_replace";i:"";<br />i:" $phpBody );
  127.         $phpBody  str_replace":"";<br>" $phpBody );
  128.         $phpBody preg_replace('#<table#''<table class="grey" align="center"'$phpBody);
  129.         $phpBody preg_replace('#<th#''<th  class="bgmain"'$phpBody);
  130.         $phpBody preg_replace('#(\w),(\w)#''\1, \2'$phpBody);
  131.         $phpBody preg_replace('#border="0" cellpadding="3" width="600"#''border="0" cellspacing="1" cellpadding="4" width="95%"',         $phpBody);
  132.         $phpBody preg_replace('#<hr />#'''$phpBody);
  133.         $this->tpl->setVar("PHPINFO"$phpBody);
  134.     }
  135. }

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