Пример #1
0
    public static function showMailingList($mailings, &$lists, $start, $limit, $total, $emailsearch, $listId, $listType, $forms, $show, $action, $setLimit = null, $setSort = null)
    {
        $Itemid = JRequest::getInt('Itemid');
        $mainframe = JFactory::getApplication();
        $my = JFactory::getUser();
        $mainPath = JNEWS_PATH_ADMIN_IMAGES2 . 'header/';
        $css = '.icon-48-newsletter { background-image:url(' . $mainPath . 'newsletter.png)}';
        $doc = JFactory::getDocument();
        $doc->addStyleDeclaration($css, $type = 'text/css');
        //		$img = 'newsletter.png';
        $item = !empty($Itemid) ? '&Itemid=' . $Itemid : '';
        $hidden = '<input type="hidden" name="listid" value="' . $listId . '" />';
        $hidden .= '<input type="hidden" name="act" value="' . $action . '" />';
        $hidden .= '<input type="hidden" name="limit" value="' . $limit . '" />';
        $pos = strpos($forms['main'], "<form");
        if ($pos !== false) {
            $forms['select'] = "";
        }
        echo $forms['main'];
        // top portion before the table list
        // for search
        $toSearch = new stdClass();
        $toSearch->forms = $forms['select'];
        $toSearch->hidden = $hidden;
        $toSearch->listsearch = $emailsearch;
        $toSearch->id = 'emailsearch';
        $title = !empty($lists['title']) ? $lists['title'] : '';
        echo jnews::setTop($toSearch, $title, $setLimit);
        ?>

	<table class="<?php 
        echo jnews::myTheme();
        ?>
">
		<thead>
			<tr>
				<th width="40" height="20" align="center" class="title"><center>#</center></th>
				 <?php 
        if ($show['select']) {
            ?>
				<th width="32"  align="center" class="title">&nbsp;</th>
				 <?php 
        }
        if ($show['status']) {
            ?>
				<th  width="40" class="title" align="center"><center><?php 
            echo jnews::HTML_GridSort(_JNEWS_PUBLISHED, 'published', $setSort->orderDir, $setSort->orderValue);
            ?>
</center></th>
				 <?php 
        }
        if (empty($listType) || $listType == 0) {
            $listType = JRequest::getVar('listype', 0);
            //listType to listype
        }
        if ($listType == 2) {
            $show['delay'] = true;
            if ($show['delay']) {
                ?>
				<th width="80"  class="title" align="center"><center><?php 
                echo jnews::HTML_GridSort(_JNEWS_LIST_DELAY, 'delay', $setSort->orderDir, $setSort->orderValue);
                ?>
</center></th>
				 <?php 
            }
        }
        if ($listType == 1 or $listType == 7) {
            if ($show['sentdate']) {
                ?>
				<th width="140"  class="title"><?php 
                echo jnews::HTML_GridSort(_JNEWS_LIST_DATE, 'send_date', $setSort->orderDir, $setSort->orderValue);
                ?>
</th>
				 <?php 
            }
        }
        ?>
				<th class="title" align="left"><?php 
        echo jnews::HTML_GridSort(_JNEWS_LIST_SUB, 'subject', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
				<?php 
        if ($mainframe->isAdmin()) {
            ?>
				 <?php 
            if ($show['status']) {
                ?>
				<th width="40" class="title" align="center"><center><?php 
                echo jnews::HTML_GridSort(_JNEWS_VISIBLE, 'visible', $setSort->orderDir, $setSort->orderValue);
                ?>
</center></th>
				<?php 
            }
        }
        ?>
				<?php 
        if (!empty($show['send']) && $show['send'] || $mainframe->isAdmin()) {
            if ($listType == 1) {
                ?>
					<th width="100" class="title" align="left"><?php 
                echo _JNEWS_SENDBTN;
                ?>
</th>
				<?php 
            }
        }
        if ($mainframe->isAdmin()) {
            ?>
				<th width="100" class="title" align="left"><?php 
            echo _JNEWS_DELETEBTN;
            ?>
</th>
				 <?php 
        }
        if ($mainframe->isAdmin()) {
            ?>
<th width="140"  class="title"><?php 
            echo jnews::HTML_GridSort(_JNEWS_CREATE_DATE, 'createdate', $setSort->orderDir, $setSort->orderValue);
            ?>
</th><?php 
        }
        if ($show['id']) {
            ?>
				<th width="40" class="title"><center><?php 
            echo jnews::HTML_GridSort('ID', 'id', $setSort->orderDir, $setSort->orderValue);
            ?>
</center></th>
				<?php 
        }
        ?>
			</tr>
		</thead>
	<?php 
        if (!empty($mailings)) {
            $i = 0;
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $onClickFct = '';
            } else {
                $onClickFct = 'Joomla.';
            }
            foreach ($mailings as $mailing) {
                ?>
	<tr class="row<?php 
                echo ($i + 1) % 2;
                ?>
">
		<td  height="20" align="center"><center><?php 
                echo $i + 1 + $start;
                ?>
</center></td>
		 <?php 
                if (version_compare(JVERSION, '3.0.0', '<')) {
                    $onClickFct = '';
                } else {
                    $onClickFct = 'Joomla.';
                }
                if ($show['select']) {
                    ?>
		<td  align="center"><input type="radio" id="cb<?php 
                    echo $i;
                    ?>
" name="mailingid" value="<?php 
                    echo $mailing->id;
                    ?>
" onclick="<?php 
                    echo $onClickFct;
                    ?>
isChecked(this.checked);" /></td>
		 <?php 
                }
                if ($show['status']) {
                    switch ($mailing->published) {
                        case '1':
                            $img = '16/status_g.png';
                            jnews::getLegend('status_g.png', _JNEWS_VISIBLE . '/' . _JNEWS_TEMPLATE_PUBLISH);
                            break;
                        case '2':
                            $img = '16/status_y.png';
                            jnews::getLegend('status_y.png', _JNEWS_SCHEDULED);
                            break;
                        default:
                            $img = '16/status_r.png';
                            jnews::getLegend('status_r.png', _JNEWS_NOTVISIBLE . '/' . _JNEWS_UNPUBLISHED);
                            break;
                    }
                    $publishStatus = !empty($mailing->published) && $mailing->published == 1 ? 'unpublishMailing' : 'publishMailing';
                    ?>
		<td  align="center"><center><img src="<?php 
                    echo JNEWS_PATH_ADMIN_IMAGES2 . $img;
                    ?>
" width="12" height="12" border="0" alt="" /></center></td>
		<?php 
                }
                if ($listType == 2) {
                    if ($show['delay']) {
                        $delay = $mailing->delay / 1440;
                        ?>
		<td  align="center"><?php 
                        echo $delay;
                        ?>
</td>
		 <?php 
                    }
                }
                if ($listType == 1 or $listType == 7) {
                    if ($show['sentdate']) {
                        ?>
		<td width="200"><div align="center"><?php 
                        if ($mailing->send_date == 0 or $mailing->send_date == 1) {
                            echo '0000-00-00 00:00:00';
                        } else {
                            echo date('D, d M Y H:i:s', jnews::getNow(0, true, $mailing->send_date));
                        }
                    }
                    ?>
</div></td>
		 <?php 
                }
                $backendLink = $show['index'] == 'index' ? false : true;
                if (!$show['admin'] or $mailing->published == 1 and ($mailing->mailing_type == 1 or $mailing->mailing_type == 7 or $mailing->mailing_type == 2)) {
                    $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=view&listid=' . $listId . '&mailingid=' . $mailing->id . '&listype=' . $mailing->mailing_type . $item;
                } else {
                    $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=edit&mailingid=' . $mailing->id . '&listid=' . $listId . '&listype=' . $mailing->mailing_type . $item;
                }
                $link = jNews_Tools::completeLink($link, true, true, false);
                ?>
		<td align="left">
		<?php 
                if ($mainframe->isAdmin()) {
                    echo '<a  href="' . $link . '" >';
                    echo $mailing->subject;
                    echo '</a>';
                } else {
                    if ($GLOBALS[JNEWS . 'level'] > 1 || $mailing->published == 1) {
                        $archiveLinkType = !empty($GLOBALS[JNEWS . 'archive_link']) ? $GLOBALS[JNEWS . 'archive_link'] : '';
                        switch ($archiveLinkType) {
                            case 'popup':
                                $link .= '&tmpl=component';
                                echo '<a href="#" onClick="window.open(\'' . $link . '\', \'Detail\', \'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=800,height=600,left=150,top=150\');" >';
                                echo $mailing->subject;
                                echo '</a>';
                                break;
                            case 'newpage':
                                echo '<a  href="' . $link . '" target="_blank">';
                                echo $mailing->subject;
                                echo '</a>';
                                break;
                            case 'standard':
                            default:
                                echo '<a  href="' . $link . '" >';
                                echo $mailing->subject;
                                echo '</a>';
                                break;
                        }
                    } else {
                        echo $mailing->subject;
                    }
                }
                ?>
		</td>
		 <?php 
                if ($mainframe->isAdmin()) {
                    if ($show['status']) {
                        if ($mailing->visible == 1) {
                            $img = '16/status_g.png';
                            jnews::getLegend('status_g.png', _JNEWS_VISIBLE . '/' . _JNEWS_TEMPLATE_PUBLISH);
                        } else {
                            $img = '16/status_r.png';
                            jnews::getLegend('status_r.png', _JNEWS_NOTVISIBLE . '/' . _JNEWS_UNPUBLISHED);
                        }
                        $delQimg = 'delete_queue.png';
                        ?>
		<td align="center"><center>
			<a href="<?php 
                        $listidmailing = JRequest::getVar('listid');
                        $listtypemailing = JRequest::getInt('listype');
                        echo jnews::createToggleLink('mailing', 'visible', 'mailingid', $mailing->id, 'toggle', $listidmailing, $listtypemailing);
                        ?>
"> <img src="<?php 
                        echo JNEWS_PATH_ADMIN_IMAGES2 . $img;
                        ?>
" width="12" height="12" border="0" alt="" /> </a>
		</center></td>
		 <?php 
                    }
                }
                ?>
		<?php 
                if (!empty($show['send']) && $show['send'] || $mainframe->isAdmin()) {
                    if ($listType == 1) {
                        ?>
		<td align="center"><center>
			<?php 
                        JHTML::_('behavior.modal');
                        //we check here if we are in the fe or be
                        $sendready = true;
                        if (!$mainframe->isAdmin()) {
                            $sendready = false;
                        }
                        $linkFomr5 = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=sendready&mailingid=' . $mailing->id . '&listype=' . $mailing->mailing_type, $sendready, false, true);
                        ?>
			<a class="modal" href="<?php 
                        echo $linkFomr5;
                        ?>
" rel="{handler: 'iframe', size: {x: 750, y: 500}}">
			<img src="<?php 
                        echo JNEWS_PATH_ADMIN_IMAGES2 . 'message_sent.png';
                        ?>
"width="18" height="18" border="0" alt=""/> </a>
		</center></td>
		<?php 
                    }
                }
                if ($mainframe->isAdmin()) {
                    ?>
<script language="javascript" type="text/javascript">
	function deleteQueue(url){
		if(!confirm("Are you sure you want to delete the entries of this mailing from the Queue?")){
			return false;
		}else{
			window.location = url;
		}
	}
</script>
		<td align="center"><center>
			<a onclick="deleteQueue('<?php 
                    echo 'index.php?option=' . JNEWS_OPTION . '&act=mailing&task=deletequeue&mailingid=' . $mailing->id . '&listype=' . $mailing->mailing_type;
                    ?>
')" href="#"> <img src="<?php 
                    echo JNEWS_PATH_ADMIN_IMAGES2 . $delQimg;
                    ?>
"width="18" height="18" border="0" alt=""/> </a>
		</center></td>
		 <?php 
                }
                if ($mainframe->isAdmin()) {
                    ?>
		 <td align="center"><?php 
                    if ($mailing->createdate <= 0) {
                        echo '0000-00-00 00:00:00';
                    } else {
                        echo date('D, d M Y H:i:s', jnews::getNow(0, true, $mailing->createdate));
                    }
                    ?>
		 </td><?php 
                }
                if ($show['id']) {
                    ?>
		<td align="center"><center><?php 
                    echo $mailing->id;
                    ?>
</center></td>
		<?php 
                }
                ?>
	</tr>
	<?php 
                $i++;
            }
        }
        ?>
    <?php 
        if (is_array($listType)) {
            $listType = implode(',', $listType);
        }
        ?>
	</table>
    <input type="hidden" name="act" value="<?php 
        echo $action;
        ?>
" />
    <input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
    <input type="hidden" name="listype" value="<?php 
        echo $listType;
        ?>
" />
	<?php 
        echo '<br />';
        echo jnews::setLegend();
    }
