From: Chris S. <san...@us...> - 2005-10-27 14:35:21
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9469/scripts/install Added Files: stackBackup.php Log Message: --- NEW FILE: stackBackup.php --- <?php /** * Installs the various functions needed by STACK. * @package install * @subpackage Stack */ /** * Include the stack settings. */ require('../../stackConfig.php'); require('../../stackLib.php'); include_once("{$stack_root}/scripts/stackXML.php"); $file_names = NULL; ?> <html> <head> </head> <hody> <h1>STACK backup.</h1> <h2>Backup all quizzes, including their questions.</h2> <?php /** * Include the stack settings. */ $quiz_store = stack_db_quiz_get(); foreach($quiz_store as $quizs) { $quizid = $quizs['quizid']; $quiz = stack_db_quiz_get($quizid); stack_xml_remove_quiz_meta_defaults($quiz); //Pass quiz by reference and remove all default metadata $name = stack_xml_write_quiz($quiz,"{$stack_root}/{$stack_tmpdir}/"); $file_names[] = $name; echo get_string('FE_quiz_download','stack',''). "<a href='{$stack_web_url}tmp/{$name}'>$name</a>.<br />"; } ?> <h2>Backup all questions, not in quizzes.</h2> <?php $query = 'SELECT questionID, questionName, questionKeywords FROM stackQuestion'; $result = stack_db_query($query); if(0 != mysql_num_rows($result)) { $question_store = NULL; echo '<table>'; $trcol = FALSE; for ($i = 0; $i < mysql_num_rows($result); $i++) { $row = mysql_fetch_row($result); $usage = stack_db_quiz_question_use_report($row[0]); if (FALSE === $usage) { $trcol = !$trcol; $qkeywords = stripslashes($row[2]); if ('' == $row[1]) { $qname = ''; } else { $qname = stripslashes($row[1]); } if ($trcol) { echo "\n<tr bgcolor='#DDDDDD'>\n"; } else { echo "\n<tr bgcolor='#DDDDFF'>\n"; } echo(' <td>' . $row[0] . "</td>\n"); echo(' <td>' . $qname . "</td>\n"); echo(' <td>' . $qkeywords . "</td>\n"); echo "</tr>\n"; $question_store[]=$row[0]; } } echo '</table>'; if (NULL !== $question_store) { $name = stack_xml_write_question_list($question_store, "{$stack_root}/{$stack_tmpdir}/"); $file_names[] = $name; echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; } } else { echo "<p>No unused questions!</p>"; } show_array($file_names); ?> </body> </html> |