public function clearlabelAction() { $idTag = (int) $this->_getParam('idT'); $idAct = (int) $this->_getParam('idA'); if (!$idTag or !$idAct) { return; } $this->view->response = '1'; try { $label = new AktualsLabel(); $label->getTable()->findOneByAktuals_idAndLabels_id($idAct, $idTag)->delete(); } catch (Exception $e) { $this->view->response = $e->getMessage(); } }
public function create($aData) { if (isset($aData['id'])) { $this->id = $aData['id']; $this->edited = new Doctrine_Expression('NOW()'); } else { $this->created = new Doctrine_Expression('NOW()'); $this->edited = new Doctrine_Expression('NOW()'); } $aTags = Tag::checkTags(Tag::makeTags($aData['tags'])); $this->title = $aData['title']; $this->shortcontent = trim(stripslashes($aData['shortcontent'])); $this->fullcontent = trim(stripslashes($aData['fullcontent'])); $this->tags = strtolower($aData['tags']); $this->active = $aData['active']; $this->link = Webbers_Normalize::Link($aData['title']); $this->published = $aData['published']; $this->AktualsLabels->delete(); $this->save(); $actTags = TagsRelation::getRelations($this->id, 'Aktual'); if ($actTags) { foreach ($actTags as $tag) { $tag->delete(); } } if (sizeof($aTags) > 0) { foreach ($aTags as $tag) { $aktualTags = new TagsRelation(); $aktualTags->rel_id = $this->id; $aktualTags->Tags_id = $tag->id; $aktualTags->relname = 'Aktual'; $aktualTags->save(); } } //die(); $labels = array(); if (isset($aData['newlabel']) and $aData['newlabel'] != '') { $newLabel = Webbers_Normalize::Name($aData['newlabel']); $label = Label::getLabel($newLabel); if ($label != false) { $labelID = $label->id; } else { $label = new Label(); $label->Gname = $newLabel; $label->save(); $labelID = $label->getIncremented(); } $labels = array($labelID); } if (isset($aData['labels']) and sizeof($aData['labels']) > 0) { $labels = array_unique(array_merge($aData['labels'], $labels)); foreach ($labels as $lab) { $al = new AktualsLabel(); $al->Labels_id = $lab; $al->Aktuals_id = $this->id; $al->save(); } } return $this->id; }