function getConnectionsForDebate($nodeid) { $linklabels = array("", "supports,challenges"); $linkgroups = array("All", ""); $directions = array("incoming", "incoming"); $nodetypes = array("Solution", "Pro,Con,Comment"); $nodeids = array("", ""); $conSet = getConnectionsByPathByDepth('or', 'all', 'false', $nodeid, 2, $linklabels, $linkgroups, $directions, $nodetypes, $nodeids, 'true', 'long', 0); return $conSet; }
/** * Return a ConnectionSet for the tree or Solutions and their pros and cons and comments * for the Issue node with the given nodeid. * * @param nodeid the nodeid of the node to get the tree for. * @param style, the style of node to return - how much data it has (defaults to 'mini' can also be 'long' or 'short') * @return ConnectionSet or Error. * * @uses getConnectionsByPathByDepth */ function getDebate($nodeid, $style = 'mini') { $logictype = 'or'; $scope = 'all'; $labelmatch = 'false'; $depth = 2; $uniquepath = 'true'; $status = 0; $nodetypes = array('Solution', 'Pro,Con,Comment'); $linklabels = array('', 'supports,challenges'); $linkgroups = array('', ''); $directions = array('incoming', 'incoming'); $nodeids = array('', ''); return getConnectionsByPathByDepth($logictype, $scope, $labelmatch, $nodeid, $depth, $linklabels, $linkgroups, $directions, $nodetypes, $nodeids, $uniquepath, $style, $status); }
$response = getConnectionsByPath($nodeid, $linklabels, $userid, $scope, $linkgroup, $depth, $direction, $labelmatch, $nodetypes, $style, $status); break; case "getconnectionsbypathbydepth": $nodeid = optional_param('nodeid', '', PARAM_ALPHANUMEXT); $searchid = optional_param('searchid', '', PARAM_ALPHANUMEXT); $scope = optional_param('scope', 'all', PARAM_TEXT); $labelmatch = optional_param('labelmatch', 'false', PARAM_TEXT); $depth = optional_param('depth', '7', PARAM_INT); $linklabels = optional_param('linklabels', null, PARAM_TEXT); $linkgroups = optional_param('linkgroups', null, PARAM_TEXT); $directions = optional_param('directions', null, PARAM_TEXT); $nodetypes = optional_param('nodetypes', null, PARAM_TEXT); $nodeids = optional_param('nodeids', null, PARAM_TEXT); $logictype = optional_param('logictype', 'or', PARAM_TEXT); $uniquepath = optional_param('uniquepath', 'false', PARAM_TEXT); $response = getConnectionsByPathByDepth($logictype, $scope, $labelmatch, $nodeid, $depth, $linklabels, $linkgroups, $directions, $nodetypes, $nodeids, $uniquepath, $style, $status); break; case "addconnection": $fromnodeid = required_param('fromnodeid', PARAM_ALPHANUMEXT); $fromroleid = required_param('fromroleid', PARAM_ALPHANUMEXT); $linktypeid = required_param('linktypeid', PARAM_ALPHANUMEXT); $tonodeid = required_param('tonodeid', PARAM_ALPHANUMEXT); $toroleid = required_param('toroleid', PARAM_ALPHANUMEXT); $description = optional_param('description', "", PARAM_TEXT); $response = addConnection($fromnodeid, $fromroleid, $linktypeid, $tonodeid, $toroleid, $private, $description); break; case "addconnectionlinkname": $fromnodeid = required_param('fromnodeid', PARAM_ALPHANUMEXT); $fromroleid = required_param('fromroleid', PARAM_ALPHANUMEXT); $linktypename = required_param('linktypename', PARAM_TEXT); $tonodeid = required_param('tonodeid', PARAM_ALPHANUMEXT);
$json .= '"name": "' . parseToJSON($fromNode->name) . '",'; $json .= '"nodetype": "' . parseToJSON($fromNode->role->name) . '",'; $json .= '"nodetypename": "' . getNodeTypeText(parseToJSON($fromNode->role->name), false) . '"'; $logictype = 'or'; $scope = 'all'; $labelmatch = 'false'; $depth = 1; $uniquepath = 'true'; $status = 0; $nodetypes = array('Pro,Con'); $linklabels = array('supports,challenges'); $linkgroups = array(''); $directions = array('incoming'); $nodeids = array(''); // This only works because nodes are not transcluded in Debate Hub $argumentConnections = getConnectionsByPathByDepth($logictype, $scope, $labelmatch, $fromNode->nodeid, $depth, $linklabels, $linkgroups, $directions, $nodetypes, $nodeids, $uniquepath, $style, $status); $args = $argumentConnections->connections; $countargs = count($args); if ($countargs > 0) { $json .= ',"children": ['; for ($k = 0; $k < $countargs; $k++) { $conarg = $args[$k]; $fromNodeArg = $conarg->from; $json .= "{"; $json .= '"name": "' . parseToJSON($fromNodeArg->name) . '",'; $size = $fromNodeArg->positivevotes; $json .= '"size": "50",'; $json .= '"nodetype": "' . parseToJSON($fromNodeArg->role->name) . '",'; $json .= '"nodetypename": "' . getNodeTypeText(parseToJSON($fromNodeArg->role->name), false) . '"'; $json .= '}'; if ($k < $countargs - 1) {