Exemplo n.º 1
0
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_SUPPORTED_EXTENSIONS'), $this->getPageTitleClass());
     JToolBarHelper::back();
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }
Exemplo n.º 2
0
 public function display($tpl = null)
 {
     $layout = JRequest::getVar('layout', 0, 'post', 'string');
     $fields = $this->get('Data');
     if ($layout != 'form' && !$fields) {
         $this->app->enqueueMessage(JText::_('JM_NO_CUSTOM_FIELDS'), 'notice');
     }
     $this->assignRef('fields', $fields);
     $listName = JRequest::getVar('name', JRequest::getVar('listName', ''));
     $this->assignRef('listName', $listName);
     $title = $listName ? " ({$listName})" : '';
     if ($layout == 'form') {
         JToolBarHelper::title(JText::_('JM_NEWSLETTER_NEW_CUSTOM_FIELD') . $title, $this->getPageTitleClass());
         JToolBarHelper::save();
         JToolBarHelper::spacer();
         JToolBarHelper::cancel();
         $listId = JRequest::getVar('listid', '');
         $this->assignRef('listId', $listId);
         $CBfields = $this->get('CBfields');
         $this->assignRef('CBfields', $CBfields);
         $JSfields = $this->get('JSfields');
         $this->assignRef('JSfields', $JSfields);
         $VMfields = $this->get('VMfields');
         $this->assignRef('VMfields', $VMfields);
     } else {
         JToolBarHelper::title(JText::_('JM_NEWSLETTER_CUSTOM_FIELDS') . $title, $this->getPageTitleClass());
         JToolBarHelper::custom('goToLists', 'lists', 'lists', 'JM_LISTS', false, false);
         JToolBarHelper::spacer();
         JToolBarHelper::addNew();
         JToolBarHelper::spacer();
         JToolBarHelper::deleteList();
     }
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }
Exemplo n.º 3
0
 public function display($tpl = null)
 {
     $title = JRequest::getVar('title');
     $this->assignRef('title', $title);
     $url = JRequest::getVar('url');
     $this->assignRef('url', $url);
     parent::display($tpl);
 }
Exemplo n.º 4
0
 public function display($tpl = null)
 {
     $user = JFactory::getUser();
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $MCapi = $params->get('params.MCapi');
     $JoomlamailerMC = new JoomlamailerMC();
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_SEND_CAMPAIGN'), $this->getPageTitleClass());
     if (!$MCapi) {
         if ($user->authorise('core.admin', 'com_joomailermailchimpintegration')) {
             JToolBarHelper::preferences('com_joomailermailchimpintegration', '350');
             JToolBarHelper::spacer();
         }
     } else {
         if (!$JoomlamailerMC->pingMC()) {
             if ($user->authorise('core.admin', 'com_joomailermailchimpintegration')) {
                 JToolBarHelper::preferences('com_joomailermailchimpintegration', '350');
                 JToolBarHelper::spacer();
             }
         } else {
             $document = JFactory::getDocument();
             $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/jquery.clockpick.1.2.9.min.js');
             $document->addStyleSheet(JURI::root() . 'media/com_joomailermailchimpintegration/backend/css/jquery.clockpick.1.2.9.css');
             $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/joomlamailer.send.js');
             $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/joomlamailer.sync.js');
             $AECambraVM = $this->get('AecAmbraVm');
             if ($AECambraVM) {
                 JToolBarHelper::custom('syncHotness', 'hotness', 'hotness', 'Sync Hotness', false, false);
                 JToolBarHelper::spacer();
             }
             if (JRequest::getVar('campaign', 0)) {
                 JToolBarHelper::custom('send', 'send', 'send', 'JM_SEND', false, false);
                 JToolBarHelper::spacer();
             }
             // assign data to the template
             $drafts = $this->get('Drafts');
             $this->assignRef('drafts', $drafts);
             $sentCampaigns = $this->get('SentCampaigns');
             $this->assignRef('sentCampaigns', $sentCampaigns);
             $clientDetails = $this->get('ClientDetails');
             $this->assignRef('clientDetails', $clientDetails);
             $MClists = $this->get('MClists');
             $this->assignRef('MClists', $MClists);
             $campaignStamp = JRequest::getVar('campaign', 0, '', 'string');
             $this->assignRef('campaignStamp', $campaignStamp);
             $campaignDetails = false;
             if ($campaignStamp) {
                 $db = JFactory::getDBO();
                 $query = $db->getQuery(true)->select('*')->from('#__joomailermailchimpintegration_campaigns')->where($db->qn('creation_date') . ' = ' . $db->q($campaignStamp));
                 $db->setQuery($query);
                 $campaignDetails = $db->loadObject();
             }
             $this->assignRef('campaignDetails', $campaignDetails);
         }
     }
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }
Exemplo n.º 5
0
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('JM_NEWSLETTER') . ' : ' . JText::_('JM_UPDATE'), $this->getPageTitleClass());
     $doc = JFactory::getDocument();
     $doc->addStyleSheet(JURI::root() . 'media/com_joomailermailchimpintegration/backend/css/update.css');
     $task = JRequest::getCmd('task');
     $force = $task == 'force';
     $updates = $this->getModel()->getUpdates($force);
     $this->assignRef('updates', $updates);
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }
Exemplo n.º 6
0
 public function display($tpl = null)
 {
     if (!JOOMLAMAILER_MANAGE_REPORTS) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
         $this->app->redirect('index.php?option=com_joomailermailchimpintegration');
     }
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_ANALYTICS_360'), $this->getPageTitleClass());
     JToolBarHelper::custom('goToCampaigns', 'reports', 'reports', 'JM_REPORTS', false);
     $user = JFactory::getUser();
     if ($user->authorise('core.admin', 'com_joomailermailchimpintegration')) {
         JToolBarHelper::preferences('com_joomailermailchimpintegration', '450');
         JToolBarHelper::spacer();
     }
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $JoomlamailerMC = new JoomlamailerMC();
     if (!$JoomlamailerMC->pingMC()) {
         $this->app->redirect('index.php?option=com_joomailermailchimpintegration');
     }
     $a360_ga_profile_id = $params->get('params.gprofileid');
     $gusername = $params->get('params.gusername');
     $gpassword = $params->get('params.gpw');
     $gapi = new gapi($gusername, $gpassword);
     if ($a360_ga_profile_id && $gusername && $gpassword && $gapi->auth_token) {
         $this->setModel($this->getModelInstance('main'));
         if (!isset($_SESSION['gtoken'])) {
             $_SESSION['gtoken'] = $gapi->auth_token;
         }
         $a360_ga_token = $_SESSION['gtoken'];
         $a360_list_options = $this->a360_dashboard($a360_ga_token, $a360_has_key);
         $this->assignRef('a360_list_options', $a360_list_options);
         $this->assignRef('a360_ga_token', $a360_ga_token);
         $doc = JFactory::getDocument();
         $doc->addStyleSheet(JURI::root() . 'media/com_joomailermailchimpintegration/backend/css/a360/a360.css');
         $doc->addStyleSheet(JURI::root() . 'media/com_joomailermailchimpintegration/backend/css/a360/datePicker.css');
         $doc->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/analytics360/a360.js');
         $doc->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/analytics360/date.js');
         $doc->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/analytics360/date-coolite.js');
         $doc->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/analytics360/jquery.datePicker.js');
         $doc->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/analytics360/jquery.datePickerMultiMonth.js');
         $doc->addScript('http://www.google.com/jsapi');
         $doc->addScriptDeclaration('if (typeof google !== \'undefined\') {google.load("gdata", "1");google.load("visualization", "1", {"packages": ["areachart", "table", "piechart", "imagesparkline", "geomap", "columnchart"]});}');
         $doc->addScriptDeclaration('var MCapikey = "' . $params->get('params.MCapi') . '";');
         parent::display($tpl);
         require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
     } else {
         $this->app->enqueueMessage(JText::_('JM_NO_ANALYTICS_LOGIN_SUPPLIED'), 'error');
         $this->app->redirect('index.php?option=com_joomailermailchimpintegration');
     }
 }
