HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
UActiveRecord.php
Go to the documentation of this file.
1 <?php
2 class UActiveRecord extends CActiveRecord
3 {
10  public function setAttributes($values, $safeOnly = true)
11  {
12  foreach ($this->widgetAttributes() as $fieldName => $className) {
13  if (isset($values[$fieldName]) && class_exists($className)) {
14  $class = new $className();
15  $arr = $this->widgetParams($fieldName);
16  if ($arr) {
17  $newParams = $class->params;
18  $arr = (array) CJavaScript::jsonDecode($arr);
19  foreach ($arr as $p => $v) {
20  if (isset($newParams[$p])) {
21  $newParams[$p] = $v;
22  }
23  }
24  $class->params = $newParams;
25  }
26  if (method_exists($class, 'setAttributes')) {
27  $values[$fieldName] = $class->setAttributes($values[$fieldName], $this, $fieldName);
28  }
29  }
30  }
31  parent::setAttributes($values, $safeOnly);
32  }
33 
34  public function behaviors()
35  {
36  return Yii::app()->getModule('user')->getBehaviorsFor(get_class($this));
37  }
38 }