Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.DocValue.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Generated Header (not documented yet)
9  *
10  * @author Anakeen 2000
11  * @version $Id: Class.DocValue.php,v 1.8 2003/08/18 15:47:04 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  */
15 /**
16  */
17 // ---------------------------------------------------------------
18 // $Id: Class.DocValue.php,v 1.8 2003/08/18 15:47:04 eric Exp $
19 // $Source: /home/cvsroot/anakeen/freedom/freedom/Class/Fdl/Class.DocValue.php,v $
20 // ---------------------------------------------------------------
21 $CLASS_CONTACTVALUE_PHP = '$Id: Class.DocValue.php,v 1.8 2003/08/18 15:47:04 eric Exp $';
22 include_once ('Class.DbObj.php');
23 include_once ('Class.QueryDb.php');
24 include_once ('Class.Log.php');
25 /**
26  * Values of Attribute document
27  * @package FDL
28  * @deprecated
29  *
30  */
31 class DocValue extends DbObj
32 {
33  var $fields = array(
34  "docid",
35  "attrid",
36  "value"
37  );
38 
39  var $id_fields = array(
40  "docid",
41  "attrid"
42  );
43 
44  var $dbtable = "docvalue";
45 
46  var $order_by = "docid";
47 
48  var $fulltextfields = array(
49  "docid",
50  "attrid",
51  "value"
52  );
53 
54  var $sqlcreate = "
55 create table docvalue ( docid int not null,
56  attrid name not null,
57  value text
58  );
59 create unique index idx_docvalue on docvalue (docid, attrid);";
60  // --------------------------------------------------------------------
61  function PreUpdate()
62  {
63  // modify need to add before if not exist
64  $query = new QueryDb($this->dbaccess, "Docvalue");
65 
66  $query->basic_elem->sup_where = array(
67  "attrid = '" . $this->attrid . "'",
68  "docid = " . $this->docid
69  );
70 
71  $query->Query();
72  if ($query->nb == 0) $this->Add();
73  }
74  // return docs where text is in value
75  function GetDocids($text)
76  {
77 
78  $query = new QueryDb($this->dbaccess, get_class($this));
79 
80  $query->basic_elem->sup_where = array(
81  "value ~* '.*$text.*'"
82  );
83 
84  $table1 = $query->Query();
85 
86  $title = array();
87 
88  if ($query->nb > 0) {
89  while (list($k, $v) = each($table1)) {
90  $title[$k] = $v->docid;
91  }
92  unset($table1);
93  }
94  return $title;
95  }
96  // delete all values for a document
97  function DeleteValues($docid)
98  {
99 
100  $query = new QueryDb($this->dbaccess, get_class($this));
101 
102  $query->basic_elem->sup_where = array(
103  "docid = $docid"
104  );
105 
106  $table1 = $query->Query();
107 
108  if ($query->nb > 0) {
109 
110  while (list($k, $v) = each($table1)) {
111  $table1[$k]->delete();
112  }
113  unset($table1);
114  }
115  }
116 }
117 ?>
← centre documentaire © anakeen - published under CC License - Dynacase