Exemplo n.º 1
0
 function getDisplayTab($tab, $user, $ui)
 {
     global $my, $_CB_framework;
     $lang = JFactory::getLanguage();
     $lang->load('plg_cbninjaboard');
     $return = null;
     $params = $this->params;
     //get parameters (plugin and related tab)
     $nbPlugEnabled = $params->get('nbPlugEnabled', "1");
     if ($nbPlugEnabled) {
         JHTML::stylesheet('ninjaboard.css', 'components/com_comprofiler/plugin/user/plug_cbninjaboard/');
         //get parameters
         $nbPlugShowSubject = $params->get('nbPlugShowSubject', "1");
         $nbPlugTruncateSubject = $params->get('nbPlugTruncateSubject', "25");
         $nbPlugShowMessage = $params->get('nbPlugShowMessage', "1");
         $nbPlugTruncateMessage = $params->get('nbPlugTruncateMessage', "50");
         $nbPlugShowForum = $params->get('nbPlugShowForum', "1");
         $nbPlugShowHits = $params->get('nbPlugShowHits', "1");
         $nbPlugShowCreated = $params->get('nbPlugShowCreated', "1");
         $nbPlugShowModified = $params->get('nbPlugShowModified', "1");
         $nbPlugDateFormat = $params->get('nbPlugDateFormat', "D, d M");
         $nbPlugShowEdit = $params->get('nbPlugShowEdit', "1");
         $nbPlugSortBy = $params->get('nbPlugSortBy', "1");
         $nbPlugSortOrder = $params->get('nbPlugSortOrder', "DESC");
         $nbPlugShowPagination = $params->get('nbPlugShowPagination', "1");
         $nbPlugPaginationCount = $params->get('nbPlugPaginationCount', "5");
         $limit = $nbPlugPaginationCount > 0 ? $nbPlugPaginationCount : 0;
         $offset = JRequest::getVar('limitstart', 0, 'REQUEST');
         //get current user
         $userId = $user->id;
         //get user posts
         $rows = $this->getPosts($userId, $nbPlugSortBy, $nbPlugSortOrder, $nbPlugPaginationCount, $limit, $offset);
         //get user post count
         $row_count = $this->countPosts($userId);
         //get item id
         $itemId = $this->getItemId();
         //create_html
         if ($row_count <= 0) {
             $list = '<div class="cbNinjaBoard"><div class="cbNBposts"><table><tr><td>You currently have no NinjaBoard posts</td></tr></table></div></div>';
         } else {
             $list = "";
             //show only selected fields in a table row
             $list .= '<div class="cbNinjaBoard"><div class="cbNBposts"><table><thead><tr>';
             if ($nbPlugShowSubject) {
                 $list .= '<th>' . JText::_('NB_SUBJECT_CBP') . '</th>';
             }
             if ($nbPlugShowMessage) {
                 $list .= '<th>' . JText::_('NB_MESSAGE_CBP') . '</th>';
             }
             if ($nbPlugShowForum) {
                 $list .= '<th>' . JText::_('NB_FORUM_CBP') . '</th>';
             }
             if ($nbPlugShowHits) {
                 $list .= '<th>' . JText::_('NB_HITS_CBP') . '</th>';
             }
             if ($nbPlugShowCreated) {
                 $list .= '<th>' . JText::_('NB_CREATED_CBP') . '</th>';
             }
             if ($nbPlugShowModified) {
                 $list .= '<th>' . JText::_('NB_MODIFIED_CBP') . '</th>';
             }
             if ($nbPlugShowEdit) {
                 $list .= '<th>' . JText::_('NB_VIEW_POST_CBP') . '</th>';
             }
             $list .= '</tr></thead><tbody>';
             $items = array();
             foreach ($rows as $row) {
                 //get the item subject, show no subject if there is none, truncate subject if necessary
                 $item->subject_long = stripslashes($row->subject) ? stripslashes($row->subject) : JText::_('NB_NO_SUBJECT_CBP');
                 $item->subject_short = JString::strlen($row->subject) > $nbPlugTruncateSubject ? JString::substr($row->subject, 0, $nbPlugTruncateSubject - 4) . '...' : $item->subject_long;
                 $item->subject = $nbPlugTruncateSubject > 0 ? $item->subject_short : $item->subject_long;
                 //get the item message, show no message if there is none, truncate message if necessary
                 $item->message_long = stripslashes($row->message) ? stripslashes($row->message) : JText::_('NB_NO_MESSAGE_CBP');
                 $item->message_short = JString::strlen($row->message) > $nbPlugTruncateMessage ? JString::substr($row->message, 0, $nbPlugTruncateMessage - 4) . '...' : $item->message_long;
                 $item->unparsed = $nbPlugTruncateMessage > 0 ? $item->message_short : $item->message_long;
                 $item->message = KFactory::get('admin::com.ninja.helper.bbcode')->parse(array('text' => $item->unparsed));
                 //link to edit post
                 $item->view_link = '<a href="' . (JURI::base() . 'index.php?option=com_ninjaboard&view=topic&id=' . $row->topic_id . '&Itemid=' . $itemId . '#post' . $row->post_id) . '" title="' . JText::_('NB_VIEW_POST_CBP') . '">' . '<img src="' . JURI::base() . 'components/com_comprofiler/plugin/user/plug_cbninjaboard/post.png" width="32" height="32" alt="' . JText::_('NB_VIEW_POST_CBP') . '" />' . '</a>';
                 //link to forum
                 $item->forum_link = '<a href="' . (JURI::base() . 'index.php?option=com_ninjaboard&view=forum&id=' . $row->forum_id . '&Itemid=' . $itemId) . '" title="' . JText::_($row->forum_name) . '">' . JText::_($row->forum_name) . '</a>';
                 //format dates
                 $item->c_datetime = $row->created > 0 ? date($nbPlugDateFormat, strtotime($row->created)) : JText::_('NB_NO_DATE_CBP');
                 $item->m_datetime = $row->modified > 0 ? date($nbPlugDateFormat, strtotime($row->modified)) : JText::_('NB_NO_DATE_CBP');
                 //show only selected fields in a table row
                 $list .= '<tr>';
                 if ($nbPlugShowSubject) {
                     $list .= '<td>' . $item->subject . '</td>';
                 }
                 if ($nbPlugShowMessage) {
                     $list .= '<td>' . $item->message . '</td>';
                 }
                 if ($nbPlugShowForum) {
                     $list .= '<td>' . $item->forum_link . '</td>';
                 }
                 if ($nbPlugShowHits) {
                     $list .= '<td>' . $row->hits . '</td>';
                 }
                 if ($nbPlugShowCreated) {
                     $list .= '<td>' . $item->c_datetime . '</td>';
                 }
                 if ($nbPlugShowModified) {
                     $list .= '<td>' . $item->m_datetime . '</td>';
                 }
                 if ($nbPlugShowEdit) {
                     $list .= '<td>' . $item->view_link . '</td>';
                 }
                 $list .= '</tr>';
             }
             $list .= '</table></div>';
             if ($nbPlugShowPagination && $row_count > $limit) {
                 $list .= '<div class="cbNBpagination"><table><tr><td>';
                 //$list .= KFactory::get('site::com.ninjaboard.helper.paginator',array('name' => 'posts'))->pagination($row_count, $offset, $limit , 4, true);
                 jimport('joomla.html.pagination');
                 $pagination = new JPagination($row_count, $offset, $limit);
                 $list .= $pagination->getPagesLinks() . $pagination->getResultsCounter();
                 $list .= '</td></tr></table></div>';
             }
             $list .= '</div>';
         }
         return $list;
     }
 }
Exemplo n.º 2
0
    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 
    }
Exemplo n.º 3
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();
    }
