<?php /* $ http://form.jotform.co/form/31755601191854 (Radio button example) Result example : In 10 submissions, there are 3 different answers for question #3 : %70 Yes, %20 No, %10 Not Answered $ http://form.jotform.co/form/31755930111851 (Star rating example) Result example : In 6 submissions, there are 4 different answers for question #3 : %50 5, %16.7 1, %16.7 2, %16.7 Not Answered 1) Download JotFormAPI PHP Wrapper : https://github.com/jotform/jotform-api-php 2) Set your apiKey at line 17 (Need one? http://www.jotform.com/myaccount/api) 3) Set your formID and your question ID to get your answers' percentages */ include "JotForm.php"; function getSummary($formID, $questionID) { $jotform = new JotForm("yourAPIKey"); $submissions = $jotform->getFormSubmissions($formID); foreach ($submissions as $id => $submissionDetails) { $answer = isset($submissionDetails["answers"][$questionID]["answer"]) && $submissionDetails["answers"][$questionID]["answer"] != "" ? $submissionDetails["answers"][$questionID]["answer"] : "Not Answered"; $answersArray[$answer] = isset($answersArray[$answer]) ? $answersArray[$answer] + 1 : 1; } $result = ""; arsort($answersArray); foreach ($answersArray as $key => $value) { $percentages[$key] = round($answersArray[$key] * 100 / count($submissions), 1); $result .= "%{$percentages[$key]} {$key}, "; } return sprintf("In %d submissions, there are %d different answers for question #%d : %s \n ", count($submissions), count($answersArray), $questionID, trim($result, ' ,')); } print getSummary(yourFormID, yourQuestionID);
/* documentation at: http://proquiz.softon.org/documentation/ /* Designed & Maintained by /* - Softon Technologies /* Developer /* - Manzovi /* For Support Contact @ /* - proquiz@softon.org /* Release Date : 02 Feb 2011 /* Licensed under GPL license: /* http://www.gnu.org/licenses/gpl.html */ include_once 'functions.php'; if (empty($_GET['qid'])) { header('Location:index.php'); } else { getSummary($pq, $db, $_GET['qid']); } $_SESSION['RESULTS']['total_blank'] = $_SESSION['RESULTS']['total_qstn'] - $_SESSION['RESULTS']['total_correct'] - $_SESSION['RESULTS']['total_wrong']; $_SESSION['RESULTS']['time_unused'] = $_SESSION['RESULTS']['total_time'] * 60 - $_SESSION['RESULTS']['time_used']; $_SESSION['RESULTS']['total_question'] = $_SESSION['RESULTS']['total_qstn']; $_SESSION['RESULTS']['USER'] = getUserData($db, $_SESSION['RESULTS']['user']); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title><?php echo SITETITLE; ?> </title> <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
<option value="05">May</option> <option value="06">June</option> <option value="07">July</option> <option value="08">August</option> <option value="09">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> </td></tr> <tr><td></td><td><input type="submit" value="Submit" /></td></tr> </form> </table> <br/> <br/> <?php if ($_GET['submitted']) { $branch = $_POST['branch']; $year = $_POST['year']; $month = $_POST['month']; $data = getSummary($branch, $month, $year); $days = count($data['pawning']); echo '<center><table width="90%" style="text-align:left" border="1" class="gt-notice-box">' . '<tr><th>Date</th><th>Income</th><th>Interest</th><th>Pawn Took</th><th>Bank Deposit</th>' . '<th>Salary</th><th>Expenses</th><th>Hand Cash</th></tr>'; for ($i = 1; $i <= $days; $i++) { if ($i < 10) { $j = '0' . $i; } else { $j = $i; } echo '<tr><td>' . $year . '.' . $month . '.' . $j . '</td><td>' . $data['income'][$i] . '</td>' . '<td>' . $data['interest'][$i] . '</td><td>-' . $data['pawning'][$i] . '<td></td>' . '<td>-' . $data['salary'][$i] . '</td><td>-' . $data['expenses'][$i] . '<td></td></tr>'; } echo '</table></center>'; }
\t<th>Question</th> \t<th>Summary</th> \t<th>Type</th> \t<th>Quiz</th> \t<th>Created</th> \t<th>Reviewed</th> \t<th></th> </tr> EOT; /** Display questions - could use a table formatter function, but for now coded in this file **/ foreach ($all_questions as $this_question_entry) { print "<tr>\n"; // Allow either q number or summary to be clicked (as summary may be null - eg. picture quiz) print "<td><a href=\"" . ADMIN_EDIT_FILE . "?question=" . $this_question_entry['questionid'] . "\">" . $this_question_entry['questionid'] . "</a></td>"; // uses local getSummary function - see below print "<td><a href=\"" . ADMIN_EDIT_FILE . "?question=" . $this_question_entry['questionid'] . "\">" . getSummary($this_question_entry['intro']) . "</a></td>"; print "<td>" . $this_question_entry['type'] . "</td>"; if (isset($quiz_rel[$this_question_entry['questionid']])) { print "<td>" . $quiz_rel[$this_question_entry['questionid']] . "</td>"; } else { print "<td></td>"; } print "<td>" . $this_question_entry['created'] . "</td>"; print "<td>" . $this_question_entry['reviewed'] . "</td>\n"; print "<td><a href=\"" . ADMIN_Q_FILE . "?question=" . $this_question_entry['questionid'] . "\">Test</a></td>\n"; print "</tr>\n"; } print "</table>\n"; print "</div>\n"; if (isset($debug) && $debug) { $end_time = time();
<?php $layout['pagetitle'] = trans('Events summary'); function getEventsToCloseWithoutAssign() { global $LMS, $SMARTY, $SESSION; $db = LMSDB::getInstance(); $eventsNoAssign = $db->GetAll('SELECT FROM_UNIXTIME(e.date, \'%Y-%m-%d\') AS startdate, e.title, e.id, u.name FROM events e LEFT JOIN users u ON (u.id=e.userid) WHERE e.id NOT IN (SELECT eventid FROM eventassignments) AND e.closed=0'); return $eventsNoAssign; } function getSummary() { global $LMS, $SMARTY, $SESSION; $db = LMSDB::getInstance(); $summary = $db->GetAll('SELECT u.id, u.name, COUNT(e.closed) AS wszystkie, SUM(IF(e.closed, 1, 0)) AS zamkniete, SUM(IF(e.closed, 0, 1)) AS otwarte FROM eventassignments ea LEFT JOIN users u ON (u.id = ea.userid) LEFT JOIN events e ON (e.id = ea.eventid) WHERE u.deleted=0 GROUP BY ea.userid'); return $summary; } $SMARTY->assign('summary', getSummary()); $SMARTY->assign('eventsNoAssign', getEventsToCloseWithoutAssign()); $SMARTY->display('eventssummary.html');
if (!preg_match('/^[a-zA-Z0-9\\.-]+$/', $_GET["tree"])) { die("invalid tree"); } if (!preg_match('/^\\d+\\.\\d+\\.\\d+\\.gz$/', $_GET["id"])) { die("invalid id"); } if (isset($_GET["reftest"]) && $_GET["reftest"] == "true") { $type = "reftest"; } elseif (isset($_GET["starred"]) && $_GET["starred"] == "true") { $type = "starred"; } else { $type = "notstarred"; } header("Content-Type: text/plain,charset=utf-8"); header("Access-Control-Allow-Origin: *"); echo getSummary($_GET["tree"], $_GET["id"], $type); function fgets_whole_line($fp) { $line = ''; while (!feof($fp) && substr($line, -1, 1) != "\n") { $line .= fgets($fp); } return $line; } function getSummary($tree, $id, $type) { if ($type != "starred" && $type != "notstarred" && $type != "reftest") { die("invalid type passed to getSummary"); } $reftest = $type == "reftest"; $starred = $type == "starred";
} //Show summary $payment_summary_data = payone::getPaymentSummaryData('A'); $content = '<h3>SUMMARY:</h3>'; $summary = getSummary($payment_summary_data); $content .= 'Total Unpaid: <i>' . $summary['total_unpaid'] . '</i><br/>'; $content .= 'Total Unpaid Vorkasse: <i>' . $summary['total_unpaid_vorkasse'] . '</i><br/><br/>'; //Show summary per period $period_to_show = 5; $content .= '<a class="view_webpage view_orders_link" href="?open=payment-overview-orders&hidemenu=true"></a>'; for ($i = 0; $i < $period_to_show; $i++) { $invoice_date_start = date("Y-m-01 00:00:00", strtotime("-{$i} month")); $invoice_date_end = $i == 0 ? date("Y-m-d 23:59:59", strtotime("-{$i} month")) : date("Y-m-t 23:59:59", strtotime("-{$i} month")); $filter = "invoice_date >= '{$invoice_date_start}' AND invoice_date <= '{$invoice_date_end}'"; $payment_summary_data = payone::getPaymentSummaryData('A', $filter); $summary = getSummary($payment_summary_data); $content .= '<div class="ibox w450">'; $content .= '<table border="0" cellpadding="0" cellspacing="0" class="w450">'; $content .= '<tr><td colspan="3"><h3>PERIOD ' . ($i + 1) . '</h3></td></tr>'; $content .= '<tr><td>Start Date:</td><td><input name="ids-' . ($i + 1) . '" class="date_picker ids' . ($i + 1) . '" type="text" value="' . date('d.m.Y', strtotime($invoice_date_start)) . '"/></td><td> </td></tr>'; $content .= '<tr><td>End Date:</td><td><input name="ide-' . ($i + 1) . '" class="date_picker ide' . ($i + 1) . '" type="text" value="' . date('d.m.Y', strtotime($invoice_date_end)) . '"/></td><td> </td></tr>'; $content .= '<tr><td>Total Unpaid:</td><td class="tu' . ($i + 1) . '">' . $summary['total_unpaid'] . '</td>'; $content .= '<td rowspan="2" class="tar w150" style="vertical-align:bottom;">' . '<input name="vo-' . ($i + 1) . '" type="button" class="view_orders vo' . ($i + 1) . '" value="View Orders" ' . ($summary['have_orders'] ? '' : 'style="display:none;"') . '/></td></tr>'; $content .= '<tr><td>Total Unpaid Vorkasse:</td><td class="tuv' . ($i + 1) . '">' . $summary['total_unpaid_vorkasse'] . '</td></tr>'; $content .= '</table></div>'; } $javascript = ' function renderPaymentSummary(htmlResult, txtStatus) { if (txtStatus == "success") { var tu = $("total_unpaid", htmlResult).text();
<?php global $user, $dbc; include MAIN_DIR . '/php/ajax.php'; $accountTypes = loadTypes('account_types'); $assets = loadAccounts('asset'); $payments = loadAccounts('payment', date('Y-m-d')); $assetSummary = getSummary('assets'); $paymentsSummary = getSummary('payments'); function loadSummary($summaryArray, $type = 'assets') { global $accountTypes; $total = 0; //var_dump( $summaryArray ); foreach ($summaryArray['summary'] as $key => $summary) { if (isset($summary['min_payment'])) { $total_due += $summary['min_payment']; } $total += $summary['total']; $type = $accountType[$summary['type']]; ?> <tr class="summary-row summary-<?php echo $type; ?> "> <?php foreach ($summary as $key => $value) { $class = "summary-{$key}"; $html = ''; if (is_numeric($value)) {