/** * @desc Almacena las etiquetas del elemento */ private function saveTags() { $sql = "DELETE FROM " . $this->db->prefix('dtrans_softtag') . " WHERE id_soft=" . $this->id(); $this->db->queryF($sql); $tc = TextCleaner::getInstance(); $tags = array(); foreach ($this->_tags as $tag) { if (is_array($tag)) { $tag = $tag['tag']; } $ot = new DTTag($tc->sweetstring($tag)); if ($ot->isNew()) { $ot->setVar('tag', $tag); $ot->setVar('tagid', $tc->sweetstring($tag)); $ot->save(); } $tags[] = $ot->id(); } if (empty($tags)) { return; } $sql = "INSERT INTO " . $this->db->prefix('dtrans_softtag') . " (`id_soft`,`id_tag`) VALUES "; $sql1 = ''; foreach ($tags as $k) { $sql1 .= $sql1 == "" ? "('" . $this->id() . "','{$k}')" : ",('" . $this->id() . "','{$k}')"; } if ($this->db->queryF($sql . $sql1)) { return true; } $this->addError($this->db->error()); return false; }