protected function up() { $content_com = fx::component('floxim.main.content'); fx::db()->query(array('insert into {{field}} ( `component_id` , `keyword` , `name_en` , `name_ru` , `type`) VALUES (%d, "type", "Type", "Тип", 1)', $content_com['id'])); fx::cache('meta')->flush(); }
public function process($data) { $com_content_id = fx::component('floxim.main.content')->get('id'); $res = array(); foreach ($this->getFields() as $f) { $type = $f['type']; $field_keyword = $f['keyword']; if (!in_array($type, array('string', 'text'))) { continue; } if ($f['component_id'] === $com_content_id) { continue; } if ($field_keyword === 'keyword') { continue; } $prop_tpl = $this[$field_keyword]; $tpl_obj = fx::template()->virtual($prop_tpl); $tpl_obj->isAdmin(false); $res[$field_keyword] = $tpl_obj->render($data); } return $res; }
public function getContentDumpTables($items) { $items = $items->group('type'); $tables = array(); foreach ($items as $com_keyword => $data) { $com = fx::component($com_keyword); $com_tables = $com->getAllTables(); foreach ($com_tables as $t) { if (!isset($tables[$t])) { $tables[$t] = array(); } $tables[$t] = array_merge($tables[$t], $data->getValues('id')); } } return $tables; }