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 the output that has been generated by this function
return $pnRender->fetch('feeds_admin_main.htm');
* This is a standard function that is called whenever an administrator
* wishes to create a new module item
// load the categories system
pn_exit (pnML('_UNABLETOLOADCLASS', array('s' => 'CategoryRegistryUtil')));
$pnRender->assign('categories', $categories);
$pnRender->assign('enablecategorization', pnModGetVar('Feeds', 'enablecategorization'));
// Return the output that has been generated by this function
return $pnRender->fetch('feeds_admin_new.htm');
* This is a standard function that is called with the results of the
* form supplied by feeds_admin_new() to create a new item
* @param 'feedname' the name of the item to be created
* @param 'url' the url of the item to be created
// Get parameters from whatever input we need
// Confirm authorisation code
// Notable by its absence there is no security check here.
* This is a standard function that is called whenever an administrator
* wishes to modify a current module item
* @param 'fid' the id of the item to be modified
$item = pnModAPIFunc('Feeds', 'user', 'get', array('fid' => $fid));
// load the categories system
pn_exit (pnML('_UNABLETOLOADCLASS', array('s' => 'CategoryRegistryUtil')));
$pnRender->assign('categories', $categories);
$pnRender->assign($item);
$pnRender->assign('enablecategorization', pnModGetVar('Feeds', 'enablecategorization'));
// Return the output that has been generated by this function
return $pnRender->fetch('feeds_admin_modify.htm');
* This is a standard function that is called with the results of the
* form supplied by RSS_admin_modify() to update a current item
* @param 'fid' the id of the item to be updated
* @param 'feedname' the name of the item to be updated
* @param 'url' the url of the item to be updated
if (!empty($feed['objectid'])) {
$feed['fid'] = $feed['objectid'];
// Confirm authorisation code
// Notable by its absence there is no security check here
* This is a standard function that is called whenever an administrator
* wishes to delete a current module item. Note that this function is
* the equivalent of both of the modify() and update() functions above as
* it both creates a form and processes its output. This is fine for
* simpler functions, but for more complex operations such as creation and
* modification it is generally easier to separate them into separate
* functions. There is no requirement in the Zikula MDG to do one or the
* other, so either or both can be used as seen appropriate by the module
* @param 'fid' the id of the item to be deleted
* @param 'confirmation' confirmation that this item can be deleted
$objectid = FormUtil::getPassedValue('objectid', isset ($args['objectid']) ? $args['objectid'] : null, 'REQUEST');
$item = pnModAPIFunc('Feeds', 'user', 'get', array('fid' => $fid));
// Check for confirmation.
if (empty($confirmation)) {
$pnRender->assign('fid', $fid);
// Return the output that has been generated by this function
return $pnRender->fetch('feeds_admin_delete.htm');
// If we get here it means that the user has confirmed the action
// Confirm authorisation code
$property = FormUtil::getPassedValue('feeds_property', isset ($args['feeds_property']) ? $args['feeds_property'] : null, 'POST');
$category = FormUtil::getPassedValue("feeds_{$property}_category", isset ($args["feeds_{$property}_category"]) ? $args["feeds_{$property}_category"] : null, 'POST');
// get module vars for later use
if ($modvars['enablecategorization']) {
// load the category registry util
pn_exit (pnML('_UNABLETOLOADCLASS', array('s' => 'CategoryRegistryUtil')));
// Validate and build the category filter - mateo
if (!empty($property) && in_array($property, $properties) && !empty($category)) {
$catFilter = array($property => $category);
// Assign a default property - mateo
if (empty($property) || !in_array($property, $properties)) {
$property = $properties[0];
// plan ahead for ML features
foreach ($properties as $prop) {
$propArray[$prop] = $prop;
array('startnum' => $startnum,
'numitems' => $modvars['itemsperpage'],
'category' => isset ($catFilter) ? $catFilter : null,
'catregistry' => isset ($catregistry) ? $catregistry : null));
foreach ($items as $item) {
$options[] = array('url' => pnModURL('Feeds', 'admin', 'modify', array('fid' => $item['fid'])),
$options[] = array('url' => pnModURL('Feeds', 'admin', 'delete', array('fid' => $item['fid'])),
'image' => '14_layer_deletelayer.gif',
$item['options'] = $options;
// Assign the items and modvars to the template
$pnRender->assign('feedsitems', $feedsitems);
$pnRender->assign($modvars);
// Assign the default language
// Assign the categories information if enabled
if ($modvars['enablecategorization']) {
$pnRender->assign('catregistry', $catregistry);
$pnRender->assign('numproperties', count($propArray));
$pnRender->assign('properties', $propArray);
$pnRender->assign('property', $property);
$pnRender->assign("category", $category);
// Assign the values for the smarty plugin to produce a pager
$pnRender->assign('pager', array('numitems' => pnModAPIFunc('Feeds', 'user', 'countitems', array('category' => isset ($catFilter) ? $catFilter : null)),
'itemsperpage' => $modvars['itemsperpage']));
// Return the output that has been generated by this function
return $pnRender->fetch('feeds_admin_view.htm');
* This is a standard function to modify the configuration parameters of the
// Assign all module vars
// Return the output that has been generated by this function
return $pnRender->fetch('feeds_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
// Confirm authorisation code
// Update module variables
pnModSetVar('Feeds', 'enablecategorization', $enablecategorization);
pnModSetVar('Feeds', 'openinnewwindow', $openinnewwindow);
pnModSetVar('Feeds', 'cachedirectory', $cachedirectory);
// Let any other modules know that the modules configuration has been updated
pnModCallHooks('module','updateconfig','Feeds', array('module' => 'Feeds'));
// the module configuration has been updated successfuly
|