public static function addMood($userId, $groupId, $moodId) { $retVal['success'] = true; $mood = new moodhistory(); $mood->set_variable("userId", $userId); $mood->set_variable("moodGroup", $groupId); $mood->set_variable("moodItem", $moodId); $mood->set_variable("date", date("Y-m-d H:i:s")); $mood->createNew(); return $retVal; }
protected function moods($argValues) { if ($this->method == 'GET') { try { $userId = authaccess::getValidUserId($argValues[0]); $history = moodhistory::getLastestMoods($userId, $argValues[1]); return $history; } catch (Exception $e) { return "ERROR - EXPIRED OR INVALID TOKEN"; } } else { if ($this->method == 'POST') { try { $userId = authaccess::getValidUserId($argValues[0]); $history = moodhistory::addMood($userId, $this->input->groupId, $this->input->moodId); return $history; } catch (Exception $e) { return "ERROR - EXPIRED OR INVALID TOKEN"; } } else { return "ERROR - NOT WORKING" . print_r($this->input, true); } } }