Hi, guys:
Sometime they can really confuse me.
I have a project that is based on Scriptcase and do a lot of things for the developers, so they can easily develop projects based on mine.
The more less code is best, so I want they hide btns like the sc_field_disabled function, which runs like this:
sc_field_disabled("field1;field2;field3");
So I create some functions to hide btns, and make field readonly, they all works, like that:
function _my_field_readonly($fields)
{
$arrFields = split(";", $fields);
foreach($arrFields as $fld){
$fld = trim($fld);
sc_field_readonly({$fld});
}
}
NOTE: you can use _my_field_readonly("field1;field2;field3") to finish that.
AND the BUTTONS:
function _my_btn_display($btns, $show=0)
{
$arrBtns = split(";", $btns);
foreach($arrBtns as $btn){
$btn = trim($btn);
if($show){
sc_btn_display('$btn', 'on');
}else{
sc_btn_display('$btn', 'off');
}
}
}
You can call like this: _my_btn_display("new;delete;update");
That's good for the end user because they could do several things in a single code.
And what make me angry is this:
function _my_field_display($fields)
{
$arrFields = split(";", $fields);
foreach($arrFields as $fld){
sc_field_display({$fld}, off);
}
}
And it's really fucked me, because this CANNOT WORK!
In fact, the end user can just call the sc_field_display({myfield}, off) to finish the field hiding, but that's really annoying for me.
Could I make the _my_field_display run?