Esempio n. 1
0
	public static function push_action(Action $action) {
		$mysqli = Database::connection();
		$class = get_class($action);
		switch ($class) {
			case 'JoinDiscussion':
				//Insert into the database the correct key value pairs
				$action_id = $action->log_action();
				$keys = ActionFactory::$action_key_values($class);
				foreach ($keys as $key) {
					$value = ActionFactory::handle_key($action, $keys);
					$insert = "INSERT INTO `action_key_values` (action_id, key, value) VALUES ('$action_id', '$key', '$value')";
					$result = $mysqli->query($insert)
					or die ($mysqli->error);
				}
				return true;
				break;
			case 'ApproveJoinRequest':
				//No need to push action for this one
				return true;
				break;
		}

	}