public function __construct($config = array())
 {
     parent::__construct($config = array());
     // add the path to the scripts
     $this->setScriptPath(APPLICATION_PATH . "/views/scripts/email/");
     $this->appname = getAppName();
     $config = Zend_Registry::get("config");
     // default sign off name and email
     $mail = Zend_Registry::get('mail');
     $default_sender = $mail->getDefaultFrom();
     //$this->signoffname = $default_sender['name'];
     //$this->signoffemail = $default_sender['email'];
     $this->signoffname = getDefaultAdminName();
     $this->signoffemail = getDefaultAdminEmail();
     $this->contactusurl = $this->serverUrl($this->baseUrl('contactus'));
     $this->logourl = $this->serverUrl($this->baseUrl('images/logo.jpg'));
     $this->loginurl = $this->serverUrl($this->baseUrl('user/login'));
     $this->baseurl = $this->serverUrl($this->baseUrl());
     $this->settingsurl = $this->serverUrl($this->baseUrl('profile/view/tab/account'));
     $allcolors = getAllThemeColors();
     //debugMessage($allcolors);
     $colortxt = getThemeColor();
     $themecolor = "blue";
     if (!isEmptyString($colortxt)) {
         $themecolor = $colortxt;
     }
     $this->themecolor = $allcolors[$themecolor];
     // debugMessage('color is '.$allcolors[$themecolor]);
 }
function getNotificationSenderName()
{
    $config = Zend_Registry::get("config");
    return getDefaultAdminName();
}
 /**
  * Send an email with a link to activate the users' account
  */
 function sendRecoverPasswordEmail()
 {
     $session = SessionWrapper::getInstance();
     $template = new EmailTemplate();
     // create mail object
     $mail = getMailInstance();
     // assign values
     $template->assign('firstname', $this->getFirstName());
     // just send the parameters for the activationurl, the actual url will be built in the view
     // $template->assign('resetpasswordurl', array("controller"=> "user","action"=> "resetpassword", "actkey" => $this->getActivationKey(), "id" => encode($this->getID())));
     $viewurl = $template->serverUrl($template->baseUrl('user/resetpassword/id/' . encode($this->getID()) . "/actkey/" . $this->getActivationKey() . "/"));
     $template->assign('resetpasswordurl', $viewurl);
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     // configure base stuff
     $mail->addTo($this->getEmail());
     // set the send of the email address
     $mail->setFrom(getDefaultAdminEmail(), getDefaultAdminName());
     $mail->setSubject($this->translate->_('profile_email_subject_recoverpassword'));
     // render the view as the body of the email
     $mail->setBodyHtml($template->render('recoverpassword.phtml'));
     // debugMessage($template->render('recoverpassword.phtml'));
     try {
         $mail->send();
     } catch (Exception $e) {
         $session->setVar(ERROR_MESSAGE, 'Email notification not sent! ' . $e->getMessage());
     }
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     $mail->clearFrom();
     return true;
 }
 function sendPayslipNotification()
 {
     $template = new EmailTemplate();
     # create mail object
     $mail = getMailInstance();
     $view = new Zend_View();
     $session = SessionWrapper::getInstance();
     // assign values
     $template->assign('firstname', $this->getUser()->getFirstName());
     $subject = "Payslip " . date('F Y', strtotime($this->getPayroll()->getStartDate()));
     $save_toinbox = true;
     $type = "payroll";
     $subtype = "payslip_generated";
     $viewurl = $template->serverUrl($template->baseUrl('temp/' . $this->getPDFName() . '.pdf'));
     $message_contents = "<p>This is to confirm that your Payslip for <b>" . date('F Y', strtotime($this->getPayroll()->getStartDate())) . "</b> has been completed and attached.</p>\n\t\t<p>You can also view it online <a href='" . $viewurl . "'>click here<a></p>\n\t\t<br />\n\t\t<p>" . $this->getPayroll()->getCreator()->getName() . "<br />\n\t\t" . getAppName() . "</p>\n\t\t";
     $template->assign('contents', $message_contents);
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     // configure base stuff
     $mail->addTo($this->getUser()->getEmail(), $this->getUser()->getName());
     // set the send of the email address
     $mail->setFrom(getDefaultAdminEmail(), getDefaultAdminName());
     $mail->setSubject($subject);
     // add attachment
     $content = file_get_contents($this->getPDFPath());
     // e.g. ("attachment/abc.pdf")
     $attachment = new Zend_Mime_Part($content);
     $attachment->type = 'application/pdf';
     $attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
     $attachment->encoding = Zend_Mime::ENCODING_BASE64;
     $attachment->filename = $this->getPDFName();
     // name of file
     $mail->addAttachment($attachment);
     // render the view as the body of the email
     $html = $template->render('default.phtml');
     $mail->setBodyHtml($html);
     // debugMessage($html); // exit();
     if ($this->getUser()->allowEmailForPayslip() && !isEmptyString($this->getUser()->getEmail())) {
         try {
             $mail->send();
             // $session->setVar("custommessage1", "Email sent to ".$this->getUser()->getEmail());
         } catch (Exception $e) {
             debugMessage('Email notification not sent! ' . $e->getMessage());
             $session->setVar(ERROR_MESSAGE, 'Email notification not sent! ' . $e->getMessage());
         }
     }
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     $mail->clearFrom();
     if ($save_toinbox) {
         # save copy of message to user's application inbox
         $message_dataarray = array("senderid" => DEFAULT_ID, "subject" => $subject, "contents" => $message_contents, "html" => $html, "type" => $type, "subtype" => $subtype, "refid" => $this->getID(), "recipients" => array(md5(1) => array("recipientid" => $this->getUserID())));
         // debugMessage($message_dataarray);
         // process message data
         $message = new Message();
         $message->processPost($message_dataarray);
         $message->save();
     }
     return true;
 }
