?>
"><?php 
    echo format_datetime($version['created_at']);
    ?>
</time></td>

    <td><?php 
    echo link_to($version['history_metadata']['user_private_data']['topo_name'], 'users/view?id=' . $version['history_metadata']['user_private_data']['id']);
    ?>
</td>
    <td><?php 
    display_revision_nature($version['nature'], $version['history_metadata']['is_minor']);
    ?>
</td>
    <td><?php 
    echo parse_bbcode_simple(smart_format($version['history_metadata']['comment']));
    ?>
</td>
  </tr>
<?php 
    $table_list_even_odd++;
}
?>
</table>

<?php 
echo compare_submit($versions_nb, $submit_options);
?>
</form>

<?php 
 /**
  * Executes Feed action
  * NB: cannot be cached ...
  */
 public function executeFeed()
 {
     $feed = new sfGeoRssFeed();
     $lang = $this->getRequestParameter('lang');
     $model = $this->model_class;
     $module = $this->getModuleName();
     $id = $this->getRequestParameter('id');
     $mode = $this->getRequestParameter('mode');
     if ($lang) {
         $languages = sfConfig::get('app_languages_c2c');
     }
     switch ($mode) {
         case 'editions':
             $description = $this->__($lang ? "Latest %1% editions in %2%" : "Latest %1% editions", array('%1%' => $this->__($module), '%2%' => $lang ? $this->__($languages[$lang]) : null));
             $title = $description;
             // TODO Provide better description, different from title
             $link = "@module_whatsnew?module={$module}";
             // TODO maybe we should propose lang filters for whatsnew url?
             $self_link = $lang ? "@feed_lang?module={$module}&lang={$lang}" : "@feed?module={$module}";
             break;
         case 'creations':
             $description = $this->__($lang ? "Latest %1% creations in %2%" : "Latest %1% creations", array('%1%' => $this->__($module), '%2%' => $lang ? $this->__($languages[$lang]) : null));
             $title = $description;
             // TODO Provide better description, different from title
             $link = "@default_index?module={$module}";
             // TODO can we redirect to list with lang filter once it is done?
             $self_link = $lang ? "@creations_feed_lang?module={$module}&lang={$lang}" : "@creations_feed?module={$module}";
             break;
         default:
             // editions of a specific document
             // check that document $id exists in lang $lang, and retrieve its name.
             if (!($document = DocumentI18n::findName($id, $lang, $this->model_class))) {
                 $this->setNotFoundAndRedirect();
             }
             $name = $document->get('name');
             $description = $this->__("Latest editions for \"%1%\" - %2%", array('%1%' => $name, '%2%' => $this->__($languages[$lang])));
             $title = $description;
             // TODO Provide better description, different from title
             $link = "@document_history?module={$module}&id={$id}&lang={$lang}";
             $self_link = "@document_feed?module={$module}&id={$id}&lang={$lang}";
             break;
     }
     $feed->setTitle($title);
     $feed->setLink($link);
     $feed->setFeedUrl($self_link);
     $feed->setDescription($description);
     $feed->setLanguage($lang);
     $feed->setAuthorName('Camptocamp.org');
     $max_number = sfConfig::get('app_feeds_items_limit');
     if ($module != 'documents' || !empty($id)) {
         //usage: listRecent($model, $limit, $user_id = null, $lang = null, $doc_id = null, $mode = 'editions')
         $items = Document::listRecent($this->model_class, $max_number, null, $lang, $id, $mode);
         sfLoader::loadHelpers(array('General', 'SmartFormat'));
         $model_i18n = $model . 'I18n';
         // Add best summit name for routes
         foreach ($items as $key => $item) {
             $items[$key]['module'] = $item[$model]['module'];
             $items[$key]['id'] = $item['document_id'];
             $items[$key]['name'] = $item[$model_i18n]['name'];
             $items[$key]['search_name'] = $item[$model_i18n]['search_name'];
         }
         $routes = Route::addBestSummitName(array_filter($items, array('c2cTools', 'is_route')), $this->__(' :') . ' ');
         foreach ($routes as $key => $route) {
             $items[$key] = $route;
         }
         foreach ($items as $item) {
             $item_id = $item['document_id'];
             $new = $item['version'];
             $module_name = $item[$model]['module'];
             $name = $item['name'];
             $doc_lang = $item['culture'];
             $feedItemTitle = $name . ($mode != 'creations' ? " - r{$new}" . ($lang ? '' : "/{$doc_lang}") : '');
             $feedItem = new sfGeoFeedItem();
             $feedItem->setTitle($feedItemTitle);
             if ($mode == 'creations') {
                 if ($module_name == 'users') {
                     $feedItem->setLink("@document_by_id_lang?module={$module_name}&id={$item_id}&lang={$doc_lang}");
                 } else {
                     $feedItem->setLink("@document_by_id_lang_slug?module={$module_name}&id={$item_id}&lang={$doc_lang}&slug=" . make_slug($item['name']));
                 }
             } else {
                 $feedItem->setLink("@document_by_id_lang_version?module={$module_name}&id={$item_id}&lang={$doc_lang}&version={$new}");
             }
             $feedItem->setAuthorName($item['history_metadata']['user_private_data']['topo_name']);
             //$feedItem->setAuthorEmail($item['history_metadata']['user_private_data']['email']);
             $feedItem->setPubdate(strtotime($item['created_at']));
             $feedItem->setUniqueId("{$item_id}-{$doc_lang}-{$new}");
             $feedItem->setLongitude($item[$model]['lon']);
             $feedItem->setLatitude($item[$model]['lat']);
             $comment = smart_format($item['history_metadata']['comment']);
             $feedItem->setDescription($comment);
             if ($mode != 'creations') {
                 $link = $new > 1 ? ' - ' . link_to(__('View difference between version %1% and %2%', array('%1%' => $new - 1, '%2%' => $new)), "@document_diff?module={$module_name}&id={$item_id}&lang={$doc_lang}&new={$new}&old=" . ($new - 1), array('absolute' => true)) : '';
                 $feedItem->setContent($comment . $link);
             }
             $feed->addItem($feedItem);
         }
     }
     $this->feed = $feed;
     $this->setTemplate('../../documents/templates/feed');
 }
