I actually got the recursive mood icon system to work. Its a tad bit slow and has a lot of sql queries but it works.
I need to add more "root" icons.
Here is how the system works:
There is a table of moods with parent moods. A parent mood of zero means the item is a "root" mood. Happy is a root mood. So is sad. Then there are sub moods which are based on the root mood like energetic or depressed.
If a mood doesn't have an icon specified, then my code looks up the parent mood and does another query for that mood's icon. Technically i could alter the code to do that step in one select instead of two but it would be more difficult to keep track of with the current design.
Basically i do an infinite loop looking for moods. if it hits a mood id of zero or doesn't get any records back then it breaks out of the while loop.
There are 28 root moods that need icons. Anyone want to donate some?
Here is the root list:
+----+------------+---------------+
| id | parentmood | title |
+----+------------+---------------+
| 1 | 0 | Happy |
| 2 | 0 | Sad |
| 3 | 0 | Awake |
| 4 | 0 | Tired |
| 5 | 0 | Angry |
| 8 | 0 | Silly |
| 9 | 0 | Confused |
| 10 | 0 | Bewildered |
| 11 | 0 | Smart |
| 12 | 0 | Not Specified |
| 13 | 0 | Hungry |
| 14 | 0 | Accomplished |
| 16 | 0 | Annoyed |
| 17 | 0 | Anxious |
| 18 | 0 | Bored |
| 19 | 0 | Accepted |
| 20 | 0 | Alone |
| 21 | 0 | Ashamed |
| 22 | 0 | Bittersweet |
| 23 | 0 | Blissful |
| 24 | 0 | Dark |
| 40 | 0 | Determined |
| 42 | 0 | Devious |
| 43 | 0 | Energetic |
| 46 | 0 | Enthralled |
| 87 | 0 | Indescribable |
| 88 | 0 | Nerdy |
| 91 | 0 | Okay |
+----+------------+---------------+