Ignore:
Timestamp:
08/04/09 10:23:16 (15 years ago)
Author:
gbisotto
Message:

Ticket #603 - Removido o pattern Observer da engine do Workflow

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sandbox/workflow/2.0/inc/engine/src/common/Base.php

    r795 r1263  
    11<?php 
    2 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'Observable.php'); 
    32/** 
    43 * This class is derived by all the API classes so they get the 
    54 * database connection, database methods and the Observable interface 
    6  *  
     5 * 
    76 * @package Galaxia 
    8  * @license http://www.gnu.org/copyleft/gpl.html GPL  
     7 * @license http://www.gnu.org/copyleft/gpl.html GPL 
    98 */ 
    10 class Base extends Observable { 
     9class Base { 
    1110        /** 
    1211         * @var object $db Database abstraction object used to access the database 
     
    1716         * @var int     $num_queries Debugging var 
    1817         * @access private 
    19          */      
     18         */ 
    2019        var $num_queries = 0; 
    2120        /** 
    2221         * @var int     $num_queries_total Debugging var 
    2322         * @access private 
    24          */      
     23         */ 
    2524        var $num_queries_total = 0; 
    2625        /** 
    2726         * @var array  $error Error messages 
    2827         * @access public 
    29          */      
     28         */ 
    3029        var $error= Array(); 
    3130        /** 
     
    3938         */ 
    4039        var $child_name = 'Base'; 
    41    
     40 
    4241  /** 
    4342   * Constructor receiving a database abstraction object 
     
    7271   * Always call this function after failed operations on a workflow object to obtain messages 
    7372   * 
    74    * @param bool $as_array if true the result will be send as an array of errors or an empty array. Else, if you do not give any parameter  
     73   * @param bool $as_array if true the result will be send as an array of errors or an empty array. Else, if you do not give any parameter 
    7574   * or give a false parameter you will obtain a single string which can be empty or will contain error messages with <br /> html tags 
    7675   * @param bool $debug is false by default, if true you wil obtain more messages 
    7776   * @param string $prefix string appended to the debug message 
    7877   * @return mixed Error and debug messages or an array of theses messages and empty the error messages 
    79    * @access public   
     78   * @access public 
    8079   */ 
    81   function get_error($as_array=false, $debug=false, $prefix='')  
     80  function get_error($as_array=false, $debug=false, $prefix='') 
    8281  { 
    8382    //collect errors from used objects 
     
    9695  /** 
    9796   * Gets warnings recorded by this object 
    98    *  
    99    * @param bool $as_array if true the result will be send as an array of warnings or an empty array. Else, if you do not give any parameter  
     97   * 
     98   * @param bool $as_array if true the result will be send as an array of warnings or an empty array. Else, if you do not give any parameter 
    10099   * or give a false parameter you will obtain a single string which can be empty or will contain warning messages with <br /> html tags 
    101100   * @return mixed Warning messages or an array of theses messages and empty the warning messages 
    102    * @access public   
     101   * @access public 
    103102   */ 
    104   function get_warning($as_array=false)  
     103  function get_warning($as_array=false) 
    105104  { 
    106105    if ($as_array) 
     
    118117   * Collect errors from all linked objects which could have been used by this object 
    119118   * Each child class should instantiate this function with her linked objetcs, calling get_error(true) 
    120    *  
     119   * 
    121120   * @param bool $debug is false by default, if true debug messages can be added to 'normal' messages 
    122121   * @param string $prefix is a string appended to the debug message 
    123122   * @abstract 
    124123   * @access public 
    125    * @return void  
     124   * @return void 
    126125   */ 
    127126  function collect_errors($debug=false, $prefix = '') 
     
    134133        } 
    135134  } 
    136          
     135 
    137136        /** 
    138137         * Performs a query on the AdoDB database object 
    139          *  
     138         * 
    140139         * @param string $query sql query, parameters should be replaced with ? 
    141140         * @param array $values array containing the parameters (going in the ?), use it to avoid security problems. If 
     
    196195 
    197196        /** 
    198          * @see Base::query  
     197         * @see Base::query 
    199198         * @param string $query sql query, parameters should be replaced with ? 
    200199     * @param array $values array containing the parameters (going in the ?), use it to avoid security problems 
     
    224223                if (!$result && $reporterrors ) 
    225224                        $this->sql_error($query, $clean_values, $result); 
    226                 if (!!$result)  
     225                if (!!$result) 
    227226                { 
    228227                        $res = $result->fetchRow(); 
     
    241240        /** 
    242241         * Throws error warnings 
    243          *  
     242         * 
    244243         * @param string $query 
    245244         * @param array $values 
    246245         * @param mixed $result 
    247246         * @access public 
    248          * @return void  
     247         * @return void 
    249248         */ 
    250249        function sql_error($query, $values, $result) { 
     
    252251                // DO NOT DIE, if transactions are there, they will do things in a better way 
    253252        } 
    254          
     253 
    255254        /** 
    256255         * Clean the data before it is recorded on the database 
    257          *  
     256         * 
    258257         * @param $value is a data we want to be stored in the database. 
    259          * If it is an array we'll make a serialize and then an base64_encode  
     258         * If it is an array we'll make a serialize and then an base64_encode 
    260259         * (you'll have to make an unserialize(base64_decode()) 
    261260         * If it is not an array we make an htmlspecialchars() on it 
     
    292291        /** 
    293292         * Supports DB abstraction 
    294          *  
     293         * 
    295294         * @param string &$query 
    296          * @return void  
     295         * @return void 
    297296         * @access public 
    298297         */ 
     
    302301                case "oci8": 
    303302                        $query = preg_replace("/`/", "\"", $query); 
    304                         // convert bind variables - adodb does not do that  
     303                        // convert bind variables - adodb does not do that 
    305304                        $qe = explode("?", $query); 
    306305                        $query = ''; 
     
    318317        /** 
    319318         * Supports DB abstraction 
    320          *  
     319         * 
    321320         * @param string $sort_mode 
    322          * @return string  
     321         * @return string 
    323322         * @access public 
    324323         */ 
     
    330329        /** 
    331330         * Supports DB abstraction 
    332          *  
    333          * @return mixed  
     331         * 
     332         * @return mixed 
    334333         * @access public 
    335334         */ 
Note: See TracChangeset for help on using the changeset viewer.