public function update()
 {
     $table = $this->model->getRow($this->table);
     if (!$table) {
         throw new Kwf_ClientException("Table '{$this->table}' not found");
     }
     $field = $table->getChildRows('Fields', $this->model->select()->whereId('component_id'))->current();
     if (!$field) {
         throw new Kwf_ClientException("Field 'component_id' not found");
     }
     if ($field->key != 'PRI') {
         throw new Kwf_ClientException("Field 'component_id' is not the primary key");
     }
     if (!$this->model->getRow('kwc_data')) {
         Kwf_Registry::get('db')->query("CREATE TABLE IF NOT EXISTS `kwc_data` (\n                `component_id` varchar(255) collate utf8_unicode_ci NOT NULL,\n                `data` text collate utf8_unicode_ci NOT NULL,\n                PRIMARY KEY  (`component_id`)\n            ) ENGINE=InnoDB;");
     }
     $model = new Kwf_Component_FieldModel();
     $rows = Kwf_Registry::get('db')->fetchAssoc("SELECT * FROM {$this->table}");
     foreach ($rows as $row) {
         if ($model->getRow($row['component_id'])) {
             throw new Kwf_ClientException("entry with component_id '{$row['component_id']}' does already exist");
         }
     }
     foreach ($rows as $row) {
         $r = $model->createRow();
         foreach ($row as $k => $i) {
             $r->{$k} = $i;
         }
         $r->save();
     }
 }
 public function update()
 {
     $model = new Kwf_Component_FieldModel();
     $db = Kwf_Registry::get('db');
     foreach ($db->query("SELECT * FROM kwc_basic_flash")->fetchAll() as $row) {
         if ($row['flash_source_type'] != 'external_flash_url') {
             echo "\n\nACHTUNG FLASH mit upload konnte nicht konvertiert werden ({$row['component_id']})\n\n";
             continue;
         }
         $newRow = $model->getRow($row['component_id']);
         if (!$newRow) {
             $newRow = $model->createRow();
             $newRow->component_id = $row['component_id'];
         }
         $code = "<object width=\"{$row['width']}\" height=\"{$row['height']}\">\n";
         $url = $row['external_flash_url'];
         $vars = array();
         foreach ($db->query("SELECT * FROM kwc_basic_flash_vars WHERE parent_id='{$row['component_id']}'") as $v) {
             $vars[] = urlencode($v['key']) . '=' . urlencode($v['value']);
         }
         if ($vars) {
             $url .= "?" . implode('&', $vars);
         }
         $code .= "  <param name=\"movie\" value=\"" . htmlspecialchars($url) . "\">\n";
         $code .= "  <param name=\"allow_fullscreen\" value=\"{$row['allow_fullscreen']}\">\n";
         $code .= "  <param name=\"menu\" value=\"{$row['menu']}\">\n";
         $code .= "</object>\n";
         $newRow->code = $code;
         $newRow->save();
     }
     //und tschüss
     $db->query("DROP TABLE kwc_basic_flash");
     $db->query("DROP TABLE kwc_basic_flash_vars");
 }
示例#3
0
 protected function _init()
 {
     parent::_init();
     $this->setDefault(array('link_text' => trlKwf('Read more »')));
 }
示例#4
0
 protected function _init()
 {
     parent::_init();
     $this->_dependentModels['Values'] = new Kwf_Model_FieldRows(array('fieldName' => 'values'));
 }
示例#5
0
 protected function _init()
 {
     parent::_init();
     $this->_dependentModels['FlashVars'] = new Kwf_Model_FieldRows(array('fieldName' => 'flash_vars'));
 }
示例#6
0
 protected function _init()
 {
     parent::_init();
     $this->_dependentModels['Values'] = 'Kwc_Form_Field_MultiCheckbox_Trl_ValuesModel';
 }
示例#7
0
 protected function _init()
 {
     parent::_init();
     $this->setDefault(array('link_text' => '&raquo;'));
 }
 public function __construct($config = array())
 {
     $config['proxyModel'] = new Kwf_Model_FnF(array('columns' => array('component_id', 'data'), 'primaryKey' => 'component_id', 'data' => array(array('component_id' => 1900, 'data' => json_encode(array('image_position' => 'right'))))));
     parent::__construct($config);
 }