public function updatePlayer($aData) { $this->id = $aData['id']; $this->fname = Webbers_Normalize::Name($aData['fname']); $this->sname = Webbers_Normalize::Name($aData['sname']); $this->mailadr = Webbers_Normalize::Email($aData['mailadr']); $this->gender = $aData['gender']; $this->save(); }
public function updateActual($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 = $aData['tags']; $this->active = $aData['active']; $this->link = Webbers_Normalize::Link($aData['title']); $this->AktualsTags->delete(); $this->AktualsLabels->delete(); $this->save(); if (sizeof($aTags) > 0) { foreach ($aTags as $tag) { $aktualTags = new AktualsTag(); $aktualTags->Aktuals_id = $this->id; $aktualTags->Tags_id = $tag->id; $aktualTags->save(); } } $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; }
public function create($aPostData) { $aData = $aPostData['page']; $aMenuData = $aPostData['menu']; $content = trim(stripslashes($aData['content'])); if (isset($aData['id'])) { $this->id = $aData['id']; $this->edited = new Doctrine_Expression("now()"); if ($this->content != $content) { $this->backupPage(); } } else { $this->created = new Doctrine_Expression("now()"); $this->edited = new Doctrine_Expression("now()"); } $this->pname = $aData['pname']; $this->link = Webbers_Normalize::Link($aData['pname']); $this->hd_title = $aData['hd_title']; $this->hd_keywords = $aData['hd_keywords']; $this->content = $content; $this->active = $aData['active']; $this->owner = Zend_Auth::getInstance()->getIdentity()->username; $this->template = isset($aData['template']) ? $aData['template'] : null; $this->save(); if ($aData['menuitem'] == '0') { if (is_array($aMenuData) and $aMenuData['mname'] != '0') { $aMenuData['mname'] = $this->pname; $aMenuData['active'] = $aData['active']; $aMenuData['Pages_id'] = $this->id; $aMenuData['link'] = '/pages/' . $this->link; $menu = new Menu(); $menu->updateMenu($aMenuData); } } else { $menu = Menu::getById($aData['menuitem']); if ($menu->Pages_id > 0) { $oldMenu = Menu::getMenusByPageId($this->id); if ($oldMenu) { $oldMenu->Pages_id = $menu->Pages_id; $oldMenu->save(); } } $menu->mname = $this->pname; $menu->active = $aData['active']; $menu->Pages_id = $this->id; $menu->link = '/pages/' . $this->link; $menu->save(); } return $this->id; }
public function updateMenu($aData) { if (isset($aData['id'])) { $this->id = $aData['id']; } $link = ''; switch ($aData['type']) { case 'gallery': $link = '/galerie'; break; case 'tournaments': $link = '/turnieje'; break; case 'ranks': $link = '/turnieje/ranking'; break; case 'actuals': $link = '/aktualnosci'; break; case 'static': default: $link = '/pages/' . Webbers_Normalize::Link($aData['mname']); break; } $parentId = (int) $aData['parent_id']; if ($parentId == 0) { $aElements = self::getElementByParent(0); if ($aElements->count() == 1) { $element = $aElements->getFirst(); $parentId = (int) $element->id; } else { if ($aElements->count() > 1) { $element = $aElements->getFirst(); $parentId = (int) $element->id; foreach ($aElements as $elem) { if ($elem->id != $element->id) { $elem->parent_id = (int) $element->id; $elem->save(); } } } } } $this->mname = $aData['mname']; $this->type = $aData['type']; $this->link = $link; $this->active = $aData['active']; $this->parent_id = $parentId; $this->Pages_id = (int) $aData['Pages_id']; $this->ord = $this->getOrder($parentId); $this->save(); $this->setOrder($this->id, $this->ord); return $this->id; }