public function actionIndex()
 {
     $persons = new CRecordSet();
     if (array_key_exists("rated", $_GET)) {
         $rated = $_GET["rated"];
     } else {
         $rated = 1;
     }
     /*
     $roles = new CArrayList();
     if (array_key_exists("types", $_GET)) {
         if (is_array($_GET["types"])) {
             foreach ($_GET["types"] as $key=>$value) {
                 $types[$value] = $value;
                 $roles->add(CTaxonomyManager::getTypeById($value)->getId(), CTaxonomyManager::getTypeById($value));
             }
         } else {
             foreach (explode(";", $_GET["types"]) as $value) {
                 $types[$value] = $value;
                 $roles->add(CTaxonomyManager::getTypeById($value)->getId(), CTaxonomyManager::getTypeById($value));
             }
         }
     } else {
         foreach (CTaxonomyManager::getCacheTypes()->getItems() as $type) {
             $types[$type->getId()] = $type->getId();
             $roles->add($type->getId(), $type);
         }
     }
     foreach (CStaffManager::getPersonsWithTypes($roles)->getItems() as $person) {
         if ($rated == 1) {
             if ($person->getActiveOrders()->getCount() > 0) {
                 $persons->add($person->getId(), $person);
             }
         } else {
             $persons->add($person->getId(), $person);
         }
     }
     $this->setData("types", $types);
     $this->setData("types_url", implode(";", $types));
     $this->addJSInclude("_modules/_orders/filter.js");
     */
     foreach (CStaffManager::getAllPersons()->getItems() as $person) {
         if ($rated == 1) {
             if ($person->getActiveOrders()->getCount() > 0) {
                 $persons->add($person->getId(), $person);
             }
         } else {
             $persons->add($person->getId(), $person);
         }
     }
     $this->setData("rated", $rated);
     $this->setData("persons", $persons);
     $this->renderView("_orders/index.tpl");
 }
 /**
  * Уникальные по заданному ключу и условию записи из таблицы
  *
  * @param $table
  * @param $condition
  * @param $field
  * @return CRecordSet
  */
 public static function getDistinctWithCondition($table, $condition, $field)
 {
     $key = $table . "_" . $condition . "_distinct_" . $field;
     if (!self::getCache()->hasElement($key)) {
         $q = new CQuery();
         $res = new CRecordSet();
         $res->setManualAdd(true);
         $q->select("DISTINCT(" . $field . "), id")->from($table)->condition($condition . " GROUP BY " . $field);
         $r = $q->execute();
         foreach ($r->getItems() as $item) {
             $record = new CActiveRecord($item);
             $record->setTable($table);
             $distinct = self::getById($table, $record->getId());
             $res->add($res->getCount(), $distinct);
         }
         self::getCache()->add($key, $res);
     }
     return self::getCache()->getItem($key);
 }