canEdit()) {
$owner = $blog->getOwnerEntity();
$revisions = array();
if ($auto_save_annotations = $blog->getAnnotations('blog_auto_save', 1)) {
$revisions[] = $auto_save_annotations[0];
}
// count(FALSE) == 1! AHHH!!!
if ($saved_revisions = $blog->getAnnotations('blog_revision', 10, 0, 'time_created DESC')) {
$revision_count = count($saved_revisions);
} else {
$revision_count = 0;
}
$revisions = array_merge($revisions, $saved_revisions);
if ($revisions) {
echo '
' . elgg_echo('blog:revisions') . '
';
$n = count($revisions);
echo '';
$load_base_url = elgg_get_site_url()."pg/blog/{$owner->username}/edit/{$blog->getGUID()}/";
// show the "published revision"
if ($blog->status == 'published') {
$load = elgg_view('output/url', array(
'href' => $load_base_url,
'text' => elgg_echo('blog:status:published')
));
$time = "".elgg_view_friendly_time($blog->publish_date)."";
echo '-
' . $load . ": $time
";
}
foreach ($revisions as $revision) {
$time = "".elgg_view_friendly_time($revision->time_created)."";
if ($revision->name == 'blog_auto_save') {
$revision_lang = elgg_echo('blog:auto_saved_revision');
} else {
$revision_lang = elgg_echo('blog:revision') . " $n";
}
$load = elgg_view('output/url', array(
'href' => $load_base_url . $revision->id,
'text' => $revision_lang
));
$text = "$load: $time";
$class = 'class="auto_saved"';
$n--;
echo <<<___END
-
$text
___END;
}
echo '
';
}
}