} else { echo "<p class=\"filerepo_title\">{$title}</p>"; echo "<a href=\"{$file->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'large')) . "</a>"; echo "<p class=\"filerepo_timestamp\"><small><a href=\"{$vars['url']}pg/file/{$owner->username}\">{$owner->name}</a> {$friendlytime}</small></p>"; //get the number of comments $numcomments = elgg_count_comments($file); if ($numcomments) { echo "<p class=\"filerepo_comments\"><a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a></p>"; } } echo "</div>"; // echo elgg_view("search/gallery",array('info' => $info, 'icon' => $icon)); } else { $info = "<p> <a href=\"{$file->getURL()}\">{$title}</a></p>"; $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/file/{$owner->username}\">{$owner->name}</a> {$friendlytime}"; $numcomments = elgg_count_comments($file); if ($numcomments) { $info .= ", <a href=\"{$file->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>"; } $info .= "</p>"; // $icon = elgg_view("profile/icon",array('entity' => $owner, 'size' => 'small')); $icon = "<a href=\"{$file->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $file->thumbnail, 'file_guid' => $file_guid, 'size' => 'small')) . "</a>"; echo elgg_view_listing($icon, $info); } } else { // Start main version ?> <div class="filerepo_file"> <div class="filerepo_icon"> <a href="<?php echo $vars['url'];
?> <a href="<?php echo $vars['url']; ?> pg/blog/<?php echo $owner->username; ?> "><?php echo $owner->name; ?> </a> <!-- display the comments link --> <?php if ($comments_on && $vars['entity'] instanceof ElggObject) { //get the number of comments $num_comments = elgg_count_comments($vars['entity']); ?> <a href="<?php echo $url; ?> "><?php echo sprintf(elgg_echo("comments")) . " (" . $num_comments . ")"; ?> </a><br /> <?php } ?> </p> <!-- display tags --> <?php $tags = elgg_view('output/tags', array('tags' => $vars['entity']->tags));
echo $image->getURL(); ?> "><img src="<?php echo $vars['url']; ?> mod/tidypics/thumbnail.php?file_guid=<?php echo $image_guid; ?> &size=small" alt="thumbnail"/></a> </div> <?php } else { // list view displays a thumbnail icon of the image, its title, and the number of comments $info = '<p><a href="' . $image->getURL() . '">' . $title . '</a></p>'; $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/profile/{$owner->username}\">{$owner->name}</a> {$friendlytime}"; $numcomments = elgg_count_comments($image); if ($numcomments) { $info .= ", <a href=\"{$image->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>"; } $info .= "</p>"; $icon = "<a href=\"{$image->getURL()}\">" . '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $image_guid . '&size=thumb" alt="' . $title . '" /></a>'; echo elgg_view_listing($icon, $info); } /*************************************************************** * * front page view * ****************************************************************/ } else { if (get_context() == "front" || get_context() == "widget") { // the front page view is a clickable thumbnail of the image
} print_r($name_list); echo '<br>'; echo $name_list;*/ $blogs = get_entities("object", "blog", get_loggedin_user()->getGUID()); //print_r(array_values($blogs)); $comments = array(); $count = array(); $title = array(); $loop = 0; foreach ($blogs as $value) { $comments[$loop] = array(); $comments[$loop]['Title'] = $value->title; $comments[$loop]['Description'] = $value->description; $comments[$loop++]['Count'] = $bcount = elgg_count_comments($value); } function compareOrder($a, $b) { return $a['Count'] - $b['Count']; } usort($comments, 'compareOrder'); $cnt = count($comments); if ($cnt > 0) { $break = 0; for ($i = $cnt - 1; $i >= 0; $i--) { if ($break == 3) { break; } array_push($count, intval($comments[$i]['Count'])); array_push($title, $comments[$i]['Title']);
$blog = isset($vars['entity']) ? $vars['entity'] : FALSE; if (!$blog) { return ''; } $owner = get_entity($blog->owner_guid); $container = get_entity($blog->container_guid); $linked_title = "<a href=\"{$blog->getURL()}\" title=\"" . htmlentities($blog->title) . "\">{$blog->title}</a>"; $categories = elgg_view('categories/view', $vars); $excerpt = $blog->excerpt; $body = $blog->description; $owner_icon = elgg_view("profile/icon", array('entity' => $owner, 'size' => 'tiny')); $tags = elgg_view('output/tags', array('tags' => $blog->tags)); $date = friendly_time($blog->publish_date); // The "on" status changes for comments, so best to check for !Off if ($blog->comments_on != 'Off') { $comments_count = elgg_count_comments($blog); $comments_link = "<a href=\"{$blog->getURL()}#annotations\">" . sprintf(elgg_echo("comments"), $comments_count) . '</a>'; } else { $comments_link = ''; } // links to delete or edit. $edit = ''; if ($blog->canEdit()) { $edit_url = "{$vars['url']}pg/blog/{$owner->username}/edit/{$blog->getGUID()}/"; $edit_link = "<a href=\"{$edit_url}\">" . elgg_echo('edit') . '</a>'; $delete_url = "{$vars['url']}action/blog/delete?guid={$blog->getGUID()}"; $delete_link = "<span class='delete_button'>" . elgg_view('output/confirmlink', array('href' => $delete_url, 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'))) . "</span>"; $status = ''; if ($blog->status != 'published') { $status_text = elgg_echo("blog:status:{$blog->status}"); $status = "<span class='blog_status'>{$status_text}</a>";
$myid = get_loggedin_user()->getGUID(); $area1 = elgg_view_title(elgg_echo('friends:new')); //$area2 = elgg_view('friends/forms/edit', array('friends' => get_user_friends($_SESSION['user']->getGUID(),"",9999))); // Format page $body = ""; $guid = $page_owner->guid; $myid = get_loggedin_user()->getGUID(); //print $myid; $blog_comment = array(); $i = 0; $blog_entity = get_entities("object", "blog", get_loggedin_user()->getGUID()); foreach ($blog_entity as $rows) { $blog_comment[$i] = array(); $blog_comment[$i]['Title'] = $rows->title; $blog_comment[$i]['Description'] = $rows->description; $blog_comment[$i++]['Count'] = elgg_count_comments($rows); } function compareOrder($val1, $val2) { return $val1['Count'] - $val2['Count']; } usort($blog_comment, 'compareOrder'); $cnt = count($blog_comment); //echo $cnt; $body .= "<h3> Top 3 commented post </h3>"; if ($cnt > 0) { $body .= "<table border=1>"; $body .= "<tr> <th><b> Post Name   </b></th> <th> <b>Number of blog_comment</b> </th> </tr>"; $break = 0; for ($i = $cnt - 1; $i >= 0; $i--) { $body .= "<tr>";
function form_view_entities($entities, $form, $viewtype) { global $CONFIG; $html = ''; $qs = $_SERVER["QUERY_STRING"]; if (is_array($entities) && sizeof($entities) > 0) { if (in_array($viewtype, array('list', 'display'))) { $commentable = $form->allow_comments; $recommendable = $form->allow_recommendations; } else { $commentable = $false; $recommendable = $false; } foreach ($entities as $entity) { $form_data_id = $entity->getGUID(); $entity_url = $entity->getURL(); $md_get = get_metadata_for_entity($form_data_id); $md = array(); foreach ($md_get as $m) { if (isset($md[$m->name])) { if (!is_array($md[$m->name]->value)) { $md[$m->name]->value = array($md[$m->name]->value); } $md[$m->name]->value[] = $m->value; } else { $md[$m->name] = new StdClass(); $md[$m->name]->value = $m->value; $md[$m->name]->name = $m->name; } } // add title and description $extras = array('title' => $entity->title, 'description' => $entity->description); foreach ($extras as $k => $v) { $md[$k] = new StdClass(); $md[$k]->value = $v; $md[$k]->name = $k; } $vars = array(); $form_id = $form->getGUID(); $fields = form_get_fields($form_id); if ($fields) { foreach ($fields as $field) { $internalname = $field->internal_name; if (isset($md[$internalname])) { $item = $md[$internalname]; $vars[$item->name] = form_get_field_output($form, $field, $item->value); if ($field->field_type == 'image_upload') { $vars[$item->name . ':thumb'] = elgg_view($view, array('value' => $item->value, 'size' => 'small')); } else { if ($field->field_type == 'video_box') { $vars[$item->name . ':thumb'] = elgg_view($view, array('value' => $item->value, 'size' => 'thumb')); } } } else { // just return empty strings $vars[$internalname] = ''; if ($field->field_type == 'image_upload') { $vars[$internalname . ':thumb'] = ''; } else { if ($field->field_type == 'video_box') { $vars[$internalname . ':thumb'] = ''; } } } } } $comment_bit = ''; $recommend_bit = ''; if ($commentable) { if ($viewtype == 'display') { $comment_bit = elgg_view_comments($entity); } else { $num_comments = elgg_count_comments($entity); if ($num_comments == 1) { $comment_bit = $num_comments . elgg_echo('form:comment'); } else { $comment_bit = $num_comments . elgg_echo('form:comments'); } } } if ($recommendable) { $number_of_recommendations = count_annotations($form_data_id, 'object', 'form_data', 'form:recommendation'); // count_annotations had a bug, but should be fixed now, so comment out this workaround //$number_of_recommendations = form_count(get_annotations($form_data_id, 'object', 'form_data', 'form:recommendation', 1, 0, 500)); if (isloggedin() && $viewtype == 'display') { $number_of_my_recommendations = form_count(get_annotations($form_data_id, 'object', 'form_data', 'form:recommendation', 1, $_SESSION['user']->getGUID())); $user_guid = $_SESSION['user']->getGUID(); if ($number_of_my_recommendations == 0) { $recommendation_template = '<a href="%s">' . elgg_echo("form:recommend_this") . '</a>'; $my_recommend_bit = ' [' . sprintf($recommendation_template, $CONFIG->wwwroot . 'action/form/manage_form_data?form_action=recommend&d=' . $form_data_id) . ']'; } else { $my_recommend_bit = ''; } } else { $my_recommend_bit = ''; } if ($number_of_recommendations == 1) { $recommend_bit = sprintf(elgg_echo('form:recommendation'), $number_of_recommendations) . $my_recommend_bit; } else { $recommend_bit = sprintf(elgg_echo('form:recommendations'), $number_of_recommendations) . $my_recommend_bit; } } if ($viewtype == 'list') { if ($recommend_bit && $comment_bit) { $annotation_bit = $recommend_bit . ', ' . $comment_bit; } else { $annotation_bit = $recommend_bit . $comment_bit; } } else { $annotation_bit = $recommend_bit . '<br /><br />' . $comment_bit; } if (trim($form->list_template) || trim($form->display_template)) { $vars['_url'] = $CONFIG->wwwroot; $vars['_user_message_link'] = '<a href="' . $CONFIG->wwwroot . 'mod/messages/send.php?send_to=' . $entity->owner_guid . '">' . elgg_echo('form:send_a_message') . '</a>'; $vars['_full_view_link'] = '<a href="' . $entity_url . '">' . elgg_echo('form:full_view') . '</a>'; $vars['_full_view_url'] = $entity_url; $vars['_friendlytime'] = friendly_time($entity->time_created); $owner_entity = $entity->getOwnerEntity(); $owner_url = $owner_entity->getUrl(); $vars['_owner_url'] = $owner_url; $vars['_owner_name'] = $owner_entity->name; $vars['_owner_username'] = $owner_entity->username; $vars['_owner_message_link'] = $vars['_user_message_link']; $vars['_owner_icon'] = elgg_view("profile/icon", array('entity' => $owner_entity, 'size' => 'small')); $vars['_annotations'] = $annotation_bit; } if ($viewtype == 'display') { $template = $form->display_template; if (trim($template)) { $content = form_parse_template($template, $vars); $content = form_language_template($content); } else { $content = elgg_view('form/default_form_data_display', array('entity' => $entity, 'annotations' => $annotation_bit)); } } else { if ($viewtype == 'list') { $template = $form->list_template; if (trim($template)) { $content = form_parse_template($template, $vars); $content = form_language_template($content); } else { $content = elgg_view('form/default_form_data_listing', array('entity' => $entity, 'annotations' => $annotation_bit)); } } else { $content = sprintf(elgg_echo('form:submitted'), friendly_time($entity->time_created)); if ($entity->time_updated != $entity->time_created) { $content .= ", " . sprintf(elgg_echo('form:updated'), friendly_time($entity->time_updated)); } } } $html .= $content; } } return $html; }
<a href="<?php echo $vars['url']; ?> pg/videos/list/<?php echo $container_entity->username; ?> "><?php echo $container_entity->name; ?> </a> <!-- display the comments link --> <a href="<?php echo $vars['video']->getURL(); ?> "><?php echo sprintf(elgg_echo("comments")) . " (" . elgg_count_comments($vars['video']) . ")"; ?> </a> <?php echo $DeleteEdit; ?> <p class="generic_comment_owner"> <?php $description = strip_tags($vars['video']->description); echo $description = substr($description, 0, 250) . (strlen($description) > 250 ? '...' : ''); ?> </p> </div> <div class="clearfloat"></div> </div>