public function _revert_more($type, $client, $pk, $json) { $data = json_decode($json); $table = JCckTableBatch::getInstance('#__cck_core_' . $type . '_field'); $table->delete($type . 'id = ' . $pk . ' AND client = "' . $client . '"'); $table->save($data->fields, array(), array(), array('markup' => '', 'restriction' => '', 'restriction_options' => '')); $table = JCckTableBatch::getInstance('#__cck_core_' . $type . '_position'); $table->delete($type . 'id = ' . $pk . ' AND client = "' . $client . '"'); $table->save($data->positions); }
public function postStore($pk) { $data = JRequest::get('post'); $client = $data['client']; if ($data['fromclient']) { if ($client == 'site') { $from = 'admin'; } elseif ($client == 'admin') { $from = 'site'; } elseif ($client == 'content') { $from = 'intro'; } elseif ($client == 'intro') { $from = 'content'; } $table = JCckTableBatch::getInstance('#__cck_core_type_field'); $table->load('typeid = ' . $pk . ' AND client = "' . $from . '"'); $table->check(array('client' => $client)); $table->store(); $table = JCckTableBatch::getInstance('#__cck_core_type_position'); $table->load('typeid = ' . $pk . ' AND client = "' . $from . '"'); $table->check(array('client' => $client)); $table->store(); } else { if (isset($data['li_end']) && $data['li_end'] == '1') { $this->storeMore($pk, $data['client'], $data['ff'], $data['ffp']); } } if (isset($data['quick_menuitem']) && $data['quick_menuitem']) { if (is_file(JPATH_SITE . '/libraries/joomla/database/table/menu.php')) { require_once JPATH_SITE . '/libraries/joomla/database/table/menu.php'; } $quick_item = explode('.', $data['quick_menuitem']); $item = JTable::getInstance('Menu'); $item->id = 0; $item->title = $data['title']; $item->menutype = $quick_item[0]; $item->parent_id = $quick_item[1]; $item->published = 1; $item->component_id = JCckDatabase::loadResult('SELECT extension_id FROM #__extensions WHERE type = "component" AND element = "com_cck"'); $item->link = 'index.php?option=com_cck&view=form&layout=edit&type=' . $data['name']; $item->params = '{}'; $item->type = 'component'; $item->client_id = 0; $item->home = 0; $item->language = '*'; $item->template_style_id = 0; $item->setLocation($quick_item[1], 'last-child'); $item->check(); $item->store(); } }