/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { //TODO: Need to move css/js to SetDocument JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/statistic.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/filterpanel.js'); JHTML::script('media/com_newsletter/js/migur/js/search.js'); JHTML::script('media/com_newsletter/js/migur/js/raphael-min.js'); JHTML::script('media/com_newsletter/js/migur/js/g.raphael.js'); JHTML::script('media/com_newsletter/js/migur/js/g.line.js'); JHTML::script('media/com_newsletter/js/migur/js/g.pie.js'); JHTML::script('media/com_newsletter/js/migur/js/g.bar.js'); JHTML::script('media/com_newsletter/js/migur/js/raphael-migur-line.js'); JHTML::script('media/com_newsletter/js/migur/js/raphael-migur-pie.js'); JHTML::script('administrator/components/com_newsletter/views/statistic/hlines.js'); JHTML::script('administrator/components/com_newsletter/views/statistic/statistic.js'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->setStatisticsData(); parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the automailingitem name * * @return void * @since 1.0 */ public function display($tpl = null) { // Set the document $this->setDocument(); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } // Set main ID first $iid = JRequest::getInt('series_id'); $this->assignRef('seriesId', $iid); // Get automailing form $model = $this->getModel(); $item = $model->getItem(); $this->assignRef('item', $item); $this->assignRef('form', $this->get('Form', 'automailingitem')); // Set main ID first $aid = !empty($item->automailing_id) ? $item->automailing_id : JRequest::getInt('automailing_id'); $this->assignRef('automailingId', $aid); // All items of parent (siblings) $amItemsModel = JModel::getInstance('AutomailingItems', 'NewsletterModel'); $amItems = $amItemsModel->getAllItems($aid); $this->assignRef('allItems', $amItems); // Automailig entity $amItemsModel = JModel::getInstance('Automailing', 'NewsletterModel'); $am = $amItemsModel->getItem($aid); $this->assignRef('automailing', $am); parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { JHTML::_('behavior.modal'); $tStyleId = JRequest::getInt('t_style_id'); $modelTemps = JModel::getInstance('Templates', 'NewsletterModel'); $temps = (object) array('items' => $modelTemps->getStandardTemplates(), 'state' => $modelTemps->getState(), 'listOrder' => $modelTemps->getState('list.ordering'), 'listDirn' => $modelTemps->getState('list.direction')); $this->assignRef('templates', $temps); $script = $this->get('Script'); $this->script = $script; $this->tplForm = $this->get('Form', 'template'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } if ($tStyleId > 0) { $model = $this->getModel(); $template = $model->getTemplateBy($tStyleId); $this->assign('columns', $model->getColumnPlaceholders($template->content)); $this->assign('tplInfo', (object) $template->information); $name = $this->tplForm->getValue('template_name'); if (empty($name)) { $this->tplForm->setValue('template_name', null, $this->escape($this->tplInfo->name)); } } parent::display($tpl); // Set the document $this->setDocument(); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { JHTML::_('behavior.modal'); //TODO: Need to move css/js to SetDocument JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/subscribers.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/filterpanel.js'); JHTML::script('media/com_newsletter/js/migur/js/search.js'); JHTML::script(JURI::root() . "administrator/components/com_newsletter/views/subscribers/subscribers.js"); $this->setModel(JModel::getInstance('lists', 'NewsletterModel')); EnvironmentHelper::showWarnings(array('checkUserConflicts')); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } $modelSubs = $this->getModel('subscribers'); $modelLists = $this->getModel('lists'); $ss = (object) array('items' => $modelSubs->getItems(), 'pagination' => $modelSubs->getPagination(), 'state' => $modelSubs->getState(), 'listOrder' => $modelSubs->getState('list.ordering'), 'listDirn' => $modelSubs->getState('list.direction')); $this->assignRef('subscribers', $ss); $lists = (object) array('items' => $modelLists->getItems(), 'pagination' => $modelLists->getPagination(), 'state' => $modelLists->getState(), 'listOrder' => $modelLists->getState('list.ordering'), 'listDirn' => $modelLists->getState('list.direction')); $this->assignRef('lists', $lists); $this->assignRef('subscriberModel', JModel::getInstance('Subscriber', 'NewsletterModelEntity')); parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { //TODO: Need to move css/js to SetDocument JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/bounceds.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/filterpanel.js'); JHTML::script('media/com_newsletter/js/migur/js/search.js'); JHTML::script(JURI::root() . "/administrator/components/com_newsletter/views/newsletters/bounceds.js"); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); // Let's work with model 'newsletters' ! $model = $this->getModel('bounceds'); $items = $model->getItems(); $pagination = $model->getPagination(); $state = $model->getState(); $listOrder = $model->getState('list.ordering'); $listDirn = $model->getState('list.direction'); $saveOrder = $listOrder == 'a.ordering'; $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); $this->assignRef('state', $state); $this->assignRef('listOrder', $listOrder); $this->assignRef('listDirn', $listDirn); $this->assignRef('saveOrder', $saveOrder); parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { JHTML::_('behavior.modal'); JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/sender.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/filterpanel.js'); JHTML::script('media/com_newsletter/js/migur/js/search.js'); JHTML::script(JURI::root() . "administrator/components/com_newsletter/views/sender/sender.js"); $this->setModel(JModel::getInstance('lists', 'NewsletterModel')); $this->setModel(JModel::getInstance('newsletters', 'NewsletterModel')); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $modelLists = $this->getModel('lists'); JRequest::setVar('limit', 1); $limit = $modelLists->setState('limit', 1); $modelLists->filtering = array('state' => '1'); $lists = (object) array('items' => $modelLists->getItems(), 'pagination' => new JPagination(10, 0, 5), 'state' => $modelLists->getState(), 'listOrder' => $modelLists->getState('list.ordering'), 'listDirn' => $modelLists->getState('list.direction')); JavascriptHelper::addStringVar('defaultMailbox', MailHelper::getDefaultMailbox('idOnly')); $modelLists->setState('limit', $limit); $this->assignRef('lists', $lists); $this->addToolbar(); parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { JHTML::_('behavior.modal'); //TODO: Need to move css/js to SetDocument JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/templates.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script(JURI::root() . "administrator/components/com_newsletter/views/templates/templates.js"); JHTML::script('media/com_newsletter/js/migur/js/filterpanel.js'); JHTML::script('media/com_newsletter/js/migur/js/search.js'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } $modelTemps = $this->getModel('templates'); $pagination = $modelTemps->getPagination(); $temps = (object) array('items' => $modelTemps->getItems(), 'state' => $modelTemps->getState(), 'listOrder' => $modelTemps->getState('list.ordering'), 'listDirn' => $modelTemps->getState('list.direction')); $this->assignRef('templates', $temps); $this->assignRef('pagination', $pagination); parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { JHTML::_('behavior.modal'); JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/import.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/message.js'); $this->assignRef('components', DataHelper::getSupportedComponents()); $this->addToolbar(); parent::display($tpl); }
/** * Display the view * * @return void */ public function display($tpl = null) { $this->ssForm = $this->get('Form', 'mailboxprofile'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); parent::display($tpl); // Set the document $this->setDocument(); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { // Find out if there are backed up tables. $sess = JFactory::getSession(); $this->assignRef('backups', $sess->get('com-newsletter-backup')); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } parent::display($tpl); // Set the document $this->setDocument(); }
/** * Displays the view. * * @param string $tpl the automailing name * * @return void * @since 1.0 */ public function display($tpl = null) { // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } $model = $this->getModel('automailings'); $amList = (object) array('items' => $model->getItems(), 'state' => $model->getState(), 'listOrder' => $model->getState('list.ordering'), 'listDirn' => $model->getState('list.direction')); $this->assignRef('automailings', $amList); $pagination = $model->getPagination(); $this->assignRef('pagination', $pagination); $this->setDocument(); parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/dashboard.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/raphael-min.js'); JHTML::script('media/com_newsletter/js/migur/js/g.raphael-min.js'); JHTML::script('media/com_newsletter/js/migur/js/g.line-min.js'); JHTML::script('media/com_newsletter/js/migur/js/g.raphael.js'); JHTML::script('media/com_newsletter/js/migur/js/g.line.js'); JHTML::script('media/com_newsletter/js/migur/js/g.pie.js'); JHTML::script('media/com_newsletter/js/migur/js/g.bar.js'); JHTML::script('media/com_newsletter/js/migur/js/raphael-migur-line.js'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } EnvironmentHelper::showWarnings(array('checkJoomla', 'checkImap', 'checkLogs')); $this->addToolbar(); $stat = QueueHelper::getCount(); $sent = 0; $toSend = 0; $total = 0; foreach ($stat as $row) { $sent += $row['sent']; $toSend += $row['to_send']; $total += $row['total']; } JavascriptHelper::addStringVar('emailsSent', $sent); JavascriptHelper::addStringVar('emailsToSend', $toSend); JavascriptHelper::addStringVar('emailsTotal', $total); JavascriptHelper::addStringVar('newslettersSent', count($stat)); $cache = JFactory::getCache('com_newsletter'); $this->news = $cache->call(array('RssfeedHelper', 'loadFeed'), new JObject(array('rssurl' => JRoute::_('http://migur.com/blog?format=feed&type=rss')))); $this->info = NewsletterHelper::getCommonInfo(); $this->setStatisticsData(); $sess = JFactory::getSession(); JavascriptHelper::addStringVar('sessname', $sess->getName()); parent::display($tpl); // Set the document $this->setDocument(); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { //TODO: Need to move css/js to SetDocument JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/subscriber.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/message.js'); $script = $this->get('Script'); $this->script = $script; $this->ssForm = $this->get('Form', 'subscriber'); // call getItems from model 'lists' via JView->get() $this->subscriberId = $this->ssForm->getValue('subscriber_id'); if ($this->getLayout() == 'edit') { $model = JModel::getInstance('Subscriber', 'NewsletterModelEntity'); $model->load($this->subscriberId); $this->subscriber = $model; $model = $this->setModel(JModel::getInstance('lists', 'NewsletterModel')); $model->filtering = array('subscriber_id' => JRequest::getInt('subscriber_id', null)); $model->setSubscriberQuery(); $model = $this->setModel(JModel::getInstance('sents', 'NewsletterModel')); $model->filtering = array('subscriber_id' => JRequest::getInt('subscriber_id', null)); $model = $this->setModel(JModel::getInstance('history', 'NewsletterModel')); $model->filtering = array('subscriber_id' => JRequest::getInt('subscriber_id', null)); $this->listItems = $this->get('Items', 'lists'); $this->newsletterItems = $this->get('Items', 'sents'); $this->historyItems = $this->get('Items', 'history'); // used to get the pagination layout in any cases $this->historyPagination = new JPagination(10, 0, 5); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } parent::display($tpl); // Set the document $this->setDocument(); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { //TODO: Need to move css/js to SetDocument JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/newsletters.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/filterpanel.js'); JHTML::script('media/com_newsletter/js/migur/js/search.js'); JHTML::script('media/com_newsletter/js/migur/js/raphael-min.js'); JHTML::script('media/com_newsletter/js/migur/js/g.raphael.js'); JHTML::script('media/com_newsletter/js/migur/js/g.pie.js'); JHTML::script('media/com_newsletter/js/migur/js/raphael-migur-pie.js'); JHTML::script(JURI::root() . "/administrator/components/com_newsletter/views/newsletters/newsletters.js"); $this->setModel(JModel::getInstance('lists', 'NewsletterModel')); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } JHTML::_('behavior.modal'); // Let's work with model 'newsletters' ! $model = $this->getModel('newsletters'); $items = $model->getItems(); $pagination = $model->getPagination(); $state = $model->getState(); $listOrder = $model->getState('list.ordering'); $listDirn = $model->getState('list.direction'); $saveOrder = $listOrder == 'a.ordering'; $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); $this->assignRef('state', $state); $this->assignRef('listOrder', $listOrder); $this->assignRef('listDirn', $listDirn); $this->assignRef('saveOrder', $saveOrder); $this->setStatisticsData(); parent::display($tpl); }
/** * Display the view * * @return void */ public function display($tpl = null) { JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/smtpprofile.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); $this->ssForm = $this->get('Form', 'smtpprofile'); $model = JModel::getInstance('Smtpprofile', 'NewsletterModelEntity'); $smtpid = JRequest::getInt('smtp_profile_id', null); if ($smtpid !== null) { $model->load($smtpid); } JavascriptHelper::addStringVar('migurIsJoomlaProfile', $model->isJoomlaProfile()); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); parent::display($tpl); // Set the document $this->setDocument(); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { //TODO: Need to move css/js to SetDocument JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/queues.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/filterpanel.js'); JHTML::script('media/com_newsletter/js/migur/js/search.js'); JHTML::script(JURI::root() . "/administrator/components/com_newsletter/views/queues/queues.js"); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } EnvironmentHelper::showWarnings(array('checkJoomla', 'checkImap', 'checkLogs')); // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } // JHTML::_('behavior.modal'); // Let's work with model 'queues' ! $model = $this->getModel('queues'); $items = $model->getItems(); $pagination = $model->getPagination(); $state = $model->getState(); $listOrder = $model->getState('list.ordering'); $listDirn = $model->getState('list.direction'); $saveOrder = $listOrder == 'a.ordering'; $this->assignRef('items', $items); $this->assignRef('pagination', $pagination); $this->assignRef('state', $state); $this->assignRef('listOrder', $listOrder); $this->assignRef('listDirn', $listDirn); $this->assignRef('saveOrder', $saveOrder); $sess = JFactory::getSession(); JavascriptHelper::addStringVar('sessname', $sess->getName()); parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { JHTML::_('behavior.modal'); JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/configuration.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('administrator/components/com_newsletter/views/configuration/configuration.js'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } EnvironmentHelper::showWarnings(array('checkJoomla', 'checkImap', 'checkLogs', 'checkAcl')); $this->general = JComponentHelper::getParams('com_newsletter'); //$model = JModel::getInstance('extensions', 'NewsletterModel'); //$this->modules = $model->getModules(); //$this->plugins = $model->getPlugins(); $this->modules = MigurModuleHelper::getSupported(); $this->plugins = MigurPluginHelper::getSupported(); $this->form = $this->get('Form'); $this->addToolbar(); parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/extension.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script(JURI::root() . "/administrator/components/com_newsletter/views/extension/submitbutton.js"); $type = JRequest::getString('type', ''); $native = JRequest::getInt('native', null); $extensionId = JRequest::getInt('extension_id', 0); if ($type == 'plugin') { $exts = MigurPluginHelper::getSupported(array('extension_id' => $extensionId, 'native' => $native)); } else { $exts = MigurModuleHelper::getSupported(array('extension_id' => $extensionId, 'native' => $native)); } $lang = JFactory::getLanguage(); $lang->load('com_content', JPATH_ADMINISTRATOR, null, false, false); $ext = $exts[0]; $this->info = $ext->xml; if (JRequest::getString('layout') == 'edit') { $model = $this->getModel(); $this->form = $model->getForm(array('module' => $ext->extension, 'native' => $ext->native, 'type' => $ext->type)); } parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { // Set the document $this->setDocument(); $this->addToolbar(); // Set main ID first $aid = JRequest::getInt('automailing_id'); $this->assignRef('automailingId', $aid); // Get automailing form $model = $this->getModel(); $automailing = $model->getItem(); $this->assignRef('automailing', $automailing); JavascriptHelper::addObject('automailing', $automailing); $this->assignRef('form', $this->get('form', 'automailing')); // Get item list (series) $itemsModel = JModel::getInstance('AutomailingItems', 'NewsletterModel'); $itemsModel->automailingId = $aid; $amList = (object) array('items' => $itemsModel->getNormalizedItems($aid), 'state' => $itemsModel->getState(), 'listOrder' => $itemsModel->getState('list.ordering'), 'listDirn' => $itemsModel->getState('list.direction'), 'pagination' => $itemsModel->getPagination()); $this->assignRef('automailingItems', $amList); // Get targets list $targetsModel = JModel::getInstance('AutomailingTargets', 'NewsletterModel'); $targetsModel->automailingId = $aid; if ($tpl != 'details') { // Get ids for all available lists $listsModel = JModel::getInstance('Lists', 'NewsletterModel'); $allLists = $listsModel->getAllActive(); // Find all used lists $usedLists = $targetsModel->getRelatedLists($aid); // Diff the records $usedListIds = DataHelper::getColumnData($usedLists, 'list_id'); foreach ($allLists as $idx => $item) { if (in_array($item->list_id, $usedListIds)) { unset($allLists[$idx]); } } $amTargets = (object) array('items' => $targetsModel->getRelatedLists($aid, 'usePagination'), 'state' => $targetsModel->getState(), 'listOrder' => $targetsModel->getState('list.ordering'), 'listDirn' => $targetsModel->getState('list.direction'), 'pagination' => $targetsModel->getPagination()); $this->assignRef('automailingTargets', $amTargets); $this->assignRef('unusedLists', $allLists); } if ($tpl == 'details') { $this->assignRef('automailingTargets', $targetsModel->getNames($aid)); } parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { $isNew = !JRequest::getInt('newsletter_id', false); if ($isNew && !AclHelper::actionIsAllowed('newsletter.add') || !$isNew && !AclHelper::actionIsAllowed('newsletter.edit')) { $msg = $isNew ? 'JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED' : 'JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'; JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_newsletter&view=newsletters', false), JText::_($msg), 'error'); return; } //TODO: Need to move css/js to SetDocument JHTML::stylesheet('media/com_newsletter/css/admin.css'); JHTML::stylesheet('media/com_newsletter/css/newsletter.css'); JHTML::script('media/com_newsletter/js/migur/js/core.js'); JHTML::script('media/com_newsletter/js/migur/js/ajax.js'); JHTML::script('media/com_newsletter/js/migur/js/widgets.js'); JHTML::script('media/com_newsletter/js/migur/js/moodialog/MooDialog.js'); JHTML::script('media/com_newsletter/js/migur/js/moodialog/MooDialog.Request.js'); JHTML::script('media/com_newsletter/js/migur/js/moodialog/MooDialog.IFrame.js'); JHTML::stylesheet('media/com_newsletter/js/migur/js/moodialog/css/MooDialog.css'); JHTML::script('media/com_newsletter/js/migur/js/autocompleter/Observer.js'); JHTML::script('media/com_newsletter/js/migur/js/autocompleter/Autocompleter.js'); JHTML::script('media/com_newsletter/js/migur/js/autocompleter/Autocompleter.Local.js'); JHTML::stylesheet('media/com_newsletter/js/migur/js/autocompleter/css/Autocompleter.css'); JHTML::script('media/com_newsletter/js/migur/js/guide.js'); JHTML::stylesheet('media/com_newsletter/css/guide.css'); //TODO: Bulk-code. Need to refactor. JavascriptHelper::addObject('comParams', JComponentHelper::getParams('com_newsletter')->toArray()); $nId = JRequest::getInt('newsletter_id'); $script = $this->get('Script'); $this->script = $script; // Get main form and data for newsletter $this->form = $this->get('Form', 'newsletter'); $this->newsletter = $this->get('Item'); $smtpModel = JModel::getInstance('SMtpProfile', 'NewsletterModelEntity'); // Let's add J! profile $smtpp = $smtpModel->loadJoomla(); JavascriptHelper::addObject('joomlaDe', JComponentHelper::getParams('com_newsletter')->toArray()); // get the SmtpProfiles data $smtpprofilesManager = JModel::getInstance('smtpprofiles', 'NewsletterModel'); $this->assignRef('smtpprofiles', $smtpprofilesManager->getAllItems('withDefault')); // get all the Extensions $this->modules = MigurModuleHelper::getSupported(array('withoutInfo' => true)); $this->plugins = MigurPluginHelper::getSupported(array('withoutInfo' => true), 'com_newsletter.newsletter'); // get the Extensions used in this newsletter $model = JModel::getInstance('newsletterext', 'NewsletterModel'); $this->usedExts = $model->getExtensionsBy($nId); // Get a list of all templates $this->setModel(JModel::getInstance('templates', 'NewsletterModel')); $model = $this->getModel('templates'); $templs = $model->getItems(); $path = JPATH_COMPONENT . '/extensions/templates/'; $filenames = JFolder::files($path, '^.*\\.xml$'); if ($filenames === false) { JError::raiseError(500, implode("\n", array("Path {$path} not found"))); } $this->templates = (object) array('items' => array(), 'path' => $path); $this->htmlTemplateId = null; foreach ($templs as $item) { $xml = new JSimpleXML(); $xml->loadFile($path . $item->template); $str = trim($xml->document->template[0]->_data); $str = preg_replace('/<style.*>.*<\\/style>/s', '', $str); $str = str_replace('<position', '<div class="drop container-draggables"', $str); $id = strtolower(str_replace('.', '-', $item->template) . '-' . $item->t_style_id); $item->id = $id; $item->filename = $item->template; $item->template = $str; $this->templates->items[] = $item; if ($this->newsletter->t_style_id == $item->t_style_id) { $this->htmlTemplateId = $id; $this->t_style_id = $item->t_style_id; } unset($xml); } //attachments $this->attItems = array(); $this->dynamicData = array('Name' => '[username]', 'Email' => '[useremail]', 'Site name' => '[sitename]', 'Subscription key' => '[subscription key]', 'Unsubscription link' => '[unsubscription link]', 'Confirmation link' => '[confirmation link]'); $this->attItemslistDirn = "a.filename"; $this->attItemslistOrder = "asc"; // getting of an xml from // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // We don't need toolbar in the modal window. if ($this->getLayout() !== 'modal') { $this->addToolbar(); } $this->downloads = (array) DownloadHelper::getByNewsletterId($nId); JavascriptHelper::addObject('dataStorage', (object) array('htmlTemplate' => (object) array('template' => (object) array('id' => $this->htmlTemplateId), 'extensions' => (array) $this->usedExts), 'templates' => (array) $this->templates->items, 'modules' => (array) $this->modules, 'plugins' => (array) $this->plugins, 'newsletter' => NewsletterHelper::get($nId))); // Set the document $this->setDocument(); parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { $this->setDocument(); parent::display($tpl); }
/** * Displays the view. * * @param string $tpl the template name * * @return void * @since 1.0 */ public function display($tpl = null) { $isNew = !JRequest::getInt('list_id', false); if ($isNew && !AclHelper::actionIsAllowed('list.add') || !$isNew && !AclHelper::actionIsAllowed('list.edit')) { $msg = $isNew ? 'JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED' : 'JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'; JFactory::getApplication()->redirect(JRoute::_('index.php?option=com_newsletter&view=subscribers', false), JText::_($msg), 'error'); return; } //TODO: Bulk-code. Need to refactor $listId = JRequest::getInt('list_id', 0); switch (JRequest::getString('subtask', '')) { case 'import': $this->subtask = 1; break; case 'exclude': $this->subtask = 2; break; default: $this->subtask = 0; } JavaScriptHelper::addStringVar('subtask', $this->subtask); $script = $this->get('Script'); $this->script = $script; $this->listForm = $this->get('Form', 'list'); $this->setModel(JModel::getInstance('subscribers', 'NewsletterModel')); $sess = JFactory::getSession(); $data = $sess->get('list.' . $listId . '.file.uploaded'); if ($data) { JavaScriptHelper::addObject('uploadData', $data); } $modelSubs = new NewsletterModelSubscribers(); $modelSubs->setState('list.limit', 10); if (!empty($listId)) { $this->subs = $modelSubs->getSubscribersByList(array('list_id' => JRequest::getInt('list_id'))); $items = $modelSubs->getUnsubscribedList(array('list_id' => JRequest::getInt('list_id'))); } else { $items = array(); $this->subs = array(); } $ss = (object) array('items' => $items, 'state' => $modelSubs->getState(), 'listOrder' => $modelSubs->getState('list.unsubscribed.ordering'), 'listDirn' => $modelSubs->getState('list.unsubscribed.direction')); $this->assignRef('subscribers', $ss); // get data for "excluded" $model = JModel::getInstance('lists', 'NewsletterModel'); // get only active lists $model->setState('filter.fields', array('a.state="1"', 'a.list_id<>' . JRequest::getInt('list_id'))); $this->lists = (object) array('items' => $model->getItems(), 'state' => $model->getState(), 'listOrder' => $model->getState('list.ordering'), 'listDirn' => $model->getState('list.direction')); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } // We don't need toolbar in the modal window. $this->addToolbar(); $config = JComponentHelper::getParams('com_media'); $app = JFactory::getApplication(); $lang = JFactory::getLanguage(); $append = ''; if ($config->get('enable_flash', 1)) { JHTML::stylesheet('media/com_newsletter/css/uploaders.css'); JHTML::script(JURI::root() . "administrator/components/com_newsletter/views/list/uploaders.js"); $fileTypes = $config->get('image_extensions', 'bmp,gif,jpg,png,jpeg'); $types = explode(',', $fileTypes); $displayTypes = ''; // this is what the user sees $filterTypes = ''; // this is what controls the logic $firstType = true; foreach ($types as $type) { if (!$firstType) { $displayTypes .= ', '; $filterTypes .= '; '; } else { $firstType = false; } $displayTypes .= '*.' . $type; $filterTypes .= '*.' . $type; } $typeString = '{ \'' . JText::_('COM_MEDIA_FILES', 'true') . ' (' . $displayTypes . ')\': \'' . $filterTypes . '\' }'; } /* * Display form for FTP credentials? * Don't set them here, as there are other functions called before this one if there is any file write operation */ jimport('joomla.client.helper'); $ftp = !JClientHelper::hasCredentials('ftp'); $this->assignRef('session', JFactory::getSession()); $this->assignRef('config', $config); $this->assignRef('state', $this->get('state')); $this->assignRef('folderList', $this->get('folderList')); $this->assign('require_ftp', $ftp); $this->setStatisticsData(); // Set the document $this->setDocument(); parent::display($tpl); }