OphTrConsent_Leaflet::model PHP Method

model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : the
return the static model class
    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

Usage Example

 public function actionSearch()
 {
     if (Yii::app()->request->isAjaxRequest) {
         $criteria = new CDbCriteria();
         if (isset($_GET['term']) && strlen($term = $_GET['term']) > 0) {
             $criteria->addCondition(array('LOWER(name) LIKE :term'), 'OR');
             $params[':term'] = '%' . strtolower(strtr($term, array('%' => '\\%'))) . '%';
         }
         $criteria->order = 'name';
         $criteria->select = 'id, name';
         $criteria->params = $params;
         $results = OphTrConsent_Leaflet::model()->active()->findAll($criteria);
         $return = array();
         foreach ($results as $resultRow) {
             $return[] = array('label' => $resultRow->name, 'value' => $resultRow->name, 'id' => $resultRow->id);
         }
         echo CJSON::encode($return);
     }
 }
All Usage Examples Of OphTrConsent_Leaflet::model