/**
*
*
*/
function locate_display(&$brainstorm, $userid, $groupid)
{
    $responses = brainstorm_get_responses($brainstorm->id, 0, $groupid, false);
    $responses_locations = locate_get_locations($brainstorm->id, $userid, $groupid);
    $current_operator = new BrainstormOperator($brainstorm->id, 'locate');
    $current_operator->configdata->width = $w = 200;
    $current_operator->configdata->height = $h = 200;
    /// graphic coordinates converter
    function g($absx, $absy, $configdata, $xshift = 0, $yshift = 0)
    {
        $xabsoffset = 0;
        $yabsoffset = 0;
        $xfactor = $configdata->width / ($configdata->xmaxrange - $configdata->xminrange);
        $yfactor = $configdata->height / ($configdata->ymaxrange - $configdata->yminrange);
        $p->x = $xfactor * ($absx - $configdata->xminrange) + $xabsoffset + $xshift;
        $p->y = $configdata->height - $yfactor * ($absy - $configdata->yminrange) + $yabsoffset + $yshift;
        return $p;
    }
    ?>
<style>
.spot { background-color : #5CCA59 ; border : 1px solid #217218 }
.spot1 { background-color : #FFFF00 ; border : 1px solid #968612 }
.axis { background-color : #091C09 }
</style>
<center>
<?php 
    if (!isset($current_operator->configdata->xminrange)) {
        print_simple_box(get_string('notconfigured', 'brainstorm'));
    } else {
        echo "<div style=\"width: {$w}px; height: {$h}px; left: 0px; position: relative ; text-align : left\">";
        $pleft = g($current_operator->configdata->xminrange, 0, $current_operator->configdata);
        $ptop = g(0, $current_operator->configdata->xmaxrange, $current_operator->configdata);
        echo "<div class=\"axis\" style=\"position:absolute; left: {$pleft->x}px; top: {$pleft->y}px; width: {$w}px; height: 1px;\"></div>";
        echo "<div class=\"axis\" style=\"position:absolute; left: {$ptop->x}px; top: {$ptop->y}px; width: 1px; height: {$h}px;\"></div>";
        if ($responses_locations) {
            $i = 0;
            foreach ($responses_locations as $located) {
                $spot = 'spot';
                $abs = unserialize($located->blobvalue);
                $p = g($abs->x, $abs->y, $current_operator->configdata, 0, -15);
                echo "<div class=\"{$spot}\" style=\"position:absolute; left: {$p->x}px; top: {$p->y}px; width: 15px; height: 15px;\" title=\"({$abs->x},{$abs->y}) {$responses[$located->itemsource]->response}\"></div>";
                if (@$current_operator->configdata->showlabels) {
                    $p->x += 20 + rand(-20, 20);
                    $p->y += 20 + rand(-20, 20);
                    echo "<div style=\"position:absolute; left: {$p->x}px; top: {$p->y}px;\" >{$responses[$located->itemsource]->response}</div>";
                }
                $i++;
            }
        }
    }
    ?>
</div>
</center>
<?php 
}
* @reengineering Valery Fremaux
* @package Brainstorm
* @date 20/12/2007
*/
include_once $CFG->dirroot . "/mod/brainstorm/operators/{$page}/locallib.php";
include_once "{$CFG->dirroot}/mod/brainstorm/operators/operator.class.php";
$responses = brainstorm_get_responses($brainstorm->id, 0, $currentgroup, false);
$current_operator = new BrainstormOperator($brainstorm->id, $page);
$responses_bounds = locate_get_bounds($brainstorm->id);
if (!isset($current_operator->configdata->width)) {
    $current_operator->configdata->width = 400;
}
if (!isset($current_operator->configdata->height)) {
    $current_operator->configdata->height = 400;
}
$responses_locations = locate_get_locations($brainstorm->id, null, $currentgroup);
$w = $current_operator->configdata->width;
$h = $current_operator->configdata->height;
/// graphic coordinates converter
function g($absx, $absy, $configdata, $xshift = 0, $yshift = 0)
{
    $xabsoffset = 0;
    $yabsoffset = 0;
    $xfactor = $configdata->width / ($configdata->xmaxrange - $configdata->xminrange);
    $yfactor = $configdata->height / ($configdata->ymaxrange - $configdata->yminrange);
    $p->x = $xfactor * ($absx - $configdata->xminrange) + $xabsoffset + $xshift;
    $p->y = $configdata->height - $yfactor * ($absy - $configdata->yminrange) + $yabsoffset + $yshift;
    return $p;
}
?>
<style>
* @date 20/12/2007
*/
include_once $CFG->dirroot . "/mod/brainstorm/operators/{$page}/locallib.php";
include_once "{$CFG->dirroot}/mod/brainstorm/operators/operator.class.php";
print_heading("<img src=\"{$CFG->wwwroot}/mod/brainstorm/operators/{$page}/pix/enabled_small.gif\" align=\"left\" width=\"40\" /> " . get_string("organizing{$page}", 'brainstorm'));
$responses = brainstorm_get_responses($brainstorm->id, 0, 0);
if (!isset($current_operator)) {
    $current_operator = new BrainstormOperator($brainstorm->id, $page);
}
if (!isset($current_operator->configdata->xminrange)) {
    echo '<center>';
    print_simple_box(get_string('notconfigured', 'brainstorm'));
    echo '</center>';
    return;
}
$responses_locations = locate_get_locations($brainstorm->id, $USER->id);
$strresponses = get_string('responses', 'brainstorm');
$strxquantifier = get_string('xquantifier', 'brainstorm');
$stryquantifier = get_string('yquantifier', 'brainstorm');
?>
<center>
<?php 
$intro = isset($current_operator->configdata->requirement) ? $current_operator->configdata->requirement . '<br/>' : '';
$intro .= get_string('datarangeis', 'brainstorm');
$intro .= ' : X[' . $current_operator->configdata->xminrange . ',' . $current_operator->configdata->xmaxrange . '] ';
$intro .= ' : Y[' . $current_operator->configdata->yminrange . ',' . $current_operator->configdata->ymaxrange . '] ';
print_simple_box($intro);
?>
<form name="locateform" method="post" action="view.php">
<input type="hidden" name="id" value="<?php 
p($cm->id);