<?php 
if ($needs_username) {
    ?>
    <?php 
    echo link_to($item['history_metadata']['user_private_data']['topo_name'], $link);
    ?>
    </td><td>
<?php 
}
?>

<?php 
display_revision_nature($item['nature'], $item['history_metadata']['is_minor']);
if ($version > 1) {
    printf(' (%s)', link_to(__('diff'), "@document_diff?module={$module_name}&id={$id}&lang={$lang}&new={$version}&old=" . ($version - 1)));
}
?>
</td>

<?php 
if ($comment = $item['history_metadata']['comment']) {
    ?>
<td><em><?php 
    echo parse_bbcode_simple(smart_format($comment));
    ?>
</em></td>
<?php 
}
?>
    
Example #4
0
      <br />
      <?php 
    if ($metadata->get('is_minor')) {
        ?>
      <strong><?php 
        echo __('minor_tag');
        ?>
</strong>
      <?php 
    }
    ?>
      <?php 
    if (trim($metadata->get('comment'))) {
        ?>
      <em>(<?php 
        echo parse_bbcode_simple(smart_format(__($metadata->get('comment'))));
        ?>
)</em>
      <?php 
    }
    ?>
      <br />
      <?php 
    if ($rank == 'old' && $document->getVersion() > 1) {
        echo link_to('&larr;&nbsp;' . __('previous difference'), "@document_diff?module={$module}&id={$id}" . '&lang=' . $document->getCulture() . '&new=' . $document->getVersion() . '&old=' . ($document->getVersion() - 1));
    } elseif ($rank == 'new' && $document->getVersion() != $current_version) {
        echo link_to(__('next difference') . '&nbsp;&rarr;', "@document_diff?module={$module}&id={$id}" . '&lang=' . $document->getCulture() . '&new=' . ($document->getVersion() + 1) . '&old=' . $document->getVersion());
    }
    ?>
  
    </td>
