BpNode: rendering

This commit is contained in:
Thomas Gelf 2014-11-30 11:57:47 +01:00
parent 057d99cab5
commit dad4b991ea

View file

@ -190,4 +190,43 @@ class BpNode extends Node
}
return $this->children;
}
protected function assertNumericOperator()
{
if (! is_numeric($this->operator)) {
// TODO: ConfigurationError
throw new Exception(
sprintf(
'Got invalid operator: %s',
$this->operator
)
);
}
}
public function renderLink($view)
{
if (! $this->bp->isEditMode()) {
return parent::renderLink($view);
}
return $view->qlink($this->name, 'bpapp/node/edit', array(
'node' => $this->name
));
}
public function operatorHtml()
{
switch ($this->operator) {
case self::OP_AND:
return 'and';
break;
case self::OP_OR:
return 'or';
break;
default:
// MIN
$this->assertNumericOperator();
return 'min:' . $this->operator;
}
}
}