Update api_resolution.php
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 6 Sep 2008 20:02:43 +0000 (16:02 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 6 Sep 2008 20:02:43 +0000 (16:02 -0400)
includes/api_resolution.php

index aeb59ca4fe9bd9a0def8266a4a3a3ab3be51ddf2..1cd1dd0f1b18e0a597dc6f7fdecd2ab9406aa167 100644 (file)
@@ -19,8 +19,7 @@
 || ###################################################################
 \*=====================================================================*/
 
-$GLOBALS['isso:callback']->load('api', null);
-
+require_once ISSO . '/Api.php';
 require_once('./includes/functions_datastore.php');
 
 /**
@@ -32,65 +31,69 @@ require_once('./includes/functions_datastore.php');
 * @package             Bugdar
 * 
 */
-class ResolutionAPI extends API
+class ResolutionAPI extends BSApi
 {
        /**
-       * Fields
-       * @var  array
-       * @access       private
-       */
-       var $fields = array(
-               'resolutionid'  => array(TYPE_UINT,             REQ_AUTO,       'verify_nozero'),
-               'resolution'    => array(TYPE_STR,              REQ_YES,        'verify_noempty'),
+        * Fields
+        * @var array
+        */
+       protected $fields = array(
+               'resolutionid'  => array(TYPE_UINT,             REQ_AUTO),
+               'resolution'    => array(TYPE_STR,              REQ_YES),
                'displayorder'  => array(TYPE_INT,              REQ_NO)
        );
        
        /**
-       * Database table
-       * @var  string
-       * @access       private
-       */
-       var $table = 'resolution';
+        * Database table
+        * @var string
+        */
+       protected $table = 'resolution';
        
        /**
-       * Table prefix
-       * @var  string
-       * @access       private
-       */
-       var $prefix = TABLE_PREFIX;
+        * Table prefix
+        * @var string
+        */
+       protected $prefix = TABLE_PREFIX;
        
-       // ###################################################################
        /**
-       * Post-insert
-       *
-       * @access       protected
-       */
-       function post_insert()
+        * Post-insert
+        */
+       protected function post_insert()
        {
                build_resolutions();
        }
        
-       // ###################################################################
        /**
-       * Post-update
-       *
-       * @access       protected
-       */
-       function post_update()
+        * Post-update
+        */
+       protected function post_update()
        {
                build_resolutions();
        }
        
-       // ###################################################################
        /**
-       * Post-delete
-       *
-       * @access       protected
-       */
-       function post_delete()
+        * Post-delete
+        */
+       protected function post_delete()
        {
                build_resolutions();
-               $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET resolution = " . $this->registry->clean(bugdar::$options['defaultresolve'], TYPE_UINT) . " WHERE resolution = " . $this->values['resolutionid']);
+               BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET resolution = " . BSApp::$input->clean(bugdar::$options['defaultresolve'], TYPE_UINT) . " WHERE resolution = " . $this->values['resolutionid']);
+       }
+       
+       /**
+        * Validate: resolutionid
+        */
+       protected function validate_resolutionid($field)
+       {
+               return $this->_verifyIsNotZero($field);
+       }
+       
+       /**
+        * Validate: resolution
+        */
+       protected function validate_resolution($field)
+       {
+               return $this->_verifyIsNotEmpty($field);
        }
 }