Hi

I allow to my users to create questions only from inside the quiz.
With this case, it is not very good when is empty quiz on incomplete quiz published and questions are adding into published quiz.
I suggest to have optionally checkbox in quiz admin, that every new or edited quizes will be stored unpublished, until user doesn't check checkbox "Publish" or optionally another one "Publish this quiz and let users take it".

When unpublished quiz is stored, the message "This quiz is now unpublished and nobody except you and people with admin permissions can see it. When you will be satisfy with your quiz settings and all questions you want will be created and added into this quiz, edit quiz and check published checkbox".

thanks
Igor

Comments

falcon’s picture

Version: 6.x-4.x-dev » 6.x-5.x-dev

All feature requests are moved to quiz 5

igorik’s picture

Hi

I did some quick fixes for this for 4.x.

Here are my steps.

1. set quiz content type that it is created unpublisehd by default. (content type workflow settings)
2. Use Publish content module for setting that authenticated users (or any you wanted roles) can set Published/Unpublished for their quizes. It will create Publish/Unpublish tabs on Quiz node.
3. edit node.tpl and add this code (for full node, not for teaser ):

<?php if ($unpublished) { ?>
    <div class="unpublished"><?php print t('Unpublished'); ?></div>
    <?php 
		if ($node->type == 'quiz') {
			if ( $user->uid == $node->uid) {
				if ( $node->number_of_questions == 0) {			
					print '<div style="font-size: 140%; line-height: 110%; border: 1px solid blue; color: navy; margin-top: 80px; padding: 9px; ">This quiz is marked as Unpublished, and it doesn't contains any questions. Questions for this quiz you can create and add after click on tab Manage questions. <br /><br />When your quiz will be prepared and you will be want to publish it for the others, click on the tab Publish..</div>';
				} else {
					print '<div style="font-size: 140%; line-height: 110%; border: 1px solid blue; color: navy; margin-top: 80px; padding: 9px; ">This quiz is marked as Unpublished, and it is waiting when you publish it. <br /><br />When you will be have all questions you want in this quiz, and you will be want to publish this quiz, click on the tab Publish.</div>';
				}
			}
		}
		
		} else {
			if ( $node->type == 'quiz' ) {
				if ( $node->number_of_questions == 0) {
					if ( $user->uid == $node->uid) {
					?>
					<div style="font-size: 140%; border: 2px solid red; color: maroon; padding: 9px; line-height: 110%; background: yellow;">This quiz doesn't contains any questions <strong>but it is marked as Published</strong>. Click on tab Unpublish and you do it invisible for others, until you add some appropriate questions. After then you can publish it.</div>
					<?php
					}
				}
			}
		}
		?>

That's all, quizes on your site will be from now published only when they will be complete, not more empty quizes, and quiz creators will be notified about publish/unpublish options.

Btw sorry for my english in the code above, I have it in Slovak language for my needs.

Have a nice day
Igor

djdevin’s picture

Component: Code - Quiz module » Code - Quiz core
Issue summary: View changes
Status: Active » Closed (outdated)

This issue is being closed because it was filed against a version that is no longer supported. If the issue still persists in the latest version of Quiz, please open a new issue.