]> git.agnieray.net Git - galette.git/blob - galette/install/steps/db_select_version.php
3a8a05bc4ad3cf7fb789c0e852de308d4b090f13
[galette.git] / galette / install / steps / db_select_version.php
1 <?php
2
3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4
5 /**
6 * Galette installation, database upgrade previous version selection step
7 *
8 * PHP version 5
9 *
10 * Copyright © 2013-2014 The Galette Team
11 *
12 * This file is part of Galette (http://galette.tuxfamily.org).
13 *
14 * Galette is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * Galette is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
26 *
27 * @category Core
28 * @package Galette
29 *
30 * @author Johan Cwiklinski <johan@x-tnd.be>
31 * @copyright 2013-2014 The Galette Team
32 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
33 * @link http://galette.tuxfamily.org
34 * @since Available since 0.8 - 2013-07-21
35 */
36
37 use Galette\Core\Install as GaletteInstall;
38 use Galette\Core\Db as GaletteDb;
39
40 $versions = $install->getScripts();
41 $current = $install->getCurrentVersion($zdb);
42 $raw_current = $zdb->getDbVersion(true);
43 $last = '0.00';
44 ?>
45 <h2><?php echo _T("Previous version selection"); ?></h2>
46 <p><?php echo _T("Select your previous Galette version below, and then click next."); ?></p>
47 <form action="installer.php" method="post">
48 <?php
49 if (count($versions) == 0) {
50 ?>
51 <p id="errorbox"><?php echo _T("No update script found!"); ?></p>
52 <?php
53 if ($raw_current === GALETTE_DB_VERSION) {
54 ?>
55 <p id="warningbox"><?php echo _T("It seems you already use latest Galette version!"); ?></p>
56 <?php
57 }
58 ?>
59 <p id="btn_box">
60 <input type="submit" name="abort_btn" value="<?php echo _T("Cancel"); ?>"/>
61 <button type="submit" id="btnback" name="stepback_btn" formnovalidate><i class="fas fa-backward"></i> <?php echo _T("Back"); ?></button>
62 </p>
63
64 <?php
65 } else {
66 if ($current !== false) {
67 if ($current < 0.70) {
68 ?>
69 <p id="warningbox"><?php echo _T("Previous version is older than 0.7. <strong>Make sure you select the right version</strong>."); ?></p>
70 <?php
71 } else {
72 ?>
73 <p id="successbox"><?php echo _T("Your previous version should be selected and <strong>displayed in bold</strong>."); ?></p>
74 <?php
75 }
76 }
77
78 if ($raw_current === GALETTE_DB_VERSION) {
79 ?>
80 <p id="warningbox"><?php echo _T("It seems you already use latest Galette version!<br/>Are you sure you want to upgrade?"); ?></p>
81 <?php
82 }
83 ?>
84 <fieldset class="cssform">
85 <legend class="ui-state-active ui-corner-top"><?php echo _T("Your current Galette version is..."); ?></legend>
86
87 <ul class="leaders">
88 <?php
89 $is_current = false;
90 foreach ($versions as $version) {
91 ?>
92 <li>
93 <?php
94 if ($is_current) {
95 echo '<strong>';
96 }
97 ?>
98 <span>
99 <label for="upgrade-<?php echo $version; ?>">
100 <?php
101 if ($last === '0.00') {
102 echo str_replace(
103 '%version',
104 number_format($version, 2),
105 _T("older than %version")
106 );
107 } elseif ($last != number_format($version - 0.01, 2)) {
108 echo _T("comprised between") . " " .
109 $last . " " . _T("and") . " " . number_format($version - 0.01, 2);
110 } else {
111 echo " " . number_format($version - 0.01, 2);
112 }
113 $last = $version;
114 ?>
115 </label>
116 </span>
117 <span>
118 <input type="radio" name="previous_version" value="<?php echo $version; ?>" id="upgrade-<?php echo $version; ?>"<?php if ($is_current) { echo ' checked="checked"'; }; ?> required/>
119 </span>
120 <?php
121 if ($is_current) {
122 echo '</strong>';
123 }
124 $is_current = $current == $version;
125 ?>
126
127 </li>
128 <?php
129 }
130 ?>
131 </ul>
132 </fieldset>
133 <p id="btn_box">
134 <button type="submit"><?php echo _T("Next step"); ?> <i class="fas fa-forward"></i></button>
135 <button type="submit" id="btnback" name="stepback_btn" formnovalidate><i class="fas fa-backward"></i> <?php echo _T("Back"); ?></button>
136 </p>
137 <?php
138 }
139 ?>
140 </form>