Changeset 156

Show
Ignore:
Timestamp:
09/01/10 16:47:43 (17 months ago)
Author:
gnum
Message:

References #100, done some changes, all small versions of posts and comments content get tags stripped, plus some more changes to nicer code

Location:
trunk/views/default/edufeedr
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/views/default/edufeedr/educourse_blog.php

    r155 r156  
    2424        if ($posts) { 
    2525            $phtml = ''; 
    26                         $c = 1; 
    2726                        $post_date = ""; 
    2827                        foreach ($posts as $post) { 
     
    3635                                /*translation:%s by %s*/ 
    3736                $phtml .= "<em>".sprintf(elgg_echo('edufeedr:blog:by'), date("d.m.Y G:i",$post['date']), $post['author'])."</em>"; 
    38                 $phtml .= "<div>"; 
    39                 if (strlen($post['content'])>250) { 
    40                     $last_space = strrpos(substr($post['content'], 0, 250), ' '); 
    41                         $content_piece = substr($post['content'], 0, $last_space); 
    42                     $phtml .= '<div id="post_intro_'.$c.'">'.$content_piece.'...</div>'; 
    43                                         /*translation:read more*/ 
    44                                         $phtml .= '<a href="'.$vars['url'].'pg/edufeedr/view_post/'.$vars['entity']->getGUID().'/'.$post['id'].'">' . elgg_echo('edufeedr:read:more') . '</a>'; 
    45                                         // Hide post 
    46                                         if ($vars['entity']->canEdit() && edufeedrCanEditEducourse($vars['entity'])) { 
    47                                                 /*translation:hide*/ 
    48                                                 $phtml .= ' | <a href="'.$vars['url'].'action/edufeedr/hide_post?post_id='.$post['id'].'&educourse='.$vars['entity']->getGUID().'&__elgg_ts='.$ts.'&__elgg_token='.$token.'">' . elgg_echo('edufeedr:action:hide') . '</a>'; 
    49                                         } 
    50                 } else { 
    51                     $phtml .= $post['content']; 
    52                 } 
     37                                $phtml .= "<div>"; 
     38                                $phtml .= '<div class="edufeedr_post_content">'; 
     39                                // Getting post content plaintext 
     40                                $post_content = strip_tags($post['content']); 
     41                if (strlen($post_content)>250) { 
     42                    $last_space = strrpos(substr($post_content, 0, 250), ' '); 
     43                        $content_piece = substr($post_content, 0, $last_space); 
     44                    $phtml .= $content_piece; 
     45                                } else { 
     46                    $phtml .= $post_content; 
     47                                } 
     48                                $phtml .= '</div>';// post content end 
     49                                // Actions 
     50                /*translation:read more*/ 
     51                                $phtml .= '<a href="'.$vars['url'].'pg/edufeedr/view_post/'.$vars['entity']->getGUID().'/'.$post['id'].'">' . elgg_echo('edufeedr:read:more') . '</a>'; 
     52                                // Hide post 
     53                                if ($vars['entity']->canEdit() && edufeedrCanEditEducourse($vars['entity'])) { 
     54                                        /*translation:hide*/ 
     55                                        $phtml .= ' | <a href="'.$vars['url'].'action/edufeedr/hide_post?post_id='.$post['id'].'&educourse='.$vars['entity']->getGUID().'&__elgg_ts='.$ts.'&__elgg_token='.$token.'">' . elgg_echo('edufeedr:action:hide') . '</a>'; 
     56                                } 
     57 
    5358                $phtml .= "</div>"; 
    54                 $c++; 
    5559            } 
    5660            $body .= $phtml; 
     
    6064                if ($comments) { 
    6165                        $chtml = ''; 
    62                         $c = 1; 
    6366                        $comm_date = ""; 
    6467                        foreach ($comments as $comment) { 
     
    6972                                } 
    7073                                $chtml .= elgg_view('edufeedr/singles/educourse_comment', array('educourse' => $vars['entity'], 'comment' => $comment, 'type' => 'coursefeed')); 
    71                                 $c++; 
    7274            } 
    7375            $body .= $chtml; 
  • trunk/views/default/edufeedr/singles/educourse_comment.php

    r155 r156  
    3333                // Content 
    3434                $body .= '<div class="edufeedr_comment_content">'; 
     35                // Getting comment content plaintext 
     36                $comment_content = strip_tags($vars['comment']['content']); 
    3537                if ($type == 'coursefeed') { 
    36                         if (strlen($vars['comment']['content'])>200) { 
    37                                 $last_space = strrpos(substr($vars['comment']['content'], 0, 200), ' '); 
    38                                 $body .= substr($vars['comment']['content'], 0, $last_space); 
     38                        if (strlen($comment_content)>200) { 
     39                                $last_space = strrpos(substr($comment_content, 0, 200), ' '); 
     40                                $body .= substr($comment_content, 0, $last_space); 
    3941                        } else { 
    40                                 $body .= $vars['comment']['content']; 
     42                                $body .= $comment_content; 
    4143                        } 
    4244                } else if ($type == 'viewpost'){ 
     
    4850                        if ($vars['comment']['post_id']) { 
    4951                                /*translation:read more*/ 
    50                                 $body .= '<a href="'.$vars['url'].'pg/edufeedr/view_post/'.$vars['educourse']->getGUID().'/'.$comment['post_id'].'">' . elgg_echo('edufeedr:read:more') . '</a>'; 
     52                                $body .= '<a href="'.$vars['url'].'pg/edufeedr/view_post/'.$vars['educourse']->getGUID().'/'.$vars['comment']['post_id'].'">' . elgg_echo('edufeedr:read:more') . '</a>'; 
    5153                                if ($can_edit) { 
    5254                                        $body .= ' | ';