Пример #2
0
function jnewsbot_k2_editab()
{
    $limit = 5;
    $limittotal = countK2Items();
    $setLimitk2 = jnews::setLimitPagination($limittotal);
    $task = JRequest::getVar('task');
    //filter
    if (isset($_POST['contentsearchk2'])) {
        $contentsearch = JRequest::getVar('contentsearchk2', 'post', '', 'string');
    } else {
        $contentsearch = "";
    }
    $toSearch = new stdClass();
    $toSearch->forms = '';
    //$toSearch->hidden = $hidden;
    $toSearch->listsearch = $contentsearch;
    $toSearch->id = 'contentsearchk2';
    $app = JFactory::getApplication();
    $setSortk2 = new stdClass();
    if (!isset($_POST['k2_filter_order'])) {
        $setSortk2->orderValue = "a.id";
    } else {
        $setSortk2->orderValue = $_POST['filter_order'];
    }
    $setSortk2->orderDir = $app->getUserStateFromRequest(JNEWS_OPTION . '.k2content.filter_order_Dir', 'filter_order_Dir', 'desc', 'word');
    $sort_select = JRequest::getVar('filter_category_id_k2', '', 'POST', 'int');
    $k2contentitems = jnewsbot_k2_getitems($contentsearch, $setLimitk2, $setSortk2, $sort_select);
    ob_start();
    $js = "var id_global, content_type, hide_title_global;\n            function setContentTag(id, hide_title_or_rendering)\n            {\n                if(id != null) {\n\n                    if(document.getElementById('for_disabled').checked === false)\n                    {\n                         document.getElementById('hide_title_yes').disabled=false;\n                    }\n\n                    if(hide_title_or_rendering ==undefined && hide_title_global == undefined)\n                    {\n                         hide_title_global = 0;\n                    }\n                    if(hide_title_or_rendering ==undefined && content_type == undefined)\n                    {\n                        content_type = 0;\n                    }\n                    if(id ==='rendering')\n                    {\n                        content_type = hide_title_or_rendering;\n                        if(id_global == undefined)  id_global = 0;\n                        if(hide_title_global == undefined) hide_title_global = 0;\n                        if(hide_title_or_rendering == 2)\n                        {\n                           // hide_title_global = 0;\n                            document.getElementById('hide_title_no').click();\n                            document.getElementById('hide_title_yes').disabled=true;\n\n                        }\n                    }\n                    if(id == 'hide_title')\n                    {\n                        hide_title_global = hide_title_or_rendering;\n                        if(id_global == undefined) id_global = 0;\n                        if(content_type == undefined) content_type = 0;\n                    }\n                    if( id % 1 === 0)\n                    {\n                        id_global = id;\n                        if(content_type == undefined) content_type = 0;\n                        if(hide_title_global == undefined) hide_title_global = 0;\n                    }\n\n                    var form = document.adminForm;\n                    if(!form){\n                            form = document.mosForm;\n                    }\n                    var tag = '{k2item:' + id_global + '|' + content_type +'|'+hide_title_global+ '}';\n                    form.k2tag.value = tag;\n\n                }\n                else\n                {           var form = document.adminForm;\n                            if(!form){\n                                    form = document.mosForm;\n                            }\n                            var tag = form.k2tag.value;     ";
    if (version_compare(JVERSION, '1.6.0', '<')) {
        //1.5
        $js .= " if(window.top.insertTag(tag)){window.top.document.getElementById('sbox-window').close();}";
    } else {
        if (version_compare(JVERSION, '3.0.0', '<')) {
            $js .= ' if(window.top.insertTag(tag)) {window.parent.SqueezeBox.close();}';
        } else {
            $js .= ' if(window.top.insertTag(tag)) {
                    var need_click = jQuery(window.top.document).find("div.modal-backdrop");
                    if(need_click.length == 0) window.parent.SqueezeBox.close();
                    else    jQuery(window.top.document).find("div.modal-backdrop").click();}';
        }
    }
    $js .= "}\n\t}";
    //if(window.top.insertTag(tag)){window.top.document.getElementById('sbox-window').close();}
    $doc = JFactory::getDocument();
    $doc->addScriptDeclaration($js);
    ?>


<style type="text/css">
table.smartcontent {
	border: 1px solid #D5D5D5;
	background-color: #F6F6F6;
	width: 100%;
	margin-bottom: 10px;
	-moz-border-radius:3px;
	-webkit-border-radius:3px;
	padding: 5px;
}
table.smartcontent td.key {
	background-color: #f6f6f6;
	text-align: left;
	width: 140px;
	color: #666;
	font-weight: bold;
	border-bottom: 1px solid #e9e9e9;
	border-right: 1px solid #e9e9e9;
}
</style>
<div id="element-box">
<div class="t">
    <div class="t">
        <div class="t"></div>
    </div>
</div>
<div class="m">



<form id="adminForm" name="adminForm" method="post" action="index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&tmpl=component&act=tags&task=k2content">



<table class="smartcontent" width="100%">
<tr>
<td width="185" class="key">
<span class="editlinktip">
<?php 
    $tip = _JNEWS_AUTONEWS_TYPE_TIPS;
    $title = _JNEWS_AUTONEWS_TYPE;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
</span>
</td>
<td style="vertical-align: top;">
<span class="editlinktip">
<?php 
    $tip = _JNEWS_TITLE_ONLY_TIPS;
    $title = _JNEWS_TITLE_ONLY;
    $title_only = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    $tip = _JNEWS_INTRO_ONLY_TIPS;
    $title = _JNEWS_INTRO_ONLY;
    $intro_only = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    $tip = _JNEWS_FULL_ARTICLE_TIPS;
    $title = _JNEWS_FULL_ARTICLE;
    $full_article = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    ?>
</span>
<span class="editlinktip">
    <input type="radio" onclick="setContentTag('rendering', 0)" name="content_type" value="0" checked="checked" /><?php 
    echo $full_article;
    ?>
    <input type="radio"  onclick="setContentTag('rendering', 1)" name="content_type" value="1" /><?php 
    echo $intro_only;
    ?>
    <input id="for_disabled" type="radio" onclick="setContentTag('rendering', 2)" name="content_type" value="2" /><?php 
    echo $title_only;
    ?>
</span>

</td>
<td rowspan="2">
        <input onclick="setContentTag(null)" class="inserttag" type="button" label="Insert Tag" name="Insert Tag" value="<?php 
    echo _JNEWS_TAG_INSERT_TAG;
    ?>
"/>
</td>
</tr>

<tr>
	<td width="185" class="key">
		<span class="editlinktip">
			Tag
		</span>
	</td>
	<td style="vertical-align: top;">
		<!-- 	<input type="text" onchange="setCaptionTags();" size="60px" name="jnewstagcaption"> -->
			<input type="text" size="60px" name="k2tag">
	</td>
</tr>
<tr>
	<td width="185" class="key">
		<span class="editlinktip">
                    <?php 
    $tip = _JNEWS_HIDE_TITTLE_ARTICLE_TIPS;
    $title = _JNEWS_HIDE_TITLE;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
		</span>
	</td>
	<td style="vertical-align: top;">
            <span class="hide_title" >
                <input id="hide_title_no" onclick="setContentTag('hide_title', 0);" type="radio" name="hide_title" value="0" checked="checked" /><?php 
    echo 'No';
    ?>
                <input id="hide_title_yes" onclick="setContentTag('hide_title', 1);" type="radio" name="hide_title" value="1" /><?php 
    echo 'Yes';
    ?>
            </span>
        </td>
</tr>
</table>
<div id="element-box">
    <div class="t">
        <div class="t">
            <div class="t"></div>
        </div>
    </div>


    <div class="m"  style="position:relative;">


    <input type="hidden" name="option" value="<?php 
    echo JNEWS_OPTION;
    ?>
" />
    <input type="hidden" name="limit" value="<?php 
    echo $limit;
    ?>
" />
<!--////////////////////////////////////////////////////-->
        <?php 
    echo jnews::setTop($toSearch, null);
    $category_list_k2 = getAllCategoriesK2();
    ?>
        <div style="position:absolute;top:5px; left:55%;">
            <select name="filter_category_id_k2" class="inputbox" onchange="this.form.submit()">
                <option value=""><?php 
    echo JText::_('JOPTION_SELECT_CATEGORY');
    ?>
</option>
                <?php 
    for ($i = 0; $i < count($category_list_k2); $i++) {
        ?>
                <option value="<?php 
        echo $category_list_k2[$i]->id;
        ?>
"  <?php 
        if ($sort_select == $category_list_k2[$i]->id) {
            echo "selected";
        }
        ?>
>
                    <?php 
        echo $category_list_k2[$i]->name;
        ?>
                </option>
               <?php 
    }
    ?>
            </select>
        </div>
        <table class="<?php 
    echo jnews::myTheme();
    ?>
