protected function validate(\ICanBoogie\Errors $errors)
 {
     $id = $this->request['id'];
     if ($id) {
         if (!$this->model->exists($id)) {
             $errors['id'] = "The record does not exists.";
         }
     }
     return $errors->count() == 0;
 }
 protected function validate(Errors $errors)
 {
     global $core;
     if ($core->user_id) {
         $result = $core->models['forms.blueprints/results']->filter_by_nid_and_uid($this->record->nid, $core->user_id)->one;
         if ($result) {
             $errors[] = "Vous avez déjà participé à cette enquête.";
         }
     }
     return !$errors->count();
 }
Beispiel #3
0
 protected function validate(Errors $errors)
 {
     $request = $this->request;
     if (!$this->key) {
         $errors['editor_id'] = new FormattedString('The %property is required.', array('property' => 'editor_id'));
     }
     if (empty($request['selector_name'])) {
         $errors['selector_name'] = new FormattedString('The %property is required.', array('property' => 'selector_name'));
     }
     if (empty($request['contents_name'])) {
         $errors['contents_name'] = new FormattedString('The %property is required.', array('property' => 'contents_name'));
     }
     return !$errors->count();
 }
Beispiel #4
0
 protected function validate(\ICanboogie\Errors $errors)
 {
     $order = $this->request['order'];
     $relation = $this->request['relation'];
     if ($order && $relation) {
         foreach ($order as $nid) {
             if (!isset($relation[$nid])) {
                 $errors['relation'] = $errors->format("Missing relation for nid %nid.", array('nid' => $nid));
             }
         }
     } else {
         if (!$order) {
             $errors['order'] = $errors->format("The %param param is required", array('param' => 'order'));
         }
         if (!$relation) {
             $errors['relation'] = $errors->format("The %param param is required", array('param' => 'relation'));
         }
     }
     return !$errors->count();
 }