public function actionSave()
 {
     $validator = new CCoreModelFieldValidator();
     $validator->setAttributes(CRequest::getArray($validator::getClassName()));
     if ($validator->validate()) {
         $validator->save();
         if ($this->continueEdit()) {
             $this->redirect("?action=edit&id=" . $validator->getId());
         } else {
             $this->redirect("fields.php?action=edit&id=" . $validator->field_id);
         }
         return true;
     }
     $this->setData("validator", $validator);
     $this->renderView("_core/fieldvalidator/edit.tpl");
 }
 public function save()
 {
     $model = CCoreObjectsManager::getCoreModel($this->id);
     foreach ($this->getItems()->getItems() as $item) {
         $field = new CCoreModelField();
         $field->model_id = $model->getId();
         $field->field_name = $item["name"];
         $field->save();
         if ($item["translation"] !== "") {
             $t = new CCoreModelFieldTranslation();
             $t->field_id = $field->getId();
             $t->value = $item["translation"];
             $t->save();
         }
         if ($item["validator"] !== "0") {
             $v = new CCoreModelFieldValidator();
             $v->field_id = $field->getId();
             $v->validator_id = $item["validator"];
             $v->save();
         }
     }
 }