" cellpadding="0" cellspacing="0">
            <tbody>
                <thead>
                    <tr>
                        <th width="80px" class="title">
                                <?php 
    if ($setSortk2->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.title','<?php 
    echo $new_sort;
    ?>
', 'k2content');" href="#">
                                       <?php 
    echo _JNEWS_TAGPICKLIST_TITLE;
    ?>
                                         <?php 
    if ($setSortk2->orderValue == 'a.title') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>

                        </th>
                           <th width="80px" class="title">
                                <?php 
    if ($setSortk2->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.title_2','<?php 
    echo $new_sort;
    ?>
', 'k2content');" href="#">
                                        <?php 
    echo _JNEWS_TAG_ARTICLESECTION;
    ?>
                                         <?php 
    if ($setSortk2->orderValue == 'a.title_2') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>

                        </th>
                        <th width="80px" class="title">
                                <?php 
    if ($setSortk2->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.catid','<?php 
    echo $new_sort;
    ?>
', 'k2content');" href="#">
                                        <?php 
    echo _JNEWS_TAG_ARTICLECATEGORY;
    ?>
                                         <?php 
    if ($setSortk2->orderValue == 'a.catid') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>

                        </th>
                        <th width="80px" class="title">
                                <?php 
    if ($setSortk2->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.id','<?php 
    echo $new_sort;
    ?>
', 'k2content');" href="#">
                                       <?php 
    echo "  ID";
    ?>
                                         <?php 
    if ($setSortk2->orderValue == 'a.id') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>

                        </th>

                    </tr>
                </thead>
                <?php 
    if (sizeof($k2contentitems) > 0) {
        $k = 0;
        foreach ($k2contentitems as $k2contentitem) {
            if (empty($k2contentitem->section)) {
                $k2contentitem->section = JText::_('Uncategorised');
            }
            if (empty($k2contentitem->category)) {
                $k2contentitem->category = JText::_('Uncategorised');
            }
            echo '<tr style="cursor:pointer" class="row' . $k . '" onclick="setContentTag(\'' . $k2contentitem->id . '\');" ><td>' . $k2contentitem->title . '</td><td nowrap="nowrap" align="center">' . $k2contentitem->section . '</td><td nowrap="nowrap" align="center">' . $k2contentitem->category . '</td><td nowrap="nowrap" align="center">' . $k2contentitem->id . '</td></tr>';
            $k = 1 - $k;
        }
    }
    ?>
            </tbody>
        </table>
   <?php 
    echo jnews::setPaginationBot($setLimitk2, 'margin:auto;');
    ?>

</div>
<div class="b">
<div class="b">
<div class="b"></div>
</div>
</div>
</div>
                <input type="hidden" value="<?php 
    echo $task;
    ?>
" name="task"/>
                <input type="hidden" value="<?php 
    echo $setSortk2->orderValue;
    ?>
" name="k2_filter_order"/>
                  <input type="hidden" value="<?php 
    echo $setSortk2->orderValue;
    ?>
" name="filter_order"/>
                <input type="hidden" value="<?php 
    echo $setSortk2->orderDir;
    ?>
" name="filter_order_Dir"/>
</form>
</div>
<div class="b">
<div class="b">
<div class="b"></div>
</div>
</div>
</div>
<?php 
    $return = ob_get_contents();
    ob_end_clean();
    return array(_JNEWS_CONTENT_ITEM, $return);
}
Пример #3
0
    public static function showSubscribers($subscribers, $action, $listId, &$lists, $start, $limit, $total, $showAdmin, $theLetterId, $emailsearch, $forms, $setLimit = null, $front = false, $setSort = null)
    {
        $my = JFactory::getUser();
        $mainframe = JFactory::getApplication();
        ?>

	<script language="javascript" type="text/javascript">
	//<!--
	function jnewsletterselectall(){
		var i = 0;
		allcheck = document.getElementById("selectallcheck");
		if(allcheck.checked) checkedvalue = 1;
		else checkedvalue = 0;

		while(myelement = document.getElementById("cid["+i+"]")){
			myelement.checked = checkedvalue;
			i++;
		}

		if(checkedvalue){
			document.getElementById("boxcount").value = i;
		}else{
			document.getElementById("boxcount").value = 0;
		}
	}
	 //-->
	</script>

	<?php 
        if ($listId == 0) {
            $message = _JNEWS_SUSCRIB_LIST;
        } else {
            $lt_name = jNews_Lists::getLists($listId, 0, null, '', false, false, true);
            $message = _JNEWS_SUSCRIB_LIST_UNIQUE . "<span style='color: rgb(51, 51, 51);'>" . @$lt_name[0]->list_name . "</span>";
        }
        $filter = _JNEWS_SEL_LIST . '  ' . $lists['listid'] . ' ' . $lists['subscirberType'];
        $hidden = '<input type="hidden" name="listid" value="' . $listId . '" />';
        $hidden .= '<input type="hidden" name="limit" value="' . $limit . '" />';
        $pos = strpos($forms['main'], "<form");
        if ($pos !== false) {
            $forms['select'] = "";
        }
        echo $forms['main'];
        // top portion before the table list
        // for search
        $toSearch = new stdClass();
        $toSearch->forms = $forms['select'];
        $toSearch->hidden = $hidden;
        $toSearch->listsearch = $emailsearch;
        $toSearch->id = 'emailsearch';
        echo jnews::setTop($toSearch, $message, $setLimit, $filter);
        ?>

		<table class="<?php 
        echo jnews::myTheme();
        ?>
">
		<thead>
		<tr>
			<th class="title">#</th>
			<th class="title"><input type="checkbox" id="selectallcheck" name="allchecked" onclick="jnewsletterselectall();"/></th>
			<th class="title"><?php 
        echo jnews::HTML_GridSort(_JNEWS_INPUT_NAME, 'name', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
		<?php 
        if ($mainframe->isAdmin()) {
            ?>
			<th class="title"><?php 
            echo jnews::HTML_GridSort(_JNEWS_INPUT_EMAIL, 'email', $setSort->orderDir, $setSort->orderValue);
            ?>
</th>
		<?php 
        } else {
            if ($GLOBALS[JNEWS . 'show_sub_email']) {
                ?>
				<th class="title"><?php 
                echo jnews::HTML_GridSort(_JNEWS_INPUT_EMAIL, 'email', $setSort->orderDir, $setSort->orderValue);
                ?>
</th>
		<?php 
            }
        }
        //endelse
        if ($mainframe->isAdmin()) {
            ?>
			<th class="title"><?php 
            echo jnews::HTML_GridSort(_JNEWS_SIGNUP_DATE, 'subscribe_date', $setSort->orderDir, $setSort->orderValue);
            ?>
</th>
		<?php 
        }
        ?>
			<th class="title"><center><?php 
        echo jnews::HTML_GridSort(_JNEWS_REGISTERED, 'user_id', $setSort->orderDir, $setSort->orderValue);
        ?>
</center></th>
			<th class="title"><center><?php 
        echo jnews::HTML_GridSort(_JNEWS_CONFIRMED, 'confirmed', $setSort->orderDir, $setSort->orderValue);
        ?>
</center></th>
			<th class="title"><center><?php 
        echo jnews::HTML_GridSort(_JNEWS_HTML, 'receive_html', $setSort->orderDir, $setSort->orderValue);
        ?>
</center></th>
		<?php 
        if ($GLOBALS[JNEWS . 'level'] > 2) {
            //check if the version of jnewsletter is pro
            if ($GLOBALS[JNEWS . 'show_column1'] == 1) {
                ?>
				<th class="title"><center><?php 
                echo $GLOBALS[JNEWS . 'column1_name'];
            }
            //<!--/center></th><!--column 1 in the subscribers list-BE-->
            if ($GLOBALS[JNEWS . 'show_column2'] == 1) {
                ?>
				<th class="title"><center><?php 
                echo $GLOBALS[JNEWS . 'column2_name'];
            }
            if ($GLOBALS[JNEWS . 'show_column3'] == 1) {
                ?>
				<th class="title"><center><?php 
                echo $GLOBALS[JNEWS . 'column3_name'];
            }
            if ($GLOBALS[JNEWS . 'show_column4'] == 1) {
                ?>
				<th class="title"><center><?php 
                echo $GLOBALS[JNEWS . 'column4_name'];
            }
            if ($GLOBALS[JNEWS . 'show_column5'] == 1) {
                ?>
				<th class="title"><center><?php 
                echo $GLOBALS[JNEWS . 'column5_name'];
            }
        }
        if (jnews::checkPermissions('admin')) {
            ?>
			<th class="title"><?php 
            echo jnews::HTML_GridSort('ID', 'id', $setSort->orderDir, $setSort->orderValue);
            ?>
</th>
		<?php 
        }
        ?>
		</tr>
		</thead>
		<?php 
        $i = 0;
        if (!empty($subscribers)) {
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $onClickFct = '';
            } else {
                $onClickFct = 'Joomla.';
            }
            foreach ($subscribers as $subscriber) {
                $subscriber->email = trim($subscriber->email);
                if (!jNews_Subscribers::validEmail($subscriber->email)) {
                    continue;
                }
                if ($subscriber->user_id != 0) {
                    $img = '16/status_g.png';
                    $alt = 'Registered';
                    jnews::getLegend('status_g.png', _JNEWS_REGISTERED . '/' . _JNEWS_CONFIRMED);
                } else {
                    $img = '16/status_r.png';
                    $alt = 'Unregistered';
                    jnews::getLegend('status_r.png', _JNEWS_SUBSCRIBERS_UNREGISTERED . '/' . _JNEWS_PIE_UNCONFIRMED);
                }
                //endelse
                if ($subscriber->confirmed == 1) {
                    $imgC = '16/status_g.png';
                    $altC = 'Confirmed';
                    jnews::getLegend('status_g.png', _JNEWS_REGISTERED . '/' . _JNEWS_CONFIRMED);
                } else {
                    $imgC = '16/status_r.png';
                    $altC = 'Not confirmed';
                    jnews::getLegend('status_r.png', _JNEWS_SUBSCRIBERS_UNREGISTERED . '/' . _JNEWS_PIE_UNCONFIRMED);
                }
                //endelse
                if ($subscriber->receive_html == 1) {
                    $imgH = '16/status_g.png';
                    $altH = 'HTML';
                    jnews::getLegend('status_g.png', _JNEWS_REGISTERED . '/' . _JNEWS_CONFIRMED);
                } else {
                    $imgH = '16/status_r.png';
                    $altH = 'TEXT';
                    jnews::getLegend('status_r.png', _JNEWS_SUBSCRIBERS_UNREGISTERED . '/' . _JNEWS_PIE_UNCONFIRMED);
                }
                //endelse
                ?>
					<tr class="row<?php 
                echo ($i + 1) % 2;
                ?>
">
						<td><center><?php 
                echo $i + 1 + $start;
                ?>
</center></td>

						<td>
							<center><input type="checkbox" id="cid[<?php 
                echo $i;
                ?>
]" name="cid[<?php 
                echo $i;
                ?>
]" value="<?php 
                echo $subscriber->id;
                ?>
" onclick="<?php 
                echo $onClickFct;
                ?>
isChecked(this.checked);" /></center>
						</td>
						<td>

			<?php 
                if (!$front) {
                    $href = "index.php?option=" . JNEWS_OPTION . "&act=" . $action . "&task=show&userid=" . $subscriber->id;
                } else {
                    $link = "option=" . JNEWS_OPTION . "&act=" . $action . "&task=show&userid=" . $subscriber->id;
                    $href = jNews_Tools::completeLink($link, false, true);
                }
                ?>

						<a href=<?php 
                echo $href;
                ?>
 >
						<?php 
                echo $subscriber->name;
                ?>
</a>
						</td>
					<?php 
                if (!jNews_Subscribers::validEmail($subscriber->email)) {
                    $subscriber->email = '';
                }
                if ($mainframe->isAdmin()) {
                    ?>
						<td><?php 
                    echo $subscriber->email;
                    ?>
</td>
					<?php 
                } else {
                    if ($GLOBALS[JNEWS . 'show_sub_email']) {
                        ?>
							<td><?php 
                        echo $subscriber->email;
                        ?>
</td>
					<?php 
                    }
                }
                //endelse
                if ($mainframe->isAdmin()) {
                    ?>
						<td><div align="center">
						<?php 
                    echo date('D, d M Y H:i:s', jnews::getNow(0, true, $subscriber->subscribe_date));
                }
                ?>
					</div></td>
						<td align="center">
							<img src="<?php 
                echo JNEWS_PATH_ADMIN_IMAGES2 . $img;
                ?>
" width="12" height="12" border="0" alt="<?php 
                echo $alt;
                ?>
" />
						</td>

						<td align="center">
							<a href="<?php 
                echo jnews::createToggleLink('subscribers', 'confirmed', 'subid', $subscriber->id, 'toggle', $listId);
                ?>
"> <img src="<?php 
                echo JNEWS_PATH_ADMIN_IMAGES2 . $imgC;
                ?>
" width="12" height="12" border="0" alt="<?php 
                echo $altC;
                ?>
" /> </a>
						</td>
						<td align="center">
							<a href="<?php 
                echo jnews::createToggleLink('subscribers', 'receive_html', 'subid', $subscriber->id, 'toggle', $listId);
                ?>
"> <img src="<?php 
                echo JNEWS_PATH_ADMIN_IMAGES2 . $imgH;
                ?>
" width="12" height="12" border="0" alt="<?php 
                echo $altH;
                ?>
" /> </a>
						</td>
						<?php 
                $i++;
                ?>
						<?php 
                if ($GLOBALS[JNEWS . 'level'] > 2) {
                    //check if the version of jnewsletter is 5.0.2
                    if ($GLOBALS[JNEWS . 'show_column1'] == 1) {
                        ?>
 <!--check to show/hide column 1 data in the subscribers list-->
							<td align="center"> <!--data for column1-->
								<?php 
                        echo $subscriber->column1;
                    }
                    ?>
							</td>
							<?php 
                    if ($GLOBALS[JNEWS . 'show_column2'] == 1) {
                        ?>
 <!--check to show/hide column 2 data in the subscribers list-->
							<td align="center"> <!--data for column1-->
								<?php 
                        echo $subscriber->column2;
                    }
                    ?>
							</td>
							<?php 
                    if ($GLOBALS[JNEWS . 'show_column3'] == 1) {
                        ?>
 <!--check to show/hide column 3 data in the subscribers list-->
							<td align="center"> <!--data for column3-->
								<?php 
                        echo $subscriber->column3;
                    }
                    ?>
							</td>
							<?php 
                    if ($GLOBALS[JNEWS . 'show_column4'] == 1) {
                        ?>
 <!--check to show/hide column 4 data in the subscribers list-->
							<td align="center"> <!--data for column4-->
								<?php 
                        echo $subscriber->column4;
                    }
                    ?>
							</td>
							<?php 
                    if ($GLOBALS[JNEWS . 'show_column5'] == 1) {
                        ?>
 <!--check to show/hide column 5 data in the subscribers list-->
							<td align="center"> <!--data for column5-->
								<?php 
                        echo $subscriber->column5;
                    }
                }
                //end check of version
                if (jnews::checkPermissions('admin')) {
                    echo '<td align="center">' . $subscriber->id . '</td>';
                }
                ?>
						</td>
					<?php 
            }
        }
        ?>
			</tr>
		</table>
		<input type="hidden" name="option" value="<?php 
        echo JNEWS_OPTION;
        ?>
" />
		<input type="hidden" name="act" value="<?php 
        echo $action;
        ?>
" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="userid" value="" />
		<input type="hidden" name="filter_order" value="<?php 
        echo $setSort->orderValue;
        ?>
" />
		<input type="hidden" name="filter_order_Dir" value="<?php 
        echo $setSort->orderDir;
        ?>
" />
		<input type="hidden" id="boxcount" name="boxchecked" value="0" />
		<?php 
        if (version_compare(JVERSION, '3.0.0', '<')) {
            echo JHTML::_('form.token');
        } else {
            echo JHtml::_('form.token');
        }
        ?>
		</form>
		<?php 
        echo '<br />';
        echo jnews::setLegend();
    }
Пример #4
0
    public static function showListingLists($lists, $action, $task, $forms, $show, $listsearch = '', $limit = 0, $setLimit = null, $totalSubs = null, $setSort = null, $totalUnSubs = null)
    {
        $Itemid = JRequest::getInt('Itemid');
        $mainframe = JFactory::getApplication();
        $my = JFactory::getUser();
        $loggedin = false;
        if ($my->id > 0) {
            $loggedin = true;
        }
        if (empty($Itemid) and !$mainframe->isAdmin() and !empty($GLOBALS[JNEWS . 'itemidAca'])) {
            $Itemid = $GLOBALS[JNEWS . 'itemidAca'];
        }
        if (!empty($Itemid)) {
            $item = '&Itemid=' . $Itemid;
        } else {
            $item = '';
        }
        echo $forms['main'];
        // top portion before the table list
        if ($mainframe->isAdmin()) {
            // for search
            $toSearch = new stdClass();
            $toSearch->listsearch = $listsearch;
            $toSearch->id = 'listsearch';
            echo jnews::setTop($toSearch, null, $setLimit);
        }
        echo '<table class="' . jnews::myTheme() . '"><thead><tr>';
        echo '<th width="2%" class="title">#</td>';
        if ($show['select']) {
            echo '<th width="3%" style="text-align:center;" class="title"></th>';
        }
        echo '<th width="30%" class="title"><center>' . jnews::HTML_GridSort(_JNEWS_LIST_NAME, 'list_name', $setSort->orderDir, $setSort->orderValue) . '</th>';
        if ($show['sender']) {
            echo '<th width="20%" class="title"><center>' . jnews::HTML_GridSort(_JNEWS_LIST_SENDER, 'sendername', $setSort->orderDir, $setSort->orderValue) . '</center> </th>';
        }
        if ($show['sender_email']) {
            echo ' <th width="15%" class="title"><center>' . _JNEWS_SENDER_EMAIL . '</center></th>';
        }
        if ($show['mailings_link']) {
            echo '<th width="17%" class="title"><center>' . _JNEWS_MENU_MAILING_TITLE . '</center></th>';
        }
        if ($show['mailings_sub']) {
            echo '<th width="17%" class="title"><center>' . _JNEWS_SUBSCRIBER_CONFIG . '</center></th>';
            echo '<th width="17%" class="title"><center>' . _JNEWS_UNSUBSCRIBER_CONFIG . '</center></th>';
        }
        if ($show['visible']) {
            echo '<th width="5%" class="title"><center>' . jnews::HTML_GridSort(_JNEWS_VISIBLE, 'hidden', $setSort->orderDir, $setSort->orderValue) . '</center></th>';
        }
        if ($show['published']) {
            echo '<th width="5%" class="title"><center>' . jnews::HTML_GridSort(_JNEWS_PUBLISHED, 'published', $setSort->orderDir, $setSort->orderValue) . '</center></th>';
        }
        if ($show['buttons']) {
            if ($GLOBALS[JNEWS . 'allow_unregistered'] or $loggedin) {
                echo '<th class="title" width="90"><center>' . _JNEWS_SUBSCRIB . '</center></th>';
            }
            if ($GLOBALS[JNEWS . 'show_archive'] == '1') {
                echo '<th class="title" width="90"><center>' . _JNEWS_VIEW_ARCHIVE . '</center></th>';
            }
        }
        if ($show['id']) {
            echo '<th width="2%" class="title">' . jnews::HTML_GridSort('ID', 'id', $setSort->orderDir, $setSort->orderValue) . '</th>';
        }
        echo '</tr></thead>';
        $i = 0;
        $ctr = 0;
        //total subs
        if (!empty($lists)) {
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $onClickFct = '';
            } else {
                $onClickFct = 'Joomla.';
            }
            foreach ($lists as $list) {
                $i++;
                if ($list->list_type == 1 or $list->list_type == 7) {
                    //mariap
                    $linkArchive = 'option=' . JNEWS_OPTION . '&act=mailing&listid=' . $list->id . '&listype=' . $list->list_type . '&task=archive' . $item;
                } else {
                    $linkArchive = '#';
                }
                ?>
		<tr class="row<?php 
                echo ($i + 2) % 2;
                ?>
">
			<?php 
                $num = isset($setLimit->start) ? $i + $setLimit->start : $i;
                echo '<td width="2%" class="title"><center>' . $num . '</center></td>';
                ?>
			<?php 
                if ($show['select']) {
                    ?>
			<td><center><input type="radio" name="listid" value="<?php 
                    echo $list->id;
                    ?>
" onclick="<?php 
                    echo $onClickFct;
                    ?>
isChecked(this.checked);" /></center></td>
			<?php 
                }
                if ($show['index'] == 'index') {
                    if ($mainframe->isAdmin()) {
                        if (jnews::checkPermissions('admin')) {
                            $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=' . $task . '&listid=' . $list->id . $item;
                        } else {
                            $link = $linkArchive;
                        }
                    } else {
                        if (jnews::checkPermissions('admin')) {
                            $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=' . $task . '&listid=' . $list->id . '&listype=' . $list->list_type . $item;
                        } else {
                            $link = $linkArchive;
                        }
                    }
                    $link = jNews_Tools::completeLink($link, false);
                } else {
                    if ($mainframe->isAdmin()) {
                        $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=' . $task . '&listid=' . $list->id;
                        $link = jNews_Tools::completeLink($link);
                    } else {
                        $link = 'option=' . JNEWS_OPTION . '&act=' . $action . '&task=' . $task . '&listid=' . $list->id . '&listype=' . $list->list_type;
                        $link = jNews_Tools::completeLink($link);
                    }
                }
                ?>
			<td>
				<span class="aca_letter_names" <?php 
                if ($link == "#" or $link == "administrator/#") {
                    echo " onclick='return false;' ";
                }
                ?>
>
				<?php 
                echo jNews_Tools::toolTip($list->list_desc, $list->list_name, '', '', $list->list_name, $link, 1);
                ?>
				</span>
			</td>

			<?php 
                if ($show['sender']) {
                    echo '<td>' . $list->sendername . '</td>';
                }
                if ($show['sender_email']) {
                    echo ' <td width="20%" class="title">' . $list->senderemail . '</td>';
                }
                if ($show['mailings_link']) {
                    $ltype = isset($list->list_type) && $list->list_type == 2 ? 2 : 1;
                    if ($show['index'] == 'index') {
                        $link = 'option=' . JNEWS_OPTION . '&act=mailing&task=show&listid=' . $list->id;
                        if (!empty($ltype)) {
                            $link .= '&listype=' . $ltype;
                        }
                        $link .= $item;
                        $link = jNews_Tools::completeLink($link, false);
                    } else {
                        $link = 'option=' . JNEWS_OPTION . '&act=mailing&task=show&listid=' . $list->id;
                        if (!empty($ltype)) {
                            $link .= '&listype=' . $ltype;
                        }
                        $link = jNews_Tools::completeLink($link);
                    }
                    //for autoresponder list only we need to filter the autoresponders to their associated list
                    if ($action == 'arlist') {
                        $link = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&listype=2&listid=' . $list->id;
                    }
                    //listType to listype
                    ?>
				<td><center><a href="<?php 
                    echo $link;
                    ?>
"> <?php 
                    echo _JNEWS_MALING_EDIT_VIEW;
                    ?>
</a></center></td>
			<?php 
                }
                if ($show['mailings_sub']) {
                    if ($show['index'] == 'index') {
                        $link = 'option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $list->id . '&subtype=1' . $item;
                        $link = jNews_Tools::completeLink($link, false);
                        $linkUnsubscribed = 'option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $list->id . '&subtype=2' . $item;
                        $linkUnsubscribed = jNews_Tools::completeLink($linkUnsubscribed, false);
                    } else {
                        $link = 'option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $list->id . '&subtype=1';
                        $link = jNews_Tools::completeLink($link);
                        $linkUnsubscribed = 'option=' . JNEWS_OPTION . '&act=subscribers&listid=' . $list->id . '&subtype=2';
                        $linkUnsubscribed = jNews_Tools::completeLink($linkUnsubscribed);
                    }
                    ?>
				<td><center><a href="<?php 
                    echo $link;
                    ?>
">
				<?php 
                    echo _JNEWS_SUBCRIBERS_VIEW . " ( {$totalSubs[$ctr]} ) ";
                    ?>
					</center>
				</td>
				<td><center><a href="<?php 
                    echo $linkUnsubscribed;
                    ?>
">
				<?php 
                    echo _JNEWS_UNSUBCRIBERS_VIEW . " ( {$totalUnSubs[$ctr]} ) ";
                    // $totalSubs[$ctr]
                    ?>
					</center>
				</td>
			<?php 
                    $ctr++;
                }
                if ($show['visible']) {
                    if ($list->hidden == 1) {
                        $img = '16/status_g.png';
                        jnews::getLegend('status_g.png', _JNEWS_VISIBLE . '/' . _JNEWS_TEMPLATE_PUBLISH);
                    } else {
                        $img = '16/status_r.png';
                        jnews::getLegend('status_r.png', _JNEWS_NOTVISIBLE . '/' . _JNEWS_UNPUBLISHED);
                    }
                    ?>
			<td height="20"><center>
			<?php 
                    if ($mainframe->isAdmin()) {
                        ?>
				<a href="<?php 
                        $act = JRequest::getVar('act', 'list', '', 'WORD');
                        echo jnews::createToggleLink($act, 'hidden', 'listid', $list->id);
                        ?>
"> <img src="<?php 
                        echo JNEWS_PATH_ADMIN_IMAGES2 . $img;
                        ?>
" width="12" height="12" border="0" alt="" /> </a>
			<?php 
                    } else {
                        ?>
				<img src="<?php 
                        echo JNEWS_PATH_ADMIN_IMAGES2 . $img;
                        ?>
" width="12" height="12" border="0" alt="" />
			<?php 
                    }
                    ?>
			</center></td>
			<?php 
                }
                if ($show['published']) {
                    ?>
			<td align="center"><center>
				<?php 
                    if ($list->published == 1) {
                        $img = '16/status_g.png';
                        $alt = 'Published';
                        jnews::getLegend('status_g.png', _JNEWS_VISIBLE . '/' . _JNEWS_TEMPLATE_PUBLISH);
                    } else {
                        if ($list->published == 2) {
                            $img = '16/status_y.png';
                            $alt = 'Scheduled';
                            jnews::getLegend('status_y.png', _JNEWS_SCHEDULED);
                        } else {
                            $img = '16/status_r.png';
                            $alt = 'Unpublished';
                            jnews::getLegend('status_r.png', _JNEWS_NOTVISIBLE . '/' . _JNEWS_UNPUBLISHED);
                        }
                    }
                    $status = !empty($list->published) && $list->published == 1 ? 'unpublish' : 'publish';
                    if ($mainframe->isAdmin()) {
                        ?>
					<a href="<?php 
                        $act = JRequest::getVar('act', 'list', '', 'WORD');
                        echo jnews::createToggleLink($act, $status, 'listid', $list->id, 'togle');
                        ?>
"> <img src="<?php 
                        echo JNEWS_PATH_ADMIN_IMAGES2 . $img;
                        ?>
" width="12" height="12" border="0" alt="<?php 
                        echo $alt;
                        ?>
" /> </a>
				<?php 
                    } else {
                        ?>
					 <img src="<?php 
                        echo JNEWS_PATH_ADMIN_IMAGES2 . $img;
                        ?>
" width="12" height="12" border="0" alt="<?php 
                        echo $alt;
                        ?>
" />
				<?php 
                    }
                    ?>
			</center></td>
			<?php 
                }
                ?>


	<?php 
                if ($show['buttons']) {
                    $backendLink = $show['index'] == 'index' ? false : true;
                    if ($GLOBALS[JNEWS . 'allow_unregistered'] or $loggedin) {
                        $link = 'index.php?option=' . JNEWS_OPTION . '&act=subone&listid=' . $list->id . $item;
                        $link = JRoute::_($link);
                        $img = 'folder_add_f2.png';
                        echo '<td align="center" height="24"><center>';
                        echo '<a href="' . $link . '" >' . "\n\r";
                        echo '<img src="' . JNEWS_JPATH_LIVE . '/components/' . JNEWS_OPTION . '/images/' . $img . '" width="20" height="20" border="0" alt="" /></a></center></td>' . "\n\r";
                    }
                    if (($list->list_type == 1 or $list->list_type == 7) && $GLOBALS[JNEWS . 'show_archive'] == '1') {
                        $linkArchive = 'option=' . JNEWS_OPTION . '&act=mailing&listid=' . $list->id . '&listype=' . $list->list_type . '&task=archive' . $item;
                        $linkArchive = jNews_Tools::completeLink($linkArchive, true);
                        $img = 'move_f2.png';
                        echo '<td height="24"><center>';
                        echo '<a href="' . $linkArchive . '" >' . "\n\r";
                        echo '<img src="' . JNEWS_JPATH_LIVE . '/components/' . JNEWS_OPTION . '/images/' . $img . '" width="20" height="20" border="0" alt="' . _JNEWS_VIEW_ARCHIVE . '" /></a></center></td>' . "\n\r";
                    } elseif ($GLOBALS[JNEWS . 'show_archive'] == '1') {
                        //ifthe list is an autoresponder don't need to show the archives
                        echo '<td height="24"><center>-</center></td>' . "\n\r";
                    }
                }
                if ($show['id']) {
                    echo '<td width="2%" class="title"><center>' . $list->id . '</center></td>';
                }
                echo '	</tr>' . "\n\r";
            }
        }
        echo '</table>';
        echo '<br />';
        echo jnews::setLegend();
    }
Пример #5
0
function jnewsbot_content_editab($forms)
{
    if (version_compare(JVERSION, '3.0.0', '<')) {
        JHTML::_('behavior.mootools');
    } else {
        JHtmlBehavior::framework();
    }
    $siteContent = new siteContent();
    //	$limit = -1;
    $limit = 5;
    $limittotal = $siteContent->countSiteCount();
    $setLimit = jnews::setLimitPagination($limittotal);
    $action = JRequest::getVar('act', '', '', 'WORD');
    $task = JRequest::getVar('task');
    $contentsearch = JRequest::getVar('contentsearch', '');
    echo $forms['main'];
    $hidden = '<input type="hidden" name="option" value="' . JNEWS_OPTION . '" />';
    $hidden .= '<input type="hidden" name="limit" value="' . $limit . '" />';
    $toSearch = new stdClass();
    $toSearch->forms = '';
    $toSearch->hidden = $hidden;
    $toSearch->listsearch = $contentsearch;
    $toSearch->id = 'contentsearch';
    $app = JFactory::getApplication();
    $setSort = new stdClass();
    if (!isset($_POST['c_filter_order'])) {
        $setSort->orderValue = "a.id";
    } else {
        $setSort->orderValue = $_POST['filter_order'];
    }
    //$setSort->orderValue = $app->getUserStateFromRequest(JNEWS_OPTION . '.content.filter_order', 'filter_order', 'a.id', 'cmd');
    $setSort->orderDir = $app->getUserStateFromRequest(JNEWS_OPTION . '.content.filter_order_Dir', 'filter_order_Dir', 'desc', 'word');
    //$setSort->orderValue  = "a.id";
    $contentItems = jnewsbot_content_getitems($contentsearch, $setLimit, $setSort);
    ob_start();
    $js = "function setContentTag(id, url, changeType , hide_title)\n           {\n\n                if(hide_title ==undefined)\n                {\n                    var check_title =  document.getElementById('hide_title_no').checked;\n                    if(check_title) hide_title = 0;\n                    else            hide_title = 1;\n\n                }\n\n\n\n                var form = document.adminForm;\n                if(!form)\n                {\n                        form = document.mosForm;\n                }\n\n                if(form.content_type[2].checked === false)\n                {\n                        document.getElementById('hide_title_yes').disabled=false;\n                }\n                else\n                {\n                      document.getElementById('hide_title_no').click();\n                      hide_title = 0;\n                      document.getElementById('hide_title_yes').disabled=true;\n                }\n                if(id!=null)\n                {\n                        for (i=0; i<form.content_type.length; i++)\n                        {\n                                if (form.content_type[i].checked)\n                                {\n                                        var content_type = form.content_type[i].value;\n                                }\n                        }";
    //   if ( @include_once( JNEWSPATH_ADMIN . 'social' .DS. 'class.social.php' ) ) {
    if (!$GLOBALS[JNEWS . 'use_tags'] and class_exists('jNews_Social') or !$GLOBALS[JNEWS . 'use_tags'] and $GLOBALS[JNEWS . 'level'] > 2) {
        $js .= "\n                            if(changeType!=null)\n                                id = document.getElementById('insertbot').value;\n\n                            template = window.top.document.getElementById('template_id');\n                            templateid = template.value;\n\n                            var tag =  id;\n                            if(id != 0)\n                                getContent(id, content_type, url,templateid);\n\n                            form.contenttag.value = tag;\n                    }\n                    //if id == null\n                    else\n                    {\n                            var tag = form.contentreplace.value;";
        if (version_compare(JVERSION, '1.6.0', '<')) {
            //1.5
            $js .= " if(window.top.insertTag(tag)){window.top.document.getElementById('sbox-window').close();}";
        } else {
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $js .= ' if(window.top.insertTag(tag)) {window.parent.SqueezeBox.close();}';
            } else {
                $js .= 'if(window.top.insertTag(tag))
                                        {
                                            var need_click = jQuery(window.top.document).find("div.modal-backdrop");
                                            if(need_click.length == 0) window.parent.SqueezeBox.close();
                                            else    jQuery(window.top.document).find("div.modal-backdrop").click();}';
            }
        }
        $js .= "}\n                      }";
    } else {
        $js .= "\n                                if(changeType==null)\n                                        form.botID.value= id;\n\n                                var tag = '{contentitem:' + form.botID.value + '|' + content_type +'|'+hide_title+ '}';\n\n                                form.contenttag.value = tag;\n                    }\n                    //if id -- null\n                    else\n                    {\n\n                                var tag = form.contenttag.value;";
        if (version_compare(JVERSION, '1.6.0', '<')) {
            //1.5
            $js .= " if(window.top.insertTag(tag)){window.top.document.getElementById('sbox-window').close();}";
        } else {
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $js .= ' if(window.top.insertTag(tag)) {window.parent.SqueezeBox.close();}';
            } else {
                $js .= ' if(window.top.insertTag(tag)) {
                                                var need_click = jQuery(window.top.document).find("div.modal-backdrop");
                                                if(need_click.length == 0) window.parent.SqueezeBox.close();
                                                else    jQuery(window.top.document).find("div.modal-backdrop").click();}';
            }
        }
        $js .= "}\n                            }";
    }
    //end function
    if (version_compare(JVERSION, '1.6.0', '<')) {
        //1.5
        $js .= "\n\n \t\t\tfunction getContent(id, content_type, url, templateid){\n\n \t\t\t\tvar ajax = new Ajax(url,\n \t\t\t\t\t{data: 'artId='+id+'&content_type='+content_type+'&templateid='+templateid,\n \t\t\t\t\tmethod: 'POST',\n \t\t\t\t\tonComplete : function(result){insertContent(result, id); }\n \t\t\t\t\t}\n \t\t\t\t);\n \t\t\t\tajax.request();\n \t\t\t}";
    } else {
        $js .= "\n \t\t\tfunction getContent(id, content_type, url,templateid){\n\n\t\t\t\tvar ajax = new Request({\n\t\t\t\turl : url,\n\t\t\t\tdata: 'artId='+id+'&content_type='+content_type+'&templateid='+templateid,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tonComplete : function(result){insertContent(result, id); }\n\t\t\t\t});\n\t\t\t\tajax.send();\n \t\t\t}";
    }
    $js .= "\n \t\t\tfunction insertContent(html, id){\n\t\t\t\tvar form = document.adminForm;\n\t\t\t\tif(!form){\n\t\t\t\t\tform = document.mosForm;\n\t\t\t\t}\n\n\t\t\t\tvar root = document.createElement('div');\n\n\t\t\t\troot.innerHTML = html;\n\t\t\t\tvar body = document.getElementsByTagName('body')[0].appendChild(root);\n\n\t\t\t\troot.setAttribute(\"style\", \"width:150px; display:none\");\n\t\t\t\tvar element = document.getElementById('artcontent_'+id);\n\n\t\t\t\tform.contentreplace.value = element.innerHTML;\n\n\t\t\t\tdocument.getElementsByTagName('body')[0].removeChild(root);\n\t\t\t}\n\t\t\t";
    $url = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=articleContent', false, false, true);
    $doc = JFactory::getDocument();
    $doc->addScriptDeclaration($js);
    ?>

    <style type="text/css">
        table.smartcontent {
            border: 1px solid #D5D5D5;
            background-color: #F6F6F6;
            width: 100%;
            margin-bottom: 10px;
            -moz-border-radius:3px;
            -webkit-border-radius:3px;
            padding: 5px;
        }
        table.smartcontent td.key {
            background-color: #f6f6f6;
            text-align: left;
            width: 140px;
            color: #666;
            font-weight: bold;
            border-bottom: 1px solid #e9e9e9;
            border-right: 1px solid #e9e9e9;
        }
    </style>
    <div id="element-box">
        <div class="t">
            <div class="t">
                <div class="t"></div>
            </div>
        </div>
        <div class="m">




    <!--<form name="adminForm" method="post" action="index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&tmpl=component">-->
            <table class="smartcontent" width="100%"">
                   <tr>
                    <td width="185" class="key">
                        <span class="editlinktip">
                            <?php 
    $tip = _JNEWS_AUTONEWS_TYPE_TIPS;
    $title = _JNEWS_AUTONEWS_TYPE;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
                        </span>
                    </td>
                    <td style="vertical-align: top;">
                        <span class="editlinktip">
    <?php 
    $tip = _JNEWS_TITLE_ONLY_TIPS;
    $title = _JNEWS_TITLE_ONLY;
    $title_only = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    $tip = _JNEWS_INTRO_ONLY_TIPS;
    $title = _JNEWS_INTRO_ONLY;
    $intro_only = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    $tip = _JNEWS_FULL_ARTICLE_TIPS;
    $title = _JNEWS_FULL_ARTICLE;
    $full_article = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    //                                $tip =  _JNEWS_HIDE_TITTLE_ARTICLE_TIPS;
    //				$title =  _JNEWS_HIDE_TITLE ;
    //				$hide_title = "<span class=\"editlinktip\">" . jNews_Tools::toolTip( $tip, '', 280, 'tooltip.png', $title, '', 0 ) . "</span>";
    ?>
                        </span>
                        <span class="editlinktip">
                            <input id="content_type" type="radio" name="content_type" value="0" checked="checked" onclick="setContentTag(1,'<?php 
    echo $url;
    ?>
