<?php
  $c = new Criteria();
  $lesson_array = myUtility::execSQL('select les_category from tbllesson group by les_category');
  $lessons = array();
  foreach ($lesson_array as $lesson_item) $lessons[] = intval($lesson_item[0]);

  $c = new Criteria();
  $c->add(TblcategoryPeer::CG_ID, $lessons, Criteria::IN);
  $c->addAscendingOrderByColumn(TblcategoryPeer::CG_NAME);
  $categories = TblcategoryPeer::doSelect($c);

  $guide = new Tblcategory();
  $guide->setCgId('');
  $guide->setCgName('-Chọn lớp-');
  array_unshift($categories, $guide);

  $filters = $sf_params->get('filters');
  echo select_tag('filters[les_category]', objects_for_select($categories, 'getCgId', 'getCgName', $filters['les_category']));
?>