function MarkNotInterested() { global $user; $recordId = $_REQUEST['recordId']; $source = $_REQUEST['source']; require_once ROOT_DIR . '/sys/NotInterested.php'; $notInterested = new NotInterested(); $notInterested->userId = $user->id; require_once ROOT_DIR . '/services/MyResearch/lib/Resource.php'; $resource = new Resource(); $resource->source = $source; $resource->record_id = $recordId; if ($resource->find(true)) { $notInterested->resourceId = $resource->id; if (!$notInterested->find(true)) { $notInterested->dateMarked = time(); $notInterested->insert(); $result = array('result' => true); } else { $result = array('result' => false, 'message' => "This record was already marked as something you aren't interested in."); } } else { $result = array('result' => false, 'message' => 'Unable to find the resource specified.'); } return json_encode($result); }
function markNotInterested() { global $user; $id = $_REQUEST['id']; require_once ROOT_DIR . '/sys/LocalEnrichment/NotInterested.php'; $notInterested = new NotInterested(); $notInterested->userId = $user->id; $notInterested->groupedRecordPermanentId = $id; if (!$notInterested->find(true)) { $notInterested->dateMarked = time(); $notInterested->insert(); $result = array('result' => true, 'message' => "You won't be shown this title in the future."); } else { $result = array('result' => false, 'message' => "This record was already marked as something you aren't interested in."); } return json_encode($result); }