function contactus_handler_after_install(BASE_CLASS_EventCollector $event) { if (count(CONTACTUS_BOL_Service::getInstance()->getDepartmentList()) < 1) { $url = OW::getRouter()->urlForRoute('contactus.admin'); $event->add(OW::getLanguage()->text('contactus', 'after_install_notification', array('url' => $url))); } }
/** * Returns an instance of class (singleton pattern implementation). * * @return CONTACTUS_BOL_Service */ public static function getInstance() { if (self::$classInstance === null) { self::$classInstance = new self(); } return self::$classInstance; }
public function delete($params) { if (isset($params['id'])) { CONTACTUS_BOL_Service::getInstance()->deleteDepartment((int) $params['id']); } $this->redirect(OW::getRouter()->urlForRoute('contactus.admin')); }
$Userservice = BOL_UserService::getInstance(); $EmailVerifyService = BOL_EmailVerifyService::getInstance(); $BOL_AvatarService_inst = BOL_AvatarService::getInstance(); $SKAPI_BOL_Service_inst = SKAPI_BOL_Service::getInstance(); $PHOTO_BOL_PhotoService_inst = PHOTO_BOL_PhotoService::getInstance(); $PHOTO_BOL_PhotoAlbumService = PHOTO_BOL_PhotoAlbumService::getInstance(); $PHOTO_BOL_PhotoTemporaryService = PHOTO_BOL_PhotoTemporaryService::getInstance(); $UserResetPassword = BOL_UserResetPasswordDao::getInstance(); $QuestionService = BOL_QuestionService::getInstance(); $AccountTypeToGenderService = SKADATE_BOL_AccountTypeToGenderService::getInstance(); $BOL_AuthorizationService = BOL_AuthorizationService::getInstance(); $BOL_UserOnlineDao = BOL_UserOnlineDao::getInstance(); $USEARCH_BOL_Service = USEARCH_BOL_Service::getInstance(); $BOL_SearchService = BOL_SearchService::getInstance(); $getPluginManager = OW::getPluginManager(); $CONTACTUS_BOL_Service = CONTACTUS_BOL_Service::getInstance(); $PHOTO_BOL_PhotoService = PHOTO_BOL_PhotoService::getInstance(); $PHOTO_BOL_PhotoAlbumCoverDao = PHOTO_BOL_PhotoAlbumCoverDao::getInstance(); $PHOTO_BOL_PhotoDao = PHOTO_BOL_PhotoDao::getInstance(); $getRouter = OW::getRouter(); $language = OW::getLanguage(); $getMailer = OW::getMailer(); $getConfig = OW::getConfig(); $getFeedback = OW::getFeedback(); $getEventManager = OW::getEventManager(); $getMailer = OW::getMailer(); $ow = OW_DB_PREFIX; $LanguageService = BOL_LanguageService::getInstance(); $OW_Language = OW_Language::getInstance(); $QUESTION_PRESENTATION_DATE = BOL_QuestionService::QUESTION_PRESENTATION_DATE; $QUESTION_PRESENTATION_RANGE = BOL_QuestionService::QUESTION_PRESENTATION_RANGE;
public function index() { $this->setPageTitle(OW::getLanguage()->text('contactus', 'index_page_title')); $this->setPageHeading(OW::getLanguage()->text('contactus', 'index_page_heading')); $contactEmails = array(); $contacts = CONTACTUS_BOL_Service::getInstance()->getDepartmentList(); foreach ($contacts as $contact) { /* @var $contact CONTACTUS_BOL_Department */ $contactEmails[$contact->id]['label'] = CONTACTUS_BOL_Service::getInstance()->getDepartmentLabel($contact->id); $contactEmails[$contact->id]['email'] = $contact->email; } $form = new Form('contact_form'); $fieldTo = new Selectbox('to'); foreach ($contactEmails as $id => $value) { $fieldTo->addOption($id, $value['label']); } $fieldTo->setRequired(); $fieldTo->setHasInvitation(false); $fieldTo->setLabel($this->text('contactus', 'form_label_to')); $form->addElement($fieldTo); $fieldFrom = new TextField('from'); $fieldFrom->setLabel($this->text('contactus', 'form_label_from')); $fieldFrom->setRequired(); $fieldFrom->addValidator(new EmailValidator()); if (ow::getUser()->isAuthenticated()) { $fieldFrom->setValue(OW::getUser()->getEmail()); } $form->addElement($fieldFrom); $fieldSubject = new TextField('subject'); $fieldSubject->setLabel($this->text('contactus', 'form_label_subject')); $fieldSubject->setRequired(); $form->addElement($fieldSubject); $fieldMessage = new Textarea('message'); $fieldMessage->setLabel($this->text('contactus', 'form_label_message')); $fieldMessage->setRequired(); $form->addElement($fieldMessage); $fieldCaptcha = new CaptchaField('captcha'); $fieldCaptcha->setLabel($this->text('contactus', 'form_label_captcha')); $form->addElement($fieldCaptcha); $submit = new Submit('send'); $submit->setValue($this->text('contactus', 'form_label_submit')); $form->addElement($submit); $this->addForm($form); if (OW::getRequest()->isPost()) { if ($form->isValid($_POST)) { $data = $form->getValues(); if (!array_key_exists($data['to'], $contactEmails)) { OW::getFeedback()->error($this->text('contactus', 'no_department')); return; } $mail = OW::getMailer()->createMail(); $mail->addRecipientEmail($contactEmails[$data['to']]['email']); $mail->setSender($data['from']); $mail->setSenderSuffix(false); $mail->setSubject($data['subject']); $mail->setTextContent($data['message']); OW::getMailer()->addToQueue($mail); OW::getSession()->set('contactus.dept', $contactEmails[$data['to']]['label']); $this->redirectToAction('sent'); } } }