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

index d5fd90d7a4553a61ab019b28a17ad134c1c2c78f..8cd4184be9c056e34b648e2920404d20ea1b14b1 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 PriorityAPI extends API
+class PriorityAPI extends BSApi
 {
        /**
-       * Fields
-       * @var  array
-       * @access       private
-       */
-       var $fields = array(
+        * Fields
+        * @var array
+        */
+       protected $fields = array(
                'priorityid'    => array(TYPE_UINT,             REQ_AUTO,       'verify_nozero'),
                'priority'              => array(TYPE_STR,              REQ_YES,        'verify_noempty'),
                'displayorder'  => array(TYPE_INT,              REQ_NO)
        );
        
        /**
-       * Database table
-       * @var  string
-       * @access       private
-       */
-       var $table = 'priority';
+        * Database table
+        * @var string
+        */
+       protected $table = 'priority';
        
        /**
-       * 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_priorities();
        }
        
-       // ###################################################################
        /**
-       * Post-update
-       *
-       * @access       protected
-       */
-       function post_update()
+        * Post-update
+        */
+       protected function post_update()
        {
                build_priorities();
        }
        
-       // ###################################################################
        /**
-       * Post-delete
-       *
-       * @access       protected
-       */
-       function post_delete()
+        * Post-delete
+        */
+       protected function post_delete()
        {
                build_priorities();
-               $this->registry->db->query("UPDATE " . TABLE_PREFIX . "bug SET priority = " . bugdar::$options['defaultpriority'] . " WHERE priority = " . $this->values['priorityid']);
+               BSApp::$db->query("UPDATE " . TABLE_PREFIX . "bug SET priority = " . bugdar::$options['defaultpriority'] . " WHERE priority = " . $this->values['priorityid']);
+       }
+       
+       /**
+        * Validate: priorityid
+        */
+       protected function validate_priorityid($field)
+       {
+               return $this->_verifyIsNotZero($field);
+       }
+       
+       /**
+        * Validate: priority
+        */
+       protected function validate_priority($field)
+       {
+               return $this->_verifyIsNotEmpty($field);
        }
 }