/** * Автоподстановка индексов */ public function actionGetIndexes() { $indexes = $_GET["data"]["term"]; $res = array(); $tmpRes = new CArrayList(); foreach (CActiveRecordProvider::getWithCondition(TABLE_PUBLICATIONS_TYPES, "name LIKE '%{$indexes}%'")->getItems() as $item) { $index = CBaseManager::getPublicationByTypes($item->getItemValue("id")); if (!is_null($index)) { $tmpRes->add($index->name, $index); } } foreach ($tmpRes->getItems() as $index) { $res[] = array("label" => $index->name, "value" => $index->name); } echo json_encode($res); }
public function actionDelete() { $type = CBaseManager::getPublicationByTypes(CRequest::getInt("id")); $type->remove(); $this->redirect("index.php?action=types"); }