Ejemplo n.º 1
0
 public function reminder($id_user)
 {
     $i = 0;
     if (Zend_Registry::isRegistered('Zend_Translate')) {
         $translator = Zend_Registry::get('Zend_Translate');
     }
     if (!$id_user || $id_user == null) {
         $modelReminder = new Reminder();
         $dataReminders = $modelReminder->fetchToSendEmailAll();
     } elseif ($id_user) {
         $modelReminder = new Reminder();
         $dataReminders = $modelReminder->fetchToSendEmail($id_user);
     }
     foreach ($dataReminders as $dataReminder) {
         $modelUser = new User();
         $dataUsers = $modelUser->findOne($dataReminder['created_by']);
         $userEmail = $dataUser['email'];
         $this->view->description = str_replace("ó", "ó", strip_tags($dataReminder['description']));
         $body = $this->view->render('/_mail/reminder.phtml');
         $client = new Logic_MailerAdapter();
         $client->mail($userEmail, $translator->translate('Reminder') . ' - ' . $dataReminder['title'], array('type' => 1, 'content' => $body));
         $modelReminder->setAsSent($dataReminder['id']);
         $i++;
     }
     return $i;
 }