Exemplo n.º 7
0
 public function display($tpl = null)
 {
     $params = $this->app->getParams('com_joomailermailchimpintegration');
     $displayType = $params->get('display_type', 0);
     $this->assignRef('displayType', $displayType);
     if ($displayType == 0) {
         JHTML::_('behavior.modal');
     }
     // retrieve page title from the menuitem
     $jSite = new JSite();
     $menus = $jSite->getMenu();
     $menu = $menus->getActive();
     $this->assignRef('menuParams', $menu->params);
     $campaigns = $this->get('Campaigns');
     $this->assignRef('campaigns', $campaigns);
     parent::display($tpl);
 }
Exemplo n.º 8
0
 function display($tpl = null)
 {
     //get the joomailermailchimpintegration Data
     $joomailermailchimpintegration = $this->get('Data');
     $isNew = isset($joomailermailchimpintegration['anyType']['Title']) ? false : true;
     $title = $isNew ? JText::_('New List') : JText::_('Edit List');
     JToolBarHelper::title('Newsletter : ' . $title, $this->getPageTitleClass());
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         // for existing items the button is renamed `close`
         JToolBarHelper::cancel('cancel', JText::_('Close'));
     }
     $this->assignRef('joomailermailchimpintegration', $joomailermailchimpintegration);
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }
Exemplo n.º 9
0
 public function display($tpl = null)
 {
     if (!JOOMLAMAILER_MANAGE_LISTS) {
         $this->app->redirect('index.php?option=com_joomailermailchimpintegration', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
     }
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_LISTS'), $this->getPageTitleClass());
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $MCapi = $params->get('params.MCapi');
     $JoomlamailerMC = new JoomlamailerMC();
     // Get data from the model
     $lists = $this->get('Lists');
     $this->assignRef('lists', $lists);
     if ($MCapi && $JoomlamailerMC->pingMC() && isset($lists[0])) {
         JToolBarHelper::custom('addUsers', 'plus', 'plus', 'JM_ADD_USERS', false);
         JToolBarHelper::spacer();
     }
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }
Exemplo n.º 10
0
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('JM_NEWSLETTER'), $this->getPageTitleClass());
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $MCapi = $params->get('params.MCapi');
     $JoomlamailerMC = new JoomlamailerMC();
     JToolBarHelper::custom('extensions', 'extensions', 'extensions', 'JM_EXTENSIONS', false);
     JToolBarHelper::spacer();
     $bar = JToolBar::getInstance('toolbar');
     if ($MCapi && $JoomlamailerMC->pingMC()) {
         $subdomain = explode('-', $MCapi);
         $url = 'https://' . $subdomain[1] . '.admin.mailchimp.com';
         if (JOOMLAMAILER_CREATE_DRAFTS || JOOMLAMAILER_MANAGE_CAMPAIGNS) {
             JToolBarHelper::custom('templates', 'templates', 'templates', 'JM_EMAIL_TEMPLATES', false);
             JToolBarHelper::spacer();
         }
     } else {
         $url = 'https://login.mailchimp.com/';
     }
     $bar->appendButton('Link', 'link', 'JM_ACCOUNT_SETTINGS', $url);
     JToolBarHelper::spacer();
     $user = JFactory::getUser();
     if ($user->authorise('core.admin', 'com_joomailermailchimpintegration')) {
         JToolBarHelper::preferences('com_joomailermailchimpintegration', '450');
         JToolBarHelper::spacer();
     }
     if ($MCapi && $JoomlamailerMC->pingMC()) {
         $details = $this->get('ClientDetails');
         $this->assignRef('details', $details);
         $drafts = $this->get('Drafts');
         $this->assignRef('drafts', $drafts);
         $campaigns = $this->get('Campaigns');
         $this->assignRef('campaigns', $campaigns);
         $chimpChatter = $this->get('ChimpChatter');
         $this->assignRef('chimpChatter', $chimpChatter);
     }
     $this->assignRef('params', $params);
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }
Exemplo n.º 11
0
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_SUBSCRIBERS'), $this->getPageTitleClass());
     $option = JRequest::getCmd('option');
     $limit = $this->app->getUserStateFromRequest('global.list.limit', 'limit', $this->app->getCfg('list_limit'), 'int');
     $limitstart = $this->app->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $MCapi = $params->get('params.MCapi');
     $JoomlamailerMC = new JoomlamailerMC();
     if ($MCapi && $JoomlamailerMC->pingMC()) {
         JToolBarHelper::custom('goToLists', 'lists', 'lists', 'JM_LISTS', false, false);
         JToolBarHelper::spacer();
         if (JRequest::getVar('type') == 's') {
             JToolBarHelper::custom('unsubscribe', 'unsubscribe', 'unsubscribe', 'JM_UNSUBSCRIBE', true, false);
             JToolBarHelper::spacer();
             JToolBarHelper::custom('delete', 'unsubscribe', 'unsubscribe', 'JM_DELETE', true, false);
             JToolBarHelper::spacer();
         } else {
             if (JRequest::getVar('type') == 'u') {
                 //		JToolBarHelper::custom('resubscribe', 'resubscribe', 'resubscribe', 'Resubscribe', false, false);
             }
         }
     }
     // Get data from the model
     $active = $this->get('Active');
     $this->getModel()->addJoomlaUserData($active);
     $this->assignRef('active', $active);
     $lists = $this->get('Lists');
     $this->assignRef('lists', $lists);
     $total = $this->get('Total');
     $this->assignRef('total', $total);
     //		if ($total<$limit) $limit = $total;
     $this->assignRef('limitstart', $limitstart);
     $this->assignRef('limit', $limit);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }
Exemplo n.º 12
0
 public function display($tpl = null)
 {
     // redirect guests to login page
     $user = JFactory::getUser();
     if (!$user->id) {
         $uri = JFactory::getURI();
         $this->app->enqueueMessage(JText::_('JM_ONLY_LOGGED_IN_USERS_CAN_VIEW_SUBSCRIPTIONS'), 'error');
         $this->app->redirect('index.php?option=com_users&view=login&return=' . base64_encode($uri->toString()));
     }
     $this->assignRef('user', $user);
     $lists = $this->get('Lists');
     $this->assignRef('lists', $lists);
     // pass a link to the edit form to the view
     $editLink = JRoute::_('index.php?option=com_joomailermailchimpintegration&view=subscriptions&task=edit');
     $this->assignRef('editlink', $editLink);
     // retrieve page title from the menuitem
     $jSite = new JSite();
     $menus = $jSite->getMenu();
     $menu = $menus->getActive();
     $this->assignRef('menuParams', $menu->params);
     parent::display($tpl);
 }
