/** * Store information about activity. * * <code> * $userId = 1; * $content = "..."; * * $activity = new Prism\Integration\Activity\Gamification($userId, $content); * $activity->store(); * </code> */ public function store() { $activity = new Activity(\JFactory::getDbo()); $activity->setContent($this->getContent()); $activity->setUserId($this->getUserId()); if ($this->title !== null) { $activity->setTitle($this->getTitle()); } if ($this->image !== null) { $activity->setImage($this->getImage()); } if ($this->url !== null) { $activity->setUrl($this->getUrl()); } $activity->store(); }
/** * Return the activities as array with objects. * * <code> * $options = array( * "ids" => array(1,2,3,4,5) * ); * * $activities = new Gamification\Activity\Activities(\JFactory::getDbo()); * $activities->load($options); * * $activities = $activities->getActivities(); * </code> * * @return array */ public function getActivities() { $results = array(); $i = 0; foreach ($this->items as $item) { $activity = new Activity($this->db); $activity->bind($item); $results[$i] = $activity; $i++; } return $results; }