$rs3 = $db->GetAll($sql); display_chooser($rs3, "operator_id", "operator_id", true, false, false, false); ?> <input type="hidden" name="case_id" value="<?php echo $case_id; ?> "/> <button class="submitclass btn btn-default" type="submit" name="submit" ><i class="fa fa-link fa-lg"></i> <?php echo T_("Assign this case to operator"); ?> </button> </form></div> <?php } //Modify the case in Limesurvey $sid = get_lime_sid($case_id); $id = get_lime_id($case_id); print "<div class='panel-body'>"; if ($id) { print "<h4><a href='" . LIME_URL . "admin/admin.php?action=dataentry&sid={$sid}&subaction=edit&id={$id}' class='btn btn-default btn-lime'><i class='fa fa-lemon-o fa-lg'></i> " . T_("Modify responses for this case") . "</a></h4>"; } else { print "<div class='alert text-danger' role='alert'>" . T_("Case not yet started in Limesurvey") . "</div>"; } print "</div></div>"; if (isset($r[0]['sample_id'])) { // if sample data exists view availability print "<div class='panel-body col-sm-6'><h4 class=''><i class='fa fa-calendar'></i> " . T_("Availability groups") . "</h4>"; if (is_using_availability($case_id)) { //List all availability group items and whether selected or not (all selected by default unless >= 1 availability group is in use for this case $sql = "SELECT qa.availability_group_id,ag.description,ca.availability_group_id as selected_group_id\r\n\t\t\t\tFROM `case` as c\r\n\t\t\t\tJOIN questionnaire_availability AS qa ON (qa.questionnaire_id = c.questionnaire_id)\r\n\t\t\t\tJOIN availability_group AS ag ON (ag.availability_group_id = qa.availability_group_id)\r\n\t\t\t\tLEFT JOIN case_availability AS ca ON (ca.availability_group_id = qa.availability_group_id and ca.case_id = c.case_id)\r\n\t\t\t\tWHERE c.case_id = '{$case_id}'"; $rs = $db->GetAll($sql);
/** * Return the percent complete a questionnaire is, or false if not started * * @param int $case_id The case id * @return bool|float False if no data, otherwise the percentage of questions answered * */ function limesurvey_percent_complete($case_id) { global $db; $lime_sid = get_lime_sid($case_id); if ($lime_sid == false) { return false; } $sql = "SELECT saved_thisstep\r\n\t\tFROM " . LIME_PREFIX . "saved_control\r\n\t\tWHERE sid = '{$lime_sid}'\r\n\t\tAND identifier = '{$case_id}'"; $r = $db->GetRow($sql); if (!empty($r)) { $step = $r['saved_thisstep']; $questions = limesurvey_get_numberofquestions($lime_sid); return $step / $questions * 100.0; } return false; }