Exemplo n.º 1
0
 private function buildLink($event)
 {
     $limit = $this->subject_max_length;
     $time = '';
     if (!$event['allday']) {
         $time = helpers::event_time($event['start']);
     }
     $title = $event['subject'];
     //dont cut this text
     $subject = $time . $event['subject'];
     $endTag = '';
     $pos = strrpos($subject, '</');
     if ($pos !== false) {
         ## if we're here, then we need to remove the end html tag and re-add it after the $limit trim
         $limit += 3;
         // add 3 to the set lengh limit since "<b><s>...tags" arent displayed
         $endTag = substr($subject, $pos, strlen($subject));
         $subject = substr($subject, 0, $pos);
         //helpers::debug($removed . "-" . $subject);
     }
     $len = strlen($subject);
     if ($len > $limit) {
         $subject = trim(substr($subject, 0, $limit)) . "...";
     }
     ## re-add any removed html tags
     $subject = $subject . $endTag;
     $tag = 'eventtag' . $event['id'];
     $text = $event['text'] . '&nbsp;';
     ## this fixes the line feed issue in the comments/text
     $text = str_replace("\r\n", "<br>", $text);
     ## we're passing these strings into javascript, so we need to handle special characters
     ## need to come back and re-visit this... there has to be a better way...
     $title = $this->fixJavascriptSpecialChars($title);
     $text = $this->fixJavascriptSpecialChars($text);
     $url = $this->cleanLink($this->title) . '&Name=' . $this->key . '&EditEvent=' . $event['id'];
     if ($this->options['summary_js']) {
         $link = "<a href=\"{$url}\" title='' name='{$tag}' onmouseover=\"EventSummary('{$tag}','{$title}','{$text}')\" onmouseout=\"ClearEventSummary()\" >{$subject}</a>";
     } else {
         $link = "<a href=\"{$url}\" title='{$title}' name='{$tag}' >{$subject}</a>";
     }
     return $link;
 }