Update api_status.php
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 6 Sep 2008 19:45:07 +0000 (15:45 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 6 Sep 2008 19:45:07 +0000 (15:45 -0400)
includes/api_status.php

index fea567db33022566dd2795a963948738d2db02df..697fe3de5c2f1dcf9b4a781d24bb2b9cac3588bd 100644 (file)
@@ -19,7 +19,7 @@
 || ###################################################################
 \*=====================================================================*/
 
-$GLOBALS['isso:callback']->load('api', null);
+require_once ISSO . '/Api.php';
 
 require_once('./includes/functions_datastore.php');
 
@@ -32,66 +32,70 @@ require_once('./includes/functions_datastore.php');
 * @package             Bugdar
 * 
 */
-class StatusAPI extends API
+class StatusAPI extends BSApi
 {
        /**
-       * Fields
-       * @var  array
-       * @access       private
-       */
-       var $fields = array(
-               'statusid'              => array(TYPE_UINT,             REQ_AUTO,       'verify_nozero'),
-               'status'                => array(TYPE_STR,              REQ_YES,        'verify_noempty'),
+        * Fields
+        * @var array
+        */
+       protected $fields = array(
+               'statusid'              => array(TYPE_UINT,             REQ_AUTO),
+               'status'                => array(TYPE_STR,              REQ_YES),
                'color'                 => array(TYPE_STR,              REQ_NO),
                'displayorder'  => array(TYPE_INT,              REQ_NO)
        );
        
        /**
-       * Database table
-       * @var  string
-       * @access       private
-       */
-       var $table = 'status';
+        * Database table
+        * @var string
+        */
+       protected $table = 'status';
        
        /**
-       * Table prefix
-       * @var  string
-       * @access       private
-       */
-       var $prefix = TABLE_PREFIX;
+        * Table prefix
+        * @var string
+        */
+       protected $prefix = TABLE_PREFIX;
        
-       // ###################################################################
        /**
-       * Post-insert
-       *
-       * @access       protected
-       */
+        * Post-insert
+        */
        function post_insert()
        {
                build_statuses();
        }
        
-       // ###################################################################
        /**
-       * Post-update
-       *
-       * @access       protected
-       */
-       function post_update()
+        * Post-update
+        */
+       protected function post_update()
        {
                build_statuses();
        }
        
-       // ###################################################################
        /**
-       * Post-delete
-       *
-       * @access       protected
-       */
-       function post_delete()
+        * Post-delete
+        */
+       protected function post_delete()
        {
                build_statuses();
-               $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET status = " . bugdar::$options['defaultstatus'] . " WHERE status = " . $this->values['statusid']);
+               BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET status = " . bugdar::$options['defaultstatus'] . " WHERE status = " . $this->values['statusid']);
+       }
+       
+       /**
+        * Validate: statusid
+        */
+       protected function validate_statusid($field)
+       {
+               return $this->_verifyIsNotZero($field);
+       }
+       
+       /**
+        * Validate: status
+        */
+       protected function validate_status($field)
+       {
+               return $this->_verifyIsNotEmpty($field);
        }
 }