', 0);"/><?php 
    echo $full_article;
    ?>
                            <input id="content_type" type="radio" name="content_type" value="1" onclick="setContentTag(1, '<?php 
    echo $url;
    ?>
', 1);"/><?php 
    echo $intro_only;
    ?>
                            <input id="content_type" type="radio" name="content_type" value="2" onclick="setContentTag(1, '<?php 
    echo $url;
    ?>
', 2);"/><?php 
    echo $title_only;
    ?>
                            <!--<input id="content_type" type="radio" name="content_type" value="3" onclick="setContentTag(1, '<?php 
    //echo $url
    ?>
', 3);"/><?php 
    //echo $hide_title;
    ?>
-->
                        </span>

                    </td>
                    <td rowspan="2">
                        <input onclick="setContentTag(null,'<?php 
    echo $url;
    ?>
')" class="inserttag" type="button" label="Insert Content" name="Insert Content" value="Insert Content"/>
                    </td>
                </tr>

                <tr>
                    <td width="185" class="key">
                        <span class="editlinktip">
    <?php 
    $tip = _JNEWS_CONTENT_TIP;
    $title = _JNEWS_CONTENT_ID;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
                        </span>
                    </td>
                    <td style="vertical-align: top;">
                                    <!--  <input type="text" onchange="setCaptionTags();" size="60px" name="jnewstagcaption"> -->
                        <input id="insertbot" type="text" size="20px" name="contenttag" value="0"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input id="insertbot" type="hidden" size="60px" name="contentreplace" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input id="botID" size="10px" name="botID" value="0" type="hidden"/>
                    </td>
                </tr>


                <tr>
                    <td width="185" class="key">
                        <span class="editlinktip">
                    <?php 
    $tip = _JNEWS_HIDE_TITTLE_ARTICLE_TIPS;
    $title = _JNEWS_HIDE_TITLE;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
                        </span>
                    </td>
                    <td style="vertical-align: top;">
                        <input id="hide_title_no" onclick="setContentTag(1, '<?php 
    echo $url;
    ?>
', 2, 0);" type="radio" name="hide_title" value="0" checked="checked" /><?php 
    echo 'No';
    ?>
                        <input id="hide_title_yes" onclick="setContentTag(1, '<?php 
    echo $url;
    ?>
', 2, 1);" type="radio" name="hide_title" value="1" /><?php 
    echo 'Yes';
    ?>

                    </td>
                </tr>
            </table>
            <div id="element-box">
                <div class="t">
                    <div class="t">
                        <div class="t"></div>
                    </div>
                </div>
                <div class="m" style="position:relative;">
                                    <?php 
    echo jnews::setTop($toSearch, null);
    $select_cat = version_compare(JVERSION, '1.6.0', '<') ? 'SELECT CATEGORY' : 'JOPTION_SELECT_CATEGORY';
    ?>
                    <div style="position:absolute;top:5px; left:55%;">
                    <?php 
    $sort_select = JRequest::getVar('filter_category_id', '', 'POST', 'int');
    ?>
                        <select name="filter_category_id" class="inputbox" onchange="this.form.submit()">
                            <option value=""><?php 
    echo JText::_($select_cat);
    ?>
</option>
                            <?php 
    if (version_compare(JVERSION, '1.6.0', '<')) {
        echo getCatListFromJoomla15($sort_select);
    } else {
        echo JHtml::_('select.options', JHtml::_('category.options', 'com_content'), 'value', 'text', $sort_select);
    }
    ?>
                        </select>
                    </div>