Exemplo n.º 4
0
    function productDisplay()
    {
        $app = JFactory::getApplication();
        $db = JFactory::getDBO();
        $editor_name = JRequest::getString('editor_name', 'jform_articletext');
        $pageInfo = new stdClass();
        $pageInfo->limit = new stdClass();
        $pageInfo->search = $app->getUserStateFromRequest("com_content.productbutton.search", 'search', '', 'string');
        $pageInfo->search = JString::strtolower(trim($pageInfo->search));
        $pageInfo->limit->value = $app->getUserStateFromRequest('com_content.productbutton.limit', 'limit', $app->getCfg('list_limit'), 'int');
        $pageInfo->limit->start = $app->getUserStateFromRequest('com_content.productbutton.limitstart', 'limitstart', 0, 'int');
        if (JRequest::getVar('search') != $app->getUserState('com_content.productbutton.search') || JRequest::getVar('limit') != $app->getUserState('com_content.productbutton.limit')) {
            $pageInfo->limit->start = 0;
            $app->setUserState('com_content.productbutton.limitstart', 0);
        }
        $Select = 'SELECT * FROM ' . hikashop_table('product');
        $Where = ' WHERE product_type=\'main\' AND product_access=\'all\' AND product_published=1 ';
        $orderBY = ' ORDER BY product_id ASC';
        $searchMap = array('product_name', 'product_code', 'product_id');
        $filters = array();
        if (!empty($pageInfo->search)) {
            $searchVal = '\'%' . hikashop_getEscaped(JString::strtolower(trim($pageInfo->search)), true) . '%\'';
            $filter = '(' . implode(" LIKE {$searchVal} OR ", $searchMap) . " LIKE {$searchVal}" . ')';
            $filters[] = $filter;
        }
        if (is_array($filters) && count($filters)) {
            $filters = ' AND ' . implode(' AND ', $filters);
        } else {
            $filters = '';
        }
        $db->setQuery($Select . $Where . $filters . $orderBY, (int) $pageInfo->limit->start, (int) $pageInfo->limit->value);
        $products = $db->loadObjectList();
        $db->setQuery('SELECT COUNT(product_id) FROM ' . hikashop_table('product') . ' WHERE product_type=\'main\' AND product_access=\'all\' AND product_published=1' . $filters);
        $nbrow = $db->loadResult();
        $db->setQuery('SELECT * FROM ' . hikashop_table('price') . ' ORDER BY price_product_id ASC');
        $prices = $db->loadObjectList();
        if (HIKASHOP_J30) {
            $pagination = hikashop_get('helper.pagination', $nbrow, $pageInfo->limit->start, $pageInfo->limit->value);
        } else {
            jimport('joomla.html.pagination');
            $pagination = new JPagination($nbrow, $pageInfo->limit->start, $pageInfo->limit->value);
        }
        $scriptV1 = "function insertTag(tag){ window.parent.jInsertEditorText(tag,'text'); return true;}";
        $scriptV2 = "function insertTag(tag){ window.parent.jInsertEditorText(tag,'" . str_replace(array('\\', '\''), array('\\\\', '\\\''), $editor_name) . "'); return true;}";
        if (!HIKASHOP_PHP5) {
            $doc =& JFactory::getDocument();
        } else {
            $doc = JFactory::getDocument();
        }
        if (version_compare(JVERSION, '1.6.0', '<')) {
            $doc->addScriptDeclaration($scriptV1);
        } else {
            $doc->addScriptDeclaration($scriptV2);
        }
        $config =& hikashop_config();
        $pricetaxType = hikashop_get('type.pricetax');
        $discountDisplayType = hikashop_get('type.discount_display');
        ?>
	<script language="JavaScript" type="text/javascript">
		function divhidder(){
			if (document.getElementById('price').checked) {
				document.getElementById('Priceopt').style.visibility = 'visible';
			}
			else {
				document.getElementById('Priceopt').style.visibility = 'hidden';
			}
		}
		function checkSelect(){
			form = document.getElementById('adminForm');
			inputs = form.getElementsByTagName('input');
			nbbox = 0;
			nbboxOk = 0;
			nbboxProd = 0;
			for(i=0 ; i < inputs.length ; i++){
				if(inputs[i].type == 'checkbox' && inputs[i].checked==true){
					nbbox++;
				}
			}
			for(i=0 ; i < inputs.length ; i++){
				if(inputs[i].type == 'checkbox' && inputs[i].checked==true){
					nbboxOk++;
					if(inputs[i].id.match(/product_checkbox.*/)){
						if (nbboxProd == 0)
							document.getElementById('product_insert').value = '{product ';
						nbboxProd++;
						document.getElementById('product_insert').value = document.getElementById('product_insert').value +  inputs[i].name;
						if(nbbox > nbboxOk){
							document.getElementById('product_insert').value = document.getElementById('product_insert').value + '|';
						}
					}
				}
			}
			if( nbboxProd > 0 )
			{
				if(document.getElementById('name').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|name';
				}
				if(document.getElementById('cart').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|cart';
				}
				if(document.getElementById('quantityfield').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|quantityfield';
				}
				if(document.getElementById('description').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|description';
				}
				if(document.getElementById('picture').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|picture';
				}
				if(document.getElementById('link').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|link';
				}
				if(document.getElementById('border').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|border';
				}
				if(document.getElementById('badge').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|badge';
				}
				if(document.getElementById('menuid').value.length != 0){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|menuid:' + document.getElementById('menuid').value;
				}
				if(document.getElementById('pricedisc').value==1 && document.getElementById('price').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|pricedis1';
				}
				if(document.getElementById('pricedisc').value==2 && document.getElementById('price').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|pricedis2';
				}
				if(document.getElementById('pricedisc').value==3 && document.getElementById('price').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|pricedis3';
				}
				if(document.getElementById('pricetax').value==1 && document.getElementById('price').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|pricetax1';
				}
				if(document.getElementById('pricetax').value==2 && document.getElementById('price').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|pricetax2';
				}
				if(document.getElementById('pricedisc').value==0 && document.getElementById('pricetax').value==0 && document.getElementById('price').checked==true){
					document.getElementById('product_insert').value =document.getElementById('product_insert').value +  '|price';
				}
				document.getElementById('product_insert').value=document.getElementById('product_insert').value + '}';
			}
			if(document.getElementById('name').checked==false
			&& document.getElementById('price').checked==false
			&& document.getElementById('cart').checked==false
			&& document.getElementById('description').checked==false
			&& document.getElementById('picture').checked==false){
				document.getElementById('product_insert').value='';
			}
		}
		function checkAllBox(){
			var checkAll = document.getElementById('checkAll');
			var toCheck = document.getElementById('ToCheck').getElementsByTagName('input');
			for (i = 0 ; i < toCheck.length ; i++) {
				if (toCheck[i].type == 'checkbox') {
					if(checkAll.checked == true){
						toCheck[i].checked = true;
					}else{
						toCheck[i].checked = false;
					}
				}
			}
		}
	</script>
	<form action="<?php 
        echo hikashop_currentURL();
        ?>
" method="POST" name="adminForm" id="adminForm">
		<table class="hikashop_no_border">
			<tr>
				<td width="100%">
					<?php 
        echo JText::_('FILTER');
        ?>
:
					<input type="text" name="search" id="hikashop_search" value="<?php 
        echo hikashop_getEscaped($pageInfo->search);
        ?>
" class="inputbox" onchange="document.adminForm.submit();" />
					<button class="btn" onclick="this.form.submit();"><?php 
        echo JText::_('GO');
        ?>
</button>
					<button class="btn" onclick="document.getElementById('hikashop_search').value='';this.form.submit();"><?php 
        echo JText::_('RESET');
        ?>
</button>
				</td>
			</tr>
		</table>
		<fieldset>
			<legend>OPTIONS</legend>
			<div id="productInsertOptions">
				<input type="checkbox" name="name" id="name" value="1" checked/><?php 
        echo JText::_('HIKA_NAME');
        ?>
				<input type="checkbox" name="description" id="description" value="1" checked/><?php 
        echo JText::_('PRODUCT_DESCRIPTION');
        ?>
				<input type="checkbox" name="cart" id="cart" value="1" <?php 
        if (!empty($_REQUEST['cart'])) {
            echo 'checked';
        }
        ?>
 /><?php 
        echo JText::_('HIKASHOP_CHECKOUT_CART');
        ?>
				<input type="checkbox" name="quantity" id="quantityfield" value="1" <?php 
        if (!empty($_REQUEST['quantityfield'])) {
            echo 'checked';
        }
        ?>
 /><?php 
        echo JText::_('HIKA_QUANTITY_FIELD');
        ?>
				<input type="checkbox" name="picture" id="picture" value="1" <?php 
        if (!empty($_REQUEST['picture'])) {
            echo 'checked';
        }
        ?>
/><?php 
        echo JText::_('HIKA_IMAGE');
        ?>
				<input type="checkbox" name="link" id="link" value="1" <?php 
        if (!empty($_REQUEST['link'])) {
            echo 'checked';
        }
        ?>
/><?php 
        echo JText::_('LINK_TO_PRODUCT_PAGE');
        ?>
				<input type="checkbox" name="border" id="border" value="1" <?php 
        if (!empty($_REQUEST['border'])) {
            echo 'checked';
        }
        ?>
 /><?php 
        echo JText::_('ITEM_BOX_BORDER');
        ?>
				<input type="checkbox" name="badge" id="badge" value="1" <?php 
        if (!empty($_REQUEST['badge'])) {
            echo 'checked';
        }
        ?>
 /><?php 
        echo JText::_('HIKA_BADGE');
        ?>
				<br/>
				Menu ID : <input type="text" name="menuid" id="menuid"  <?php 
        if (!empty($_REQUEST['menuid'])) {
            echo 'value="' . $_REQUEST['menuid'] . '"';
        }
        ?>
 />
				<input type="checkbox" name="pricetax" id="pricetax" value="<?php 
        echo $config->get('price_with_tax');
        ?>
" hidden/>
				<br/>
				<input type="checkbox" name="price" id="price" value="1" checked onclick="divhidder()"/><?php 
        echo JText::_('DISPLAY_PRICE');
        ?>
				<br/>
				<div id="Priceopt">
				<tr id="show_discount_line">
					<td class="key" valign="top">
						<?php 
        echo JText::_('SHOW_DISCOUNTED_PRICE');
        ?>
					</td>
					<td>
						<?php 
        $default_params = $config->get('default_params');
        echo $discountDisplayType->display('pricedisc', 3);
        ?>
					</td>
				</tr>
				<div>
				</div>
		</fieldset>
			<fieldset>
			<table class="adminlist table table-striped" cellpadding="1" width="100%">
				<thead>
					<tr>
						<th class="title titlenum">
							<?php 
        echo JText::_('HIKA_NUM');
        ?>
						</th>
						<th class="title titlebox">
							<input type="checkbox" name="checkAll" id="checkAll" value="" onclick="checkAllBox();"/>
						</th>
						<th class="title">
							<?php 
        echo JText::_('HIKA_NAME');
        ?>
						</th>
						<th class="title">
							<?php 
        echo JText::_('PRODUCT_PRICE');
        ?>
						</th>
						<th class="title">
							<?php 
        echo JText::_('PRODUCT_QUANTITY');
        ?>
						</th>
						<th class="title">
							<?php 
        echo 'ID';
        ?>
						</th>
					</tr>
				</thead>
				<tbody id="ToCheck">
					<?php 
        $i = 0;
        $row = '';
        $currencyClass = hikashop_get('class.currency');
        $currencies = new stdClass();
        $currency_symbol = '';
        foreach ($products as $product) {
            $i++;
            $row .= '<tr><td class="title titlenum">';
            $row .= $i;
            $row .= '</td><td class="title titlebox"><input type="checkbox" id="product_checkbox' . $product->product_id . '" name="' . $product->product_id;
            $row .= '" value=""/></td><td class="center">';
            $row .= $product->product_name;
            $row .= '</td><td class="center">';
            foreach ($prices as $price) {
                if ($price->price_product_id == $product->product_id) {
                    $row .= $price->price_value;
                    $currency = $currencyClass->getCurrencies($price->price_currency_id, $currencies);
                    foreach ($currency as $currrencie) {
                        if ($price->price_currency_id == $currrencie->currency_id) {
                            $currency_symbol = $currrencie->currency_symbol;
                        }
                    }
                    $row .= ' ' . $currency_symbol;
                }
            }
            $row .= '</td><td class="center">';
            if ($product->product_quantity > -1) {
                $row .= $product->product_quantity;
            } else {
                $row .= JText::_('UNLIMITED');
            }
            $row .= '</td><td class="center">';
            $row .= $product->product_id;
            $row .= '</td></tr>';
        }
        echo $row;
        ?>
				</tbody>
				<tfoot>
					<tr>
						<td colspan="7">
							<?php 
        echo $pagination->getListFooter();
        ?>
							<?php 
        echo $pagination->getResultsCounter();
        ?>
						</td>
					</tr>
				</tfoot>
			</table>
		</fieldset>
		<input type="hidden" name="product_insert" id="product_insert" value="" />
		<button class="btn" onclick="checkSelect(); insertTag(document.getElementById('product_insert').value); window.parent.SqueezeBox.close();"><?php 
        echo JText::_('HIKA_INSERT');
        ?>
</button>
		<?php 
        global $Itemid;
        ?>
		<input type="hidden" name="Itemid" value="<?php 
        echo $Itemid;
        ?>
"/>
		<?php 
        echo JHTML::_('form.token');
    }
