Back
overrideFunction
Programming
overrideFunction
Name of function used to modify globally phpLens settings
Default:
Sometimes you want to implement a function that modifies phpLens settings before the $lens object is rendered. This is typically for global settings on security, table colors, etc. But Generate PHP Code will always overwrite this global security function.

This property makes the global function part of the Generate PHP Code process, simplifying your code.

The function is called after the phpLens dynamic editor settings are retrieved, so it will override any settings configured using the dynamic editor.

Syntax
$lens->overrideFunction = 'SetSecurity';

An Example

// remember $lens is by reference!
function SetSecurity(&$lens)
{
$global $isAdmin;
  if ($isAdmin) {
    $lens->dynEdit = 1;
    $lens->menuHide = '';
  } else {
    $lens->dynEdit = 0;
    $lens->menuHide = 'ALL';
  }
}

$lens = new phpLens($db,'select * from table');
$lens->overrideFunction = 'SetSecurity';
// Now the next line is autogenerated by Generate PHP Code
SetSecurity($lens);
$lens->Render();
$lens->Close();

 Basic:Yes  Advanced/Enterprise:Yes  DynamicEdit:Yes   [Version 1.0]