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
* @author The Zikula Development Team
* @return output The main module admin page.
// Return the output that has been generated by this function
return $pnRender->fetch('faq_admin_main.htm');
* @author The Zikula Development Team
* @return output The main module admin page.
if ($modvars['enablecategorization']) {
// load the categories system
pn_exit (pnML('_UNABLETOLOADCLASS', array('s' => 'CategoryRegistryUtil')));
$pnRender->assign('catregistry', $catregistry);
// Assign the module vars to the template
$pnRender->assign($modvars);
// Return the output that has been generated by this function
return $pnRender->fetch('faq_admin_new.htm');
* @author The Zikula Development Team
* @param name the name of the item to be created
* @param number the number of the item to be created
// Get parameters from whatever input we need
// Confirm authorisation code
* @author The Zikula Development Team
* @param tid the id of the item to be modified
* @return output the modification page
$item = pnModAPIFunc('FAQ', 'user', 'get', array('faqid' => $faqid));
$pnRender->assign($item);
// load the categories system
pn_exit (pnML('_UNABLETOLOADCLASS', array('s' => 'CategoryRegistryUtil')));
$pnRender->assign('categories', $categories);
// Return the output that has been generated by this function
return $pnRender->fetch('faq_admin_modify.htm');
* @author The Zikula Development Team
* @param tid the id of the item to be modified
* @param name the name of the item to be updated
* @param number the number of the item to be updated
if (!empty($faq['objectid'])) {
$faq['faqid'] = $faq['objectid'];
// Confirm authorisation code
* @author The Zikula Development Team
* @param tid the id of the item to be modified
* @param confirmation confirmation that this item can be deleted
$objectid = FormUtil::getPassedValue('objectid', isset ($args['objectid']) ? $args['objectid'] : null, 'REQUEST');
$item = pnModAPIFunc('FAQ', 'user', 'get', array('faqid' => $faqid));
// Check for confirmation.
if (empty($confirmation)) {
// Add a hidden field for the item ID to the output
$pnRender->assign('faqid', $faqid);
// Return the output that has been generated by this function
return $pnRender->fetch('faq_admin_delete.htm');
// If we get here it means that the user has confirmed the action
// Confirm authorisation code
if (pnModAPIFunc('FAQ', 'admin', 'delete', array('faqid' => $faqid))) {
* This function shows all items and lists the administration
* @author The Zikula Development Team
* @param startnum The number of the first item to show
* @return output The main module admin page
$property = FormUtil::getPassedValue('faq_property', isset ($args['faq_property']) ? $args['faq_property'] : null, 'POST');
$category = FormUtil::getPassedValue("faq_{$property}_category", isset ($args["faq_{$property}_category"]) ? $args["faq_{$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 $key => $item) {
$options[] = array('url' => pnModURL('FAQ', 'admin', 'modify', array('faqid' => $item['faqid'])),
$options[] = array('url' => pnModURL('FAQ', 'admin', 'delete', array('faqid' => $item['faqid'])),
'image' => '14_layer_deletelayer.gif',
// Add the calculated menu options to the item array
$items[$key]['options'] = $options;
// Assign the items and modvars to the template
$pnRender->assign('faqs', $items);
$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('FAQ', 'user', 'countitems', array('category' => isset ($catFilter) ? $catFilter : null)),
'itemsperpage' => $modvars['itemsperpage']));
// Return the output that has been generated by this function
return $pnRender->fetch('faq_admin_view.htm');
* This is a standard function to modify the configuration parameters of the
* @author The Zikula Development Team
* @return output The configuration page
// Assign all module vars
// Return the output that has been generated by this function
return $pnRender->fetch('faq_admin_modifyconfig.htm');
* Update the configuration
* This is a standard function to update the configuration parameters of the
* module given the information passed back by the modification form
* @author The Zikula Development Team
* @param itemsperpage number of items per page
// Confirm authorisation code
// Update module variables
pnModSetVar('FAQ', 'enablecategorization', $enablecategorization);
pnModSetVar('FAQ', 'addcategorytitletopermalink', $addcategorytitletopermalink);
// The configuration has been changed, so we clear all caches for this module.
$pnRender->clear_all_cache();
// Let any other modules know that the modules configuration has been updated
pnModCallHooks('module','updateconfig','FAQ', array('module' => 'FAQ'));
// the module configuration has been updated successfuly
|