loadData($dn)) { $config = LSconfig :: get('LSobjects.'.$LSobject.'.customActions.'.$customAction); if (isset($config['function']) && is_callable($config['function'])) { if (isset($config['label'])) { $title=__($config['label']); } else { $title=__($customAction); } if (isset($_GET['valid']) || $config['noConfirmation']) { $objectname=$object -> getDisplayName(); LStemplate :: assign('pagetitle',$title.' : '.$objectname); if (call_user_func_array($config['function'],array(&$object))) { if ($config['disableOnSuccessMsg']!=true) { if ($config['onSuccessMsgFormat']) { LSsession :: addInfo(getFData(__($config['onSuccessMsgFormat']),$objectname)); } else { LSsession :: addInfo(getFData(_('The custom action %{customAction} have been successfully execute on %{objectname}.'),array('objectname' => $objectname,'customAction' => $customAction))); } } if ($config['redirectToObjectList']) { LSsession :: redirect('view.php?LSobject='.$LSobject.'&refresh'); } else if (!isset($config['noRedirect']) || !$config['noRedirect']) { LSsession :: redirect('view.php?LSobject='.$LSobject.'&dn='.urlencode($dn)); } } else { LSerror :: addErrorCode('LSldapObject_31',array('objectname' => $objectname,'customAction' => $customAction)); } } else { $objectname=$object -> getDisplayName(); $question=( isset($config['question_format'])? getFData(__($config['question_format']),$objectname): getFData( _('Do you really want to execute custom action %{customAction} on %{objectname} ?'), array( 'objectname' => $objectname, 'customAction' => $customAction ) ) ); LStemplate :: assign('pagetitle',$title.' : '.$objectname); LStemplate :: assign('question',$question); LStemplate :: assign('validation_url','custom_action.php?LSobject='.urlencode($LSobject).'&dn='.urlencode($dn).'&customAction='.urlencode($customAction).'&valid'); LStemplate :: assign('validation_label',_('Validate')); LSsession :: setTemplate('question.tpl'); } } else { LSerror :: addErrorCode('LSsession_13'); } } else { LSerror :: addErrorCode('LSsession_12'); } } else { LSerror :: addErrorCode('LSsession_11'); } } else { LSerror :: addErrorCode('LSldapObject_01'); } } else { LSerror :: addErrorCode('LSsession_12'); } } else { LSsession :: setTemplate('login.tpl'); } // Affichage des retours d'erreurs LSsession :: displayTemplate();