function addToWishList($id, $user)
 {
     $wishlistEntry = new EContentWishList();
     $wishlistEntry->userId = $user->id;
     $wishlistEntry->recordId = $id;
     $wishlistEntry->status = 'active';
     if ($wishlistEntry->find(true)) {
         //The record was already added to the database
     } else {
         //Add to the database
         $wishlistEntry->dateAdded = time();
         $wishlistEntry->insert();
     }
     return true;
 }
Example #2
0
 public function getMyWishList($user)
 {
     global $configArray;
     //Get wishlist
     $wishListEntry = new EContentWishList();
     $wishListEntry->userId = $user->id;
     $wishListEntry->status = 'active';
     $wishListEntry->orderBy('title ASC');
     $econtentRecord = new EContentRecord();
     $wishListEntry->joinAdd($econtentRecord, 'INNER');
     $wishListEntry->find();
     $wishList = array();
     while ($wishListEntry->fetch()) {
         $wishListItem = clone $wishListEntry;
         $wishListItem->links[] = array('url' => $configArray['Site']['path'] . '/EcontentRecord/' . $wishListEntry->recordId . '/RemoveFromWishList', 'text' => 'Remove From Wish List');
         $wishListItem->recordId = 'econtentRecord' . $wishListItem->recordId;
         $wishList[$wishListItem->id] = $wishListItem;
     }
     $wishList['items'] = $wishList;
     return $wishList;
 }