|| ###################################################################
\*=====================================================================*/
-$GLOBALS['isso:callback']->load('api', null);
-
+require_once ISSO . '/Api.php';
require_once('./includes/functions_datastore.php');
/**
-* API: Automation
-*
-* @author Blue Static
-* @copyright Copyright ©2002 - 2007, Blue Static
-* @version $Revision$
-* @package Bugdar
-*
-*/
-class AutomationAPI extends API
+ * API: Automation
+ *
+ * @author Blue Static
+ * @copyright Copyright ©2002 - 2007, Blue Static
+ * @version $Revision$
+ * @package Bugdar
+ *
+ */
+class AutomationAPI extends BSApi
{
/**
- * Fields
- * @var array
- * @access private
- */
- var $fields = array(
- 'actionid' => array(TYPE_UINT, REQ_AUTO, 'verify_nozero'),
- 'name' => array(TYPE_STR, REQ_YES, 'verify_noempty'),
+ * Fields
+ * @var array
+ */
+ protected $fields = array(
+ 'actionid' => array(TYPE_UINT, REQ_AUTO),
+ 'name' => array(TYPE_STR, REQ_YES),
'description' => array(TYPE_STR, REQ_NO),
- 'fieldchanges' => array(TYPE_NONE, REQ_YES, ':self'),
+ 'fieldchanges' => array(TYPE_NONE, REQ_YES),
'comment' => array(TYPE_STR, REQ_NO)
);
/**
- * Table
- * @var string
- * @access private
- */
- var $table = 'automation';
+ * Table
+ * @var string
+ */
+ protected $table = 'automation';
/**
- * Table prefix
- * @var string
- * @access private
- */
- var $prefix = TABLE_PREFIX;
+ * Table prefix
+ * @var string
+ */
+ protected $prefix = TABLE_PREFIX;
- // ###################################################################
/**
- * Post-insert
- *
- * @access private
- */
- function post_insert()
+ * Post-insert
+ */
+ protected function post_insert()
{
build_automations();
}
- // ###################################################################
/**
- * Post-update
- *
- * @access private
- */
- function post_update()
+ * Post-update
+ */
+ protected function post_update()
{
build_automations();
}
- // ###################################################################
/**
- * Post-delete
- *
- * @access private
- */
- function post_delete()
+ * Post-delete
+ */
+ protected function post_delete()
{
build_automations();
}
- // ###################################################################
/**
- * Verify: fieldchanges
- *
- * @access private
- */
- function verify_fieldchanges()
+ * Validate: actionid
+ */
+ protected function validate_actionid($field)
+ {
+ return $this->_verifyIsNotZero($field);
+ }
+
+ /**
+ * Validate: name
+ */
+ protected function validate_name($field)
+ {
+ return $this->_verifyIsNotEmpty($field);
+ }
+
+ /**
+ * Validate: fieldchanges
+ */
+ protected function validate_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']))
+ if (!is_array($this->values['fieldchanges']) || sizeof($this->values['fieldchanges']) != 2 || !is_array($this->values['fieldchanges']['custom']) || !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)
+ if (sizeof($this->values['fieldchanges']['custom']) < 1 && sizeof($this->values['fieldchanges']['builtin']) < 1)
{
return T('You need to specify some fields to change.');
}