Specifications

PA-001011-03-04 Aastra July 2014
193
# Adjust with the style
switch($style)
{
case 'none':
case 'radio':
$length--;
break;
default:
$length-=4;
break;
}
# Unbreakable space
$nbsp=chr(0xa0);
# Pad the the first line with regular spaces
switch($mode)
{
case 'center':
$line=str_pad($line1,$length-1-$offset,$char,STR_PAD_BOTH);
break;
case 'right':
$line=str_pad($line1,$length-1-$offset,$char,STR_PAD_LEFT);
break;
default:
$line=str_pad($line1,$length-1-$offset,$char,STR_PAD_RIGHT);
break;
}
# Crop the line to the correct length (-1 for wrap-space)
$line=substr($line,0,($length-1-$offset));
# Append a space so it can wrap to line two, and two non-break spaces to pad below
the icon
if($line2!='')
{
$line.=' '.str_repeat($nbsp,$offset);
switch($mode)
{
case 'center':
if($char==chr(0xa0)) $line.=str_repeat($char,($length-
$offset-strlen($line2))/2).$line2;
else $line.=str_pad($line2,$length-$offset-
1,$char,STR_PAD_BOTH);
break;
case 'right':
$line.=str_repeat($char,$length-$offset-
strlen($line2)+1).$line2;
break;
default:
$line.=$line2;
break;
}
}
# Return formatted prompt
return($line);
}
Parameters
line1 string to be displayed on line 1
line2 string to be displayed on line 2 (can be empty)
style TextMenu style (none/numbered/radio)
offset Integer represents the offset for the second line (size of the icon)
char Character to use for the padding, space is supported.