コード例 #1
0
ファイル: validation_rule.php プロジェクト: LGBGit/tierno
 /**
  * Should the validation be run - based on whether new record or editing existing
  *
  * @return boolean
  */
 protected function shouldValidateOn()
 {
     $params = $this->getParams();
     $on = $params->get('validation_on', 'both');
     $rowId = $this->elementModel->getFormModel()->getRowId();
     if ($on === 'both') {
         return true;
     }
     if ($rowId === '' && $on === 'new') {
         return true;
     }
     if ($rowId !== '' && $on === 'edit') {
         return true;
     }
     return false;
 }
コード例 #2
0
 /**
  * Create hover tip text for validations
  *
  * @return  array  Messages
  */
 public function hoverTexts()
 {
     $texts = array();
     if ($this->elementModel->isEditable()) {
         $tmpl = $this->elementModel->getFormModel()->getTmpl();
         $validations = array_unique($this->findAll());
         foreach ($validations as $c => $validation) {
             $texts[] = $validation->getHoverText($c, $tmpl);
         }
         $internal = $this->elementModel->internalValidataionText();
         if ($internal !== '') {
             $i = $this->elementModel->internalValidationIcon();
             $icon = FabrikHelperHTML::image($i, 'form', $tmpl, $this->iconOpts);
             $texts[] = $icon . ' ' . $internal;
         }
     }
     return $texts;
 }