| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: view.php 14401 2010-01-26 14:10:00Z louis $ 4 * @package Joomla 5 * @subpackage Installation 6 * @copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved. 7 * @license GNU/GPL, see LICENSE.php 8 * Joomla! is free software. This version may have been modified pursuant 9 * to the GNU General Public License, and as distributed it includes or 10 * is derivative of works licensed under the GNU General Public License or 11 * other free or open source software licenses. 12 * See COPYRIGHT.php for copyright notices and details. 13 */ 14 15 // no direct access 16 defined( '_JEXEC' ) or die( 'Restricted access' ); 17 18 /** 19 * @package Joomla 20 * @subpackage Installation 21 */ 22 23 jimport('joomla.application.component.view'); 24 25 class JInstallationView extends JView 26 { 27 /** 28 * The installation steps 29 * 30 * @var array 31 * @access protected 32 * @since 1.5 33 */ 34 var $_steps = null; 35 36 /** 37 * The templabe object 38 * 39 * @var object 40 * @access protected 41 * @since 1.5 42 */ 43 var $_template = null; 44 45 /** 46 * Language page 47 * 48 * @return boolean True if successful 49 * @access public 50 * @since 1.5 51 */ 52 function chooseLanguage() 53 { 54 $steps =& $this->getSteps(); 55 56 $model =& $this->getModel(); 57 $lists =& $model->getData('lists'); 58 59 $tmpl =& $this->getTemplate( 'language.html' ); 60 61 $steps['lang'] = 'on'; 62 63 $tmpl->addVars( 'stepbar', $steps, 'step_' ); 64 $tmpl->addRows( 'lang-options', $lists['langs'] ); 65 66 return $this->display(); 67 } 68 69 /** 70 * Create a template object 71 * 72 * @return boolean True if successful 73 * @access private 74 * @since 1.5 75 */ 76 function _createTemplate( $bodyHtml = null, $mainHtml = 'page.html' ) 77 { 78 79 jimport('joomla.template.template'); 80 81 $this->_template = new JTemplate(); 82 $this->_template->applyInputFilter('ShortModifiers'); 83 84 // load the wrapper and common templates 85 $this->_template->setRoot( JPATH_BASE . DS . 'template' . DS. 'tmpl' ); 86 $this->_template->readTemplatesFromFile( $mainHtml ); 87 88 if ($bodyHtml) { 89 $this->_template->setAttribute( 'body', 'src', $bodyHtml ); 90 } 91 } 92 93 /** 94 * The DB Config page 95 * 96 * @return boolean True if successful 97 * @access public 98 * @since 1.5 99 */ 100 function dbConfig() 101 { 102 $steps =& $this->getSteps(); 103 $model =& $this->getModel(); 104 $lists =& $model->getData('lists'); 105 $tmpl =& $this->getTemplate( 'dbconfig.html' ); 106 107 $steps['dbconfig'] = 'on'; 108 109 $tmpl->addVars( 'stepbar', $steps, 'step_' ); 110 $tmpl->addRows( 'dbtype-options', $lists['dbTypes'] ); 111 112 return $this->display(); 113 } 114 115 /** 116 * Display the template 117 * 118 * @return boolean True if successful 119 * @access public 120 * @since 1.5 121 */ 122 function display() 123 { 124 $model =& $this->getModel(); 125 $tmpl =& $this->getTemplate(); 126 $lang =& JFactory::getLanguage(); 127 $vars =& $model->getVars(); 128 129 $tmpl->addVar( 'buttons', 'direction', $lang->isRTL() ? 'rtl' : 'ltr'); 130 $tmpl->addVar( 'body', 'lang', $lang->getTag() ); 131 $tmpl->addVars( 'body', $vars, 'var_' ); 132 133 echo $tmpl->fetch( 'page' ); 134 135 return true; 136 } 137 138 /** 139 * Report an error to the user 140 * 141 * @return boolean True if successful 142 * @access public 143 * @since 1.5 144 */ 145 function error() 146 { 147 $steps =& $this->getSteps(); 148 $model =& $this->getModel(); 149 $vars =& $model->getVars(); 150 $tmpl =& $this->getTemplate( 'error.html' ); 151 152 $msg = $model->getError(); 153 $back = $model->getData('back'); 154 $xmsg = $model->getData('errors'); 155 156 $tmpl->addVars( 'stepbar', $steps, 'step_' ); 157 $tmpl->addVar( 'messages', 'message', $msg ); 158 159 if ($xmsg) { 160 $tmpl->addVar( 'xmessages', 'xmessage', $xmsg ); 161 } 162 163 $tmpl->addVar( 'buttons', 'back', $back ); 164 $tmpl->addVars( 'body', $vars, 'var_' ); 165 166 return $this->display(); 167 } 168 169 /** 170 * The the final page 171 * 172 * @return boolean True if successful 173 * @access public 174 * @since 1.5 175 */ 176 function finish() 177 { 178 $steps =& $this->getSteps(); 179 $model =& $this->getModel(); 180 $vars =& $model->getVars(); 181 $tmpl =& $this->getTemplate( 'finish.html' ); 182 183 $buffer = $model->getData('buffer'); 184 185 $steps['finish'] = 'on'; 186 187 $tmpl->addVars( 'stepbar', $steps, 'step_' ); 188 189 if ($buffer) { 190 $tmpl->addVar( 'configuration-error', 'buffer', $buffer ); 191 } 192 193 return $this->display(); 194 } 195 196 /** 197 * Show the FTP config page 198 * 199 * @return boolean True if successful 200 * @access public 201 * @since 1.5 202 */ 203 function ftpConfig() 204 { 205 $steps =& $this->getSteps(); 206 $model =& $this->getModel(); 207 208 $tmpl =& $this->getTemplate( 'ftpconfig.html' ); 209 210 $steps['ftpconfig'] = 'on'; 211 212 $tmpl->addVars( 'stepbar', $steps, 'step_' ); 213 214 return $this->display(); 215 } 216 217 /** 218 * Get the installation steps 219 * 220 * @return array 221 * @access protected 222 * @since 1.5 223 */ 224 function & getSteps() 225 { 226 if ( is_null($this->_steps) ) 227 { 228 $this->_steps = array( 229 'lang' => 'off', 230 'preinstall' => 'off', 231 'license' => 'off', 232 'dbconfig' => 'off', 233 'ftpconfig' => 'off', 234 'mainconfig' => 'off', 235 'finish' => 'off' 236 ); 237 } 238 239 return $this->_steps; 240 } 241 242 /** 243 * Get the template object 244 * 245 * @param string The name of the body html file 246 * @return patTemplate 247 * @access protected 248 * @since 1.5 249 */ 250 function & getTemplate( $bodyHtml = null ) 251 { 252 static $current; 253 254 $change = false; 255 256 // Record the current template body 257 if ( is_null($current) && $bodyHtml) 258 { 259 $current = $bodyHtml; 260 $change = true; 261 } 262 263 // Check if we need to create the body, possibly anew 264 if ( is_null( $this->_template) || $change ) 265 { 266 $this->_createTemplate($bodyHtml); 267 } 268 269 return $this->_template; 270 } 271 272 /** 273 * The license page 274 * 275 * @return boolean True if successful 276 * @access public 277 * @since 1.5 278 */ 279 function license() 280 { 281 $steps =& $this->getSteps(); 282 $model =& $this->getModel(); 283 $tmpl =& $this->getTemplate( 'license.html' ); 284 285 $steps['license'] = 'on'; 286 287 $tmpl->addVars( 'stepbar', $steps, 'step_' ); 288 289 return $this->display(); 290 } 291 292 /** 293 * The main configuration page 294 * 295 * @return boolean True if successful 296 * @access public 297 * @since 1.5 298 */ 299 function mainConfig() 300 { 301 $steps =& $this->getSteps(); 302 $model =& $this->getModel(); 303 $tmpl =& $this->getTemplate( 'mainconfig.html' ); 304 305 $steps['mainconfig'] = 'on'; 306 307 $tmpl->addVars( 'stepbar', $steps, 'step_' ); 308 309 $tmpl->addVar( 'buttons', 'previous', 'ftpconfig'); 310 // $tmpl->addRows( 'folder-perms', $lists['folderPerms'] ); 311 312 /* 313 * prepare migration encoding selection 314 */ 315 $encodings = array( 'iso-8859-1','iso-8859-2','iso-8859-3','iso-8859-4','iso-8859-5','iso-8859-6','iso-8859-7','iso-8859-8','iso-8859-9','iso-8859-10','iso-8859-13','iso-8859-14','iso-8859-15','cp874','windows-1250','windows-1251','windows-1252','windows-1253','windows-1254','windows-1255','windows-1256','windows-1257','windows-1258','utf-8','big5','euc-jp','euc-kr','euc-tw','iso-2022-cn','iso-2022-jp-2','iso-2022-jp','iso-2022-kr','iso-10646-ucs-2','iso-10646-ucs-4','koi8-r','koi8-ru','ucs2-internal','ucs4-internal','unicode-1-1-utf-7','us-ascii','utf-16' ); 316 $tmpl->addVar( 'encoding_options', 'value', $encodings ); 317 $max_upload_size = min(JInstallationHelper::let_to_num(ini_get('post_max_size')), JInstallationHelper::let_to_num(ini_get('upload_max_filesize'))); 318 $tmpl->addVar( 'uploadsize', 'maxupload', JText::sprintf('UPLOADFILESIZE',(number_format($max_upload_size/(1024*1024), 2))."MB.")); 319 return $this->display(); 320 } 321 322 /** 323 * The the pre-install info page 324 * 325 * @return boolean True if successful 326 * @access public 327 * @since 1.5 328 */ 329 function preInstall() 330 { 331 $steps =& $this->getSteps(); 332 $model =& $this->getModel(); 333 $lists =& $model->getData('lists'); 334 335 $version = new JVersion(); 336 $tmpl =& $this->getTemplate( 'preinstall.html' ); 337 338 $steps['preinstall'] = 'on'; 339 340 $tmpl->addVars( 'stepbar', $steps, 'step_' ); 341 $tmpl->addVar( 'body', 'version', $version->getLongVersion() ); 342 343 $tmpl->addRows( 'php-options', $lists['phpOptions'] ); 344 $tmpl->addRows( 'php-settings', $lists['phpSettings'] ); 345 346 return $this->display(); 347 } 348 349 /** 350 * Remove directory messages 351 * 352 * @return Boolean True if successful 353 * @access public 354 * @since 1.5 355 */ 356 function removedir() 357 { 358 $model =& $this->getModel(); 359 360 $this->_createTemplate('', 'removedir.html'); 361 $tmpl = $this->_template; 362 363 #$tmpl =& $this->getTemplate( 'removedir.html' ); 364 return $this->display(); 365 } 366 367 368 function migrateScreen() { 369 $steps =& $this->getSteps(); 370 $model =& $this->getModel(); 371 372 $tmpl =& $this->getTemplate( 'migration.html' ); 373 $scriptpath =& $model->getData('scriptpath'); 374 $tmpl->addVars( 'stepbar', $steps, 'step_' ); 375 $tmpl->addVar( 'migration', 'migration', JRequest::getVar( 'migration', 0, 'post', 'bool' )); 376 $tmpl->addVar( 'buttons', 'previous', 'mainconfig'); 377 return $this->display(); 378 } 379 } 380 381 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |