Source for file pnadmin.php
Documentation is available at pnadmin.php
* Zikula Application Framework
* @copyright (c) 2002, Zikula Development Team
* @link http://www.zikula.org
* @version $Id: pnadmin.php 24342 2008-06-06 12:03:14Z markwest $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @package Zikula_Value_Addons
* the main administration function
* @return output The main module admin page.
// Create output object - this object will store all of our output so that
// we can return it easily when required
// Return the output that has been generated by this function
return $pnRender->fetch('banners_admin_main.htm');
* display form to create a new banner/client
* @return string HTML output string
// Check if Banners variable is active, if not then print a message
$pnRender->assign('bannersenabled', pnModGetVar('Banners', 'banners'));
// get list of current clients and assign to template
$clients = pnModAPIFunc('Banners', 'user', 'getallclients');
foreach($clients as $client) {
$clientitems[$client['cid']] = $client['name'];
$pnRender->assign('clients', $clientitems);
return $pnRender->fetch('banners_admin_new.htm');
* @param int $startnum the start item id for the pager
* @return string HTML output string
// Check if Banners variable is active, if not then print a message
$pnRender->assign('bannersenabled', pnModGetVar('Banners', 'banners'));
$activebanneritems = pnModAPIFunc('Banners', 'user', 'getall', array('clientinfo' => true));
$pnRender->assign('activebanneritems', $activebanneritems);
// get list of finished banners
$finishedbanners = pnModAPIFunc('Banners', 'user', 'getallfinished');
$pnRender->assign('finishedbanners', $finishedbanners);
$activeclients = pnModAPIFunc('Banners', 'user', 'getallclients');
$pnRender->assign('activeclients', $activeclients);
return $pnRender->fetch('banners_admin_view.htm');
* @param int $cid client id
* @param int $idtype banner type id
* @param int $imptotal total impressions purchased
* @param string $imageurl source url of the banner image
* @param string $clickurl destination url for the banner
* @return mixed int banner id if successful
// Confirm authorisation code.
// Notable by its absence there is no security check here.
array('cid' => $banner['cid'],
'idtype' => $banner['idtype'],
'imptotal' => $banner['imptotal'],
'imageurl' => $banner['imageurl'],
'clickurl' => $banner['clickurl']));
// The return value of the function is checked
// This function generated no output, and so now it is complete we redirect
// the user to an appropriate page for them to carry on their work
* @param int $args['bid'] the banner id
* @return string HTML output string
$banner = pnModAPIFunc('Banners', 'user', 'get', array('bid' => $bid));
// create a new output object
// assign the banner item
$pnRender->assign($banner);
// build a list of clients suitable for html_options
$allclients = pnModAPIFunc('Banners', 'user', 'getallclients');
foreach ($allclients as $client) {
$clients[$client['cid']] = $client['name'];
$pnRender->assign('clients', $clients);
return $pnRender->fetch('banners_admin_banneredit.htm');
* @param int $cid client id
* @param int $idtype banner type id
* @param int $imptotal total impressions purchased
* @param int $impadded additional impressions added
* @param string $imageurl source url of the banner image
* @param string $clickurl destination url for the banner
// Confirm authorisation code.
array('bid' => $banner['bid'],
'idtype' => $banner['idtype'],
'imptotal' => $banner['imptotal'],
'impadded' => $banner['impadded'],
'imageurl' => $banner['imageurl'],
'clickurl' => $banner['clickurl']))){
* @param int $bid banner id
* @param int $objectid generic object id maps to bid if present
* @param bool $confirmation confirmation of the deletion
* @return mixed HTML output string if no confirmation, true if succesful, false otherwise
$objectid = (int) FormUtil::getPassedValue('objectid', isset ($args['objectid']) ? $args['objectid'] : null, 'REQUEST');
// Get the existing admin message
$banner = pnModAPIFunc('Banners', 'user', 'get', array('bid' => $bid, 'clientinfo' => true));
// Check for confirmation.
if (empty($confirmation)) {
$pnRender->assign('bid', $bid);
$pnRender->assign($banner);
// Return the output that has been generated by this function
return $pnRender->fetch('banners_admin_bannerdelete.htm');
// Confirm authorisation code.
// The return value of the function is checked
if (pnModAPIFunc('Banners', 'admin', 'delete', array('bid' => $bid))) {
// This function generated no output, and so now it is complete we redirect
// the user to an appropriate page for them to carry on their work
/**************************** client functions ****************************/
* @param int $cname client name
* @param int $contact client contact name
* @param int $email client e-mail address
* @param string $login client login name
* @param string $passwd client login password
* @param string $extrainfo additional client information
* @return mixed int banner id if successful
// Confirm authorisation code.
array('cname' => $client['cname'],
'contact' => $client['contact'],
'email' => $client['email'],
'login' => $client['login'],
'passwd' => $client['passwd'],
'extrainfo' => $client['extrainfo']))){
* @param int $cid the client id
* @return string HTML output string
$client = pnModAPIFunc('Banners', 'user', 'getclient', array('cid' => $cid));
// create a new output object
// assign the banner item
$pnRender->assign($client);
return $pnRender->fetch('banners_admin_clientedit.htm');
* @param int $cid client id
* @param int $cname client name
* @param int $contact client contact name
* @param int $email client e-mail address
* @param string $login client login name
* @param string $passwd client login password
* @param string $extrainfo additional client information
// Confirm authorisation code.
array('cid' => $client['cid'],
'cname' => $client['cname'],
'contact' => $client['contact'],
'email' => $client['email'],
'extrainfo' => $client['extrainfo'],
'login' => $client['login'],
'passwd' => $client['passwd']))){
* @param int $cid client id
* @param int $objectid generic object id maps to bid if present
* @param bool $confirmation confirmation of the deletion
* @return mixed HTML output string if no confirmation, true if succesful, false otherwise
$objectid = FormUtil::getPassedValue('objectid', isset ($args['objectid']) ? $args['objectid'] : null, 'REQUEST');
// Get the existing admin message
$client = pnModAPIFunc('Banners', 'user', 'getclient', array('cid' => $cid));
// Check for confirmation.
if (empty($confirmation)) {
$pnRender->assign('cid', $cid);
$pnRender->assign('banners', pnModAPIFunc('Banners', 'user', 'getall', array('cid' => $cid)));
// Return the output that has been generated by this function
return $pnRender->fetch('banners_admin_clientdelete.htm');
// Confirm authorisation code.
// The return value of the function is checked
if (pnModAPIFunc('Banners', 'admin', 'deleteclient', array('cid' => $cid))) {
// This function generated no output, and so now it is complete we redirect
// the user to an appropriate page for them to carry on their work
/**************************** finished banner functions ****************************/
* delete a finished banner
* @param int $bid banner id
* @param int $objectid generic object id maps to bid if present
* @param bool $confirmation confirmation of the deletion
* @return mixed HTML output string if no confirmation, true if succesful, false otherwise
$objectid = FormUtil::getPassedValue('objectid', isset ($args['objectid']) ? $args['objectid'] : null, 'REQUEST');
// Get the existing admin message
$banner = pnModAPIFunc('Banners', 'user', 'get', array('bid' => $bid));
// Check for confirmation.
if (empty($confirmation)) {
$pnRender->assign('bid', $bid);
$pnRender->assign(pnModAPIFunc('Banners', 'user', 'getfinished', array('bid' => $bid)));
// Return the output that has been generated by this function
return $pnRender->fetch('banners_admin_bannerdelete.htm');
// Confirm authorisation code.
// The return value of the function is checked
if (pnModAPIFunc('Banners', 'admin', 'deletefinished', array('bid' => $bid))) {
// This function generated no output, and so now it is complete we redirect
// the user to an appropriate page for them to carry on their work
/**************************** configuration functions ****************************/
* This is a standard function to modify the configuration parameters of the
* @return string HTML output string
// Number of items to display per page
// Return the output that has been generated by this function
return $pnRender->fetch('banners_admin_modifyconfig.htm');
* This is a standard function to update the configuration parameters of the
* module given the information passed back by the modification form
* @param int $itemsperpage the number messages per page in the admin panel
* @return bool true if successful, false otherwise
// Confirm authorisation code.
// Update module variables.
pnModSetVar('Banners', 'openinnewwindow', $openinnewwindow);
// Let any other modules know that the modules configuration has been updated
pnModCallHooks('module','updateconfig','Banners', array('module' => 'Banners'));
// the module configuration has been updated successfuly
// This function generated no output, and so now it is complete we redirect
// the user to an appropriate page for them to carry on their work
|