<!--                          border: 1px solid #CCCCCC;-->
                    <table class="joobilist" cellpadding="0" cellspacing="0">
                        <tbody>
                        <thead>
                            <tr>
                                <th class="title">
                                      <?php 
    if ($setSort->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                                <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.title','<?php 
    echo $new_sort;
    ?>
', 'content');" href="#">
                                                    <?php 
    echo JText::_(_JNEWS_TAGPICKLIST_TITLE);
    ?>
                                                    <?php 
    if ($setSort->orderValue == 'a.title') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                                </a>
    <?php 
    //echo _JNEWS_TAGPICKLIST_TITLE;
    // echo jnews::HTML_GridSort(_JNEWS_TAGPICKLIST_TITLE, 'a.title', $setSort->orderDir, $setSort->orderValue);
    ?>
                                </th>
                                <th width="80px" class="title">
                        <?php 
    //echo _JNEWS_TAG_ARTICLESECTION;
    if (version_compare(JVERSION, '1.6.0', '<')) {
        //j15
        echo jnews::HTML_GridSort(_JNEWS_TAG_ARTICLESECTION, 'b.title', $setSort->orderDir, $setSort->orderValue);
    } else {
        ?>

                              <?php 
        if ($setSort->orderDir == 'asc') {
            $new_sort = "desc";
        } else {
            $new_sort = "asc";
        }
        ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('c.title_2','<?php 
        echo $new_sort;
        ?>
', 'content');" href="#">
                                        <?php 
        echo JText::_(_JNEWS_TAG_ARTICLESECTION);
        ?>
                                         <?php 
        if ($setSort->orderValue == 'c.title_2') {
            ?>
<i class="icon-arrow-<?php 
            echo $new_sort == "asc" ? "up" : "down";
            ?>
"></i><?php 
        }
        ?>
                                    </a>

<!--                            echo jnews::HTML_GridSort(_JNEWS_TAG_ARTICLESECTION, 'b.title', $setSort->orderDir, $setSort->orderValue);-->
                        <?php 
    }
    ?>
                                </th>
                                <th width="80px" class="title">
                                <?php 
    if ($setSort->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('c.title','<?php 
    echo $new_sort;
    ?>
', 'content');" href="#">
                                        <?php 
    echo JText::_(_JNEWS_TAG_ARTICLECATEGORY);
    ?>
                                         <?php 
    if ($setSort->orderValue == 'c.title') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>
                    <?php 
    //echo _JNEWS_TAG_ARTICLECATEGORY;
    // echo jnews::HTML_GridSort(_JNEWS_TAG_ARTICLECATEGORY, 'c.title', $setSort->orderDir, $setSort->orderValue);
    ?>
                                </th>
                                <th width="30px" class="title">
                                    <?php 
    if ($setSort->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                        <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.id','<?php 
    echo $new_sort;
    ?>
', 'content');" href="#">
                                            ID
                                             <?php 
    if ($setSort->orderValue == 'a.id') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                        </a>
                                        <?php 
    //echo jnews::HTML_GridSort('ID', 'a.id', $setSort->orderDir, $setSort->orderValue, 'task');
    ?>
                                </th>
                            </tr>
                        </thead>
    <?php 
    if (sizeof($contentItems) > 0) {
        $k = 0;
        foreach ($contentItems as $contentItem) {
            if (empty($contentItem->section)) {
                $contentItem->section = JText::_('Uncategorised');
            }
            if (empty($contentItem->category)) {
                $contentItem->category = JText::_('Uncategorised');
            }
            echo '<tr style="cursor:pointer" class="row' . $k . '" onclick="setContentTag(\'' . $contentItem->id . '\',\'' . $url . '\');" ><td>' . $contentItem->title . '</td><td nowrap="nowrap" align="center">' . $contentItem->section . '</td><td nowrap="nowrap" align="center">' . $contentItem->category . '</td><td nowrap="nowrap" align="center">' . $contentItem->id . '</td></tr>';
            //echo '<tr style="cursor:pointer" class="row'.$k.'" onclick="setContentTag(\''.$contentItem->id.'\',\''.$url.'\');" ><td>'.$contentItem->title.'</td><td nowrap="nowrap" align="center">'.$contentItem->section.'</td><td nowrap="nowrap" align="center">'.$contentItem->category.'</td><td nowrap="nowrap" align="center">'.$contentItem->id.'</td></tr>';
            $k = 1 - $k;
        }
    }
    ?>
                        </tbody>
                    </table>
    <?php 
    echo jnews::setPaginationBot($setLimit, 'margin:auto;');
    ?>
                    <input type="hidden" value="<?php 
    echo JNEWS_OPTION;
    ?>
" name="option"/>
                    <input type="hidden" value="<?php 
    echo $action;
    ?>
" name="act"/>
                    <input type="hidden" value="<?php 
    echo $task;
    ?>
" name="task"/>
                    <input type="hidden" value="<?php 
    echo $setSort->orderValue;
    ?>
" name="c_filter_order"/>
                    <input type="hidden" value="<?php 
    echo $setSort->orderValue;
    ?>
" name="filter_order"/>
                    <input type="hidden" value="<?php 
    echo $setSort->orderDir;
    ?>
" name="filter_order_Dir"/>
                    </form>
                </div>
                <div class="b">
                    <div class="b">
                        <div class="b"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="b">
            <div class="b">
                <div class="b"></div>
            </div>
        </div>
    </div>
    <?php 
    $return = ob_get_contents();
    ob_end_clean();
    return array(_JNEWS_CONTENT_ITEM, $return);
}
Пример #6
0
    public static function controlPanel()
    {
        unset($GLOBALS["task"]);
        unset($_REQUEST["task"]);
        $doc = JFactory::getDocument();
        $doc->addStyleSheet(JNEWS_URL_ADMIN . 'cssadmin/jnews.css');
        ?>
<div align="center" class="centermain">
<div id="jnews">
		<table class="">
            <tr>
         	<td width="58%" valign="top">
				<?php 
        echo backHTML::iconsPanel();
        ?>
			</td>
			<td width="42%" valign="top">

			<div style="width=100%;">

			<script type="text/javascript">
				function checkcid(myField) {
					myField.checked = true;
					isChecked(true);
				}
			</script>

			<form action="index.php" method="post" name="adminForm" id="adminForm">
				<input type="hidden" name="option" value="<?php 
        echo JNEWS_OPTION;
        ?>
" />
				<input type="hidden" name="act" value="jnews" />
				<input type="hidden" name="task" value="" />
				<input type="hidden" name="userid" value="" />
		    	<input type="hidden" name="boxchecked" value="0" />

			<?php 
        $tabs = new MosTabsjNews(1);
        $tabs->startPane('acaControlPanel');
        $tabs->startTab(_JNEWS_MENU_TAB_SUM, "acaControlPanel.Summary");
        ?>
			<table class="<?php 
        echo jnews::myTheme();
        ?>
">
			<tbody>
				<thead>
					<tr>
					 <th class="title" style="text-align: center;"><?php 
        echo '#';
        ?>
</th>
					 <th class="title" style="text-align: center;"><?php 
        echo _JNEWS_MENU_TAB_LIST;
        ?>
</th>
					 <th class="title" style="text-align: center;"><?php 
        echo _JNEWS_MENU_MAILING_TITLE;
        ?>
</th>
					</tr>
				</thead>
			 <?php 
        $html = '';
        $totalist = 0;
        $totalmail = 0;
        $totalsub = $GLOBALS[JNEWS . 'act_totalsubcribers0'];
        $totalsent = 0;
        $nb = explode(',', $GLOBALS[JNEWS . 'activelist']);
        $size = sizeof($nb);
        $countOfLists[1] = jNews_Lists::countLists(1);
        $countOfLists[2] = jNews_Lists::countLists(2);
        $countOfLists[7] = jNews_Mailing::countMails(7, true);
        $countOfMailings[1] = jNews_Mailing::countMails(1);
        $countOfMailings[2] = jNews_Mailing::countMails(2);
        $countOfMailings[7] = jNews_Mailing::countMails(7);
        for ($i = 0; $i < $size; $i++) {
            $index = $nb[$i];
            if ($GLOBALS[JNEWS . 'listshow' . $index] > 0 and $GLOBALS[JNEWS . 'listype' . $index] == 1) {
                $row = ($i + 1) % 2;
                $html .= '<tr class="row' . $row . '">';
                $html .= '<td><b>' . @constant($GLOBALS[JNEWS . 'listnames' . $index]) . '</b></td>';
                //					$html .= '<td style="text-align: center; ">' .$GLOBALS[JNEWS.'act_totallist'.$index].'1 </td>';
                $html .= '<td style="text-align: center; ">' . $countOfLists[$index] . ' </td>';
                //if the value to be is less than 0 we will display 0
                if ($GLOBALS[JNEWS . 'act_totalmailing' . $index] > 0) {
                    //						$html .= '<td style="text-align: center; ">' .$GLOBALS[JNEWS.'act_totalmailing'.$index].' </td>';
                    $html .= '<td style="text-align: center; ">' . $countOfMailings[$index] . ' </td>';
                } else {
                    $html .= '<td style="text-align: center; ">0</td>';
                }
                //					$html .= '<td style="text-align: center; ">' .$GLOBALS[JNEWS.'totalmailingsent'.$index].' </td>';
                $html .= '</tr>';
                //					$totalist = $totalist + $GLOBALS[JNEWS.'act_totallist'.$index];
                $totalist = array_sum($countOfLists);
                //					$totalmail = $totalmail + $GLOBALS[JNEWS.'act_totalmailing'.$index];
                $totalmail = array_sum($countOfMailings);
                $totalsent = $totalsent + $GLOBALS[JNEWS . 'totalmailingsent' . $index];
                if ($GLOBALS[JNEWS . 'act_totalsubcribers' . $index] > $totalsub) {
                    $totalsub = $GLOBALS[JNEWS . 'act_totalsubcribers' . $index];
                }
            }
        }
        $html .= '<tr>';
        $html .= '<td style="background-color: #CCFFFF;"><b>' . _JNEWS_CP_TOTAL . '</b></td>';
        $html .= '<td style="text-align: center; text-decoration: bold; background-color: #CCFFFF; border-top: 1px solid #000; ">' . $totalist . ' </td>';
        $html .= '<td style="text-align: center; text-decoration: bold; background-color: #CCFFFF; border-top: 1px solid #000; ">' . $totalmail . ' </td>';
        //			$html .= '<td style="text-align: center; text-decoration: bold; background-color: #CCFFFF; border-top: 1px solid #000; ">' .$totalsent.' </td>';
        //$html .= '<td style="text-align: center; ">' .$totalsub.' </td>';
        $html .= '</tr>';
        echo $html;
        ?>
			 </tbody></table>
			 <br />
			<?php 
        if (class_exists('jNews_Auto')) {
            echo jNews_Auto::showQueue();
        }
        $tabs->endTab();
        $tabs->startTab(_JNEWS_MENU_SUBSCRIBERS, "acaControlPanel.Subscribers");
        $emailsearch = '';
        $listId = 0;
        $limittotal = jNews_Subscribers::getSubscribersCount($listId);
        $setLimitSubs = jnews::setLimitPagination($limittotal);
        ?>
			<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
			<input type="hidden" name="start" value="<?php 
        echo $setLimitSubs->start;
        ?>
" />
			<input type="hidden" name="limit" value="<?php 
        echo $setLimitSubs->end;
        ?>
" />
			<input type="hidden" name="listsearch" value="<?php 
        echo $emailsearch;
        ?>
" />

			<div style="margin-top: 10px;"><?php 
        echo jnews::setTop('', '', $setLimitSubs);
        ?>
</div>

			<table class="<?php 
        echo jnews::myTheme();
        ?>
">
				<thead>
					<tr>
						<th class="title">#</th>
						<th class="title" style="text-align: left;"><?php 
        echo _JNEWS_INPUT_NAME;
        ?>
</th>
						<th class="title" style="text-align: left;"><?php 
        echo _JNEWS_INPUT_EMAIL;
        ?>
</th>
						<th class="title" style="text-align: center;"><?php 
        echo _JNEWS_SIGNUP_DATE;
        ?>
</th>
					</tr>
				</thead>
				<?php 
        $subscribers = jNews_Subscribers::getSubscribers($setLimitSubs->start, $setLimitSubs->end, $emailsearch, $setLimitSubs->total, $listId, '', 0, 0, 'sub_dateD', 0, 0, null, 0);
        $i = 0;
        foreach ($subscribers as $subscriber) {
            $i++;
            if (!jNews_Subscribers::validEmail($subscriber->email)) {
                continue;
            }
            ?>
				<tr class="row<?php 
            echo ($i + 2) % 2;
            ?>
">
				<td><center><?php 
            echo $i + $setLimitSubs->start;
            ?>
</center></td>
				<td style="text-align: left;">
				<a href="index.php?option=<?php 
            echo JNEWS_OPTION;
            ?>
&act=subscribers&task=show&userid=<?php 
            echo $subscriber->id;
            ?>
" >
				<?php 
            echo $subscriber->name;
            ?>
</a></td>
				<td style="text-align: left;"><?php 
            echo $subscriber->email;
            ?>
</td>
				<td style="text-align: center;">
				<?php 
            echo date('l, jS F Y h:i:s A', jnews::getNow(0, true, $subscriber->subscribe_date));
            ?>
				</td>
				</tr>
				<?php 
        }
        ?>
			</table>

			<?php 
        $tabs->endTab();
        $tabs->startTab(_JNEWS_MENU_TAB_LIST, "acaControlPanel.Lists");
        $listsearch = '';
        $lists = jNews_Lists::getLists(0, 0, 1, '', false, false, false);
        $limittotal = count($lists);
        $setLimitLists = jnews::setLimitPagination($limittotal);
        ?>

			<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
			<input type="hidden" name="start" value="<?php 
        echo $setLimitLists->start;
        ?>
" />
			<input type="hidden" name="limit" value="<?php 
        echo $setLimitLists->end;
        ?>
" />
			<input type="hidden" name="listsearch" value="<?php 
        echo $listsearch;
        ?>
" />

			<div style="margin-top: 10px;"><?php 
        echo jnews::setTop('', '', $setLimitLists);
        ?>
</div>

			<table class="<?php 
        echo jnews::myTheme();
        ?>
">
				<thead>
				<tr>
					<th class="title">#</th>
					<th class="title" width="65%"  style="text-align: left;"><?php 
        echo _JNEWS_LIST_NAME;
        ?>
</th>
					<th class="title" width="25%"  style="text-align: left;"><?php 
        echo _JNEWS_LIST_TYPE;
        ?>
</th>
					<th class="title"  style="text-align: center;">ID</th>
				</tr>
				</thead>
			<?php 
        $lists = jNews_Lists::getLists(0, 0, 1, 'listtypeA', false, false, false, false, false, $listsearch, $setLimitLists, 0, 0);
        $i = 0;
        foreach ($lists as $list) {
            $i++;
            $link = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&task=show&listid=' . $list->id;
            ?>
				<tr class="row<?php 
            echo ($i + 2) % 2;
            ?>
">
					<td><?php 
            echo $i + $setLimitLists->start;
            ?>
</td>
					<td  style="text-align: left;">
						<a href="<?php 
            echo $link;
            ?>
">
							<?php 
            echo $list->list_name;
            ?>
</a>
					</td>
					<td  style="text-align: left;"><?php 
            if ($list->list_type == 1) {
                echo _JNEWS_LIST;
            } else {
                echo _JNEWS_AR;
            }
            ?>
</td>
					<td  style="text-align: center;"><?php 
            echo $list->id;
            ?>
</td>
					</tr>
			<?php 
        }
        ?>
			<tr>
				<th colspan="4">
				</th>
			</tr>
			</table>
			<?php 
        $tabs->endTab();
        ?>
			<?php 
        $tabs->endPane();
        ?>
			</form>
		</div>
		<div style="clear:both; float:left; margin-top: 10px;">
		<?php 
        echo jnews::printM('ok', _JNEWS_SERVER_LOCAL_TIME . ' : ' . date('l, j F Y H:i:s', jnews::getNow(0, true)));
        // - date('Z')
        ?>
		</div>
   <td>
   </tr>
   </table>
   </div>
</div>
<?php 
    }
Пример #7
0
    /**
     * <p>public static function to create the view of the template list where the user can assign a template to a newsletter.</p>
     * @param mixed $templates - the array object list of templates in the database
     */
    public static function assignTemplate($templates, $forms, $setLimit, $templatesearch)
    {
        if (version_compare(JVERSION, '3.0.0', '<')) {
            JHTML::_('behavior.modal');
        } else {
            JHtml::_('behavior.modal');
        }
        if (version_compare(JVERSION, '3.0.0', '<')) {
            JHTML::_('behavior.mootools');
        } else {
            JHtmlBehavior::framework();
        }
        $action = JRequest::getString('act', '', 'request');
        $js = "function assignTemplate(templateid){var templatebody = window.document.getElementById('templatebody_'+templateid).innerHTML;\n\t \tvar templatealtbody = window.document.getElementById('templatealtbody_'+templateid).innerHTML;\n\t \twindow.top.changeTemplate(templatebody, templatealtbody,templateid);";
        if (version_compare(JVERSION, '1.6.0', '<')) {
            //1.5
            $js .= " window.top.document.getElementById('sbox-window').close();";
        } else {
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $js .= " window.parent.SqueezeBox.close();";
            } else {
                $js .= 'jQuery(window.top.document).find("div.modal-backdrop").click();';
            }
        }
        $js .= "}";
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($js);
        ?>
	  	<style type="text/css">
	  	div#pagination {
	  		background-color: #006699;
	  		margin: auto;
	  		padding: 0 8px;
	  		color: #FFFFFF;
	  	}

	  	div.template-container {
	  		border-bottom: 1px dotted #000000;
	  		padding: 5px;
	  		margin-top: 10px;
	  		float: left;
	  		width: 596px;
	  		cursor:pointer;
	  	}
	  	div.template-container:hover {
	  		background-color: #CCFFFF;
	  	}

	  	div.template-container div#image {
	  		float:left;
	  		margin-right: 5px;
	  	}

	  	div.template-container div#name {
	  		clear: right;
	  		border: 1px solid #000;
	  		font-weight: bold;
	  		font-size: 1.2em;
	  	}

	  	div.template-container div#description {
	  		margin-top: 5px;
	  	}

	  	</style>
	  	<?php 
        echo $forms['main'];
        ?>
		<div id="pagination">
		<?php 
        // for search
        $limit = -1;
        $hidden = '<input type="hidden" name="limit" value="' . $limit . '" />';
        $toSearch = new stdClass();
        //$toSearch->forms = '';
        $toSearch->hidden = $hidden;
        $toSearch->listsearch = $templatesearch;
        $toSearch->id = 'templatesearch';
        //echo jnews::setTop($toSearch, null, $setLimit, null, true);
        echo jnews::setTop($toSearch, null);
        ?>
		</div>
	 	<?php 
        foreach ($templates as $countMeNow => $template) {
            if ($template->availability == 1 && $template->published == 1) {
                if (empty($template->thumbnail)) {
                    $template->thumbnail = 'sample-image.png';
                }
                $findposhttp = strpos($template->thumbnail, 'http://');
                $findposwww = strpos($template->thumbnail, 'www.');
                if ($findposhttp === false || $findposwww === false) {
                    $path = $template->thumbnail;
                    $img = '<img src="' . $path . '" alt="' . $template->name . '">';
                } else {
                    $path = $template->thumbnail;
                    $img = '<img src="' . $path . '" alt="' . $template->name . '">';
                }
                ?>
			<div class="template-container" onclick="assignTemplate(<?php 
                echo $template->template_id;
                ?>
);">
				<div id="image"><?php 
                echo $img;
                ?>
</div>
				<div id="name" style="text-indent:10px"><?php 
                echo $template->name;
                ?>
</div>
				<div id="description" style="text-indent:25px" ><?php 
                echo jnews::stringTruncate($template->description, 400, ".", "...");
                ?>
</div>
				<div id="templatebody_<?php 
                echo $template->template_id;
                ?>
" style="display:none;"><?php 
                echo $template->body;
                ?>
</div>
				<div id="templatealtbody_<?php 
                echo $template->template_id;
                ?>
" style="display:none;"><?php 
                echo $template->altbody;
                ?>
</div>
			</div>
		<?php 
            }
        }
        $css = 'margin:auto;';
        echo jnews::setPaginationBot($setLimit, $css);
        ?>
	 	<input type="hidden" value="<?php 
        echo JNEWS_OPTION;
        ?>
