function getEffectProducts($status = false, &$categories = array())
{
    global $method, $total;
    $data = getDatas($status, true);
    $products = array();
    $tmp = array();
    $total = abs($total);
    foreach ($data['disabled'] as $c_id => $p) {
        if ($method == 'percentage') {
            if ($total > 100) {
                $count = count($p);
            } else {
                $count = ceil($total * count($p) / 100);
            }
        } else {
            $count = $total;
            if ($total < 1) {
                $count = 1;
            }
        }
        if (count($p) > $count) {
            $tmp = array_rand($p, $count);
        } else {
            $tmp = $p;
        }
        if (!is_array($tmp)) {
            $tmp = array($tmp);
        }
        // fix just one
        $categories[] = $c_id;
        $products = array_merge($products, $tmp);
    }
    $categories = array_unique($categories);
    $products = array_unique($products);
    return $products;
}
예제 #2
0
function extractToPDF()
{
    require_once "/var/www/html/rentree/admin/lib/fpdf.php";
    $students = getDatas();
    $pdf = new FPDF('L', 'mm', 'A4');
    $pdf->AddPage();
    $pdf->SetFont('Arial', '', 10);
    $pdf->SetTitle('Etudiants enregistrés', true);
    $header = array('Identifiant', 'Nom', 'Prenom', 'DDN', 'Telephone', 'Courriel', 'Enregistrement', 'IP');
    ImprovedTable($pdf, $header, $students);
    $pdf->Output();
}