HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
CBase64Behavior.php
Go to the documentation of this file.
1 <?php
27 {
31  public function beforeSave($event)
32  {
33  if (count($this->serialAttributes)) {
34  foreach ($this->serialAttributes as $attribute) {
35  $_att = $this->getOwner()->$attribute;
36  $this->getOwner()->$attribute = base64_encode($_att);
37  }
38  }
39  }
40 
44  public function afterSave($event)
45  {
46  if (count($this->serialAttributes)) {
47  foreach ($this->serialAttributes as $attribute) {
48  $_att = $this->getOwner()->$attribute;
49  if (!empty($_att)) {
50  $a = base64_decode($_att);
51  if ($a !== false) {
52  $this->getOwner()->$attribute = $a;
53  } else {
54  $this->getOwner()->$attribute = '';
55  }
56  }
57  }
58  }
59  }
60 
64  public function afterFind($event)
65  {
66  if (count($this->serialAttributes)) {
67  foreach ($this->serialAttributes as $attribute) {
68  $_att = $this->getOwner()->$attribute;
69  if (!empty($_att)) {
70  $a = base64_decode($_att);
71  if ($a !== false) {
72  $this->getOwner()->$attribute = $a;
73  } else {
74  $this->getOwner()->$attribute = '';
75  }
76  }
77  }
78  }
79  }
80 }