echo $LNG->FORM_ACTIVITY_ACTION_ADDED_EVIDENCE;
                             }
                         }
                     } else {
                         echo $LNG->FORM_ACTIVITY_ACTION_ASSOCIATED_WITH . " " . getNodeTypeText($othernode->role->name, false);
                     }
                 }
             } else {
                 if ($activity->changetype == 'delete') {
                     if ($othernode->role->name == 'Comment') {
                         echo $LNG->FORM_ACTIVITY_ACTION_REMOVED . " " . getNodeTypeText($othernode->role->name, false);
                     } else {
                         if (in_array($othernode->role->name, $CFG->EVIDENCE_TYPES)) {
                             echo $LNG->FORM_ACTIVITY_ACTION_REMOVED_EVIDENCE;
                         } else {
                             echo $LNG->FORM_ACTIVITY_ACTION_REMOVED_ASSOCIATION . " " . getNodeTypeText($othernode->role->name, false);
                         }
                     }
                 }
             }
             echo "</span>";
             echo "</td>";
             echo "<td id='item" . $i . "'>";
             echo "<script type='text/javascript'>";
             echo " if (connection) { if (connection.from.nodeid != '" . $nodeid . "') { activityitems['item" . $i . "'] = renderNodeFromLocalJSon(connection.from, 'activity', connection.from.role, true); }";
             echo "else if (connection.to.nodeid != '" . $nodeid . "') { activityitems['item" . $i . "'] = renderNodeFromLocalJSon(connection.to, 'activity', connection.to.role, true); } }";
             echo "</script></td>";
             echo "</tr>";
         }
     }
 }
示例#2
0
/**
 * Helper function for the Circle Packing function. Recurses the data tree
 */
