public function DeleteFavourite(ModuleFavourite_EntityFavourite $oFavourite)
 {
     $sql = "\n\t\t\tDELETE FROM " . Config::Get('db.table.favourite') . " \n\t\t\tWHERE\n\t\t\t\tuser_id = ?d\n\t\t\tAND\n\t\t\t\ttarget_id = ?d\n\t\t\tAND \n\t\t\t\ttarget_type = ?\t\t\t\t\n\t\t";
     if ($this->oDb->query($sql, $oFavourite->getUserId(), $oFavourite->getTargetId(), $oFavourite->getTargetType())) {
         return true;
     }
     return false;
 }
 /**
  * Удаляет теги
  *
  * @param ModuleFavourite_EntityFavourite $oFavourite    Объект избранного
  *
  * @return bool
  */
 public function DeleteTags($oFavourite)
 {
     $sql = "\n\t\t\tDELETE FROM ?_favourite_tag\n\t\t\tWHERE\n\t\t\t\tuser_id = ?d\n\t\t\t\tAND\n\t\t\t\ttarget_type = ?\n\t\t\t\tAND\n\t\t\t\ttarget_id = ?d\n\t\t";
     $bResult = $this->oDb->query($sql, $oFavourite->getUserId(), $oFavourite->getTargetType(), $oFavourite->getTargetId());
     return $bResult !== false;
 }
示例#3
0
 /**
  * Удаляет таргет из избранного
  *
  * @param  ModuleFavourite_EntityFavourite $oFavourite
  * @return bool
  */
 public function DeleteFavourite(ModuleFavourite_EntityFavourite $oFavourite)
 {
     //чистим зависимые кеши
     $this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("favourite_{$oFavourite->getTargetType()}_change_user_{$oFavourite->getUserId()}"));
     $this->Cache_Delete("favourite_{$oFavourite->getTargetType()}_{$oFavourite->getTargetId()}_{$oFavourite->getUserId()}");
     return $this->oMapper->DeleteFavourite($oFavourite);
 }
示例#4
0
 /**
  * Добавляет таргет в избранное
  *
  * @param  ModuleFavourite_EntityFavourite $oFavourite Объект избранного
  * @return bool
  */
 public function AddFavourite(ModuleFavourite_EntityFavourite $oFavourite)
 {
     if (!$oFavourite->getTags()) {
         $oFavourite->setTags('');
     }
     $oUser = $this->ModuleUser_GetUserById($oFavourite->getUserId());
     $this->SetFavouriteTags($oFavourite);
     //чистим зависимые кеши
     $this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("favourite_{$oFavourite->getTargetType()}_change_user_{$oFavourite->getUserId()}"));
     $this->Cache_Delete("favourite_{$oFavourite->getTargetType()}_{$oFavourite->getTargetId()}_{$oFavourite->getUserId()}");
     if ($this->ModuleACL_CanAddFavourite($oFavourite, $oUser)) {
         return $this->oMapper->AddFavourite($oFavourite);
     } else {
         return false;
     }
 }
 /**
  * Удаляет теги
  *
  * @param ModuleFavourite_EntityFavourite $oFavourite Объект избранного
  * @return bool
  */
 public function DeleteTags($oFavourite)
 {
     $sql = "\n      DELETE FROM " . Config::Get('db.table.favourite_tag') . "\n      WHERE\n        user_id = ?d\n        AND\n        target_type = ?\n        AND\n        target_id = ?d\n    ";
     if ($this->oDb->query($sql, $oFavourite->getUserId(), $oFavourite->getTargetType(), $oFavourite->getTargetId())) {
         return true;
     }
     return false;
 }
 /**
  * Удаляет теги
  *
  * @param ModuleFavourite_EntityFavourite $oFavourite Объект избранного
  * @return bool
  */
 public function DeleteTags($oFavourite)
 {
     $sql = "\n\t\t\tDELETE FROM " . Config::Get('db.table.favourite_tag') . "\n\t\t\tWHERE\n\t\t\t\tuser_id = ?d\n\t\t\t\tAND\n\t\t\t\ttarget_type = ?\n\t\t\t\tAND\n\t\t\t\ttarget_id = ?d\n\t\t";
     $res = $this->oDb->query($sql, $oFavourite->getUserId(), $oFavourite->getTargetType(), $oFavourite->getTargetId());
     return $this->IsSuccessful($res);
 }