Zikula_Value_Addons
[ class tree: Zikula_Value_Addons ] [ index: Zikula_Value_Addons ] [ all elements ]

Source for file pnadmin.php

Documentation is available at pnadmin.php

  1. <?php
  2. /**
  3.  * Zikula Application Framework
  4.  *
  5.  * @copyright (c) 2002, Zikula Development Team
  6.  * @link http://www.zikula.org
  7.  * @version $Id: pnadmin.php 24342 2008-06-06 12:03:14Z markwest $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  * @package Zikula_Value_Addons
  10.  * @subpackage AvantGo
  11.  */
  12.  
  13. /**
  14.  * the main administration function
  15.  * This function is the default function, and is called whenever the
  16.  * module is initiated without defining arguments.  As such it can
  17.  * be used for a number of things, but most commonly it either just
  18.  * shows the module menu and returns or calls whatever the module
  19.  * designer feels should be the default function (often this is the
  20.  * view() function)
  21.  * @author Mark West
  22.  * @link http://www.markwest.me.uk
  23.  * @return string HTML string
  24.  */
  25. function AvantGo_admin_main()
  26. {
  27.     // Security check
  28.     if (!SecurityUtil::checkPermission('AvantGo::''::'ACCESS_EDIT)) {
  29.         return LogUtil::registerPermissionError();
  30.     }
  31.  
  32.     // Create output object
  33.     $pnRender pnRender::getInstance('AvantGo');
  34.  
  35.     // Return the output that has been generated by this function
  36.     return $pnRender->fetch('avantgo_admin_main.htm');
  37. }
  38.  
  39. /**
  40.  * View items that would be displayed by the module within PN framework
  41.  * @author Mark West
  42.  * @link http://www.markwest.me.uk
  43.  * @param 'startnum' the starting article numbner
  44.  * @return strong HTML string
  45.  */
  46. function AvantGo_admin_view()
  47. {
  48.     // Security check
  49.     if (!SecurityUtil::checkPermission('AvantGo::''::'ACCESS_EDIT)) {
  50.         return LogUtil::registerPermissionError();
  51.     }
  52.  
  53.     $startnum FormUtil::getPassedValue('startnum'isset($args['startnum']$args['startnum'null'GET');
  54.  
  55.     // Create output object
  56.     $pnRender pnRender::getInstance('AvantGo'false);
  57.  
  58.     // Get all the items from the API
  59.     $items pnModAPIFunc('News''user''getall',
  60.                           array('startnum' => $startnum,
  61.                                 'numitems' => pnModGetVar('AvantGo''itemsperpage')));
  62.  
  63.     // assign the result set
  64.     $pnRender->assign('storyitems'$items);
  65.  
  66.     // Return the output that has been generated by this function
  67.     return $pnRender->fetch('avantgo_admin_view.htm');
  68. }
  69.  
  70. /**
  71.  * This is a standard function to modify the configuration parameters of the
  72.  * module
  73.  * @author Mark West
  74.  * @link http://www.markwest.me.uk
  75.  * @return string HTML string
  76.  */
  77. {
  78.     // Security check
  79.     if (!SecurityUtil::checkPermission('AvantGo::''::'ACCESS_ADMIN)) {
  80.         return LogUtil::registerPermissionError();
  81.     }
  82.  
  83.     // Create output object
  84.     $pnRender pnRender::getInstance('AvantGo'false);
  85.  
  86.     // assign all module vars
  87.     $pnRender->assign(pnModGetVar('AvantGo'));
  88.  
  89.     // Return the output that has been generated by this function
  90.     return $pnRender->fetch('avantgo_admin_modifyconfig.htm');
  91. }
  92.  
  93. /**
  94.  * This is a standard function to update the configuration parameters of the
  95.  * module given the information passed back by the modification form
  96.  * @author Mark West
  97.  * @link http://www.markwest.me.uk
  98.  * @param 'itemsperpage' the number of items to display on the module page
  99.  * @return bool true if update successful, false otherwise
  100.  */
  101. {
  102.     // Security check
  103.     if (!SecurityUtil::checkPermission('AvantGo::''::'ACCESS_ADMIN)) {
  104.         return LogUtil::registerPermissionError();
  105.     }
  106.  
  107.     // Confirm authorisation code.
  108.     if (!SecurityUtil::confirmAuthKey()) {
  109.         return LogUtil::registerAuthidError (pnModURL('AvantGo''admin''view'));
  110.     }
  111.  
  112.     // Update module variables.
  113.     $itemsperpage FormUtil::getPassedValue('itemsperpage'25'POST');
  114.     pnModSetVar('AvantGo''itemsperpage'$itemsperpage);
  115.  
  116.     // Let any other modules know that the modules configuration has been updated
  117.     pnModCallHooks('module','updateconfig','AvantGo'array('module' => 'AvantGo'));
  118.  
  119.     // the module configuration has been updated successfuly
  120.  
  121.     // This function generated no output, and so now it is complete we redirect
  122.     // the user to an appropriate page for them to carry on their work
  123.     return pnRedirect(pnModURL('AvantGo''admin''view'));
  124. }

Documentation generated on Fri, 18 Jul 2008 21:50:01 +0200 by phpDocumentor 1.4.1