/**
  * Load your component.
  *
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $_CORELANG, $objTemplate, $subMenuTitle;
     switch ($this->cx->getMode()) {
         case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
             $newsletter = new Newsletter(\Env::get('cx')->getPage()->getContent());
             \Env::get('cx')->getPage()->setContent($newsletter->getPage());
             break;
         case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
             $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
             $objTemplate = $this->cx->getTemplate();
             $subMenuTitle = $_CORELANG['TXT_CORE_EMAIL_MARKETING'];
             $objNewsletter = new NewsletterManager();
             $objNewsletter->getPage();
             break;
     }
 }
Exemplo n.º 2
0
 /**
  * Fixes the attributes and lists properties - they should not be null.
  * Normalizes the lists.
  *
  * @param \Gan\Entity $entity
  * @return object
  */
 public function normalizeEntity($entity)
 {
     $data = parent::normalizeEntity($entity);
     if (!is_object($data->attributes)) {
         $data->attributes = (object) [];
     }
     $listManager = new NewsletterManager($this->api);
     $data->lists = [];
     if (is_array($entity->lists)) {
         foreach ($entity->lists as $list) {
             $norm = $listManager->normalizeEntity($list);
             $norm->hash = $list->hash;
             $data->lists[] = $norm;
         }
     }
     return $data;
 }
Exemplo n.º 3
0
<?php

include_once './partials/header.php';
require_once './../config/constants.php';
require_once './../class/NewsletterManager.class.php';
require_once './../includes/functions.inc.php';
require_once './../includes/SSMTP.inc.php';
require_once './../class/NewsletterSubscriberManager.class.php';
?>
		<body>
			
		<?php 
if (isset($_POST['subject']) && isset($_POST['content'])) {
    extract($_POST);
    $NManager = new NewsletterManager();
    $NSManager = new NewsletterSubscriberManager();
    $newsletter = new Newsletter($subject, $content);
    if ($NManager->Create($newsletter)) {
        $subscribers = $NSManager->Read();
        $mail = SSMTP::getInstance();
        for ($i = 0; $i < count($subscribers); $i++) {
            $mail->sendEmail("*****@*****.**", $subscribers[$i]->Email, $subject, $content);
        }
    }
    header('Location: newsletterlist.php');
}
include './partials/main_admin.php';
include './partials/createform.php';
?>
		</body>			
<?php 
<?php

include_once './partials/header.php';
require_once './../class/NewsletterManager.class.php';
if (!isset($_SESSION["Admin"]) || $_SESSION["Admin"] == null) {
    header('Location: login.php');
}
?>
	
<body>
        <?php 
include './partials/main_admin.php';
$NManager = new NewsletterManager();
$newsletters = $NManager->Read();
?>
        <div class="container">
                <a href="create.php" class="btn btn-success">Nouvelle newsletter</a>
                <table class="table table-bordered">
                <thead>
                        <tr><th>Subject</th><th>Content</th><th>SendAt</th></tr>                
                </thead>
                <?php 
for ($i = 0; $i < count($newsletters); $i++) {
    ?>
                        <tr>
                                
                                <td><?php 
    echo $newsletters[$i]->Subject;
    ?>
</td>
                                <td><?php