Ejemplo n.º 1
0
print_r($sendReportsTo);
if (is_array($sendReportsTo)) {
    if (!empty($sendReportsTo)) {
        foreach ($sendReportsTo as $ars => $user) {
            $sendiftrue = FALSE;
            $mail = new Zend_Mail();
            $mail->setFrom('*****@*****.**', 'Textmunication.com');
            $mail->addTo($user['email']);
            $mail->setSubject('Daily Reports');
            $excelFile = "";
            if ($user['continent'] != 3) {
                if ($user['edituser'] != '0') {
                    if ($user['continent'] == 0) {
                        $user['continent'] = 3;
                    }
                    $excelDataArray = $weeklyreport->sendingDailyReport_AutoSms($user['continent']);
                    $excelFileName = $user['topic'] . "_dailyauto_" . $user['edituser'];
                    echo $excelFileName . '<br>';
                    logWrite("Creating the Excel spreadsheets");
                    $excel = new Application_Model_Excel();
                    if (isset($excelDataArray)) {
                        $excelFile = $excel->create($excelDataArray, $excelFileName);
                        logWrite("Attaching the spreadsheets");
                        $at = $mail->createAttachment(file_get_contents($excelFile['path']));
                        $at->filename = $excelFile['name'];
                        $sendiftrue = TRUE;
                        sleep(3);
                    }
                }
            } else {
                if ($user['edituser'] != '0') {