function brainstorm_user_complete($course, $user, $mod, $brainstorm) { if ($responses = brainstorm_get_responses($brainstorm->id, $user->id, 0, false)) { $responses_values = array_values($responses); /// printing last entered response for that user $result->info = '"' . $responses_values[count($responses_values) - 1]->response . '"'; $result->time = $responses_values[count($responses_values) - 1]->timemodified; echo get_string('responded', 'brainstorm') . ": {$result->info} , last updated " . userdate($result->time); } else { print_string('notresponded', 'brainstorm'); } }
<?php /** * Module Brainstorm V2 * Operator : scale * @author 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"; $current_operator = new BrainstormOperator($brainstorm->id, $page); $responses = brainstorm_get_responses($brainstorm->id, 0, $currentgroup, false); $scalings = scale_get_scalings($brainstorm->id, null, 0, false, $current_operator->configdata); print_heading(get_string('myscaling', 'brainstorm')); scale_display($brainstorm, null, $currentgroup, $responses, $scalings); print_heading(get_string('unscaled', 'brainstorm')); scale_display_unscaled($brainstorm, null, $currentgroup, $responses, $scalings); print_heading(get_string('otherscales', 'brainstorm')); print_simple_box_start('center'); $otherscalings = scale_get_meanscalings($brainstorm->id, 0, $currentgroup, true, $current_operator->configdata); if ($otherscalings) { $absscalebounds = scale_get_scalebounds($brainstorm->id, 0, $currentgroup, false, $current_operator->configdata); } ?> <table cellspacing="5" width="80%"> <?php if ($otherscalings && $absscalebounds->range != 0) { $i = 0; $absoffset = $absscalebounds->minvalue < 0 ? abs($absscalebounds->minvalue / $absscalebounds->range * $current_operator->configdata->barwidth) : 0; foreach ($otherscalings as $other) {
</tr> </table> <?php } else { // grading a user /// starting form echo '<form name="gradesform" action="view.php" method="post">'; echo "<input type=\"hidden\" name=\"id\" value=\"{$cm->id}\" />"; echo "<input type=\"hidden\" name=\"what\" value=\"savegrade\" />"; echo "<input type=\"hidden\" name=\"for\" value=\"{$gradefor}\" />"; $gradeset = brainstorm_get_gradeset($brainstorm->id, $gradefor); $user = get_record('user', 'id', $gradefor); print_heading(get_string('gradingof', 'brainstorm') . ' ' . fullname($user)); /// printing ideas print_heading(get_string('responses', 'brainstorm'), '', 3); $responses = brainstorm_get_responses($brainstorm->id, $user->id, 0, false); if ($responses) { echo '<table><tr>'; brainstorm_print_responses_cols($brainstorm, $responses, false); echo '</tr></table>'; } else { print_simple_box(get_string('notresponded', 'brainstorm')); } if (!$brainstorm->singlegrade && $brainstorm->seqaccesscollect) { print_string('gradeforparticipation', 'brainstorm'); echo ' : '; make_grading_menu($brainstorm, 'participate', @$gradeset->participate, false); } // getting valid operator list $operators = brainstorm_get_operators($brainstorm->id); /// printing preparing sets
<?php // $Id: categorise.php,v 1.1 2004/08/24 16:40:57 cmcclean Exp $ /** * Module Brainstorm V2 * Operator : merge * @author Valery Fremaux * @package Brainstorm * @date 20/12/2007 */ include_once "{$CFG->dirroot}/mod/brainstorm/operators/operator.class.php"; if (!brainstorm_legal_include()) { error("The way you loaded this page is not the way this script is done for."); } $responses = brainstorm_get_responses($brainstorm->id, 0, 0); $currentoperator = new BrainstormOperator($brainstorm->id, $page); $usehtmleditor = can_use_html_editor(); if (!isset($currentoperator->configdata->maxideasleft)) { $currentoperator->configdata->maxideasleft = count($responses); } if (!isset($currentoperator->configdata->requirement)) { $currentoperator->configdata->requirement = ''; } if (!isset($currentoperator->configdata->allowreducesource)) { $currentoperator->configdata->allowreducesource = 0; } $noselected = !$currentoperator->configdata->allowreducesource ? 'checked="checked"' : ''; $yesselected = $currentoperator->configdata->allowreducesource ? 'checked="checked"' : ''; print_heading(get_string('mergesettings', 'brainstorm')); ?> <center>
/** * * */ function scale_display_unscaled(&$brainstorm, $userid, $groupid, &$responses = null, &$scalings = null) { /// get data if we do not have it yet $current_operator = new BrainstormOperator($brainstorm->id, 'scale'); if (!$responses) { $responses = brainstorm_get_responses($brainstorm->id, 0, $groupid, false); } if (!$scalings) { $scalings = scale_get_scalings($brainstorm->id, $userid, $groupid, false, $current_operator->configdata); } /// compute unscaled if ($responses) { $unvaluated = $responses; foreach (array_keys($scalings) as $scaledid) { unset($unvaluated[$scaledid]); } } ?> <table cellspacing="5" width="80%"> <?php if (!empty($unvaluated)) { $i = 0; foreach ($unvaluated as $response) { ?> <tr valign="top"> <th class="<?php echo $matchclass; ?> " width="10%"> <?php echo $i + 1; ?> . </th> <td align="right"> <?php echo $response->response; ?> </td> </tr> <?php $i++; } } else { echo '<tr><td>'; print_simple_box(get_string('allevaluated', 'brainstorm')); echo '</td></tr>'; } ?> </table> <?php }
<?php /** * Module Brainstorm V2 * Operator : order * @author 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"; if (!isset($current_operator)) { $current_operator = new BrainstormOperator($brainstorm->id, $page); } $responses = brainstorm_get_responses($brainstorm->id, 0, $currentgroup, false, $sort = 'timemodified,id'); $responses = hierarchize_refresh_tree($brainstorm->id, $currentgroup); $tree = hierarchize_get_childs($brainstorm->id, null, $currentgroup, false, 0); print_heading("<img src=\"{$CFG->wwwroot}/mod/brainstorm/operators/{$page}/pix/enabled_small.gif\" align=\"left\" width=\"40\" /> " . get_string('tree', 'brainstorm')); ?> <center> <?php if (isset($current_operator->configdata->requirement)) { print_simple_box($current_operator->configdata->requirement); } ?> <style> .response{ border : 1px solid gray ; background-color : #E1E1E1 } </style> <form name="treeform" action="view.php" method="POST"> <input type="hidden" name="id" value="<?php p($cm->id);
/** * displays filter information for a user * */ function filter_display(&$brainstorm, $userid, $groupid) { $responses = brainstorm_get_responses($brainstorm->id, 0, $groupid, false); $responsesids = array_keys($responses); $statuses = filter_get_status($brainstorm->id, $userid, $groupid, false); $statusesids = array_keys($statuses); $strsource = get_string('sourcedata', 'brainstorm'); $strfiltered = get_string('filtereddata', 'brainstorm'); ?> <style> .match{ background-color : #25B128 } .nomatch{ background-color : #CE0909 } </style> <table cellspacing="5"> <tr valign="top"> <td> <table cellspacing="5"> <tr> <th> </th> <th> <?php echo $strsource; ?> </th> </tr> <?php $i = 0; foreach ($responses as $response) { $match = in_array($response->id, $statusesids) ? 'match' : ''; ?> <tr> <th class="<?php echo $match; ?> "> <b><?php echo $i + 1; ?> .</b> </th> <td> <?php echo $response->response; ?> </td> </tr> <?php $i++; } ?> </table> </td> <td> <?php if ($statuses) { ?> <table cellspacing="5"> <tr> <th> </th> <th> <?php echo $strfiltered; ?> </th> </tr> <?php $i = 0; foreach ($statuses as $status) { $match = in_array($status->itemsource, $responsesids) ? 'match' : ''; ?> <tr> <th class="<?php echo $match; ?> "> <b><?php echo $i + 1; ?> .</b> </th> <td> <?php echo $status->response; ?> </td> </tr> <?php $i++; } ?> </table> <?php } else { print_simple_box(get_string('nofilteringinprogress', 'brainstorm')); } ?> </td> </tr> </table> <?php }
* and a call to add own. * - we provided ideas : we can see them and add more if max number of imputs has not been reached * * Teacher view * teacher view is sightly different, because he will have a monitoring capbility */ /// get viewable responses $myresponses = brainstorm_get_responses($brainstorm->id, $USER->id); if (has_capability('mod/brainstorm:manage', $context)) { $otherresponses = brainstorm_get_responses($brainstorm->id, 0, $currentgroup, true); } else { if ($groupmode && $currentgroup) { $otherresponses = brainstorm_get_responses($brainstorm->id, 0, $currentgroup, true); } else { if ($groupmode == 0 && !$brainstorm->privacy) { $otherresponses = brainstorm_get_responses($brainstorm->id, 0, 0, true); } else { $otherresponses = array(); } } } /// Just display responses, sorted in alphabetical order print_heading(get_string('collectingideas', 'brainstorm')); print_simple_box_start('center'); if (!empty($myresponses) || !empty($otherresponses)) { if (has_capability('mod/brainstorm:manage', $context)) { ?> <form name="deleteform" method="post"> <input type="hidden" name="id" value="<?php p($cm->id); ?>
/** * * */ function order_display(&$brainstorm, $userid, $groupid) { $responses = brainstorm_get_responses($brainstorm->id, 0, $groupid, false, 'timemodified,id'); $myordering = order_get_ordering($brainstorm->id, $userid, 0, false); ?> <center> <style> .match { background-color : #54DE57 } </style> <table> <tr> <th> <?php print_string('original', 'brainstorm'); ?> </th> <th> <?php print_string('myordering', 'brainstorm'); ?> </th> </tr> <tr> <td> <?php if ($responses) { $i = 0; echo '<table cellspacing="10">'; $myorderingkeys = array_keys($myordering); foreach ($responses as $response) { $matchclass = $response->id == @$myorderingkeys[$i] ? 'match' : ''; ?> <tr> <th class="<?php echo $matchclass; ?> "> <?php echo $i + 1; ?> . </th> <td> <?php echo $response->response; ?> </td> </tr> <?php $i++; } echo '</table>'; } else { print_simple_box(get_string('noresponses', 'brainstorm')); } ?> </td> <td> <?php if ($myordering) { $i = 0; echo '<table cellspacing="10">'; $responsekeys = array_keys($responses); foreach ($myordering as $response) { $matchclass = $response->id == @$responsekeys[$i] ? 'match' : ''; ?> <tr> <th class="<?php echo $matchclass; ?> "> <?php echo $i + 1; ?> . </th> <td> <?php echo $response->response; ?> </td> </tr> <?php $i++; } echo '</table>'; } else { print_simple_box(get_string('noorderset', 'brainstorm')); } ?> </td> </tr> </table> <?php }
/** * * */ 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 }