This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/modules/static_page_category/static_page_category.inc.php
2011-05-03 09:49:01 +10:00

84 lines
2.1 KiB
PHP

<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* Originally authored by Tony Landis, AgileBill LLC
*
* Recent modifications by Deon George
*
* @author Deon George <deonATleenooksDOTnet>
* @copyright 2009 Deon George
* @link http://osb.leenooks.net
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @subpackage Modules:StaticPages
*/
/**
* The main AgileBill Static Page Categories Class
*
* @package AgileBill
* @subpackage Modules:StaticPages
*/
class static_page_category extends OSB_module {
/**
* Get the page categories
*/
public function get_page_categories($VAR) {
global $C_auth;
$categories = array();
$db = &DB();
if (isset($VAR['id']) && trim($VAR['id']))
$result = $db->Execute(sqlSelect($db,'static_page_category','id,name,group_avail',array('status'=>1,'id'=>$VAR['id']),'sort_order,name'));
else
$result = $db->Execute(sqlSelect($db,'static_page_category','id,name,group_avail',array('status'=>1),'sort_order,name'));
if ($result && $result->RecordCount())
while (! $result->EOF) {
@$arr = unserialize($result->fields['group_avail']);
for ($i=0; $i<count($arr); $i++) {
if ($C_auth->auth_group_by_id($arr[$i])) {
array_push($categories,array('name'=>$result->fields['name'],'id'=>$result->fields['id']));
$i=count($arr);
}
}
$result->MoveNext();
}
return $categories;
}
/**
* Get all the page categories to a user
*/
public function menu() {
global $smarty;
$smart = $this->get_page_categories(array());
if (! count($smart)) {
$smarty->assign('static_page_category_display',false);
return false;
} else {
$smarty->assign('static_page_category_display',true);
$smarty->assign('static_page_category_results',$smart);
return true;
}
}
}
?>