Exemplo n.º 5
0
    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();
    }
Exemplo n.º 6
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();
    }
Exemplo n.º 7
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', '|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();
    }
Exemplo n.º 8
0
    function communitysurveys_show()
    {
        $db = JFactory::getDbo();
        $app = JFactory::getApplication();
        $limitstart = $app->getUserStateFromRequest(S_APP_NAME . '.acysurveys.limitstart', 'limitstart', 0, 'int');
        $limit = $app->input->getInt('limit', 20);
        $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
        $content = '';
        $paramBase = S_APP_NAME . '.acysurveys';
        $pageInfo = new stdClass();
        $pageInfo->filter->order = $pageInfo->filter = new stdClass();
        $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);
        $query = '
				select 
					a.id, a.title, a.alias, a.created_by, a.created, u.name, u.username
				from
					#__survey a
				left join
					#__users u on a.created_by = u.id
				where
					a.published = 1
				order by
					a.created desc';
        $db->setQuery($query, $limitstart, $limit);
        $surveys = $db->loadObjectList();
        if (!empty($surveys)) {
            $query = 'select count(*) from #__survey a where a.published = 1';
            jimport('joomla.html.pagination');
            $db->setQuery($query);
            $total = $db->loadResult();
            $pagination = new JPagination($total, $limitstart, $limit);
            $content = '
						<table class="adminlist table table-striped table-hover" cellpadding="1" width="100%">
							<thead>
								<tr>
									<th class="title">' . JHTML::_('grid.sort', JText::_('FIELD_TITLE'), 'a.title', $pageInfo->filter->order->dir, $pageInfo->filter->order->value) . '</th>
									<th class="title">' . JHTML::_('grid.sort', JText::_('ACY_AUTHOR'), 'b.name', $pageInfo->filter->order->dir, $pageInfo->filter->order->value) . '</th>
									<th class="title">' . JHTML::_('grid.sort', JText::_('ACY_CREATED'), 'a.created', $pageInfo->filter->order->dir, $pageInfo->filter->order->value) . '</th>
									<th class="title titleid">' . JHTML::_('grid.sort', JText::_('ACY_ID'), 'a.id', $pageInfo->filter->order->dir, $pageInfo->filter->order->value) . '</th>
								</tr>
							</thead>
							<tfoot>
								<tr>
									<td colspan="5">' . $pagination->getListFooter() . $pagination->getResultsCounter() . '</td>
								</tr>
							</tfoot>
							<tbody>';
            foreach ($surveys as $row) {
                $k = 0;
                $content .= '<tr><td>';
                $text = '<b>' . JText::_('JOOMEXT_ALIAS') . ': </b>' . $row->alias;
                $content .= '<a href="#" onclick="setTag(\'{surveyurl:' . $row->id . '}\');insertTag();">' . acymailing_tooltip($text, $row->title, '', $row->title) . '</a>';
                $content .= '</td><td>';
                $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;
                $content .= acymailing_tooltip($text, $row->name, '', $row->name);
                $content .= '</td>
							<td align="center">' . JHTML::_('date', $row->created, JText::_('DATE_FORMAT_LC4')) . '</td>
							<td align="center">' . $row->id . '</td></tr>';
                $k = 1 - $k;
            }
            $content .= '</tbody></table>
					<input type="hidden" name="boxchecked" value="0" />
					<input type="hidden" name="filter_order" value="" />
					<input type="hidden" name="filter_order_Dir" value="" />';
        }
        echo $content;
    }