function addNextCirclePackingDepth($json, $node, $depth, $treeArray, $checkArray)
{
    $json .= '{';
    $json .= '"name": "' . parseToJSON($node->name) . '",';
    $json .= '"nodetype": "' . parseToJSON($node->role->name) . '",';
    $json .= '"nodetypename": "' . getNodeTypeText(parseToJSON($node->role->name), false) . '"';
    $treeitem = $treeArray[$node->nodeid];
    if (isset($treeitem["children"]) && count($treeitem["children"]) > 0 && !array_key_exists($node->nodeid, $checkArray)) {
        // make sure you don't recurse the same set of children more than once.
        $checkArray[$node->nodeid] = $node->nodeid;
        $children = $treeitem["children"];
        $countkids = count($children);
        $json .= ',"children": [';
        for ($i = 0; $i < $countkids; $i++) {
            $child = $children[$i];
            $json = addNextCirclePackingDepth($json, $child, $depth + 1, $treeArray, $checkArray);
            if ($i < $countkids - 1) {
                $json .= ',';
            }
        }
        $json .= "]";
    } else {
        $json .= ',"size": ' . (2000 - 20 * $depth);
    }
    $json .= "}";
    return $json;
}
         $conSet = getDebate($nodeid);
         $conns = $conSet->connections;
         $countl = count($conns);
         for ($l = 0; $l < $countl; $l++) {
             $con = $conns[$l];
             $from = $con->from;
             $to = $con->to;
             $node = array();
             $node['NodeID'] = $from->nodeid;
             $node['Name'] = $from->name;
             $node['NodeType'] = $from->role->name;
             $node['UserID'] = $from->users[0]->userid;
             $as = getNodeActivity($from->nodeid, $followlastrun, false);
             $activities = $as->activities;
             if (count($activities) > 0) {
                 $nextMessage .= '<br /><br /><br />' . $LNG->ADMIN_CRON_FOLLOW_ACTIVITY_FOR . ' ' . getNodeTypeText($node['NodeType'], false) . ': <span style="font-weight:bold">' . $from->name . '</span> <a href="' . $CFG->homeAddress . 'ui/popups/activityviewer.php?nodeid=' . $from->nodeid . '&fromtime=' . $followlastrun . '">' . $LNG->ADMIN_CRON_FOLLOW_EXPLORE_LINK . '</a>';
                 $nextMessage .= processActivityList($activities, $node, $user);
             }
         }
     }
 }
 $user->updateFollowLastRun($now);
 if ($nextMessage != "") {
     $nextMessage = $LNG->ADMIN_CRON_FOLLOW_DATE_FROM_TO_PART1 . " " . date("d M Y", $followlastrun) . " " . $LNG->ADMIN_CRON_FOLLOW_DATE_FROM_TO_PART2 . " " . date("d M Y", $now) . "<br />" . $nextMessage;
     //email messages can't have more than 998 characters on one line or you get odd characters ! randomly through the email.
     $nextMessage = wordwrap($nextMessage, 900, "\n");
     $nextMessage .= '<br><br><p style="font-size:8pt">' . $LNG->ADMIN_CRON_FOLLOW_UNSUBSCRIBE_PART1 . ' <a href="' . $CFG->homeAddress . 'user.php?userid=' . $userid . '"> ' . $LNG->ADMIN_CRON_FOLLOW_UNSUBSCRIBE_PART2 . '</a></p><br>';
     //$myFile = $user->userid."C.html";
     //$fh = fopen($myFile, 'w') or die("can't open file");
     //fwrite($fh, $nextMessage);
     //fclose($fh);
示例#4
0
include_once $_SERVER['DOCUMENT_ROOT'] . '/config.php';
$groupid = required_param("groupid", PARAM_ALPHANUMEXT);
$nodeCheck = array();
$totalnodes = 0;
$nodeSet = getNodesByGroup($groupid, 0, -1, 'date', 'ASC', '', 'Issue,Solution,Pro,Con', 'mini');
$nodes = $nodeSet->nodes;
$count = count($nodes);
$typeArray = array($LNG->ISSUE_NAME, $LNG->SOLUTION_NAME, $LNG->PRO_NAME, $LNG->CON_NAME);
$coloursArray = array("#DFC7EB", "#A4AED4", "#A9C89E", "#D46A6A");
$dateArray = array();
//error_log($count);
for ($i = 0; $i < $count; $i++) {
    $node = $nodes[$i];
    $datekey = date('d/m/y', $node->creationdate);
    //$datekey = $node->creationdate*1000;
    $nodetype = getNodeTypeText($node->role->name, false);
    if (in_array($nodetype, $typeArray)) {
        if (!array_key_exists($datekey, $dateArray)) {
            $typearray = array();
            $typearray[$LNG->ISSUE_NAME] = 0;
            $typearray[$LNG->SOLUTION_NAME] = 0;
            $typearray[$LNG->PRO_NAME] = 0;
            $typearray[$LNG->CON_NAME] = 0;
            $typearray[$nodetype] = 1;
            $dateArray[$datekey] = $typearray;
        } else {
            $typearray = $dateArray[$datekey];
            $typearray[$nodetype] = $typearray[$nodetype] + 1;
            $dateArray[$datekey] = $typearray;
        }
    }
     $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) {
                 $json .= ',';
             }
         }
         $json .= ']';
     } else {
         $json .= ',"size": "50"';
     }
     $json .= '}';
     if ($j < $countcons - 1) {
         $json .= ',';
     }
 }
 $json .= ']';
示例#6
0
/**
 * Helper function for the Circle Packing Attention function. Recurses the data tree
 */
