/** * Set image read * * @param PluginLsgallery_ModuleImage_EntityImageRead $oImageRead * @return boolean */ public function SetimageRead($oImageRead) { if ($this->GetImageRead($oImageRead->getImageId(), $oImageRead->getUserId())) { $this->Cache_Delete("image_read_{$oImageRead->getImageId()}_{$oImageRead->getUserId()}"); $this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("image_read_user_{$oImageRead->getUserId()}")); $this->oMapper->UpdateImageRead($oImageRead); } else { $this->Cache_Delete("image_read_{$oImageRead->getImageId()}_{$oImageRead->getUserId()}"); $this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array("image_read_user_{$oImageRead->getUserId()}")); $this->oMapper->AddImageRead($oImageRead); } return true; }
/** * Add image read * * @param PluginLsgallery_ModuleImage_EntityImageRead $oImageRead * @return boolean */ public function AddImageRead($oImageRead) { $sql = "INSERT INTO\n " . Config::Get('db.table.lsgallery.image_read') . "\n SET\n comment_count_last = ? ,\n comment_id_last = ? ,\n date_read = ? ,\n image_id = ? ,\n user_id = ?\n "; return $this->oDb->query($sql, $oImageRead->getCommentCountLast(), $oImageRead->getCommentIdLast(), $oImageRead->getDateRead(), $oImageRead->getImageId(), $oImageRead->getUserId()); }