Source for file pnadminapi.php
Documentation is available at pnadminapi.php
* Zikula Application Framework
* @copyright (c) 2002, Zikula Development Team
* @link http://www.zikula.org
* @version $Id: pnadminapi.php 24342 2008-06-06 12:03:14Z markwest $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @package Zikula_System_Modules
* @subpackage Admin_Messages
* create a new Admin_Messages item
* @param string $args['title'] title of the admin message
* @param string $args['content'] text of the admin message
* @param string $args['language'] the language of the message
* @param int $args['active'] activation status of the message
* @param int $args['expire'] expiry date of the message
* @param int $args['view'] who can view the message
* @return mixed Admin_Messages item ID on success, false on failure
if (!isset ($args['title']) ||
!isset ($args['content']) ||
!isset ($args['language']) ||
!isset ($args['active']) ||
!isset ($args['expire']) ||
if (empty($args['title']) && empty($args['content'])) {
$item = array('title' => $args['title'], 'content' => $args['content'],
'language' => $args['language'], 'active' => $args['active'], 'view' => $args['view']);
// add some additional modified values
if ($args['expire'] < 0) {
$item['expire'] = $args['expire'] * 86400; // turns days into seconds
// Let any hooks know that we have created a new item.
pnModCallHooks('item', 'create', $item['mid'], array('module' => 'Admin_Messages'));
// Return the id of the newly created item to the calling process
* delete an Admin_Messages item
* @param int $args['mid'] ID of the admin message to delete
* @return bool true on success, false on failure
if (!isset ($args['mid'])) {
// Get the existing admin message
$item = pnModAPIFunc('Admin_Messages', 'user', 'get', array('mid' => $args['mid']));
// Let any hooks know that we have deleted an item.
pnModCallHooks('item', 'delete', $args['mid'], array('module' => 'Admin_Messages'));
// The item has been modified, so we clear all cached pages of this item.
// Let the calling process know that we have finished successfully
* update a Admin_Messages item
* @param int $args['mid'] the ID of the item
* @param sting $args['title'] title of the admin message
* @param string $args['content'] text of the admin message
* @param string $args['language'] the language of the message
* @param int $args['active'] activation status of the message
* @param int $args['expire'] expiry date of the message
* @param int $args['view'] who can view the message
* @return bool true if successful, false otherwise
if (!isset ($args['mid']) ||
!isset ($args['title']) ||
!isset ($args['content']) ||
!isset ($args['language']) ||
!isset ($args['active']) ||
!isset ($args['expire']) ||
!isset ($args['oldtime']) ||
!isset ($args['changestartday']) ||
// Get the existing admin message
$item = pnModAPIFunc('Admin_Messages', 'user', 'get', array('mid' => $args['mid']));
// check value of change start day to today and set time
if ($args['changestartday'] == 1) {
$time = $args['oldtime'];
// check for an invalid expiry
if ($args['expire'] < 0) {
$item = array('mid' => $args['mid'], 'title' => $args['title'], 'content' => $args['content'],
'language' => $args['language'], 'active' => $args['active'], 'view' => $args['view']);
// add some additional modified values
$args['expire'] = $args['expire'] * 86400; // turns days into seconds
pnModCallHooks('item', 'update', $args['mid'], array('module' => 'Admin_Messages'));
// The item has been modified, so we clear all cached pages of this item.
// Let the calling process know that we have finished successfully
* get available admin panel links
* @return array array of admin links
|