function addNextCirclePackingAttentionDepth($json, $node, $depth, $treeArray, $checkArray, $circlesizearray, $circlecolorarray)
{
    $json .= '{';
    $json .= '"name": "' . parseToJSON($node->name) . '",';
    $json .= '"nodetype": "' . parseToJSON($node->rolename) . '",';
    $json .= '"nodetypename": "' . getNodeTypeText(parseToJSON($node->rolename), false) . '"';
    if (array_key_exists($node->nodeid, $circlecolorarray)) {
        $json .= ',"colornumber": "' . round($circlecolorarray[$node->nodeid], 1) . '"';
    } else {
        $json .= ',"colornumber": "0"';
        //error_log("Color not found for:".$node->nodeid);
    }
    $treeitem = $treeArray[$node->nodeid];
    if (isset($treeitem["children"]) && count($treeitem["children"]) > 0 && !array_key_exists($node->nodeid, $checkArray)) {
        // make sure you don't recurse the same set of children more than once.
        $checkArray[$node->nodeid] = $node->nodeid;
        $children = $treeitem["children"];
        $countkids = count($children);
        $json .= ',"children": [';
        for ($i = 0; $i < $countkids; $i++) {
            $child = $children[$i];
            $json = addNextCirclePackingAttentionDepth($json, $child, $depth + 1, $treeArray, $checkArray, $circlesizearray, $circlecolorarray);
            if ($i < $countkids - 1) {
                $json .= ',';
            }
        }
        $json .= "]";
    }
    $circlesize = 0;
    //(2000-(20*$depth));
    if (array_key_exists($node->nodeid, $circlesizearray)) {
        $circlesize = $circlesizearray[$node->nodeid];
    }
    $json .= ',"size": ' . $circlesize;
    $json .= "}";
    return $json;
}
示例#7
0
/**
 * Turn the given list of activities into a text report.
 */