Exemplo n.º 9
0
function show_listing($listing, $url, $params, $searchbox, $searchboxbutton, $lists, $pagination, $options, $lang, $menuid, $categoriesbegenningby)
{
    global $mainframe;
    $document =& JFactory::getDocument();
    $user =& JFactory::getUser();
    // show search bar
    if ($searchbox) {
        $jumpmenulist = "\t\t<!--\n\t\tfunction jumpmenu(target,obj,restore){\n\t\t  eval(target+\".location='\"+obj.options[obj.selectedIndex].value+\"'\");\t\t\n\t\t  if (restore) obj.selectedIndex=0;\t\t\n\t\t}\t\t\n\t\t//-->";
        ?>
	<?php 
        $document->addScriptDeclaration($jumpmenulist);
        ?>
			
		<div id="searchbar">
		<table width="100%"  border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td>
				<form name="adminFormSearchAC" action="" method="post">
				<?php 
        echo $searchbox;
        ?>
 <?php 
        echo $lists['list_searchfield'];
        ?>
 <?php 
        echo $searchboxbutton;
        ?>
				</form>			
				</td>
				<td><div class="orderinglist">
				<?php 
        if (count($listing) && @$listing[0]->id != '' && $options['letter'] == '') {
            echo $lists['list_defaultordering'];
        }
        ?>
				</div></td>
			</tr>
		</table>
		</div>
		
	<?php 
    }
    // If result search letter -> show result categories beginning with this letter
    if ($categoriesbegenningby) {
        echo "<div id=\"alphapcategoriesbegenningby\"><span class=\"bigletter\">" . $options['letter'] . "</span><span class=\"allcategoriesbeginningby\">" . $categoriesbegenningby . "</span></div>";
    }
    if (count($listing) > $pagination->limit) {
        $newlimit = count($listing);
        $pagination = new JPagination($options['total'], $newlimit, $pagination->limitstart);
    }
    // show Pages Counter
    if ($params->get('list_shownumberpagetotal') && (count($listing) && @$listing[0]->id != '')) {
        if (!($options['section'] == '' && ($options['letter'] != '' || $options['search'] != '') && ($params->get('weblinkssection') || $params->get('contactsection')))) {
            echo "<div id=\"alphapagecounter\"><p>";
            echo $pagination->getResultsCounter();
            echo "</p></div>";
        }
    }
    $ac_alignimage = $params->get('list_imageposition');
    $ac_numcolumnslisting = $params->get('list_numcols');
    $ac_k = $ac_alignimage == '2' ? 0 : 'none';
    // for alternate image left-right
    $line = 0;
    // just using for 2 columns
    for ($i = 0; $i < count($listing); $i++) {
        //for ( $i=0; $i < $new_pagination ; $i++ ){
        // prepare each listing
        if (@$listing[$i]->id != '') {
            // define all vars for listing template
            $id_article = $listing[$i]->id;
            // id of item article
            $num = $params->get('list_numindex') ? $i + 1 + $options['limitstart'] : '';
            //num listing
            $title = "";
            // title of item
            $featured = "";
            // show "Featured" article on homepage of AlphaContent if this option is selected
            $icon_new = "";
            // icon new
            $icon_hot = "";
            // icon hot
            $section_category = "";
            // section / category
            $author = "";
            // author or alias author if defined in item
            $content = "";
            // content intro
            $date = "";
            // date created
            $hits = "";
            // num hits
            $comments = "";
            // num of comments
            $rating = "";
            // rating bar (native Joomla)
            $print = "";
            // link to print
            $pdf = "";
            // link to pdf
            $emailthis = "";
            // link to email this
            $report = "";
            // link to report this listing
            $readmore = "";
            // readmore link if exist
            $ratingbar = "";
            // ajax rating bar integrated in AlphaContent
            $googlemaps = "";
            // link to Google Maps Location
            $tags = "";
            // tags / keywords
            $link_to_article = $listing[$i]->reallink;
            // real link to article or contact or weblink
            /*		
            *
            * Notes *
            ---------
            $rating is disabled if you use ajax rating bar integrated in AlphaContent ($ratingbar)		
            *
            */
            $url_article = $listing[$i]->slug;
            if ($listing[$i]->catslug && $url_article != '') {
                $url_article .= "&amp;catid=" . $listing[$i]->catslug;
            }
            $url_article .= "&amp;directory=" . $menuid;
            $start_url_article = "<a href=\"" . JRoute::_($listing[$i]->href . $url_article) . "\">";
            $end_url_article = "</a>";
            // get Title article/contact/weblink
            if ($params->get('list_titlelinkable')) {
                $title = $start_url_article . $listing[$i]->title . $end_url_article;
                if ($listing[$i]->is_article == 'weblink') {
                    $title = "<a href=\"" . $listing[$i]->href . "\" target=\"_blank\">" . $listing[$i]->title . "</a>";
                }
            } else {
                $title = $listing[$i]->title;
            }
            // Featured
            if ($listing[$i]->is_article) {
                $featuredID = @explode(',', $params->get('list_featuredID'));
                $featured = $listing[$i]->featured || @in_array($listing[$i]->id, $featuredID) ? JText::_('AC_FEATURED') : '';
            }
            // get icon new and hot
            $typedatearticle = $params->get('list_showdate') ? $params->get('list_showdate') : 'created';
            if ($params->get('list_iconnew')) {
                $icon_new = showIconNew($listing[$i]->{$typedatearticle}, $params->get('list_numdaynew'), $lang);
            }
            if ($params->get('list_iconhot')) {
                $icon_hot = showIconHot($listing[$i]->hits, $params->get('list_numhitshot'), $lang);
            }
            if ($params->get('list_showsectioncategory')) {
                $section_category = $listing[$i]->section;
            }
            // get Section/Category
            $section_category = $params->get('list_showsectioncategory') ? $listing[$i]->section : '';
            // get Author
            $author = $params->get('list_showauthor') ? $listing[$i]->author : '';
            // get Ajax rating bar for AlphaContent
            if ($params->get('showsystemrating') && $params->get('activeglobalsystemrating') && $params->get('systemrating')) {
                switch ($options['section']) {
                    case 'weblinks':
                        $component4rating = 'com_weblinks';
                        break;
                    case 'contacts':
                        $component4rating = 'com_contact';
                        break;
                    default:
                        $component4rating = 'com_content';
                }
                $document =& JFactory::getDocument();
                $document->addScript(JURI::base(true) . '/components/com_alphacontent/assets/js/behavior.js');
                $document->addScript(JURI::base(true) . '/components/com_alphacontent/assets/js/rating.js');
                $document->addStyleSheet(JURI::base(true) . '/components/com_alphacontent/assets/css/rating.css');
                require_once JPATH_COMPONENT . DS . 'assets' . DS . 'includes' . DS . 'alphacontent.drawrating.php';
                $ratingbar = rating_bar($listing[$i]->id, $params->get('numstars'), $component4rating, $params->get('widthstars', 16), '', '', 0, 0, $params->get('showinfosrating'));
                // usage rating_bar( id article, num stars, component, width stars, default=16 ), static, model (example for module), comment id, review id, show or hide sum*rating/num stars (num votes) );
            }
            // get Joomla native rating bar
            if ($params->get('showsystemrating') && $params->get('systemrating') == '0' && $listing[$i]->rating_count != '') {
                // look for images in template if available
                $img = "";
                $starImageOn = JHTML::_('image.site', 'rating_star.png', '/images/M_images/');
                $starImageOff = JHTML::_('image.site', 'rating_star_blank.png', '/images/M_images/');
                for ($rb = 0; $rb < $listing[$i]->rating; $rb++) {
                    $img .= $starImageOn;
                }
                for ($rb = $listing[$i]->rating; $rb < 5; $rb++) {
                    $img .= $starImageOff;
                }
                $rating = '<span class="content_rating">';
                $rating .= JText::_('User Rating') . ':' . $img . '&nbsp;/&nbsp;';
                $rating .= intval($listing[$i]->rating_count);
                $rating .= "</span>";
            }
            // Location Google Maps link
            //if ( $params->get('list_showlinkmap') && $params->get('apikeygooglemap') ) {
            if ($params->get('list_showlinkmap')) {
                $mapIsDefined = 0;
                if (preg_match('#{ALPHAGMAP=(.*)}#Uis', $listing[$i]->text, $m)) {
                    $listing[$i]->text = preg_replace("#{ALPHAGMAP=(.*)}#Uis", "", $listing[$i]->text);
                    $mapIsDefined = 1;
                } elseif (preg_match('#{ALPHAGMAP=(.*)}#Uis', $listing[$i]->fulltext, $m)) {
                    $listing[$i]->fulltext = preg_replace("#{ALPHAGMAP=(.*)}#Uis", "", $listing[$i]->fulltext);
                    $mapIsDefined = 1;
                }
                $a = array();
                if ($mapIsDefined) {
                    $a = explode("|", $m[1]);
                    if (count($a) == 3) {
                        $thewidthmap = $params->get('widthgooglemap') + 20;
                        $theheightmap = $params->get('heightgooglemap') + 20;
                        $status = "status=no,toolbar=no,scrollbars=no,titlebar=no,menubar=no,resizable=no,width=" . $thewidthmap . ",height=" . $theheightmap . ",directories=no,location=no";
                        $googlemaps = "<a href=\"javascript:void window.open('index2.php?option=com_alphacontent&amp;task=viewmap&amp;la=" . $a[0] . "&amp;lo=" . $a[1] . "&amp;txt=" . $a[2] . "', 'win2', '{$status}');\">" . JTEXT::_('AC_MAP') . "</a>";
                    }
                }
            }
            $listing[$i]->text = preg_replace('#{ALPHAGMAP=(.*)}#Uis', '', $listing[$i]->text);
            // prepare content
            $cuttext = 0;
            switch ($params->get('list_introstyle')) {
                case '1':
                    // text only
                    $numcharsintro = $params->get('list_numcharsintro') ? $params->get('list_numcharsintro') : '999999';
                    $cuttext = strlen($listing[$i]->text) > $numcharsintro ? 1 : 0;
                    $content = acPrepareAlphaContent($listing[$i]->text, $numcharsintro, '');
                    break;
                case '2':
                    // Original intro with plugins
                    //if ( $listing[$i]->attribs!='' ) {
                    // Process the prepare content plugins
                    JPluginHelper::importPlugin('content');
                    $dispatcher =& JDispatcher::getInstance();
                    $tparams =& $mainframe->getParams('com_content');
                    // Merge article parameters into the page configuration
                    $aparams = new JParameter($listing[$i]->attribs);
                    $tparams->merge($aparams);
                    //$results = @$dispatcher->trigger('onPrepareContent', array (& $listing[$i]->text, & $tparams, 0));
                    $results = @$dispatcher->trigger('onPrepareContent', array(&$listing[$i], &$tparams, 0));
                    $content = $listing[$i]->text;
                    //}
                    break;
                case '3':
                    // Metadesc
                    $numcharsintro = $params->get('list_numcharsintro') ? $params->get('list_numcharsintro') : '999999';
                    $content = $listing[$i]->metadesc ? $listing[$i]->metadesc : acPrepareAlphaContent($listing[$i]->text, $numcharsintro, '');
                    break;
            }
            if ($listing[$i]->created) {
                if ($params->get('list_showdate') == 'created') {
                    $date = JHTML::_('date', $listing[$i]->created, JText::_($params->get('list_formatdate')));
                } elseif ($params->get('list_showdate') == 'modified') {
                    $date = JHTML::_('date', $listing[$i]->modified, JText::_($params->get('list_formatdate')));
                }
            }
            $hits = $params->get('list_showhits') ? intval($listing[$i]->hits) : '';
            // get number of comments
            if ($params->get('list_shownumcomments') && $params->get('list_commentsystem') && $listing[$i]->is_article == '1') {
                $comments = getNumberComments($params->get('list_commentsystem'), $listing[$i]->id);
            }
            // PDF link
            if ($listing[$i]->is_article == '1' && $params->get('list_showpdf')) {
                $url = 'index.php?view=article';
                $url .= @$listing[$i]->catslug ? '&catid=' . $listing[$i]->catslug : '';
                $url .= '&id=' . $listing[$i]->id . $listing[$i]->slug . '&format=pdf&option=com_content';
                $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
                $text = JText::_('PDF');
                $attribs['title'] = JText::_('PDF');
                $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;";
                $attribs['rel'] = 'nofollow';
                $pdf = JHTML::_('link', JRoute::_($url), $text, $attribs);
            }
            // Print link
            if ($listing[$i]->is_article == '1' && $params->get('list_showprint')) {
                $url = 'index.php?view=article';
                $url .= @$listing[$i]->catslug ? '&catid=' . $listing[$i]->catslug : '';
                $url .= '&id=' . $listing[$i]->id . $listing[$i]->slug . '&tmpl=component&print=1&option=com_content';
                $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
                $text = JText::_('Print');
                $attribs['title'] = JText::_('Print');
                $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;";
                $print = JHTML::_('link', JRoute::_($url), $text, $attribs);
            }
            // Email link
            if ($listing[$i]->is_article == '1' && $params->get('list_showemail')) {
                $uri =& JURI::getInstance();
                $base = $uri->toString(array('scheme', 'host', 'port'));
                $link = $base . JRoute::_("index.php?view=article&id=" . $listing[$i]->id . $listing[$i]->slug, false);
                $url = 'index.php?option=com_mailto&tmpl=component&link=' . base64_encode($link);
                $status = 'width=400,height=300,menubar=yes,resizable=yes';
                $text = '&nbsp;' . JText::_('Email');
                $attribs['title'] = JText::_('Email');
                $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;";
                $emailthis = JHTML::_('link', JRoute::_($url), $text, $attribs);
            }
            // report this listing link
            if ($params->get('list_showreportlisting')) {
                $url = 'index.php?option=com_alphacontent&task=report';
                //switch ( $options['section'] ) {
                switch ($listing[$i]->is_article) {
                    case 'weblink':
                        $report_type = 'com_weblinks';
                        break;
                    case 'contact':
                        $report_type = 'com_contact';
                        break;
                    default:
                        $report_type = 'com_content';
                }
                $url .= '&type=' . $report_type . '&id=' . $id_article . '&tmpl=component';
                $status = 'width=400,height=300,menubar=yes,resizable=yes';
                $text = JText::_('AC_REPORT');
                $attribsr['title'] = JText::_('AC_REPORT_THIS_LISTING');
                $attribsr['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;";
                $report = JHTML::_('link', JRoute::_($url), $text, $attribsr);
            }
            // readmore link
            if (($listing[$i]->readmore || $cuttext) && $params->get('list_showreadmore')) {
                $sluggy = $listing[$i]->slug;
                if ($listing[$i]->catslug && $sluggy != '') {
                    $sluggy .= "&amp;catid=" . $listing[$i]->catslug;
                }
                $sluggy .= "&amp;directory=" . $menuid;
                $readmore = "<a href=\"" . JRoute::_($listing[$i]->href . $sluggy) . "\">" . JText::_('Readmore') . "</a>";
                if ($listing[$i]->access > $user->aid) {
                    $readmore = "<a href=\"" . JRoute::_($listing[$i]->href . $sluggy) . "\">" . JText::_("REGISTER TO READ MORE...") . "</a>";
                }
            }
            // prepare image
            $linkimgsrc = "";
            if ($params->get('list_showimage')) {
                if ($listing[$i]->is_article == '1') {
                    $linkIMG = findIMG($listing[$i]->text, $params->get('list_showimage'));
                    if ($linkIMG == "") {
                        $linkIMG = findIMG($listing[$i]->fulltext, $params->get('list_showimage'));
                    }
                    $linkimgsrc = $linkIMG ? $start_url_article . "<img src=\"" . $linkIMG . "\" width=\"" . $params->get('list_widthimage') . "px\" alt=\"\" />" . $end_url_article : "";
                } elseif ($listing[$i]->is_article == 'contact' && $listing[$i]->images) {
                    $linkimgsrc = $start_url_article . "<img src=\"images/stories/" . $listing[$i]->images . "\" width=\"" . $params->get('list_widthimage') . "px\" alt=\"\" />" . $end_url_article;
                } elseif ($listing[$i]->is_article == 'weblink' && $params->get('weblinksthumbnail') == '1') {
                    $forcewidth = "width=\"" . $params->get('list_widthimage') . "px\"";
                    if ($params->get('list_keywebsnapr') && $params->get('list_sizewebsnapr', 'AC') != 'AC') {
                        $sizewebsnapr = "size=" . $params->get('list_sizewebsnapr');
                        $sizewebsnapr .= "&key=" . $params->get('list_keywebsnapr');
                        $forcewidth = "";
                    } else {
                        $sizewebsnapr = "size=s";
                    }
                    $linkimgsrc = "<a href=\"" . $listing[$i]->href . "\" target=\"_blank\">" . "<img src=\"http://images.websnapr.com/?" . $sizewebsnapr . "&url=" . $listing[$i]->reallink . "\" alt=\"" . $listing[$i]->reallink . "\" {$forcewidth} />" . "</a>";
                }
            }
            if ($listing[$i]->is_article == 'weblink') {
                // prepare link for weblink
                $content = "<a href=\"" . $listing[$i]->href . "\" target=\"_blank\">" . $listing[$i]->reallink . "</a><br />" . $content;
            }
            if ($listing[$i]->is_article == 'contact' && $listing[$i]->author != '') {
                // prepare link for email contact
                $content .= "<br /><a href=\"mailto:" . $listing[$i]->author . "\">" . $listing[$i]->author . "</a>";
                $author = "";
            }
            if ($listing[$i]->is_article == 'contact' && $listing[$i]->reallink != '') {
                // prepare link for webpage url
                $content .= "<br /><a href=\"" . $listing[$i]->reallink . "\" target=\"_blank\">" . $listing[$i]->reallink . "</a><br />";
            }
            if ($listing[$i]->metakey != '' && $params->get('showtags')) {
                $keywords = array();
                $keywords = explode(",", trim($listing[$i]->metakey));
                for ($a = 0, $b = count($keywords); $a < $b; $a++) {
                    $metakey = trim($keywords[$a]);
                    if ($a > 0) {
                        $tags .= ", ";
                    }
                    $tags .= " <a href=\"" . JRoute::_("index.php?option=com_search&searchword={$metakey}&submit=Search&searchphrase=any&ordering=newest") . "\">" . $metakey . "</a>";
                }
            }
            // START LAYOUT
            $ac_m = $line % 2 + 1;
            // using 2 columns
            if ($ac_numcolumnslisting && $ac_m == '1') {
                echo "\n<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\"><tr><td width=\"50%\" valign=\"top\">\n";
            }
            if ($ac_numcolumnslisting && $ac_m == '2') {
                echo "\n<td width=\"50%\" valign=\"top\">\n";
            }
            ?>
			<!-- STARTING DIV CONTAINER ARTICLE -->
			<div id="container<?php 
            echo $num;
            ?>
" class="alphalisting">
			<table width="100%"><tr>	
			<?php 
            if ($params->get('list_showimage') && $linkimgsrc != '') {
                if ($ac_alignimage == 0 && $ac_k == 'none' || $ac_alignimage == '2' && $ac_k == 0) {
                    ?>
				<td valign="top" width="<?php 
                    echo $params->get('list_widthimage');
                    ?>
px">
				<!-- STARTING DIV IMAGE LEFT -->				
				<div class="_imageleft"><?php 
                    echo $linkimgsrc;
                    ?>
</div>
				<!-- END DIV IMAGE LEFT -->
				</td>
				<?php 
                }
            }
            ?>
			<!-- STARTING DIV ARTICLE -->
			<td>
			<div id="article<?php 
            echo $num;
            ?>
">
			<div id="title<?php 
            echo $num;
            ?>
">
			<?php 
            if ($num) {
                ?>
<span class="_alphanum" style="display:inline;"><?php 
                echo $num;
                ?>
. </span><?php 
            }
            ?>
			<?php 
            if ($title) {
                ?>
<span class="_alphatitle" style="display:inline;"><?php 
                echo $title;
                ?>
</span> <span class="_alphafeatured"><sup><?php 
                echo $featured;
                ?>
</sup></span> <?php 
            }
            ?>
			<?php 
            if ($icon_new || $icon_hot) {
                ?>
<span style="display:inline;"><?php 
                echo " " . $icon_new . " " . $icon_hot;
                ?>
</span><?php 
            }
            ?>
			</div>
			<?php 
            if ($ratingbar || $rating) {
                ?>
				<div id="ratingbar<?php 
                echo $num;
                ?>
" class="small">				
				<?php 
                echo $ratingbar;
                if ($rating) {
                    echo $rating;
                }
                ?>
 
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($section_category) {
                ?>
				<div class="small"><?php 
                echo $section_category;
                ?>
</div>
			<?php 
            }
            ?>
			<?php 
            if ($author) {
                ?>
				<div class="small">
				<?php 
                echo JTEXT::_('AC_AUTHOR') . $author;
                ?>
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($tags) {
                ?>
			
				<div class="small">
				<?php 
                echo JTEXT::_('AC_TAGS') . $tags;
                ?>
				</div>
			<?php 
            }
            ?>
			<?php 
            if ($content) {
                ?>
				<div id="content<?php 
                echo $num;
                ?>
"><?php 
                echo $content;
                ?>
</div>
			<?php 
            }
            ?>
			<div id="features<?php 
            echo $num;
            ?>
">
			<?php 
            if ($date) {
                ?>
<span class="small"><?php 
                echo $date;
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($hits) {
                ?>
 | <span class="small"><?php 
                $labelHit = $hits > 1 ? 'AC_HITS' : 'AC_HIT';
                echo $hits . " " . JTEXT::_($labelHit);
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($comments) {
                ?>
 | <span class="small"><?php 
                $labelComment = $comments > 1 ? JTEXT::_('AC_COMMENTS') : JTEXT::_('AC_COMMENT');
                echo $comments . " " . $start_url_article . $labelComment . $end_url_article;
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($print) {
                ?>
 | <span class="small"><?php 
                echo $print;
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($pdf) {
                ?>
 | <span class="small"><?php 
                echo $pdf;
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($emailthis) {
                ?>
 | <span class="small"><?php 
                echo $emailthis;
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($report) {
                ?>
 | <span class="small"><?php 
                echo $report;
                ?>
</span><?php 
            }
            ?>
			
			<?php 
            if ($readmore) {
                ?>
 | <span class="small"><?php 
                echo $readmore;
                ?>
</span><?php 
            }
            ?>
			<?php 
            if ($googlemaps) {
                ?>
 | <span class="small"><?php 
                echo $googlemaps;
                ?>
</span><?php 
            }
            ?>
			</div>
			</div><!-- END DIV ARTICLE -->
			</td>
			<?php 
            if ($params->get('list_showimage') && $linkimgsrc != '') {
                if ($ac_alignimage == 1 && $ac_k == 'none' || $ac_alignimage == '2' && $ac_k == 1) {
                    ?>
				<td valign="top" width="<?php 
                    echo $params->get('list_widthimage');
                    ?>
px">
				<!-- STARTING DIV IMAGE RIGHT -->
				<div class="_imageright"><?php 
                    echo $linkimgsrc;
                    ?>
</div>				
				<!-- END DIV IMAGE RIGHT -->
				</td>
				<?php 
                }
            }
            ?>
			</tr></table></div><!-- END DIV CONTAINER -->
			<div class="_separate"></div>
			<?php 
            // END LAYOUT HTML
            // using 2 columns
            if ($ac_numcolumnslisting && $ac_m == '1') {
                echo "\n</td>\n";
            }
            if ($ac_numcolumnslisting && $ac_m == '1' && $i == count($listing) - 1) {
                echo "\n<td width=\"50%\" valign=\"top\">&nbsp;";
            }
            if ($ac_numcolumnslisting && $ac_m == '2' || $ac_numcolumnslisting && $ac_m == '1' && $i == count($listing) - 1) {
                echo "\n</td></tr></table>\n";
            }
            $line++;
            if ($ac_alignimage == '2') {
                $ac_k = 1 - $ac_k;
            }
        } else {
            if ($i > 0) {
                $i = $i - 1;
            }
        }
    }
    ?>
	
	<?php 
    if (count($listing) && @$listing[0]->id != '') {
        if (!($options['section'] == '' && ($options['letter'] != '' || $options['search'] != '') && ($params->get('weblinkssection') || $params->get('contactsection')))) {
            echo "<div id=\"alphapagination\"><p>";
            echo $pagination->getPagesLinks();
            echo "<br />";
            echo $pagination->getPagesCounter();
            echo "</p></div>";
        }
    }
}
Exemplo n.º 10
0
    function myproductslisting()
    {
        $user =& JFactory::getUser();
        $userid = $user->id;
        $usertype = $user->usertype;
        $db =& JFactory::getDBO();
        if ($usertype == 'Merchants' && $userid != 0) {
            ?>
			<script type="text/javascript" src="components/com_dealcatalog/js/jquery1.7.js"></script>
			<script type="text/javascript" src="components/com_dealcatalog/js/jquery.fancybox.js"></script>		
			<script type="text/javascript" src="components/com_dealcatalog/css/dealcatalog.css"></script>
			<link rel="stylesheet" type="text/css" href="components/com_dealcatalog/js/jquery.fancybox.css" media="screen" />
			<script type="text/javascript">
				$(document).ready(function() {
						$(".fancybox").fancybox();
					});
			</script>
			<?php 
            //Company name
            $query = "select company_name from #__deal_merchants where user_id='{$userid}'";
            $db->setQuery($query);
            $company = $db->loadRow();
            $company_name = $company[0];
            //Pagination
            global $mainframe;
            $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
            $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
            if ($_REQUEST['limitstart'] == '') {
                $limitstart = 0;
            }
            $query = "select a.product_name,a.product_image1,a.product_thumbimage1,b.id,b.product_id,b.vendor_id,b.stock_in,b.price,b.discount_price,b.listingstart_date,b.listingend_date,b.merchantproduct_image1,b.merchantproduct_thumbimage1,b.is_deal,b.deal_price,b.dealstart_date,b.dealend_date,c.company_name from #__deal_products as a,#__deal_productslisting_deals as b,#__deal_merchants as c where c.user_id='{$userid}' and a.id=b.product_id and b.vendor_id=c.id order by b.id desc";
            $db->setQuery($query);
            $total = $db->loadResultArray();
            $total = count($total);
            //Products
            jimport('joomla.html.pagination');
            $pageNav = new JPagination($total, $limitstart, $limit);
            $query = "select a.product_name,a.product_image1,a.product_thumbimage1,b.id,b.product_id,b.vendor_id,b.stock_in,b.price,b.discount_price,b.listingstart_date,b.listingend_date,b.merchantproduct_image1,b.merchantproduct_thumbimage1,b.is_deal,b.deal_price,b.dealstart_date,b.dealend_date,c.company_name from #__deal_products as a,#__deal_productslisting_deals as b,#__deal_merchants as c where c.user_id='{$userid}' and a.id=b.product_id and b.vendor_id=c.id order by b.id desc";
            $db->setQuery($query, $pageNav->limitstart, $pageNav->limit);
            $product_all = $db->loadObjectList();
            ?>
			<div id="merchant_layout">
				<div id="merchant_menu">
						<ul>
							<li> <a href="index.php?option=com_dealcatalog&task=merchantdefault&Itemid=<?php 
            echo $_REQUEST['Itemid'];
            ?>
" > DashBoard </a> </li>
							<li> <a href="index.php?option=com_dealcatalog&task=products&Itemid=<?php 
            echo $_REQUEST['Itemid'];
            ?>
" > Products </a> </li>
							<li> <a href="index.php?option=com_dealcatalog&task=addproductslistingdeals&Itemid=<?php 
            echo $_REQUEST['Itemid'];
            ?>
" > Add Products Listing and Deals </a> </li>
							<li> <a href="index.php?option=com_dealcatalog&task=myproductslisting&Itemid=<?php 
            echo $_REQUEST['Itemid'];
            ?>
" > My Products Usage</a> </li>
							<li> <a href="index.php?option=com_dealcatalog&task=coupons&Itemid=<?php 
            echo $_REQUEST['Itemid'];
            ?>
" > My Customers Coupons </a> </li>
						</ul>
				</div>
				<div id="myusage">
					<div class="welcome">
							<?php 
            echo "Welcome back " . $company_name;
            ?>
					</div>
					<div class="lists">
						<h2> My Products Listing </h2>
						<div id="products_display">
							<div id="search_product">								
								<div class="cat_head"> Showing the Results for "<b> Products Listing and Deals </b>" </div>
								<div class="cat_title">
									<div class="product_count">Showing the <?php 
            echo $pageNav->getResultsCounter();
            ?>
 </div>								
								</div>
								<form method="post" name="myproductslisting" id="myproductslisting" action="<?php 
            echo $_SERVER['REQUEST_URI'];
            ?>
">
									<?php 
            $k = $limitstart;
            for ($i = 0, $n = count($product_all); $i < $n; $i++) {
                $row =& $product_all[$i];
                $productlist = $row->id;
                $product_id = $row->product_id;
                $vendor_id = $row->vendor_id;
                $product_name = $row->product_name;
                $price = $row->price;
                $company_name = $row->company_name;
                $discount_price = $row->discount_price;
                $listenddate = $row->listingend_date;
                $pimage = $row->product_image1;
                $pimage1 = $row->product_thumbimage1;
                $mimage = $row->merchantproduct_image1;
                $mimage1 = $row->merchantproduct_thumbimage1;
                $is_deal = $row->is_deal;
                $deal_price = $row->deal_price;
                $dealstartdate = $row->dealstart_date;
                $dealenddate = $row->dealend_date;
                //Product Image
                if ($mimage != '') {
                    $image = substr($mimage, 3);
                    $thumb_image = substr($mimage1, 3);
                } else {
                    $image = substr($pimage, 3);
                    $thumb_image = substr($pimage1, 3);
                }
                if ($i % 2 == 0) {
                    ?>
											<div class="product_odd">
												<div class="img_views">
													<a class="fancybox" href="<?php 
                    echo $image;
                    ?>
" title="<?php 
                    echo $product_name;
                    ?>
">
														<img src="<?php 
                    echo $thumb_image;
                    ?>
" />
													</a>
												</div>
												<div class="offer">
													<?php 
                    echo $product_name;
                    ?>
												</div>									
												<div class="offer_price"> 
													Price : <span class="deals"><?php 
                    echo $price;
                    ?>
 </span>
												</div>													
												<div class="offer_price"> 
													Discount Price : <span class="deals"><?php 
                    echo $discount_price;
                    ?>
 </span>
												</div>
												<div class="offer">
													Product Expires on <?php 
                    echo $listenddate;
                    ?>
												</div>	
												<?php 
                    if ($is_deal == 1) {
                        ?>
													<div class="offer_price"> 
														Deal Price : <span class="deals"><?php 
                        echo $deal_price;
                        ?>
 </span>
													</div>
													<div class="offer">
														Deal Expires on <?php 
                        echo $dealenddate;
                        ?>
													</div>
													<?php 
                    }
                    ?>
												
												<div class="details_more">
													<a href="index.php?option=com_dealcatalog&task=editproductlisting&productlist=<?php 
                    echo $productlist;
                    ?>
&Itemid=<?php 
                    echo $_REQUEST['Itemid'];
                    ?>
">  Edit </a>
												</div>
											</div>
										<?php 
                } else {
                    ?>
											<div class="product_even">												
												<div class="img_views">
													<a class="fancybox" href="<?php 
                    echo $image;
                    ?>
" title="<?php 
                    echo $product_name;
                    ?>
">
														<img src="<?php 
                    echo $thumb_image;
                    ?>
" />
													</a>
												</div>
												<div class="offer">
													<?php 
                    echo $product_name;
                    ?>
												</div>									
												<div class="offer_price"> 
													Price : <span class="deals"><?php 
                    echo $price;
                    ?>
 </span>
												</div>													
												<div class="offer_price"> 
													Discount Price : <span class="deals"><?php 
                    echo $discount_price;
                    ?>
 </span>
												</div>
												<div class="offer">
													Product Expires on <?php 
                    echo $listenddate;
                    ?>
												</div>	
												<?php 
                    if ($is_deal == 1) {
                        ?>
													<div class="offer_price"> 
														Deal Price : <span class="deals"><?php 
                        echo $deal_price;
                        ?>
 </span>
													</div>
													<div class="offer">
														Deal Expires on <?php 
                        echo $dealenddate;
                        ?>
													</div>
													<?php 
                    }
                    ?>
												
												<div class="details_more">
													<a href="index.php?option=com_dealcatalog&task=editproductlisting&productlist=<?php 
                    echo $productlist;
                    ?>
&Itemid=<?php 
                    echo $_REQUEST['Itemid'];
                    ?>
">  Edit </a>
												</div>
											</div>
										<?php 
                }
                $k++;
            }
            ?>
									<div class="pagi">
										<?php 
            echo $pageNav->getPagesLinks();
            ?>
									</div>
								</form>
							</div>
						</div>
					</div>
				</div>
			</div>
			<?php 
        } else {
            echo "<h1> You don't have the permission to access this page </h1>";
            echo "<p> Please <a href='index.php?option=com_dealcatalog&task=merchantregister&Itemid=" . $_REQUEST['Itemid'] . "'> Register </a> as a Merchant  </p>";
        }
    }
Exemplo n.º 11
0
 function _getNinjaBoardHTML($rows, $row_count, $userId, $nbPlugShowSubject, $nbPlugTruncateSubject, $nbPlugShowMessage, $nbPlugTruncateMessage, $nbPlugShowForum, $nbPlugShowHits, $nbPlugShowCreated, $nbPlugShowModified, $nbPlugDateFormat, $nbPlugShowEdit, $nbPlugSortBy, $nbPlugSortOrder, $nbPlugShowPagination, $nbPlugPaginationCount, $offset, $limit, $itemId, &$params, &$user, &$my)
 {
     $mainframe =& JFactory::getApplication();
     $column_array = array($nbPlugShowSubject, $nbPlugShowMessage, $nbPlugShowForum, $nbPlugShowHits, $nbPlugShowCreated, $nbPlugShowModified, $nbPlugShowEdit);
     $columns = array_sum($column_array);
     if ($row_count <= 0) {
         $html = '<div class="jsNinjaBoard"><div class="jsNBposts"><table><tr><td>You currently have no NinjaBoard posts</td></tr></table></div>';
     } else {
         //show only selected fields in a table row
         $html = '<div class="jsNinjaBoard"><div class="jsNBposts"><table><thead><tr>';
         if ($nbPlugShowSubject) {
             $html .= '<th>' . JText::_('NB_SUBJECT_JSP') . '</th>';
         }
         if ($nbPlugShowMessage) {
             $html .= '<th>' . JText::_('NB_MESSAGE_JSP') . '</th>';
         }
         if ($nbPlugShowForum) {
             $html .= '<th>' . JText::_('NB_FORUM_JSP') . '</th>';
         }
         if ($nbPlugShowHits) {
             $html .= '<th>' . JText::_('NB_HITS_JSP') . '</th>';
         }
         if ($nbPlugShowCreated) {
             $html .= '<th>' . JText::_('NB_CREATED_JSP') . '</th>';
         }
         if ($nbPlugShowModified) {
             $html .= '<th>' . JText::_('NB_MODIFIED_JSP') . '</th>';
         }
         if ($nbPlugShowEdit) {
             $html .= '<th>' . JText::_('NB_VIEW_POST_JSP') . '</th>';
         }
         $html .= '</tr></thead><tbody>';
         $items = array();
         foreach ($rows as $row) {
             //get the item subject, show no subject if there is none, truncate subject if necessary
             $item->subject_long = stripslashes($row->subject) ? stripslashes($row->subject) : JText::_('NB_NO_SUBJECT_JSP');
             $item->subject_short = JString::strlen($item->subject_long) > $nbPlugTruncateSubject ? JString::substr($item->subject_long, 0, $subject_max - 4) . '...' : $item->subject_long;
             $item->subject = $nbPlugTruncateSubject > 0 ? $item->subject_short : $item->subject_long;
             //get the item message, show no message if there is none, truncate message if necessary
             $item->message_long = stripslashes($row->message) ? stripslashes($row->message) : JText::_('NB_NO_MESSAGE_JSP');
             $item->message_short = JString::strlen($item->message_long) > $nbPlugTruncateMessage ? JString::substr($item->message_long, 0, $nbPlugTruncateMessage - 4) . '...' : $item->message_long;
             $item->unparsed = $nbPlugTruncateMessage > 0 ? $item->message_short : $item->message_long;
             $item->message = KFactory::get('admin::com.ninja.helper.bbcode')->parse(array('text' => $item->unparsed));
             //link to edit post
             $item->view_link = '<a href="' . (JURI::base() . 'index.php?option=com_ninjaboard&view=topic&id=' . $row->topic_id . '&Itemid=' . $itemId . '#post' . $row->post_id) . '" title="' . JText::_('NB_VIEW_POST_JSP') . '">' . '<img src="' . JURI::base() . 'plugins/community/ninjaboard/post.png" width="32" height="32" alt="' . JText::_('NB_VIEW_POST_JSP') . '" />' . '</a>';
             //link to forum
             $item->forum_link = '<a href="' . (JURI::base() . 'index.php?option=com_ninjaboard&view=forum&id=' . $row->forum_id . '&Itemid=' . $itemId) . '" title="' . JText::_($row->forum_name) . '">' . JText::_($row->forum_name) . '</a>';
             //format dates
             $item->c_datetime = $row->created > 0 ? date($nbPlugDateFormat, strtotime($row->created)) : JText::_('NB_NO_DATE_JSP');
             $item->m_datetime = $row->modified > 0 ? date($nbPlugDateFormat, strtotime($row->modified)) : JText::_('NB_NO_DATE_JSP');
             //show only selected fields in a table row
             $html .= '<tr>';
             if ($nbPlugShowSubject) {
                 $html .= '<td>' . $item->subject . '</td>';
             }
             if ($nbPlugShowMessage) {
                 $html .= '<td>' . $item->message . '</td>';
             }
             if ($nbPlugShowForum) {
                 $html .= '<td>' . $item->forum_link . '</td>';
             }
             if ($nbPlugShowHits) {
                 $html .= '<td>' . $row->hits . '</td>';
             }
             if ($nbPlugShowCreated) {
                 $html .= '<td>' . $item->c_datetime . '</td>';
             }
             if ($nbPlugShowModified) {
                 $html .= '<td>' . $item->m_datetime . '</td>';
             }
             if ($nbPlugShowEdit) {
                 $html .= '<td>' . $item->view_link . '</td>';
             }
             $html .= '</tr>';
         }
         $html .= '</tbody></table></div>';
         //if(($nbPlugShowPagination)&&($row_count>$limit)){
         $html .= '<div class="jsNBpagination"><table><tr><td>';
         //$html .= KFactory::get('site::com.ninjaboard.helper.paginator',array('name' => 'posts'))->pagination($row_count, $offset, $limit , 4, true);
         jimport('joomla.html.pagination');
         $pagination = new JPagination($row_count, $offset, $limit);
         $html .= $pagination->getPagesLinks() . $pagination->getResultsCounter();
         $html .= '</td></tr></table></div>';
         //}
         $html .= '</div>';
     }
     return $html;
 }
Exemplo n.º 12
0
 function display()
 {
     global $user, $mainframe, $ueConfig;
     $my =& JFactory::getUser();
     $lang =& JFactory::getLanguage();
     $lang->load('plg_cbeninjaboard');
     $return = null;
     JHTML::stylesheet('ninjaboard.css', 'components/com_cbe/enhanced/ninjaboard/');
     //get parameters
     $ninjaboard_ShowSubject = $this->params['ninjaboard_ShowSubject'];
     $ninjaboard_TruncateSubject = $this->params['ninjaboard_TruncateSubject'];
     $ninjaboard_ShowMessage = $this->params['ninjaboard_ShowMessage'];
     $ninjaboard_TruncateMessage = $this->params['ninjaboard_TruncateMessage'];
     $ninjaboard_ShowForum = $this->params['ninjaboard_ShowForum'];
     $ninjaboard_ShowHits = $this->params['ninjaboard_ShowHits'];
     $ninjaboard_ShowCreated = $this->params['ninjaboard_ShowCreated'];
     $ninjaboard_ShowModified = $this->params['ninjaboard_ShowModified'];
     $ninjaboard_DateFormat = $this->params['ninjaboard_DateFormat'];
     $ninjaboard_ShowEdit = $this->params['ninjaboard_ShowEdit'];
     $ninjaboard_SortBy = $this->params['ninjaboard_SortBy'];
     $ninjaboard_SortOrder = $this->params['ninjaboard_SortOrder'];
     $ninjaboard_ShowPagination = $this->params['ninjaboard_ShowPagination'];
     $ninjaboard_PaginationCount = $this->params['ninjaboard_PaginationCount'];
     $limit = $ninjaboard_PaginationCount > 0 ? $ninjaboard_PaginationCount : 0;
     $offset = JRequest::getVar('limitstart', 0, 'REQUEST');
     //connect to database
     $database =& JFactory::getDBO();
     //get current user
     $userId = $user->id;
     //get user posts
     $rows = $this->getPosts($userId, $ninjaboard_SortBy, $ninjaboard_SortOrder, $ninjaboard_PaginationCount, $limit, $offset);
     //get user post count
     $row_count = $this->countPosts($userId);
     //get item id
     $itemId = $this->getItemId();
     //create_html
     if ($row_count <= 0) {
         $list = '<div class="cbeNinjaBoard"><div class="cbeNBposts"><table><tr><td>You currently have no NinjaBoard posts</td></tr></table></div>';
     } else {
         $list = '<div class="cbeNinjaBoard"><div class="cbeNBposts"><table><thead><tr>';
         if ($ninjaboard_ShowSubject) {
             $list .= '<th>' . JText::_('Subject') . '</th>';
         }
         if ($ninjaboard_ShowMessage) {
             $list .= '<th>' . JText::_('Message') . '</th>';
         }
         if ($ninjaboard_ShowForum) {
             $list .= '<th>' . JText::_('Forum') . '</th>';
         }
         if ($ninjaboard_ShowHits) {
             $list .= '<th>' . JText::_('Hits') . '</th>';
         }
         if ($ninjaboard_ShowCreated) {
             $list .= '<th>' . JText::_('Created') . '</th>';
         }
         if ($ninjaboard_ShowModified) {
             $list .= '<th>' . JText::_('Modified') . '</th>';
         }
         if ($ninjaboard_ShowEdit) {
             $list .= '<th>' . JText::_('View Post') . '</th>';
         }
         $list .= '</tr></thead><tbody>';
         $items = array();
         foreach ($rows as $row) {
             //get the item subjec, show no subject if there is none, truncate subject if necessary
             $item->subject_long = stripslashes($row->subject) ? stripslashes($row->subject) : JText::_('No Subject');
             $item->subject_short = JString::strlen($row->subject) > $ninjaboard_TruncateSubject ? JString::substr($row->subject, 0, $subject_max - 4) . '...' : $item->subject_long;
             $item->subject = $ninjaboard_TruncateSubject > 0 ? $item->subject_short : $item->subject_long;
             //get the item message, show no message if there is none, truncate message if necessary
             $item->message_long = stripslashes($row->message) ? stripslashes($row->message) : JText::_('No Message');
             $item->message_short = JString::strlen($row->message) > $ninjaboard_TruncateMessage ? JString::substr($row->message, 0, $ninjaboard_TruncateMessage - 4) . '...' : $item->message_long;
             $item->unparsed = $ninjaboard_TruncateMessage > 0 ? $item->message_short : $item->message_long;
             $item->message = KFactory::get('admin::com.ninja.helper.bbcode')->parse(array('text' => $item->unparsed));
             //link to edit post
             $item->view_link = '<a href="' . (JURI::base() . 'index.php?option=com_ninjaboard&view=topic&id=' . $row->topic_id . '&Itemid=' . $itemId . '#post' . $row->post_id) . '" title="' . JText::_('View Post') . '">' . '<img src="' . JURI::base() . 'components/com_cbe/enhanced/ninjaboard/post.png" width="32" height="32" alt="View Post" />' . '</a>';
             //link to forum
             $item->forum_link = '<a href="' . (JURI::base() . 'index.php?option=com_ninjaboard&view=forum&id=' . $row->forum_id . '&Itemid=' . $itemId) . '" title="' . JText::_($row->forumname) . '">' . JText::_($row->forumname) . '</a>';
             //format dates
             $item->c_datetime = $row->created > 0 ? date($ninjaboard_DateFormat, strtotime($row->created)) : JText::_('No Date');
             $item->m_datetime = $row->modified > 0 ? date($ninjaboard_DateFormat, strtotime($row->modified)) : JText::_('No Date');
             //show only selected fields in a table row
             $list .= '<tr>';
             if ($ninjaboard_ShowSubject) {
                 $list .= '<td>' . $item->subject . '</td>';
             }
             if ($ninjaboard_ShowMessage) {
                 $list .= '<td>' . $item->message . '</td>';
             }
             if ($ninjaboard_ShowForum) {
                 $list .= '<td>' . $item->forum_link . '</td>';
             }
             if ($ninjaboard_ShowHits) {
                 $list .= '<td>' . $row->hits . '</td>';
             }
             if ($ninjaboard_ShowCreated) {
                 $list .= '<td>' . $item->c_datetime . '</td>';
             }
             if ($ninjaboard_ShowModified) {
                 $list .= '<td>' . $item->m_datetime . '</td>';
             }
             if ($ninjaboard_ShowEdit) {
                 $list .= '<td>' . $item->view_link . '</td>';
             }
             $list .= '</tr>';
         }
         $list .= '</tbody></table></div>';
         if ($ninjaboard_ShowPagination && $row_count > $limit) {
             $list .= '<div class="cbeNBpagination"><table><tr><td>';
             //$list .= KFactory::get('site::com.ninjaboard.helper.paginator',array('name' => 'posts'))->pagination($row_count, $offset, $limit , 4, true);
             jimport('joomla.html.pagination');
             $pagination = new JPagination($row_count, $offset, $limit);
             $list .= $pagination->getPagesLinks() . $pagination->getResultsCounter();
             $list .= '</td></tr></table></div>';
         }
         $list .= '</div>';
     }
     echo $list;
 }