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

Source for file pnajax.php

Documentation is available at pnajax.php

  1. <?php
  2. /**
  3.  * Zikula Application Framework
  4.  *
  5.  * @copyright (c) 2001, Zikula Development Team
  6.  * @link http://www.zikula.org
  7.  * @version $Id: pnajax.php 24342 2008-06-06 12:03:14Z markwest $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  * @package Zikula_System_Modules
  10.  * @subpackage Blocks
  11. */
  12.  
  13. /**
  14.  * changeblockorder
  15.  *
  16.  * @author Frank Schummertz
  17.  * @param blockorder array of sorted blocks (value = block id)
  18.  * @param position int zone id
  19.  * @return mixed true or Ajax error
  20.  */
  21. {
  22.     if (!SecurityUtil::checkPermission('Blocks::''::'ACCESS_ADMIN)) {
  23.     }
  24.  
  25.     if (!SecurityUtil::confirmAuthKey()) {
  26.         AjaxUtil::error(_BADAUTHKEY);
  27.     }
  28.  
  29.     $blockorder FormUtil::getPassedValue('blockorder');
  30.     $position FormUtil::getPassedValue('position');
  31.  
  32.     // empty block positions for this block zone
  33.     $res DBUtil::deleteObjectByID('block_placements'$position'pid');
  34.     if (!$res{
  35.         AjaxUtil::error(_UPDATEFAILED);
  36.     }
  37.  
  38.     // add new block positions
  39.     $blockplacements array();
  40.     foreach ($blockorder as $order => $bid{
  41.         $blockplacements[array('bid' => $bid'pid' => $position'order' => $order);
  42.     }
  43.     $res DBUtil::insertObjectArray($blockplacements'block_placements');
  44.     if (!$res{
  45.         AjaxUtil::error(_UPDATEFAILED);
  46.     }
  47.  
  48.     return array('result' => true);
  49. }
  50.  
  51. /**
  52.  * toggleblock
  53.  * This function toggles active/inactive
  54.  *
  55.  * @author Frank Schummertz
  56.  * @param bid int  id of block to toggle
  57.  * @return mixed true or Ajax error
  58.  */
  59. {
  60.     if (!SecurityUtil::checkPermission('Blocks::''::'ACCESS_ADMIN)) {
  61.     }
  62.  
  63.     $bid FormUtil::getPassedValue('bid'-1'GET');
  64.     if ($bid==-1{
  65.         LogUtil::registerError('no block id');
  66.         AjaxUtil::output();
  67.     }
  68.     
  69.     // read the block information
  70.     $blockinfo pnBlockGetInfo($bid);
  71.     if ($blockinfo == false{
  72.         LogUtil::registerError('unable to get block info for bid=' DataUtil::formatForDisplay($bid));
  73.         AjaxUtil::output();
  74.     }
  75.     
  76.     if ($blockinfo['active'== 1{
  77.         pnModAPIFunc('Blocks''admin''deactivate'array('bid' => $bid));
  78.     else {
  79.         pnModAPIFunc('Blocks''admin''activate'array('bid' => $bid));
  80.     }
  81.     
  82.     AjaxUtil::output(array('bid' => $bid));
  83. }

Documentation generated on Fri, 18 Jul 2008 21:52:36 +0200 by phpDocumentor 1.4.1