Пример #1
0
function doc_Download($arr, $cid)
{
    global $USERZALIK, $USEREXAM, $tchData, $DOPZ, $NEDOPZ, $DOPE, $NEDOPE, $DEVCTO, $MINSIX, $MAXSIX, $EIGHTNINE, $SEVNINE, $SIXNINE, $SIXFOUR, $THIRNINE, $ZEROTHIRFOUR;
    $DEVCTO = 0;
    $EIGHTNINE = 0;
    $SEVNINE = 0;
    $SIXNINE = 0;
    $SIXFOUR = 0;
    $THIRNINE = 0;
    $ZEROTHIRFOUR = 0;
    if (is_array($arr)) {
        $CNTUSR = sizeof($arr);
        require_once "lib_cartFiles.php";
        $head = simbolReplace($head, $tchData);
        $datashow = $head;
        $k = 0;
        foreach ($arr as $v) {
            $k++;
            $FullName = trim($v->lastname) . ' ' . trim($v->firstname);
            //$v->allgd=(int)$v->allgd;
            $grd = $v->allgd;
            if ($grd >= 90 and $grd <= 100 or $grd > 100) {
                ++$DEVCTO;
            }
            if ($grd >= 80 and $grd <= 89) {
                ++$EIGHTNINE;
            }
            if ($grd >= 70 and $grd <= 79) {
                ++$SEVNINE;
            }
            if ($grd >= 65 and $grd <= 69) {
                ++$SIXNINE;
            }
            if ($grd >= 60 and $grd <= 64) {
                ++$SIXFOUR;
            }
            if ($grd >= 34 and $grd <= 59) {
                ++$THIRNINE;
            }
            if ($grd >= 0 and $grd <= 33) {
                ++$ZEROTHIRFOUR;
            }
            if ($grd >= 60) {
                ++$DOPZ;
                ++$MAXSIX;
                ++$DOPE;
            } else {
                if ($grd <= 59) {
                    ++$NEDOPZ;
                    ++$MINSIX;
                    ++$NEDOPE;
                }
            }
            $datashow .= trReplace($tr, $k, $FullName, null, round($v->pcgd), round($v->scgd), round($v->allgd), FourGrd($v->allgd), ECTS($v->allgd, $cid), null);
        }
        if ($tchData->OREXAM == 'exam') {
            $DOPZ = null;
            $NEDOPZ = null;
            $MINSIX = null;
            $MAXSIX = null;
            $USERZALIK = null;
            $USEREXAM = $CNTUSR;
        } else {
            $DOPE = null;
            $NEDOPE = null;
            $USEREXAM = null;
            $USERZALIK = $CNTUSR;
        }
        $bottom = simbolReplace($bottom, $tchData);
        $datashow .= $bottom;
        /*iconv('ANSI','utf-8',$datashow);*/
        //$datashow=iconv('cp1251', 'utf-8', $datashow);//utf8_encode($datashow);
        header("Content-type: application/x-force-download");
        //header("content-type:application/rtf");//mb_internal_encoding("utf-8");; charset=utf-8
        header("content-disposition:attachment; filename=\"cart_" . date("Y-m-d-H-i-s", time()) . ".doc\"");
        echo $datashow;
        exit;
    } else {
        echo "empty data";
    }
}
Пример #2
0
function doc_Download($arr, $dept = null)
{
    global $SPEC, $semestr, $group;
    if (is_array($arr)) {
        foreach ($arr as $k => $v) {
            $CNTUSR = sizeof($arr[$k]);
            break;
        }
        require_once "cartFileMejses.php";
        $head = simbolReplace($head);
        $datashow = $head;
        $k = 0;
        $trLine = null;
        $ij = 0;
        foreach ($arr as $k => $v) {
            ++$ij;
            $trLesson = trLesson($trLesson, $k, $ij);
            if ($ij == 1) {
                for ($i = 0, $num = 1; $i < 18; $i++, $num++) {
                    $trLine .= trReplace($tr, $num, $v[$i]->student, $v[$i]->grade, "A{$num}A2", "A{$num}A3", "A{$num}A4", "A{$num}A5", "A{$num}A6", "A{$num}A7", "A{$num}A8", "A{$num}A9", "A{$num}A10");
                }
            } else {
                for ($i = 0, $num = 1; $i < 18; $i++, $num++) {
                    $trLine = trReplaceOth($trLine, $num, $v[$i]->grade, $ij);
                }
            }
        }
        $sum = sizeof($arr);
        for ($ij = 10; $ij < 11; $ij--) {
            if ($ij < $sum) {
                break;
            }
            $trLesson = trLesson($trLesson, null, $ij);
        }
        /****************/
        for ($ij = 10; $ij < 11; $ij--) {
            if ($ij < $sum) {
                break;
            }
            for ($i = 0, $num = 1; $i < 18; $i++, $num++) {
                $trLine = trReplaceOth($trLine, $num, null, $ij);
            }
        }
        /****************/
        $datashow .= $trLesson;
        $datashow .= $trLine;
        $bottom = simbolReplace($bottom);
        $datashow .= $bottom;
        /*iconv('ANSI','utf-8',$datashow);*/
        //		$datashow=iconv('cp1251', 'utf-8', $datashow);//utf8_encode($datashow);
        header("Content-type: application/x-force-download");
        //header("content-type:application/rtf");//mb_internal_encoding("utf-8");; charset=utf-8
        header("content-disposition:attachment; filename=\"cart_" . date("Y-m-d-H-i-s", time()) . ".xls\"");
        echo $datashow;
        exit;
    }
}