Exemplo n.º 13
0
 public function display($tpl = null)
 {
     JToolBarHelper::title(JText::_('JM_Newsletter : Leads'), $this->getPageTitleClass());
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $subdomain = $params->get('subdomain');
     $domain = $params->get('domain');
     $username = $params->get('username');
     $pw = $params->get('pw');
     if ($subdomain && $domain && $username && $pw) {
         JToolBarHelper::back();
         JToolBarHelper::custom('sync_leads', 'sync_selected', 'sync_selected', 'JM_ADD_SELECTED_USERS', false, false);
         JToolBarHelper::custom('sync_all', 'sync', 'sync', 'JM_ADD_ALL_USERS', false, false);
     }
     // Get data from the model
     $items = $this->get('Data');
     $this->assignRef('items', $items);
     $campaign = $this->get('Campaign');
     $this->assignRef('campaign', $campaign);
     $lists = $this->get('Lists');
     $this->assignRef('lists', $lists);
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }
Exemplo n.º 14
0
 public function display($tpl = null)
 {
     if (!JOOMLAMAILER_CREATE_DRAFTS && !JOOMLAMAILER_MANAGE_CAMPAIGNS) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
         $this->app->redirect('index.php?option=com_joomailermailchimpintegration');
     }
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_CAMPAIGNS'), $this->getPageTitleClass());
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $MCapi = $params->get('params.MCapi');
     $JoomlamailerMC = new JoomlamailerMC();
     if ($MCapi && $JoomlamailerMC->pingMC()) {
         if (JOOMLAMAILER_CREATE_DRAFTS) {
             JToolBarHelper::custom('create', 'create-campaign', 'create-campaign', 'JM_CREATE_CAMPAIGN', false, false);
             JToolBarHelper::spacer();
         }
         $filter = JRequest::getVar('filter_status', 'sent', '', 'string');
         if (JOOMLAMAILER_CREATE_DRAFTS && !JOOMLAMAILER_MANAGE_CAMPAIGNS) {
             $filter = 'save';
             JRequest::setVar('filter_status', 'save');
         } else {
             if (!JOOMLAMAILER_CREATE_DRAFTS && JOOMLAMAILER_MANAGE_CAMPAIGNS) {
                 if ($filter == 'save') {
                     JRequest::setVar('filter_status', 'sent');
                 }
             }
         }
         if ($filter == 'save') {
             if (JOOMLAMAILER_CREATE_DRAFTS) {
                 JToolBarHelper::editList();
                 JToolBarHelper::spacer();
             }
             if (JOOMLAMAILER_MANAGE_CAMPAIGNS) {
                 JToolBarHelper::custom('send', 'send', 'send', 'JM_SEND', true, false);
                 JToolBarHelper::spacer();
             }
             if (JOOMLAMAILER_CREATE_DRAFTS) {
                 JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THE_SELECTED_CAMPAIGNS'));
                 JToolBarHelper::spacer();
             }
         } else {
             if ($filter == 'schedule') {
                 JToolBarHelper::custom('unschedule', 'unschedule', 'unschedule', 'JM_UNSCHEDULE', true, false);
                 JToolBarHelper::spacer();
                 // you can only pause autoresponder and rss campaigns
                 //  JToolBarHelper::custom('pause', 'pause', 'pause', 'Pause', true, false);
                 if (JOOMLAMAILER_MANAGE_CAMPAIGNS) {
                     JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THE_SELECTED_CAMPAIGNS'));
                     JToolBarHelper::spacer();
                 }
             } else {
                 if ($filter == 'sent') {
                     JToolBarHelper::custom('copyCampaign', 'copy', 'copy', 'JM_REPLICATE', true, false);
                     JToolBarHelper::spacer();
                     if (JOOMLAMAILER_MANAGE_REPORTS) {
                         JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THE_SELECTED_CAMPAIGNS'));
                         JToolBarHelper::spacer();
                     }
                 } else {
                     if ($filter == 'sending') {
                         if (JOOMLAMAILER_MANAGE_CAMPAIGNS) {
                             JToolBarHelper::custom('pause', 'pause', 'pause', 'JM_PAUSE', true, false);
                             JToolBarHelper::spacer();
                         }
                         if (JOOMLAMAILER_MANAGE_REPORTS) {
                             JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THE_SELECTED_CAMPAIGNS'));
                             JToolBarHelper::spacer();
                         }
                     } else {
                         if ($filter == 'paused') {
                             if (JOOMLAMAILER_MANAGE_CAMPAIGNS) {
                                 JToolBarHelper::custom('resume', 'resume', 'resume', 'JM_RESUME', true, false);
                                 JToolBarHelper::spacer();
                             }
                             if (JOOMLAMAILER_MANAGE_REPORTS) {
                                 JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THE_SELECTED_CAMPAIGNS'));
                                 JToolBarHelper::spacer();
                             }
                         }
                     }
                 }
             }
         }
     }
     if (JOOMLAMAILER_MANAGE_REPORTS) {
         $folders = $this->get('Folders');
         $undefined[0] = array('folder_id' => 0, 'name' => JText::_('JM_UNFILED'));
         $folder_id = JRequest::getVar('folder_id', 0, '', 'int');
         $folders = array_merge($undefined, $folders);
         $foldersDropDown = JHTML::_('select.genericlist', $folders, 'folder_id', 'onchange="document.adminForm.submit();"', 'folder_id', 'name', $folder_id);
         $this->assignRef('foldersDropDown', $foldersDropDown);
     }
     // Get data from the model
     $campaigns = $this->get('Campaigns');
     $this->assignRef('campaigns', $campaigns);
     $page = $this->get('Pagination');
     $this->assignRef('pagination', $page);
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }
Exemplo n.º 15
0
    public function display($tpl = null)
    {
        if (!JOOMLAMAILER_CREATE_DRAFTS) {
            $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
            $this->app->redirect('index.php?option=com_joomailermailchimpintegration');
        }
        JToolBarHelper::title(JText::_('JM_NEWSLETTER_CREATE_DRAFT'), $this->getPageTitleClass());
        $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
        $MCapi = $params->get('params.MCapi');
        $JoomlamailerMC = new JoomlamailerMC();
        if (!$MCapi) {
            $user = JFactory::getUser();
            if ($user->authorise('core.admin', 'com_joomailermailchimpintegration')) {
                JToolBarHelper::preferences('com_joomailermailchimpintegration', '350');
            }
        } else {
            if (!$JoomlamailerMC->pingMC()) {
                $user = JFactory::getUser();
                if ($user->authorise('core.admin', 'com_joomailermailchimpintegration')) {
                    JToolBarHelper::preferences('com_joomailermailchimpintegration', '350');
                    JToolBarHelper::spacer();
                }
            } else {
                JHTML::_('behavior.modal');
                JHTML::_('behavior.tooltip');
                // Include css/js files
                $document = JFactory::getDocument();
                $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/joomlamailer.create.js');
                $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/joomlamailer.preview.js');
                $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/tablednd.js');
                $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/sorttable.js');
                if (version_compare(JVERSION, '3.0.0') < 0) {
                    $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/joomlamailer.create_2_5.js');
                }
                // plugin support
                JPluginHelper::importPlugin('joomlamailer');
                $plugins = JDispatcher::getInstance();
                $this->assignRef('plugins', $plugins);
                $db = JFactory::getDBO();
                $query = $db->getQuery(true)->select('enabled')->from('#__extensions')->where($db->qn('type') . ' = ' . $db->q('plugin'))->where($db->qn('element') . ' = ' . $db->q('tinymce'));
                $db->setQuery($query);
                $tinymce = $db->loadResult();
                $editortype = $tinymce ? 'tinymce' : 'none';
                $editor = JFactory::getEditor($editortype);
                $this->assignRef('editor', $editor);
                $script = '!function($){
                $(document).ready(function(){
                    joomlamailerJS.create.getIntroContent = function() {
                        return ' . $editor->getContent('intro') . ';
                    }
                    joomlamailerJS.create.onSubmit = function() {' . $editor->save('intro');
                $submitformJavascript = $plugins->trigger('submitformJavascript');
                foreach ($submitformJavascript as $sj) {
                    $script .= $sj;
                }
                $script .= '}';
                if (JRequest::getVar('text_only', 0, '', 'int')) {
                    $script .= "\$('.create_sidebar').css('display', 'none');";
                }
                $script .= '});
                }(jQuery);

                var includeComponents = new Object();
                var includeComponentsOptions = new Object();
                var includeComponentsFields = new Object();
                var includeTableofcontent = false;
                var includeTableofcontentComponents = new Object();
                var sidebarElements = new Object();
                var postData = new Object();
                var socialIcons = new Object();';
                $document->addScriptDeclaration($script);
                $categories = $this->get('Categories');
                $this->assignRef('categories', $categories);
                $merge = $this->get('MergeTags');
                $this->assignRef('merge', $merge);
                $K2Installed = $this->get('K2Installed');
                $this->assignRef('K2Installed', $K2Installed);
                if ($K2Installed) {
                    $allk2cat = $this->getModel()->getK2Cat();
                    $this->assignRef('allk2cat', $allk2cat);
                }
                $folders = $this->get('Folders');
                $unfiled = array(array('folder_id' => 0, 'name' => JText::_('JM_UNFILED')));
                $folder_id = JRequest::getVar('folder_id', 0, '', 'int');
                if ($folders) {
                    $folders = array_merge($unfiled, $folders);
                } else {
                    $folders = $unfiled;
                }
                $foldersDropDown = JHTML::_('select.genericlist', $folders, 'folder_id', '', 'folder_id', 'name', $folder_id);
                $this->assignRef('foldersDropDown', $foldersDropDown);
                $user = JFactory::getUser();
                $this->assignRef('user', $user);
            }
        }
        parent::display($tpl);
        require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
    }
Exemplo n.º 16
0
    public function display($tpl = null)
    {
        $mainframe = JFactory::getApplication();
        $option = JRequest::getCmd('option');
        $document = JFactory::getDocument();
        $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/joomlamailer.sync.js');
        $script = '!function($){
    $(document).ready(function(){
        joomlamailerJS.strings.addSelectedUsers = "' . JText::_('JM_ADD_SELECTED_USERS', true) . '";
        joomlamailerJS.strings.addAllUsers = "' . JText::_('JM_ADD_ALL_USERS', true) . '";
        joomlamailerJS.strings.addAllUsersConfirm = "' . JText::_('JM_ARE_YOU_SURE_TO_ADD_ALL_USERS', true) . '";
        joomlamailerJS.strings.selectAList = "' . JText::_('JM_SELECT_A_LIST_TO_ASSIGN_THE_USERS_TO', true) . '";
        joomlamailerJS.strings.noUsersSelected = "' . JText::_('JM_NO_USERS_SELECTED', true) . '";
        joomlamailerJS.strings.usersAlreadyAdded = "' . JText::_('JM_ALL_USERS_ALREADY_ADDED', true) . '";

        joomlamailerJS.strings.addingUsers = "' . JText::_('JM_ADDING_USERS', true) . '";
        joomlamailerJS.strings.done = "' . JText::_('JM_DONE', true) . '";


    });
}(jQuery);';
        $document->addScriptDeclaration($script);
        $layout = JRequest::getVar('layout', 'default');
        if ($layout == 'default') {
            $filter_order = $mainframe->getUserStateFromRequest($option . 'filter_order', 'filter_order', 'a.name', 'cmd');
            $filter_order_Dir = $mainframe->getUserStateFromRequest($option . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
            $filter_type = $mainframe->getUserStateFromRequest($option . 'filter_type', 'filter_type', 0, 'string');
            $filter_date = $mainframe->getUserStateFromRequest($option . 'filter_date', 'filter_date', '', 'string');
            $search = JString::strtolower($mainframe->getUserStateFromRequest($option . 'search', 'search', '', 'string'));
            // get list of Groups for dropdown filter
            require_once JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php';
            $dropdown = '<select name="filter_type" id="filter_type" class="inputbox" onchange="this.form.submit()">';
            $dropdown .= '<option value="">- ' . JText::_('JM_USERGROUP') . ' -</option>';
            $dropdown .= JHtml::_('select.options', UsersHelper::getGroups(), 'value', 'text', $filter_type);
            $dropdown .= '</select>';
            $lists['type'] = $dropdown;
            // table ordering
            $lists['order_Dir'] = $filter_order_Dir;
            $lists['order'] = $filter_order;
            // search filter
            $lists['search'] = $search;
            //date filter
            JHtml::_('behavior.calendar');
            $attr = array('size' => '16', 'style' => 'top:0;', 'placeholder' => JText::_('JM_LAST_VISIT_AFTER'));
            $lists['filter_date'] = JHtml::_('calendar', $filter_date, 'filter_date', 'filter_date', '%Y-%m-%d', $attr);
            $this->assignRef('lists', $lists);
            $this->assignRef('pagination', $pagination);
            JToolBarHelper::title(JText::_('JM_NEWSLETTER_ADD_USERS'), $this->getPageTitleClass());
        } else {
            if ($layout == 'sugar') {
                JToolBarHelper::title(JText::_('JM_NEWSLETTER_SUGARCRM_CONFIGURATION'), $this->getPageTitleClass());
            } else {
                if ($layout == 'highrise') {
                    JToolBarHelper::title(JText::_('JM_NEWSLETTER_HIGHRISE_CONFIGURATION'), $this->getPageTitleClass());
                }
            }
        }
        $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
        $MCapi = $params->get('params.MCapi');
        $JoomlamailerMC = new JoomlamailerMC();
        if ($MCapi && $JoomlamailerMC->pingMC()) {
            if ($layout == 'default') {
                if ($params->get('params.sugar_name') && $params->get('params.sugar_pwd')) {
                    JToolBarHelper::custom('sync_sugar', 'sync_sugar', 'sync_sugar', 'JM_ADD_TO_SUGAR', false, false);
                    JToolBarHelper::spacer();
                    JToolBarHelper::custom('sugar', 'sync_sugar', 'sync_sugar', 'JM_SUGAR_CONFIG', false, false);
                    JToolBarHelper::spacer();
                }
                if ($params->get('params.highrise_url') && $params->get('params.highrise_api_token')) {
                    JToolBarHelper::custom('sync_highrise', 'sync_highrise', 'sync_highrise', 'JM_ADD_TO_HIGHRISE', false, false);
                    JToolBarHelper::spacer();
                    JToolBarHelper::custom('highrise', 'sync_highrise', 'sync_highrise', 'JM_HIGHRISE_CONFIG', false, false);
                    JToolBarHelper::spacer();
                }
                JToolBarHelper::custom('mailchimp', 'sync', 'sync', 'JM_ADD_TO_MAILCHIMP', false, false);
                JToolBarHelper::spacer();
            } else {
                if ($layout == 'sugar') {
                    JToolBarHelper::custom('cancel', 'back', 'back', 'JM_BACK', false, false);
                    JToolBarHelper::spacer();
                    JToolBarHelper::custom('setConfig', 'sync_sugar', 'sync_sugar', 'JM_SAVE_CONFIG', false, false);
                    JToolBarHelper::spacer();
                } else {
                    if ($layout == 'highrise') {
                        JToolBarHelper::custom('cancel', 'back', 'back', 'JM_BACK', false, false);
                        JToolBarHelper::spacer();
                        JToolBarHelper::custom('setConfig', 'sync_highrise', 'sync_highrise', 'JM_SAVE_CONFIG', false, false);
                        JToolBarHelper::spacer();
                    }
                }
            }
        }
        if ($layout == 'default') {
            // Get data from the model
            $items = $this->get('Data');
            $this->assignRef('items', $items);
            $this->setModel($this->getModelInstance('lists'));
            $subscriberLists = $this->getModel('lists')->getLists();
            $this->assignRef('subscriberLists', $subscriberLists);
            $groups = $this->get('Groups');
            $this->assignRef('groups', $groups);
            $CRMusers = $this->get('CRMusers');
            $this->assignRef('CRMusers', $CRMusers);
        } else {
            if ($layout == 'sugar') {
                $sugarFields = $this->get('SugarFields');
                $this->assignRef('sugarFields', $sugarFields);
                $JSFields = $this->get('JSFields');
                $this->assignRef('JSFields', $JSFields);
                $CBFields = $this->get('CBFields');
                $this->assignRef('CBFields', $CBFields);
                $config = $this->getModel('sync')->getConfig('sugar');
                $this->assignRef('config', $config);
            } else {
                if ($layout == 'highrise') {
                    $JSFields = $this->get('JSFields');
                    $this->assignRef('JSFields', $JSFields);
                    $CBFields = $this->get('CBFields');
                    $this->assignRef('CBFields', $CBFields);
                    $config = $this->getModel('sync')->getConfig('highrise');
                    $this->assignRef('config', $config);
                }
            }
        }
        $total = $this->get('TotalUsers');
        $this->assignRef('total', $total);
        parent::display($tpl);
        require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
    }
Exemplo n.º 17
0
 public function display($tpl = null)
 {
     if (!JOOMLAMAILER_MANAGE_REPORTS) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
         $this->app->redirect('index.php?option=com_joomailermailchimpintegration');
     }
     $this->setModel($this->getModelInstance('main'));
     $this->setModel($this->getModelInstance('campaignlist'));
     $option = JRequest::getCmd('option');
     $cacheGroup = 'joomlamailerReports';
     $cacheOptions = array();
     $cacheOptions['cachebase'] = JPATH_ADMINISTRATOR . '/cache';
     $cacheOptions['lifetime'] = 31556926;
     $cacheOptions['storage'] = 'file';
     $cacheOptions['defaultgroup'] = 'joomlamailerReports';
     $cacheOptions['locking'] = false;
     $cacheOptions['caching'] = true;
     $cache = new JCache($cacheOptions);
     require_once JPATH_COMPONENT . '/helpers/JoomlamailerCache.php';
     $mainframe = JFactory::getApplication();
     $layout = JRequest::getVar('layout', '', '', 'string');
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($layout . '.limitstart', $layout . 'limitstart', 0, 'int');
     if ($layout == 'sharereport') {
         $document = JFactory::getDocument();
         $document->addStyleSheet(JURI::root() . 'media/com_joomailermailchimpintegration/backend/css/shareReport.css');
         $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/joomlamailer.shareReport.js');
         JToolBarHelper::title(JText::_('JM_NEWSLETTER_SHARE_REPORT'), $this->getPageTitleClass());
     } else {
         JToolBarHelper::title(JText::_('JM_NEWSLETTER_CAMPAIGN_STATS'), $this->getPageTitleClass());
     }
     if ($layout != '') {
         JToolBarHelper::custom('goToCampaigns', 'reports', 'reports', 'JM_REPORTS', false);
     }
     if ($layout == 'clickedlinks') {
         $cid = JRequest::getVar('cid', 0, '', 'string');
         $clicked = $this->getModel()->getClicks($cid);
         foreach ($clicked as $index => $data) {
             if (!$data['clicks']) {
                 unset($clicked[$index]);
             }
         }
         $this->assignRef('clicked', $clicked);
         $this->assignRef('limitstart', $limitstart);
         $this->assignRef('limit', $limit);
         jimport('joomla.html.pagination');
         $pagination = new JPagination(count($clicked), $limitstart, $limit, $layout);
         $this->assignRef('pagination', $pagination);
     } else {
         if ($layout == 'clickedlinkdetails') {
             $cid = JRequest::getVar('cid', 0, '', 'string');
             $url = urldecode(JRequest::getVar('url', '', '', 'string'));
             $clicks = $this->getModel()->getClicksAIM($cid, $url);
             $this->assignRef('clicks', $clicks);
             $this->assignRef('limitstart', $limitstart);
             $this->assignRef('limit', $limit);
             jimport('joomla.html.pagination');
             $pagination = new JPagination(count($clicks), $limitstart, $limit, $layout);
             $this->assignRef('pagination', $pagination);
         } else {
             if ($layout == 'clicked') {
                 $cid = JRequest::getVar('cid', 0, '', 'string');
                 $clicked = $this->getModel()->getCampaignEmailStatsAIMAll($cid, $limitstart, 1000);
                 $i = 0;
                 $click = array();
                 foreach ($clicked as $key => $value) {
                     $unset = true;
                     foreach ($value as $v) {
                         if ($v['action'] == 'click') {
                             $unset = false;
                         }
                     }
                     if (!$unset) {
                         $click[$key] = $clicked[$key];
                         $i++;
                     }
                     if ($i == $limit) {
                         break;
                     }
                 }
                 $this->assignRef('clicked', $click);
                 $this->assignRef('limitstart', $limitstart);
                 $this->assignRef('limit', $limit);
                 $total = $this->getModel()->getCampaignStats($cid);
                 jimport('joomla.html.pagination');
                 $pagination = new JPagination($total['unique_clicks'], $limitstart, $limit, $layout);
                 $this->assignRef('pagination', $pagination);
             } else {
                 if ($layout == 'recipients') {
                     $cid = JRequest::getVar('cid', 0, '', 'string');
                     $url = urldecode(JRequest::getVar('url', 0, '', 'string'));
                     $clicked = $this->getModel()->getCampaignEmailStatsAIMAll($cid, $limitstart, $limit);
                     $campaignStats = $this->getModel()->getCampaignStats($cid);
                     $this->assignRef('clicked', $clicked);
                     $this->assignRef('limitstart', $limitstart);
                     $this->assignRef('limit', $limit);
                     jimport('joomla.html.pagination');
                     $pagination = new JPagination($campaignStats['emails_sent'], $limitstart, $limit, $layout);
                     $this->assignRef('pagination', $pagination);
                 } else {
                     if ($layout == 'opened') {
                         $cid = JRequest::getVar('cid', 0, '', 'string');
                         $items = $this->getModel()->getOpens($cid);
                         $this->assignRef('limitstart', $limitstart);
                         $this->assignRef('limit', $limit);
                         jimport('joomla.html.pagination');
                         $pagination = new JPagination(count($items), $limitstart, $limit, $layout);
                         $this->assignRef('pagination', $pagination);
                     } else {
                         if ($layout == 'abuse') {
                             $cid = JRequest::getVar('cid', 0, '', 'string');
                             $items = $this->getModel()->getAbuse($cid);
                             $this->assignRef('limitstart', $limitstart);
                             $this->assignRef('limit', $limit);
                             jimport('joomla.html.pagination');
                             $pagination = new JPagination(count($items), $limitstart, $limit, $layout);
                             $this->assignRef('pagination', $pagination);
                         } else {
                             if ($layout == 'unsubscribes') {
                                 $cid = JRequest::getVar('cid', 0, '', 'string');
                                 $items = $this->getModel()->getUnsubscribes($cid);
                                 $this->assignRef('limitstart', $limitstart);
                                 $this->assignRef('limit', $limit);
                                 jimport('joomla.html.pagination');
                                 $pagination = new JPagination(count($items), $limitstart, $limit, $layout);
                                 $this->assignRef('pagination', $pagination);
                             } else {
                                 if ($layout == 'sharereport') {
                                     $cid = JRequest::getVar('cid', '', 'get', 'string');
                                     $this->setModel($this->getModelInstance('campaigns'));
                                     $cData = $this->getModel('campaigns')->getCampaignData($cid);
                                     $name = isset($cData[0]->name) ? $cData[0]->name : $cData[0]['title'];
                                     $this->assignRef('name', $name);
                                     $data = $this->getModel('campaigns')->getShareReport($cid, JText::_('JM_CAMPAIGN_REPORT') . ': ' . $name);
                                     $this->assignRef('data', $data);
                                     $this->setModel($this->getModelInstance('templates'));
                                     $palettes = $this->getModel('templates')->getPalettes();
                                     $this->assignRef('palettes', $palettes);
                                 } else {
                                     $document = JFactory::getDocument();
                                     $document->addStyleSheet(JURI::root() . 'media/com_joomailermailchimpintegration/backend/css/campaigns.css');
                                     $JoomlamailerMC = new JoomlamailerMC();
                                     if (!$JoomlamailerMC->pingMC()) {
                                         $user = JFactory::getUser();
                                         if ($user->authorise('core.admin', 'com_joomailermailchimpintegration')) {
                                             JToolBarHelper::preferences('com_joomailermailchimpintegration', '450');
                                             JToolBarHelper::spacer();
                                         }
                                     } else {
                                         JToolBarHelper::custom('shareReport', 'shareReport', 'shareReport', 'JM_SEND_REPORT', true, false);
                                         JToolBarHelper::spacer();
                                         JToolBarHelper::custom('analytics', 'reports', 'reports', 'Analytics360°', false, false);
                                         JToolBarHelper::spacer();
                                         $user = JFactory::getUser();
                                         if ($user->authorise('core.admin', 'com_joomailermailchimpintegration')) {
                                             JToolBarHelper::preferences('com_joomailermailchimpintegration', '450');
                                             JToolBarHelper::spacer();
                                         }
                                         //	JToolBarHelper::custom('delete', 'delete', 'delete', 'JM_DELETE_REPORT', true, false);
                                         $tmp = array(array('folder_id' => 0, 'name' => '- ' . JText::_('JM_SELECT_FOLDER') . ' -'));
                                         $folders = $this->getModel('campaignlist')->getFolders();
                                         $folders = array_merge($tmp, $folders);
                                         $folder_id = JRequest::getVar('folder_id', 0, '', 'int');
                                         $foldersDropDown = JHTML::_('select.genericlist', $folders, 'folder_id', 'onchange="document.adminForm.submit();"', 'folder_id', 'name', $folder_id);
                                         $this->assignRef('foldersDropDown', $foldersDropDown);
                                         $limit = JRequest::getVar('limit', 5, '', 'int');
                                         $cacheID = 'sent_campaigns';
                                         if (!$cache->get($cacheID, $cacheGroup)) {
                                             $campaigns = array();
                                             $res = 'not empty';
                                             $page = 0;
                                             while (!empty($res)) {
                                                 $res = $this->getModel()->getCampaigns(array('status' => 'sent'), $page, 1000);
                                                 if ($res) {
                                                     $campaigns = array_merge($campaigns, $res);
                                                     if (count($res) < 1000) {
                                                         break;
                                                     }
                                                     $page++;
                                                 }
                                             }
                                             if (count($campaigns)) {
                                                 foreach ($campaigns as $c) {
                                                     $stats = $this->getModel()->getCampaignStats($c['id']);
                                                     $advice = $this->getModel()->getAdvice($c['id']);
                                                     if ($stats) {
                                                         $items[$c['id']]['folder_id'] = $c['folder_id'];
                                                         $items[$c['id']]['title'] = $c['title'];
                                                         $items[$c['id']]['subject'] = $c['subject'];
                                                         $items[$c['id']]['send_time'] = $c['send_time'];
                                                         $items[$c['id']]['emails_sent'] = $c['emails_sent'];
                                                         $items[$c['id']]['stats'] = $stats;
                                                         $items[$c['id']]['advice'] = $advice;
                                                         $items[$c['id']]['archive_url'] = $c['archive_url'];
                                                         $items[$c['id']]['twitter'] = $this->getModel()->getTwitterStats($c['id']);
                                                         $items[$c['id']]['geo'] = $this->getModel()->getGeoStats($c['id']);
                                                     } else {
                                                         $items[$c['id']]['folder_id'] = $c['folder_id'];
                                                         $items[$c['id']]['title'] = $c['title'];
                                                         $items[$c['id']]['subject'] = $c['subject'];
                                                         $items[$c['id']]['send_time'] = $c['send_time'];
                                                         $items[$c['id']]['emails_sent'] = $c['emails_sent'];
                                                         $items[$c['id']]['stats'] = '';
                                                         $items[$c['id']]['advice'] = '';
                                                         $items[$c['id']]['archive_url'] = $c['archive_url'];
                                                         $items[$c['id']]['twitter'] = $this->getModel()->getTwitterStats($c['id']);
                                                         $items[$c['id']]['geo'] = $this->getModel()->getGeoStats($c['id']);
                                                     }
                                                 }
                                             }
                                             $cache->store(json_encode($items), $cacheID, $cacheGroup);
                                         }
                                         $campaigns = json_decode($cache->get($cacheID, $cacheGroup), true);
                                         // get timestamp of when the cache was modified
                                         $joomlamailerCache = new JoomlamailerCache('file');
                                         $cacheDate = $joomlamailerCache->getCreationTime($cacheID, $cacheGroup);
                                         $this->assignRef('cacheDate', $cacheDate);
                                         if ($folder_id) {
                                             foreach ($campaigns as $k => $v) {
                                                 if ($v['folder_id'] != $folder_id) {
                                                     unset($campaigns[$k]);
                                                 }
                                             }
                                         }
                                         $total = count($campaigns);
                                         $items = array();
                                         $x = 0;
                                         if ($total) {
                                             foreach ($campaigns as $k => $v) {
                                                 if ($x == $limitstart + $limit) {
                                                     break;
                                                 }
                                                 if ($x >= $limitstart) {
                                                     $items[$k] = $v;
                                                 }
                                                 $x++;
                                             }
                                         }
                                         jimport('joomla.html.pagination');
                                         $pagination = new JPagination($total, $limitstart, $limit, $layout);
                                         $this->assignRef('pagination', $pagination);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->assignRef('items', $items);
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }
Exemplo n.º 18
0
    public function display($tpl = null)
    {
        $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
        $MCapi = $params->get('params.MCapi');
        $JoomlamailerMC = new JoomlamailerMC();
        if (!$MCapi || !$JoomlamailerMC->pingMC()) {
            JToolBarHelper::title(JText::_('JM_NEWSLETTER') . ' : ' . JText::_('JM_UPLOAD_TEMPLATE'), $this->getPageTitleClass());
            $user = JFactory::getUser();
            if ($user->authorise('core.admin', 'com_joomailermailchimpintegration')) {
                JToolBarHelper::preferences('com_joomailermailchimpintegration', '350');
                JToolBarHelper::spacer();
            }
        } else {
            jimport('joomla.filesystem.file');
            jimport('joomla.filesystem.folder');
            $document = JFactory::getDocument();
            $script = '!function($){
    $(document).ready(function(){
        joomlamailerJS.strings.templateDownloadError = "' . JText::_('JM_TEMPLATE_DOWNLOAD_ERROR', true) . '";
        joomlamailerJS.strings.templateWidthOf = "' . JText::_('JM_TEMPLATE_WIDTH_OF', true) . '";
        joomlamailerJS.strings.uploadButtonText = "' . JText::_('JM_UPLOAD_HEADER_IMAGE', true) . '";
        joomlamailerJS.strings.errorInvalidFileType = "' . JText::_('JM_INVALID_FILE_TYPE', true) . '";
        joomlamailerJS.strings.allowedFileTypes = "' . JText::_('JM_ALLOWED_EXTENSIONS', true) . '";
        joomlamailerJS.strings.clickToEdit = "' . JText::_('JM_CLICK_TO_EDIT', true) . '";
        joomlamailerJS.strings.confirmClearPosition = "' . JText::_('JM_ARE_YOU_SURE_TO_DELETE_EVERYTHING_FROM_THE', true) . '";
        joomlamailerJS.strings.position = "' . JText::_('JM_POSITION_DELETE', true) . '";
        joomlamailerJS.strings.confirmOverwriteTemplate = "' . JText::_('JM_OVERWRITE_TEMPLATE', true) . '";
        joomlamailerJS.strings.errorTemplateName = "' . JText::_('JM_INVALID_TEMPLATE_NAME_SUPPLIED', true) . '";
    });
}(jQuery);';
            $document->addScriptDeclaration($script);
            $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/joomlamailer.templates.js');
            $layout = JRequest::getVar('layout', 0, '', 'string');
            if ($layout == 'upload') {
                $uploadIcon = version_compare(JVERSION, '3.0', 'ge') ? 'upload_14' : 'upload_32';
                JToolBarHelper::title(JText::_('JM_NEWSLETTER') . ' : ' . JText::_('JM_UPLOAD_TEMPLATE'), $this->getPageTitleClass());
                JToolBarHelper::custom('startUpload', $uploadIcon, $uploadIcon, 'JM_START_UPLOAD', false, false);
                JToolBarHelper::spacer();
                JToolBarHelper::cancel();
                JToolBarHelper::spacer();
            } else {
                if ($layout == 'edit') {
                    JToolBarHelper::title(JText::_('JM_NEWSLETTER') . ' : ' . JText::_('JM_EDIT_TEMPLATE'), $this->getPageTitleClass());
                    JToolBarHelper::save();
                    JToolBarHelper::spacer();
                    JToolBarHelper::cancel();
                    JToolBarHelper::spacer();
                    $document->addStyleSheet(JURI::root() . 'media/com_joomailermailchimpintegration/backend/css/templateEditor.css');
                    $document->addStyleSheet(JURI::root() . 'media/com_joomailermailchimpintegration/backend/css/picker.css');
                    $document->addStyleSheet(JURI::root() . 'media/com_joomailermailchimpintegration/backend/css/fileuploader.css');
                    $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/jquery-ui-1.10.4.custom.min.js');
                    $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/jquery.jeditable.js');
                    $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/picker.js');
                    $document->addScript(JURI::root() . 'media/com_joomailermailchimpintegration/backend/js/fileuploader.js');
                    $templateFolder = JRequest::getVar('template', array(), '', 'array');
                    $templateFolder = urldecode($templateFolder[0]);
                    $filename = JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/templates/' . $templateFolder . '/template.html';
                    $template = JFile::read($filename);
                    $src = JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/templates/' . $templateFolder;
                    $dest = JPATH_SITE . '/tmp/' . $templateFolder . '/';
                    JFolder::create($dest, 0777);
                    JFolder::copy($src, $dest, '', true);
                    $imagepath = '$1="' . JURI::base() . 'components/com_joomailermailchimpintegration/templates/' . $templateFolder . '/$2$3';
                    $template = preg_replace('#(href|src)="([^:"]*)("|(?:(?:%20|\\s|[.]|\\+)[^"]*"))#i', $imagepath, $template);
                    // prevent preview from being cached
                    $metaDataArray = array('<meta http-Equiv="Cache-Control" Content="no-cache">', '<meta http-Equiv="Pragma" Content="no-cache">', '<meta http-Equiv="Expires" Content="0">');
                    $template = str_ireplace($metaDataArray, '', $template);
                    $metaData = '<meta http-Equiv="Cache-Control" Content="no-cache"><meta http-Equiv="Pragma" Content="no-cache"><meta http-Equiv="Expires" Content="0">';
                    if (!stristr($template, '<head>')) {
                        $template = str_ireplace('<html>', '<html><head>' . $metaData . '</head>', $template);
                    } else {
                        $template = str_ireplace('</head>', $metaData . '</head>', $template);
                    }
                    $templatesPath = JURI::root() . 'administrator/components/com_joomailermailchimpintegration/templates';
                    $template = str_replace($templatesPath, JURI::root() . 'tmp', $template);
                    $tmpFile = JPATH_SITE . '/tmp/' . $templateFolder . '/template.html';
                    if (JFile::exists($tmpFile)) {
                        JFile::delete($tmpFile);
                    }
                    JFile::write($tmpFile, $template);
                    $tmpFileURL = '../tmp/' . $templateFolder . '/template.html';
                    $this->assignRef('iframeSrc', $tmpFileURL);
                    $this->assignRef('tmpPath', $tmpFile);
                    $this->assignRef('tmpFolder', $templateFolder);
                    // Get data from the model
                    $palettes = $this->get('Palettes');
                    $this->assignRef('palettes', $palettes);
                } else {
                    JToolBarHelper::title(JText::_('JM_NEWSLETTER') . ' : ' . JText::_('JM_EMAIL_TEMPLATES'), $this->getPageTitleClass());
                    JToolBarHelper::addNew('add', 'JM_UPLOAD_TEMPLATE');
                    JToolBarHelper::spacer();
                    JToolBarHelper::editList();
                    JToolBarHelper::spacer();
                    JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THIS_TEMPLATE'));
                    JToolBarHelper::spacer();
                    $templateFolders = $this->get('templateFolders');
                    $this->assignRef('templateFolders', $templateFolders);
                }
            }
        }
        parent::display($tpl);
        require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
    }
Exemplo n.º 19
0
 public function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $document->addStyleSheet(JURI::root(true) . '/media/com_joomailermailchimpintegration/backend/css/subscriber.css');
     JToolBarHelper::title(JText::_('JM_NEWSLETTER_SUBSCRIBERS'), $this->getPageTitleClass());
     $mainframe = JFactory::getApplication();
     $option = JRequest::getCmd('option');
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     $params = JComponentHelper::getParams('com_joomailermailchimpintegration');
     $MCapi = $params->get('params.MCapi');
     $JoomlamailerMC = new JoomlamailerMC();
     $AIM = true;
     $clientDetails = $this->getModel()->getClientDetails();
     if ($MCapi && $JoomlamailerMC->pingMC()) {
         JToolBarHelper::custom('goToLists', 'lists', 'lists', 'Lists', false, false);
         JToolBarHelper::spacer();
         if (JRequest::getVar('type') == 's') {
             JToolBarHelper::custom('unsubscribe', 'unsubscribe', 'unsubscribe', 'Unsubscribe', true, false);
             JToolBarHelper::spacer();
             JToolBarHelper::custom('delete', 'unsubscribe', 'unsubscribe', 'Delete', true, false);
             JToolBarHelper::spacer();
         } else {
             if (JRequest::getVar('type') == 'u') {
                 //JToolBarHelper::custom('resubscribe', 'resubscribe', 'resubscribe', 'Resubscribe', false, false);
             }
         }
     }
     $userid = JRequest::getVar('uid', 0, 'get', 'string');
     $email = JRequest::getVar('email', 0, '', 'string', JREQUEST_ALLOWRAW);
     $memberInfo = $this->getModel()->getListsForEmail();
     foreach ($memberInfo['lists'] as $key => $list) {
         $member_rating = $memberInfo['lists'][$key]['member_rating'];
         break;
     }
     if ($userid) {
         $user = JFactory::getUser($userid);
     }
     //TODO convert $start to GMT using JConfig and tzoffset
     $start = $user->registerDate;
     //$listid = JRequest::getVar('listid', 0, 'get', 'string');
     //$campaigns = $this->getModel()->MC_object()->campaigns(array('sendtime_start'=>$start, 'list_id'=>$listid));
     $campaigns = $this->getModel()->getCampaignsSince($start);
     //$lists = $this->getModel()->MC_object()->listsForEmail($email);
     $stats = array();
     foreach ($campaigns as $campaign) {
         $listmemberinfo = $this->getModel()->getListMemberInfo($campaign['list_id'], $email);
         //Check if this email was ever subscribed to this list
         if ($listmemberinfo) {
             //if (in_array($campaign['list_id'], $lists)) {
             $clicks = 0;
             if ($AIM) {
                 $clickStats = $this->getModel()->campaignEmailStatsAIM($campaign['id'], $user->email);
                 if (isset($clickStats[0])) {
                     foreach ($clickStats as $cs) {
                         if ($cs['action'] == 'click') {
                             $clicks++;
                         }
                     }
                 }
             }
             $stats[$campaign['id']]['clicks'] = $clicks;
             $opens = $this->getModel()->campaignOpenedAIM($campaign['id']);
             if ($opens) {
                 foreach ($opens as $o) {
                     if ($o['email'] == $email) {
                         $stats[$campaign['id']]['opens'] = $o['open_count'];
                         $stats[$campaign['id']]['received'] = true;
                     } else {
                         $stats[$campaign['id']]['opens'] = 0;
                         $softbounces = $this->getModel()->getSoftBounces($campaign['id']);
                         $hardbounces = $this->getModel()->getHardBounces($campaign['id']);
                         $bounces = array_merge($softbounces, $hardbounces);
                         $stats[$campaign['id']]['received'] = in_array($email, $bounces) ? 0 : 1;
                     }
                 }
             }
             $stats[$campaign['id']]['title'] = $campaign['title'];
             $stats[$campaign['id']]['date'] = $campaign['send_time'];
             $stats[$campaign['id']]['segment_text'] = $campaign['segment_text'];
             $stats[$campaign['id']]['list_sub'] = $listmemberinfo['timestamp'];
         }
     }
     $cbpath = JPATH_ADMINISTRATOR . '/components/com_comprofiler/admin.comprofiler.php';
     $jspath = JPATH_ADMINISTRATOR . '/components/com_community/admin.community.php';
     $db = JFactory::getDBO();
     $avatar = JURI::root() . 'media/com_joomailermailchimpintegration/backend/images/mailchimp_avatar.jpg';
     $gravatar_default = $avatar;
     if (JFile::exists($cbpath)) {
         //community builder is being used
         $query = 'SELECT avatar FROM #__comprofiler WHERE id=' . $userid;
         $db->setQuery($query);
         $avatarPath = $db->loadResult();
         if ($avatarPath) {
             $avatar = JURI::root() . 'images/comprofiler/' . $avatarPath;
         }
     } else {
         if (JFile::exists($jspath)) {
             //jomsocial is being used
             $query = 'SELECT avatar FROM #__community_users WHERE userid=' . $userid;
             $db->setQuery($query);
             $avatarPath = $db->loadResult();
             if ($avatarPath) {
                 $avatar = JURI::root() . $avatarPath;
             }
         }
     }
     if ($gravatar_default == $avatar) {
         $avatar = $this->getModel()->getGravatar($gravatar_default);
     }
     $twitterName = $this->getModel()->getTwitterName();
     $kloutScore = $this->getModel()->getKloutScore();
     $this->assignRef('kloutScore', $kloutScore);
     $this->assignRef('twitterName', $twitterName);
     $facebookName = $this->getModel()->getFacebookName();
     $this->assignRef('facebookName', $facebookName);
     $composite = new hotActivityComposite();
     $hotActivity = $composite->getActivity();
     $hotnessRating = $composite->getHotnessValue();
     $this->assignRef('hotnessRating', $hotnessRating);
     $this->assignRef('hotActivity', $hotActivity);
     $jomSocialGroups = $this->getModel()->getJomSocialGroups();
     $totalDiscussionsOfUser = $this->getModel()->getTotalJomSocialDiscussionsOfUser();
     $jomSocialDiscussions = $this->getModel()->getRecentJomSocialDiscussions();
     jimport('joomla.html.pagination');
     $pagination = new JPagination(count($stats), $limitstart, $limit);
     $this->assignRef('memberRating', $member_rating);
     $this->assignRef('jomSocialGroups', $jomSocialGroups);
     $this->assignRef('jomSocialDiscussions', $jomSocialDiscussions);
     $this->assignRef('totalDiscussionsOfUser', $totalDiscussionsOfUser);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('email', $email);
     $this->assignRef('stats', $stats);
     $this->assignRef('limitstart', $limitstart);
     $this->assignRef('subscribed', $subscribed);
     $this->assignRef('user', $user);
     $this->assignRef('avatar', $avatar);
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }
Exemplo n.º 20
0
 public function display($tpl = null)
 {
     $layout = JRequest::getVar('layout', 0, 'post', 'string');
     if ($layout == 'form') {
         $cid = JRequest::getVar('cid', '');
         if ($cid) {
             JToolBarHelper::title(JText::_('JM_NEWSLETTER_EDIT_MERGE_FIELD'), $this->getPageTitleClass());
         } else {
             JToolBarHelper::title(JText::_('JM_NEWSLETTER_NEW_MERGE_FIELD'), $this->getPageTitleClass());
         }
         JToolBarHelper::save();
         JToolBarHelper::spacer();
         JToolBarHelper::cancel();
         $CBfields = $this->get('CBfields');
         $this->assignRef('CBfields', $CBfields);
         $JSfields = $this->get('JSfields');
         $this->assignRef('JSfields', $JSfields);
         $VMfields = $this->get('VMfields');
         $this->assignRef('VMfields', $VMfields);
         $item = array();
         $item['listid'] = JRequest::getVar('listid');
         $item['name'] = '';
         $item['tag'] = '';
         $item['field_type'] = '';
         $item['req'] = 0;
         $item['choices'] = array();
         $fieldData = array();
         $fieldData[0] = new stdClass();
         $fieldData[0]->dbfield = '';
         if (isset($cid[0])) {
             $attribs = explode(';', $cid[0]);
             $item['name'] = $attribs[0];
             $item['tag'] = $attribs[1];
             $item['field_type'] = $attribs[2];
             $item['req'] = $attribs[3];
             $item['choices'] = explode('||', $attribs[4]);
             $db = JFactory::getDBO();
             $query = $db->getQuery(true);
             $query->select($db->qn(array('id', 'grouping_id', 'framework', 'dbfield')))->from($db->qn('#__joomailermailchimpintegration_custom_fields'))->where($db->qn('grouping_id') . ' = ' . $db->q($item['tag']));
             $db->setQuery($query);
             $fieldData = $db->loadObjectList();
             if (isset($fieldData[0])) {
                 $fieldId = $fieldData[0]->id;
                 $groupingId = $fieldData[0]->grouping_id;
                 if ($fieldData[0]->framework == 'CB') {
                     $CBeditID = $fieldData[0]->dbfield;
                     $JSeditID = '';
                     $VMeditID = '';
                 } else {
                     if ($fieldData[0]->framework == 'JS') {
                         $CBeditID = '';
                         $JSeditID = $fieldData[0]->dbfield;
                         $VMeditID = '';
                     } else {
                         if ($fieldData[0]->framework == 'VM') {
                             $CBeditID = '';
                             $JSeditID = '';
                             $query = $db->getQuery(true);
                             $query->select($db->qn('fieldid'))->from($db->qn('#__vm_userfield'))->where($db->qn('name') . ' = ' . $db->q($fieldData[0]->dbfield));
                             $db->setQuery($query);
                             $VMeditID = $db->loadResult();
                         }
                     }
                 }
             } else {
                 $fieldId = '';
                 $groupingId = '';
                 $CBeditID = '';
                 $JSeditID = '';
                 $VMeditID = '';
                 $fieldData = array();
                 $fieldData[0] = new stdClass();
                 $fieldData[0]->dbfield = '';
             }
         } else {
             $name = '';
             $CBeditID = '';
             $JSeditID = '';
             $VMeditID = '';
             $fieldId = '';
             $groupingId = '';
         }
         $types = array(array('type' => '0', 'name' => '--- ' . JText::_('JM_SELECT_A_DATA_TYPE') . ' ---'), array('type' => 'text', 'name' => 'text'), array('type' => 'email', 'name' => 'email'), array('type' => 'number', 'name' => 'number'), array('type' => 'radio', 'name' => 'radio'), array('type' => 'dropdown', 'name' => 'dropdown'), array('type' => 'date', 'name' => 'date'), array('type' => 'address', 'name' => 'address'), array('type' => 'phone', 'name' => 'phone'), array('type' => 'url', 'name' => 'url'), array('type' => 'imageurl', 'name' => 'imageurl'));
         $typeDropDown = JHTML::_('select.genericlist', $types, 'field_type', '', 'type', 'name', array($item['field_type']));
         $this->assignRef('typeDropDown', $typeDropDown);
         $this->assignRef('item', $item);
         $firstoption = new stdClass();
         $firstoption->id = 0;
         $firstoption->name = '--- ' . JText::_('JM_SELECT_FIELD') . ' ---';
         $JSDropDown = '';
         if ($JSfields) {
             $JSfields = array_merge(array($firstoption), $JSfields);
             $JSDropDown = JHTML::_('select.genericlist', $JSfields, 'JSfield', 'id="JSField" style="min-width:303px;"', 'id', 'name', array($fieldData[0]->dbfield));
         }
         $this->assignRef('JSDropDown', $JSDropDown);
         $this->assignRef('CBeditID', $CBeditID);
         $VMDropDown = '';
         if ($VMfields) {
             $VMfields = array_merge(array($firstoption), $VMfields);
             $VMDropDown = JHTML::_('select.genericlist', $VMfields, 'VMfield', 'id="VMfield" style="min-width:303px;"', 'id', 'name', array($VMeditID));
         }
         $this->assignRef('VMDropDown', $VMDropDown);
     } else {
         $fields = $this->get('Data');
         $this->assignRef('fields', $fields);
         $listId = JRequest::getVar('listid', '');
         $this->assignRef('listId', $listId);
         $name = JRequest::getVar('name', '');
         if (!$name) {
             $name = JRequest::getVar('listName', '');
         }
         $this->assignRef('name', $name);
         $title = $name ? $title = ' (' . $name . ')' : '';
         JToolBarHelper::title(JText::_('JM_NEWSLETTER_CUSTOM_MERGE_FIELDS') . $title, $this->getPageTitleClass());
         JToolBarHelper::custom('goToLists', 'lists', 'lists', 'JM_LISTS', false, false);
         JToolBarHelper::spacer();
         JToolBarHelper::addNew();
         JToolBarHelper::spacer();
         JToolBarHelper::editList();
         JToolBarHelper::spacer();
         JToolBarHelper::deleteList(JText::_('JM_ARE_YOU_SURE_TO_DELETE_THIS_MERGE_FIELD'));
     }
     parent::display($tpl);
     require_once JPATH_COMPONENT . '/helpers/jmFooter.php';
 }