<p class="important_message">
<?php 
echo __('Warning: archived version:') . ' ' . __('version %1%', array('%1%' => $document->getVersion())) . ' (' . format_language_c2c($document->getCulture()) . ')' . ' - ' . format_datetime($metadata->get('written_at')) . ' ' . __('by') . ' ' . link_to($metadata->get('user_private_data')->get('topo_name'), '@document_by_id?module=users&id=' . $metadata->get('user_id'));
?>
<br />
<?php 
if ($metadata->get('is_minor')) {
    $change_comment = '<strong>' . __('minor modification') . '</strong>';
} else {
    $change_comment = '';
}
if (trim($metadata->get('comment'))) {
    if (!$metadata->get('is_minor')) {
        $change_comment = '<strong>' . __('modification') . '</strong>';
    }
    $change_comment .= __(' :') . ' ' . parse_bbcode_simple(smart_format(__($metadata->get('comment'))));
}
echo $change_comment;
?>
<br />
    <?php 
if ($document->getVersion() > 1) {
    echo link_to('&laquo; ' . __('version %1%', array('%1%' => $document->getVersion() - 1)), "@document_by_id_lang_version?module={$module}&id=" . $id . '&version=' . ($document->getVersion() - 1) . '&lang=' . $document->getCulture());
    echo ' | ';
}
echo link_to(__('current version'), "@document_by_id_lang?module={$module}&id=" . $id . '&lang=' . $document->getCulture());
echo ' | ';
echo link_to(__('version %1%', array('%1%' => $document->getVersion() + 1)) . ' &raquo;', "@document_by_id_lang_version?module={$module}&id=" . $id . '&version=' . ($document->getVersion() + 1) . '&lang=' . $document->getCulture());
?>
</p>
Example #6
0
    if (!$mobile_version) {
        echo '<div id="nav_space">&nbsp;</div>';
        echo tabs_list_tag($id, $document->getCulture(), $document->isAvailable(), '', NULL, get_slug($document), 0);
    }
}
echo display_content_top('doc_content');
echo start_content_tag($module . '_content');
// display warning if editing from an archive version
if (!empty($editing_archive)) {
    echo '<p class="warning_message">', __('Warning: you are editing an archive version!'), '</p>';
}
if ($new_document && $linked_with) {
    ?>
    <p class="warning_message">
    <?php 
    echo smart_format(__("This new {$module} will be linked with {$linked_module} '[[{$linked_module}/%2%|%1%]]' (document %2%)", array('%1%' => $linked_name, '%2%' => $linked_with)));
    ?>
    </p>
<?php 
}
echo global_form_errors_tag();
echo form_tag("@document_edit?module={$module}&id=&lang=", array('multipart' => true, 'onsubmit' => 'C2C.submitonce(this)', 'id' => 'editform'));
if ($new_document && $linked_with) {
    $pseudo_id = $module . '_' . mt_rand();
    echo input_hidden_tag('pseudo_id', $pseudo_id);
}
include_partial("{$module}/form_fields", array('document' => $document, 'new_document' => $new_document, 'linked_doc' => $linked_doc, 'associated_books' => isset($associated_books) ? $associated_books : null, 'associated_articles' => isset($associated_articles) ? $associated_articles : null));
$editing_archive = isset($editing_archive) ? $editing_archive : false;
?>
<div id="form_buttons_up" style="display:none">
<?php 
<?php

use_helper('SmartFormat');
?>

<p class="warning_message">
<?php 
echo smart_format("Warning: this document has been merged into another one ([[{$merged_into}]]). It is thus write-protected.");
?>
</p>