Changes to AgileBill

This commit is contained in:
Deon George
2009-08-03 14:10:16 +10:00
parent 0a22cfe22c
commit 27aee719b0
1051 changed files with 219109 additions and 117219 deletions

View File

@@ -1,12 +1,35 @@
<?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:Account
*/
### public methods for this module:
$auth_methods = Array
(
Array ('module' => 'faq', 'method' => 'faq_categories'),
Array ('module' => 'faq', 'method' => 'faq_show'),
Array ('module' => 'faq', 'method' => 'autofill'),
Array ('module' => 'faq', 'method' => 'faq_search')
);
/**
* Public FAQ methods
*/
$auth_methods = array(
array('module'=>'faq','method'=>'faq_categories'),
array('module'=>'faq','method'=>'faq_show'),
array('module'=>'faq','method'=>'autofill'),
array('module'=>'faq','method'=>'faq_search')
);
?>

View File

@@ -1,55 +1,34 @@
<?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
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* 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>
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
* @subpackage Module:FAQ
*/
class faq
{
# Open the constructor for this mod
function faq()
{
# name of this module:
$this->module = "faq";
$this->version = "1.0.0a";
if(!defined('AJAX'))
{
# location of the construct XML file:
$this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml";
# open the construct file for parsing
$C_xml = new CORE_xml;
$construct = $C_xml->xml_to_array($this->xml_construct);
$this->method = $construct["construct"]["method"];
$this->trigger = $construct["construct"]["trigger"];
$this->field = $construct["construct"]["field"];
$this->table = $construct["construct"]["table"];
$this->module = $construct["construct"]["module"];
$this->cache = $construct["construct"]["cache"];
$this->order_by = $construct["construct"]["order_by"];
$this->limit = $construct["construct"]["limit"];
}
}
/**
* The main AgileBill FAQ Class
*
* @package AgileBill
* @subpackage Module:FAQ
*/
class faq extends OSB_module {
### autofill for admin 'canned messages' in ticket reply
function autofill($VAR)
{
@@ -198,61 +177,33 @@ class faq
$smarty->assign('faq_category_list', @$smart);
}
/**
* Add a entry to the database
*/
public function add($VAR) {
global $VAR;
if (empty($VAR['faq_translate_question']))
return false;
$q = $VAR['faq_translate_question'];
unset($VAR['faq_translate_question']);
$a = '';
if (isset($VAR['faq_translate_answer'])) {
$a = $VAR['faq_translate_answer'];
unset($VAR['faq_translate_answer']);
}
##############################
## ADD ##
##############################
function add($VAR)
{
$type = "add";
$this->method["$type"] = explode(",", $this->method["$type"]);
$db = new CORE_database;
$id = $db->add($VAR, $this, $type);
$id = parent::add($VAR);
if($id && !empty($VAR['faq_question']))
{
# Insert translation
# Insert translation
if ($id) {
$db = &DB();
$idx = $db->GenID(AGILE_DB_PREFIX. 'faq_translate_id');
$sql = "INSERT INTO ".AGILE_DB_PREFIX."faq_translate
SET
site_id = ".DEFAULT_SITE.",
id = $idx,
faq_id = $id,
date_orig = ".time().",
date_last = ".time().",
language_id = '".DEFAULT_LANGUAGE."',
answer = ".$db->qstr( @$VAR['faq_answer'] ).",
question = ".$db->qstr( @$VAR['faq_question']);
$db->Execute($sql);
$db->Execute(sqlInsert($db,'faq_translate',array('faq_id'=>$id,'date_orig'=>time(),'date_last'=>time(),'language_id'=>DEFAULT_LANGUAGE,'question'=>$q,'answer'=>$a)));
}
}
##############################
## VIEW ##
##############################
function view($VAR)
{
$type = "view";
$this->method["$type"] = explode(",", $this->method["$type"]);
$db = new CORE_database;
$db->view($VAR, $this, $type);
}
##############################
## UPDATE ##
##############################
function update($VAR)
{
$type = "update";
$this->method["$type"] = explode(",", $this->method["$type"]);
$db = new CORE_database;
$db->update($VAR, $this, $type);
}
##############################
## DELETE ##
##############################
@@ -268,40 +219,6 @@ class faq
$db->mass_delete($VAR, $this, "");
}
##############################
## SEARCH FORM ##
##############################
function search_form($VAR)
{
$type = "search";
$this->method["$type"] = explode(",", $this->method["$type"]);
$db = new CORE_database;
$db->search_form($VAR, $this, $type);
}
##############################
## SEARCH ##
##############################
function search($VAR)
{
$type = "search";
$this->method["$type"] = explode(",", $this->method["$type"]);
$db = new CORE_database;
$db->search($VAR, $this, $type);
}
##############################
## SEARCH SHOW ##
##############################
function search_show($VAR)
{
$type = "search";
$this->method["$type"] = explode(",", $this->method["$type"]);
$db = new CORE_database;
$db->search_show($VAR, $this, $type);
}
function linkalize($text)
{
$text = preg_replace("/([^\w\/])(www\.[a-z0-9\-]+\.[a-z0-9\-]+)/i", "$1http://$2", $text);

View File

@@ -1,78 +1,116 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<!-- Module name -->
<module>faq</module>
<!-- Module supporting database table -->
<table>faq</table>
<!-- Module dependancy(s) (module wont install if these modules are not yet installed) -->
<dependancy></dependancy>
<!-- DB cache in seconds -->
<cache>0</cache>
<!-- Default order_by field for SQL queries -->
<order_by>sort_order,date_orig,name</order_by>
<!-- Default SQL limit for SQL queries -->
<limit>25</limit>
<!-- Schema version (used to determine if the schema has change during upgrades) -->
<version>0</version>
<!-- define the module name -->
<module>faq</module>
<!-- Database indexes -->
<index>
</index>
<!-- define the module table name -->
<table>faq</table>
<!-- Database fields -->
<field>
<!-- Record ID -->
<id>
<index>1</index>
<type>I4</type>
<unique>1</unique>
</id>
<!-- Site ID -->
<site_id>
<index>1</index>
<type>I4</type>
</site_id>
<!-- Date record created -->
<date_orig>
<convert>date-now</convert>
<display>Date Created</display>
<type>I8</type>
</date_orig>
<!-- Date record updated -->
<date_last>
<convert>date-now</convert>
<display>Date Updated</display>
<type>I8</type>
</date_last>
<faq_category_id>
<display>Category</display>
<type>I4</type>
<asso_table>faq_category</asso_table>
<asso_field>name</asso_field>
</faq_category_id>
<date_start>
<display>Date Start</display>
<type>I8</type>
<convert>date</convert>
</date_start>
<date_expire>
<display>Date Expire</display>
<type>I8</type>
<convert>date</convert>
</date_expire>
<sort_order>
<display>Sort Order</display>
<type>I4</type>
</sort_order>
<status>
<display>Active</display>
<type>L</type>
</status>
<name>
<display>Name</display>
<type>C(255)</type>
<min_len>1</min_len>
<max_len>255</max_len>
<validate>any</validate>
<unique>1</unique>
</name>
</field>
<!-- define the module dependancy(s) -->
<dependancy></dependancy>
<!-- Methods for this class, and the fields they have access to, if applicable -->
<method>
<add>faq_category_id,date_orig,sort_order,status,name</add>
<update>id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name</update>
<delete>id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name</delete>
<view>id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name</view>
<search>id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name</search>
</method>
<!-- define the DB cache in seconds -->
<cache>0</cache>
<!-- Method triggers -->
<trigger></trigger>
<!-- define the default order_by field for SQL queries -->
<order_by>sort_order,date_orig,name</order_by>
<!-- Template page display titles -->
<title>
<add>Add FAQ</add>
<search_form>Search FAQ</search_form>
<view>FAQ</view>
</title>
<!-- define the methods -->
<limit>35</limit>
<!-- define the fields -->
<field>
<id>
<type>I4</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<faq_category_id>
<type>I4</type>
<asso_table>faq_category</asso_table>
<asso_field>name</asso_field>
</faq_category_id>
<date_orig>
<type>I8</type>
<convert>date-now</convert>
</date_orig>
<date_last>
<type>I8</type>
<convert>date-now</convert>
</date_last>
<date_start>
<type>I8</type>
<convert>date</convert>
</date_start>
<date_expire>
<type>I8</type>
<convert>date</convert>
</date_expire>
<sort_order>
<type>I4</type>
</sort_order>
<status>
<type>L</type>
</status>
<name>
<type>C(255)</type>
<min_len>1</min_len>
<max_len>255</max_len>
<validate>any</validate>
<unique>1</unique>
</name>
</field>
<!-- define all the methods for this class, and the fields they have access to, if applicable. -->
<method>
<add>id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name</add>
<update>id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name</update>
<delete>id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name</delete>
<view>id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name</view>
<search>id,site_id,faq_category_id,date_orig,date_last,date_start,date_expire,sort_order,status,name</search>
</method>
<!-- define the method triggers -->
<trigger>0</trigger>
<!-- Template helpers -->
<tpl>
<search_show>
<checkbox>
<field>id</field>
<type>checkbox</type>
<width>25px</width>
</checkbox>
<name>
<field>name</field>
</name>
<faq_category_id>
<field>faq_category_id</field>
</faq_category_id>
</search_show>
</tpl>
</construct>

View File

@@ -1,49 +1,61 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<!-- Tree Menu Module Properties -->
<module_properties>
<!-- MODULE Dependancy, this module wont be installed if the dependant modules dont exist -->
<dependancy></dependancy>
<!-- Translated display to use on the tree -->
<display>FAQ</display>
<!-- Display a module in the menu tree -->
<menu_display>1</menu_display>
<!-- MODULE Name -->
<name>faq</name>
<!-- MODULE Notes, these notes show up in the modules table, as a description of the module -->
<notes><![CDATA[This module controls the FAQs]]></notes>
<!-- MODULE Parent, the parent node in the tree -->
<parent>faq</parent>
<!-- SUB Modules to install with this one -->
<sub_modules>faq_category,faq_translate</sub_modules>
<!-- MODULE Type (core|base), core modules cannot be deleted, unrecognised types are ignored. -->
<type>base</type>
</module_properties>
<!-- Define the main module properties -->
<module_properties>
<name>faq</name>
<parent>faq</parent>
<notes>This module controls the FAQs</notes>
<menu_display>1</menu_display>
<sub_modules>faq_category,faq_translate</sub_modules>
</module_properties>
<!-- Define any methods for this module -->
<sql_inserts>
<module_method>
<search>
<name>search</name>
<notes>Allow users to view the search form</notes>
<page>%%:search_form</page>
<menu_display>1</menu_display>
</search>
<view>
<name>view</name>
<notes>Allow users to view records</notes>
<page><![CDATA[core:search&module=%%&_escape=1&_next_page_one=view]]></page>
<menu_display>1</menu_display>
</view>
<add>
<name>add</name>
<notes>Allow users to add records</notes>
<menu_display>1</menu_display>
</add>
<delete>
<name>delete</name>
</delete>
<update>
<name>update</name>
</update>
<search_form>
<name>search_form</name>
</search_form>
<search_show>
<name>search_show</name>
<notes>Allow users to view the search results</notes>
</search_show>
</module_method>
</sql_inserts>
<!-- Tree Menu & Module Methods to load, they will be assigned the group permissions on install time, as selected by the user. -->
<module_method>
<add>
<display>Add</display>
<menu_display>1</menu_display>
<name>add</name>
<notes><![CDATA[Add records]]></notes>
</add>
<delete>
<name>delete</name>
<notes><![CDATA[Delete records]]></notes>
</delete>
<search>
<display>List</display>
<menu_display>1</menu_display>
<name>search</name>
<notes><![CDATA[List records]]></notes>
<page><![CDATA[core:search&module=%%&_next_page_one=view]]></page>
</search>
<search_form>
<display>Search</display>
<menu_display>1</menu_display>
<name>search_form</name>
<notes><![CDATA[Search for records]]></notes>
</search_form>
<search_show>
<name>search_show</name>
<notes><![CDATA[Show the results of a search]]></notes>
</search_show>
<update>
<name>update</name>
<notes><![CDATA[Update a record]]></notes>
</update>
<view>
<name>view</name>
<notes><![CDATA[View a record]]></notes>
</view>
</module_method>
</install>