No regular expressions were active.
1 |
|
<?php
|
|
|
2 |
|
|
|
|
3 |
|
/*********
**********
**********
**********
**********
**********
**********
******
|
|
|
4 |
|
*
D
olphin Sma
rt Communi
ty Builder
|
|
|
5 |
|
*
---------
--------
|
|
|
6 |
|
* begi
n
: M
on Mar 23
2006
|
|
|
7 |
|
* copy
right
: (
C) 2006 Bo
onEx Group
|
|
|
8 |
|
* webs
ite
: h
ttp://www.
boonex.com
/
|
|
|
9 |
|
* This fil
e is part
of Dolphin
- Smart C
ommunity B
uilder
|
|
|
10 |
|
*
|
|
|
11 |
|
* Dolphin
is free so
ftware. Th
is work is
licensed
under a Cr
eative Com
mons Attri
bution 3.0
License.
|
|
|
12 |
|
* http://c
reativecom
mons.org/l
icenses/by
/3.0/
|
|
|
13 |
|
*
|
|
|
14 |
|
* Dolphin
is distrib
uted in th
e hope tha
t it will
be useful,
but WITHO
UT ANY WAR
RANTY;
|
|
|
15 |
|
* without
even the i
mplied war
ranty of
MERCHANTAB
ILITY or F
ITNESS FOR
A PARTICU
LAR PURPOS
E.
|
|
|
16 |
|
* See the
Creative C
ommons Att
ribution 3
.0 License
for more
details.
|
|
|
17 |
|
* You shou
ld have re
ceived a c
opy of the
Creative
Commons At
tribution
3.0 Licens
e along wi
th Dolphin
,
|
|
|
18 |
|
* see lice
nse.txt fi
le; if not
, write to
marketing
@boonex.co
m
|
|
|
19 |
|
**********
**********
**********
**********
**********
**********
**********
*****/
|
|
|
20 |
|
|
|
|
21 |
|
/*
|
|
|
22 |
|
* Page fo
r displayi
ng and edi
ting profi
le fields.
|
|
|
23 |
|
*/
|
|
|
24 |
|
|
|
|
25 |
|
require_on
ce( '../in
c/header.i
nc.php' );
|
|
|
26 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'd
esign.inc.
php' );
|
|
|
27 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'p
rofiles.in
c.php' );
|
|
|
28 |
|
require_on
ce( BX_DIR
ECTORY_PAT
H_INC . 'a
dmin_desig
n.inc.php'
);
|
|
|
29 |
|
|
|
|
30 |
|
|
|
|
31 |
|
// Check i
f administ
rator is l
ogged in.
If not di
splay logi
n form.
|
|
|
32 |
|
$logged['a
dmin'] = m
ember_auth
( 1 );
|
|
|
33 |
|
|
|
|
34 |
|
$_page['he
ader'] = '
Split Join
Form';
|
|
|
35 |
|
$_page['cs
s_name'] =
'profile_
fields.css
';
|
|
|
36 |
|
|
|
|
37 |
|
|
|
|
38 |
|
TopCodeAdm
in();
|
|
|
39 |
|
ContentBlo
ckHead("Sp
lit join f
orm");
|
|
|
40 |
|
echo m
ain_code()
;
|
|
|
41 |
|
ContentBlo
ckFoot();
|
|
|
42 |
|
BottomCode
();
|
|
|
43 |
|
|
|
|
44 |
|
|
|
|
45 |
|
function m
ain_code()
|
|
|
46 |
|
{
|
|
|
47 |
|
global
$site;
|
|
|
48 |
|
global
$modified
;
|
|
|
49 |
|
|
|
|
50 |
|
switch
( $_REQUE
ST['action
'] )
|
|
|
51 |
|
{
|
|
|
52 |
|
//
menu to m
ove field
to another
join page
|
|
|
53 |
|
ca
se 'edit':
|
|
|
54 |
|
// get e
lement nam
e, etc
|
|
|
55 |
|
$id = (i
nt)$_GET['
id'];
|
|
|
56 |
|
// get p
roperties
of field b
y it's id
|
|
|
57 |
|
$query =
"SELECT `
name`, `na
medisp`, `
join_page`
, FLOOR(`j
oin_page`
/ 1000) as
`jp`, `ch
eck` FROM
`ProfilesD
esc` WHERE
`ID` = '$
id'";
|
|
|
58 |
|
$field_a
rr = db_ar
r($query);
|
|
|
59 |
|
if ( !$f
ield_arr )
|
|
|
60 |
|
retu
rn "";
|
|
|
61 |
|
|
|
|
62 |
|
// calcu
late numbe
r of join
pages
|
|
|
63 |
|
$query =
"SELECT F
LOOR(`join
_page` / 1
000) as `j
p` FROM `P
rofilesDes
c` WHERE `
visible` &
2 AND (FI
ND_IN_SET(
'0',`show_
on_page`)
OR FIND_IN
_SET('3',`
show_on_pa
ge`)) AND
`join_page
` >= 1000
GROUP BY `
jp`";
|
|
|
64 |
|
$respd =
db_res($q
uery);
|
|
|
65 |
|
$pages_n
um = mysql
_num_rows(
$respd);
|
|
|
66 |
|
$pages_n
um++;
|
|
|
67 |
|
|
|
|
68 |
|
$content
= "
|
|
|
69 |
|
<for
m name=\"j
_editform\
" id=\"j_e
ditform\"
action=\"{
$_SERVER['
PHP_SELF']
}\" method
=\"POST\">
|
|
|
70 |
|
<table wid
th=\"100%\
">
|
|
|
71 |
|
<tr>
|
|
|
72 |
|
<t
d valign=\
"top\">
|
|
|
73 |
|
Field na
me - " . $
field_arr[
'name'] .
"<br />
|
|
|
74 |
|
Field ca
ption - "
. _t($fiel
d_arr['nam
edisp']) .
"<br />
|
|
|
75 |
|
</
td>
|
|
|
76 |
|
<t
d valign=\
"top\">
|
|
|
77 |
|
select p
art of joi
n page:&nb
sp;
|
|
|
78 |
|
<input t
ype=\"hidd
en\" name=
\"action\"
value=\"c
hange_page
\">
|
|
|
79 |
|
<input t
ype=\"hidd
en\" name=
\"id\" val
ue=\"$id\"
>
|
|
|
80 |
|
<select
name=\"new
_jp\" id=\
"j_page\"
onchange=\
"javascrip
t: documen
t.forms['j
_editform'
].submit()
;\">
|
|
|
81 |
|
<opt
ion value=
\"0\">invi
sible</opt
ion>";
|
|
|
82 |
|
|
|
|
83 |
|
for ($i
= 1; $i <=
$pages_nu
m; $i++)
|
|
|
84 |
|
{
|
|
|
85 |
|
$sel
ected = $i
== $field
_arr['jp']
? 'select
ed' : '';
|
|
|
86 |
|
$con
tent .= "
|
|
|
87 |
|
<opt
ion value=
\"$i\" $se
lected>joi
n page, pa
rt $i</opt
ion>";
|
|
|
88 |
|
}
|
|
|
89 |
|
|
|
|
90 |
|
$content
.= "
|
|
|
91 |
|
</select
>
|
|
|
92 |
|
</
td>
|
|
|
93 |
|
<t
d valign=\
"top\">
|
|
|
94 |
|
<a href=
\"{$_SERVE
R['PHP_SEL
F']}\">Bac
k</a>
|
|
|
95 |
|
</
td>
|
|
|
96 |
|
</tr>
|
|
|
97 |
|
</table>
|
|
|
98 |
|
</fo
rm>";
|
|
|
99 |
|
|
|
|
100 |
|
return $
content;
|
|
|
101 |
|
|
|
|
102 |
|
// res
et join fo
rm
|
|
|
103 |
|
case '
reset':
|
|
|
104 |
|
|
|
|
105 |
|
$q
uery = "UP
DATE `Prof
ilesDesc`
SET `join_
page` = `o
rder` + 10
00";
|
|
|
106 |
|
$r
espd = db_
res($query
);
|
|
|
107 |
|
|
|
|
108 |
|
br
eak;
|
|
|
109 |
|
|
|
|
110 |
|
// mov
e field to
another j
oin page
|
|
|
111 |
|
case '
change_pag
e':
|
|
|
112 |
|
|
|
|
113 |
|
$r
es = db_re
s( "SELECT
`ID`, `na
me`, `name
disp`, `jo
in_page`,
`type`, `g
roup_mark`
, FLOOR(`j
oin_page`
/ 1000) as
`jp` FROM
`Profiles
Desc` WHER
E `visible
` & 2 AND
(FIND_IN_S
ET('0',`sh
ow_on_page
`) OR FIND
_IN_SET('3
',`show_on
_page`)) O
RDER BY `j
oin_page`
ASC" );
|
|
|
114 |
|
//
Process d
eleting
|
|
|
115 |
|
ch
ange_page(
$_POST['i
d'], $_POS
T['new_jp'
], $res );
|
|
|
116 |
|
ec
ho "<p><sp
an style=\
"color:#ff
6666;font-
weight:bol
d\">Join p
age change
d.</span><
/p>\n";
|
|
|
117 |
|
$m
odified =
(int)$_POS
T['id'];
|
|
|
118 |
|
br
eak;
|
|
|
119 |
|
|
|
|
120 |
|
case '
up':
|
|
|
121 |
|
|
|
|
122 |
|
$r
es = db_re
s( "SELECT
`ID`, `na
me`, `name
disp`, `jo
in_page`,
`type`, `g
roup_mark`
, FLOOR(`j
oin_page`
/ 1000) as
`jp` FROM
`Profiles
Desc` WHER
E `visible
` & 2 AND
(FIND_IN_S
ET('0',`sh
ow_on_page
`) OR FIND
_IN_SET('3
',`show_on
_page`)) O
RDER BY `j
oin_page`
ASC" );
|
|
|
123 |
|
if
( !move_u
p( $_GET['
id'], $res
) )
|
|
|
124 |
|
echo "<p
><span sty
le=\"color
:#ff6666;f
ont-weight
:bold\">Ca
n't move u
p field.</
span></p>\
n";
|
|
|
125 |
|
el
se
|
|
|
126 |
|
$modifie
d = (int)$
_GET['id']
;
|
|
|
127 |
|
br
eak;
|
|
|
128 |
|
|
|
|
129 |
|
case '
down':
|
|
|
130 |
|
|
|
|
131 |
|
$r
es = db_re
s( "SELECT
`ID`, `na
me`, `name
disp`, `jo
in_page`,
`type`, `g
roup_mark`
, FLOOR(`j
oin_page`
/ 1000) as
`jp` FROM
`Profiles
Desc` WHER
E `visible
` & 2 AND
(FIND_IN_S
ET('0',`sh
ow_on_page
`) OR FIND
_IN_SET('3
',`show_on
_page`)) O
RDER BY `j
oin_page`
ASC" );
|
|
|
132 |
|
if
( !move_d
own( $_GET
['id'], $r
es ) )
|
|
|
133 |
|
echo "<p
><span sty
le=\"color
:#ff6666;f
ont-weight
:bold\">Ca
n't move d
own field.
</span></p
>\n";
|
|
|
134 |
|
el
se
|
|
|
135 |
|
$modifie
d = (int)$
_GET['id']
;
|
|
|
136 |
|
br
eak;
|
|
|
137 |
|
}
|
|
|
138 |
|
|
|
|
139 |
|
$reset
_link = "<
a href=\"{
$_SERVER['
PHP_SELF']
}?action=r
eset\">res
et join fo
rm to defa
ult</a><br
> <br
>";
|
|
|
140 |
|
return
$reset_li
nk . displ
ay_fields(
);
|
|
|
141 |
|
}
|
|
|
142 |
|
|
|
|
143 |
|
function d
isplay_fie
lds()
|
|
|
144 |
|
{
|
|
|
145 |
|
global
$modified
;
|
|
|
146 |
|
|
|
|
147 |
|
$conte
nt = "
|
|
|
148 |
|
<tab
le width=1
00% border
=\"1\" cla
ss=\"profi
le_fields\
">
|
|
|
149 |
|
<tr>
|
|
|
150 |
|
<td><b
>name</b><
/td>
|
|
|
151 |
|
<td><b
>caption</
b></td>
|
|
|
152 |
|
<td co
lspan=\"2\
"><b>order
</b></td>
|
|
|
153 |
|
<td><b
>edit</b><
/td>
|
|
|
154 |
|
</tr>";
|
|
|
155 |
|
|
|
|
156 |
|
// if
'hidden' f
ields exis
ts - we ha
ve to crea
te caption
for it
|
|
|
157 |
|
$query
= "SELECT
COUNT(`jo
in_page`)
FROM `Prof
ilesDesc`
WHERE `joi
n_page` <
1000;";
|
|
|
158 |
|
$arr =
db_arr($q
uery);
|
|
|
159 |
|
if ( $
arr[0] > 0
)
|
|
|
160 |
|
{
|
|
|
161 |
|
$c
ontent .=
"
|
|
|
162 |
|
<tr>
|
|
|
163 |
|
<td st
yle=\"font
-weight: b
old; backg
round-colo
r: #757575
;\" colspa
n=\"6\" al
ign=\"cent
er\">List
of hidden
fields</td
>
|
|
|
164 |
|
</tr>";
|
|
|
165 |
|
}
|
|
|
166 |
|
|
|
|
167 |
|
$curre
nt_page =
0;
|
|
|
168 |
|
$respd
= db_res(
"SELECT `
ID`, `name
`, `namedi
sp`, `join
_page`, `t
ype`, `gro
up_mark`,
FLOOR(`joi
n_page` /
1000) as `
jp` FROM `
ProfilesDe
sc` WHERE
`visible`
& 2 AND (F
IND_IN_SET
('0',`show
_on_page`)
OR FIND_I
N_SET('3',
`show_on_p
age`)) ORD
ER BY `joi
n_page` AS
C" );
|
|
|
169 |
|
$total
_num = mys
ql_num_row
s($respd);
|
|
|
170 |
|
$i = 0
;
|
|
|
171 |
|
while
( $arrpd =
mysql_fet
ch_array($
respd) )
|
|
|
172 |
|
{
|
|
|
173 |
|
if
( $arrpd[
'jp'] != $
current_pa
ge )
|
|
|
174 |
|
{
|
|
|
175 |
|
$content
.= "
|
|
|
176 |
|
<tr>
|
|
|
177 |
|
<td st
yle=\"font
-weight: b
old; backg
round-colo
r: #ffc482
;\" colspa
n=\"6\" al
ign=\"cent
er\">Join
page numbe
r {$arrpd[
'jp']}</td
>
|
|
|
178 |
|
</tr>";
|
|
|
179 |
|
$current
_page = $a
rrpd['jp']
;
|
|
|
180 |
|
}
|
|
|
181 |
|
if
( $modifi
ed == $arr
pd['ID'] )
|
|
|
182 |
|
{
|
|
|
183 |
|
$style =
'class="m
odified_ro
w"';
|
|
|
184 |
|
}
|
|
|
185 |
|
el
se
|
|
|
186 |
|
{
|
|
|
187 |
|
$style =
(( '0' ==
$arrpd['t
ype'] ) ?
'class="se
ction""' :
|
|
|
188 |
|
(( $
i % 2 == 0
) ? 'clas
s="odd_row
"' : ''));
|
|
|
189 |
|
}
|
|
|
190 |
|
|
|
|
191 |
|
if
( $arrpd[
'group_mar
k'] != ''
)
|
|
|
192 |
|
{
|
|
|
193 |
|
$row_sty
le = 'colo
r:#777777;
';
|
|
|
194 |
|
}
|
|
|
195 |
|
el
se
|
|
|
196 |
|
{
|
|
|
197 |
|
$row_sty
le = '';
|
|
|
198 |
|
}
|
|
|
199 |
|
|
|
|
200 |
|
$c
ontent .=
"
|
|
|
201 |
|
<tr $style
>";
|
|
|
202 |
|
if
( '0' !=
$arrpd['ty
pe'] )
|
|
|
203 |
|
{
|
|
|
204 |
|
$content
.= "
|
|
|
205 |
|
<td wi
dth=\"30%\
" style=\"
padding-ri
ght: 5px;
$row_style
\">{$arrpd
['name']}<
/td>
|
|
|
206 |
|
<td st
yle=\"$row
_style\">"
. _t($arrp
d['namedis
p']) ."</t
d>";
|
|
|
207 |
|
}
|
|
|
208 |
|
el
se
|
|
|
209 |
|
{
|
|
|
210 |
|
$content
.= "
|
|
|
211 |
|
<td co
lspan=\"2\
">". _t($a
rrpd['name
disp']) ."
</td>";
|
|
|
212 |
|
}
|
|
|
213 |
|
$c
ontent .=
"
|
|
|
214 |
|
<td wi
dth=\"15px
\">". ($i
!= 0 ? "<a
href='{$_
SERVER['PH
P_SELF']}?
action=up&
id={$arrpd
['ID']}'><
img src=\"
images/arr
ow_up.gif\
" border=\
"0\"></a>"
: "
") ."</td>
|
|
|
215 |
|
<td wi
dth=\"15px
\">". ($i
!= $total_
num - 1 ?
"<a href='
{$_SERVER[
'PHP_SELF'
]}?action=
down&id={$
arrpd['ID'
]}'><img s
rc=\"image
s/arrow_do
wn.gif\" b
order=\"0\
"></a>" :
' ')
. "</td>
|
|
|
216 |
|
<td wi
dth=\"15px
\"><a href
='{$_SERVE
R['PHP_SEL
F']}?actio
n=edit&id=
{$arrpd['I
D']}'><img
src=\"ima
ges/edit.g
if\" borde
r=\"0\"></
a></td>
|
|
|
217 |
|
</tr>";
|
|
|
218 |
|
$i
++;
|
|
|
219 |
|
}
|
|
|
220 |
|
|
|
|
221 |
|
$conte
nt .= "
|
|
|
222 |
|
</ta
ble>";
|
|
|
223 |
|
|
|
|
224 |
|
return
$content;
|
|
|
225 |
|
}
|
|
|
226 |
|
|
|
|
227 |
|
function c
hange_page
( $ID, $jo
in_page, $
res )
|
|
|
228 |
|
{
|
|
|
229 |
|
// Mak
e int from
ID and jo
in_page
|
|
|
230 |
|
$ID =
(int) $ID;
|
|
|
231 |
|
$join_
page = (in
t) $join_p
age;
|
|
|
232 |
|
|
|
|
233 |
|
// Col
lect all f
ields and
determine
which of t
hem are gr
oup
|
|
|
234 |
|
$cnt =
0;
|
|
|
235 |
|
$total
_rows = my
sql_num_ro
ws( $res )
;
|
|
|
236 |
|
while
( $row = m
ysql_fetch
_array( $r
es ) )
|
|
|
237 |
|
{
|
|
|
238 |
|
$r
ows[$cnt]
= $row;
|
|
|
239 |
|
$f
name = get
_field_nam
e( $row );
|
|
|
240 |
|
$r
ows[$cnt][
'db_name']
= $fname;
|
|
|
241 |
|
$r
ows[$cnt][
'change_jp
'] = false
;
|
|
|
242 |
|
$f
ield_group
s[$fname][
'count']++
;
|
|
|
243 |
|
if
( $row['I
D'] == $ID
)
|
|
|
244 |
|
$field_i
ndex = $cn
t;
|
|
|
245 |
|
$c
nt++;
|
|
|
246 |
|
}
|
|
|
247 |
|
|
|
|
248 |
|
if ( !
isset($fie
ld_index)
)
|
|
|
249 |
|
re
turn;
|
|
|
250 |
|
|
|
|
251 |
|
// Det
erm the la
st order f
or destina
tion join
page
|
|
|
252 |
|
$query
= "SELECT
`join_pag
e` FROM `P
rofilesDes
c` WHERE `
join_page`
>= ". ($j
oin_page *
1000) . "
AND `join
_page` < "
.( ($join_
page + 1)
* 1000) ."
ORDER BY
`join_page
` DESC LIM
IT 1";
|
|
|
253 |
|
$order
_arr = db_
arr($query
);
|
|
|
254 |
|
if ( !
$order_arr
['join_pag
e'] )
|
|
|
255 |
|
$o
rder = $jo
in_page *
1000 + 1;
|
|
|
256 |
|
else
|
|
|
257 |
|
$o
rder = $or
der_arr['j
oin_page']
+ 1;
|
|
|
258 |
|
|
|
|
259 |
|
// Kee
p changing
join page
for all r
ow group
|
|
|
260 |
|
if ( $
rows[$fiel
d_index]['
group_mark
'] != '' )
|
|
|
261 |
|
{
|
|
|
262 |
|
$i
= $field_
index - 1;
|
|
|
263 |
|
wh
ile ( $row
s[$i]['gro
up_mark']
!= '' && $
i >= 0 )
|
|
|
264 |
|
{
|
|
|
265 |
|
$rows[$i
]['change_
jp'] = tru
e;
|
|
|
266 |
|
$i--;
|
|
|
267 |
|
}
|
|
|
268 |
|
$i
= $field_
index + 1;
|
|
|
269 |
|
wh
ile ( $row
s[$i]['gro
up_mark']
!= '' && $
i < $total
_rows )
|
|
|
270 |
|
{
|
|
|
271 |
|
$rows[$i
]['change_
jp'] = tru
e;
|
|
|
272 |
|
$i++;
|
|
|
273 |
|
}
|
|
|
274 |
|
}
|
|
|
275 |
|
|
|
|
276 |
|
// Cha
nge join p
age for al
l necessar
y fields
|
|
|
277 |
|
for (
$i = 0; $i
< $total_
rows; $i++
)
|
|
|
278 |
|
if
( $rows[$
i]['db_nam
e'] == $ro
ws[$field_
index]['db
_name'] ||
$rows[$i]
['change_j
p'] )
|
|
|
279 |
|
{
|
|
|
280 |
|
db_res(
"UPDATE `P
rofilesDes
c` SET `jo
in_page` =
'$order'
WHERE ID =
{$rows[$i
]['ID']}"
);
|
|
|
281 |
|
$order++
;
|
|
|
282 |
|
}
|
|
|
283 |
|
}
|
|
|
284 |
|
|
|
|
285 |
|
function m
ove_up( $I
D, $res )
|
|
|
286 |
|
{
|
|
|
287 |
|
// Mak
e int from
ID
|
|
|
288 |
|
$ID =
(int) $ID;
|
|
|
289 |
|
|
|
|
290 |
|
// Col
lect field
s and dete
rmine whic
h of them
are group
|
|
|
291 |
|
$cnt =
0;
|
|
|
292 |
|
while
( $row = m
ysql_fetch
_array( $r
es ) )
|
|
|
293 |
|
{
|
|
|
294 |
|
$r
ows[$cnt]
= $row;
|
|
|
295 |
|
$f
name = get
_field_nam
e( $row );
|
|
|
296 |
|
$r
ows[$cnt][
'db_name']
= $fname;
|
|
|
297 |
|
$f
ield_group
s[$fname][
'count']++
;
|
|
|
298 |
|
if
( $row['I
D'] == $ID
)
|
|
|
299 |
|
$field_i
ndex = $cn
t;
|
|
|
300 |
|
$c
nt++;
|
|
|
301 |
|
}
|
|
|
302 |
|
|
|
|
303 |
|
// Num
ber of fie
lds in cur
rent group
|
|
|
304 |
|
$src_g
roup_field
s_num = $f
ield_group
s[$rows[$f
ield_index
]['db_name
']]['count
'];
|
|
|
305 |
|
// Num
ber of fie
lds in des
tination g
roup
|
|
|
306 |
|
$dest_
group_fiel
ds_num = $
field_grou
ps[$rows[$
field_inde
x - 1]['db
_name']]['
count'];
|
|
|
307 |
|
|
|
|
308 |
|
if ( $
field_inde
x == 0 )
|
|
|
309 |
|
re
turn false
;
|
|
|
310 |
|
|
|
|
311 |
|
// Get
the join
page of gi
ven field.
|
|
|
312 |
|
$src_j
p = $rows[
$field_ind
ex]['join_
page'];
|
|
|
313 |
|
$src_i
d = $rows[
$field_ind
ex]['ID'];
|
|
|
314 |
|
|
|
|
315 |
|
// Get
the join
page of fi
eld preced
ing the gi
ven one.
|
|
|
316 |
|
$dest_
jp = $rows
[$field_in
dex - 1]['
join_page'
];
|
|
|
317 |
|
$dest_
id = $rows
[$field_in
dex - 1]['
ID'];
|
|
|
318 |
|
|
|
|
319 |
|
// Thi
s is for p
revent gro
up interse
ction
|
|
|
320 |
|
if ( $
src_group_
fields_num
> 1 )
|
|
|
321 |
|
$s
rc_group_c
har = 'G';
|
|
|
322 |
|
else
|
|
|
323 |
|
$s
rc_group_c
har = ( $r
ows[$field
_index]['g
roup_mark'
] == '' ?
' ' : $row
s[$field_i
ndex]['gro
up_mark']
);
|
|
|
324 |
|
if ( $
dest_group
_fields_nu
m > 1 )
|
|
|
325 |
|
$d
est_group_
char = 'G'
;
|
|
|
326 |
|
else
|
|
|
327 |
|
$d
est_group_
char = ( $
rows[$fiel
d_index -
1]['group_
mark'] ==
'' ? ' ' :
$rows[$fi
eld_index
- 1]['grou
p_mark'] )
;
|
|
|
328 |
|
if ( $
dest_group
_char . $s
rc_group_c
har == 'GG
' && $rows
[$field_in
dex]['db_n
ame'] == $
rows[$fiel
d_index -
1]['db_nam
e'] )
|
|
|
329 |
|
{
|
|
|
330 |
|
$s
rc_group_c
har = ( $r
ows[$field
_index]['g
roup_mark'
] == '' ?
' ' : $row
s[$field_i
ndex]['gro
up_mark']
);
|
|
|
331 |
|
$d
est_group_
char = ( $
rows[$fiel
d_index -
1]['group_
mark'] ==
'' ? ' ' :
$rows[$fi
eld_index
- 1]['grou
p_mark'] )
;
|
|
|
332 |
|
}
|
|
|
333 |
|
|
|
|
334 |
|
switch
( $dest_g
roup_char
. $src_gro
up_char )
|
|
|
335 |
|
{
|
|
|
336 |
|
ca
se 'GG':
|
|
|
337 |
|
$border_
info['firs
t_start']
= $field_i
ndex - $de
st_group_f
ields_num;
|
|
|
338 |
|
$border_
info['firs
t_end'] =
$field_ind
ex - 1;
|
|
|
339 |
|
$border_
info['seco
nd_start']
= $field_
index;
|
|
|
340 |
|
$border_
info['seco
nd_end'] =
$field_in
dex + $src
_group_fie
lds_num -
1;
|
|
|
341 |
|
swap_gro
ups_jp( $r
ows, $bord
er_info );
|
|
|
342 |
|
break;
|
|
|
343 |
|
|
|
|
344 |
|
ca
se 'Gb':
|
|
|
345 |
|
$border_
info['firs
t_start']
= $field_i
ndex - $de
st_group_f
ields_num;
|
|
|
346 |
|
$border_
info['firs
t_end'] =
$field_ind
ex - 1;
|
|
|
347 |
|
$border_
info['seco
nd_start']
= $field_
index;
|
|
|
348 |
|
// Deter
mine index
of last f
ield in th
e row
|
|
|
349 |
|
$row_end
_index = $
field_inde
x + 1;
|
|
|
350 |
|
while (
$rows[$row
_end_index
]['group_m
ark'] != '
e' && $row
s[$row_end
_index]['g
roup_mark'
] != '' )
|
|
|
351 |
|
$row
_end_index
++;
|
|
|
352 |
|
if ( $ro
ws[$row_en
d_index]['
group_mark
'] == '' )
|
|
|
353 |
|
$row
_end_index
--;
|
|
|
354 |
|
$border_
info['seco
nd_end'] =
$row_end_
index;
|
|
|
355 |
|
swap_gro
ups_jp( $r
ows, $bord
er_info );
|
|
|
356 |
|
break;
|
|
|
357 |
|
|
|
|
358 |
|
ca
se 'eG':
|
|
|
359 |
|
// Deter
mine index
of last f
ield in th
e row
|
|
|
360 |
|
$row_sta
rt_index =
$field_in
dex - 2;
|
|
|
361 |
|
while (
$rows[$row
_start_ind
ex]['group
_mark'] !=
'b' && $r
ows[$row_s
tart_index
]['group_m
ark'] != '
' )
|
|
|
362 |
|
$row
_start_ind
ex--;
|
|
|
363 |
|
if ( $ro
ws[$row_st
art_index]
['group_ma
rk'] == ''
)
|
|
|
364 |
|
$row
_start_ind
ex++;
|
|
|
365 |
|
$border_
info['firs
t_start']
= $row_sta
rt_index;
|
|
|
366 |
|
$border_
info['firs
t_end'] =
$field_ind
ex - 1;
|
|
|
367 |
|
$border_
info['seco
nd_start']
= $field_
index;
|
|
|
368 |
|
$border_
info['seco
nd_end'] =
$field_in
dex + $src
_group_fie
lds_num -
1;
|
|
|
369 |
|
swap_gro
ups_jp( $r
ows, $bord
er_info );
|
|
|
370 |
|
break;
|
|
|
371 |
|
|
|
|
372 |
|
ca
se 'G ':
|
|
|
373 |
|
// Move
lower fiel
d up
|
|
|
374 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = ". $
rows[$fiel
d_index -
$dest_grou
p_fields_n
um]['join_
page'] ."
WHERE `ID`
= $src_id
";
|
|
|
375 |
|
db_res(
$query_str
);
|
|
|
376 |
|
for ($i
= $field_i
ndex - $de
st_group_f
ields_num;
$i < $fie
ld_index;
$i++)
|
|
|
377 |
|
{
|
|
|
378 |
|
// C
hange join
page of t
he current
field.
|
|
|
379 |
|
$que
ry_str = "
UPDATE `Pr
ofilesDesc
` SET `joi
n_page` =
". $rows[$
i + 1]['jo
in_page']
." WHERE `
ID` = ". $
rows[$i]['
ID'];
|
|
|
380 |
|
db_r
es( $query
_str );
|
|
|
381 |
|
}
|
|
|
382 |
|
break;
|
|
|
383 |
|
|
|
|
384 |
|
ca
se ' G':
|
|
|
385 |
|
// Move
upper fiel
d down
|
|
|
386 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = ". $
rows[$fiel
d_index +
$src_group
_fields_nu
m - 1]['jo
in_page']
." WHERE `
ID` = $des
t_id";
|
|
|
387 |
|
db_res(
$query_str
);
|
|
|
388 |
|
for ($i
= $field_i
ndex; $i <
$field_in
dex + $src
_group_fie
lds_num; $
i++)
|
|
|
389 |
|
{
|
|
|
390 |
|
// C
hange join
page of t
he current
field.
|
|
|
391 |
|
$que
ry_str = "
UPDATE `Pr
ofilesDesc
` SET `joi
n_page` =
". $rows[$
i - 1]['jo
in_page']
." WHERE `
ID` = ". $
rows[$i]['
ID'];
|
|
|
392 |
|
db_r
es( $query
_str );
|
|
|
393 |
|
}
|
|
|
394 |
|
break;
|
|
|
395 |
|
|
|
|
396 |
|
ca
se ' b':
|
|
|
397 |
|
// Deter
mine index
of last f
ield in th
e row
|
|
|
398 |
|
$row_end
_index = $
field_inde
x + 1;
|
|
|
399 |
|
while (
$rows[$row
_end_index
]['group_m
ark'] != '
e' && $row
s[$row_end
_index]['g
roup_mark'
] != '' )
|
|
|
400 |
|
$row
_end_index
++;
|
|
|
401 |
|
if ( $ro
ws[$row_en
d_index]['
group_mark
'] == '' )
|
|
|
402 |
|
$row
_end_index
--;
|
|
|
403 |
|
|
|
|
404 |
|
// Move
upper fiel
d down
|
|
|
405 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = ". $
rows[$row_
end_index]
['join_pag
e'] ." WHE
RE `ID` =
$dest_id";
|
|
|
406 |
|
db_res(
$query_str
);
|
|
|
407 |
|
for ($i
= $field_i
ndex; $i <
= $row_end
_index; $i
++)
|
|
|
408 |
|
{
|
|
|
409 |
|
// C
hange join
page of t
he current
field.
|
|
|
410 |
|
$que
ry_str = "
UPDATE `Pr
ofilesDesc
` SET `joi
n_page` =
". $rows[$
i - 1]['jo
in_page']
." WHERE `
ID` = ". $
rows[$i]['
ID'];
|
|
|
411 |
|
db_r
es( $query
_str );
|
|
|
412 |
|
}
|
|
|
413 |
|
|
|
|
414 |
|
break;
|
|
|
415 |
|
|
|
|
416 |
|
ca
se 'bc':
|
|
|
417 |
|
// Chang
e join pag
e for the
given fiel
d.
|
|
|
418 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $des
t_jp, `gro
up_mark` =
'b' WHERE
`ID` = $s
rc_id";
|
|
|
419 |
|
db_res(
$query_str
);
|
|
|
420 |
|
|
|
|
421 |
|
// Chang
e join pag
e for the
preceding
field.
|
|
|
422 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $src
_jp, `grou
p_mark` =
'c' WHERE
`ID` = $de
st_id";
|
|
|
423 |
|
db_res(
$query_str
);
|
|
|
424 |
|
|
|
|
425 |
|
break;
|
|
|
426 |
|
|
|
|
427 |
|
ca
se 'be':
|
|
|
428 |
|
// Chang
e join pag
e for the
given fiel
d.
|
|
|
429 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $des
t_jp, `gro
up_mark` =
'b' WHERE
`ID` = $s
rc_id";
|
|
|
430 |
|
db_res(
$query_str
);
|
|
|
431 |
|
|
|
|
432 |
|
// Chang
e join pag
e for the
preceding
field.
|
|
|
433 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $src
_jp, `grou
p_mark` =
'e' WHERE
`ID` = $de
st_id";
|
|
|
434 |
|
db_res(
$query_str
);
|
|
|
435 |
|
|
|
|
436 |
|
break;
|
|
|
437 |
|
|
|
|
438 |
|
ca
se 'ce':
|
|
|
439 |
|
// Chang
e join pag
e for the
given fiel
d.
|
|
|
440 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $des
t_jp, `gro
up_mark` =
'c' WHERE
`ID` = $s
rc_id";
|
|
|
441 |
|
db_res(
$query_str
);
|
|
|
442 |
|
|
|
|
443 |
|
// Chang
e join pag
e for the
preceding
field.
|
|
|
444 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $src
_jp, `grou
p_mark` =
'e' WHERE
`ID` = $de
st_id";
|
|
|
445 |
|
db_res(
$query_str
);
|
|
|
446 |
|
|
|
|
447 |
|
break;
|
|
|
448 |
|
|
|
|
449 |
|
ca
se 'e ':
|
|
|
450 |
|
// Deter
mine index
of last f
ield in th
e row
|
|
|
451 |
|
$row_sta
rt_index =
$field_in
dex - 2;
|
|
|
452 |
|
while (
$rows[$row
_start_ind
ex]['group
_mark'] !=
'b' && $r
ows[$row_s
tart_index
]['group_m
ark'] != '
' )
|
|
|
453 |
|
$row
_start_ind
ex--;
|
|
|
454 |
|
if ( $ro
ws[$row_st
art_index]
['group_ma
rk'] == ''
)
|
|
|
455 |
|
$row
_start_ind
ex++;
|
|
|
456 |
|
// Move
lower fiel
d up
|
|
|
457 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = ". $
rows[$row_
start_inde
x]['join_p
age'] ." W
HERE `ID`
= $src_id"
;
|
|
|
458 |
|
db_res(
$query_str
);
|
|
|
459 |
|
for ($i
= $row_sta
rt_index;
$i < $fiel
d_index; $
i++)
|
|
|
460 |
|
{
|
|
|
461 |
|
// C
hange join
page of t
he current
field.
|
|
|
462 |
|
$que
ry_str = "
UPDATE `Pr
ofilesDesc
` SET `joi
n_page` =
". $rows[$
i + 1]['jo
in_page']
." WHERE `
ID` = ". $
rows[$i]['
ID'];
|
|
|
463 |
|
db_r
es( $query
_str );
|
|
|
464 |
|
}
|
|
|
465 |
|
|
|
|
466 |
|
break;
|
|
|
467 |
|
|
|
|
468 |
|
ca
se ' ':
|
|
|
469 |
|
ca
se 'cc':
|
|
|
470 |
|
// Chang
e join pag
e for the
given fiel
d.
|
|
|
471 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $des
t_jp WHERE
`ID` = $s
rc_id";
|
|
|
472 |
|
db_res(
$query_str
);
|
|
|
473 |
|
|
|
|
474 |
|
// Chang
e join pag
e for the
preceding
field.
|
|
|
475 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $src
_jp WHERE
`ID` = $de
st_id";
|
|
|
476 |
|
db_res(
$query_str
);
|
|
|
477 |
|
}
|
|
|
478 |
|
|
|
|
479 |
|
return
true;
|
|
|
480 |
|
}
|
|
|
481 |
|
|
|
|
482 |
|
function m
ove_down(
$ID, $res
)
|
|
|
483 |
|
{
|
|
|
484 |
|
// Mak
e int from
ID
|
|
|
485 |
|
$ID =
(int) $ID;
|
|
|
486 |
|
|
|
|
487 |
|
// Col
lect field
s and dete
rmine whic
h of them
are group
|
|
|
488 |
|
$cnt =
0;
|
|
|
489 |
|
$total
_rows = my
sql_num_ro
ws( $res )
;
|
|
|
490 |
|
while
( $row = m
ysql_fetch
_array( $r
es ) )
|
|
|
491 |
|
{
|
|
|
492 |
|
$r
ows[$cnt]
= $row;
|
|
|
493 |
|
$f
name = get
_field_nam
e( $row );
|
|
|
494 |
|
$r
ows[$cnt][
'db_name']
= $fname;
|
|
|
495 |
|
$f
ield_group
s[$fname][
'count']++
;
|
|
|
496 |
|
if
( $row['I
D'] == $ID
)
|
|
|
497 |
|
$field_i
ndex = $cn
t;
|
|
|
498 |
|
$c
nt++;
|
|
|
499 |
|
}
|
|
|
500 |
|
|
|
|
501 |
|
// Num
ber of fie
lds in cur
rent group
|
|
|
502 |
|
$src_g
roup_field
s_num = $f
ield_group
s[$rows[$f
ield_index
]['db_name
']]['count
'];
|
|
|
503 |
|
// Num
ber of fie
lds in des
tination g
roup
|
|
|
504 |
|
$dest_
group_fiel
ds_num = $
field_grou
ps[$rows[$
field_inde
x + 1]['db
_name']]['
count'];
|
|
|
505 |
|
|
|
|
506 |
|
if ( $
field_inde
x == ($tot
al_rows -
1) )
|
|
|
507 |
|
re
turn false
;
|
|
|
508 |
|
|
|
|
509 |
|
// Get
the order
of the gi
ven field.
|
|
|
510 |
|
$src_j
p = $rows[
$field_ind
ex]['join_
page'];
|
|
|
511 |
|
$src_i
d = $rows[
$field_ind
ex]['ID'];
|
|
|
512 |
|
|
|
|
513 |
|
// Get
the order
of the fi
eld preced
ing the gi
ven one.
|
|
|
514 |
|
$dest_
jp = $rows
[$field_in
dex + 1]['
join_page'
];
|
|
|
515 |
|
$dest_
id = $rows
[$field_in
dex + 1]['
ID'];
|
|
|
516 |
|
|
|
|
517 |
|
// Thi
s is for p
revent gro
up interse
ction
|
|
|
518 |
|
if ( $
src_group_
fields_num
> 1 )
|
|
|
519 |
|
$s
rc_group_c
har = 'G';
|
|
|
520 |
|
else
|
|
|
521 |
|
$s
rc_group_c
har = ( $r
ows[$field
_index]['g
roup_mark'
] == '' ?
' ' : $row
s[$field_i
ndex]['gro
up_mark']
);
|
|
|
522 |
|
if ( $
dest_group
_fields_nu
m > 1 )
|
|
|
523 |
|
$d
est_group_
char = 'G'
;
|
|
|
524 |
|
else
|
|
|
525 |
|
$d
est_group_
char = ( $
rows[$fiel
d_index +
1]['group_
mark'] ==
'' ? ' ' :
$rows[$fi
eld_index
+ 1]['grou
p_mark'] )
;
|
|
|
526 |
|
if ( $
src_group_
char . $de
st_group_c
har == 'GG
' && $rows
[$field_in
dex]['db_n
ame'] == $
rows[$fiel
d_index +
1]['db_nam
e'] )
|
|
|
527 |
|
{
|
|
|
528 |
|
$s
rc_group_c
har = ( $r
ows[$field
_index]['g
roup_mark'
] == '' ?
' ' : $row
s[$field_i
ndex]['gro
up_mark']
);
|
|
|
529 |
|
$d
est_group_
char = ( $
rows[$fiel
d_index +
1]['group_
mark'] ==
'' ? ' ' :
$rows[$fi
eld_index
+ 1]['grou
p_mark'] )
;
|
|
|
530 |
|
}
|
|
|
531 |
|
|
|
|
532 |
|
switch
( $src_gr
oup_char .
$dest_gro
up_char )
|
|
|
533 |
|
{
|
|
|
534 |
|
ca
se 'GG':
|
|
|
535 |
|
$border_
info['firs
t_start']
= $field_i
ndex - $sr
c_group_fi
elds_num +
1;
|
|
|
536 |
|
$border_
info['firs
t_end'] =
$field_ind
ex;
|
|
|
537 |
|
$border_
info['seco
nd_start']
= $field_
index + 1;
|
|
|
538 |
|
$border_
info['seco
nd_end'] =
$field_in
dex + $des
t_group_fi
elds_num;
|
|
|
539 |
|
swap_gro
ups_jp( $r
ows, $bord
er_info );
|
|
|
540 |
|
break;
|
|
|
541 |
|
|
|
|
542 |
|
ca
se 'Gb':
|
|
|
543 |
|
$border_
info['firs
t_start']
= $field_i
ndex - $sr
c_group_fi
elds_num +
1;
|
|
|
544 |
|
$border_
info['firs
t_end'] =
$field_ind
ex;
|
|
|
545 |
|
$border_
info['seco
nd_start']
= $field_
index + 1;
|
|
|
546 |
|
// Deter
mine index
of last f
ield in th
e row
|
|
|
547 |
|
$row_end
_index = $
field_inde
x + 2;
|
|
|
548 |
|
while (
$rows[$row
_end_index
]['group_m
ark'] != '
e' && $row
s[$row_end
_index]['g
roup_mark'
] != '' )
|
|
|
549 |
|
$row
_end_index
++;
|
|
|
550 |
|
if ( $ro
ws[$row_en
d_index]['
group_mark
'] == '' )
|
|
|
551 |
|
$row
_end_index
--;
|
|
|
552 |
|
$border_
info['seco
nd_end'] =
$row_end_
index;
|
|
|
553 |
|
swap_gro
ups_jp( $r
ows, $bord
er_info );
|
|
|
554 |
|
break;
|
|
|
555 |
|
|
|
|
556 |
|
ca
se 'eG':
|
|
|
557 |
|
// Deter
mine index
of last f
ield in th
e row
|
|
|
558 |
|
$row_sta
rt_index =
$field_in
dex - 1;
|
|
|
559 |
|
while (
$rows[$row
_start_ind
ex]['group
_mark'] !=
'b' && $r
ows[$row_s
tart_index
]['group_m
ark'] != '
' )
|
|
|
560 |
|
$row
_start_ind
ex--;
|
|
|
561 |
|
if ( $ro
ws[$row_st
art_index]
['group_ma
rk'] == ''
)
|
|
|
562 |
|
$row
_start_ind
ex++;
|
|
|
563 |
|
$border_
info['firs
t_start']
= $row_sta
rt_index;
|
|
|
564 |
|
$border_
info['firs
t_end'] =
$field_ind
ex;
|
|
|
565 |
|
$border_
info['seco
nd_start']
= $field_
index + 1;
|
|
|
566 |
|
$border_
info['seco
nd_end'] =
$field_in
dex + $des
t_group_fi
elds_num;
|
|
|
567 |
|
swap_gro
ups_jp( $r
ows, $bord
er_info );
|
|
|
568 |
|
break;
|
|
|
569 |
|
|
|
|
570 |
|
ca
se 'G ':
|
|
|
571 |
|
// Move
lower fiel
d up
|
|
|
572 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = ". $
rows[$fiel
d_index -
$src_group
_fields_nu
m + 1]['jo
in_page']
." WHERE `
ID` = $des
t_id";
|
|
|
573 |
|
db_res(
$query_str
);
|
|
|
574 |
|
for ($i
= $field_i
ndex - $sr
c_group_fi
elds_num +
1; $i <=
$field_ind
ex; $i++)
|
|
|
575 |
|
{
|
|
|
576 |
|
// C
hange join
page of t
he current
field.
|
|
|
577 |
|
$que
ry_str = "
UPDATE `Pr
ofilesDesc
` SET `joi
n_page` =
". $rows[$
i + 1]['jo
in_page']
." WHERE `
ID` = ". $
rows[$i]['
ID'];
|
|
|
578 |
|
db_r
es( $query
_str );
|
|
|
579 |
|
}
|
|
|
580 |
|
break;
|
|
|
581 |
|
|
|
|
582 |
|
ca
se ' G':
|
|
|
583 |
|
// Move
upper fiel
d down
|
|
|
584 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = ". $
rows[$fiel
d_index +
$dest_grou
p_fields_n
um]['join_
page'] ."
WHERE `ID`
= $src_id
";
|
|
|
585 |
|
db_res(
$query_str
);
|
|
|
586 |
|
for ($i
= $field_i
ndex + 1;
$i <= $fie
ld_index +
$dest_gro
up_fields_
num; $i++)
|
|
|
587 |
|
{
|
|
|
588 |
|
// C
hange join
page of t
he current
field.
|
|
|
589 |
|
$que
ry_str = "
UPDATE `Pr
ofilesDesc
` SET `joi
n_page` =
". $rows[$
i - 1]['jo
in_page']
." WHERE `
ID` = ". $
rows[$i]['
ID'];
|
|
|
590 |
|
db_r
es( $query
_str );
|
|
|
591 |
|
}
|
|
|
592 |
|
break;
|
|
|
593 |
|
|
|
|
594 |
|
ca
se ' b':
|
|
|
595 |
|
// Deter
mine index
of last f
ield in th
e row
|
|
|
596 |
|
$row_end
_index = $
field_inde
x + 2;
|
|
|
597 |
|
while (
$rows[$row
_end_index
]['group_m
ark'] != '
e' && $row
s[$row_end
_index]['g
roup_mark'
] != '' )
|
|
|
598 |
|
$row
_end_index
++;
|
|
|
599 |
|
if ( $ro
ws[$row_en
d_index]['
group_mark
'] == '' )
|
|
|
600 |
|
$row
_end_index
--;
|
|
|
601 |
|
|
|
|
602 |
|
// Move
upper fiel
d down
|
|
|
603 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = ". $
rows[$row_
end_index]
['join_pag
e'] ." WHE
RE `ID` =
$src_id";
|
|
|
604 |
|
db_res(
$query_str
);
|
|
|
605 |
|
for ($i
= $field_i
ndex + 1;
$i <= $row
_end_index
; $i++)
|
|
|
606 |
|
{
|
|
|
607 |
|
// C
hange join
page of t
he current
field.
|
|
|
608 |
|
$que
ry_str = "
UPDATE `Pr
ofilesDesc
` SET `joi
n_page` =
". $rows[$
i - 1]['jo
in_page']
." WHERE `
ID` = ". $
rows[$i]['
ID'];
|
|
|
609 |
|
db_r
es( $query
_str );
|
|
|
610 |
|
}
|
|
|
611 |
|
|
|
|
612 |
|
break;
|
|
|
613 |
|
|
|
|
614 |
|
ca
se 'bc':
|
|
|
615 |
|
// Chang
e join pag
e for the
given fiel
d.
|
|
|
616 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $des
t_jp, `gro
up_mark` =
'c' WHERE
`ID` = $s
rc_id";
|
|
|
617 |
|
db_res(
$query_str
);
|
|
|
618 |
|
|
|
|
619 |
|
// Chang
e join pag
e for the
following
field.
|
|
|
620 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $src
_jp, `grou
p_mark` =
'b' WHERE
`ID` = $de
st_id";
|
|
|
621 |
|
db_res(
$query_str
);
|
|
|
622 |
|
|
|
|
623 |
|
break;
|
|
|
624 |
|
|
|
|
625 |
|
ca
se 'be':
|
|
|
626 |
|
// Chang
e join pag
e for the
given fiel
d.
|
|
|
627 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $des
t_jp, `gro
up_mark` =
'e' WHERE
`ID` = $s
rc_id";
|
|
|
628 |
|
db_res(
$query_str
);
|
|
|
629 |
|
|
|
|
630 |
|
// Chang
e join pag
e for the
following
field.
|
|
|
631 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $src
_jp, `grou
p_mark` =
'b' WHERE
`ID` = $de
st_id";
|
|
|
632 |
|
db_res(
$query_str
);
|
|
|
633 |
|
|
|
|
634 |
|
break;
|
|
|
635 |
|
|
|
|
636 |
|
ca
se 'ce':
|
|
|
637 |
|
// Chang
e join pag
e for the
given fiel
d.
|
|
|
638 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $des
t_jp, `gro
up_mark` =
'e' WHERE
`ID` = $s
rc_id";
|
|
|
639 |
|
db_res(
$query_str
);
|
|
|
640 |
|
|
|
|
641 |
|
// Chang
e join pag
e for the
following
field.
|
|
|
642 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $src
_jp, `grou
p_mark` =
'c' WHERE
`ID` = $de
st_id";
|
|
|
643 |
|
db_res(
$query_str
);
|
|
|
644 |
|
|
|
|
645 |
|
break;
|
|
|
646 |
|
|
|
|
647 |
|
ca
se 'e ':
|
|
|
648 |
|
// Deter
mine index
of last f
ield in th
e row
|
|
|
649 |
|
$row_sta
rt_index =
$field_in
dex - 1;
|
|
|
650 |
|
while (
$rows[$row
_start_ind
ex]['group
_mark'] !=
'b' && $r
ows[$row_s
tart_index
]['group_m
ark'] != '
' )
|
|
|
651 |
|
$row
_start_ind
ex--;
|
|
|
652 |
|
if ( $ro
ws[$row_st
art_index]
['group_ma
rk'] == ''
)
|
|
|
653 |
|
$row
_start_ind
ex++;
|
|
|
654 |
|
|
|
|
655 |
|
// Move
lower fiel
d up
|
|
|
656 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = ". $
rows[$row_
start_inde
x]['join_p
age'] ." W
HERE `ID`
= $dest_id
";
|
|
|
657 |
|
db_res(
$query_str
);
|
|
|
658 |
|
for ($i
= $row_sta
rt_index;
$i <= $fie
ld_index;
$i++)
|
|
|
659 |
|
{
|
|
|
660 |
|
// C
hange join
page of t
he current
field.
|
|
|
661 |
|
$que
ry_str = "
UPDATE `Pr
ofilesDesc
` SET `joi
n_page` =
". $rows[$
i + 1]['jo
in_page']
." WHERE `
ID` = ". $
rows[$i]['
ID'];
|
|
|
662 |
|
db_r
es( $query
_str );
|
|
|
663 |
|
}
|
|
|
664 |
|
|
|
|
665 |
|
break;
|
|
|
666 |
|
|
|
|
667 |
|
ca
se ' ':
|
|
|
668 |
|
ca
se 'cc':
|
|
|
669 |
|
// Chang
e join pag
e for the
given fiel
d.
|
|
|
670 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $des
t_jp WHERE
`ID` = $s
rc_id";
|
|
|
671 |
|
db_res(
$query_str
);
|
|
|
672 |
|
|
|
|
673 |
|
// Chang
e join pag
e for the
following
field.
|
|
|
674 |
|
$query_s
tr = "UPDA
TE `Profil
esDesc` SE
T `join_pa
ge` = $src
_jp WHERE
`ID` = $de
st_id";
|
|
|
675 |
|
db_res(
$query_str
);
|
|
|
676 |
|
}
|
|
|
677 |
|
|
|
|
678 |
|
return
true;
|
|
|
679 |
|
}
|
|
|
680 |
|
|
|
|
681 |
|
/**
|
|
|
682 |
|
* Swap jo
in form or
der of two
field gro
ups
|
|
|
683 |
|
* @param
$field_buf
fer - arra
y of field
s in forma
t [$index]
['value']
|
|
|
684 |
|
* @param
$border_in
fo - info
about fiel
d groups b
orders
|
|
|
685 |
|
* $b
order_info
['first_st
art'] - st
art of fir
st group
|
|
|
686 |
|
* $b
order_info
['first_en
d'] - end
of first g
roup
|
|
|
687 |
|
* $b
order_info
['second_s
tart'] - s
tart of se
cond group
|
|
|
688 |
|
* $b
order_info
['second_e
nd'] - end
of second
group
|
|
|
689 |
|
* WA
RNING!!! $
border_inf
o['first_e
nd'] + 1 =
$border_i
nfo['secon
d_start']
|
|
|
690 |
|
*/
|
|
|
691 |
|
function s
wap_groups
_jp( $fiel
d_buffer,
$border_in
fo )
|
|
|
692 |
|
{
|
|
|
693 |
|
// Fir
st swap ac
tion
|
|
|
694 |
|
$offse
t = 0;
|
|
|
695 |
|
for ($
i = $borde
r_info['se
cond_start
']; $i <=
$border_in
fo['second
_end']; $i
++)
|
|
|
696 |
|
{
|
|
|
697 |
|
//
Get the j
oin page o
f the give
n field.
|
|
|
698 |
|
$s
rc_jp = $f
ield_buffe
r[$border_
info['firs
t_start']
+ $offset]
['join_pag
e'];
|
|
|
699 |
|
|
|
|
700 |
|
//
Get the j
oin page o
f the fiel
d precedin
g the give
n one.
|
|
|
701 |
|
$d
est_id = $
field_buff
er[$i]['ID
'];
|
|
|
702 |
|
|
|
|
703 |
|
//
Change or
der for th
e given fi
eld.
|
|
|
704 |
|
$q
uery_str =
"UPDATE `
ProfilesDe
sc` SET `j
oin_page`
= $src_jp
WHERE `ID`
= $dest_i
d";
|
|
|
705 |
|
db
_res( $que
ry_str );
|
|
|
706 |
|
|
|
|
707 |
|
$o
ffset++;
|
|
|
708 |
|
}
|
|
|
709 |
|
|
|
|
710 |
|
// Sec
ond swap a
ction
|
|
|
711 |
|
$offse
t = $borde
r_info['se
cond_end']
- $border
_info['sec
ond_start'
] - $borde
r_info['fi
rst_end']
+ $border_
info['firs
t_start'];
|
|
|
712 |
|
for ($
i = $borde
r_info['fi
rst_start'
]; $i <= $
border_inf
o['first_e
nd']; $i++
)
|
|
|
713 |
|
{
|
|
|
714 |
|
//
Get the o
rder of th
e given fi
eld.
|
|
|
715 |
|
$s
rc_jp = $f
ield_buffe
r[$border_
info['seco
nd_start']
+ $offset
]['join_pa
ge'];
|
|
|
716 |
|
|
|
|
717 |
|
//
Get the o
rder of th
e field pr
eceding th
e given on
e.
|
|
|
718 |
|
$d
est_id = $
field_buff
er[$i]['ID
'];
|
|
|
719 |
|
|
|
|
720 |
|
//
Change or
der for th
e given fi
eld.
|
|
|
721 |
|
$q
uery_str =
"UPDATE `
ProfilesDe
sc` SET `j
oin_page`
= $src_jp
WHERE `ID`
= $dest_i
d";
|
|
|
722 |
|
db
_res( $que
ry_str );
|
|
|
723 |
|
|
|
|
724 |
|
$o
ffset++;
|
|
|
725 |
|
}
|
|
|
726 |
|
|
|
|
727 |
|
}
|
|
|
728 |
|
|
|
|
729 |
|
?>
|
|
|