Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F804645
configuration_tag_processor.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 26, 3:15 PM
Size
3 KB
Mime Type
text/x-php
Expires
Fri, Feb 28, 3:15 PM (16 h, 14 m)
Engine
blob
Format
Raw Data
Handle
577117
Attached To
rINP In-Portal
configuration_tag_processor.php
View Options
<?php
class
ConfigurationTagProcessor
extends
kDBTagProcessor
{
function
PrintList
(
$params
)
{
$params
[
'per_page'
]
=
-
1
;
$list
=&
$this
->
Application
->
recallObject
(
$this
->
getPrefixSpecial
(),
$this
->
Prefix
.
'_List'
,
$params
);
$id_field
=
$this
->
Application
->
getUnitOption
(
$this
->
Prefix
,
'IDField'
);
if
(
!(
$list
->
OriginalParams
==
$params
)
)
{
$this
->
Application
->
removeObject
(
$this
->
getPrefixSpecial
());
$list
=&
$this
->
Application
->
recallObject
(
$this
->
getPrefixSpecial
(),
$this
->
Prefix
.
'_List'
,
$params
);
}
$list
->
PerPage
=
-
1
;
$list
->
Query
();
$o
=
''
;
$list
->
GoFirst
();
$block_params
=
$this
->
prepareTagParams
(
$params
);
$block_params
[
'name'
]=
$params
[
'block'
];
$block_params
[
'pass_params'
]=
'true'
;
$block_params
[
'IdField'
]
=
$id_field
;
$next_block
=
$params
[
'full_block'
];
$prev_title
=
""
;
while
(!
$list
->
EOL
())
{
$nextItemPrompt
=
$list
->
Records
[
$list
->
CurrentIndex
+
1
][
'prompt'
];
$thisItemPrompt
=
$list
->
Records
[
$list
->
CurrentIndex
][
'prompt'
];
$this_title
=
$list
->
Records
[
$list
->
CurrentIndex
][
'heading'
];
if
(
$this_title
!=
$prev_title
){
$prev_title
=
$this_title
;
$section_header_params
=
array
();
$section_header_params
[
'name'
]=
'config_section_header'
;
$section_header_params
[
'title'
]=
$this
->
Application
->
Phrase
(
$this_title
);
$o
.=
$this
->
Application
->
ParseBlock
(
$section_header_params
,
1
);
}
if
(
$nextItemPrompt
==
$thisItemPrompt
){
$curr_block
=
$params
[
'half_block1'
];
$next_block
=
$params
[
'half_block2'
];
}
else
{
$curr_block
=
$next_block
;
$next_block
=
$params
[
'full_block'
];
}
$block_params
[
'name'
]=
$curr_block
;
$this
->
Application
->
SetVar
(
$this
->
getPrefixSpecial
().
'_id'
,
$list
->
GetDBField
(
$id_field
)
);
$o
.=
$this
->
Application
->
ParseBlock
(
$block_params
,
1
);
$list
->
GoNext
();
}
return
$o
;
}
function
PrintConfList
(
$params
){
$list
=&
$this
->
Application
->
recallObject
(
$this
->
getPrefixSpecial
(),
$this
->
Prefix
.
'_List'
,
$params
);
$id_field
=
$this
->
Application
->
getUnitOption
(
$this
->
Prefix
,
'IDField'
);
$list
->
PerPage
=-
1
;
$list
->
Query
();
$o
=
''
;
$list
->
GoFirst
();
$tmp_row
=
array
();
while
(!
$list
->
EOL
())
{
$rec
=
$list
->
getCurrentRecord
();
$tmp_row
[
0
][
$rec
[
'VariableName'
]]=
$rec
[
'VariableValue'
];
$tmp_row
[
0
][
'prompt'
]=
$rec
[
'prompt'
];
$list
->
GoNext
();
}
$list
->
Records
=
$tmp_row
;
$block_params
=
$this
->
prepareTagParams
(
$params
);
$block_params
[
'name'
]=
$params
[
'block'
];
$list
->
GoFirst
();
return
$this
->
Application
->
ParseBlock
(
$block_params
,
1
);
}
function
GetToEnv
(
$params
){
$vars
=
explode
(
','
,
$params
[
'vars'
]);
foreach
(
$vars
as
$key
=>
$var
){
$val
=
$this
->
Application
->
GetVar
(
$var
);
if
(
$val
)
{
$this
->
Application
->
SetVar
(
"conf_"
.
$var
,
$this
->
myUrlEncode
(
$val
));
}
}
}
function
myUrlDecode
(
$str
){
$str
=
str_replace
(
';'
,
':'
,
$str
);
$str
=
str_replace
(
'!'
,
'-'
,
$str
);
return
$str
;
}
function
myUrlEncode
(
$str
){
$str
=
str_replace
(
'-'
,
'!'
,
$str
);
$str
=
str_replace
(
':'
,
';'
,
$str
);
return
$str
;
}
function
ConfigValue
(
$params
){
return
$this
->
Application
->
ConfigValue
(
$params
[
'name'
]);
}
function
Error
(
$params
)
{
$object
=&
$this
->
Application
->
recallObject
(
$this
->
getPrefixSpecial
()
);
$field
=
$object
->
GetDBField
(
$params
[
'id_field'
]);
$errors
=
$this
->
Application
->
GetVar
(
'errormsgs'
);
$errors
=
$errors
[
$this
->
getPrefixSpecial
()];
if
(
isset
(
$errors
[
$field
])){
$msg
=
$this
->
Application
->
Phrase
(
$errors
[
$field
]);
}
else
{
$msg
=
''
;
}
return
$msg
;
}
}
?>
Event Timeline
Log In to Comment