Exemple #5
0
 function sendApprovalConfirmationNotification()
 {
     $template = new EmailTemplate();
     # create mail object
     $mail = getMailInstance();
     $view = new Zend_View();
     $session = SessionWrapper::getInstance();
     // assign values
     $template->assign('firstname', $this->getUser()->getFirstName());
     $statuslabel = $this->isApproved() ? "Approved" : "Rejected";
     $subject = "Leave " . $statuslabel;
     $save_toinbox = true;
     $type = "leave";
     $subtype = "leave_" . strtolower($statuslabel);
     $viewurl = $template->serverUrl($template->baseUrl('leave/view/id/' . encode($this->getID())));
     $rejectreason = "";
     if ($this->isRejected()) {
         $rejectreason = "<br><b>Synopsis:</b> " . $this->getComments() . "";
     }
     $days = $this->getDuration() / getHoursInDay();
     $message_contents = "<p>This is to confirm that your Leave Request from <b>" . changeMySQLDateToPageFormat($this->getStartDate()) . "</b> to <b> " . changeMySQLDateToPageFormat($this->getEndDate()) . "</b> has been successfully " . $statuslabel . $rejectreason . ".</p>\n\t\t<p>To view your request online <a href='" . $viewurl . "'>click here<a></p>\n\t\t<br />\n\t\t<p>" . $this->getApprover()->getName() . "<br />\n\t\t" . getAppName() . "</p>\n\t\t";
     $template->assign('contents', $message_contents);
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     // configure base stuff
     $mail->addTo($this->getUser()->getEmail(), $this->getUser()->getName());
     // set the send of the email address
     $mail->setFrom(getDefaultAdminEmail(), getDefaultAdminName());
     $mail->setSubject($subject);
     // render the view as the body of the email
     $html = $template->render('default.phtml');
     $mail->setBodyHtml($html);
     // debugMessage($html); exit();
     if ($this->getUser()->allowEmailForTimesheetApproval() && !isEmptyString($this->getUser()->getEmail())) {
         try {
             $mail->send();
             $session->setVar("custommessage1", "Email sent to " . $this->getUser()->getEmail());
         } catch (Exception $e) {
             $session->setVar(ERROR_MESSAGE, 'Email notification not sent! ' . $e->getMessage());
         }
     }
     $mail->clearRecipients();
     $mail->clearSubject();
     $mail->setBodyHtml('');
     $mail->clearFrom();
     if ($save_toinbox) {
         # save copy of message to user's application inbox
         $message_dataarray = array("senderid" => DEFAULT_ID, "subject" => $subject, "contents" => $message_contents, "html" => $html, "type" => $type, "subtype" => $subtype, "refid" => $this->getID(), "recipients" => array(md5(1) => array("recipientid" => $this->getUserID())));
         // debugMessage($message_dataarray);
         // process message data
         $message = new Message();
         $message->processPost($message_dataarray);
         $message->save();
     }
     return true;
 }
