-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclassi_dettaglio.php
137 lines (112 loc) · 4.41 KB
/
classi_dettaglio.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
135
136
137
<?php
$classe=array();
$query="SELECT * FROM srd35_class WHERE id=".$_GET[id];
$result=mysql_query($query);
while($row=mysql_fetch_assoc($result)){
$classe['nome']=$row["name_".$_MEPHIT['lang']];
$classe['arcane']=$row['arcane'];
$classe['divine']=$row['divine'];
$classe['psion']=$row['psion'];
$classe['key_ability']=$row['key_ability'];
$classe['livelli']=array();
}
$query="
SELECT *
FROM srd35_class_level
WHERE fk_classe=".$_GET[id]."
AND level < 21
ORDER BY level
";
$result=mysql_query($query);
while($row=mysql_fetch_assoc($result)){
$classe['livelli'][]=$row;
}
$query="
SELECT *
FROM srd35_class_feature_level as fl
JOIN srd35_class_feature as cf
WHERE fl.fk_classe=".$_GET[id]."
AND cf.id=fl.fk_privilegio
AND fl.fk_livello < 21
ORDER BY fl.fk_livello, cf.name_".$_MEPHIT['lang']."
";
$result=mysql_query($query);
while($row=mysql_fetch_assoc($result)){
$l = $row['fk_livello'] - 1;
if (!isset($classe['livelli'][$l]['special'])) {
$classe[livelli][$l]['special'] = array();
}
$classe[livelli][$l]['special'][] = $row;
}
$classe[martial]=!$classe[arcane]&&!$classe[divine]&&!$classe[psion]?1:0;
$showSpells=!$classe[martial];
$smarty->assign('title',$classe[nome]);
$pagPos=array();
if(isset($_GET[pag]))$pagPos[pag]="pag=".$_GET[pag];
if(isset($_GET[orderby]))$pagPos[orderby]="orderby=".$_GET[orderby];
if(count($pagPos)>0){
$pagPos_classi="&".implode("&",$pagPos);
$pagPos_path="?".implode("&",$pagPos);
}
$PATH='<a href="classi.php'.$pagPos_path.'">'.$_LANG["classes"].'</a> » <a href="classi.php?id='.$_GET[id].$pagPos_classi.'">'.htmlspecialchars($classe[nome])."</a>";
$TAB1='risorse';
$BODY.='<style>
#optTabs{margin:0;padding:0;list-style:none;background:#c00000;}
#optTabs LI{float:left;}
#optTabs A{display:block;line-height:2em;text-decoration:none;color:#fff;padding: 0 1em;}
#optTabs .sel A{background:#fff;color:#c00000;}
</style>';
$BODY.='<script>
function beforeSave(){
var THs=document.getElementById("tabellaClasse").getElementsByTagName("THEAD")[0].getElementsByTagName("TR")[0].getElementsByTagName("TH"),l=THs.length;
var headers=[];
for(var i=0;i<l;i++){
headers.push(THs[i].id);
}
var FORM=document.getElementById("form-dndtool");
var TRs=document.getElementById("tabellaClasse").getElementsByTagName("TBODY")[0].getElementsByTagName("TR"),l=TRs.length;
for(var i=0;i<l;i++){
var FIELDs=$(TRs[i]).select(".v"),f=FIELDs.length,level=i+1;
for(var j=0;j<f;j++){
// try{
var INPUT=document.createElement("INPUT");
INPUT.type="hidden";
INPUT.name="levels["+level+"]["+headers[j]+"]";
INPUT.value=FIELDs[j].innerHTML.replace("\"",""").replace("\n","").replace("\r","");
FORM.appendChild(INPUT);
// }catch(e){}
}
}
}
</script>';
$BODY.='<form id="form-dndtool" action="classi_save.php" method="post" onsubmit="beforeSave();">';
$BODY.='<input type="hidden" name="what" value="modifica">';
$BODY.='<input type="hidden" name="id" value="'.$_GET[id].'">';
$BODY.='<ul id="optTabs" class="row">
<li class="tab"><a href="javascript:;" onclick="this.blur();">'.$_LANG[class_table].'</a></li>
<li class="tab"><a href="javascript:;" onclick="this.blur();">'.$_LANG[class_skills].'</a></li>
<li class="tab"><a href="javascript:;" onclick="this.blur();">'.$_LANG[proficiencies].'</a></li>
<li class="tab"><a href="javascript:;" onclick="this.blur();">'.$_LANG[class_features].'</a></li>
<li class="tab"><a href="javascript:;" onclick="this.blur();">'.$_LANG[other].'</a></li>
</ul>';
$BODY.='<div id="optCnt">';
$BODY.='<div class="tabContent" style="display:none;">';
require("classi_dettaglio_tabella.php");
$BODY.='</div>';
$BODY.='<div class="tabContent" style="display:none;">';
require("classi_dettaglio_abilitadiclasse.php");
$BODY.='</div>';
$BODY.='<div class="tabContent" style="display:none;">';
require("classi_dettaglio_competenze.php");
$BODY.='</div>';
$BODY.='<div class="tabContent" style="display:none;">';
require("classi_dettaglio_privilegidiclasse.php");
$BODY.='</div>';
$BODY.='<div class="tabContent" style="display:none;">';
require("classi_dettaglio_altro.php");
$BODY.='</div>';
$BODY.='</div>';
$BODY.='<script>new jTab("optTabs","optCnt");</script>';
$BODY.='<br><input type="button" class="btn" value="'.$_LANG[back].'" onclick="location.href=\'personaggi.php?id='.$_GET[id].$pagPos_personaggio.'\';" onkeypress="this.onclick();"> <input type="submit" class="btn" value="'.$_LANG[save].'"><br>';
$BODY.='</form><br>';
?>