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

84 lines
2.1 KiB
PHP
Raw Normal View History

<?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
2009-08-03 04:10:16 +00:00
*
* 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
2009-08-03 04:10:16 +00:00
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
2009-08-03 04:10:16 +00:00
* @subpackage Modules:StaticPages
*/
2009-08-03 04:10:16 +00:00
/**
* 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;
2009-08-03 04:10:16 +00:00
$categories = array();
$db = &DB();
2009-08-03 04:10:16 +00:00
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
2009-08-03 04:10:16 +00:00
$result = $db->Execute(sqlSelect($db,'static_page_category','id,name,group_avail',array('status'=>1),'sort_order,name'));
2009-08-03 04:10:16 +00:00
if ($result && $result->RecordCount())
while (! $result->EOF) {
@$arr = unserialize($result->fields['group_avail']);
2009-08-03 04:10:16 +00:00
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);
}
}
2009-08-03 04:10:16 +00:00
$result->MoveNext();
}
2009-08-03 04:10:16 +00:00
return $categories;
}
2009-08-03 04:10:16 +00:00
/**
* Get all the page categories to a user
*/
public function menu() {
global $smarty;
2009-08-03 04:10:16 +00:00
$smart = $this->get_page_categories(array());
2009-08-03 04:10:16 +00:00
if (! count($smart)) {
$smarty->assign('static_page_category_display',false);
return false;
2009-08-03 04:10:16 +00:00
} else {
$smarty->assign('static_page_category_display',true);
$smarty->assign('static_page_category_results',$smart);
2009-08-03 04:10:16 +00:00
return true;
}
}
}
2009-08-03 04:10:16 +00:00
?>