コード例 #1
0
ファイル: lib.php プロジェクト: nadavkav/MoodleTAO
/** 
 *  get the count of completeds depending on the given groupid.
 *  @param object $feedback
 *  @param int $groupid
 *  @param int $courseid
 *  @return mixed count of completeds or false
 */
function feedback_get_completeds_group_count($feedback, $groupid = false, $courseid = false)
{
    global $CFG;
    if ($courseid > 0 and !$groupid <= 0) {
        $sql = 'SELECT id, COUNT( item ) ci
                    FROM  ' . $CFG->prefix . 'feedback_value 
                    WHERE  course_id  = ' . $courseid . '
                    GROUP  BY  item ORDER BY ci DESC';
        if ($foundrecs = get_records_sql($sql)) {
            $foundrecs = array_values($foundrecs);
            return $foundrecs[0]->ci;
        }
        return false;
    }
    if ($values = feedback_get_completeds_group($feedback, $groupid)) {
        return sizeof($values);
    } else {
        return false;
    }
}
コード例 #2
0
ファイル: lib.php プロジェクト: numbas/moodle
/**
 * get the count of completeds depending on the given groupid.
 *
 * @global object
 * @global object
 * @param object $feedback
 * @param int $groupid
 * @param int $courseid
 * @return mixed count of completeds or false
 */
function feedback_get_completeds_group_count($feedback, $groupid = false, $courseid = false) {
    global $CFG, $DB;

    if ($courseid > 0 AND !$groupid <= 0) {
        $sql = "SELECT id, COUNT(item) AS ci
                  FROM {feedback_value}
                 WHERE course_id  = ?
              GROUP BY item ORDER BY ci DESC";
        if ($foundrecs = $DB->get_records_sql($sql, array($courseid))) {
            $foundrecs = array_values($foundrecs);
            return $foundrecs[0]->ci;
        }
        return false;
    }
    if ($values = feedback_get_completeds_group($feedback, $groupid)) {
        return count($values);
    } else {
        return false;
    }
}
コード例 #3
0
$rowOffset1++;
if (empty($items)) {
    $items = array();
}
foreach ($items as $item) {
    //get the class of item-typ
    $itemclass = 'feedback_item_' . $item->typ;
    //get the instance of the item-class
    $itemobj = new $itemclass();
    $rowOffset1 = $itemobj->excelprint_item($worksheet1, $rowOffset1, $item, $mygroupid, $coursefilter);
}
////////////////////////////////////////////////////////////////////////
//print the detailed sheet
////////////////////////////////////////////////////////////////////////
//get the completeds
$completeds = feedback_get_completeds_group($feedback, $mygroupid, $coursefilter);
//important: for each completed you have to print each item, even if it is not filled out!!!
//therefor for each completed we have to iterate over all items of the feedback
//this is done by feedback_excelprint_detailed_items
$rowOffset2 = 0;
//first we print the table-header
$rowOffset2 = feedback_excelprint_detailed_head($worksheet2, $items, $rowOffset2);
if (is_array($completeds)) {
    foreach ($completeds as $completed) {
        $rowOffset2 = feedback_excelprint_detailed_items($worksheet2, $completed, $items, $rowOffset2);
    }
}
$workbook->close();
exit;
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////