function listing() { $app =& JFactory::getApplication(); $pageInfo = null; $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName(); $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.listid', '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); $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 = '\'%' . $database->getEscaped($pageInfo->search) . '%\''; $filters[] = "a.name LIKE {$searchVal} OR a.description LIKE {$searchVal} OR a.listid LIKE {$searchVal}"; } $filters[] = 'a.type = \'campaign\''; if (!empty($selectedCreator)) { $filters[] = 'a.userid = ' . $selectedCreator; } $query = 'SELECT SQL_CALC_FOUND_ROWS 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) . ') '; $query .= ' GROUP BY a.listid'; 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(); $database->setQuery('SELECT FOUND_ROWS()'); $pageInfo->elements->total = $database->loadResult(); if (!empty($pageInfo->search)) { $rows = acymailing::search($pageInfo->search, $rows); } $pageInfo->elements->page = count($rows); $followupClass = acymailing::get('class.listmail'); if (!empty($rows)) { foreach ($rows as $id => $onerow) { $rows[$id]->followup = $followupClass->getFollowup($onerow->listid); } } jimport('joomla.html.pagination'); $pagination = new JPagination($pageInfo->elements->total, $pageInfo->limit->start, $pageInfo->limit->value); acymailing::setTitle(JText::_('CAMPAIGN'), 'campaign', 'campaign'); JToolBarHelper::addNew(); JToolBarHelper::editList(); JToolBarHelper::deleteList(JText::_('VALIDDELETEITEMS', true)); JToolBarHelper::divider(); $bar =& JToolBar::getInstance('toolbar'); $bar->appendButton('Pophelp', 'campaign-listing'); $bar->appendButton('Link', 'acymailing', JText::_('JOOMEXT_CPANEL'), acymailing::completeLink('dashboard')); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->assignRef('pagination', $pagination); $this->assignRef('toggleClass', acymailing::get('helper.toggle')); $this->assignRef('delay', acymailing::get('type.delaydisp')); }
function search($searchString, $object) { if (empty($object) or is_numeric($object)) { return $object; } if (is_string($object) or is_numeric($object)) { return preg_replace('#(' . str_replace('#', '\\#', $searchString) . ')#i', '<span class="searchtext">$1</span>', $object); } if (is_array($object)) { foreach ($object as $key => $element) { $object[$key] = acymailing::search($searchString, $element); } } elseif (is_object($object)) { foreach ($object as $key => $element) { $object->{$key} = acymailing::search($searchString, $element); } } return $object; }
function acymailinghikaserial_show() { if (!$this->init()) { return 'Please install HikaSerial before using the HikaSerial tag plugin'; } $app = JFactory::getApplication(); $contentType = array(); $pageInfo = new stdClass(); $paramBase = ACYMAILING_COMPONENT . '.hikaserial'; $pageInfo->filter->order->value = $app->getUserStateFromRequest($paramBase . ".filter_order", 'filter_order', 'a.pack_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->lang = $app->getUserStateFromRequest($paramBase . ".lang", 'lang', '', 'string'); $pageInfo->contenttype = $app->getUserStateFromRequest($paramBase . ".contenttype", 'contenttype', '|type: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'); $db = JFactory::getDBO(); if (!empty($pageInfo->search)) { $searchVal = '\'%' . $db->getEscaped($pageInfo->search) . '%\''; $filters[] = 'a.pack_id LIKE ' . $searchVal . ' OR a.pack_name LIKE ' . $searchVal . ' OR a.pack_description LIKE ' . $searchVal; } $whereQuery = ''; if (!empty($filters)) { $whereQuery = ' WHERE (' . implode(') AND (', $filters) . ')'; } $query = 'SELECT SQL_CALC_FOUND_ROWS a.* FROM ' . acymailing::table('hikaserial_pack', 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; } $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); ?> <script language="javascript" type="text/javascript"> <!-- function updateTagProd(packid){ tag = '{hikaserial_genpack:'+packid; for(var i=0; i < document.adminForm.contenttype.length; i++){ if (document.adminForm.contenttype[i].checked){ tag += document.adminForm.contenttype[i].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> <?php ?> <table class="adminlist table table-striped" cellpadding="1" width="100%"> <thead> <tr> <th class="title"><?php echo JHTML::_('grid.sort', JText::_('HIKA_NAME'), 'a.pack_name', $pageInfo->filter->order->dir, $pageInfo->filter->order->value); ?> </th> <th class="title titleid"><?php echo JHTML::_('grid.sort', JText::_('ID'), 'a.pack_id', $pageInfo->filter->order->dir, $pageInfo->filter->order->value); ?> </th> </tr> </thead> <tfoot> <tr> <td colspan="3"> <?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->pack_id; ?> " class="row<?php echo $k; ?> " onclick="updateTagProd(<?php echo $row->pack_id; ?> );" style="cursor:pointer;"> <td><?php echo $row->pack_name; ?> </td> <td align="center"><?php echo $row->pack_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 }
function choose() { $pageInfo = null; $app =& JFactory::getApplication(); $paramBase = ACYMAILING_COMPONENT . '.' . $this->getName() . '_' . $this->getLayout(); $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'); $db =& JFactory::getDBO(); $filters = array(); if (!empty($pageInfo->search)) { $searchVal = '\'%' . $db->getEscaped($pageInfo->search, true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $this->searchFieldsChoose) . " LIKE {$searchVal}"; } $query = 'SELECT SQL_CALC_FOUND_ROWS ' . implode(',', $this->selectedFieldsChoose) . ' FROM #__users as a'; 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); $db->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value); $rows = $db->loadObjectList(); $db->setQuery('SELECT FOUND_ROWS()'); $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); }
function acymailingtagvmproduct_show() { $app =& JFactory::getApplication(); $contentType = array(); $contentType[] = JHTML::_('select.option', "|type:title", JText::_('TITLE_ONLY')); $contentType[] = JHTML::_('select.option', "|type:intro", JText::_('INTRO_ONLY')); $contentType[] = JHTML::_('select.option', "|type:full", JText::_('FULL_TEXT')); $pageInfo = null; $paramBase = ACYMAILING_COMPONENT . '.tagvmproduct'; $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'); $pageInfo->search = $app->getUserStateFromRequest($paramBase . ".search", 'search', '', 'string'); $pageInfo->search = JString::strtolower($pageInfo->search); $pageInfo->lang = $app->getUserStateFromRequest($paramBase . ".lang", 'lang', '', 'string'); $pageInfo->contenttype = $app->getUserStateFromRequest($paramBase . ".contenttype", 'contenttype', '|type: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'); $db =& JFactory::getDBO(); if (!empty($pageInfo->search)) { $searchVal = '\'%' . $db->getEscaped($pageInfo->search) . '%\''; $filters[] = "a.product_id LIKE {$searchVal} OR a.product_s_desc LIKE {$searchVal} OR a.product_name LIKE {$searchVal} OR a.product_sku LIKE {$searchVal}"; } $whereQuery = ''; if (!empty($filters)) { $whereQuery = ' WHERE (' . implode(') AND (', $filters) . ')'; } $query = 'SELECT SQL_CALC_FOUND_ROWS a.product_id,a.product_s_desc,a.product_sku,a.product_name FROM ' . acymailing::table('vm_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; } $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); jimport('joomla.html.pane'); $tabs =& JPane::getInstance('tabs'); echo $tabs->startPane('vmproduct_tab'); echo $tabs->startPanel(JText::_('VM_PRODUCT'), 'vm_product'); ?> <script language="javascript" type="text/javascript"> <!-- function updateTag(productid){ tag = '{vmproduct:'+productid; for(var i=0; i < document.adminForm.contenttype.length; i++){ if (document.adminForm.contenttype[i].checked){ tag += document.adminForm.contenttype[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 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> </tr> </table> <table width="100%" class="adminform"> <tr> <td> <?php echo JText::_('DISPLAY'); ?> </td> <td colspan="2"> <?php echo JHTML::_('select.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> </table> <table class="adminlist" cellpadding="1" width="100%"> <thead> <tr> <th class="title"> <?php echo JHTML::_('grid.sort', JText::_('NAME'), 'a.product_name', $pageInfo->filter->order->dir, $pageInfo->filter->order->value); ?> </th> <th class="title"> <?php echo JHTML::_('grid.sort', JText::_('DESCRIPTION'), 'a.product_s_desc', $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="3"> <?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="updateTag(<?php echo $row->product_id; ?> );" style="cursor:pointer;"> <td> <?php echo acymailing::tooltip('SKU : ' . $row->product_sku, $row->product_name, '', $row->product_name); ?> </td> <td> <?php echo $row->product_s_desc; ?> </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::_('TAG_CATEGORIES'), 'vm_auto'); $type = JRequest::getString('type'); $db->setQuery('SELECT a.*,b.* FROM `#__vm_category` as a LEFT JOIN `#__vm_category_xref` as b ON a.category_id = b.category_child_id ORDER BY `list_order`'); $categories = $db->loadObjectList('category_id'); $this->cats = array(); foreach ($categories as $oneCat) { $this->cats[$oneCat->category_parent_id][] = $oneCat; } $ordering = array(); $ordering[] = JHTML::_('select.option', "|order:product_id,DESC", JText::_('ID')); $ordering[] = JHTML::_('select.option', "|order:cdate,DESC", JText::_('CREATED_DATE')); $ordering[] = JHTML::_('select.option', "|order:mdate,DESC", JText::_('MODIFIED_DATE')); $ordering[] = JHTML::_('select.option', "|order:product_name,ASC", JText::_('TITLE')); ?> <script language="javascript" type="text/javascript"> <!-- var selectedCat = new Array(); function applyAutoProduct(catid,rowClass){ 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(){ tag = '{autovmproduct:'; 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 += 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 += document.adminForm.contentorder.value; } if(document.adminForm.contentfilter && document.adminForm.contentfilter.value){ tag += document.adminForm.contentfilter.value; } if(window.document.getElementById('jflangvm') && window.document.getElementById('jflangvm').value != ''){ tag += '|lang:'; tag += window.document.getElementById('jflangvm').value; } tag += '}'; setTag(tag); } //--> </script> <table width="100%" class="adminform"> <tr> <td> <?php echo JText::_('DISPLAY'); ?> </td> <td colspan="2"> <?php echo JHTML::_('select.radiolist', $contentType, 'contenttypeauto', 'size="1" onclick="updateTagAuto();"', 'value', 'text', '|type:full'); ?> </td> <td> <?php $jflanguages = acymailing::get('type.jflanguages'); if (!empty($jflanguages->values)) { $jflanguages->id = 'jflangvm'; $jflanguages->onclick = 'onchange="updateTagAuto();"'; echo $jflanguages->display('language'); } ?> </td> </tr> <tr> <td> <?php echo JText::_('MAX_ARTICLE'); ?> </td> <td> <input name="max_article" size="10" value="" onchange="updateTagAuto();"/> </td> <td> <?php echo JText::_('ORDER BY'); ?> </td> <td> <?php echo JHTML::_('select.genericlist', $ordering, 'contentorder', 'size="1" onchange="updateTagAuto();"'); ?> </td> </tr> <?php if ($type == 'autonews') { ?> <tr> <td> <?php echo JText::_('MIN_ARTICLE'); ?> </td> <td> <input name="min_article" size="10" 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', '|filter:created'); ?> </td> </tr> <?php } ?> </table> <table class="adminlist" cellpadding="1" width="100%"> <?php $k = 0; echo $this->displayChildren(0, $k); ?> </table> <?php echo $tabs->endPanel(); echo $tabs->endPane(); }
function listing() { global $Itemid; $app =& JFactory::getApplication(); $my =& JFactory::getUser(); $pathway =& $app->getPathway(); $values = null; $menus =& JSite::getMenu(); $menu = $menus->getActive(); if (empty($menu) and !empty($Itemid)) { $menus->setActive($Itemid); $menu = $menus->getItem($Itemid); } if (is_object($menu)) { $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)) { 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 (acymailing::level(3)) { if (!empty($my->id) and (int) $my->id == (int) $oneList->userid) { $access->frontEndManament = true; } if (!empty($my->gid) and !empty($my->id)) { if ($oneList->access_manage == 'all' or in_array($my->gid, explode(',', $oneList->access_manage))) { $access->frontEndManament = true; } } if ($oneList->access_sub != 'all' and ($oneList->access_sub == 'none' or empty($my->gid) or empty($my->id) or !in_array($my->gid, explode(',', $oneList->access_sub)))) { $access->frontEndAccess = false; } if ($access->frontEndManament) { JHTML::_('behavior.modal', 'a.modal'); } } if (!$access->frontEndManament and (!$oneList->published or !$oneList->visible or !$access->frontEndAccess)) { return JError::raiseError(404, 'Mailing List not accessible : ' . $listid); } 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; } $config = acymailing::config(); $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); $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.visible', 'a.published', 'a.fromname', 'a.fromemail', 'a.replyname', 'a.replyemail', 'a.userid')); $query = 'SELECT SQL_CALC_FOUND_ROWS ' . 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); $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); $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); }
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', '|type:intro', 'string'); $pageInfo->author = $app->getUserStateFromRequest($paramBase . ".author", 'author', '', 'string'); $pageInfo->titlelink = $app->getUserStateFromRequest($paramBase . ".titlelink", 'titlelink', '|link', 'string'); $pageInfo->lang = $app->getUserStateFromRequest($paramBase . ".lang", 'lang', '', 'string'); $pageInfo->pict = $app->getUserStateFromRequest($paramBase . ".pict", '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 (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"> <?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="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->id; ?> " class="<?php echo "row{$k}"; ?> " onclick="applyContent(<?php echo $row->id . ",'row{$k}'"; ?> );" style="cursor:pointer;"> <td> <?php $text = '<b>' . JText::_('ALIAS', true) . ': </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(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', '|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', '|link'); ?> </td> <td> <?php echo JText::_('AUTHOR_NAME'); ?> </td> <td> <?php $authorname = acymailing::get('type.authorname'); $authorname->onclick = "updateAutoTag();"; echo $authorname->display('authorauto', ''); ?> </td> </tr> <tr> <td><?php echo JText::_('DISPLAY_PICTURES'); ?> </td> <td><?php echo JHTML::_('select.radiolist', $picts, 'pictauto', 'size="1" onclick="updateAutoTag();"', 'value', 'text', "1"); ?> </td> <td></td> <td></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> <?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 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 style="font-weight: bold;"> <?php echo $row->section; ?> </td> <td style="text-align:center;font-weight: bold;"> <?php echo JText::_('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> </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> <?php echo $row->title; ?> </td> </tr> <?php } $k = 1 - $k; } ?> </tbody> </table> <?php echo $tabs->endPanel(); echo $tabs->endPane(); }
function listing() { $app =& JFactory::getApplication(); $pageInfo = null; 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 = '\'%' . $database->getEscaped($pageInfo->search, true) . '%\''; $filters[] = implode(" LIKE {$searchVal} OR ", $this->searchFields) . " LIKE {$searchVal}"; } $query = 'SELECT SQL_CALC_FOUND_ROWS ' . implode(' , ', $this->selectFields); $query .= ' FROM ' . acymailing::table('stats') . ' as a'; $query .= ' LEFT 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(); $database->setQuery('SELECT FOUND_ROWS()'); $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'); if (acymailing::level(1)) { $bar->appendButton('Link', 'stats', JText::_('CHARTS'), acymailing::completeLink('diagram')); } JToolBarHelper::spacer(); JToolBarHelper::spacer(); JToolBarHelper::deleteList(JText::_('VALIDDELETEITEMS')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'stats-listing'); $bar->appendButton('Link', 'acymailing', JText::_('JOOMEXT_CPANEL'), acymailing::completeLink('dashboard')); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->assignRef('pagination', $pagination); }
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); }
} $query = 'SELECT SQL_CALC_FOUND_ROWS ' . implode(' , ', $this->detailSelectFields); $query .= ' FROM ' . acymailing::table('urlclick') . ' as a'; $query .= ' LEFT JOIN ' . acymailing::table('mail') . ' as b on a.mailid = b.mailid'; $query .= ' LEFT JOIN ' . acymailing::table('url') . ' as c on a.urlid = c.urlid'; $query .= ' LEFT JOIN ' . acymailing::table('subscriber') . ' as d on a.subid = d.subid'; 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(); $database->setQuery('SELECT FOUND_ROWS()'); $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); $filtersType = null; $mailType = acymailing::get('type.urlmail'); $urlType = acymailing::get('type.url'); $filtersType->mail = $mailType->display('filter_mail', $selectedMail); $filtersType->url = $urlType->display('filter_url', $selectedUrl); $this->assignRef('filters', $filtersType); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->assignRef('pagination', $pagination);
function listing() { $app =& JFactory::getApplication(); $pageInfo = null; $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.subject', 'a.fromname', 'a.fromemail', 'a.replyname', 'a.replyemail', 'a.userid', 'b.name', 'b.username', 'b.email'); $filters = array(); if (!empty($pageInfo->search)) { $searchVal = '\'%' . $database->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 SQL_CALC_FOUND_ROWS ' . implode(',', $selection) . ' FROM ' . acymailing::table('mail') . ' as a'; } else { $query = 'SELECT SQL_CALC_FOUND_ROWS ' . implode(',', $selection) . ' FROM ' . acymailing::table('listmail') . ' as c'; $query .= ' LEFT 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; } $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value); $rows = $database->loadObjectList(); if (!empty($pageInfo->search)) { $rows = acymailing::search($pageInfo->search, $rows); } $database->setQuery('SELECT FOUND_ROWS()'); $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::_('PREVIEW'); if ($this->type == 'autonews') { JToolBarHelper::custom('generate', 'process', '', JText::_('GENERATE'), false); } elseif ($this->type == 'news') { $buttonPreview .= ' / ' . JText::_('SEND'); } JToolBarHelper::custom('preview', 'preview', '', $buttonPreview); JToolBarHelper::divider(); JToolBarHelper::addNew(); JToolBarHelper::editList(); JToolBarHelper::deleteList(JText::_('VALIDDELETEITEMS')); JToolBarHelper::spacer(); JToolBarHelper::custom('copy', 'copy.png', 'copy.png', JText::_('COPY')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', $this->ctrl . '-listing'); $bar->appendButton('Link', 'acymailing', JText::_('JOOMEXT_CPANEL'), acymailing::completeLink('dashboard')); $filters = null; $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); $toggleClass = acymailing::get('helper.toggle'); $this->assignRef('filters', $filters); $this->assignRef('toggleClass', $toggleClass); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->assignRef('pagination', $pagination); $this->assignRef('delay', acymailing::get('type.delaydisp')); $this->assignRef('config', acymailing::config()); }
function listing() { $app =& JFactory::getApplication(); $pageInfo = null; $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 = '\'%' . $database->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 SQL_CALC_FOUND_ROWS 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) . ')'; $query .= ' GROUP BY a.listid'; 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(); $database->setQuery('SELECT FOUND_ROWS()'); $pageInfo->elements->total = $database->loadResult(); $listids = array(); foreach ($rows as $oneRow) { $listids[] = $oneRow->listid; } if (!empty($listids)) { $querySelectSub = 'SELECT count(distinct subid) as nbsub,listid FROM ' . acymailing::table('listsub') . ' WHERE listid IN (' . implode(',', $listids) . ') AND status = 1 GROUP BY listid'; $querySelectUnsub = 'SELECT count(distinct subid) as nbunsub,listid FROM ' . acymailing::table('listsub') . ' WHERE listid IN (' . implode(',', $listids) . ') AND status = -1 GROUP BY listid'; $querySelectWaiting = 'SELECT count(distinct subid) as nbwait,listid FROM ' . acymailing::table('listsub') . ' WHERE listid IN (' . implode(',', $listids) . ') AND status = 2 GROUP BY listid'; $database->setQuery($querySelectSub); $subinfos = $database->loadObjectList('listid'); $database->setQuery($querySelectUnsub); $unsubinfos = $database->loadObjectList('listid'); $database->setQuery($querySelectWaiting); $waitinfos = $database->loadObjectList('listid'); } foreach ($rows as $i => $oneRow) { $rows[$i]->nbsub = empty($subinfos[$oneRow->listid]) ? 0 : $subinfos[$oneRow->listid]->nbsub; $rows[$i]->nbunsub = empty($unsubinfos[$oneRow->listid]) ? 0 : $unsubinfos[$oneRow->listid]->nbunsub; $rows[$i]->nbwait = empty($waitinfos[$oneRow->listid]) ? 0 : $waitinfos[$oneRow->listid]->nbwait; } 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'), 'categories', 'list'); $bar =& JToolBar::getInstance('toolbar'); $bar->appendButton('Link', 'import', JText::_('SUB_USERS'), acymailing::completeLink('list&task=addusers')); JToolBarHelper::divider(); JToolBarHelper::addNew(); JToolBarHelper::editList(); JToolBarHelper::deleteList(JText::_('VALIDDELETEITEMS')); JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'list-listing'); $bar->appendButton('Link', 'acymailing', JText::_('JOOMEXT_CPANEL'), acymailing::completeLink('dashboard')); $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; } } $filters = null; $listcreatorType = acymailing::get('type.listcreator'); $filters->creator = $listcreatorType->display('filter_creator', $selectedCreator); $this->assignRef('filters', $filters); $this->assignRef('order', $order); $this->assignRef('toggleClass', acymailing::get('helper.toggle')); $this->assignRef('rows', $rows); $this->assignRef('pageInfo', $pageInfo); $this->assignRef('pagination', $pagination); }
function listing() { $app =& JFactory::getApplication(); $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', '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 = '\'%' . $database->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 .= ' LEFT JOIN ' . acymailing::table('subscriber') . ' as b on a.subid = b.subid'; $query .= ' LEFT 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'; } $database->setQuery($query, $pageInfo->limit->start, $pageInfo->limit->value); $rows = $database->loadObjectList(); $queryCount = 'SELECT COUNT(a.mailid) FROM ' . acymailing::table('queue') . ' as a'; if (!empty($filters)) { $queryCount .= ' LEFT JOIN ' . acymailing::table('subscriber') . ' as b on a.subid = b.subid'; $queryCount .= ' LEFT JOIN ' . acymailing::table('mail') . ' as c on a.mailid = c.mailid'; $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); $mailqueuetype = acymailing::get('type.queuemail'); $filtersType = null; $filtersType->mail = $mailqueuetype->display('filter_mail', $selectedMail); acymailing::setTitle(JText::_('QUEUE'), 'process', 'queue'); $bar =& JToolBar::getInstance('toolbar'); $bar->appendButton('Popup', 'process', JText::_('PROCESS'), acymailing::completeLink("queue&task=process&mailid=" . $selectedMail, true)); if (!empty($pageInfo->elements->total)) { JToolBarHelper::spacer(); JToolBarHelper::spacer(); $bar->appendButton('Confirm', JText::sprintf('CONFIRM_DELETE_QUEUE', $pageInfo->elements->total), 'delete', JText::_('DELETE'), 'remove', false, false); } JToolBarHelper::divider(); $bar->appendButton('Pophelp', 'queue-listing'); $bar->appendButton('Link', 'acymailing', JText::_('JOOMEXT_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); }