load('api', null); require_once('./includes/functions_datastore.php'); /** * API: Automation * * @author Blue Static * @copyright Copyright (c)2002 - 2007, Blue Static * @version $Revision$ * @package Bugdar * */ class AutomationAPI extends API { /** * Fields * @var array * @access private */ var $fields = array( 'actionid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'), 'name' => array(TYPE_STR, REQ_YES, 'verify_noempty'), 'description' => array(TYPE_STR, REQ_NO), 'fieldchanges' => array(TYPE_NONE, REQ_YES, ':self'), 'comment' => array(TYPE_STR, REQ_NO) ); /** * Table * @var string * @access private */ var $table = 'automation'; /** * Table prefix * @var string * @access private */ var $prefix = TABLE_PREFIX; // ################################################################### /** * Post-insert * * @access private */ function post_insert() { build_automations(); } // ################################################################### /** * Post-update * * @access private */ function post_update() { build_automations(); } // ################################################################### /** * Post-delete * * @access private */ function post_delete() { build_automations(); } // ################################################################### /** * Verify: fieldchanges * * @access private */ function verify_fieldchanges() { if (!is_array($this->values['fieldchanges']) OR sizeof($this->values['fieldchanges']) != 2 OR !is_array($this->values['fieldchanges']['custom']) OR !is_array($this->values['fieldchanges']['builtin'])) { return T('Invalid array type passed. The fieldchaneges array must be a two-dimensional array: array("builtin" => array("fieldname" => "newvalue" ...), "custom" => array("fieldname" => "fieldvalue" ...))'); } if (sizeof($this->values['fieldchanges']['custom']) < 1 AND sizeof($this->values['fieldchanges']['builtin']) < 1) { return T('You need to specify some fields to change.'); } $this->values['fieldchanges'] = serialize($this->values['fieldchanges']); return true; } }