5 * Copyright (C) 2008 Vincent Tunru
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20 * @license http://www.fsf.org/licensing/licenses/info/GPLv2.html GPL v.2
21 * @category PivipModulesDefault
22 * @package Module_Install
23 * @subpackage Controllers
24 * @copyright (C) 2008 Vincent Tunru
25 * @author Vincent Tunru <email@vincentt.org>
29 * Manage the installation
31 class Install_InstallController
extends Pivip_Controller_Module_Abstract
34 * Manage the installation
36 public function indexAction()
38 $translate = Zend_Registry
::get('Zend_Translate');
39 $this->view
->headTitle($translate->_('Installation'));
40 switch($this->_request
->getParam('phase'))
43 $this->_forward('configuration', 'install', 'install',
44 $this->_request
->getParams());
50 * Manage configuration of Pivip
52 * Displays a form that lets the administrator enter new configuration
53 * values and, when that form is submitted, writes the new configuration data
54 * to disk and redirects to the next step.
56 public function configurationAction()
58 $generalConfig = Zend_Registry
::get('generalConfig');
59 if($this->_request
->isPost())
61 $generalConfig->database
->params
->dbname
=
62 $this->_request
->getParam('dbname');
63 $generalConfig->database
->params
->username
=
64 $this->_request
->getParam('username');
65 $generalConfig->database
->params
->password
=
66 $this->_request
->getParam('password');
67 $generalConfig->website
->name
=
68 $this->_request
->getParam('sitename');
71 $generalConfig->save();
72 $this->_forward('modules', 'install', 'install',
73 $this->_request
->getParams());
74 } catch(Exception
$e) {
75 $translate = Zend_Registry
::get('Zend_Translate');
76 $notification = $translate->_('Could not save the configuration.
77 Is the configuration file writable?');
78 $this->_helper
->FlashMessenger($notification);
81 $route = Zend_Controller_Front
::getInstance()->getRouter()
82 ->getRoute('install');
83 $action = $route->assemble(array('phase' => 'configure'));
84 $dbName = new Zend_Form_Element_Text('dbname');
85 $dbName->setLabel('Database name');
86 $dbUser = new Zend_Form_Element_Text('username');
87 $dbUser->setLabel('Username')
89 $dbPassword = new Zend_Form_Element_Password('password');
90 $dbPassword->setLabel('Password')
92 $form = new Zend_Form();
93 $form->setAction($action)
95 ->setAttrib('id', 'generalSettings')
96 ->setAttrib('class', 'install')
99 ->addElement($dbPassword)
100 ->addDisplayGroup(array('dbname', 'username', 'password'), 'db')
101 ->db
->setLegend('Inloggegevens database');
102 $siteName = new Zend_Form_Element_Text('sitename');
103 $siteName->setLabel('Name')
105 ->addFilter('HtmlEntities');
106 $form->addElement($siteName)
107 ->addDisplayGroup(array('sitename'), 'site')
108 ->site
->setLegend('Site details');
109 $submit = new Zend_Form_Element_Submit('submit');
110 $submit->setLabel('Next step');
111 $form->addElement($submit);
112 $data = $generalConfig->toArray();
113 $data = $data['database']['params'];
114 $data['sitename'] = $generalConfig->website
->name
;
115 $form->populate($data);
116 $this->view
->form
= $form;
120 * Install the modules
122 * Will first check whether the user has administrator rights. If no
123 * authentication module has been installed yet this will prompt its
124 * installation. Once the user has been identified as being the
125 * administrator, installation of individual modules will commence.
127 public function modulesAction()