set_enrichText("full");
$description->id="ag_description";
$has_description = false;
//---------------------------------- Description -------------------------------------------------------------------
// if there are comments then the first one is the description
// variable: $acomment[0]
//
if ( count($acomment)> 0) {
$has_description = true;
$editable_description = Document_Option::is_enable_editable_description($this->dt_id);
// if editable and the description can be changed
if ( $p_view != 'READ' && $editable_description == true){
echo h2(_("Description"));
$itDescription=new ITextarea("ag_description");
$itDescription->style='class="input_text field_follow_up" style="height:21rem;width:98%;margin-left:1em;"';
$itDescription->set_enrichText('enrich');
$ag_description_id= $acomment[0]['agc_id'];
$itDescription->value=$acomment[0]['agc_comment_raw'];
$itDescription->id="ag_description";
echo \HtmlInput::hidden("ag_description_id",$acomment[0]['agc_id']);
echo $itDescription->input();
}
elseif ($p_view == 'READ' || $editable_description == false)
{
echo h2(_("Description"));
echo '
';
echo $acomment[0]['agc_comment_raw'];
echo '
';
echo '';
}
} elseif ( count($acomment)> 0 && $p_view != 'READ') {
// there is no comments so there is no description, just input one
echo h2(_("Description"));
$description->set_enrichText('enrich');
$description->style='style="height:250px;width:90%;"';
echo '
';
echo $description->input();
echo '
';
} elseif ( $p_view != 'READ' ) {
// no description and no comment it is a new document
echo h2(_("Description"));
$description->set_enrichText('enrich');
$description->style='style="height:250px;width:90%;"';
echo '
';
echo $description->input();
echo '
';
}
$aFile=[];
if ( count($acomment) > 0 ) {
// link to files to download
$aFile=$this->db->get_array('select d_id,d_filename,d_description,d_mimetype
from action_comment_document
join document on (d_id=document_id) where action_gestion_comment_id=$1'
, array($acomment[0]['agc_id']));
if ( ! empty ($aFile)) {
echo '
';
echo _("Fichiers :");
foreach ($aFile as $file)
{
$url="export.php?".http_build_query(array("act"=>'RAW:document'
,"gDossier"=>$dossier_id
,"d_id"=>$file["d_id"]));
printf('
%s',
$url,h($file['d_filename']));
}
echo '
';
}
}
//---------------------------------- -----------------------------------
//Comment
//---------------------------------- -----------------------------------
//------------------------------------------------
// Single comment to edit
//------------------------------------------------
if ( Document_Option::can_add_comment($ag_id) &&
Document_Option::option_comment($this->dt_id) == "ONE_EDIT" )
{
echo '';
}
//------------------------------------------------
// Multiple comments
//------------------------------------------------
if ( count($acomment) > 0
&& Document_Option::can_add_comment($ag_id)
&& Document_Option::option_comment($this->dt_id) == "SOME_FIXED")
{
echo h2(_("Commentaire"));
echo '';
}
?>