';
foreach ($compare_methods as $i => $compare_method)
{
$output .= '';
}
$output .= '';
// continue with next step
return array(EVT_CONTINUE, $output);
// Second step: enter a value to compare the varchar to
case 1:
// Use $name to make sure the name of the input element is unique
// a varchar shouldn't be longer than 255 characters
$output = ' ';
if ($options[0] == 0)
{
$output .= ' ' . $user->lang['REGEXP'] . ' ';
}
// this was the last input element
return array(EVT_DONE, $output);
}
}
/**
* Outputs the stored option for the (num)th step in condition creation
*
* @param int $num is the number of the current part of the condition,
* ranging from 0 until the number for which this function returns array(EVT_DONE, output)
*
* @param string $name is a unique identifier which is used for form
* elements in order to allow the use of one condition type multiple times
* per event
*
* @param array $options contains all options collected in the previous steps
*/
function display($num, $options)
{
global $user;
switch ($num)
{
// First step: Display the compare method
case 0:
$compare_methods = &evc_varchar_compare();
// continue with next step
return array(EVT_CONTINUE, $compare_methods[$options[0]]);
// Second step: display the compare string
case 1:
$output = $options[1]['string'];
if ($options[0] == 0 && $options[1]['regexp'])
{
$output .= ' ' . $user->lang['REGEXP'] . '';
}
// this was the last input element
return array(EVT_DONE, $output);
}
}
/**
* Return the option which shall be stored for the (num)th step, read from $_REQUEST
*/
function retrieve_options($num, $name, $options)
{
switch ($num)
{
// First step: get the compare method
case 0:
$compare_method = request_var('compare_varchar_' . $name, 0);
$compare_methods = &evc_varchar_compare();
if (!isset($compare_methods[$compare_method]))
{
global $user;
return array(EVT_ERROR, $user->lang['NO_COMPARE_METHOD']);
}
return array(EVT_CONTINUE, $compare_method);
// Second step: get the string we compare to
case 1:
$string = request_var('compare_varchar_to_' . $name, '');
$regexp = request_var('compare_varchar_regexp_' . $name, false);
return array(EVT_DONE, array('string' => $string, 'regexp' => $regexp));
}
}
}
?>