function Widget_MySurveys() { $this->Widget('mysurveys'); $no_survey = true; // Get id and title of the survey that will be promoted to user page. default = survey whose id=1 if ($GLOBALS['sys_my_page_survey']) { $developer_survey_id = $GLOBALS['sys_my_page_survey']; } else { $developer_survey_id = "1"; } $survey = SurveySingleton::instance(); $sql = "SELECT * from surveys WHERE survey_id=" . db_ei($developer_survey_id); $result = db_query($sql); $group_id = db_result($result, 0, 'group_id'); $purifier = Codendi_HTMLPurifier::instance(); $survey_title = $purifier->purify($survey->getSurveyTitle(db_result($result, 0, 'survey_title'))); // Check that the survey is active $devsurvey_is_active = db_result($result, 0, 'is_active'); if ($devsurvey_is_active == 1) { $sql = "SELECT * FROM survey_responses " . "WHERE survey_id='" . db_ei($developer_survey_id) . "' AND user_id='" . db_ei(user_getid()) . "'"; $result = db_query($sql); if (db_numrows($result) < 1) { $no_survey = false; $this->content .= '<a href="/survey/survey.php?group_id=' . $group_id . '&survey_id=' . $developer_survey_id . '">' . $survey_title . '</a>'; } } if ($no_survey) { $this->content .= $GLOBALS['Language']->getText('my_index', 'no_survey'); } }
function ShowResultsGroupSurveys($result) { global $group_id, $Language; $survey =& SurveySingleton::instance(); $rows = db_numrows($result); $cols = db_numfields($result); $title_arr = array(); $title_arr[] = $Language->getText('survey_index', 's_id'); $title_arr[] = $Language->getText('survey_index', 's_tit'); echo html_build_list_table_top($title_arr); for ($j = 0; $j < $rows; $j++) { echo "<tr class=\"" . html_get_alt_row_color($j) . "\">\n"; echo "<TD><A HREF=\"survey.php?group_id={$group_id}&survey_id=" . db_result($result, $j, "survey_id") . "\">" . db_result($result, $j, "survey_id") . "</TD>"; printf("<TD>%s</TD>\n", $survey->getSurveyTitle(db_result($result, $j, 'survey_title'))); echo "</tr>"; } echo "</table>"; //</TD></TR></TABLE>"); }
<?php echo $Language->getText('survey_admin_update_question', 'q'); ?> <BR> <TEXTAREA NAME="question" COLS="80" ROWS="8" WRAP="SOFT"><?php echo $purifier->purify($question); ?> </TEXTAREA> <P> <?php echo $Language->getText('survey_admin_add_question', 'q_type'); ?> <BR> <?php $survey =& SurveySingleton::instance(); echo $survey->showTypeBox('question_type', $question_type); // see if the question is a radio-button type $qry1 = "SELECT * FROM survey_questions WHERE group_id='" . db_ei($group_id) . "' AND question_id='" . db_ei($question_id) . "'"; $res1 = db_query($qry1); $question_type = db_result($res1, 0, 'question_type'); ?> <P> <INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="<?php echo $Language->getText('survey_admin_update_question', 'subm_changes'); ?> ">
function survey_utils_show_questions($result, $hlink_id = true, $show_delete = true) { global $group_id, $Language; $survey =& SurveySingleton::instance(); $rows = db_numrows($result); echo "<h3>" . $Language->getText('survey_s_utils', 'found', $rows) . "</h3>"; $title_arr = array(); $title_arr[] = $Language->getText('survey_s_utils', 'q_id'); $title_arr[] = $Language->getText('survey_admin_update_question', 'q'); $title_arr[] = $Language->getText('survey_admin_show_r_aggregate', 'type'); if ($show_delete) { $title_arr[] = $Language->getText('survey_s_utils', 'del'); } echo html_build_list_table_top($title_arr); for ($j = 0; $j < $rows; $j++) { $question_id = db_result($result, $j, 'question_id'); $question_type_id = db_result($result, $j, 'question_type_id'); if ($question_type_id == 6 || $question_type_id == 7) { $warning = 'warning_loose_data'; } else { $warning = 'warning_loose_answers'; } echo "<tr class=\"" . html_get_alt_row_color($j) . "\">\n"; if ($hlink_id) { echo "<TD><A HREF=\"/survey/admin/edit_question.php?func=update_question&group_id={$group_id}&question_id={$question_id}\">{$question_id}</A></TD>\n"; } else { echo "<TD>{$question_id}</TD>\n"; } echo '<TD>' . db_result($result, $j, 'question') . "</TD>\n" . '<TD>' . $survey->getLabel($question_type_id) . "</TD>\n"; if ($show_delete) { echo '<TD align=center>' . "<a href=\"/survey/admin/edit_question.php?func=delete_question&group_id={$group_id}&question_id={$question_id}\" " . '" onClick="return confirm(\'' . $Language->getText('survey_s_utils', $warning) . '\')">' . '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" BORDER="0" ALT="' . $Language->getText('survey_s_utils', 'del_txt') . '"></A></TD>'; } echo "</tr>"; } echo "</table>"; }