HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
UActiveForm.php
Go to the documentation of this file.
1 <?php
5 class UActiveForm extends CActiveForm
6 {
8 
9  public function run()
10  {
11  if (is_array($this->focus)) {
12  $this->focus = "#".CHtml::activeId($this->focus[0], $this->focus[1]);
13  }
14 
15  echo CHtml::endForm();
16  $cs = Yii::app()->clientScript;
17  if (!$this->enableAjaxValidation && !$this->enableClientValidation || empty($this->attributes)) {
18  if ($this->focus !== null) {
19  $cs->registerCoreScript('jquery');
20  $cs->registerScript('CActiveForm#focus', "
21  if(!window.location.hash)
22  $('".$this->focus."').focus();
23  ");
24  }
25 
26  return;
27  }
28 
29  $options = $this->clientOptions;
30  if (isset($this->clientOptions['validationUrl']) && is_array($this->clientOptions['validationUrl'])) {
31  $options['validationUrl'] = CHtml::normalizeUrl($this->clientOptions['validationUrl']);
32  }
33 
34  $options['attributes'] = array();
35  foreach ($this->attributes as $attr => $item) {
36  if (in_array($attr, $this->disableAjaxValidationAttributes) === false) {
37  array_push($options['attributes'], $item);
38  }
39  }
40 
41  if ($this->summaryID !== null) {
42  $options['summaryID'] = $this->summaryID;
43  }
44 
45  if ($this->focus !== null) {
46  $options['focus'] = $this->focus;
47  }
48 
49  $options = CJavaScript::encode($options);
50  $cs->registerCoreScript('yiiactiveform');
51  $id = $this->id;
52  $cs->registerScript(__CLASS__.'#'.$id, "\$('#$id').yiiactiveform($options);");
53 
54  /*
55  parent::run();
56  $cs = Yii::app()->getClientScript();
57  $js = "// UActiveForm\n$('".'#'.implode(', #',$this->disableAjaxValidationAttributes)."').die('focusout','');";
58  //echo '<pre>'; print_r(); die();
59  $cs->registerScript(__CLASS__.'#dialog', $js);
60 
61  if(is_array($this->focus))
62  $this->focus="#".CHtml::activeId($this->focus[0],$this->focus[1]);
63 
64  echo CHtml::endForm();
65  $cs=Yii::app()->clientScript;
66  if(!$this->enableAjaxValidation && !$this->enableClientValidation || empty($this->attributes))
67  {
68  if($this->focus!==null)
69  {
70  $cs->registerCoreScript('jquery');
71  $cs->registerScript('CActiveForm#focus',"
72  if(!window.location.hash)
73  $('".$this->focus."').focus();
74  ");
75  }
76  return;
77  }
78 
79  $options=$this->clientOptions;
80  if(isset($this->clientOptions['validationUrl']) && is_array($this->clientOptions['validationUrl']))
81  $options['validationUrl']=CHtml::normalizeUrl($this->clientOptions['validationUrl']);
82 
83  $options['attributes']=array();
84  foreach ($this->attributes as $attr => $item) {
85  if (in_array($attr,$this->disableAjaxValidationAttributes)===false) {
86  array_push($options['attributes'],$item);
87  }
88  }
89 
90  if($this->summaryID!==null)
91  $options['summaryID']=$this->summaryID;
92 
93  if($this->focus!==null)
94  $options['focus']=$this->focus;
95 
96  $options=CJavaScript::encode($options);
97  $cs->registerCoreScript('yiiactiveform');
98  $id=$this->id;
99  $cs->registerScript(__CLASS__.'#'.$id,"\$('#$id').yiiactiveform($options);");
100  //*/
101  }
102 }