nyroFwk  0.2
row.class.php
Go to the documentation of this file.
1 <?php
10 class db_row extends object implements ArrayAccess {
11 
17  protected $changes = array();
18 
24  protected $new = true;
25 
31  protected $table;
32 
38  protected $linked = array();
39 
45  protected $related = array();
46 
52  protected $i18nRows = array();
53 
54  protected function afterInit() {
55  $defaultClass = 'db_row_'.$this->cfg->table->getName();
56  if (get_class($this) != $defaultClass)
57  $this->cfg->overload($defaultClass);
58 
59  $this->table = $this->cfg->table;
60 
61  if (!empty($this->cfg->data)) {
62  $this->loadData($this->cfg->data);
63  } else if (!empty($this->cfg->findId)) {
64  $tmp = $this->getTable()->find($this->cfg->findId);
65  if ($tmp) {
66  $this->cfg->data = $tmp->getValues('data');
67  $this->setNew(false);
68  }
69  unset($tmp);
70  }
71  }
72 
78  public function loadData(array $data) {
79  $this->cfg->data = $data;
80  if (array_key_exists($this->getTable()->getIdent(), $data) && $data[$this->getTable()->getIdent()])
81  $this->setNew(false);
82  else {
83  $primary = $this->getTable()->getPrimary();
84  $p = 0;
85  foreach($primary as $pp) {
86  if (array_key_exists($pp, $data) && $data[$pp])
87  $p++;
88  }
89  if ($p == count($primary))
90  $this->setNew(false);
91  }
92 
93  $linkedKey = db::getCfg('linked');
94  if (array_key_exists($linkedKey, $data)) {
95  $this->setLinked($data[$linkedKey]);
96  }
97 
98  $relatedKey = db::getCfg('related');
99  if (array_key_exists($relatedKey, $data)) {
100  $this->setRelated($data[$relatedKey]);
101  }
102  }
103 
109  public function reload($force = true) {
110  if (!$this->isNew() && $this->getId() && ($force || $this->cfg->needReload)) {
111  $this->loadData($this->getTable()->find($this->getId())->getValues());
112  $this->cfg->needReload = false;
113  }
114  }
115 
121  public function getDb() {
122  return $this->cfg->db;
123  }
124 
130  public function getTable() {
131  return $this->table;
132  }
133 
140  public function getWhere(array $prm = array()) {
141  return $this->getDb()->getWhere($prm);
142  }
143 
152  public function getForm($showFields = null, array $formParam = array(), $passConfirm = true) {
153  $form = factory::get('form_db', array_merge($formParam, array(
154  'table'=>$this->getTable()
155  )));
156  /* @var $form form_db */
157  foreach($this->getTable()->getField() as $f) {
158  if ($f['name'] != $this->getTable()->getIdent() && !$f['auto'] &&
159  (empty($showFields) || in_array($f['name'], $showFields))) {
160  $f['label'] = $this->getTable()->getLabel($f['name']);
161  $f['link'] = $this->getTable()->getLinked($f['name']);
162  $f['value'] = $this->get($f['name']);
163  $obj = $form->addFromField($f);
164  if ($passConfirm && $obj instanceof form_password) {
165  $name = $f['name'];
166  $f['name'].= 'Confirm';
167  $f['label'] = $this->getTable()->getLabel($f['name']);
168  $moreConf = $this->getTable()->getCfg()->getInArray('fields', $f['name']);
169  if (is_array($moreConf) && array_key_exists('comment', $moreConf)) {
170  factory::mergeCfg($f, $moreConf);
171  }
172  $form->addFromField($f)->addRule('equal', $obj);
173  $form->addNotValue($f['name']);
174  if (!$this->isNew()) {
175  // remove the required validation for the 2 password fields but keep the equal
176  $form->get($name)->getValid()->delRule('required');
177  $form->get($f['name'])->getValid()->delRule('required');
178  }
179  if (!empty($showFields) && !in_array($f['name'], $showFields)) {
180  $key = array_search($name, $showFields);
181  array_splice($showFields, $key+1, 0, array($f['name']));
182  }
183  }
184  }
185  }
186 
187  $relatedUpdated = false;
188  $related = $this->cfg->getInArray('data', 'related');
189  foreach($this->getTable()->getRelated() as $t=>$r) {
190  if (empty($showFields) || in_array($r['tableLink'], $showFields)) {
191  $r['name'] = $r['tableLink'];
192  $r['label'] = $this->getTable()->getLabel($r['table']);
193  $r['valid'] = false;
194  $form->addFromRelated($r);
195 
196  if (!$this->getTable()->getCfg()->autoJoin) {
197  $relatedUpdated = true;
198  $tmp = $this->getRelated($t);
199  $related[$r['table']] = $tmp;
200  }
201  }
202  }
203 
204  if ($relatedUpdated)
205  $this->cfg->setInArray('data', 'related', $related);
206 
207  $form->setValues($this->getValues('flat'));
208 
209  $i18nFields = $this->getTable()->getI18nFields();
210  $i18nFieldsT = array();
211 
212  foreach($i18nFields as $f) {
213  if ((empty($showFields) || in_array(db::getCfg('i18n').$f['name'], $showFields))) {
214  $i18nFieldsT[] = $f['name'];
215  $f['label'] = $this->getTable()->getI18nTable()->getLabel($f['name']);
216  $form->addFromField($f, true);
217  }
218  }
219 
220  $form->finalize();
221 
222  if ($i18nRows = $this->getI18nRows()) {
223  $tmp = array();
224  $primary = $this->getTable()->getI18nTable()->getPrimary();
225  foreach($i18nRows as $r) {
226  $lang = $r->get($primary[1]);
227  foreach($r->getValues() as $k=>$v) {
228  $tmp[db::getCfg('i18n').'['.$lang.']['.$k.']'] = $v;
229  }
230  }
231  $form->setValues($tmp);
232  }
233  $form->setBound(false);
234  if (is_array($showFields) && !empty($showFields))
235  $form->reOrder($showFields);
236 
237  return $form;
238  }
239 
245  public function isNew() {
246  return $this->new;
247  }
248 
254  public function setNew($new) {
255  $this->new = (bool) $new;
256  }
257 
263  public function insert() {
264  $values = array_intersect_key(array_merge($this->getValues('flat'), $this->getChangesTable()), $this->getTable()->getField());
265  unset($values[$this->getTable()->getIdent()]);
266  $id = $this->getTable()->insert($values);
267  $this->set($this->getTable()->getIdent(), $id);
268  $this->setNew(false);
269  $this->saveRelated();
270  $this->saveI18n();
271  $this->getTable()->clearCache();
272  return $id;
273  }
274 
280  public function save() {
281  if ($this->isNew())
282  return $this->insert();
283 
284  if (!$this->hasChange())
285  return true;
286 
287  if ($changesTable = $this->getChangesTable())
288  $this->getTable()->update($changesTable, $this->whereClause());
289 
290  $this->saveRelated();
291  $this->saveI18n();
292  $this->getTable()->clearCache();
293 
294  return true;
295  }
296 
302  public function saveRelated() {
303  if ($this->isNew())
304  throw new nException('db_row::saveRelated: try to save related for a new row');
305 
306  $changes = $this->getChangesOther();
307  foreach($this->getTable()->getRelated() as $r) {
308  if (array_key_exists($r['tableLink'], $changes)) {
309  $values = array(
310  $r['fk1']['name'] => $this->getId()
311  );
312  $r['tableObj']->delete($values);
313  $hasFields = isset($r['fields']) && count($r['fields']);
314  if (($tmp = $changes[$r['tableLink']]) && is_array($tmp)) {
315  foreach($tmp as $t) {
316  $curValues = $values;
317  if ($hasFields) {
318  foreach($t as $k=>$v) {
319  if ($k == db::getCfg('relatedValue'))
320  $curValues[$r['fk2']['name']] = $v;
321  else
322  $curValues[$k] = $v;
323  }
324  } else
325  $curValues = array_merge($values, array($r['fk2']['name'] => $t));
326  $r['tableObj']->insert($curValues);
327  }
328  }
329  }
330  }
331  }
332 
338  public function saveI18n() {
339  if ($this->isNew())
340  throw new nException('db_row::saveI18n: try to save i18n for a new row');
341 
342  if (!empty($this->i18nRows)) {
343  list($fkId, $lang) = ($this->getTable()->getI18nTable()->getPrimary());
344  foreach($this->i18nRows as $r) {
345  if ($r->isNew())
346  $r->set($fkId, $this->getId());
347  $r->save();
348  }
349  }
350  }
351 
357  public function delete() {
358  foreach($this->getTable()->getRelated() as $related) {
359  $related['tableObj']->delete(array(
360  $related['fk1']['name']=>$this->getId()
361  ));
362  }
363  $nb = $this->getTable()->delete($this->whereClause());
364  return ($nb > 0);
365  }
366 
372  public function getId() {
373  return $this->get($this->getTable()->getIdent());
374  }
375 
379  public function clear() {
380  $this->changes = array();
381  }
382 
388  public function keyExists($key) {
389  return in_array($key, $this->getTable()->getCols());
390  }
391 
399  public function get($key, $mode = 'flat') {
400  if (db::isI18nName($key))
401  return $this->getI18n(db::unI18nName($key), $mode);
402 
403  if ($this->keyExists($key)) {
404  if ($mode == 'flat' && $this->hasChange($key))
405  $val = $this->changes[$key];
406  else
407  $val = $this->cfg->getInArray('data', $key);
408  return $this->getTable()->getField($key, 'htmlOut') ? utils::htmlOut($val) : $val;
409  } else if ($val = $this->cfg->getInArray('data', $key)) {
410  return $val;
411  } else if ($this->getTable()->isRelated($key)) {
412  $key = $this->getTable()->getRelatedTableName($key);
413  $values = $this->getValues($mode);
414  if (isset($values[$key]))
415  return $values[$key];
416 
417  if (!$this->getTable()->getCfg()->autoJoin && ($mode == 'flat' || $mode == 'flatReal')) {
418  $tmp = $this->getRelated($key);
419  if (count($tmp)) {
420  $v = $this->getTable()->getRelated($key);
421  $ret = array();
422  $fields = explode(',', $v['fk2']['link']['fields']);
423  $i18nFields = explode(',', $v['fk2']['link']['i18nFields']);
424  array_walk($i18nFields, create_function('&$v', '$v = "'.db::getCfg('i18n').'".$v;'));
425  $fields = array_filter(array_merge($fields, $i18nFields));
426 
427  $hasFields = isset($v['fields']) && count($v['fields']);
428 
429  foreach($tmp as $vv) {
430  if ($mode == 'flat') {
431  if ($hasFields) {
432  $curVal = array(
433  db::getCfg('relatedValue')=>$vv->get($v['fk2']['link']['ident'])
434  );
435  foreach($v['fields'] as $kF=>$vF) {
436  $curVal[$kF] = $vv->get($kF);
437  }
438  $ret[] = $curVal;
439  } else {
440  $ret[] = $vv->get($v['fk2']['link']['ident']);
441  }
442  } else {
443  $tmp2 = array();
444  foreach($fields as $f) {
445  if ($vv->get($f))
446  $tmp2[] = $vv->get($f);
447  }
448  $ret[] = utils::htmlOut(implode($v['fk2']['link']['sep'], $tmp2));
449  }
450  }
451  if (count($ret))
452  return $ret;
453  }
454  }
455  }
456  return null;
457  }
458 
466  public function getI18n($key, $mode='flat', $lang=null) {
467  return $this->getI18nRow($lang)->get($key, $mode);
468  }
469 
476  public function getI18nRow($lang = null) {
477  if (is_null($lang) || !$lang)
478  $lang = request::get('lang');
479  if (!array_key_exists($lang, $this->i18nRows)) {
480  if ($this->getTable()->getCfg()->i18nGetDefaultLangIfNotExist && $lang != request::getDefaultLang())
481  return $this->getI18nRow(request::getDefaultLang());
482  $primary = $this->getTable()->getI18nTable()->getPrimary();
483  $this->i18nRows[$lang] = $this->getTable()->getI18nTable()->getRow();
484  $this->i18nRows[$lang]->setValues(array(
485  $primary[0]=>$this->getId(),
486  $primary[1]=>$lang
487  ));
488  }
489  return $this->i18nRows[$lang];
490  }
491 
497  public function getI18nRows() {
498  return $this->i18nRows;
499  }
500 
507  public function getValues($mode = 'data') {
508  switch ($mode) {
509  case 'flat':
510  case 'flatNoRelated':
511  $data = array_merge($this->cfg->data, $this->getChanges());
512  $tmp = $this->getTable()->getCols();
513 
514  if ($mode == 'flat') {
515  $linked = $this->getTable()->getLinked();
516  if (is_array($linked)) {
517  foreach($linked as $k=>$v) {
518  $tmp[] = $k;
519  if (array_key_exists($key = $k.'_'.$v['ident'], $data))
520  $data[$k] = $data[$k.'_'.$v['ident']];
521  }
522  }
523  if (array_key_exists('related', $data)) {
524  foreach($this->getTable()->getRelated() as $k=>$v) {
525  $tmp[] = $k;
526  $data[$k] = array();
527  $hasFields = isset($v['fields']) && count($v['fields']);
528  foreach($data['related'][$v['fk2']['link']['table']] as $vv) {
529  if ($hasFields) {
530  $curVal = array(
531  db::getCfg('relatedValue')=>$vv[$v['fk2']['link']['ident']]
532  );
533  foreach($v['fields'] as $kF=>$vF) {
534  $curVal[$kF] = $vv[$kF];
535  }
536  $data[$k][] = $curVal;
537  } else {
538  $data[$k][] = $vv[$v['fk2']['link']['ident']];
539  }
540  }
541  }
542  }
543  }
544  return array_intersect_key($data, array_flip($tmp));
545  break;
546  case 'flatReal':
547  case 'flatRealNoRelated':
548  $data = array_merge($this->cfg->data, $this->getChanges());
549  $tmp = $this->getTable()->getCols();
550 
551  if ($mode == 'flatReal' && array_key_exists('related', $data)) {
552  foreach($this->getTable()->getRelated() as $k=>$v) {
553  $tmp[] = $k;
554  $data[$k] = array();
555  $fields = explode(',', $v['fk2']['link']['fields']);
556  $i18nFields = explode(',', $v['fk2']['link']['i18nFields']);
557  array_walk($fields, create_function('&$v', '$v = "'.$v['fk2']['link']['table'].'_".$v;'));
558  array_walk($i18nFields, create_function('&$v', '$v = "'.$v['fk2']['link']['table'].'_'.db::getCfg('i18n').'".$v;'));
559  $fields = array_merge($fields, $i18nFields);
560  foreach($data['related'][$v['fk2']['link']['table']] as $vv) {
561  $tmp2 = array();
562  foreach($fields as $f)
563  if (array_key_exists($f, $vv))
564  $tmp2[] = $vv[$f];
565  $data[$k][] = implode($v['fk2']['link']['sep'], $tmp2);
566  }
567  $data[$k] = utils::htmlOut($data[$k]);
568  }
569  }
570 
571  return array_intersect_key($data, array_flip($tmp));
572  break;
573  case 'data':
574  default:
575  return $this->cfg->data;
576  break;
577  }
578  }
579 
588  public function getInValues($name = null, $mode = 'flatReal') {
589  $tmp = $this->getValues($mode);
590  if(array_key_exists($name, $tmp))
591  return $tmp[$name];
592  return null;
593  }
594 
603  public function set($key, $value, $force = false) {
604  if ($key == db::getCfg('i18n'))
605  return $this->setI18n($value, $force);
606 
607  $field = $this->getTable()->getField($key);
608  $fct = null;
609 
610  if (isset($field['comment']) && is_array($field['comment'])) {
611  foreach($field['comment'] as $k=>$v) {
612  if (!is_array($v) && strpos($v, 'fct:') === 0) {
613  $fct = substr($v, 4);
614  break;
615  }
616  }
617  }
618  if (!is_null($fct) && function_exists($fct))
619  $value = $fct($value);
620  if ($force || $this->get($key) != $value)
621  $this->changes[$key] = $value;
622  }
623 
631  public function setI18n(array $values, $force = false, $lg = null) {
632  if (!is_null($lg) && $lg) {
633  if (count($values))
634  $this->getI18nRow($lg)->setValues($values, $force);
635  } else {
636  foreach($values as $lg=>$val)
637  $this->setI18n($val, $force, $lg);
638  }
639  }
640 
647  public function setValues(array $values, $force = false) {
648  foreach($values as $k=>$v)
649  $this->set($k, $v, $force);
650  }
651 
658  public function getChanges($name = null) {
659  if (is_null($name))
660  return $this->changes;
661 
662  if ($this->hasChange($name))
663  return $this->changes[$name];
664  return null;
665  }
666 
672  public function getChangesTable() {
673  return array_intersect_key($this->getChanges(), $this->getTable()->getField());
674  }
675 
681  public function getChangesOther() {
682  return array_diff_key($this->getChanges(), array_merge($this->getTable()->getField(), array(db::getCfg('i18n')=>true)));
683  }
684 
690  public function getChangesI18n() {
691  $tmp = $this->getChanges();
692  if (array_key_exists(db::getCfg('i18n'), $tmp))
693  return $tmp[db::getCfg('i18n')];
694  return array();
695  }
696 
703  public function hasChange($name = null) {
704  if (is_null($name))
705  return !empty($this->changes) || $this->hasChange(db::getCfg('i18n'));
706  else if ($name == db::getCfg('i18n')) {
707  $hasChange = false;
708  foreach($this->i18nRows as $r)
709  $hasChange = $hasChange || $r->hasChange();
710  return $hasChange;
711  }
712  return array_key_exists($name, $this->changes);
713  }
714 
722  public function getLinked($field = null, $reload = false) {
723  if ($this->getTable()->isLinked($field)) {
724  if (!array_key_exists($field, $this->linked)) {
725  $data = array();
726  if ($val = $this->get($field, 'flatReal')) {
727  $tmp = $this->getTable()->getLinked($field);
728  $data[$tmp['ident']] = $val;
729  } else if ($val = $this->get($field, 'flat')) {
730  $tmp = $this->getTable()->getLinked($field);
731  $data[$tmp['ident']] = $val;
732  }
733  $this->linked[$field] = $this->getTable()->getLinkedTableRow($field, $data);
734  }
735  if ($reload && array_key_exists($field, $this->linked) && !is_null($this->linked[$field]))
736  $this->linked[$field]->reload(false);
737  return $this->linked[$field];
738  }
739  return null;
740  }
741 
748  public function setLinked($linked, $field = null) {
749  if (!is_null($field)) {
750  if ($this->getTable()->isLinked($field)) {
751  if ($linked instanceof db_row)
752  $this->linked[$field] = $linked;
753  else
754  $this->linked[$field] = $this->getTable()->getLinkedTableRow($field, $linked);
755  }
756  } else {
757  foreach($linked as $f=>$v)
758  $this->setLinked($v, $f);
759  }
760  }
761 
768  public function getRelated($name) {
769  $related = $this->getTable()->getRelated($this->getTable()->getRelatedTableName($name));
770  $id = $this->getId();
771  if (!$id)
772  return array();
773  return $related['tableObj']->getLinkedTable($related['fk2']['name'])->select(array(
774  'where'=>$this->getWhere(array(
775  'clauses'=>factory::get('db_whereClause', array(
776  'name'=>$related['fk2']['link']['table'].'.'.$related['fk2']['link']['ident'],
777  'in'=>$this->getDb()->selectQuery(array(
778  'fields'=>$related['fk2']['name'],
779  'table'=>$related['tableLink'],
780  'where'=>$related['fk1']['name'].'='.$id
781  ))
782  ))
783  ))
784  ));
785  }
786 
793  public function setRelated($related, $name = null) {
794  if (!is_null($name)) {
795  if ($this->getTable()->getI18nTable() && $name == $this->getTable()->getI18nTable()->getName()) {
796  $primary = $this->getTable()->getI18nTable()->getPrimary();
797  foreach($related as $r) {
798  $this->i18nRows[$r[$primary[1]]] = $this->getTable()->getI18nTable()->getRow(
799  array_merge($r, array($primary[0]=>$this->getId())));
800  }
801  } else {
802  $name = $this->getTable()->getRelatedTableName($name);
803  if ($this->getTable()->isRelated($name)) {
804  if (!array_key_exists($name, $this->related))
805  $this->related[$name] = array();
806 
807  if ($related instanceof db_row)
808  $this->related[$name][] = $related;
809  else {
810  foreach($related as $v) {
811  if ($v instanceof db_row)
812  $this->related[$name][] = $v;
813  else
814  $this->related[$name][] = $this->getTable()->getRelatedTableRow($name, $v);
815  }
816  }
817  }
818  }
819  } else {
820  foreach($related as $t=>$v)
821  $this->setRelated($v, $t);
822  }
823  }
824 
830  public function whereClause() {
831  $primary = $this->getTable()->getPrimary();
832  $values = $this->getValues('flat');
833  $where = array();
834  foreach($primary as $p) {
835  $where[] = $this->getTable()->getRawName().'.'.$p.='="'.$values[$p].'"';
836  }
837  return implode(' AND ', $where);
838  }
839 
850  public function getAround(array $prm = array()) {
851  config::initTab($prm, array(
852  'field'=>null,
853  'returnId'=>false,
854  'where'=>null,
855  'asRow'=>false
856  ));
857 
858  if ($prm['asRow'])
859  $prm['returnId'] = true;
860 
861  $field = $prm['field'];
862  $where = $this->getDb()->makeWhere($prm['where']);
863  if (empty($where))
864  $where = 'WHERE 1';
865 
866  if (!is_null($where))
867  $where.= ' AND ';
868  if (is_null($field))
869  $field = $this->getTable()->getIdent();
870  $val = $this->get($field);
871 
872  $query = '(SELECT '.$field.','.$this->getTable()->getIdent().' FROM '.$this->getTable()->getRawName().' '.$where.$field.' < ? ORDER BY '.$field.' DESC LIMIT 1)
873  UNION
874  (SELECT '.$field.','.$this->getTable()->getIdent().' FROM '.$this->getTable()->getRawName().' '.$where.$field.' > ? ORDER BY '.$field.' ASC LIMIT 1)';
875  $vals = $this->getDb()->query($query, utils::htmlDeOut(array($val, $val)))->fetchAll(PDO::FETCH_NUM);
876  $ret = array(null, null);
877  $useIndex = $prm['returnId'] ? 1 : 0;
878  if (array_key_exists(1, $vals)) {
879  $ret[0] = $vals[0][$useIndex];
880  $ret[1] = $vals[1][$useIndex];
881  } else if (array_key_exists(0, $vals)) {
882  $tmp = $vals[0][0];
883  if ($tmp > $val)
884  $ret[1] = $vals[0][$useIndex];
885  else
886  $ret[0] = $vals[0][$useIndex];
887  }
888  if ($prm['asRow']) {
889  if ($ret[0])
890  $ret[0] = $this->getTable()->find($ret[0]);
891  if ($ret[1])
892  $ret[1] = $this->getTable()->find($ret[1]);
893  }
894  return $ret;
895  }
896 
897  public function __call($name, $prm) {
898  if (strpos($name, 'get') === 0 || strpos($name, 'set') === 0) {
899  $tblName = strtolower(substr($name, 3, 1)).substr($name, 4);
900  $found = false;
901  $linked = $this->getTable()->getLinked();
902  if (is_array($linked)) {
903  foreach(array_keys($linked) as $v) {
904  if (strpos($v, $tblName.'_') === 0) {
905  $name = $v;
906  $found = true;
907  break;
908  }
909  }
910  }
911  if (!$found) {
912  $tblName = $this->getTable()->getName().'_'.substr($tblName, 0, -1);
913  $related = $this->getTable()->getRelated();
914  if (is_array($related)) {
915  foreach(array_keys($related) as $v) {
916  if ($v == $tblName) {
917  $name = $v;
918  $found = true;
919  break;
920  }
921  }
922  }
923  }
924  }
925  if ($this->getTable()->isLinked($name)) {
926  if (empty($prm) || is_bool($prm[0])) {
927  return $this->getLinked($name, isset($prm[0]) ? $prm[0] : false);
928  } else {
929  return $this->setLinked($prm[0], $name);
930  }
931  } else if ($this->getTable()->isRelated($name)) {
932  if (empty($prm)) {
933  return $this->getRelated($name);
934  } else {
935  return $this->setRelated($prm[0], $name);
936  }
937  }
938  }
939 
947  public function offsetExists($offset) {
948  return !is_null($this->getTable()->getField($offset));
949  }
950 
958  public function offsetGet($offset) {
959  return $this->get($offset);
960  }
961 
969  public function offsetSet($offset, $value) {
970  $this->set($offset, $value);
971  }
972 
979  public function offsetUnset($offset) {
980  $this->set($offset, null);
981  }
982 
983  public function __get($name) {
984  return $this->get($name);
985  }
986 
987  public function __set($name, $val) {
988  return $this->set($name, $val);
989  }
990 
991  public function __toString() {
992  return $this->getTable()->getName().'-'.$this->getId();
993  }
994 
995 }
static get($get=null)
static htmlOut($val, $key=false)
static htmlDeOut($val, $key=false)
getWhere(array $prm=array())
Definition: row.class.php:140
saveI18n()
Definition: row.class.php:338
getI18nRows()
Definition: row.class.php:497
offsetUnset($offset)
Definition: row.class.php:979
getChanges($name=null)
Definition: row.class.php:658
getValues($mode='data')
Definition: row.class.php:507
whereClause()
Definition: row.class.php:830
getForm($showFields=null, array $formParam=array(), $passConfirm=true)
Definition: row.class.php:152
getTable()
Definition: row.class.php:130
getChangesOther()
Definition: row.class.php:681
getChangesTable()
Definition: row.class.php:672
getI18nRow($lang=null)
Definition: row.class.php:476
getInValues($name=null, $mode='flatReal')
Definition: row.class.php:588
static getDefaultLang()
static initTab(array &$vars, array $init)
setLinked($linked, $field=null)
Definition: row.class.php:748
setValues(array $values, $force=false)
Definition: row.class.php:647
insert()
Definition: row.class.php:263
getLinked($field=null, $reload=false)
Definition: row.class.php:722
setRelated($related, $name=null)
Definition: row.class.php:793
__toString()
Definition: row.class.php:991
offsetExists($offset)
Definition: row.class.php:947
static getCfg($key)
Definition: db.class.php:125
saveRelated()
Definition: row.class.php:302
getI18n($key, $mode='flat', $lang=null)
Definition: row.class.php:466
afterInit()
Definition: row.class.php:54
static unI18nName($field)
Definition: db.class.php:145
offsetSet($offset, $value)
Definition: row.class.php:969
static isI18nName($field)
Definition: db.class.php:135
__call($name, $prm)
Definition: row.class.php:897
reload($force=true)
Definition: row.class.php:109
hasChange($name=null)
Definition: row.class.php:703
getChangesI18n()
Definition: row.class.php:690
static mergeCfg(array &$prm, array $cfg)
loadData(array $data)
Definition: row.class.php:78
__get($name)
Definition: row.class.php:983
offsetGet($offset)
Definition: row.class.php:958
getAround(array $prm=array())
Definition: row.class.php:850
getRelated($name)
Definition: row.class.php:768
setNew($new)
Definition: row.class.php:254
__set($name, $val)
Definition: row.class.php:987
keyExists($key)
Definition: row.class.php:388
$f
Definition: list.php:6
static get($className, array $cfg=array())
setI18n(array $values, $force=false, $lg=null)
Definition: row.class.php:631
Generated on Sun Oct 15 2017 22:25:20 for nyroFwk by doxygen 1.8.13