123456789101112131415161718192021 |
- <?php
- class content_update {
- var $model_id;
- var $fields;
- var $data;
- function __construct($model_id,$id) {
- $this->model_id = $model_id;
- $this->fields = json_decode(Yii::$app->cache->get(CacheId::modelFieldCacheId($model_id)),true);
- $this->id = $id;
- }
- function update($data) {
- $info = array();
- $this->data = $data;
- foreach($data as $field=>$value) {
- if(!isset($this->fields[$field])) continue;
- $func = $this->fields[$field]['form_type'];
- $info[$field] = method_exists($this, $func) ? $this->$func($field, $value) : $value;
- }
- }
- }?>
|