" name="option"/>
		<input type="hidden" value="<?php 
        echo $action;
        ?>
" name="act"/>
		<input type="hidden" value="assign" name="task"/>
    	<input type="hidden" value="0" name="boxchecked" id="boxcount"/>

		</form>
	 	<?php 
    }
Пример #8
0
function virtuemartproduct($forms, $params = null)
{
    $vmproducts = new virtuemartProducts();
    $limit = -1;
    $limittotal = $vmproducts->_countVMProducts();
    $setLimit = jnews::setLimitPagination($limittotal);
    $action = JRequest::getVar('act', '', '', 'WORD');
    $task = JRequest::getVar('task');
    $vmproductsearch = JRequest::getVar('vmproductsearch', '');
    echo $forms['main'];
    $hidden = '<input type="hidden" name="option" value="' . JNEWS_OPTION . '" />';
    $hidden .= '<input type="hidden" name="limit" value="' . $limit . '" />';
    $toSearch = new stdClass();
    $toSearch->forms = '';
    $toSearch->hidden = $hidden;
    $toSearch->listsearch = $vmproductsearch;
    $toSearch->id = 'vmproductsearch';
    ?>

<div id="element-box">
	<div class="t">
		<div class="t">
			<div class="t"></div>
		</div>
	</div>
	<div class="m">
<?php 
    echo jnews::setTop($toSearch, null);
    $js = 'function insertjnewstag(tag){';
    if (version_compare(JVERSION, '1.6.0', '<')) {
        //1.5
        $js .= ' if(window.top.insertTag(tag)){window.top.document.getElementById(\'sbox-window\').close();}';
    } else {
        if (version_compare(JVERSION, '3.0.0', '<')) {
            $js .= ' if(window.top.insertTag(tag)) {window.parent.SqueezeBox.close();}';
        } else {
            $js .= ' if(window.top.insertTag(tag)) {           
                     var need_click = jQuery(window.top.document).find("div.modal-backdrop");
                    if(need_click.length == 0) window.parent.SqueezeBox.close();
                    else    jQuery(window.top.document).find("div.modal-backdrop").click();}';
        }
    }
    $js .= '}';
    $doc = JFactory::getDocument();
    $doc->addScriptDeclaration($js);
    ?>
	<table class="<?php 
    echo jnews::myTheme();
    ?>
