<?php
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
// | Copyright (c) 2006, Rares Benea |
// | All rights reserved. |
// | |
// | Redistribution and use in source and binary forms, with or without |
// | modification, are permitted provided that the following conditions |
// | are met: |
// | |
// | o Redistributions of source code must retain the above copyright |
// | notice, this list of conditions and the following disclaimer. |
// | o Redistributions in binary form must reproduce the above copyright |
// | notice, this list of conditions and the following disclaimer in the |
// | documentation and/or other materials provided with the distribution. |
// | o The names of the authors may not be used to endorse or promote |
// | products derived from this software without specific prior written |
// | permission. |
// | |
// | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
// | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
// | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
// | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
// | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
// | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
// | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
// | |
// +---------------------------------------------------------------------------+
// | Seagull 0.6 |
// +---------------------------------------------------------------------------+
// | Output.php |
// +---------------------------------------------------------------------------+
// | Author: Benea Rares <rbenea@bluestardesign.ro> |
// +---------------------------------------------------------------------------+
// $Id: Output.php,v 1.4 2005/05/31 23:34:23 demian Exp $
class NewsletterOutput
{
function generateCheckboxNewsList($hElements, $aChecked, $groupName, $checkListForUser = array(), $checkListEmail = array())
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$userID = $_SESSION['uid'];
if (!is_array($hElements)) {
SGL::raiseError('incorrect args passed to ' . __FILE__ . ',' . __LINE__,
SGL_ERROR_INVALIDARGS);
return false;
}
if (!is_array($checkListForUser)) {
$checkListForUser = array();
}
$html = '';
// case user have $checkListForUser
if(isset($userID) && $userID !='' && $userID !=0 && count($checkListForUser)>0 && count($checkListEmail)>0) {
foreach ($hElements as $k => $v) {
$isChecked = (in_array($k, $checkListForUser)) ? ' checked' : '';
$html .= '<input id="' . $groupName . '-' . $k . '" name="'.$groupName.'" type="checkbox" value="'.$k.'" '.$isChecked.' />'.
'<label for="' . $groupName . '-' . $k . '"><strong>'.$v['name'].'</strong> - '.$v['description'].
"</label><br />\n";
}
// case user don' t have $checkListForUser
} elseif (isset($userID) && $userID !='' && $userID !=0 && !count($checkListForUser) && count($checkListEmail)>0) {
foreach ($hElements as $k => $v) {
$isChecked = (in_array($k, $checkListForUser)) ? ' checked' : '';
$html .= '<input id="' . $groupName . '-' . $k . '" name="'.$groupName.'" type="checkbox" value="'.$k.'" '.$isChecked.' />'.
'<label for="' . $groupName . '-' . $k . '"><strong>'.$v['name'].'</strong> - '.$v['description'].
"</label><br />\n";
}
} elseif (isset($userID) && $userID !='' && $userID !=0 && !count($checkListForUser) && !count($checkListForUser)) {
foreach ($hElements as $k => $v) {
$isChecked = (in_array($k, $aChecked)) ? ' checked' : '';
$html .= '<input id="' . $groupName . '-' . $k . '" name="'.$groupName.'" type="checkbox" value="'.$k.'" '.$isChecked.' />'.
'<label for="' . $groupName . '-' . $k . '"><strong>'.$v['name'].'</strong> - '.$v['description'].
"</label><br />\n";
}
// case nobody
}else{
foreach ($hElements as $k => $v) {
$isChecked = (in_array($k, $aChecked)) ? ' checked' : '';
$html .= '<input id="' . $groupName . '-' . $k . '" name="'.$groupName.'" type="checkbox" value="'.$k.'" '.$isChecked.' />'.
'<label for="' . $groupName . '-' . $k . '"><strong>'.$v['name'].'</strong> - '.$v['description'].
"</label><br />\n";
}
}
return $html;
}
function generateCheckboxSubscribe($hElements = array(), $checkListForUser = array())
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$userID = $_SESSION['uid'];
$html = '';
if($userID ==0 || $userID ==1) {
$html .= '<input type="radio" name="action" value="subscribe" checked="checked" id="Subscribe" />
<label for="Subscribe">'.SGL_String::translate('Subscribe').'</label>
<input type="radio" name="action" value="unsubscribe" id="Unsubscribe" />
<label for="Unsubscribe">'.SGL_String::translate('Unsubscribe').'</label>';
}else{
$html .='';
}
return $html;
}
function checkUserShowList()
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$userID = $_SESSION['uid'];
if($userID !='' && $userID !=0 && $userID !=1) {
//user
return true;
}
// nobody and admin
return false;
}
function genName($aName)
{
foreach($aName as $value) {
}
return $value;
}
function genEmail($aEmail)
{
foreach($aEmail as $key=>$value) {
}
return $key;
}
function verifyModulesInstall($module)
{
require_once SGL_MOD_DIR . '/main/classes/Main.php';
$oMain = new Main;
return $oMain->verifyModules($module);
}
function statusToString($statusID)
{
return SGL_String::translate('Status_'.$statusID);
}
function statusOpts($selected)
{
$c = SGL_Config::singleton();
$conf = $c->getAll();
$aSatusOpts = $conf['statusOpts'];
return SGL_Output::generateSelect($aSatusOpts, $selected);
}
function statusSubscribe($selected)
{
$aSatusOpts = array('subscribe'=>'subscribe', 'unsubscribe'=>'unsubscribe');
return SGL_Output::generateSelect($aSatusOpts, $selected);
/* foreach ($aSatusOpts as $k => $v) {
$isSelected = ($k === $selected && !is_null($selected)) ? ' selected="selected"' : '';
$r .= "\n<option value=\"$k\"". $isSelected . $optionsString . ">$v</option>";
}
}
return $r;*/
}
function actionOpts($action)
{
$c = SGL_Config::singleton();
$conf = $c->getAll();
$aActionOpts = $conf['ActionOpts'];
$selectedAction = $action == '' ? 'empty' : $action;
return SGL_Output::generateSelect($aActionOpts, $selectedAction);
}
function translateJsMsg($key)
{
return $key;
}
function isLicensePro()
{
return true;
}
}
?>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez