Esempio n. 1
0
 /**
  * Deletes QA pair by its associated id
  * 
  * @param string $id QA id
  * @return boolean
  */
 public function deleteById($id)
 {
     // Grab question title before we remove id
     $question = Filter::escape($this->qaMapper->fetchQuestionById($id));
     if ($this->qaMapper->deleteById($id)) {
         $this->track('Question "%s" has been removed', $question);
         return true;
     } else {
         return false;
     }
 }
Esempio n. 2
0
 /**
  * Deletes a faq by its associated id
  * 
  * @param string $id Faq's id
  * @return boolean
  */
 public function deleteById($id)
 {
     $name = Filter::escape($this->faqMapper->fetchQuestionById($id));
     if ($this->faqMapper->deleteById($id)) {
         $this->track('FAQ "%s" has been removed', $name);
         return true;
     } else {
         return false;
     }
 }
Esempio n. 3
0
 /**
  * Deletes a category by its associated id
  * 
  * @param string $id Category id
  * @return boolean
  */
 public function deleteById($id)
 {
     // Grab category's name before we remove it
     $name = Filter::escape($this->categoryMapper->fetchNameById($id));
     if ($this->categoryMapper->deleteById($id) && $this->announceMapper->deleteAllByCategoryId($id)) {
         $this->track('Category "%s" has been removed', $name);
         return true;
     } else {
         return false;
     }
 }
Esempio n. 4
0
 /**
  * Deletes a banner by its associated id
  * 
  * @param string $id Banner id
  * @return boolean
  */
 public function deleteById($id)
 {
     $name = Filter::escape($this->bannerMapper->fetchNameById($id));
     if ($this->delete($id)) {
         $this->track('Banner "%s" has been removed', $name);
         return true;
     } else {
         return false;
     }
 }
Esempio n. 5
0
 /**
  * Deletes an advice by its associated id
  * 
  * @param string $id Advice id
  * @return boolean
  */
 public function deleteById($id)
 {
     // Grab advice's title before we remove id
     $title = Filter::escape($this->adviceMapper->fetchTitleById($id));
     if ($this->adviceMapper->deleteById($id)) {
         $this->track('Advice "%s" has been removed', $title);
         return true;
     } else {
         return false;
     }
 }
Esempio n. 6
0
 /**
  * Deletes a block by its associated id
  * 
  * @param string $id
  * @return boolean
  */
 public function deleteById($id)
 {
     // Grab block's name before we fetch it
     $name = Filter::escape($this->blockMapper->fetchNameById($id));
     if ($this->blockMapper->deleteById($id)) {
         $this->track('Removed "%s" block', $name);
         return true;
     } else {
         return false;
     }
 }
Esempio n. 7
0
 /**
  * Fetches box's content
  * 
  * @return string
  */
 public function fetch()
 {
     return Filter::safeTags($this->aboutBoxMapper->fetch());
 }
Esempio n. 8
0
 /**
  * Deletes an item by its associated id
  * 
  * @param string $id Item's id
  * @return boolean
  */
 public function deleteById($id)
 {
     $name = Filter::escape($this->itemMapper->fetchNameById($id));
     $this->track('The "%s" item has been removed', $name);
     return $this->itemMapper->deleteById($id) && $this->itemMapper->deleteAllByParentId($id);
 }
Esempio n. 9
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $post)
 {
     // Configure image bag
     $imageBag = clone $this->imageManager->getImageBag();
     $imageBag->setId((int) $post['id'])->setCover($post['cover']);
     // Configure time bag now
     $timeBag = clone $this->timeBag;
     $timeBag->setTimestamp((int) $post['timestamp']);
     // And finally prepare post's entity
     $entity = new PostEntity();
     $entity->setImageBag($imageBag)->setTimeBag($timeBag)->setId($post['id'], PostEntity::FILTER_INT)->setLangId($post['lang_id'], PostEntity::FILTER_INT)->setWebPageId($post['web_page_id'], PostEntity::FILTER_INT)->setCategoryId($post['category_id'], PostEntity::FILTER_INT)->setPublished($post['published'], PostEntity::FILTER_BOOL)->setSeo($post['seo'], PostEntity::FILTER_BOOL)->setName($post['name'], PostEntity::FILTER_HTML)->setTitle($post['title'], PostEntity::FILTER_HTML)->setCategoryName($this->categoryMapper->fetchNameById($post['category_id']), PostEntity::FILTER_HTML)->setIntro($post['intro'], PostEntity::FILTER_SAFE_TAGS)->setFull($post['full'], PostEntity::FILTER_SAFE_TAGS)->setSlug(Filter::escape($this->webPageManager->fetchSlugByWebPageId($post['web_page_id'])))->setUrl($this->webPageManager->surround($entity->getSlug(), $entity->getLangId()))->setPermanentUrl('/module/news/post/' . $entity->getId())->setTimestamp($post['timestamp'], PostEntity::FILTER_INT)->setKeywords($post['keywords'], PostEntity::FILTER_HTML)->setMetaDescription($post['meta_description'], PostEntity::FILTER_HTML)->setCover($post['cover'], PostEntity::FILTER_HTML)->setViewCount($post['views'], PostEntity::FILTER_INT);
     return $entity;
 }
