<?php
/**
 * Default contribute template
 * 
 * This file can be overriden. Discover logic and examples on :
 * @url http://dev.linea21.com/projects/linea21/wiki/Override
 * @url http://dev.linea21.com/projects/linea21/wiki/Personnalisation_de_l%27interface_publique
 * 
 * @package linea21\core\public
 * @author $Author$ - Simon Georget <simon@linea21.com>
 * @version $Id$ 
 * @access public
 * @license http://opensource.org/licenses/gpl-3.0.html
 */
?>

<?php

if(defined('MOD_COMMENT') && MOD_COMMENT == 1 && commentEnabled('contribute')) {

  $id = 1;

  SetHTMLTitle(_t('comment','contribute_title'));
  setBreadcrumb(array(_t('comment','contribute_title') => HrefMaker(array('rub'=> $GLOBALS['links'][U_L]['contribute']['linkvalue']))));

  postCommentAction(array('module'=> ActiveItemKey($GLOBALS['activeitem']), 'module_id'=> $id));


  echo '<h1>'._t('comment','contribute_title').'</h1>'.PHP_EOL;
  echo '<div class="sub-title">'.PHP_EOL;
  echo sprintf(_t('comment','contribute_chapo'), getNbComments(array('module'=> ActiveItemKey($GLOBALS['activeitem']), 'module_id'=> $id)));
  echo '</div>'.PHP_EOL;

  displayCommentForm(array('module'=> ActiveItemKey($GLOBALS['activeitem']), 'module_id'=> $id));

  if(commentEnabled('contribute')) {
      echo '<hr />';
      echo '<h3>'._t('comment', 'contribute_item').'</h3>'.PHP_EOL;
      echo '<div id="contribution">'.PHP_EOL;
      displayComments(array('module'=> 'contribute', 'module_id'=> '1', 'order_by' => 'ASC'), false, true);
      echo '</div>'.PHP_EOL;
  }

} else {
  ReloadIndex(CURRENT_APP);
}

?>