Gino Multimedia  0.1
Modulo di gestione di contenuti multimediali per Gino CMS
 Tutto Strutture dati File Funzioni Variabili Gruppi Pagine
class.multimediaTag.php
Vai alla documentazione di questo file.
1 <?php
26 class multimediaTag extends propertyObject {
27 
28  private $_controller;
29  public static $_tbl_tag = "multimedia_tag";
30 
37  function __construct($id, $instance) {
38 
39  $this->_controller = $instance;
40  $this->_tbl_data = self::$_tbl_tag;
41 
42  $this->_fields_label = array(
43  'name'=>_("Nome")
44  );
45 
46  parent::__construct($id);
47 
48  $this->_model_label = $this->id ? $this->name : '';
49  }
50 
58  public static function getAllList($instance, $options) {
59 
60  $db = db::instance();
61 
62  $res = array();
63  $rows = $db->select(array('id', 'name'), self::$_tbl_tag, "instance='$instance'", 'name', null);
64  if(count($rows)) {
65  foreach($rows as $row) {
66  if(gOpt('jsescape', $options, false)) {
67  $name = jsVar($row['name']);
68  }
69  else {
70  $name = htmlChars($row['name']);
71  }
72  $res[$row['id']] = $name;
73  }
74  }
75 
76  return $res;
77 
78  }
79 
87  public static function saveTag($instance, $tag) {
88 
89  $db = db::instance();
90 
91  if($tag == '') return null;
92 
93  $rows = $db->select('id', self::$_tbl_tag, "instance='$instance' AND name='$tag'", null);
94  if(count($rows) and $rows) {
95  return $rows[0]['id'];
96  }
97  else {
98  $query = "INSERT INTO ".self::$_tbl_tag." (instance, name) VALUES ('$instance', '$tag')";
99  $res = $db->actionquery($query);
100  return $db->getlastid(self::$_tbl_tag);
101  }
102 
103  }
104 
105 }
106 
107 ?>