我正在运行一个代码,该代码应该从数据库中提取调查问卷,以供具有有效会话的用户进行评估。
然而,该页面在运行此php代码时返回一个空白的不完整页面。
我在这里错过了什么吗?
<?php
session_start();
try
{
if(!isset($_SESSION['logged-in']))
{
header("Location: ../index.php");
}
}
catch(Exception $e)
{
}
// php classes
require_once("../classes/database.php");
require_once("../classes/questionnaire.php");
require_once("../classes/competency.php");
require_once("../classes/candidate.php");
require_once("../classes/participant.php");
require_once("../classes/progress.php");
require_once("../classes/user.php");
require_once("../classes/page.php");
// candidate details
if($_SESSION['usertype'] == 'candidate') // if user is doing a self evaluation
{
$candidatename = User::getName($_SESSION['id']);
$candidateusername = $_SESSION['username'];
// questionnaire object
$q = new Questionnaire(Questionnaire::getQuestionnaireName($_SESSION['id']));
}
else if($_SESSION['usertype'] == 'participant') // if user is evaluating their candidate
{
$candidatename = User::getName(Participant::getCandidateID(NULL, $_SESSION['id']));
$candidateusername = Participant::getCandidate($_SESSION['id']);
// questionnaire object
$q = new Questionnaire(Questionnaire::getQuestionnaireName(Participant::getCandidateID(NULL, $_SESSION['id'])));
}
$candidateID = User::getUID($candidateusername);
// objects
$page = new Page('evaluation');
$user = new User($_SESSION['username']);
// page height
$pagename = $page->name;
$page->setHeight(0, true, $q->numCompetencies());
?>
这是HTML必须输出
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="../css/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="../css/ie.css" />
<link rel="stylesheet" type="text/css" href="../css/custom.css" />
<link rel="stylesheet" type="text/css" href="../css/evaluation.css" />
<link rel="stylesheet" type="text/css" href="../css/progress-bar.css" />
<link rel="stylesheet" type="text/css" href="../css/error.css" />
<!-- JAVASCRIPT -->
<script type="text/javascript" language="javascript" src="../js/slide/help.js"></script>
<script type="text/javascript" language="javascript" src="../js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" language="javascript" src="../js/slide/evaluation.js"></script>
<script type="text/javascript" language="javascript" src="../js/slide/questionnaire.js"></script>
<script type="text/javascript" language="javascript" src="../js/validation/validateevaluation.js"></script>
<script type="text/javascript" language="javascript" src="../js/instructions.js"></script>
</head>
<body onload="viewCompetency('#st1')">
<!-- WEBSITE -->
<!-- BANNER -->
<div class="banner">
<div class="container">
<!-- logo div -->
<div class="span-5 logo"></div>
<!-- menu div -->
<!-- main menu -->
</div>
</div>
<div class="topseparator"></div>
<!-- PAGE CONTENT -->
<div class="container indexdesktop">
<?php include("../common/minidashboard.php"); ?>
<!-- desktop content -->
<div class="span-24" style="height: <?php print $page->height.'px'; ?>">
<!-- CONTENT MODULEBOX -->
<div class="modulebox-classy">
<div class="pageheading"><h3><span class="blue">REDMA 360 </span><span class="grey">EVALUATION</span></h3></div>
<div class="contentwide">
<div class="iconswide" id="addcand"></div>
<p>Kindly give very candid feedback to the person whose name appears below (candidate)</p>
<!-- INSTRUCTIONS -->
<p> </p>
<div class="instructions" id="instructionswidth-evaluation">
<div class="instructions-heading" onclick="showInstructions()"><div class="instructions-icon"></div>INSTRUCTIONS</div>
<div class="instructions-content" id="instructions-content">
<p>Click the <span class="italic">Accordian Menu</span> to show the competency you want to evaluate. Give a rating on the drop-down select box according to the <span class="italic">Scoring Key</span> below. When you have completed scoring <span class="italic">ALL</span> competencies in the <span class="italic">Questionnaire</span>, a <span class="strong italic">Done</span> button will show. Click <span class="strong italic">Done</span> to complete your evaluation.</p>
<p><h5 class="strong white">SCORING KEY:</h5><ol><li>Demonstrates <span class="strong italic">almost none</span> of the behaviour</li><li>Demonstrates <span class="strong italic">some</span> of the behaviour</li><li>Demonstrates <span class="strong italic">about half</span> of the behaviour</li><li>Demonstrates <span class="strong italic">majority</span> of the behaviour</li><li>Demonstrates the behaviour <span class="strong italic">fully</span></li></ol></p> </div>
</div>
</div>
<div class="contentwide" id="evaluationwidth">
<!-- Display Questionnaire -->
<h3>Welcome to Redma360 Evaluation</h3>
<h4 class="grey"><span class="blue">QUESTIONNAIRE:</span> <?php print Questionnaire::getQuestionnaireName($user->username);?><br />
<?php
print '<span class="blue">CANDIDATE:</span> '.strtoupper($candidatename);
if($user->usertype == 'participant') // if user is evaluating their candidate
{
print '<br /><span class="blue">PARTICIPANT ('.Participant::getPartType($user->username).'):</span> '.strtoupper($user->name);
}
?>
</h4>
<!-- Evaluation Accordian -->
<div class="evaluation-container">
<form action="evaluationaction.php" name="saveForm" id="saveForm" method="post" >
<?php $competenciesEvaluatedArr = Questionnaire::displayEvaluationCompetencies($q->getName(), User::getUID($candidateusername), $user->id); ?>
<input type="hidden" name="saveButton" id="saveButton" />
</form>
</div>
<?php
if($user->competenciesdone == $q->numCompetencies())
{
?>
<div class="evaluationthankyou" id="evaluationthankyou">Thank you!</div>
<div class="evaluationsubmitbutton" id="evaluationsubmitbutton">
<form action="evaluationdone.php" name="doneForm" method="post" >
<input type="image" name="doneButton" src="../images/button-done-large.png" />
</form>
</div>
<?php
}
?>
</div>
<!-- progress bar -->
<div class="sidebar-progress" id="sideprogress-evaluation">
<div class="content" id="progress">
<!-- sidebar heading -->
<div class="sidebar-subheading-color-blue" id="evaluation-sidebar-heading">See the progress and number of competencies answered so far below. </div>
<!-- progress bar -->
<div class="content">
<?php Progress::getProgressBar(User::getNumGraded(User::getUID($_SESSION['username'])), Questionnaire::getNumCompetencies($q->getID())); ?>
<p> </p>
</div>
<div class="modulebox-display">
<h4>Competencies Answered So Far</h4>
<table class="competenciesevaluated">
<thead>
<tr>
<th>Competency</th>
</tr>
</thead>
<tbody>
<?php
foreach($competenciesEvaluatedArr as $arr)
{
print '<tr>
<td>'.$arr.'</td>
</tr>';
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- FOOTER -->
<?php include("../common/footer.php"); ?>
</body>
答案 0 :(得分:0)
在标题(....)之后添加退出(0),它可以解决您的问题。
try
{
if(!isset($_SESSION['logged-in']))
{
header("Location: ../index.php");
exit(0);//Add this line
}
}
catch(Exception $e)
{
}
答案 1 :(得分:0)
原来我在附带的questionnaire.php文件中遗漏了一个班级。 将错误报告发送到我的PHP文件非常有用。
由于