function processActivityList($activities, $node, $user)
{
    global $CFG, $LNG;
    $report = "";
    $nodetypename = $node['NodeType'];
    $nodeid = $node['NodeID'];
    foreach ($activities as $activity) {
        //error_log($activity->type);
        if ($activity->type == 'Follow') {
            $report .= '<br /><br /><span style="font-style:italic">' . $LNG->ADMIN_CRON_FOLLOW_ON_THE . ' ' . date("d M Y - H:i", $activity->modificationdate) . ' </span>';
            $report .= ' ' . $activity->user->name . ' ';
            $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_STARTED . '</span> ' . $LNG->ADMIN_CRON_FOLLOW_THIS_ITEM;
        } else {
            if ($activity->type == 'Vote') {
                $report .= '<br /><br /><span style="font-style:italic">' . $LNG->ADMIN_CRON_FOLLOW_ON_THE . ' ' . date("d M Y - H:i", $activity->modificationdate) . ' </span>';
                $report .= ' ' . $activity->user->name . ' ';
                if ($activity->changetype == 'Y') {
                    $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_PROMOTED . '</span> ' . $LNG->ADMIN_CRON_FOLLOW_THIS_ITEM;
                } else {
                    if ($activity->changetype == 'N') {
                        $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_DEMOTED . '</span> ' . $LNG->ADMIN_CRON_FOLLOW_THIS_ITEM;
                    }
                }
            } else {
                if ($activity->type == 'Node') {
                    $node = getIdeaFromAuditXML($activity->xml);
                    if ($node instanceof CNode && ($node->private == 'N' || $node->userid == $user->userid) && (in_array($node->role->name, $CFG->BASE_TYPES) || in_array($node->role->name, $CFG->EVIDENCE_TYPES))) {
                        $report .= '<br /><br /><span style="font-style:italic">' . $LNG->ADMIN_CRON_FOLLOW_ON_THE . ' ' . date("d M Y - H:i", $activity->modificationdate) . ' </span>';
                        $report .= ' ' . $activity->user->name . ' ';
                        if ($activity->changetype == 'add') {
                            $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_ADDED . '</span> ' . $LNG->ADMIN_CRON_FOLLOW_THIS_ITEM;
                        } else {
                            if ($activity->changetype == 'edit') {
                                $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_EDITED . '</span> ' . $LNG->ADMIN_CRON_FOLLOW_THIS_ITEM;
                            }
                        }
                    }
                } else {
                    if ($activity->type == 'Connection') {
                        $con = getConnectionFromAuditXML($activity->xml);
                        if ($con instanceof Connection && isset($con->from) && isset($con->to) && ($con->from->private == 'N' && $con->to->private == 'N' || $con->from->userid == $user->userid && $con->to->userid == $user->userid)) {
                            if ($con->private == 'N' || $con->userid == $user->userid) {
                                if ((in_array($con->from->role->name, $CFG->BASE_TYPES) || in_array($con->from->role->name, $CFG->EVIDENCE_TYPES)) && (in_array($con->to->role->name, $CFG->BASE_TYPES) || in_array($con->to->role->name, $CFG->EVIDENCE_TYPES))) {
                                    $otherend;
                                    $othernode;
                                    $otherrole;
                                    if ($con->from->nodeid != $nodeid) {
                                        $otherend = 'from';
                                        $othernode = $con->from;
                                        $otherrole = $con->fromrole;
                                    } else {
                                        if ($con->to->nodeid != $nodeid) {
                                            $otherend = 'to';
                                            $othernode = $con->to;
                                            $otherrole = $con->torole;
                                        }
                                    }
                                    $report .= '<br /><br /><span style="font-style:italic">' . $LNG->ADMIN_CRON_FOLLOW_ON_THE . ' ' . date("d M Y - H:i", $activity->modificationdate) . ' </span>';
                                    $report .= ' ' . $activity->user->name . ' ';
                                    if ($activity->changetype == 'add') {
                                        if ($othernode->role->name == 'Comment') {
                                            $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_ADDED . ' ' . getNodeTypeText($othernode->role->name, false) . '</span>: "' . $othernode->name . '"';
                                        } else {
                                            if (in_array($othernode->role->name, $CFG->EVIDENCE_TYPES)) {
                                                if ($otherrole->name == 'Pro') {
                                                    $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_ADDED_SUPPORTING_EVIDENCE . '</span>: "' . $othernode->name . '"';
                                                } else {
                                                    if ($otherrole->name == 'Con') {
                                                        $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_ADDED_COUNTER_EVIDENCE . '</span>: "' . $othernode->name . '"';
                                                    } else {
                                                        $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_ASSOCIATED_EVIDENCE . '</span>: ' . $othernode->name . '"';
                                                    }
                                                }
                                            } else {
                                                $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_ASSOCIATED_WITH . ' ' . getNodeTypeText($othernode->role->name, false) . '</span>: "' . $othernode->name . '"';
                                            }
                                        }
                                    } else {
                                        if ($activity->changetype == 'delete') {
                                            if ($othernode->role->name == 'Comment') {
                                                $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_REMOVED . ' ' . getNodeTypeText($othernode->role->name, false) . '</span>: "' . $othernode->name . '"';
                                            } else {
                                                if (in_array($othernode->role->name, $CFG->EVIDENCE_TYPES)) {
                                                    if ($otherrole->name == 'Pro') {
                                                        $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_REMOVED_SUPPORTING_EVIDENCE . '</span>: "' . $othernode->name . '"';
                                                    } else {
                                                        if ($otherrole->name == 'Con') {
                                                            $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_REMOVED_COUNTER_EVIDENCE . '</span>: "' . $othernode->name . '"';
                                                        } else {
                                                            $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_REMOVED_EVIDENCE . '</span>: ' . $othernode->name . '"';
                                                        }
                                                    }
                                                } else {
                                                    $report .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_REMOVED_ASSOCIATION . ' ' . getNodeTypeText($othernode->role->name, false) . '</span>: "' . $othernode->name . '"';
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return $report;
}
}
echo '</td>';
?>
					</tr>
					<?php 
//error_log(print_r($allNodeVotes, true));
$allvotenodes = $allNodeVotes->nodes;
$count = count($allvotenodes);
for ($i = 0; $i < $count; $i++) {
    $n = $allvotenodes[$i];
    $nodetype = $n->role->name;
    $title = $n->name;
    ?>
							<tr>
								<td align="left"><?php 
    echo getNodeTypeText($nodetype, false);
    ?>
</td>
								<td><a href="<?php 
    echo $CFG->homeAddress;
    ?>
explore.php?id=<?php 
    echo $n->nodeid;
    ?>
" target="_blank"><?php 
    echo $title;
    ?>
</a></td>
								<td align="right"><span style="color: green"><?php 
    echo $n->up;
    ?>