4 // Lucarella, Schein, Arena
6 // Creado: Sebastian Arena
8 require_once 'Item.php';
10 class Comentario extends Item
19 var $comentarioCSVBaseConst = 'data/comentarios';
20 var $comentarioCSVConst = '';
23 id | autor | comentario | fecha
26 function Comentario($param, $pInfo_ID, $loadFromRecord) {
27 $this->comentarioCSVConst = $this->comentarioCSVBaseConst . "." . $pInfo_ID . ".csv";
28 if (!$loadFromRecord) {
34 $this->id = $param[0];
35 $this->autor = $param[1];
36 $this->texto = $param[2];
37 $this->fecha = $param[3];
42 if (is_file($this->comentarioCSVConst)) {
43 $record_info = fsearchcsv($this->comentarioCSVConst, $this->id);
45 $this->id = $param[0];
46 $this->autor = $param[1];
47 $this->texto = $param[2];
48 $this->fecha = $param[3];
54 return fappendcsv($this->comentarioCSVConst, array( $this->id, $this->autor, $this->texto, $this->fecha ));
57 function saveLoadThis( $pId, $pInfo_ID, $pComentario, $pAutor ) {
59 $this->autor = $pAutor;
60 $this->texto = preg_replace('[\n|\r\n]','<br/>',$pComentario);
61 $this->fecha = time();
62 $this->comentarioCSVConst = $this->comentarioCSVBaseConst . "." . $pInfo_ID . ".csv";
65 function ingresar( $pId, $pInfo_ID, $pComentario, $pAutor ) {
66 $this->saveLoadThis( $pId, $pInfo_ID, $pComentario, $pAutor );
68 if (!$this->saveNew()) {
69 $resultado = "<strong>ERROR</strong> al agregar el comentario. Revise que los parametros sean los adecuados";
70 file_log_add($pAutor,$resultado);
72 file_log_add($pAutor,"Se agregó el comentario");
80 if ($this->autor_original != $this->autor) {
82 <td><img src="<?php echo $this->autor_foto;?>" border="0" alt="icono usuario"/></td>
83 <td><?php echo $this->autor_apellido;?></td><?php
86 <td colspan="2"><?php echo $this->autor_original;?> (autor original)</td><?php
89 <td><?php echo $this->texto;?></td>