Exemple #6
0
 public function setTableDefinition()
 {
     parent::setTableDefinition();
     $this->setTableName('company');
     # override the not null and not blank properties for the createdby column in the BaseEntity
     $this->hasColumn('createdby', 'integer', 11, array('default' => NULL));
     $this->hasColumn('refno', 'string', 15);
     $this->hasColumn('name', 'string', 255, array('notblank' => true));
     $this->hasColumn('appname', 'string', 255);
     $this->hasColumn('headertype', 'integer', null, array('default' => 0));
     $this->hasColumn('slogan', 'string', 255);
     $this->hasColumn('username', 'string', 255);
     $this->hasColumn('abbrv', 'string', 255);
     $this->hasColumn('status', 'integer', null, array('default' => NULL));
     $this->hasColumn('contactperson', 'string', 255);
     $this->hasColumn('email', 'string', 255);
     $this->hasColumn('phone', 'string', 15);
     $this->hasColumn('country', 'string', 2, array('default' => 'UG'));
     $this->hasColumn('addressline1', 'string', 255);
     $this->hasColumn('addressline2', 'string', 255);
     $this->hasColumn('city', 'string', 255);
     $this->hasColumn('postalcode', 'string', 10);
     $this->hasColumn('industrycode', 'string', 15);
     $this->hasColumn('description', 'string', 1000);
     $this->hasColumn('remarks', 'string', 255);
     $this->hasColumn('yearstart', 'date', null, array('default' => getFirstDayOfMonth(1, date('Y'))));
     $this->hasColumn('yearend', 'date', null, array('default' => getLastDayOfMonth(12, date('Y'))));
     $this->hasColumn('ipsubnets', 'string', 255);
     $this->hasColumn('hoursinday', 'string', 50, array('default' => HOURS_IN_DAY));
     $this->hasColumn('openinghour', 'string', 50, array('default' => '08:00 AM'));
     $this->hasColumn('closinghour', 'string', 50, array('default' => '05:00 PM'));
     $this->hasColumn('lunchduration', 'string', 50, array('default' => DEFAULT_LUNCH_DURATION));
     $this->hasColumn('payspaye', 'string', 50, array('default' => 1));
     $this->hasColumn('paysnssf', 'string', 50, array('default' => 1));
     $this->hasColumn('nssfemployeerate', 'string', 50, array('default' => DEFAULT_NSSF_EMP));
     $this->hasColumn('nssfcompanyrate', 'string', 50, array('default' => DEFAULT_NSSF_COM));
     $this->hasColumn('workingdays', 'string', 50);
     $this->hasColumn('maxhoursperday', 'string', 50, array('default' => HOURS_IN_DAY));
     $this->hasColumn('maxhoursperweek', 'string', 50, array('default' => HOURS_IN_WEEK));
     $this->hasColumn('defaultuserid', 'integer', null, array('default' => NULL));
     $this->hasColumn('dateapproved', 'date', null, array('default' => NULL));
     $this->hasColumn('approvedbyid', 'integer', null, array('default' => NULL));
     $this->hasColumn('isinvited', 'integer', null, array('default' => NULL));
     $this->hasColumn('invitedbyid', 'integer', null);
     $this->hasColumn('hasacceptedinvite', 'integer', null, array('default' => 0));
     $this->hasColumn('dateinvited', 'date');
     $this->hasColumn('startdate', 'date', null, array('default' => NULL));
     $this->hasColumn('enddate', 'date', null, array('default' => NULL));
     $this->hasColumn('layout', 'string', 25, array('default' => getDefaultLayout()));
     $this->hasColumn('topbar', 'string', 25, array('default' => getDefaultTopBar()));
     $this->hasColumn('sidebar', 'string', 25, array('default' => getDefaultSideBar()));
     $this->hasColumn('colortheme', 'string', 25, array('default' => getDefaultTheme()));
     $this->hasColumn('showsidebar', 'string', 25, array('default' => getDefaultShowSideBar()));
     $this->hasColumn('logo', 'string', 255);
     $this->hasColumn('defaultadminname', 'string', 255, array('default' => getDefaultAdminName()));
     $this->hasColumn('defaultadminemail', 'string', 255, array('default' => getDefaultAdminEmail()));
     $this->hasColumn('currencysymbol', 'string', 15, array('default' => getCountryCurrencySymbol()));
     $this->hasColumn('currencycode', 'string', 15, array('default' => getCountryCurrencyCode()));
     $this->hasColumn('currencydecimalplaces', 'string', 15, array('default' => getCurrencyDecimalPlaces()));
     $this->hasColumn('numberdecimalplaces', 'string', 15, array('default' => getNumberDecimalPlaces()));
     $this->hasColumn('countryisocode', 'string', 15, array('default' => getCountryCode()));
     $this->hasColumn('phonemaxlength', 'string', 15, array('default' => getMaxPhoneLength()));
     $this->hasColumn('phoneminlength', 'string', 15, array('default' => getMinPhoneLength()));
     $this->hasColumn('nationalidminlength', 'string', 15, array('default' => getNationalIDMaxLength()));
     $this->hasColumn('nationalidmaxlength', 'string', 15, array('default' => getNationalIDMinLength()));
     $this->hasColumn('countryphonecode', 'string', 15, array('default' => getDefaultPhoneCode()));
     $this->hasColumn('timezone', 'string', 255, array('default' => getTimeZine()));
 }