Page 1 of 1
UQM - How to add "new quiz" icon for Category view page
Posted: Thu Feb 04, 2010 10:01 am
by quahappy
This suggestion was originally
here.
At the moment, if on viewing a list of quizzes within a category and new quiz(zes) has been added, the "new quiz" icon is shown.
It would be excellent if the "new posts" image on forum index could be included on the "Select category" page so users can see that one category (or more) contain new quizzes. If no new quiz within a category then you see "no new posts" image. Or, if possible, custom UQM "new quiz/no new quiz" images. I could create these if demand calls for this.
Re: UQM - How to add "new quiz" icon for Category view page
Posted: Sat Feb 06, 2010 7:28 am
by battye
Try this quahappy, let me know if it works. Don't forget to purge cache afterwards
OPEN quiz.php
FIND
Code: Select all
$quiz_count_quiz_num = find_number_of_quiz_in_category($quiz_category_id);
AFTER ADD
Code: Select all
$new_quiz_sql = 'SELECT COUNT(quiz_id) AS qct FROM ' . QUIZ_TABLE . '
WHERE quiz_category = ' . $quiz_category_id . '
AND quiz_date > ' . $user->data['user_lastvisit'];
$new_quiz_result = $db->sql_query($new_quiz_sql);
$new_quiz_row = $db->sql_fetchrow($new_quiz_result);
$new_quiz_login = ($new_quiz_row['qct'] > 0) ? $user->img('icon_topic_newest', 'VIEW_NEWEST_POST') . ' ' : '';
$db->sql_freeresult($new_quiz_result);
FIND
Code: Select all
$template->assign_block_vars('category_row', array(
'CAT_LINK' => $quiz_category_link,
'CAT_NAME' => $quiz_category_name,
AFTER ADD
Code: Select all
'CAT_NEW_QUIZ' => $new_quiz_login,
OPEN styles/prosilver/template/quiz_body.html
FIND
Code: Select all
<dt><label for="keywords"><a href="{category_row.CAT_LINK}">{category_row.CAT_NAME}</a></label>
IN LINE FIND
BEFORE ADD
Let me know how that goes
Re: UQM - How to add "new quiz" icon for Category view page
Posted: Wed Feb 10, 2010 7:25 am
by quahappy
Sorry for taking a while to reply. Been extremely busy of late.
Thanks for the code battye. Will later insert and test later then let you know how it goes.
Re: UQM - How to add "new quiz" icon for Category view page
Posted: Thu Feb 11, 2010 7:37 pm
by quahappy
Yep. It works.
Only thing I notice is when all new quiz(zes) has been played, the {category_row.CAT_NEW_QUIZ} image still shows and only disappears if you log out and back in again unless of course new quizzes has been added since.