I found this post http://xataface.com/forum/viewtopic.php?t=5169#25151 about a function in the condition for an action :
shannah wrote:Your condition can actually call any php function. So you can define your own function to check this and refer to the function from your condition.
e.g.
In one of your included files:
- Code: Select all
function containsEmailField($table){
....
}
In your condition directive in the actions.ini file:
- Code: Select all
condition="containsEmailField($query['-table'])"
Well I put a function in the delegate class inside the table then in the Delegate class but it seems not being taken into account. I tried all kinds of test but without solving it.
my function is :
- Code: Select all
function quelGroupe(){
$user = $this->getUser();
$groupe=$user->val('groupe');
return $groupe;
}
function belongsTo ($grp){
$auth =& Dataface_AuthenticationTool::getInstance();
$user = $auth->getLoggedInUser();
$groupe=quelGroupe();
//ie like 11_10
if (stripos($groupe,'_')){
$groupes=explode('_',$groupe);
foreach ($groupes as $val){
if ($val==$grp){
return TRUE;
}
}
}
else {
if ($grp==$groupe){
return TRUE;
}
}
return FALSE;
}
In the actions.ini inside the table I have :
- Code: Select all
[mial]
label = "MIAL"
category = table_tabs
url = "{$this->url('id_lieu=11')}"
condition="belongsTo(11)"
mode = list
permission = list
My aim is to have profiles for users so that I can display an action according to a value in the users table.
I hope I'm clear ;=)
Thank you
Jean