public function indexAction() { $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); $date = new Zend_Date(); $email_model = new Default_Model_EmailLogs(); $cron_model = new Default_Model_Cronstatus(); // appraisal notifications $this->checkperformanceduedate(); // feed forward notifications // $this->checkffduedate(); $cron_status = $cron_model->getActiveCron('General'); if ($cron_status == 'yes') { try { //updating cron status table to in-progress $cron_data = array('cron_status' => 1, 'cron_type' => 'General', 'started_at' => gmdate("Y-m-d H:i:s")); $cron_id = $cron_model->SaveorUpdateCronStatusData($cron_data, ''); if ($cron_id != '') { $mail_data = $email_model->getNotSentMails(); if (count($mail_data) > 0) { foreach ($mail_data as $mdata) { $options = array(); $options['header'] = $mdata['header']; $options['message'] = $mdata['message']; $options['subject'] = $mdata['emailsubject']; $options['toEmail'] = $mdata['toEmail']; $options['toName'] = $mdata['toName']; if ($mdata['cc'] != '') { $options['cc'] = $mdata['cc']; } if ($mdata['bcc'] != '') { $options['bcc'] = $mdata['bcc']; } // to send email $mail_status = sapp_Mail::_email($options); $mail_where = array('id=?' => $mdata['id']); $new_maildata['modifieddate'] = gmdate("Y-m-d H:i:s"); if ($mail_status === true) { $new_maildata['is_sent'] = 1; //to udpate email log table that mail is sent. $id = $email_model->SaveorUpdateEmailData($new_maildata, $mail_where); } } //end of for loop } //end of mails count if //updating cron status table to completed. $cron_data = array('cron_status' => 0, 'completed_at' => gmdate("Y-m-d H:i:s")); $cron_id = $cron_model->SaveorUpdateCronStatusData($cron_data, "id = " . $cron_id); } //end of cron status id if } catch (Exception $e) { } } //end of cron status if }