Пример #1
0
 function listing()
 {
     $app =& JFactory::getApplication();
     $pageInfo = null;
     $config = acymailing_config();
     $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName() . $this->getLayout();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.ordering', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word');
     $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower($pageInfo->search);
     $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database =& JFactory::getDBO();
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . $database->getEscaped($pageInfo->search, true) . '%\'';
         $this->filters[] = "a.name LIKE {$searchVal} OR a.description LIKE {$searchVal} OR a.tempid LIKE {$searchVal}";
     }
     $query = 'SELECT ' . implode(',', $this->selection) . ' FROM ' . acymailing_table('template') . ' as a';
     if (!empty($this->filters)) {
         $query .= ' WHERE (' . implode(') AND (', $this->filters) . ')';
     }
     if (!empty($pageInfo->filter->order->value)) {
         $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
     $this->rows = $database->loadObjectList();
     $queryCount = 'SELECT COUNT(a.tempid) FROM ' . acymailing_table('template') . ' as a';
     if (!empty($this->filters)) {
         $queryCount .= ' WHERE (' . implode(') AND (', $this->filters) . ')';
     }
     $database->setQuery($queryCount);
     $pageInfo->elements->total = $database->loadResult();
     if (!empty($pageInfo->search)) {
         $rows = acymailing_search($pageInfo->search, $this->rows);
     } else {
         $rows =& $this->rows;
     }
     $pageInfo->elements->page = count($rows);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
     if ($this->button) {
         acymailing_setTitle(JText::_('ACY_TEMPLATES'), 'acytemplate', 'template');
         $bar =& JToolBar::getInstance('toolbar');
         $bar->appendButton('Popup', 'upload', JText::_('IMPORT'), "index.php?option=com_acymailing&ctrl=template&task=upload&tmpl=component");
         JToolBarHelper::divider();
         JToolBarHelper::addNew();
         JToolBarHelper::editList();
         if (acymailing_isAllowed($config->get('acl_templates_delete', 'all'))) {
             JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS', true));
         }
         JToolBarHelper::spacer();
         JToolBarHelper::custom('copy', 'copy.png', 'copy.png', JText::_('ACY_COPY'));
         JToolBarHelper::divider();
         $bar->appendButton('Pophelp', 'template-listing');
         if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) {
             $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard'));
         }
     }
     $toggleClass = acymailing_get('helper.toggle');
     $order = null;
     $order->ordering = false;
     $order->orderUp = 'orderup';
     $order->orderDown = 'orderdown';
     $order->reverse = false;
     if ($pageInfo->filter->order->value == 'a.ordering') {
         $order->ordering = true;
         if ($pageInfo->filter->order->dir == 'desc') {
             $order->orderUp = 'orderdown';
             $order->orderDown = 'orderup';
             $order->reverse = true;
         }
     }
     $this->assignRef('order', $order);
     $this->assignRef('toggleClass', $toggleClass);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->assignRef('pagination', $pagination);
 }
Пример #2
0
 function listing()
 {
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->elements = new stdClass();
     $config = acymailing_config();
     $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.mailid', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower($pageInfo->search);
     $selectedList = $app->getUserStateFromRequest($paramBase . "filter_list", 'filter_list', 0, 'int');
     $selectedCreator = $app->getUserStateFromRequest($paramBase . "filter_creator", 'filter_creator', 0, 'int');
     $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database = JFactory::getDBO();
     $searchMap = array('a.mailid', 'a.alias', 'a.subject', 'a.fromname', 'a.fromemail', 'a.replyname', 'a.replyemail', 'a.userid', 'b.name', 'b.username', 'b.email');
     $filters = array();
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
     }
     $filters[] = 'a.type = \'' . $this->type . '\'';
     if (!empty($selectedList)) {
         $filters[] = 'c.listid = ' . $selectedList;
     }
     if (!empty($selectedCreator)) {
         $filters[] = 'a.userid = ' . $selectedCreator;
     }
     $selection = array_merge($searchMap, array('a.created', 'a.frequency', 'a.senddate', 'a.published', 'a.type', 'a.visible'));
     if (empty($selectedList)) {
         $query = 'SELECT ' . implode(',', $selection) . ' FROM ' . acymailing_table('mail') . ' as a';
         $queryCount = 'SELECT COUNT(a.mailid) FROM ' . acymailing_table('mail') . ' as a';
     } else {
         $query = 'SELECT ' . implode(',', $selection) . ' FROM ' . acymailing_table('listmail') . ' as c';
         $query .= ' JOIN ' . acymailing_table('mail') . ' as a on a.mailid = c.mailid ';
         $queryCount = 'SELECT COUNT(c.mailid) FROM ' . acymailing_table('listmail') . ' as c';
         $queryCount .= ' JOIN ' . acymailing_table('mail') . ' as a on a.mailid = c.mailid ';
     }
     $query .= ' LEFT JOIN ' . acymailing_table('users', false) . ' as b on a.userid = b.id ';
     $query .= ' WHERE (' . implode(') AND (', $filters) . ')';
     if (!empty($pageInfo->filter->order->value)) {
         $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     if (count($filters) > 1) {
         $queryCount .= ' LEFT JOIN ' . acymailing_table('users', false) . ' as b on a.userid = b.id ';
     }
     $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')';
     $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
     $rows = $database->loadObjectList();
     if (!empty($pageInfo->search)) {
         $rows = acymailing_search($pageInfo->search, $rows);
     }
     $database->setQuery($queryCount);
     $pageInfo->elements->total = $database->loadResult();
     $pageInfo->elements->page = count($rows);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
     acymailing_setTitle(JText::_($this->nameListing), $this->icon, $this->ctrl);
     $bar = JToolBar::getInstance('toolbar');
     $buttonPreview = JText::_('ACY_PREVIEW');
     if ($this->type == 'autonews') {
         JToolBarHelper::custom('generate', 'process', '', JText::_('GENERATE'), false);
     } elseif ($this->type == 'news') {
         $buttonPreview .= ' / ' . JText::_('SEND');
     }
     JToolBarHelper::custom('preview', 'acypreview', '', $buttonPreview, true);
     JToolBarHelper::divider();
     JToolBarHelper::addNew();
     JToolBarHelper::editList();
     if (acymailing_isAllowed($config->get('acl_' . $this->aclCat . '_delete', 'all'))) {
         JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS'));
     }
     JToolBarHelper::spacer();
     JToolBarHelper::custom('copy', 'copy.png', 'copy.png', JText::_('ACY_COPY'));
     JToolBarHelper::divider();
     $bar->appendButton('Pophelp', $this->doc);
     if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) {
         $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard'));
     }
     $filters = new stdClass();
     $listmailType = acymailing_get('type.listsmail');
     $listmailType->type = $this->type;
     $mailcreatorType = acymailing_get('type.mailcreator');
     $mailcreatorType->type = $this->type;
     $filters->list = $listmailType->display('filter_list', $selectedList);
     $filters->creator = $mailcreatorType->display('filter_creator', $selectedCreator);
     $this->assignRef('filters', $filters);
     $toggleClass = acymailing_get('helper.toggle');
     $this->assignRef('toggleClass', $toggleClass);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->assignRef('pagination', $pagination);
     $delay = acymailing_get('type.delaydisp');
     $this->assignRef('delay', $delay);
     $this->assignRef('config', $config);
 }
Пример #3
0
 static function search($searchString, $object)
 {
     return acymailing_search($searchString, $object);
 }
Пример #4
0
 function choose()
 {
     $pageInfo = new stdClass();
     $app = JFactory::getApplication();
     $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName() . '_' . $this->getLayout();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->elements = new stdClass();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.name', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word');
     $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower($pageInfo->search);
     $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
     if (empty($pageInfo->limit->value)) {
         $pageInfo->limit->value = 100;
     }
     $db = JFactory::getDBO();
     $filters = array();
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $this->searchFields) . " LIKE {$searchVal}";
     }
     if (JRequest::getString('onlyreg')) {
         $filters[] = 'a.userid > 0';
     }
     $query = 'SELECT ' . implode(',', $this->selectedFields) . ' FROM #__acymailing_subscriber as a';
     $query .= ' LEFT JOIN #__users as b on a.userid = b.id';
     if (!empty($filters)) {
         $query .= ' WHERE (' . implode(') AND (', $filters) . ')';
     }
     if (!empty($pageInfo->filter->order->value)) {
         $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     $db->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
     $rows = $db->loadObjectList();
     $queryWhere = 'SELECT COUNT(a.subid) FROM #__acymailing_subscriber as a';
     if (!empty($filters)) {
         $queryWhere .= ' LEFT JOIN #__users as b on a.userid = b.id';
         $queryWhere .= ' WHERE (' . implode(') AND (', $filters) . ')';
     }
     $db->setQuery($queryWhere);
     $pageInfo->elements->total = $db->loadResult();
     if (!empty($pageInfo->search)) {
         $rows = acymailing_search($pageInfo->search, $rows);
     }
     $pageInfo->elements->page = count($rows);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->assignRef('pagination', $pagination);
 }
Пример #5
0
 function listing()
 {
     JHTML::_('behavior.modal', 'a.modal');
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->elements = new stdClass();
     $config = acymailing_config();
     $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.senddate', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word');
     $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower($pageInfo->search);
     $selectedMail = $app->getUserStateFromRequest($paramBase . "filter_mail", 'filter_mail', 0, 'int');
     $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database = JFactory::getDBO();
     $filters = array();
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $this->searchFields) . " LIKE {$searchVal}";
     }
     if (!empty($selectedMail)) {
         $filters[] = 'a.mailid = ' . intval($selectedMail);
     }
     $query = 'SELECT ' . implode(' , ', $this->selectFields);
     $query .= ' FROM ' . acymailing_table('queue') . ' as a';
     $query .= ' JOIN ' . acymailing_table('subscriber') . ' as b on a.subid = b.subid';
     $query .= ' JOIN ' . acymailing_table('mail') . ' as c on a.mailid = c.mailid';
     if (!empty($filters)) {
         $query .= ' WHERE (' . implode(') AND (', $filters) . ')';
     }
     if (!empty($pageInfo->filter->order->value)) {
         $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir . ', a.`subid` ASC';
     }
     if (empty($pageInfo->limit->value)) {
         $pageInfo->limit->value = 100;
     }
     $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
     $rows = $database->loadObjectList();
     $pageInfo->elements->page = count($rows);
     if ($pageInfo->limit->value > $pageInfo->elements->page) {
         $pageInfo->elements->total = $pageInfo->limit->start + $pageInfo->elements->page;
     } else {
         $queryCount = 'SELECT COUNT(a.mailid) FROM ' . acymailing_table('queue') . ' as a';
         if (!empty($pageInfo->search)) {
             $queryCount .= ' JOIN ' . acymailing_table('subscriber') . ' as b on a.subid = b.subid';
             $queryCount .= ' JOIN ' . acymailing_table('mail') . ' as c on a.mailid = c.mailid';
         }
         if (!empty($filters)) {
             $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')';
         }
         $database->setQuery($queryCount);
         $pageInfo->elements->total = $database->loadResult();
     }
     if (!empty($pageInfo->search)) {
         $rows = acymailing_search($pageInfo->search, $rows);
     }
     jimport('joomla.html.pagination');
     $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
     $mailqueuetype = acymailing_get('type.queuemail');
     $filtersType = new stdClass();
     $filtersType->mail = $mailqueuetype->display('filter_mail', $selectedMail);
     acymailing_setTitle(JText::_('QUEUE'), 'process', 'queue');
     $bar = JToolBar::getInstance('toolbar');
     if (acymailing_isAllowed($config->get('acl_queue_process', 'all'))) {
         $bar->appendButton('Acypopup', 'process', JText::_('PROCESS'), "index.php?option=com_acymailing&ctrl=queue&task=process&tmpl=component&mailid=" . $selectedMail);
     }
     if (!empty($pageInfo->elements->total) and acymailing_isAllowed($config->get('acl_queue_delete', 'all'))) {
         JToolBarHelper::spacer();
         JToolBarHelper::spacer();
         $bar->appendButton('Confirm', JText::sprintf('CONFIRM_DELETE_QUEUE', $pageInfo->elements->total), 'delete', JText::_('ACY_DELETE'), 'remove', false, false);
     }
     JToolBarHelper::divider();
     $bar->appendButton('Pophelp', 'queue-listing');
     if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) {
         $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard'));
     }
     $toggleClass = acymailing_get('helper.toggle');
     $this->assignRef('toggleClass', $toggleClass);
     $this->assignRef('filters', $filtersType);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->assignRef('pagination', $pagination);
 }
