action) { return $this->doTree(); } $this->printHeader(); $this->printBody(); switch ($this->action) { /*case 'save_create': if (isset($_POST['cancel'])) { $this->doDefault(); } else { $this->doSaveCreate(); } break; case 'create': $this->doCreate(); break;*/ case 'drop': if (isset($_POST['cancel'])) { $this->doDefault(); } else { $this->doDrop(false); } break; case 'confirm_drop': $this->doDrop(true); break; case 'properties': $this->doProperties(); break; default: $this->doDefault(); break; } $this->printFooter(); } /** * Generate XML for the browser tree. */ public function doTree() { $data = $this->misc->getDatabaseAccessor(); $operators = $data->getOperators(); // Operator prototype: "type operator type" $proto = Decorator::concat(Decorator::field('oprleftname'), ' ', Decorator::field('oprname'), ' ', Decorator::field('oprrightname')); $reqvars = $this->misc->getRequestVars('operator'); $attrs = [ 'text' => $proto, 'icon' => 'Operator', 'toolTip' => Decorator::field('oprcomment'), 'action' => Decorator::actionurl( 'operators', $reqvars, [ 'action' => 'properties', 'operator' => $proto, 'operator_oid' => Decorator::field('oid'), ] ), ]; return $this->printTree($operators, $attrs, 'operators'); } /** * Show default list of operators in the database. * * @param mixed $msg */ public function doDefault($msg = '') { $data = $this->misc->getDatabaseAccessor(); $this->printTrail('schema'); $this->printTabs('schema', 'operators'); $this->printMsg($msg); $operators = $data->getOperators(); $columns = [ 'operator' => [ 'title' => $this->lang['stroperator'], 'field' => Decorator::field('oprname'), 'url' => "operators?action=properties&{$this->misc->href}&", 'vars' => ['operator' => 'oprname', 'operator_oid' => 'oid'], ], 'leftarg' => [ 'title' => $this->lang['strleftarg'], 'field' => Decorator::field('oprleftname'), ], 'rightarg' => [ 'title' => $this->lang['strrightarg'], 'field' => Decorator::field('oprrightname'), ], 'returns' => [ 'title' => $this->lang['strreturns'], 'field' => Decorator::field('resultname'), ], 'actions' => [ 'title' => $this->lang['stractions'], ], 'comment' => [ 'title' => $this->lang['strcomment'], 'field' => Decorator::field('oprcomment'), ], ]; $actions = [ 'drop' => [ // 'title' => $this->lang['strdrop'], // 'url' => "operators?action=confirm_drop&{$this->misc->href}&", // 'vars' => array('operator' => 'oprname', 'operator_oid' => 'oid'), 'content' => $this->lang['strdrop'], 'attr' => [ 'href' => [ 'url' => 'operators', 'urlvars' => [ 'action' => 'confirm_drop', 'operator' => Decorator::field('oprname'), 'operator_oid' => Decorator::field('oid'), ], ], ], ], ]; echo $this->printTable($operators, $columns, $actions, 'operators-operators', $this->lang['strnooperators']); // TODO operators action=create $this->lang['strcreateoperator'] } /** * Show read only properties for an operator. * * @param mixed $msg */ public function doProperties($msg = '') { $data = $this->misc->getDatabaseAccessor(); $this->printTrail('operator'); $this->printTitle($this->lang['strproperties'], 'pg.operator'); $this->printMsg($msg); $oprdata = $data->getOperator($_REQUEST['operator_oid']); $oprdata->fields['oprcanhash'] = $data->phpBool($oprdata->fields['oprcanhash']); if ($oprdata->recordCount() > 0) { echo '
{$this->lang['strname']} | ".PHP_EOL; echo '', $this->misc->printVal($oprdata->fields['oprname']), ' |
---|---|
{$this->lang['strleftarg']} | ".PHP_EOL; echo '', $this->misc->printVal($oprdata->fields['oprleftname']), ' |
{$this->lang['strrightarg']} | ".PHP_EOL; echo '', $this->misc->printVal($oprdata->fields['oprrightname']), ' |
{$this->lang['strcommutator']} | ".PHP_EOL; echo '', $this->misc->printVal($oprdata->fields['oprcom']), ' |
{$this->lang['strnegator']} | ".PHP_EOL; echo '', $this->misc->printVal($oprdata->fields['oprnegate']), ' |
{$this->lang['strjoin']} | ".PHP_EOL; echo '', $this->misc->printVal($oprdata->fields['oprjoin']), ' |
{$this->lang['strhashes']} | ".PHP_EOL; echo '', ($oprdata->fields['oprcanhash']) ? $this->lang['stryes'] : $this->lang['strno'], ' |
{$this->lang['strmerges']} | ".PHP_EOL; echo '', ('0' !== $oprdata->fields['oprlsortop'] && '0' !== $oprdata->fields['oprrsortop']) ? $this->lang['stryes'] : $this->lang['strno'], ' |
{$this->lang['strrestrict']} | ".PHP_EOL; echo '', $this->misc->printVal($oprdata->fields['oprrest']), ' |
{$this->lang['strleftsort']} | ".PHP_EOL; echo '', $this->misc->printVal($oprdata->fields['oprlsortop']), ' |
{$this->lang['strrightsort']} | ".PHP_EOL; echo '', $this->misc->printVal($oprdata->fields['oprrsortop']), ' |
{$this->lang['strlessthan']} | ".PHP_EOL; echo '', $this->misc->printVal($oprdata->fields['oprltcmpop']), ' |
{$this->lang['strgreaterthan']} | ".PHP_EOL; echo '', $this->misc->printVal($oprdata->fields['oprgtcmpop']), ' |
{$this->lang['strmerges']} | ".PHP_EOL; echo '', $data->phpBool($oprdata->fields['oprcanmerge']) ? $this->lang['stryes'] : $this->lang['strno'], ' |
', sprintf($this->lang['strconfdropoperator'], $this->misc->printVal($_REQUEST['operator'])), '
'.PHP_EOL; echo ''.PHP_EOL; } else { $status = $data->dropOperator($_POST['operator_oid'], isset($_POST['cascade'])); if (0 == $status) { $this->doDefault($this->lang['stroperatordropped']); } else { $this->doDefault($this->lang['stroperatordroppedbad']); } } } }