2 // vim: set binary noeol et sw=4 sts=4 :
\r
5 // Lucarella, Schein, Arena
\r
7 // Creado: Leandro Lucarella (sáb abr 30 20:21:30 ART 2005)
\r
9 // $Id: Link.php 9 2005-04-30 23:51:21Z llucare $
\r
11 require_once 'Item.php';
\r
12 require_once 'file.php';
\r
14 class Info extends Item
\r
24 var $autor_apellido;
\r
27 var $infoCSVConst = 'data/infos.csv';
\r
30 id | tema | url | autor | comentario | ranking | fecha
\r
33 function Info($param, $loadFromRecord) {
\r
34 if (!$loadFromRecord) {
\r
40 $this->id = $param[0];
\r
41 $this->tema = $param[1];
\r
42 $this->url = $param[2];
\r
43 $this->autor = $param[3];
\r
44 $this->comentario = $param[4];
\r
45 $this->ranking = $param[5];
\r
46 $this->fecha = $param[6];
\r
53 if (is_file($this->infoCSVConst)) {
\r
54 $record_info = fsearchcsv($this->infoCSVConst, $this->id);
\r
56 $this->id = $record_info[0];
\r
57 $this->tema = $record_info[1];
\r
58 $this->url = $record_info[2];
\r
59 $this->autor = $record_info[3];
\r
60 $this->comentario = $record_info[4];
\r
61 $this->ranking = $record_info[5];
\r
62 $this->fecha = $record_info[6];
\r
68 function ingresar( $pId, $pTema, $pURL, $pAutor, $pComentario ) {
\r
70 $this->tema = $pTema;
\r
72 $this->autor = $pAutor;
\r
73 $this->comentario = $pComentario;
\r
75 $this->fecha = time();
\r
79 if (!fappendcsv($this->infoCSVConst, array($this->id, $this->tema, $this->url, $this->autor, $this->comentario, $this->ranking, $this->fecha))) {
\r
80 $resultado = "<strong>ERROR</strong> al agregar la informacion. Revise que los parametros sean los adecuados";
\r
87 <td><img src="<?php echo $this->tema_icono;?>" border="0" alt="icono tema"/></td>
\r
88 <td><img src="<?php echo $this->autor_foto;?>" border="0" alt="icono usuario"/></td>
\r
89 <td><a href="<?php echo $this->url;?>" onclick="location.href='<?php echo $_SERVER['PHP_SELF'] ?>/../info.agregarRanking.php?id=<?php echo $this->id;?>';return false;"><?php echo $this->url;?></a></td>
\r
90 <td><?php echo $this->comentario;?></td>
\r
91 <td><?php echo $this->ranking;?></td>
\r
96 function incrementarRanking() {
\r
97 $this->ranking = $this->ranking + 1;
\r
98 if (($f = fopen($this->infoCSVConst, 'r')) == false) return false; // error
\r
103 $d = fgetcsv($f, 4096);
\r
105 if ($d[0] == $this->id)
\r
107 $d[5] = $this->ranking;
\r
109 if (($f = fopen($this->infoCSVConst, 'r+')) == false) return false; // error
\r
110 while ($indexSave!=($index-1)) { fgetcsv($f, 4096); $indexSave++; }
\r