} else { ?> <li <?php echo $section == '' ? 'class="topactive"' : ''; ?> ><a href="u/<?php echo $this->user->id; ?> "><img src="<?php echo htmlentities(authorImage($this->user->image)); ?> " width="25" height="25" class="img-circle" alt="<?php echo $this->user->first_name . ' ' . $this->user->last_name; ?> " /> <?php echo user_display_text(); ?> </a></li> <?php } ?> <li <?php echo $section == 'Data' ? 'class="topactive"' : ''; ?> ><a href="search?type=data<?php if (array_key_exists("q", $_GET)) { echo '&q=' . $_GET["q"]; } ?> " class="icongreen"><i class="fa fa-fw fa-lg fa-database"></i> Data<span id="datacounter" class="counter"></span></a></li> <li <?php
// Execute $data = curl_exec($ch); $results = json_decode($data); $category_code = array('3200853' => 'general', '3353609' => 'data', '3353608' => 'flow', '3353607' => 'task', '3353606' => 'run', '3760343' => 'task_type'); $threads = $results->response; foreach ($threads as $thread) { $type = $category_code[$thread->category]; $id = end(explode('/', $thread->link)); $message = "Could not retrieve message"; if ($type == 'general') { $t = $this->Thread->getById($tid); if ($t) { $thread->message = nl2br(stripslashes($t->body)); $thread->title = nl2br(stripslashes($t->title)); $auth = $this->Author->getById($t->author_id); $thread->authname = user_display_text($auth); $thread->authimage = htmlentities(authorImage($auth->image)); } } else { //get data from ES $p = array(); $p['index'] = 'openml'; $p['type'] = $type; $p['id'] = $id; $p['fields'] = 'description'; try { $thread->message = substr(preg_replace('/\\s+/', ' ', $this->searchclient->get($p)['fields']['description'][0]), 0, 150) . ' ...'; } catch (Exception $e) { } } }
<div class="searchresult panel"> <div class="itemheadfull"> <i><img src="<?php echo htmlentities(authorImage($this->author->image)); ?> " width="40" height="40" class="img-circle" /></i> <?php echo user_display_text($this->author); ?> <span><i class="fa fa-fw fa-clock-o"></i> <?php echo get_timeago(strtotime(str_replace('T', ' ', $this->thread->post_date))); ?> </span> </div> <div class="discuss_postmessage" style="margin-bottom:40px;"> <h2 style="margin-top:0px;"><?php echo $this->thread->title; ?> </h2> <?php echo nl2br(stripslashes($this->thread->body)); ?> </div> <div id="disqus_thread"></div> </div> <script type="text/javascript"> var disqus_shortname = '<?php echo DISQUS_USERNAME; ?>
echo isset($this->threadsPerCategory[$category->id]) ? $this->threadsPerCategory[$category->id]->threads : '0'; ?> )</div> </div> <?php if ($this->threads[$category->id] == false) { ?> No threads yet.<?php } else { foreach ($this->threads[$category->id] as $thread) { if ($thread) { $message = nl2br(stripslashes($thread->body)); $title = nl2br(stripslashes($thread->title)); $auth = $this->Author->getById($thread->author_id); $authname = user_display_text($auth); $authimage = htmlentities(authorImage($auth->image)); } ?> <div class="searchresult panel" > <div class="itemheadfull"> <i><img src="<?php echo $authimage; ?> " width="30" height="30" class="img-circle" style="margin-right:-15px;" /></i> <a href="discuss/tid/<?php echo $thread->id; ?> " style="margin-left:10px;"><?php echo stripslashes(teaser($thread->title, 100)); ?>