7th-grader who shot himself planned attack on school: cops