Changeset 9241

Show
Ignore:
Timestamp:
08/13/08 20:51:48 (4 months ago)
Author:
afz
Message:

Add GetComponentByName? method to Jaws_Component

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/jaws/html/include/Jaws/Component.php

    r9240 r9241  
    101101    } 
    102102 
     103    /** 
     104     * Get the info of a component 
     105     * 
     106     * @access  public 
     107     * @param   string  $comp_name  Component's name 
     108     * @return  mixed   Returns an array with the info of the component and false on error 
     109     */ 
     110    function GetComponentByName($comp_name) 
     111    { 
     112        $params = array(); 
     113        $params['comp_name'] = $comp_name; 
     114 
     115        $sql = ' 
     116            SELECT 
     117                [id], [comp_name], [enabled] 
     118            FROM [[components]] 
     119            WHERE [comp_name] = {comp_name}'; 
     120 
     121        $result = $GLOBALS['db']->query($sql, $params); 
     122        if (Jaws_Error::IsError($result) || !isset($result['id'])) { 
     123            return false; 
     124        } 
     125 
     126        return $result; 
     127    } 
     128 
    103129}