echo '<br/><span class="feedback_info">Question: </span><span class="feedback_info_value">' . strip_tags(format_string($quickfeedback->intro, true)) . '</span>'; echo $OUTPUT->box_end(); } echo $OUTPUT->box_end(); if ($action == "showresponse") { if (has_capability('mod/quickfeedback:viewresponses', $context)) { //echo "Responses"; $responses = $DB->get_records_sql("Select * from {quickfeedback_response} where quickfeedbackid= {$cm->id}"); foreach ($responses as $response) { $full_text .= $response->response; } $font = dirname(__FILE__) . '/Arial.ttf'; $width = 600; $height = 600; $cloud = new WordCloud($width, $height, $font, $full_text); $palette = Palettee::get_palette_from_hex($cloud->get_image(), array('FFA700', 'FFDF00', 'FF4F00', 'FFEE73')); $cloud->render($palette); // Render the cloud in a temporary file, and return its base64-encoded content $file = tempnam(getcwd(), 'img'); imagepng($cloud->get_image(), $file); $img64 = base64_encode(file_get_contents($file)); unlink($file); imagedestroy($cloud->get_image()); add_to_log($course->id, 'quickfeedback', ' view result', 'view.php?id=' . $cm->id, $course->fullname, $cm->id); echo '<h2>Word map of students feedback.</h2>'; if ($full_text == "") { echo "<font color='red'>No results</font>"; } ?> <div align="center">
array('word' => "aaaa", 'count' => "0", 'title' => "cedric", 'link' => "cedric"), array('word' => "bbbbb", 'count' => "8", 'title' => "cedric", 'link' => "cedric"), array('word' => "bbbbb", 'count' => "0", 'title' => "cedric", 'link' => "cedric"), array('word' => "bbbbb", 'count' => "0", 'title' => "cedric", 'link' => "cedric"), array('word' => "bbbbb", 'count' => "5", 'title' => "cedric", 'link' => "cedric"), array('word' => "rrrrrr", 'count' => "2", 'title' => "cedric", 'link' => "cedric"), ); */ $palettes = array('aqua' => array('BED661', '89E894', '78D5E3', '7AF5F5', '34DDDD', '93E2D5'), 'yellow/blue' => array('FFCC00', 'CCCCCC', '666699'), 'grey' => array('87907D', 'AAB6A2', '555555', '666666'), 'brown' => array('CC6600', 'FFFBD0', 'FF9900', 'C13100'), 'army' => array('595F23', '829F53', 'A2B964', '5F1E02', 'E15417', 'FCF141'), 'pastel' => array('EF597B', 'FF6D31', '73B66B', 'FFCB18', '29A2C6'), 'red' => array('FFFF66', 'FFCC00', 'FF9900', 'FF0000')); $font = dirname(__FILE__) . '/Arial.ttf'; $width = 600; $height = 600; //$width, $height, $font, $text = null, $imagecolor = array(0, 0, 0, 127), $words_limit = null, $vertical_freq = FrequencyTable::WORDS_MAINLY_HORIZONTAL $cloud = new WordCloud(16, 72, $width, $height, $font, $full_text); $palette = Palette::get_palette_from_hex($cloud->get_image(), $palettes['grey'], 0, FrequencyTable::WORDS_MAINLY_HORIZONTAL); $cloud->render($palette); // Render the cloud in a temporary file, and return its base64-encoded content $file = tempnam(getcwd(), 'img'); imagepng($cloud->get_image(), $file); $img64 = base64_encode(file_get_contents($file)); unlink($file); imagedestroy($cloud->get_image()); ?> <img usemap="#mymap" src="data:image/png;base64,<?php echo $img64; ?> " border="0"/> <map name="mymap"> <?php