Beispiel #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();
    }
    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();
    }
Beispiel #3
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();
    }
Beispiel #4
0
    public static function displayTemplateList($templates, $forms, $start, $limit, $templatesearch, $action, $setLimit = null, $setSort = null)
    {
        $hidden = '<input type="hidden" name="option" value="' . JNEWS_OPTION . '" />';
        $hidden .= '<input type="hidden" name="limit" value="' . $limit . '" />';
        echo $forms['main'];
        // for search
        $toSearch = new stdClass();
        $toSearch->forms = $forms['filter'];
        $toSearch->hidden = $hidden;
        $toSearch->listsearch = $templatesearch;
        $toSearch->id = 'templatesearch';
        echo jnews::setTop($toSearch, null, $setLimit);
        ?>
         
                <?php 
        //echo $forms['main'];
        ?>
		<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>		
		
		<table class="<?php 
        echo jnews::myTheme();
        ?>
">
			<thead>
				<tr>
					<th width="2%" class="title">#</th>
					<th class="title"><input type="checkbox" id="selectallcheck" name="allchecked" onclick="jnewsletterselectall();"/></th>
					<th width="12%" class="title">
					<?php 
        echo _JNEWS_TEMPLATE_IMG;
        ?>
					</th>
					<th width="65%" class="title"><?php 
        echo jnews::HTML_GridSort(_JNEWS_TEMPLATE_DESC, 'description', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
					<th width="65%" class="title"><?php 
        echo jnews::HTML_GridSort(_JNEWS_TEMPLATE_AVLB, 'availability', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
					<th width="3%" class="title"><?php 
        echo jnews::HTML_GridSort(_JNEWS_TEMPLATE_DEFAULT, 'premium', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
					<th width="3%" class="title"><?php 
        echo jnews::HTML_GridSort(_JNEWS_TEMPLATE_PUBLISH, 'published', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
					<th width="2%" class="title"><?php 
        echo jnews::HTML_GridSort('ID', 'template_id', $setSort->orderDir, $setSort->orderValue);
        ?>
</th>
				</tr>
			</thead>
<!--			</form>-->
			<?php 
        $i = $start;
        if (!empty($templates)) {
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $onClickFct = '';
            } else {
                $onClickFct = 'Joomla.';
            }
            foreach ($templates as $template) {
                ?>
				<tr class="row<?php 
                echo ($i + 1) % 2;
                ?>
">
					<td><center><?php 
                echo $i + 1;
                ?>
</center></td>

					<td align="center"><center><input type="checkbox" id="cid[<?php 
                echo $i;
                ?>
]" name="cid[<?php 
                echo $i;
                ?>
]" value="<?php 
                echo $template->template_id;
                ?>
" onclick="<?php 
                echo $onClickFct;
                ?>
isChecked(this.checked);" /></center></td>					
					<td align="center">
						<span class="editlinktip">
							<?php 
                if (empty($template->thumbnail)) {
                    $path = JNEWS_PATH_ADMIN_THUMBNAIL_SHOW . 'sample-image.png';
                    echo '<a class="modal" href="' . $path . '">' . jnews::imageResize($path, '100', '100', $template->name) . '</a>';
                }
                $tmblfile = substr($template->thumbnail, 59);
                $popmainpath = substr($template->thumbnail, 0, -25);
                $filename = explode('_', $tmblfile);
                if (strpos($filename[0], 'entwine') !== false) {
                    $filenamecolor = explode('.', $filename[1]);
                    $popimgpath = 'http://www.joobi.co/images/newsletter_templates/' . $filename[0] . '/' . $filenamecolor[0] . '/' . $tmblfile;
                } else {
                    $popimgpath = 'http://www.joobi.co/images/newsletter_templates/' . $filename[0] . '/' . $tmblfile;
                }
                $findposhttp = strpos($template->thumbnail, 'http://');
                $findposwww = strpos($template->thumbnail, 'www.');
                if ($findposhttp === false || $findposwww === false) {
                    //$link = JNEWS_PATH_ADMIN_THUMBNAIL_SHOW. $template->thumbnail;
                    $link = $template->thumbnail;
                    echo '<a class="modal" href="' . $link . '">' . jnews::imageResize($link, '100', '100', $template->name) . '</a>';
                } else {
                    $link = $template->thumbnail;
                    echo '<a class="modal" href="' . $popimgpath . '"><img src="' . $template->thumbnail . '" alt="' . $template->name . '"></a>';
                }
                ?>
						</span>
					</td>
					<td><?php 
                $link = JNEWS_JPATH_LIVE . '/administrator/index.php?option=' . JNEWS_OPTION . '&act=templates&task=edit&template_id=' . $template->template_id;
                echo '<div style="color:#4f7e11;"><a href="' . $link . '">' . $template->name . '</a></div><br><div style="text-indent:20px"> ' . $template->description . '</div>';
                ?>
</td>
					<td align="center"><?php 
                if ($template->availability == 1) {
                    echo _JNEWS_TEMPLATE_INS;
                }
                if ($template->availability == 0) {
                    $namekey = explode('_', $template->namekey);
                    $link = 'http://www.joobi.co/index.php?option=com_jlinks&controller=redirect&link=newsletter_template_' . $namekey[0];
                    echo '<a href="' . $link . '">' . _JNEWS_TEMPLATE_DWN . '</a>';
                }
                if ($template->availability == -1) {
                    $link = 'http://www.joobi.co/index.php?option=com_jlinks&controller=redirect&link=newsletter_template_' . $template->namekey;
                    echo '<a href="' . $link . '">' . _JNEWS_TEMPLATE_FDWN . '</a>';
                }
                ?>
</td>
					<td align="center">
						<?php 
                if ($template->premium) {
                    echo '<img src="' . JNEWS_PATH_ADMIN_IMAGES2 . '16/default.png" title="Default" alt="Default">';
                    jnews::getLegend('default.png', _JNEWS_TEMPLATE_DEFAULT);
                } else {
                    $status = !empty($template->premium) && $template->premium == 1 ? '' : 'default';
                    $link = jnews::createToggleLink('templates', $status, 'template_id', $template->template_id, 'togle');
                    echo '<a href="' . $link . '"> <b>-</b> </a>';
                }
                ?>
					</td>
					<td align="center">
						 <?php 
                //for publish/unpublish
                if ($template->published == 1) {
                    $img = '16/status_g.png';
                    $alt = 'Published';
                    jnews::getLegend('status_g.png', _JNEWS_TEMPLATE_PUBLISH);
                } else {
                    $img = '16/status_r.png';
                    $alt = 'Unpublished';
                    jnews::getLegend('status_r.png', _JNEWS_UNPUBLISHED);
                }
                if ($template->premium) {
                    echo '<img src="' . JNEWS_PATH_ADMIN_IMAGES2 . $img . '" alt="' . $alt . '" title="' . $alt . '">';
                } else {
                    $status = !empty($template->published) && $template->published == 1 ? 'unpublish' : 'publish';
                    $link = jnews::createToggleLink('templates', $status, 'template_id', $template->template_id, 'togle');
                    echo '<a href="' . $link . '"> <img src="' . JNEWS_PATH_ADMIN_IMAGES2 . $img . '" alt="' . $alt . '" title="' . $alt . '"> </a>';
                }
                ?>
					</td>
					<td align="center"><?php 
                echo $template->template_id;
                ?>
</td>
				</tr>
			<?php 
                $i = $i + 1;
            }
        }
        ?>
		</table>
<!--                </form>-->
		<?php 
        echo '<br />';
        echo jnews::setLegend();
    }