Location: PHPKode > projects > Blandware AtLeap Lite - CMS on PHP > atleaplite/include/dataobject/Attribute.php
<?php
/*
 *  Copyright 2008 Blandware (http://www.blandware.com)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

/**
 * Table Definition for attribute
 *
 * @package     AtleapLite
 * @author      Roman Puchkovskiy
 * @license     http://www.apache.org/licenses/LICENSE-2.0  Apache License, Version 2.0
 */

/**
 */
require_once 'dbdo_ext.php';

/**
 * Class representing commodity attribute; it has title and value.
 *
 * @package     AtleapLite
 */
class DataObjects_Attribute extends DB_DataObject_Base 
{
    ###START_AUTOCODE
    /* the code below is auto generated do not remove the above tag */

    var $__table = 'attribute';                       // table name
    var $id;                              // int(11)  not_null primary_key auto_increment
    var $title;                           // string(765)  not_null
    var $value;                           // string(765)  
    var $commodity_id;                    // int(11)  not_null multiple_key
    var $number;                          // int(11)  not_null

    /* ZE2 compatibility trick*/
    function __clone() { return $this;}

    /* Static get */
    function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('DataObjects_Attribute',$k,$v); }

    /* the code above is auto generated do not remove the tag below */
    ###END_AUTOCODE

    /**
     * Searches for titles of attributes which begin with a given prefix.
     *
     * @param string $prefix    the prefix
     * @return array array of titles
     */
    function getAttributeTitlesByPrefix($prefix) {
        $prefix = $this->escape($prefix);
        $this->whereAdd();
        $this->whereAdd($this->quoteIdentifier("title") . " LIKE '$prefix%'");
        $this->selectAdd();
        $this->selectAdd('distinct ' . $this->quoteIdentifier('title'));
        $this->orderBy();
        $this->orderBy($this->quoteIdentifier('title'));
        $this->limit(MAX_SUGGESTIONS);
        $values = $this->fetchAll();
        $result = array();
        foreach ($values as $a) {
            $result[] = $a->title;
        }
        return $result;
    }
}
Return current item: Blandware AtLeap Lite - CMS on PHP