" cellpadding="0" cellspacing="0">
		<tbody>
			<thead>
				<tr>
					<th class="title"> Tag
					</th>
					<th class="title">
						<?php 
    echo 'Product Name';
    ?>
					</th>
					<th width="80px" class="title">
						<?php 
    echo 'Product Description';
    ?>
					</th>
					<th  width="60px" class="title">
						<?php 
    echo 'Product ID';
    ?>
					</th>
				</tr>
			</thead>
<?php 
    $products = $vmproducts->_getVMProducts($vmproductsearch, $setLimit);
    $k = 0;
    $html = '';
    foreach ($products as $product) {
        if (empty($product->product_s_desc) && !empty($product->product_desc)) {
            $product->product_s_desc = substr(strip_tags($product->product_desc), 0, 100);
        } else {
            $product->product_s_desc = '';
        }
        $insertTag = '{vmprod=' . $product->virtuemart_product_id . '}';
        $html .= '<tr style="cursor:pointer" class="row' . $k . '" onclick="insertjnewstag(\'' . $insertTag . '\')" ><td><strong>{vmprod=' . $product->virtuemart_product_id . '}</strong></td><td>' . $product->product_name . '</td><td nowrap="nowrap" align="left">' . $product->product_s_desc . '</td><td align="center" nowrap="nowrap">' . $product->virtuemart_product_id . '</td></tr>';
        $k = 1 - $k;
    }
    echo $html;
    ?>
		</tbody>
	</table>
<?php 
    $css = 'margin:auto;';
    echo jnews::setPaginationBot($setLimit, $css);
    ?>
	</div>
	<div class="b">
		<div class="b">
			<div class="b"></div>
		</div>
	</div>
</div>
	<input type="hidden" value="<?php 
    echo JNEWS_OPTION;
    ?>
" name="option"/>
	<input type="hidden" value="<?php 
    echo $action;
    ?>
" name="act"/>
	<input type="hidden" value="<?php 
    echo $task;
    ?>
" name="task"/>
  	</form>
<?php 
}
Пример #9
0
    public static function showMailingQueue($mailingq = null, $lists = null, $form, $start, $limit, $mailingsearch, $setLimit = null, $setSort = null)
    {
        $listId = null;
        ?>

		<script language="javascript" type="text/javascript">
		<!--
			function jnewsselectall(){
				var i = 0;
				allcheck = document.getElementById("selectallcheck");
				if(allcheck.checked) checkedvalue = 1;
				else checkedvalue = 0;

				while(myelement = document.getElementById("cid["+i+"]")){
					myelement.checked = checkedvalue;
					i++;
				}

				if(checkedvalue){
					document.getElementById("boxcount").value = i;
				}else{
					document.getElementById("boxcount").value = 0;
				}
			}

		 //-->
		</script>
		<?php 
        if (empty($mailingq)) {
            echo '<center>' . jnews::printYN(true, _JNEWS_Q_M1, _JNEWS_ERROR) . '</center>';
        }
        if ($listId == 0) {
            $message = _JNEWS_MESSAGE_QUEUE;
        } else {
            $lt_name = jNews_Lists::getLists($listId, 0, null, '', false, false, true, false, false, '');
            $message = _JNEWS_SUSCRIB_LIST_UNIQUE . "<span style='color: rgb(51, 51, 51);'>" . @$lt_name[0]->list_name . "</span>";
        }
        if (!isset($action)) {
            $action = JRequest::getVar('act', '', '', 'WORD');
        }
        $mySepList = array();
        $mySepList[0] = new stdClass();
        $mySepList[0]->subject = 'All Mailings';
        $mySepList[0]->id = 0;
        $myMailingQueA = jNews_Mailing::getMailingsForQueue();
        if (empty($myMailingQueA) || !is_array($myMailingQueA)) {
            $myMailingQueA = array();
        }
        $lt = array_merge($mySepList, $myMailingQueA);
        $mailingId = JREquest::getVar('mailingid', '');
        $dropDown = jnews::HTML_GenericList($lt, 'mailingid', '' . 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'id', 'subject', $mailingId);
        $filter = _JNEWS_FILTER_MAILING . $dropDown;
        $hidden = '<input type="hidden" name="option" value="' . JNEWS_OPTION . '" />';
        $hidden .= '<input type="hidden" name="act" value="' . $action . '" />';
        $hidden .= '<input type="hidden" name="limit" value="' . $limit . '" />';
        ?>

	<?php 
        echo $form['main'];
        if ($form['main'] !== "") {
            $form['select'] = "";
        }
        // top portion before the table list
        // for search
        $toSearch = new stdClass();
        $toSearch->forms = $form['select'];
        $toSearch->hidden = $hidden;
        $toSearch->listsearch = $mailingsearch;
        $toSearch->id = 'mailingsearch';
        echo jnews::setTop($toSearch, $message, $setLimit, $filter);
        ?>
		<table class="<?php 
        echo jnews::myTheme();
        ?>
">
			<thead><tr>
				<th width="2%" class="title">#</th>
				<th width="2%" class="title"><input type="checkbox" id="selectallcheck" name="allchecked" onclick="jnewsselectall();"></th>
				<th width="22%" class="title"><?php 
        echo jnews::HTML_GridSort(_JNEWS_QUEUE_SUBJECT, 'm.subject', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
				<th width="22%" class="title"><?php 
        echo jnews::HTML_GridSort(_JNEWS_QUEUE_EMAIL, 's.email', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
				<th width="22%" class="title"><?php 
        echo jnews::HTML_GridSort(_JNEWS_SENDDATE, 'q.send_date', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
				<th width="3%" class="title"><center><?php 
        echo jnews::HTML_GridSort(_JNEWS_QUEUE_PRIOR, 'q.priority', $setSort->orderDir, $setSort->orderValue);
        ?>
</center></th>
				<th width="2%" class="title"><center><?php 
        echo jnews::HTML_GridSort(_JNEWS_QUEUE_ATT, 'q.attempt', $setSort->orderDir, $setSort->orderValue);
        ?>
</center></th>
				<th width="3%" class="title"><?php 
        echo jnews::HTML_GridSort('Suspend', 'q.suspend', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
				<th width="3%" class="title"><?php 
        echo jnews::HTML_GridSort('Blocked', 'q.block', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
				<th width="3%" class="title"><?php 
        echo jnews::HTML_GridSort('ID', 'q.qid', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
			</thead></tr>
			<?php 
        $i = $start;
        jNews_QueueHTML::_displayQueue($mailingq, $i);
        ?>
		</table>
		<?php 
        echo '<br />';
        echo jnews::setLegend();
    }