Ejemplo n.º 1
0
 /**
  * Loads a list of objects for the specicifies parameters, returns an array of Object_Abstract elements
  *
  * @return array
  */
 public function load()
 {
     $comments = array();
     $commentsData = $this->db->fetchAll("SELECT id FROM plugin_ratingscomments_ratings" . $this->getCondition() . $this->getOrder() . $this->getOffsetLimit());
     foreach ($commentsData as $commentData) {
         // return all comments as Type Commenting
         $comments[] = RatingsComments::getById($commentData["id"]);
     }
     $this->model->setComments($comments);
     return $comments;
 }
Ejemplo n.º 2
0
 /**
  * Deletes all comments for the current target
  *
  * @return void
  */
 public function deleteAllForTarget()
 {
     if ($this->model != null) {
         $targetId = $this->model->getTargetId();
         if (!empty($targetId)) {
             try {
                 $this->db->delete("plugin_ratingscomments_ratings", "targetId='" . $targetId . "'");
             } catch (Exception $e) {
                 logger::log(get_class($this) . ": Could not delete ratings for target id [" . $targetId . "]");
                 throw $e;
             }
         }
     }
 }
Ejemplo n.º 3
0
 /**
  *
  * @param int $id
  */
 public static function getById($id)
 {
     $comment = new RatingsComments();
     $comment->getResource()->getById($id);
     return $comment;
 }
Ejemplo n.º 4
0
 public function deleteComment($id)
 {
     $comment = RatingsComments::getById($id);
     $comment->delete();
 }