Пример #6
0
    public function acymailingtagcontent_show()
    {
        $app = JFactory::getApplication();
        $pageInfo = new stdClass();
        $pageInfo->filter = new stdClass();
        $pageInfo->filter->order = new stdClass();
        $pageInfo->limit = new stdClass();
        $pageInfo->elements = new stdClass();
        $my = JFactory::getUser();
        $lang = JFactory::getLanguage();
        $lang->load('com_content', JPATH_SITE);
        $paramBase = ACYMAILING_COMPONENT . '.tagcontent';
        $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.id', 'cmd');
        $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
        if (strtolower($pageInfo->filter->order->dir) !== 'desc') {
            $pageInfo->filter->order->dir = 'asc';
        }
        $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
        $pageInfo->search = JString::strtolower(trim($pageInfo->search));
        $pageInfo->filter_cat = $app->getUserStateFromRequest($paramBase . ".filter_cat", 'filter_cat', '', 'int');
        $pageInfo->contenttype = $app->getUserStateFromRequest($paramBase . ".contenttype", 'contenttype', $this->params->get('default_type', 'intro'), 'string');
        $pageInfo->author = $app->getUserStateFromRequest($paramBase . ".author", 'author', $this->params->get('default_author', '0'), 'string');
        $pageInfo->titlelink = $app->getUserStateFromRequest($paramBase . ".titlelink", 'titlelink', $this->params->get('default_titlelink', 'link'), 'string');
        $pageInfo->lang = $app->getUserStateFromRequest($paramBase . ".lang", 'lang', '', 'string');
        $pageInfo->pict = $app->getUserStateFromRequest($paramBase . ".pict", 'pict', $this->params->get('default_pict', 1), 'string');
        $pageInfo->pictheight = $app->getUserStateFromRequest($paramBase . ".pictheight", 'pictheight', $this->params->get('maxheight', 150), 'string');
        $pageInfo->pictwidth = $app->getUserStateFromRequest($paramBase . ".pictwidth", 'pictwidth', $this->params->get('maxwidth', 150), 'string');
        $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
        $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
        $picts = array();
        $picts[] = JHTML::_('select.option', "1", JText::_('JOOMEXT_YES'));
        $pictureHelper = acymailing_get('helper.acypict');
        if ($pictureHelper->available()) {
            $picts[] = JHTML::_('select.option', "resized", JText::_('RESIZED'));
        }
        $picts[] = JHTML::_('select.option', "0", JText::_('JOOMEXT_NO'));
        $contenttype = array();
        $contenttype[] = JHTML::_('select.option', "title", JText::_('TITLE_ONLY'));
        $contenttype[] = JHTML::_('select.option', "intro", JText::_('INTRO_ONLY'));
        $contenttype[] = JHTML::_('select.option', "text", JText::_('FIELD_TEXT'));
        $contenttype[] = JHTML::_('select.option', "full", JText::_('FULL_TEXT'));
        $titlelink = array();
        $titlelink[] = JHTML::_('select.option', "link", JText::_('JOOMEXT_YES'));
        $titlelink[] = JHTML::_('select.option', "0", JText::_('JOOMEXT_NO'));
        $authorname = array();
        $authorname[] = JHTML::_('select.option', "author", JText::_('JOOMEXT_YES'));
        $authorname[] = JHTML::_('select.option', "0", JText::_('JOOMEXT_NO'));
        $searchFields = array('a.id', 'a.title', 'a.alias', 'a.created_by', 'b.name', 'b.username');
        if (!empty($pageInfo->search)) {
            $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\'';
            $filters[] = implode(" LIKE {$searchVal} OR ", $searchFields) . " LIKE {$searchVal}";
        }
        if (!empty($pageInfo->filter_cat)) {
            $filters[] = "a.catid = " . $pageInfo->filter_cat;
        }
        if ($this->params->get('displayart', 'all') == 'onlypub') {
            $filters[] = "a.state = 1";
        } else {
            $filters[] = "a.state != -2";
        }
        if (!$app->isAdmin()) {
            if (!ACYMAILING_J16) {
                $filters[] = 'a.`access` <= ' . (int) $my->get('aid');
            } else {
                $groups = implode(',', $my->getAuthorisedViewLevels());
                $filters[] = 'a.`access` IN (' . $groups . ')';
            }
        }
        if ($this->params->get('frontendaccess') == 'author' && !$app->isAdmin()) {
            $filters[] = "a.created_by = " . intval($my->id);
        }
        $whereQuery = '';
        if (!empty($filters)) {
            $whereQuery = ' WHERE (' . implode(') AND (', $filters) . ')';
        }
        $query = 'SELECT SQL_CALC_FOUND_ROWS a.*,b.name,b.username,a.created_by FROM ' . acymailing_table('content', false) . ' as a';
        $query .= ' LEFT JOIN `#__users` AS b ON b.id = a.created_by';
        if (!empty($whereQuery)) {
            $query .= $whereQuery;
        }
        if (!empty($pageInfo->filter->order->value)) {
            $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
        }
        $this->db->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
        $rows = $this->db->loadObjectList();
        if (!empty($pageInfo->search)) {
            $rows = acymailing_search($pageInfo->search, $rows);
        }
        $this->db->setQuery('SELECT FOUND_ROWS()');
        $pageInfo->elements->total = $this->db->loadResult();
        $pageInfo->elements->page = count($rows);
        if (!ACYMAILING_J16) {
            $query = 'SELECT a.id, a.id as catid, a.title as category, b.title as section, b.id as secid from #__categories as a ';
            $query .= 'INNER JOIN #__sections as b on a.section = b.id ORDER BY b.ordering,a.ordering';
            $this->db->setQuery($query);
            $categories = $this->db->loadObjectList('id');
            $categoriesValues = array();
            $categoriesValues[] = JHTML::_('select.option', '', JText::_('ACY_ALL'));
            $currentSec = '';
            foreach ($categories as $catid => $oneCategorie) {
                if ($currentSec != $oneCategorie->section) {
                    if (!empty($currentSec)) {
                        $this->values[] = JHTML::_('select.option', '</OPTGROUP>');
                    }
                    $categoriesValues[] = JHTML::_('select.option', '<OPTGROUP>', $oneCategorie->section);
                    $currentSec = $oneCategorie->section;
                }
                $categoriesValues[] = JHTML::_('select.option', $catid, $oneCategorie->category);
            }
        } else {
            $query = "SELECT * from #__categories WHERE `extension` = 'com_content' ORDER BY lft ASC";
            $this->db->setQuery($query);
            $categories = $this->db->loadObjectList('id');
            $categoriesValues = array();
            $categoriesValues[] = JHTML::_('select.option', '', JText::_('ACY_ALL'));
            foreach ($categories as $catid => $oneCategorie) {
                $categories[$catid]->title = str_repeat('- - ', $categories[$catid]->level) . $categories[$catid]->title;
                $categoriesValues[] = JHTML::_('select.option', $catid, $categories[$catid]->title);
            }
        }
        jimport('joomla.html.pagination');
        $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
        $tabs = acymailing_get('helper.acytabs');
        echo $tabs->startPane('joomlacontent_tab');
        echo $tabs->startPanel(JText::_('JOOMLA_CONTENT'), 'joomlacontent_content');
        ?>
		<script language="javascript" type="text/javascript">
			<!--
			var selectedContents = new Array();
			function applyContent(contentid, rowClass){
				var tmp = selectedContents.indexOf(contentid)
				if(tmp != -1){
					window.document.getElementById('content' + contentid).className = rowClass;
					delete selectedContents[tmp];
				}else{
					window.document.getElementById('content' + contentid).className = 'selectedrow';
					selectedContents.push(contentid);
				}
				updateTag();
			}

			function updateTag(){
				var tag = '';
				var otherinfo = '';
				for(var i = 0; i < document.adminForm.contenttype.length; i++){
					if(document.adminForm.contenttype[i].checked){
						selectedtype = document.adminForm.contenttype[i].value;
						otherinfo += '| type:' + document.adminForm.contenttype[i].value;
					}
				}
				for(var i = 0; i < document.adminForm.titlelink.length; i++){
					if(document.adminForm.titlelink[i].checked && document.adminForm.titlelink[i].value.length > 1){
						otherinfo += '| ' + document.adminForm.titlelink[i].value;
					}
				}
				if(selectedtype != 'title'){
					for(var i = 0; i < document.adminForm.author.length; i++){
						if(document.adminForm.author[i].checked && document.adminForm.author[i].value.length > 1){
							otherinfo += '| ' + document.adminForm.author[i].value;
						}
					}
					for(var i = 0; i < document.adminForm.pict.length; i++){
						if(document.adminForm.pict[i].checked){
							otherinfo += '| pict:' + document.adminForm.pict[i].value;
							if(document.adminForm.pict[i].value == 'resized'){
								document.getElementById('pictsize').style.display = '';
								if(document.adminForm.pictwidth.value) otherinfo += '| maxwidth:' + document.adminForm.pictwidth.value;
								if(document.adminForm.pictheight.value) otherinfo += '| maxheight:' + document.adminForm.pictheight.value;
							}else{
								document.getElementById('pictsize').style.display = 'none';
							}
						}
					}
					document.getElementById('format').style.display = '';
				}else{
					document.getElementById('format').style.display = 'none';
				}

				if(document.adminForm.contentformat && document.adminForm.contentformat.value){
					otherinfo += '| format:' + document.adminForm.contentformat.value;
				}

				if(window.document.getElementById('jflang') && window.document.getElementById('jflang').value != ''){
					otherinfo += '|lang:';
					otherinfo += window.document.getElementById('jflang').value;
				}

				for(var i in selectedContents){
					if(selectedContents[i] && !isNaN(i)){
						tag = tag + '{joomlacontent:' + selectedContents[i] + otherinfo + '}<br />';
					}
				}
				setTag(tag);
			}
			//-->
		</script>
		<div class="onelineblockoptions">
			<table width="100%" class="acymailing_table">
				<tr>
					<td>
						<?php 
        echo JText::_('DISPLAY');
        ?>
					</td>
					<td colspan="2">
						<?php 
        echo JHTML::_('acyselect.radiolist', $contenttype, 'contenttype', 'size="1" onclick="updateTag();"', 'value', 'text', $pageInfo->contenttype);
        ?>
					</td>
					<td>
						<?php 
        $jflanguages = acymailing_get('type.jflanguages');
        $jflanguages->onclick = 'onchange="updateTag();"';
        echo $jflanguages->display('lang', $pageInfo->lang);
        ?>
					</td>
				</tr>
				<tr id="format" class="acyplugformat">
					<td valign="top">
						<?php 
        echo JText::_('FORMAT');
        ?>
					</td>
					<td valign="top">
						<?php 
        echo $this->acypluginsHelper->getFormatOption('tagcontent');
        ?>
					</td>
					<td valign="top"><?php 
        echo JText::_('DISPLAY_PICTURES');
        ?>
</td>
					<td valign="top"><?php 
        echo JHTML::_('acyselect.radiolist', $picts, 'pict', 'size="1" onclick="updateTag();"', 'value', 'text', $pageInfo->pict);
        ?>
						<span id="pictsize" <?php 
        if ($pageInfo->pict != 'resized') {
            echo 'style="display:none;"';
        }
        ?>
><br/><?php 
        echo JText::_('CAPTCHA_WIDTH');
        ?>
							<input name="pictwidth" type="text" onchange="updateTag();" value="<?php 
        echo $pageInfo->pictwidth;
        ?>
" style="width:30px;"/>
							x <?php 
        echo JText::_('CAPTCHA_HEIGHT');
        ?>
							<input name="pictheight" type="text" onchange="updateTag();" value="<?php 
        echo $pageInfo->pictheight;
        ?>
" style="width:30px;"/>
						</span>
					</td>
				</tr>
				<tr>
					<td>
						<?php 
        echo JText::_('CLICKABLE_TITLE');
        ?>
					</td>
					<td>
						<?php 
        echo JHTML::_('acyselect.radiolist', $titlelink, 'titlelink', 'size="1" onclick="updateTag();"', 'value', 'text', $pageInfo->titlelink);
        ?>
					</td>
					<td>
						<?php 
        echo JText::_('AUTHOR_NAME');
        ?>
					</td>
					<td>
						<?php 
        echo JHTML::_('acyselect.radiolist', $authorname, 'author', 'size="1" onclick="updateTag();"', 'value', 'text', (string) $pageInfo->author);
        ?>
					</td>
				</tr>
			</table>
		</div>
		<div class="onelineblockoptions">
			<table>
				<tr>
					<td width="100%">
						<?php 
        acymailing_listingsearch($pageInfo->search);
        ?>
					</td>
					<td nowrap="nowrap">
						<?php 
        echo JHTML::_('select.genericlist', $categoriesValues, 'filter_cat', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', (int) $pageInfo->filter_cat);
        ?>
					</td>
				</tr>
			</table>

			<table class="acymailing_table" cellpadding="1" width="100%">
				<thead>
				<tr>
					<th class="title">
					</th>
					<th class="title">
						<?php 
        echo JHTML::_('grid.sort', JText::_('FIELD_TITLE'), 'a.title', $pageInfo->filter->order->dir, $pageInfo->filter->order->value);
        ?>
					</th>
					<th class="title">
						<?php 
        echo JHTML::_('grid.sort', JText::_('ACY_AUTHOR'), 'b.name', $pageInfo->filter->order->dir, $pageInfo->filter->order->value);
        ?>
					</th>
					<th class="title">
						<?php 
        echo JHTML::_('grid.sort', JText::_(ACYMAILING_J16 ? 'COM_CONTENT_PUBLISHED_DATE' : 'START PUBLISHING'), 'a.publish_up', $pageInfo->filter->order->dir, $pageInfo->filter->order->value);
        ?>
					</th>
					<th class="title">
						<?php 
        echo JHTML::_('grid.sort', JText::_('ACY_CREATED'), 'a.created', $pageInfo->filter->order->dir, $pageInfo->filter->order->value);
        ?>
					</th>
					<th class="title titleid">
						<?php 
        echo JHTML::_('grid.sort', JText::_('ACY_ID'), 'a.id', $pageInfo->filter->order->dir, $pageInfo->filter->order->value);
        ?>
					</th>
				</tr>
				</thead>
				<tfoot>
				<tr>
					<td colspan="6">
						<?php 
        echo $pagination->getListFooter();
        ?>
						<?php 
        echo $pagination->getResultsCounter();
        ?>
					</td>
				</tr>
				</tfoot>
				<tbody>
				<?php 
        $k = 0;
        for ($i = 0, $a = count($rows); $i < $a; $i++) {
            $row =& $rows[$i];
            ?>
					<tr id="content<?php 
            echo $row->id;
            ?>
" class="<?php 
            echo "row{$k}";
            ?>
" onclick="applyContent(<?php 
            echo $row->id . ",'row{$k}'";
            ?>
);" style="cursor:pointer;">
						<td class="acytdcheckbox"></td>
						<td>
							<?php 
            $text = '<b>' . JText::_('JOOMEXT_ALIAS') . ': </b>' . $row->alias;
            echo acymailing_tooltip($text, $row->title, '', $row->title);
            ?>
						</td>
						<td>
							<?php 
            if (!empty($row->name)) {
                $text = '<b>' . JText::_('JOOMEXT_NAME') . ' : </b>' . $row->name;
                $text .= '<br /><b>' . JText::_('ACY_USERNAME') . ' : </b>' . $row->username;
                $text .= '<br /><b>' . JText::_('ACY_ID') . ' : </b>' . $row->created_by;
                echo acymailing_tooltip($text, $row->name, '', $row->name);
            }
            ?>
						</td>
						<td align="center">
							<?php 
            echo JHTML::_('date', strip_tags($row->publish_up), JText::_('DATE_FORMAT_LC4'));
            ?>
						</td>
						<td align="center">
							<?php 
            echo JHTML::_('date', strip_tags($row->created), JText::_('DATE_FORMAT_LC4'));
            ?>
						</td>
						<td align="center">
							<?php 
            echo $row->id;
            ?>
						</td>
					</tr>
					<?php 
            $k = 1 - $k;
        }
        ?>
				</tbody>
			</table>
		</div>
		<input type="hidden" name="boxchecked" value="0"/>
		<input type="hidden" name="filter_order" value="<?php 
        echo $pageInfo->filter->order->value;
        ?>
"/>
		<input type="hidden" name="filter_order_Dir" value="<?php 
        echo $pageInfo->filter->order->dir;
        ?>
"/>
		<?php 
        echo $tabs->endPanel();
        echo $tabs->startPanel(JText::_('TAG_CATEGORIES'), 'joomlacontent_auto');
        $type = JRequest::getString('type');
        ?>
		<script language="javascript" type="text/javascript">
			<!--
			window.onload = function(){
				if(window.document.getElementById('tagsauto')){
					window.document.getElementById('tagsauto').onchange = updateAutoTag;
				}
			}
			var selectedCategories = new Array();
			<?php 
        if (!ACYMAILING_J16) {
            ?>
			function applyAutoContent(secid, catid, rowClass){
				if(selectedCategories[secid] && selectedCategories[secid][catid]){
					window.document.getElementById('content_sec' + secid + '_cat' + catid).className = rowClass;
					delete selectedCategories[secid][catid];
				}else{
					if(!selectedCategories[secid]) selectedCategories[secid] = new Array();
					if(secid == 0){
						for(var isec in selectedCategories){
							for(var icat in selectedCategories[isec]){
								if(selectedCategories[isec][icat] == 'content'){
									window.document.getElementById('content_sec' + isec + '_cat' + icat).className = 'row0';
									delete selectedCategories[isec][icat];
								}
							}
						}
					}else{
						if(selectedCategories[0] && selectedCategories[0][0]){
							window.document.getElementById('content_sec0_cat0').className = 'row0';
							delete selectedCategories[0][0];
						}

						if(catid == 0){
							for(var icat in selectedCategories[secid]){
								if(selectedCategories[secid][icat] == 'content'){
									window.document.getElementById('content_sec' + secid + '_cat' + icat).className = 'row0';
									delete selectedCategories[secid][icat];
								}
							}
						}else{
							if(selectedCategories[secid][0]){
								window.document.getElementById('content_sec' + secid + '_cat0').className = 'row0';
								delete selectedCategories[secid][0];
							}
						}
					}

					window.document.getElementById('content_sec' + secid + '_cat' + catid).className = 'selectedrow';
					selectedCategories[secid][catid] = 'content';
				}

				updateAutoTag();
			}
			<?php 
        } else {
            ?>
			function applyAutoContent(catid, rowClass){
				if(selectedCategories[catid]){
					window.document.getElementById('content_cat' + catid).className = rowClass;
					delete selectedCategories[catid];
				}else{
					window.document.getElementById('content_cat' + catid).className = 'selectedrow';
					selectedCategories[catid] = 'content';
				}

				updateAutoTag();
			}
			<?php 
        }
        ?>

			function updateAutoTag(){
				tag = '{autocontent:';
				<?php 
        if (!ACYMAILING_J16) {
            ?>
				for(var isec in selectedCategories){
					for(var icat in selectedCategories[isec]){
						if(selectedCategories[isec][icat] == 'content'){
							if(icat != 0){
								tag += 'cat' + icat + '-';
							}else{
								tag += 'sec' + isec + '-';
							}
						}
					}
				}
				<?php 
        } else {
            ?>
				for(var icat in selectedCategories){
					if(selectedCategories[icat] == 'content'){
						tag += icat + '-';
					}
				}
				<?php 
        }
        ?>

				if(document.adminForm.min_article && document.adminForm.min_article.value && document.adminForm.min_article.value != 0){
					tag += '| min:' + document.adminForm.min_article.value;
				}
				if(document.adminForm.max_article.value && document.adminForm.max_article.value != 0){
					tag += '| max:' + document.adminForm.max_article.value;
				}
				if(document.adminForm.contentorder.value){
					tag += "| order:" + document.adminForm.contentorder.value + "," + document.adminForm.contentorderdir.value;
				}
				if(document.adminForm.contentfilter && document.adminForm.contentfilter.value){
					tag += document.adminForm.contentfilter.value;
				}
				if(document.adminForm.meta_article && document.adminForm.meta_article.value){
					tag += '| meta:' + document.adminForm.meta_article.value;
				}

				for(var i = 0; i < document.adminForm.contenttypeauto.length; i++){
					if(document.adminForm.contenttypeauto[i].checked){
						selectedtype = document.adminForm.contenttypeauto[i].value;
						tag += '| type:' + document.adminForm.contenttypeauto[i].value;
					}
				}

				for(var i = 0; i < document.adminForm.titlelinkauto.length; i++){
					if(document.adminForm.titlelinkauto[i].checked && document.adminForm.titlelinkauto[i].value.length > 1){
						tag += '|' + document.adminForm.titlelinkauto[i].value;
					}
				}
				if(selectedtype != 'title'){
					for(var i = 0; i < document.adminForm.authorauto.length; i++){
						if(document.adminForm.authorauto[i].checked && document.adminForm.authorauto[i].value.length > 1){
							tag += '|' + document.adminForm.authorauto[i].value;
						}
					}
					for(var i = 0; i < document.adminForm.pictauto.length; i++){
						if(document.adminForm.pictauto[i].checked){
							tag += '| pict:' + document.adminForm.pictauto[i].value;
							if(document.adminForm.pictauto[i].value == 'resized'){
								document.getElementById('pictsizeauto').style.display = '';
								if(document.adminForm.pictwidthauto.value) tag += '| maxwidth:' + document.adminForm.pictwidthauto.value;
								if(document.adminForm.pictheightauto.value) tag += '| maxheight:' + document.adminForm.pictheightauto.value;
							}else{
								document.getElementById('pictsizeauto').style.display = 'none';
							}
						}
					}
					document.getElementById('formatauto').style.display = '';
				}else{
					document.getElementById('formatauto').style.display = 'none';
				}

				if(document.getElementById('contentformatautoinvert').value == 1) tag += '| invert';
				if(document.adminForm.contentformatauto && document.adminForm.contentformatauto.value){
					tag += '| format:' + document.adminForm.contentformatauto.value;
				}

				if(document.adminForm.cols && document.adminForm.cols.value > 1){
					tag += '| cols:' + document.adminForm.cols.value;
				}
				if(window.document.getElementById('jflangauto') && window.document.getElementById('jflangauto').value != ''){
					tag += '| lang:' + window.document.getElementById('jflangauto').value;
				}
				if(window.document.getElementById('jlang') && window.document.getElementById('jlang').value != ''){
					tag += '| language:';
					tag += window.document.getElementById('jlang').value;
				}

				if(window.document.getElementById('tagsauto')){
					var tmp = 0;
					for(var i = 0; i < window.document.getElementById('tagsauto').length; i++){
						if(window.document.getElementById('tagsauto')[i].selected){
							if(tmp == 0){
								tag += '| tags:' + window.document.getElementById('tagsauto')[i].value;
								tmp = 1;
							}else{
								tag += ',' + window.document.getElementById('tagsauto')[i].value;
							}
						}
					}
				}

				tag += '}';

				setTag(tag);
			}
			//-->
		</script>
		<div class="onelineblockoptions">
			<table width="100%" class="acymailing_table">
				<tr>
					<td>
						<?php 
        echo JText::_('DISPLAY');
        ?>
					</td>
					<td colspan="2">
						<?php 
        echo JHTML::_('acyselect.radiolist', $contenttype, 'contenttypeauto', 'size="1" onclick="updateAutoTag();"', 'value', 'text', $this->params->get('default_type', 'intro'));
        ?>
					</td>
					<td id="languagesauto">
						<?php 
        $jflanguages = acymailing_get('type.jflanguages');
        $jflanguages->onclick = 'onchange="updateAutoTag();"';
        $jflanguages->id = 'jflangauto';
        echo $jflanguages->display('langauto');
        if (empty($jflanguages->found)) {
            echo $jflanguages->displayJLanguages('jlangauto');
        }
        ?>
					</td>
				</tr>
				<tr id="formatauto" class="acyplugformat">
					<td valign="top">
						<?php 
        echo JText::_('FORMAT');
        ?>
					</td>
					<td valign="top">
						<?php 
        echo $this->acypluginsHelper->getFormatOption('tagcontent', 'TOP_LEFT', false, 'updateAutoTag');
        ?>
					</td>
					<td valign="top"><?php 
        echo JText::_('DISPLAY_PICTURES');
        ?>
</td>
					<td valign="top"><?php 
        echo JHTML::_('acyselect.radiolist', $picts, 'pictauto', 'size="1" onclick="updateAutoTag();"', 'value', 'text', $this->params->get('default_pict', '1'));
        ?>
						<span id="pictsizeauto" <?php 
        if ($this->params->get('default_pict', '1') != 'resized') {
            echo 'style="display:none;"';
        }
        ?>
 ><br/><?php 
        echo JText::_('CAPTCHA_WIDTH');
        ?>
							<input name="pictwidthauto" type="text" onchange="updateAutoTag();" value="<?php 
        echo $this->params->get('maxwidth', '150');
        ?>
" style="width:30px;"/>
							x <?php 
        echo JText::_('CAPTCHA_HEIGHT');
        ?>
							<input name="pictheightauto" type="text" onchange="updateAutoTag();" value="<?php 
        echo $this->params->get('maxheight', '150');
        ?>
" style="width:30px;"/>
						</span>
					</td>
				</tr>
				<tr>
					<td>
						<?php 
        echo JText::_('CLICKABLE_TITLE');
        ?>
					</td>
					<td>
						<?php 
        echo JHTML::_('acyselect.radiolist', $titlelink, 'titlelinkauto', 'size="1" onclick="updateAutoTag();"', 'value', 'text', $this->params->get('default_titlelink', 'link'));
        ?>
					</td>
					<td>
						<?php 
        echo JText::_('AUTHOR_NAME');
        ?>
					</td>
					<td>
						<?php 
        echo JHTML::_('acyselect.radiolist', $authorname, 'authorauto', 'size="1" onclick="updateAutoTag();"', 'value', 'text', (string) $this->params->get('default_author', '0'));
        ?>
					</td>
				</tr>
				<tr>
					<?php 
        if (version_compare(JVERSION, '3.1.0', '>=')) {
            ?>
						<td valign="top">
							<?php 
            echo JText::_('TAGS');
            ?>
						</td>
						<td>
							<?php 
            $form = JForm::getInstance('acytagcontenttags', JPATH_SITE . DS . 'components' . DS . 'com_acymailing' . DS . 'params' . DS . 'tagcontenttags.xml');
            foreach ($form->getFieldset('tagcontenttagfield') as $field) {
                echo $field->input;
            }
            ?>
						</td>
					<?php 
        } else {
            ?>
						<td colspan="2"></td>
					<?php 
        }
        ?>
					<td valign="top"><?php 
        echo JText::_('FIELD_COLUMNS');
        ?>
</td>
					<td valign="top">
						<select name="cols" style="width:150px" onchange="updateAutoTag();" size="1">
							<?php 
        for ($o = 1; $o < 11; $o++) {
            echo '<option value="' . $o . '">' . $o . '</option>';
        }
        ?>
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<?php 
        echo JText::_('MAX_ARTICLE');
        ?>
					</td>
					<td>
						<input type="text" name="max_article" style="width:50px" value="20" onchange="updateAutoTag();"/>
					</td>
					<td>
						<?php 
        echo JText::_('ACY_ORDER');
        ?>
					</td>
					<td>
						<?php 
        $values = array('id' => 'ACY_ID', 'ordering' => 'ACY_ORDERING', 'created' => 'CREATED_DATE', 'modified' => 'MODIFIED_DATE', 'title' => 'FIELD_TITLE');
        echo $this->acypluginsHelper->getOrderingField($values, 'id', 'DESC', 'updateAutoTag');
        ?>
					</td>
				</tr>
				<?php 
        if ($this->params->get('metaselect')) {
            ?>
					<tr>
						<td>
							<?php 
            echo JText::_('META_KEYWORDS');
            ?>
						</td>
						<td colspan="3">
							<input type="text" name="meta_article" style="width:200px" value="" onchange="updateAutoTag();"/>
						</td>
					</tr>
				<?php 
        }
        ?>
				<?php 
        if ($type == 'autonews') {
            ?>
					<tr>
						<td>
							<?php 
            echo JText::_('MIN_ARTICLE');
            ?>
						</td>
						<td>
							<input type="text" name="min_article" style="width:50px" value="1" onchange="updateAutoTag();"/>
						</td>
						<td>
							<?php 
            echo JText::_('JOOMEXT_FILTER');
            ?>
						</td>
						<td>
							<?php 
            $filter = acymailing_get('type.contentfilter');
            $filter->onclick = "updateAutoTag();";
            echo $filter->display('contentfilter', '|filter:created');
            ?>
						</td>
					</tr>
				<?php 
        }
        ?>
			</table>
		</div>

		<div class="onelineblockoptions">
			<table class="acymailing_table" cellpadding="1" width="100%">
				<thead>
				<tr>
					<th class="title"></th>
					<?php 
        if (!ACYMAILING_J16) {
            ?>
						<th class="title">
							<?php 
            echo JText::_('SECTION');
            ?>
						</th>
					<?php 
        }
        ?>
					<th class="title">
						<?php 
        echo JText::_('TAG_CATEGORIES');
        ?>
					</th>
				</tr>
				</thead>
				<tbody>
				<?php 
        $k = 0;
        if (!ACYMAILING_J16) {
            ?>
					<tr id="content_sec0_cat0" class="<?php 
            echo "row{$k}";
            ?>
" onclick="applyAutoContent(0,0,'<?php 
            echo "row{$k}";
            ?>
');" style="cursor:pointer;">
						<td class="acytdcheckbox"></td>
						<td style="font-weight: bold;">
							<?php 
            echo JText::_('ACY_ALL');
            ?>
						</td>
						<td style="text-align:center;font-weight: bold;">
							<?php 
            echo JText::_('ACY_ALL');
            ?>
						</td>
					</tr>

				<?php 
        }
        $k = 1 - $k;
        $currentSection = '';
        foreach ($categories as $row) {
            if (!ACYMAILING_J16 && $currentSection != $row->section) {
                ?>
						<tr id="content_sec<?php 
                echo $row->secid;
                ?>
_cat0" class="<?php 
                echo "row{$k}";
                ?>
" onclick="applyAutoContent(<?php 
                echo $row->secid;
                ?>
,0,'<?php 
                echo "row{$k}";
                ?>
');" style="cursor:pointer;">
							<td class="acytdcheckbox"></td>
							<td style="font-weight: bold;">
								<?php 
                echo $row->section;
                ?>
							</td>
							<td style="text-align:center;font-weight: bold;">
								<?php 
                echo JText::_('ACY_ALL');
                ?>
							</td>
						</tr>
						<?php 
                $k = 1 - $k;
                $currentSection = $row->section;
            }
            if (!ACYMAILING_J16) {
                ?>
						<tr id="content_sec<?php 
                echo $row->secid;
                ?>
_cat<?php 
                echo $row->catid;
                ?>
" class="<?php 
                echo "row{$k}";
                ?>
" onclick="applyAutoContent(<?php 
                echo $row->secid;
                ?>
,<?php 
                echo $row->catid;
                ?>
,'<?php 
                echo "row{$k}";
                ?>
');" style="cursor:pointer;">
							<td class="acytdcheckbox"></td>
							<td>
							</td>
							<td>
								<?php 
                echo $row->category;
                ?>
							</td>
						</tr>
					<?php 
            } else {
                ?>
						<tr id="content_cat<?php 
                echo $row->id;
                ?>
" class="<?php 
                echo "row{$k}";
                ?>
" onclick="applyAutoContent(<?php 
                echo $row->id;
                ?>
,'<?php 
                echo "row{$k}";
                ?>
');" style="cursor:pointer;">
							<td class="acytdcheckbox"></td>
							<td>
								<?php 
                echo $row->title;
                ?>
							</td>
						</tr>
					<?php 
            }
            $k = 1 - $k;
        }
        ?>
				</tbody>
			</table>
		</div>
		<?php 
        echo $tabs->endPanel();
        echo $tabs->endPane();
    }
Пример #7
0
    function acymailinghikashop_show()
    {
        $config = acymailing_config();
        if ($config->get('version') < '4.9.4') {
            acymailing_display('Please download and install the latest AcyMailing version otherwise this plugin will NOT work', 'error');
            return;
        }
        if (!$this->loadAcymailing()) {
            return 'Please install HikaShop before using the HikaShop tag plugin';
        }
        $app = JFactory::getApplication();
        $contentType = array();
        $contentType[] = JHTML::_('select.option', "title", JText::_('TITLE_ONLY'));
        $contentType[] = JHTML::_('select.option', "intro", JText::_('INTRO_ONLY'));
        $contentType[] = JHTML::_('select.option', "full", JText::_('FULL_TEXT'));
        $priceDisplay = array();
        $priceDisplay[] = JHTML::_('select.option', "full", JText::_('APPLY_DISCOUNTS'));
        $priceDisplay[] = JHTML::_('select.option', "no_discount", JText::_('NO_DISCOUNT'));
        $priceDisplay[] = JHTML::_('select.option', "none", JText::_('HIKASHOP_NO'));
        $pageInfo = new stdClass();
        $pageInfo->filter = new stdClass();
        $pageInfo->filter->order = new stdClass();
        $pageInfo->limit = new stdClass();
        $paramBase = ACYMAILING_COMPONENT . '.hikashop';
        $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.product_id', 'cmd');
        $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
        if (strtolower($pageInfo->filter->order->dir) !== 'desc') {
            $pageInfo->filter->order->dir = 'asc';
        }
        $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
        $pageInfo->search = JString::strtolower(trim($pageInfo->search));
        $pageInfo->lang = $app->getUserStateFromRequest($paramBase . ".lang", 'lang', '', 'string');
        $pageInfo->contenttype = $app->getUserStateFromRequest($paramBase . ".contenttype", 'contenttype', 'full', 'string');
        $pageInfo->pricedisplay = $app->getUserStateFromRequest($paramBase . ".pricedisplay", 'pricedisplay', 'full', 'string');
        $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
        $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
        if (!empty($pageInfo->search)) {
            $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search) . '%\'';
            $filters[] = "a.product_id LIKE {$searchVal} OR a.product_description LIKE {$searchVal} OR a.product_name LIKE {$searchVal} OR a.product_code LIKE {$searchVal}";
        }
        $whereQuery = '';
        if (!empty($filters)) {
            $whereQuery = ' WHERE (' . implode(') AND (', $filters) . ')';
        }
        $query = 'SELECT SQL_CALC_FOUND_ROWS a.* FROM ' . acymailing_table('hikashop_product', false) . ' as a';
        if (!empty($whereQuery)) {
            $query .= $whereQuery;
        }
        if (!empty($pageInfo->filter->order->value)) {
            $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
        }
        $this->db->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
        $rows = $this->db->loadObjectList();
        if (!empty($pageInfo->search)) {
            $rows = acymailing_search($pageInfo->search, $rows);
        }
        $this->db->setQuery('SELECT FOUND_ROWS()');
        $pageInfo->elements = new stdClass();
        $pageInfo->elements->total = $this->db->loadResult();
        $pageInfo->elements->page = count($rows);
        jimport('joomla.html.pagination');
        $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
        $tabs = acymailing_get('helper.acytabs');
        echo $tabs->startPane('hikashop_tab');
        echo $tabs->startPanel(JText::_('PRODUCTS'), 'hikashop_product');
        ?>
		<script language="javascript" type="text/javascript">
		<!--
			function updateTagProd(productid){
				var tag = '{hikashop_product:'+productid;
				for(var i=0; i < document.adminForm.contenttype.length; i++){
					 if (document.adminForm.contenttype[i].checked){ tag += '|type:'+document.adminForm.contenttype[i].value; }
				}
				for(i=0; i < document.adminForm.pricedisplay.length; i++){
					 if (document.adminForm.pricedisplay[i].checked){ tag += '|price:'+document.adminForm.pricedisplay[i].value; }
				}
				if(window.document.getElementById('jflang')  && window.document.getElementById('jflang').value != ''){
					tag += '|lang:';
					tag += window.document.getElementById('jflang').value;
				}
				tag += '}';
				setTag(tag);
				insertTag();
			}
		//-->
		</script>
		<table>
			<tr>
				<td width="100%">
					<?php 
        echo JText::_('JOOMEXT_FILTER');
        ?>
:
					<input type="text" name="search" id="acymailingsearch" value="<?php 
        echo $pageInfo->search;
        ?>
" class="text_area" onchange="document.adminForm.submit();" />
					<button class="btn" onclick="this.form.submit();"><?php 
        echo JText::_('JOOMEXT_GO');
        ?>
</button>
					<button class="btn" onclick="document.getElementById('acymailingsearch').value='';this.form.submit();"><?php 
        echo JText::_('JOOMEXT_RESET');
        ?>
</button>
				</td>
			</tr>
		</table>
		<table width="100%" class="adminform">
			<tr>
				<td>
					<?php 
        echo JText::_('DISPLAY');
        ?>
				</td>
				<td>
				<?php 
        echo JHTML::_('acyselect.radiolist', $contentType, 'contenttype', 'size="1"', 'value', 'text', $pageInfo->contenttype);
        ?>
				</td>
				<td>
					<?php 
        $jflanguages = acymailing_get('type.jflanguages');
        echo $jflanguages->display('lang', $pageInfo->lang);
        ?>
				</td>
			</tr>
			<tr>
				<td>
					<?php 
        echo JText::_('PRICE');
        ?>
				</td>
				<td colspan="2">
				<?php 
        echo JHTML::_('acyselect.radiolist', $priceDisplay, 'pricedisplay', 'size="1"', 'value', 'text', $pageInfo->pricedisplay);
        ?>
				</td>
			</tr>
		</table>
		<table class="adminlist table table-striped" cellpadding="1" width="100%">
			<thead>
				<tr>
					<th></th>
					<th class="title">
						<?php 
        echo JHTML::_('grid.sort', JText::_('HIKA_NAME'), 'a.product_name', $pageInfo->filter->order->dir, $pageInfo->filter->order->value);
        ?>
					</th>
					<th class="title">
						<?php 
        echo JHTML::_('grid.sort', JText::_('HIKA_DESCRIPTION'), 'a.product_description', $pageInfo->filter->order->dir, $pageInfo->filter->order->value);
        ?>
					</th>
					<th class="title titleid">
						<?php 
        echo JHTML::_('grid.sort', JText::_('ID'), 'a.product_id', $pageInfo->filter->order->dir, $pageInfo->filter->order->value);
        ?>
					</th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="4">
						<?php 
        echo $pagination->getListFooter();
        ?>
						<?php 
        echo $pagination->getResultsCounter();
        ?>
					</td>
				</tr>
			</tfoot>
			<tbody>
				<?php 
        $k = 0;
        for ($i = 0, $a = count($rows); $i < $a; $i++) {
            $row =& $rows[$i];
            ?>
					<tr id="content<?php 
            echo $row->product_id;
            ?>
" class="<?php 
            echo "row{$k}";
            ?>
" onclick="updateTagProd(<?php 
            echo $row->product_id;
            ?>
);" style="cursor:pointer;">
						<td class="acytdcheckbox"></td>
						<td>
						<?php 
            echo acymailing_tooltip('CODE : ' . $row->product_code, $row->product_name, '', $row->product_name);
            ?>
						</td>
						<td>
						<?php 
            echo $row->product_description;
            ?>
						</td>
						<td align="center">
							<?php 
            echo $row->product_id;
            ?>
						</td>
					</tr>
				<?php 
            $k = 1 - $k;
        }
        ?>
			</tbody>
		</table>
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="filter_order" value="<?php 
        echo $pageInfo->filter->order->value;
        ?>
" />
		<input type="hidden" name="filter_order_Dir" value="<?php 
        echo $pageInfo->filter->order->dir;
        ?>
" />
	<?php 
        echo $tabs->endPanel();
        echo $tabs->startPanel(JText::_('HIKA_CATEGORIES'), 'hikashop_auto');
        $type = JRequest::getString('type');
        $this->db->setQuery('SELECT * FROM ' . acymailing_table('hikashop_category', false) . ' WHERE category_type=\'product\' ORDER BY `category_ordering` ASC');
        $categories = $this->db->loadObjectList('category_id');
        $this->cats = array();
        foreach ($categories as $oneCat) {
            $this->cats[$oneCat->category_parent_id][] = $oneCat;
        }
        $catClass = hikashop_get('class.category');
        $root = $catClass->getRoot();
        ?>
	<script language="javascript" type="text/javascript">
		<!--
			var selectedCat = new Array();
			function applyAutoProduct(catid,rowClass){
				if(catid == 'all'){
					if(window.document.getElementById('product_cat'+catid).className == 'selectedrow'){
						window.document.getElementById('product_catall').className = rowClass;
					}else{
						window.document.getElementById('product_cat'+catid).className = 'selectedrow';
						for(var key in selectedCat)
						{
							if(!isNaN(key))
							{
								window.document.getElementById('product_cat'+key).className = rowClass;
								delete selectedCat[key];
							}
						}
					}
				}else{
					window.document.getElementById('product_catall').className = 'row0';
					if(selectedCat[catid]){
						window.document.getElementById('product_cat'+catid).className = rowClass;
						delete selectedCat[catid];
					}else{
						window.document.getElementById('product_cat'+catid).className = 'selectedrow';
						selectedCat[catid] = 'product';
					}
				}
				updateTagAuto();
			}

			function updateTagAuto(){
				var tag = '{hikashop_auto_product:';
				for(var icat in selectedCat){
					if(selectedCat[icat] == 'product'){
						tag += icat+'-';
					}
				}
				for(var i=0; i < document.adminForm.contenttypeauto.length; i++){
					 if (document.adminForm.contenttypeauto[i].checked){ tag += '| type:'+document.adminForm.contenttypeauto[i].value; }
				}


				if(document.adminForm.min_article && document.adminForm.min_article.value && document.adminForm.min_article.value!=0){ tag += '| min:'+document.adminForm.min_article.value; }
				if(document.adminForm.max_article.value && document.adminForm.max_article.value!=0){ tag += '| max:'+document.adminForm.max_article.value; }
				if(document.adminForm.contentorder.value){ tag += "| order:"+document.adminForm.contentorder.value+","+document.adminForm.contentorderdir.value; }
				if(document.adminForm.contentfilter && document.adminForm.contentfilter.value){ tag += '| filter:'+document.adminForm.contentfilter.value; }
				if(window.document.getElementById('jflang_auto') && window.document.getElementById('jflang_auto').value != ''){
					tag += '| lang:'+window.document.getElementById('jflang_auto').value;
				}
				for(i=0; i < document.adminForm.pricedisplayauto.length; i++){
					 if (document.adminForm.pricedisplayauto[i].checked){ tag += '| price:'+document.adminForm.pricedisplayauto[i].value; }
				}

				tag += '}';
				setTag(tag);
			}
		//-->
	</script>
	<table width="100%" class="adminform">
		<tr>
			<td>
				<?php 
        echo JText::_('DISPLAY');
        ?>
			</td>
			<td colspan="2">
			<?php 
        echo JHTML::_('acyselect.radiolist', $contentType, 'contenttypeauto', 'size="1" onclick="updateTagAuto();"', 'value', 'text', 'full');
        ?>
			</td>
			<td>
				<?php 
        $jflanguages = acymailing_get('type.jflanguages');
        if (!empty($jflanguages->values)) {
            $jflanguages->id = 'jflang_auto';
            $jflanguages->onclick = 'onchange="updateTagAuto();"';
            echo $jflanguages->display('language');
        }
        ?>
			</td>
		</tr>
		<tr>
			<td>
				<?php 
        echo JText::_('PRICE');
        ?>
			</td>
			<td colspan="3">
			<?php 
        echo JHTML::_('acyselect.radiolist', $priceDisplay, 'pricedisplayauto', 'size="1" onclick="updateTagAuto();"', 'value', 'text', 'full');
        ?>
			</td>
		</tr>
		<tr>
			<td>
				<label for="max_article"><?php 
        echo JText::_('MAX_ARTICLE');
        ?>
</label>
			</td>
			<td>
			 	<input type="text" name="max_article" id="max_article" style="width:50px" value="" onchange="updateTagAuto();"/>
			</td>
			<td>
				<?php 
        echo JText::_('ACY_ORDER');
        ?>
			</td>
			<td>
				<?php 
        $values = array('product_id' => 'ACY_ID', 'product_created' => 'CREATED_DATE', 'product_modified' => 'MODIFIED_DATE', 'product_name' => 'HIKA_TITLE');
        echo $this->acypluginsHelper->getOrderingField($values, 'product_id', 'DESC');
        ?>
			</td>
		</tr>
		<?php 
        if ($type == 'autonews') {
            ?>
		<tr>
			<td>
				<label for="min_article"><?php 
            echo JText::_('MIN_ARTICLE');
            ?>
</label>
			</td>
			<td>
				<input type="text" name="min_article" id="min_article" style="width:50px" value="1" onchange="updateTagAuto();"/>
			</td>
			<td>
				<?php 
            echo JText::_('FILTER');
            ?>
			</td>
			<td>
			 	<?php 
            $filter = acymailing_get('type.contentfilter');
            $filter->onclick = 'updateTagAuto();';
            echo $filter->display('contentfilter', 'created', false);
            ?>
			</td>
		</tr>
		<?php 
        }
        ?>
	</table>
	<table class="adminlist table table-striped" cellpadding="1" width="100%">
		<tr id="product_catall" class="<?php 
        echo "row0";
        ?>
" onclick="applyAutoProduct('all','<?php 
        echo "row{$k}";
        ?>
');" style="cursor:pointer;">
			<td class="acytdcheckbox"></td>
			<td><?php 
        echo JText::_('ACY_ALL');
        ?>
</td>
		</tr>
	<?php 
        $k = 0;
        echo $this->displayChildren($root, $k);
        ?>
	</table>
	<?php 
        echo $tabs->endPanel();
        echo $tabs->startPanel(JText::_('COUPONS'), 'hikashop_coupon');
        $currency = hikashop_get('type.currency');
        $config =& hikashop_config();
        ?>
		<script language="javascript" type="text/javascript">
		<!--
			function updateTag(){
				var tagname = document.adminForm.minimum_order.value+'|';
				tagname += document.adminForm.quota.value+'|';
				tagname += document.adminForm.start.value+'|';
				tagname += document.adminForm.end.value+'|';
				tagname += document.adminForm.percent_amount.value+'|';
				tagname += document.adminForm.flat_amount.value+'|';
				tagname += document.adminForm.currency_id.value+'|';
				tagname += document.adminForm.coupon_code.value+'|';
				tagname += document.adminForm.product_id.value;
				setTag('{hikashop_coupon:'+tagname+'}');
			}
		//-->
		</script>
		<table class="admintable" width="700px" style="margin:auto">
			<tr>
				<td>
					<table class="admintable" style="margin:auto">
						<tr>
							<td class="key">
								<label for="coupon_code">
									<?php 
        echo JText::_('DISCOUNT_CODE');
        ?>
								</label>
							</td>
							<td>
								<input type="text" id="coupon_code" onchange="updateTag();" value="[name][key][value]" />
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="flat_amount">
									<?php 
        echo JText::_('DISCOUNT_FLAT_AMOUNT');
        ?>
								</label>
							</td>
							<td>
								<input style="width:50px;" type="text" id="flat_amount" onchange="updateTag();" value="0" /><?php 
        echo $currency->display('currency_id', (int) $config->get('main_currency'), ' style="width:100px;" ');
        ?>
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="percent_amount">
									<?php 
        echo JText::_('DISCOUNT_PERCENT_AMOUNT');
        ?>
								</label>
							</td>
							<td>
								<input style="width:50px;" type="text" id="percent_amount" onchange="updateTag();" value="0" />
							</td>
						</tr>
					</table>
				</td>
				<td>
					<table class="admintable" style="margin:auto">
						<tr>
							<td class="key">
								<label for="start">
									<?php 
        echo JText::_('DISCOUNT_START_DATE');
        ?>
								</label>
							</td>
							<td>
								<?php 
        echo JHTML::_('calendar', '', 'start', 'start', '%Y-%m-%d %H:%M', array('style' => 'width:100px', 'onchange' => 'updateTag();'));
        ?>
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="end">
									<?php 
        echo JText::_('DISCOUNT_END_DATE');
        ?>
								</label>
							</td>
							<td>
								<?php 
        echo JHTML::_('calendar', '', 'end', 'end', '%Y-%m-%d %H:%M', array('style' => 'width:100px', 'onchange' => 'updateTag();'));
        ?>
							</td>
						</tr>
						<?php 
        if (hikashop_level(1)) {
            ?>
						<tr>
							<td class="key">
								<label for="minimum_order">
									<?php 
            echo JText::_('MINIMUM_ORDER_VALUE');
            ?>
								</label>
							</td>
							<td>
								<input style="width:50px;" type="text" id="minimum_order" value="0" onchange="updateTag();" />
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="quota">
									<?php 
            echo JText::_('DISCOUNT_QUOTA');
            ?>
								</label>
							</td>
							<td>
								<input style="width:50px;" type="text" id="quota" value="" onchange="updateTag();" />
							</td>
						</tr>
						<tr>
							<td class="key">
								<label for="product_id">
									<?php 
            echo JText::_('PRODUCT');
            ?>
								</label>
							</td>
							<td>
								<?php 
            $this->db->setQuery("SELECT `product_id`, CONCAT(product_name,' ( ',product_code,' )') as `title` FROM #__hikashop_product WHERE `product_type`='main' AND `product_published`=1  ORDER BY `product_code` ASC");
            $results = $this->db->loadObjectList();
            $obj = new stdClass();
            $obj->product_id = '';
            $obj->title = JText::_('HIKA_NONE');
            array_unshift($results, $obj);
            echo JHTML::_('select.genericlist', $results, 'product_id', 'size="1" style="width:150px;"  onchange="updateTag();"', 'product_id', 'title', '');
            ?>
							</td>
						</tr>
						<?php 
        } else {
            ?>
						<tr>
							<td>
								<input type="hidden" id="minimum_order" value="0" />
								<input type="hidden" id="quota" value="" />
							</td>
						</tr>
						<?php 
        }
        ?>
					</table>
				</td>
			</tr>
		</table>
<?php 
        echo $tabs->endPanel();
        echo $tabs->endPane();
    }
Пример #8
0
 function listing()
 {
     $app = JFactory::getApplication();
     $config = acymailing_config();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->elements = new stdClass();
     $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.ordering', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'asc', 'word');
     $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower($pageInfo->search);
     $selectedCreator = $app->getUserStateFromRequest($paramBase . "filter_creator", 'filter_creator', 0, 'int');
     $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database = JFactory::getDBO();
     $filters = array();
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\'';
         $filters[] = "a.name LIKE {$searchVal} OR a.description LIKE {$searchVal} OR a.listid LIKE {$searchVal}";
     }
     $filters[] = "a.type = 'list'";
     if (!empty($selectedCreator)) {
         $filters[] = 'a.userid = ' . $selectedCreator;
     }
     $query = 'SELECT a.*, d.name as creatorname, d.username, d.email';
     $query .= ' FROM ' . acymailing_table('list') . ' as a';
     $query .= ' LEFT JOIN ' . acymailing_table('users', false) . ' as d on a.userid = d.id';
     $query .= ' WHERE (' . implode(') AND (', $filters) . ')';
     if (!empty($pageInfo->filter->order->value)) {
         $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
     $rows = $database->loadObjectList();
     $queryCount = 'SELECT COUNT(a.listid) FROM  ' . acymailing_table('list') . ' as a';
     if (!empty($pageInfo->search)) {
         $queryCount .= ' LEFT JOIN ' . acymailing_table('users', false) . ' as d on a.userid = d.id';
     }
     $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')';
     $database->setQuery($queryCount);
     $pageInfo->elements->total = $database->loadResult();
     $listids = array();
     foreach ($rows as $oneRow) {
         $listids[] = $oneRow->listid;
     }
     $subscriptionresults = array();
     if (!empty($listids)) {
         $querySubscription = 'SELECT count(subid) as total,listid,status FROM ' . acymailing_table('listsub') . ' WHERE listid IN (' . implode(',', $listids) . ') GROUP BY listid, status';
         $database->setQuery($querySubscription);
         $countresults = $database->loadObjectList();
         foreach ($countresults as $oneResult) {
             $subscriptionresults[$oneResult->listid][intval($oneResult->status)] = $oneResult->total;
         }
     }
     foreach ($rows as $i => $oneRow) {
         $rows[$i]->nbsub = intval(@$subscriptionresults[$oneRow->listid][1]);
         $rows[$i]->nbunsub = intval(@$subscriptionresults[$oneRow->listid][-1]);
         $rows[$i]->nbwait = intval(@$subscriptionresults[$oneRow->listid][2]);
     }
     if (!empty($pageInfo->search)) {
         $rows = acymailing_search($pageInfo->search, $rows);
     }
     $pageInfo->elements->page = count($rows);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
     acymailing_setTitle(JText::_('LISTS'), 'acylist', 'list');
     $bar = JToolBar::getInstance('toolbar');
     if (acymailing_isAllowed($config->get('acl_lists_filter', 'all'))) {
         $bar->appendButton('Link', 'filter', JText::_('ACY_FILTERS'), acymailing_completeLink('filter'));
         JToolBarHelper::divider();
     }
     if (acymailing_isAllowed($config->get('acl_lists_manage', 'all'))) {
         JToolBarHelper::addNew();
     }
     if (acymailing_isAllowed($config->get('acl_lists_manage', 'all'))) {
         JToolBarHelper::editList();
     }
     if (acymailing_isAllowed($config->get('acl_lists_delete', 'all'))) {
         JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS'));
     }
     JToolBarHelper::divider();
     $bar->appendButton('Pophelp', 'list-listing');
     if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) {
         $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard'));
     }
     $order = new stdClass();
     $order->ordering = false;
     $order->orderUp = 'orderup';
     $order->orderDown = 'orderdown';
     $order->reverse = false;
     if ($pageInfo->filter->order->value == 'a.ordering') {
         $order->ordering = true;
         if ($pageInfo->filter->order->dir == 'desc') {
             $order->orderUp = 'orderdown';
             $order->orderDown = 'orderup';
             $order->reverse = true;
         }
     }
     $filters = new stdClass();
     $listcreatorType = acymailing_get('type.listcreator');
     $filters->creator = $listcreatorType->display('filter_creator', $selectedCreator);
     $this->assignRef('filters', $filters);
     $this->assignRef('order', $order);
     $toggleClass = acymailing_get('helper.toggle');
     $this->assignRef('toggleClass', $toggleClass);
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->assignRef('pagination', $pagination);
 }
Пример #9
0
 function listing()
 {
     $app = JFactory::getApplication();
     $pageInfo = new stdClass();
     $pageInfo->filter = new stdClass();
     $pageInfo->filter->order = new stdClass();
     $pageInfo->limit = new stdClass();
     $pageInfo->elements = new stdClass();
     $config = acymailing_config();
     JHTML::_('behavior.modal', 'a.modal');
     $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName() . $this->getLayout();
     $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.senddate', 'cmd');
     $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
     $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
     $pageInfo->search = JString::strtolower($pageInfo->search);
     $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
     $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
     $database = JFactory::getDBO();
     $filters = array();
     if (!empty($pageInfo->search)) {
         $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\'';
         $filters[] = implode(" LIKE {$searchVal} OR ", $this->searchFields) . " LIKE {$searchVal}";
     }
     $query = 'SELECT ' . implode(' , ', $this->selectFields);
     $query .= ' FROM ' . acymailing_table('stats') . ' as a';
     $query .= ' JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid';
     if (!empty($filters)) {
         $query .= ' WHERE (' . implode(') AND (', $filters) . ')';
     }
     if (!empty($pageInfo->filter->order->value)) {
         $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
     }
     $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
     $rows = $database->loadObjectList();
     if ($rows === null) {
         acymailing_display(substr(strip_tags($database->getErrorMsg()), 0, 200) . '...', 'error');
         if (file_exists(ACYMAILING_BACK . 'install.acymailing.php')) {
             include_once ACYMAILING_BACK . 'install.acymailing.php';
             $installClass = new acymailingInstall();
             $installClass->fromVersion = '3.6.0';
             $installClass->update = true;
             $installClass->updateSQL();
         }
     }
     $queryCount = 'SELECT COUNT(a.mailid) FROM ' . acymailing_table('stats') . ' as a';
     if (!empty($pageInfo->search)) {
         $queryCount .= ' JOIN ' . acymailing_table('mail') . ' as b on a.mailid = b.mailid';
     }
     if (!empty($filters)) {
         $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')';
     }
     $database->setQuery($queryCount);
     $pageInfo->elements->total = $database->loadResult();
     if (!empty($pageInfo->search)) {
         $rows = acymailing_search($pageInfo->search, $rows);
     }
     $pageInfo->elements->page = count($rows);
     jimport('joomla.html.pagination');
     $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
     acymailing_setTitle(JText::_('GLOBAL_STATISTICS'), 'stats', 'stats');
     $bar = JToolBar::getInstance('toolbar');
     JToolBarHelper::custom('exportglobal', 'acyexport', '', JText::_('ACY_EXPORT'), false);
     JToolBarHelper::spacer();
     if (acymailing_isAllowed($config->get('acl_statistics_delete', 'all'))) {
         JToolBarHelper::deleteList(JText::_('ACY_VALIDDELETEITEMS'));
     }
     JToolBarHelper::divider();
     $bar->appendButton('Pophelp', 'stats-listing');
     if (acymailing_isAllowed($config->get('acl_cpanel_manage', 'all'))) {
         $bar->appendButton('Link', 'acymailing', JText::_('ACY_CPANEL'), acymailing_completeLink('dashboard'));
     }
     $this->assignRef('rows', $rows);
     $this->assignRef('pageInfo', $pageInfo);
     $this->assignRef('pagination', $pagination);
 }
Пример #10
0
    function listing()
    {
        global $Itemid;
        $app = JFactory::getApplication();
        $my = JFactory::getUser();
        $pathway = $app->getPathway();
        $values = new stdClass();
        $jsite = JFactory::getApplication('site');
        $menus = $jsite->getMenu();
        $menu = $menus->getActive();
        $config = acymailing_config();
        if (empty($menu) and !empty($Itemid)) {
            $menus->setActive($Itemid);
            $menu = $menus->getItem($Itemid);
        }
        $myItem = empty($Itemid) ? '' : '&Itemid=' . $Itemid;
        $this->assignRef('item', $myItem);
        if (is_object($menu)) {
            jimport('joomla.html.parameter');
            $menuparams = new acyParameter($menu->params);
        }
        $pageInfo = new stdClass();
        $pageInfo->filter = new stdClass();
        $pageInfo->filter->order = new stdClass();
        $pageInfo->limit = new stdClass();
        $pageInfo->elements = new stdClass();
        $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName();
        $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
        $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
        $pageInfo->search = JString::strtolower($pageInfo->search);
        $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
        $pageInfo->limit->start = JRequest::getInt('limitstart', 0);
        $listClass = acymailing_get('class.list');
        $listid = acymailing_getCID('listid');
        if (empty($listid) and !empty($menuparams)) {
            $listid = $menuparams->get('listid');
        }
        if (empty($listid) and acymailing_level(3)) {
            $listClass = acymailing_get('class.list');
            $allAllowedLists = $listClass->getFrontendLists();
            if (!empty($allAllowedLists)) {
                $firstList = reset($allAllowedLists);
                $listid = $firstList->listid;
                JRequest::setVar('listid', $listid);
            }
        }
        if (empty($listid)) {
            return JError::raiseError(404, 'Mailing List not found');
        }
        $oneList = $listClass->get($listid);
        if (empty($oneList->listid)) {
            return JError::raiseError(404, 'Mailing List not found : ' . $listid);
        }
        $access = new stdClass();
        $access->frontEndManagement = false;
        $access->frontEndAccess = true;
        if (!$access->frontEndManagement and (!$oneList->published or !$oneList->visible or !$access->frontEndAccess)) {
            if (empty($my->id)) {
                $usercomp = !ACYMAILING_J16 ? 'com_user' : 'com_users';
                $uri = JFactory::getURI();
                $url = 'index.php?option=' . $usercomp . '&view=login&return=' . base64_encode($uri->toString());
                $app->redirect($url, JText::_('ACY_NOTALLOWED'));
                return false;
            } else {
                $app->enqueueMessage(JText::_('ACY_NOTALLOWED'), 'error');
                $app->redirect(acymailing_completeLink('lists', false, true));
                return false;
            }
        }
        if ($config->get('open_popup', 1)) {
            JHTML::_('behavior.modal', 'a.modal');
        }
        if (!empty($menuparams)) {
            $values->suffix = $menuparams->get('pageclass_sfx', '');
            $values->page_title = $menuparams->get('page_title');
            $values->page_heading = ACYMAILING_J16 ? $menuparams->get('page_heading') : $menuparams->get('page_title');
            $values->show_page_heading = ACYMAILING_J16 ? $menuparams->get('show_page_heading', 1) : $menuparams->get('show_page_title', 1);
        } else {
            $values->suffix = '';
            $values->show_page_heading = 1;
        }
        $values->show_description = $config->get('show_description', 1);
        $values->show_headings = $config->get('show_headings', 1);
        $values->show_senddate = $config->get('show_senddate', 1);
        $values->show_colnumber = $config->get('show_colnumber', 1);
        $values->show_receiveemail = $config->get('show_receiveemail', 0) && acymailing_level(1);
        $values->filter = $config->get('show_filter', 1);
        if (empty($values->page_title)) {
            $values->page_title = $oneList->name;
        }
        if (empty($values->page_heading)) {
            $values->page_heading = $oneList->name;
        }
        if (empty($menuparams)) {
            $pathway->addItem(JText::_('MAILING_LISTS'), acymailing_completeLink('lists'));
            $pathway->addItem($values->page_title);
        } elseif (!$menuparams->get('listid')) {
            $pathway->addItem($values->page_title);
        }
        $document = JFactory::getDocument();
        $document->setTitle($values->page_title);
        $this->addFeed();
        $db = JFactory::getDBO();
        $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', $access->frontEndManagement ? 'a.mailid' : 'a.senddate', 'cmd');
        $searchMap = array('a.mailid', 'a.subject', 'a.alias');
        $filters = array();
        if (!empty($pageInfo->search)) {
            $searchVal = '\'%' . acymailing_getEscaped($pageInfo->search, true) . '%\'';
            $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
        }
        $filters[] = 'a.type = \'news\'';
        if (!$access->frontEndManagement) {
            $filters[] = 'a.published = 1';
            $filters[] = 'a.visible = 1';
        }
        $filters[] = 'c.listid = ' . $oneList->listid;
        $selection = array_merge($searchMap, array('a.senddate', 'a.created', 'a.visible', 'a.published', 'a.fromname', 'a.fromemail', 'a.replyname', 'a.replyemail', 'a.userid'));
        $query = 'SELECT "" AS body, "" AS altbody, html AS sendHTML, ' . implode(',', $selection);
        $query .= ' FROM ' . acymailing_table('listmail') . ' as c';
        $query .= ' JOIN ' . acymailing_table('mail') . ' as a on a.mailid = c.mailid ';
        $query .= ' WHERE (' . implode(') AND (', $filters) . ')';
        $query .= ' ORDER BY ' . acymailing_secureField($pageInfo->filter->order->value) . ' ' . acymailing_secureField($pageInfo->filter->order->dir) . ', c.mailid DESC';
        $db->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
        $rows = $db->loadObjectList();
        $pageInfo->elements->page = count($rows);
        if (!empty($pageInfo->search)) {
            $rows = acymailing_search($pageInfo->search, $rows);
        }
        if ($pageInfo->limit->value > $pageInfo->elements->page) {
            $pageInfo->elements->total = $pageInfo->limit->start + $pageInfo->elements->page;
        } else {
            $queryCount = 'SELECT COUNT(c.mailid) FROM ' . acymailing_table('listmail') . ' as c';
            $queryCount .= ' JOIN ' . acymailing_table('mail') . ' as a on a.mailid = c.mailid ';
            $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')';
            $db->setQuery($queryCount);
            $pageInfo->elements->total = $db->loadResult();
        }
        if (!empty($my->email)) {
            $userClass = acymailing_get('class.subscriber');
            $receiver = $userClass->get($my->email);
        }
        if (empty($receiver)) {
            $receiver = new stdClass();
            $receiver->name = JText::_('VISITOR');
        }
        JPluginHelper::importPlugin('acymailing');
        $dispatcher = JDispatcher::getInstance();
        foreach ($rows as $mail) {
            if (strpos($mail->subject, "{") !== false) {
                $dispatcher->trigger('acymailing_replacetags', array(&$mail, false));
                $dispatcher->trigger('acymailing_replaceusertags', array(&$mail, &$receiver, false));
            }
        }
        jimport('joomla.html.pagination');
        $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
        $js = 'function tableOrdering( order, dir, task ){
			var form = document.adminForm;

			form.filter_order.value 	= order;
			form.filter_order_Dir.value	= dir;
			document.adminForm.submit( task );
		}

		function changeReceiveEmail(checkedbox){
			var form = document.adminForm;
			if(checkedbox){
				form.nbreceiveemail.value++;
			}else{
				form.nbreceiveemail.value--;
			}

			if(form.nbreceiveemail.value > 0 ){
				document.getElementById(\'receiveemailbox\').className = \'receiveemailbox receiveemailbox_visible\';
			}else{
				document.getElementById(\'receiveemailbox\').className = \'receiveemailbox receiveemailbox_hidden\';
			}
		}
		';
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($js);
        $this->assignRef('access', $access);
        $this->assignRef('rows', $rows);
        $this->assignRef('values', $values);
        $this->assignRef('list', $oneList);
        $this->assignRef('pagination', $pagination);
        $this->assignRef('pageInfo', $pageInfo);
        $this->assignRef('config', $config);
        $this->assignRef('my', $my);
    }
Пример #11
0
    function acymailingtagcontent_show()
    {
        $app =& JFactory::getApplication();
        $pageInfo = null;
        $my = JFactory::getUser();
        $paramBase = ACYMAILING_COMPONENT . '.tagcontent';
        $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.id', 'cmd');
        $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
        $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
        $pageInfo->search = JString::strtolower($pageInfo->search);
        $pageInfo->filter_cat = $app->getUserStateFromRequest($paramBase . ".filter_cat", 'filter_cat', '', 'int');
        $pageInfo->contenttype = $app->getUserStateFromRequest($paramBase . ".contenttype", 'contenttype', $this->params->get('default_type', '|type:intro'), 'string');
        $pageInfo->author = $app->getUserStateFromRequest($paramBase . ".author", 'author', $this->params->get('default_author', ''), 'string');
        $pageInfo->titlelink = $app->getUserStateFromRequest($paramBase . ".titlelink", 'titlelink', $this->params->get('default_titlelink', '|link'), 'string');
        $pageInfo->lang = $app->getUserStateFromRequest($paramBase . ".lang", 'lang', '', 'string');
        $pageInfo->pict = $app->getUserStateFromRequest($paramBase . ".pict", 'pict', $this->params->get('default_pict', 1), 'string');
        $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
        $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
        $picts = array();
        $picts[] = JHTML::_('select.option', "1", JText::_('JOOMEXT_YES'));
        $pictureHelper = acymailing_get('helper.acypict');
        if ($pictureHelper->available()) {
            $picts[] = JHTML::_('select.option', "resized", JText::_('RESIZED'));
        }
        $picts[] = JHTML::_('select.option', "0", JText::_('JOOMEXT_NO'));
        $db =& JFactory::getDBO();
        $searchFields = array('a.id', 'a.title', 'a.alias', 'a.created_by', 'b.name', 'b.username');
        if (!empty($pageInfo->search)) {
            $searchVal = '\'%' . $db->getEscaped($pageInfo->search, true) . '%\'';
            $filters[] = implode(" LIKE {$searchVal} OR ", $searchFields) . " LIKE {$searchVal}";
        }
        if (!empty($pageInfo->filter_cat)) {
            $filters[] = "a.catid = " . $pageInfo->filter_cat;
        }
        if ($this->params->get('displayart', 'all') == 'onlypub') {
            $filters[] = "a.state = 1";
        } else {
            $filters[] = "a.state != -2";
        }
        if (!$app->isAdmin()) {
            if (version_compare(JVERSION, '1.6.0', '<')) {
                $filters[] = 'a.`access` <= ' . (int) $my->get('aid');
            } else {
                $groups = implode(',', $my->authorisedLevels());
                $filters[] = 'a.`access` IN (' . $groups . ')';
            }
        }
        if ($this->params->get('frontendaccess') == 'author' and !$app->isAdmin()) {
            $filters[] = "a.created_by = " . intval($my->id);
        }
        $whereQuery = '';
        if (!empty($filters)) {
            $whereQuery = ' WHERE (' . implode(') AND (', $filters) . ')';
        }
        $query = 'SELECT SQL_CALC_FOUND_ROWS a.id,a.created,a.title,a.alias,a.catid,a.sectionid,b.name,b.username,a.created_by FROM ' . acymailing_table('content', false) . ' as a';
        $query .= ' LEFT JOIN `#__users` AS b ON b.id = a.created_by';
        if (!empty($whereQuery)) {
            $query .= $whereQuery;
        }
        if (!empty($pageInfo->filter->order->value)) {
            $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
        }
        $db->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
        $rows = $db->loadObjectList();
        if (!empty($pageInfo->search)) {
            $rows = acymailing_search($pageInfo->search, $rows);
        }
        $db->setQuery('SELECT FOUND_ROWS()');
        $pageInfo->elements->total = $db->loadResult();
        $pageInfo->elements->page = count($rows);
        if (version_compare(JVERSION, '1.6.0', '<')) {
            $query = 'SELECT a.id, a.id as catid, a.title as category, b.title as section, b.id as secid from #__categories as a ';
            $query .= 'INNER JOIN #__sections as b on a.section = b.id ORDER BY b.ordering,a.ordering';
            $db->setQuery($query);
            $categories = $db->loadObjectList('id');
            $categoriesValues = array();
            $categoriesValues[] = JHTML::_('select.option', '', JText::_('ACY_ALL'));
            $currentSec = '';
            foreach ($categories as $catid => $oneCategorie) {
                if ($currentSec != $oneCategorie->section) {
                    if (!empty($currentSec)) {
                        $this->values[] = JHTML::_('select.option', '</OPTGROUP>');
                    }
                    $categoriesValues[] = JHTML::_('select.option', '<OPTGROUP>', $oneCategorie->section);
                    $currentSec = $oneCategorie->section;
                }
                $categoriesValues[] = JHTML::_('select.option', $catid, $oneCategorie->category);
            }
        } else {
            $query = "SELECT * from #__categories WHERE `extension` = 'com_content' ORDER BY lft ASC";
            $db->setQuery($query);
            $categories = $db->loadObjectList('id');
            $categoriesValues = array();
            $categoriesValues[] = JHTML::_('select.option', '', JText::_('ACY_ALL'));
            foreach ($categories as $catid => $oneCategorie) {
                $categories[$catid]->title = str_repeat('- - ', $categories[$catid]->level) . $categories[$catid]->title;
                $categoriesValues[] = JHTML::_('select.option', $catid, $categories[$catid]->title);
            }
        }
        jimport('joomla.html.pagination');
        $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
        jimport('joomla.html.pane');
        $tabs =& JPane::getInstance('tabs');
        echo $tabs->startPane('joomlacontent_tab');
        echo $tabs->startPanel(JText::_('JOOMLA_CONTENT'), 'joomlacontent_content');
        ?>

		<br style="font-size:1px"/>
		<script language="javascript" type="text/javascript">
		<!--
			var selectedContents = new Array();
			function applyContent(contentid,rowClass){
				if(selectedContents[contentid]){
					window.document.getElementById('content'+contentid).className = rowClass;
					delete selectedContents[contentid];
				}else{
					window.document.getElementById('content'+contentid).className = 'selectedrow';
					selectedContents[contentid] = 'content';
				}
				updateTag();
			}
			function updateTag(){
				var tag = '';
				var otherinfo = '';
				for(var i=0; i < document.adminForm.contenttype.length; i++){
					 if (document.adminForm.contenttype[i].checked){ selectedtype = document.adminForm.contenttype[i].value; otherinfo += document.adminForm.contenttype[i].value; }
				}
				for(var i=0; i < document.adminForm.titlelink.length; i++){
					 if (document.adminForm.titlelink[i].checked){ otherinfo += document.adminForm.titlelink[i].value; }
				}
				if(selectedtype != '|type:title'){
					for(var i=0; i < document.adminForm.author.length; i++){
						 if (document.adminForm.author[i].checked){ otherinfo += document.adminForm.author[i].value; }
					}
					for(var i=0; i < document.adminForm.pict.length; i++){
						 if (document.adminForm.pict[i].checked){ otherinfo += '|pict:'+document.adminForm.pict[i].value; }
					}
				}
				if(window.document.getElementById('jflang')  && window.document.getElementById('jflang').value != ''){
					otherinfo += '|lang:';
					otherinfo += window.document.getElementById('jflang').value;
				}
				for(var i in selectedContents){
					if(selectedContents[i] == 'content'){
						tag = tag + '{joomlacontent:'+i+otherinfo+'}<br/>';
					}
				}
				setTag(tag);
			}
		//-->
		</script>
		<table width="100%" class="adminform">
			<tr>
				<td>
					<?php 
        echo JText::_('DISPLAY');
        ?>

				</td>
				<td colspan="2">
				<?php 
        $contentType = acymailing_get('type.content');
        echo $contentType->display('contenttype', $pageInfo->contenttype);
        ?>

				</td>
				<td>
				<?php 
        $jflanguages = acymailing_get('type.jflanguages');
        $jflanguages->onclick = 'onchange="updateTag();"';
        echo $jflanguages->display('lang', $pageInfo->lang);
        ?>

				</td>
			</tr>
			<tr>
				<td>
				<?php 
        echo JText::_('CLICKABLE_TITLE');
        ?>

				 </td>
				 <td>
				 	<?php 
        $titlelinkType = acymailing_get('type.titlelink');
        echo $titlelinkType->display('titlelink', $pageInfo->titlelink);
        ?>

				</td>
				<td>
				<?php 
        echo JText::_('AUTHOR_NAME');
        ?>

				 </td>
				 <td>
				 	<?php 
        $authorname = acymailing_get('type.authorname');
        echo $authorname->display('author', $pageInfo->author);
        ?>

				</td>
			</tr>
			<tr>
				<td><?php 
        echo JText::_('DISPLAY_PICTURES');
        ?>
</td>
				<td><?php 
        echo JHTML::_('select.radiolist', $picts, 'pict', 'size="1" onclick="updateTag();"', 'value', 'text', $pageInfo->pict);
        ?>
</td>
				<td></td>
				<td></td>
			</tr>
		</table>
		<table>
			<tr>
				<td width="100%">
					<?php 
        echo JText::_('JOOMEXT_FILTER');
        ?>
:
					<input type="text" name="search" id="acymailingsearch" value="<?php 
        echo $pageInfo->search;
        ?>
" class="text_area" onchange="document.adminForm.submit();" />
					<button onclick="this.form.submit();"><?php 
        echo JText::_('JOOMEXT_GO');
        ?>
</button>
					<button onclick="document.getElementById('acymailingsearch').value='';this.form.submit();"><?php 
        echo JText::_('JOOMEXT_RESET');
        ?>
</button>
				</td>
				<td nowrap="nowrap">
					<?php 
        echo JHTML::_('select.genericlist', $categoriesValues, 'filter_cat', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', (int) $pageInfo->filter_cat);
        ?>

				</td>
			</tr>
		</table>
		<table class="adminlist" cellpadding="1" width="100%">
			<thead>
				<tr>
					<th class="title">
					</th>
					<th class="title">
						<?php 
        echo JHTML::_('grid.sort', JText::_('FIELD_TITLE'), 'a.title', $pageInfo->filter->order->dir, $pageInfo->filter->order->value);
        ?>

					</th>
					<th class="title">
						<?php 
        echo JHTML::_('grid.sort', JText::_('ACY_AUTHOR'), 'b.name', $pageInfo->filter->order->dir, $pageInfo->filter->order->value);
        ?>

					</th>
					<th class="title">
						<?php 
        echo JHTML::_('grid.sort', JText::_('ACY_CREATED'), 'a.created', $pageInfo->filter->order->dir, $pageInfo->filter->order->value);
        ?>

					</th>
					<th class="title titleid">
						<?php 
        echo JHTML::_('grid.sort', JText::_('ACY_ID'), 'a.id', $pageInfo->filter->order->dir, $pageInfo->filter->order->value);
        ?>

					</th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan="5">
						<?php 
        echo $pagination->getListFooter();
        ?>

						<?php 
        echo $pagination->getResultsCounter();
        ?>

					</td>
				</tr>
			</tfoot>
			<tbody>
				<?php 
        $k = 0;
        for ($i = 0, $a = count($rows); $i < $a; $i++) {
            $row =& $rows[$i];
            ?>

					<tr id="content<?php 
            echo $row->id;
            ?>
" class="<?php 
            echo "row{$k}";
            ?>
" onclick="applyContent(<?php 
            echo $row->id . ",'row{$k}'";
            ?>
);" style="cursor:pointer;">
						<td class="acytdcheckbox"></td>
						<td>
						<?php 
            $text = '<b>' . JText::_('JOOMEXT_ALIAS') . ': </b>' . $row->alias;
            echo acymailing_tooltip($text, $row->title, '', $row->title);
            ?>

						</td>
						<td>
						<?php 
            if (!empty($row->name)) {
                $text = '<b>' . JText::_('JOOMEXT_NAME') . ' : </b>' . $row->name;
                $text .= '<br/><b>' . JText::_('ACY_USERNAME') . ' : </b>' . $row->username;
                $text .= '<br/><b>' . JText::_('ACY_ID') . ' : </b>' . $row->created_by;
                echo acymailing_tooltip($text, $row->name, '', $row->name);
            }
            ?>

						</td>
						<td align="center">
							<?php 
            echo JHTML::_('date', $row->created, JText::_('DATE_FORMAT_LC4'));
            ?>

						</td>
						<td align="center">
							<?php 
            echo $row->id;
            ?>

						</td>
					</tr>
				<?php 
            $k = 1 - $k;
        }
        ?>

			</tbody>
		</table>
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="filter_order" value="<?php 
        echo $pageInfo->filter->order->value;
        ?>
" />
		<input type="hidden" name="filter_order_Dir" value="<?php 
        echo $pageInfo->filter->order->dir;
        ?>
" />
	<?php 
        echo $tabs->endPanel();
        echo $tabs->startPanel(JText::_('TAG_CATEGORIES'), 'joomlacontent_auto');
        $type = JRequest::getString('type');
        ?>

		<br style="font-size:1px"/>
		<script language="javascript" type="text/javascript">
		<!--
			var selectedCategories = new Array();
		<?php 
        if (version_compare(JVERSION, '1.6.0', '<')) {
            ?>

			function applyAutoContent(secid,catid,rowClass){
				if(selectedCategories[secid] && selectedCategories[secid][catid]){
					window.document.getElementById('content_sec'+secid+'_cat'+catid).className = rowClass;
					delete selectedCategories[secid][catid];
				}else{
					if(!selectedCategories[secid]) selectedCategories[secid] = new Array();
					if(secid == 0){
						for(var isec in selectedCategories){
							for(var icat in selectedCategories[isec]){
								if(selectedCategories[isec][icat] == 'content'){
									window.document.getElementById('content_sec'+isec+'_cat'+icat).className = 'row0';
									delete selectedCategories[isec][icat];
								}
							}
						}
					}else{
						if(selectedCategories[0] && selectedCategories[0][0]){
							window.document.getElementById('content_sec0_cat0').className = 'row0';
							delete selectedCategories[0][0];
						}
						if(catid == 0){
							for(var icat in selectedCategories[secid]){
								if(selectedCategories[secid][icat] == 'content'){
									window.document.getElementById('content_sec'+secid+'_cat'+icat).className = 'row0';
									delete selectedCategories[secid][icat];
								}
							}
						}else{
							if(selectedCategories[secid][0]){
								window.document.getElementById('content_sec'+secid+'_cat0').className = 'row0';
								delete selectedCategories[secid][0];
							}
						}
					}
					window.document.getElementById('content_sec'+secid+'_cat'+catid).className = 'selectedrow';
					selectedCategories[secid][catid] = 'content';
				}
				updateAutoTag();
			}
		<?php 
        } else {
            ?>

			function applyAutoContent(catid,rowClass){
				if(selectedCategories[catid]){
					window.document.getElementById('content_cat'+catid).className = rowClass;
					delete selectedCategories[catid];
				}else{
					window.document.getElementById('content_cat'+catid).className = 'selectedrow';
					selectedCategories[catid] = 'content';
				}
				updateAutoTag();
			}
		<?php 
        }
        ?>
			function updateAutoTag(){
				tag = '{autocontent:';
			<?php 
        if (version_compare(JVERSION, '1.6.0', '<')) {
            ?>

				for(var isec in selectedCategories){
					for(var icat in selectedCategories[isec]){
						if(selectedCategories[isec][icat] == 'content'){
							if(icat != 0){
								tag += 'cat'+icat+'-';
							}else{
								tag += 'sec'+isec+'-';
							}
						}
					}
				}
			<?php 
        } else {
            ?>

				for(var icat in selectedCategories){
					if(selectedCategories[icat] == 'content'){
						tag += icat+'-';
					}
				}
			<?php 
        }
        ?>
				if(document.adminForm.min_article && document.adminForm.min_article.value && document.adminForm.min_article.value!=0){ tag += '|min:'+document.adminForm.min_article.value; }
				if(document.adminForm.max_article.value && document.adminForm.max_article.value!=0){ tag += '|max:'+document.adminForm.max_article.value; }
				if(document.adminForm.contentorder.value){ tag += document.adminForm.contentorder.value; }
				if(document.adminForm.contentfilter && document.adminForm.contentfilter.value){ tag += document.adminForm.contentfilter.value; }
				if(document.adminForm.meta_article && document.adminForm.meta_article.value){ tag += '|meta:'+document.adminForm.meta_article.value; }
				for(var i=0; i < document.adminForm.contenttypeauto.length; i++){
					 if (document.adminForm.contenttypeauto[i].checked){selectedtype = document.adminForm.contenttypeauto[i].value; tag += document.adminForm.contenttypeauto[i].value; }
				}
				for(var i=0; i < document.adminForm.titlelinkauto.length; i++){
					 if (document.adminForm.titlelinkauto[i].checked){ tag += document.adminForm.titlelinkauto[i].value; }
				}
				if(selectedtype != '|type:title'){
					for(var i=0; i < document.adminForm.authorauto.length; i++){
						 if (document.adminForm.authorauto[i].checked){ tag += document.adminForm.authorauto[i].value; }
					}
					for(var i=0; i < document.adminForm.pictauto.length; i++){
						 if (document.adminForm.pictauto[i].checked){ tag += '|pict:'+document.adminForm.pictauto[i].value; }
					}
					if(document.adminForm.cols && document.adminForm.cols.value > 1){ tag += '|cols:'+document.adminForm.cols.value; }
				}
				if(window.document.getElementById('jflangauto')  && window.document.getElementById('jflangauto').value != ''){
					tag += '|lang:';
					tag += window.document.getElementById('jflangauto').value;
				}
				tag += '}';
				setTag(tag);
			}
		//-->
		</script>
		<table width="100%" class="adminform">
			<tr>
				<td>
					<?php 
        echo JText::_('DISPLAY');
        ?>

				</td>
				<td colspan="2">
				<?php 
        $contentType = acymailing_get('type.content');
        $contentType->onclick = "updateAutoTag();";
        echo $contentType->display('contenttypeauto', $this->params->get('default_type', '|type:intro'));
        ?>

				</td>
				<td>
					<?php 
        $jflanguages = acymailing_get('type.jflanguages');
        $jflanguages->onclick = 'onchange="updateAutoTag();"';
        $jflanguages->id = 'jflangauto';
        echo $jflanguages->display('langauto');
        ?>

				</td>
			</tr>
			<tr>
				<td>
				<?php 
        echo JText::_('CLICKABLE_TITLE');
        ?>

				 </td>
				 <td>
				 	<?php 
        $titlelinkType = acymailing_get('type.titlelink');
        $titlelinkType->onclick = "updateAutoTag();";
        echo $titlelinkType->display('titlelinkauto', $this->params->get('default_titlelink', '|link'));
        ?>

				</td>
				<td>
				<?php 
        echo JText::_('AUTHOR_NAME');
        ?>

				 </td>
				 <td>
				 	<?php 
        $authorname = acymailing_get('type.authorname');
        $authorname->onclick = "updateAutoTag();";
        echo $authorname->display('authorauto', $this->params->get('default_author', ''));
        ?>

				</td>
			</tr>
			<tr>
				<td><?php 
        echo JText::_('DISPLAY_PICTURES');
        ?>
</td>
				<td><?php 
        echo JHTML::_('select.radiolist', $picts, 'pictauto', 'size="1" onclick="updateAutoTag();"', 'value', 'text', $this->params->get('default_pict', '1'));
        ?>
</td>
				<td><?php 
        echo JText::_('FIELD_COLUMNS');
        ?>
</td>
				<td><input name="cols" size="10" value="1" onchange="updateAutoTag();"/></td>
			</tr>
			<tr>
				<td>
				<?php 
        echo JText::_('MAX_ARTICLE');
        ?>

				 </td>
				 <td>
				 	<input name="max_article" size="10" value="20" onchange="updateAutoTag();"/>
				</td>
				<td>
				<?php 
        echo JText::_('ACY_ORDER');
        ?>

				 </td>
				 <td>
				 	<?php 
        $ordertype = acymailing_get('type.contentorder');
        $ordertype->onclick = "updateAutoTag();";
        echo $ordertype->display('contentorder', '|order:id');
        ?>

				</td>
			</tr>
			<?php 
        if ($this->params->get('metaselect')) {
            ?>

				<tr>
					<td>
					<?php 
            echo JText::_('META_KEYWORDS');
            ?>

					 </td>
					 <td colspan="3">
					 	<input name="meta_article" size="50" value="" onchange="updateAutoTag();"/>
					</td>
				</tr>
			<?php 
        }
        ?>

			<?php 
        if ($type == 'autonews') {
            ?>

			<tr>
				<td>
				<?php 
            echo JText::_('MIN_ARTICLE');
            ?>

				 </td>
				 <td>
				 <input name="min_article" size="10" value="1" onchange="updateAutoTag();"/>
				</td>
				<td>
				<?php 
            echo JText::_('JOOMEXT_FILTER');
            ?>

				 </td>
				 <td>
				 	<?php 
            $filter = acymailing_get('type.contentfilter');
            $filter->onclick = "updateAutoTag();";
            echo $filter->display('contentfilter', '|filter:created');
            ?>

				</td>
			</tr>
			<?php 
        }
        ?>

		</table>
		<table class="adminlist" cellpadding="1" width="100%">
			<thead>
				<tr>
					<th class="title"></th>
				<?php 
        if (version_compare(JVERSION, '1.6.0', '<')) {
            ?>

					<th class="title">
						<?php 
            echo JText::_('SECTION');
            ?>

					</th>
				<?php 
        }
        ?>

					<th class="title">
						<?php 
        echo JText::_('TAG_CATEGORIES');
        ?>

					</th>
				</tr>
			</thead>
			<tbody>
				<?php 
        $k = 0;
        if (version_compare(JVERSION, '1.6.0', '<')) {
            ?>

					<tr id="content_sec0_cat0" class="<?php 
            echo "row{$k}";
            ?>
" onclick="applyAutoContent(0,0,'<?php 
            echo "row{$k}";
            ?>
');" style="cursor:pointer;">
						<td class="acytdcheckbox"></td>
						<td style="font-weight: bold;">
						<?php 
            echo JText::_('ACY_ALL');
            ?>

						</td>
						<td style="text-align:center;font-weight: bold;">
						<?php 
            echo JText::_('ACY_ALL');
            ?>

						</td>
					</tr>
					<?php 
        }
        $k = 1 - $k;
        $currentSection = '';
        foreach ($categories as $row) {
            if (version_compare(JVERSION, '1.6.0', '<') and $currentSection != $row->section) {
                ?>

						<tr id="content_sec<?php 
                echo $row->secid;
                ?>
_cat0" class="<?php 
                echo "row{$k}";
                ?>
" onclick="applyAutoContent(<?php 
                echo $row->secid;
                ?>
,0,'<?php 
                echo "row{$k}";
                ?>
');" style="cursor:pointer;">
							<td class="acytdcheckbox"></td>
							<td style="font-weight: bold;">
							<?php 
                echo $row->section;
                ?>

							</td>
							<td style="text-align:center;font-weight: bold;">
							<?php 
                echo JText::_('ACY_ALL');
                ?>

							</td>
						</tr>
						<?php 
                $k = 1 - $k;
                $currentSection = $row->section;
            }
            if (version_compare(JVERSION, '1.6.0', '<')) {
                ?>

					<tr id="content_sec<?php 
                echo $row->secid;
                ?>
_cat<?php 
                echo $row->catid;
                ?>
" class="<?php 
                echo "row{$k}";
                ?>
" onclick="applyAutoContent(<?php 
                echo $row->secid;
                ?>
,<?php 
                echo $row->catid;
                ?>
,'<?php 
                echo "row{$k}";
                ?>
');" style="cursor:pointer;">
						<td class="acytdcheckbox"></td>
						<td>
						</td>
						<td>
						<?php 
                echo $row->category;
                ?>

						</td>
					</tr>
				<?php 
            } else {
                ?>

						<tr id="content_cat<?php 
                echo $row->id;
                ?>
" class="<?php 
                echo "row{$k}";
                ?>
" onclick="applyAutoContent(<?php 
                echo $row->id;
                ?>
,'<?php 
                echo "row{$k}";
                ?>
');" style="cursor:pointer;">
						<td class="acytdcheckbox"></td>
						<td>
						<?php 
                echo $row->title;
                ?>

						</td>
					</tr>
					<?php 
            }
            $k = 1 - $k;
        }
        ?>

			</tbody>
		</table>
	<?php 
        echo $tabs->endPanel();
        echo $tabs->endPane();
    }
Пример #12
0
    function acymailingzoomailing_show()
    {
        $app = JFactory::getApplication();
        $pageInfo = new stdClass();
        $pageInfo->filter = new stdClass();
        $pageInfo->filter->order = new stdClass();
        $pageInfo->limit = new stdClass();
        $pageInfo->elements = new stdClass();
        $paramBase = ACYMAILING_COMPONENT . '.zoomailing';
        $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.id', 'cmd');
        $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
        $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
        $pageInfo->search = JString::strtolower($pageInfo->search);
        $pageInfo->filter_app = $app->getUserStateFromRequest($paramBase . ".filter_app", 'filter_app', '', 'int');
        if (!$pageInfo->filter_app) {
            $pageInfo->filter_app = $this->app->zm->firstApplication();
        }
        $pageInfo->filter_reset = JRequest::getInt('filter_reset');
        if ($pageInfo->filter_reset != 1) {
            $pageInfo->filter_type = $app->getUserStateFromRequest($paramBase . ".filter_type", 'filter_type', '', 'array');
            $pageInfo->filter_cat = $app->getUserStateFromRequest($paramBase . ".filter_cat", 'filter_cat', '', 'array');
            $pageInfo->filter_tag = $app->getUserStateFromRequest($paramBase . ".filter_tag", 'filter_tag', '', 'array');
        } else {
            $app->setUserState($paramBase . ".filter_type", null);
            $app->setUserState($paramBase . ".filter_cat", null);
            $app->setUserState($paramBase . ".filter_tag", null);
            $pageInfo->filter_type = null;
            $pageInfo->filter_cat = null;
            $pageInfo->filter_tag = null;
        }
        $pageInfo->lang = $app->getUserStateFromRequest($paramBase . ".lang", 'lang', '', 'string');
        $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
        $pageInfo->limit->start = $app->getUserStateFromRequest($paramBase . '.limitstart', 'limitstart', 0, 'int');
        $db = JFactory::getDBO();
        $filters[] = "a.application_id = " . $pageInfo->filter_app;
        $searchFields = array('a.id', 'a.name', 'a.alias', 'u.name', 'u.username');
        if (!empty($pageInfo->search)) {
            $searchVal = '\'%' . $db->getEscaped($pageInfo->search, true) . '%\'';
            $filters[] = implode(" LIKE {$searchVal} OR ", $searchFields) . " LIKE {$searchVal}";
        }
        if (!is_array($pageInfo->filter_type)) {
            $pageInfo->filter_type = array();
        }
        if (count($pageInfo->filter_type) > 0) {
            unset($pageInfo->filter_type[0]);
        }
        if (!empty($pageInfo->filter_type)) {
            $filters[] = "a.type IN('" . implode("','", $pageInfo->filter_type) . "')";
        }
        if (!is_array($pageInfo->filter_cat)) {
            $pageInfo->filter_cat = array();
        }
        if (count($pageInfo->filter_cat) > 0) {
            unset($pageInfo->filter_cat[0]);
        }
        if (!empty($pageInfo->filter_cat)) {
            $filters[] = "c.category_id IN(" . implode(',', $pageInfo->filter_cat) . ")";
        }
        if (!is_array($pageInfo->filter_tag)) {
            $pageInfo->filter_tag = array();
        }
        if (count($pageInfo->filter_tag) > 0) {
            unset($pageInfo->filter_tag[0]);
        }
        if (!empty($pageInfo->filter_tag)) {
            $filters[] = "t.name IN('" . implode("','", $pageInfo->filter_tag) . "')";
        }
        if ($this->params->get('displayzoo', 'all') == 'onlypub') {
            $filters[] = "a.state = 1";
        }
        $whereQuery = '';
        if (!empty($filters)) {
            $whereQuery = ' WHERE(' . implode(') AND(', $filters) . ')';
        }
        $query = 'SELECT SQL_CALC_FOUND_ROWS a.id, a.name, a.alias, a.created_by, u.name AS author, u.username
		FROM ' . acymailing_table('zoo_item', false) . ' as a';
        $query .= ' LEFT JOIN `' . acymailing_table('zoo_category_item', false) . '` AS c ON c.item_id = a.id';
        $query .= ' LEFT JOIN `' . acymailing_table('zoo_tag', false) . '` AS t ON t.item_id = a.id';
        $query .= ' LEFT JOIN `#__users` AS u ON u.id = a.created_by';
        if (!empty($whereQuery)) {
            $query .= $whereQuery;
        }
        $query .= ' GROUP BY a.id';
        if (!empty($pageInfo->filter->order->value)) {
            $query .= ' ORDER BY ' . $pageInfo->filter->order->value . ' ' . $pageInfo->filter->order->dir;
        }
        $db->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
        $rows = $db->loadObjectList();
        if (!empty($pageInfo->search)) {
            $rows = acymailing_search($pageInfo->search, $rows);
        }
        $db->setQuery('SELECT FOUND_ROWS()');
        $pageInfo->elements->total = $db->loadResult();
        $pageInfo->elements->page = count($rows);
        jimport('joomla.html.pagination');
        $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
        ?>
		<table class="adminform" width="100%">
			<tr>
				<td>Application : <?php 
        echo $this->app->zmhtml->_('zm.applicationList', $pageInfo->filter_app);
        ?>
 <input type="hidden" name="filter_reset" value="0" /></td>
			</tr>
		</table>
	<?php 
        $tabs = acymailing_get('helper.acytabs');
        echo $tabs->startPane('joomlazoo_tab');
        echo $tabs->startPanel('Items', 'joomlazoo_zoo');
        include_once $this->path . 'tab/item.php';
        echo $tabs->endPanel();
        echo $tabs->startPanel('Categories', 'joomlazoo_auto');
        include_once $this->path . 'tab/category.php';
        echo $tabs->endPanel();
        echo $tabs->endPane();
    }
Пример #13
0
    function listing()
    {
        global $Itemid;
        $app =& JFactory::getApplication();
        $my =& JFactory::getUser();
        $pathway =& $app->getPathway();
        $values = null;
        $menus =& JSite::getMenu();
        $menu = $menus->getActive();
        $config = acymailing_config();
        if (empty($menu) and !empty($Itemid)) {
            $menus->setActive($Itemid);
            $menu = $menus->getItem($Itemid);
        }
        $myItem = empty($Itemid) ? '' : '&Itemid=' . $Itemid;
        $this->assignRef('item', $myItem);
        if (is_object($menu)) {
            jimport('joomla.html.parameter');
            $menuparams = new JParameter($menu->params);
        }
        $pageInfo = null;
        $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName();
        $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.senddate', 'cmd');
        $pageInfo->filter->order->dir = $app->getUserStateFromRequest($paramBase . ".filter_order_Dir", 'filter_order_Dir', 'desc', 'word');
        $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string');
        $pageInfo->search = JString::strtolower($pageInfo->search);
        $pageInfo->limit->value = $app->getUserStateFromRequest($paramBase . '.list_limit', 'limit', $app->getCfg('list_limit'), 'int');
        $pageInfo->limit->start = JRequest::getInt('limitstart', 0);
        $listClass = acymailing_get('class.list');
        $listid = acymailing_getCID('listid');
        if (empty($listid) and !empty($menuparams)) {
            $listid = $menuparams->get('listid');
        }
        if (empty($listid) and acymailing_level(3)) {
            $listClass = acymailing_get('class.list');
            $allAllowedLists = $listClass->getFrontendLists();
            if (!empty($allAllowedLists)) {
                $firstList = reset($allAllowedLists);
                $listid = $firstList->listid;
                JRequest::setVar('listid', $listid);
            }
        }
        if (empty($listid)) {
            return JError::raiseError(404, 'Mailing List not found');
        }
        $oneList = $listClass->get($listid);
        if (empty($oneList->listid)) {
            return JError::raiseError(404, 'Mailing List not found : ' . $listid);
        }
        $access = null;
        $access->frontEndManament = false;
        $access->frontEndAccess = true;
        if (!$access->frontEndManament and (!$oneList->published or !$oneList->visible or !$access->frontEndAccess)) {
            if (empty($my->id)) {
                $uri = JFactory::getURI();
                $url = 'index.php?option=com_user&view=login';
                $url .= '&return=' . base64_encode($uri->toString());
                $app->redirect($url, JText::_('ACY_NOTALLOWED'));
                return false;
            } else {
                $app->enqueueMessage(JText::_('ACY_NOTALLOWED'), 'error');
                $app->redirect(acymailing_completeLink('lists', false, true));
                return false;
            }
        }
        if ($config->get('open_popup')) {
            JHTML::_('behavior.modal', 'a.modal');
        }
        if (!empty($menuparams)) {
            $values->suffix = $menuparams->get('pageclass_sfx', '');
            $values->page_title = $menuparams->get('page_title');
            $values->show_page_title = $menuparams->get('show_page_title', 1);
        } else {
            $values->suffix = '';
            $values->show_page_title = 1;
        }
        $values->show_description = $config->get('show_description', 1);
        $values->show_headings = $config->get('show_headings', 1);
        $values->show_senddate = $config->get('show_senddate', 1);
        $values->filter = $config->get('show_filter', 1);
        if (empty($values->page_title)) {
            $values->page_title = $oneList->name;
        }
        if (empty($menuparams)) {
            $pathway->addItem(JText::_('MAILING_LISTS'), acymailing_completeLink('lists'));
            $pathway->addItem($values->page_title);
        } else {
            $pathway->addItem($values->page_title);
        }
        $document =& JFactory::getDocument();
        $document->setTitle($values->page_title);
        $link = '&format=feed&limitstart=';
        if ($config->get('acyrss_format') == 'rss' || $config->get('acyrss_format') == 'both') {
            $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
            $document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
        }
        if ($config->get('acyrss_format') == 'atom' || $config->get('acyrss_format') == 'both') {
            $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
            $document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);
        }
        $db =& JFactory::getDBO();
        $searchMap = array('a.mailid', 'a.subject', 'a.alias');
        $filters = array();
        if (!empty($pageInfo->search)) {
            $searchVal = '\'%' . $db->getEscaped($pageInfo->search, true) . '%\'';
            $filters[] = implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}";
        }
        $filters[] = 'a.type = \'news\'';
        if (!$access->frontEndManament) {
            $filters[] = 'a.published = 1';
            $filters[] = 'a.visible = 1';
        }
        $filters[] = 'c.listid = ' . $oneList->listid;
        $selection = array_merge($searchMap, array('a.senddate', 'a.created', 'a.visible', 'a.published', 'a.fromname', 'a.fromemail', 'a.replyname', 'a.replyemail', 'a.userid'));
        $query = 'SELECT ' . implode(',', $selection);
        $query .= ' FROM ' . acymailing_table('listmail') . ' as c';
        $query .= ' LEFT JOIN ' . acymailing_table('mail') . ' as a on a.mailid = c.mailid ';
        $query .= ' WHERE (' . implode(') AND (', $filters) . ')';
        $query .= ' ORDER BY ' . acymailing_secureField($pageInfo->filter->order->value) . ' ' . acymailing_secureField($pageInfo->filter->order->dir) . ', c.mailid DESC';
        $db->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value);
        $rows = $db->loadObjectList();
        $pageInfo->elements->page = count($rows);
        if (!empty($pageInfo->search)) {
            $rows = acymailing_search($pageInfo->search, $rows);
        }
        if ($pageInfo->limit->value > $pageInfo->elements->page) {
            $pageInfo->elements->total = $pageInfo->limit->start + $pageInfo->elements->page;
        } else {
            $queryCount = 'SELECT COUNT(c.mailid) FROM ' . acymailing_table('listmail') . ' as c';
            $queryCount .= ' LEFT JOIN ' . acymailing_table('mail') . ' as a on a.mailid = c.mailid ';
            $queryCount .= ' WHERE (' . implode(') AND (', $filters) . ')';
            $db->setQuery($queryCount);
            $pageInfo->elements->total = $db->loadResult();
        }
        jimport('joomla.html.pagination');
        $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value);
        $js = 'function tableOrdering( order, dir, task ){
		var form = document.adminForm;
		form.filter_order.value 	= order;
		form.filter_order_Dir.value	= dir;
		document.adminForm.submit( task );
	}';
        $doc =& JFactory::getDocument();
        $doc->addScriptDeclaration($js);
        $this->assignRef('access', $access);
        $this->assignRef('rows', $rows);
        $this->assignRef('values', $values);
        $this->assignRef('list', $oneList);
        $this->assignRef('pagination', $pagination);
        $this->assignRef('pageInfo', $pageInfo);
        $this->assignRef('config', $config);
        $this->assignRef('my', $my);
    }