Esempio n. 10
0
 /**
  * Returns all product entities stored in the basket
  * 
  * @return array
  */
 public function getProducts()
 {
     $products = $this->collection->getContainer();
     $entities = array();
     foreach ($products as $id => $options) {
         $product = $this->productMapper->fetchById($id);
         if (count($product) === 1) {
             // If a product itself has been removed. We'd simply ignore it and remove it from collection
             $this->removeById($id);
         } else {
             $qty = (int) $options[self::BASKET_STATIC_OPTION_QTY];
             $price =& $options[self::BASKET_STATIC_OPTION_SUBTOTAL_PRICE];
             $imageBag = clone $this->imageBag;
             $imageBag->setId((int) $product['id'])->setCover(Filter::escape($product['cover']));
             // Grab actual price
             $price = $this->getPrice($product);
             // Now finally prepare the entity
             $entity = new BasketEntity();
             $entity->setId($product['id'], BasketEntity::FILTER_INT)->setTitle($product['title'], BasketEntity::FILTER_HTML)->setInStock($product['in_stock'], ProductEntity::FILTER_INT)->setUrl($this->webPageManager->getUrl($product['web_page_id'], $product['lang_id']))->setImageBag($imageBag)->setQty($qty)->setPrice($price)->setSubTotalPrice($qty * $price);
             // Finally add prepared entity
             array_push($entities, $entity);
         }
     }
     // And return in reversed order
     return array_reverse($entities, true);
 }
Esempio n. 11
0
 /**
  * {@inheritDoc}
  */
 protected function toEntity(array $form)
 {
     $entity = new VirtualEntity();
     $entity->setId($form['id'], VirtualEntity::FILTER_INT)->setLangId($form['lang_id'], VirtualEntity::FILTER_INT)->setWebPageId($form['web_page_id'], VirtualEntity::FILTER_INT)->setTitle($form['title'], VirtualEntity::FILTER_HTML)->setName($form['name'], VirtualEntity::FILTER_HTML)->setDescription($form['description'], VirtualEntity::FILTER_SAFE_TAGS)->setSeo($form['seo'], VirtualEntity::FILTER_BOOL)->setSlug(Filter::escape($this->webPageManager->fetchSlugByWebPageId($form['web_page_id'])))->setUrl($this->webPageManager->surround($entity->getSlug(), $entity->getLangId()))->setPermanentUrl('/module/mail-form/' . $entity->getId())->setTemplate($form['template'], VirtualEntity::FILTER_HTML)->setKeywords($form['keywords'], VirtualEntity::FILTER_HTML)->setMetaDescription($form['meta_description'] . VirtualEntity::FILTER_HTML)->setMessage($form['message']);
     return $entity;
 }
Esempio n. 12
0
 /**
  * Removes a category by its associated id
  * 
  * @param string $id Category's id
  * @return boolean
  */
 public function deleteById($id)
 {
     // Grab category's name before we remove it
     $title = Filter::escape($this->categoryMapper->fetchNameById($id));
     // Completely remove the post
     $this->removeChildCategoriesByParentId($id);
     $this->removeAllById($id);
     $this->track('Category "%s" has been removed', $title);
     return true;
 }
Esempio n. 13
0
 /**
  * Deletes a whole album by its id including all its photos
  * 
  * @param string $id Album's id
  * @return boolean
  */
 public function deleteById($id)
 {
     // Save the name into a variable, before an album is removed
     $name = Filter::escape($this->albumMapper->fetchNameById($id));
     // Do remove now
     $this->removeAlbumById($id);
     $this->removeChildAlbumsByParentId($id);
     $this->track('The album "%s" has been removed', $name);
     return true;
 }
Esempio n. 14
0
 /**
  * Removes a post by its associated id
  * 
  * @param string $id Post's id
  * @return boolean
  */
 public function deleteById($id)
 {
     $name = Filter::escape($this->postMapper->fetchNameById($id));
     if ($this->removeAllById($id)) {
         $this->track('Post "%s" has been removed', $name);
         return true;
     } else {
         return false;
     }
 }
Esempio n. 15
0
 /**
  * Deletes a category by its associated id
  * Also remove items associated with given category id
  * 
  * @param string $id
  * @return boolean Depending on success
  */
 public function deleteById($id)
 {
     $name = Filter::escape($this->categoryMapper->fetchNameById($id));
     $this->track('Category menu "%s" has been removed', $name);
     return $this->categoryMapper->deleteById($id) && $this->itemMapper->deleteAllByCategoryId($id);
 }
Esempio n. 16
0
 /**
  * Deletes a page by its associated id
  * 
  * @param string $id Page's id
  * @return boolean
  */
 public function deleteById($id)
 {
     // Gotta grab page's title, before removing it
     $name = Filter::escape($this->pageMapper->fetchNameById($id));
     if ($this->delete($id)) {
         $this->track('The page "%s" has been removed', $name);
         return true;
     } else {
         return false;
     }
 }