-
Notifications
You must be signed in to change notification settings - Fork 1
/
mod_create_char.php
134 lines (115 loc) · 4.24 KB
/
mod_create_char.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<div class="container">
<?php
use App\FileAndDir;
use App\Session;
$page_mod = isset($_PAGE['request'][0]) ? $_PAGE['request'][0] : '';
$t = $db->req('SELECT %gen_step,%gen_mod,%gen_anchor,%gen_id FROM %%steps ORDER BY %gen_step ASC');//On génère la liste des étapes
$steps = array();
$page_step = 0;
$page_title = null;
foreach ($t as $v) {//On formate la liste des étapes
$steps[$v['gen_id']] = array(
'step' => $v['gen_step'],
'mod' => $v['gen_mod'],
'title' => $v['gen_anchor'],
);
if ($page_mod === $v['gen_mod']) {
$page_title = $v['gen_anchor'];
$page_step = (int) $v['gen_step'];
}
}
if (!$page_mod || !$page_title || !$page_step) {
$page_mod = $steps[1]['mod'];
header('Location:'.mkurl(array('params'=>array($page_mod))));
exit;
}
if (!$page_step) { return; }
//if (isset($page_title)) { $_PAGE['anchor'] = $page_title; }
unset($t, $v);
if (!Session::read('etape')) { Session::write('etape', 1); }
$step = Session::read('etape');//On récupère l'étape en cours
if (!FileAndDir::fexists(ROOT.DS.'modules_'.$_PAGE['get'].DS.'mod_'.$page_mod.'.php')) {
Session::setFlash('Le module "'.$page_mod.'" n\'existe pas dans "'.$_PAGE['get'].'"', 'error');
return;
}
if ($step < $page_step && $step > 0) {
header('Location:'.mkurl(array('params'=>array($steps[$step]['mod']))));
exit;
}
$lang = P_LANG;
$p_action = isset($steps[$page_step+1]) ? mkurl(array('params'=>array($steps[$page_step+1]['mod']))) : '';
$p_action = str_replace([base_url(), "/$lang/$lang"], array('', "/$lang"), $p_action);
if (isset($steps[$page_step])) {
$datas = array(
'steps' => $steps,
'page_mod' => $page_mod,
'page_step' => $page_step,
'p_stepval' => Session::read($steps[$page_step]['mod']),
'p_action' => $p_action,
'p_prev' => $page_step > 1 ? mkurl(array('params'=>array($steps[$page_step-1]['mod']))) : '',
);
$_PAGE['more_css'][] = BASE_URL.'/css/pages/pg_'.$page_mod.'.css';
$_PAGE['more_js'][] = BASE_URL.'/js/pages/pg_'.$page_mod.'.js';
// Uncomment this if you want to debug current step's character data.
// Very useful when debugging step actions.
// if (P_DEBUG === true) { echo '<div class="container">'; pr(array($steps[$page_step]['mod'] => $datas['p_stepval'])); echo '</div>'; }
?>
<div id="formgen" class="container">
<ul id="create_char_links" class="nav nav-tabs"><?php
foreach ($steps as $etape => $v) {
$active = $page_step == $etape ? ' class="active"' : '';
$anchor = $v['step'].'. '.tr($v['title'], true);
if ($step >= $etape) {
?><li<?php echo $active; ?>>
<?php echo mkurl(array('params'=>array($v['mod']), 'type' => 'tag', 'attr' => array('class'=>'create_char_link'), 'anchor' => $anchor)); ?>
</li><?php
} else {
?><li<?php echo $active; ?>>
<a class="create_char_link disabled"><?php echo $anchor; ?></a>
</li><?php
}
}
?>
<li>
<?php echo mkurl(array('val'=>52, 'type' => 'tag', 'trans'=>true, 'attr' => array('class'=>'create_char_link'))); ?>
</li>
</ul>
<!--<div class="progress"><div class="bar bar-black" style="width: <?php echo $page_step*5; ?>%;"></div></div>-->
<h2><?php tr($page_title); ?></h2>
<?php
if ($datas['p_prev']) {
?><a href="<?php echo $datas['p_prev']; ?>" class="btn" id="gen_prev">← <?php tr("Étape précédente"); ?></a>
<?php } ?>
<a href="<?php echo isset($_SESSION[$page_mod]) ? base_url().$datas['p_action'] : '#'; ?>" class="btn<?php echo $datas['p_stepval'] ? ' vsbl' : ''; ?>" id="gen_send"><?php tr("Étape suivante"); ?> →</a>
<?php
load_module($page_mod, 'module', $datas);
?>
</div><!--/#formgen-->
<?php
}
?>
<script type="text/javascript">var nextsteptranslate = '<?php tr("Étape suivante"); ?> →';</script>
</div>
<!-- /container -->
<?php
buffWrite('css', /** @lang CSS */ <<<CSSFILE
ul#create_char_links {
/*border: medium none;*/
margin: 0;
}
ul#create_char_links .create_char_link {
font-size: 12px;
margin-bottom: 1px;
padding: 3px 6px 1px 6px;
color: #000;
}
ul#create_char_links .create_char_link.disabled {
color: #aaa;
}
ul#create_char_links .create_char_link.disabled:hover {
background: transparent;
border-color: transparent;
}
CSSFILE
);
buffWrite('js', '');