function emitCompmenu() { global $database; $database = JFactory::getDBO(); // sanity check if ($this->hasErrors()) return; if (!array_key_exists('emitted', $this->params[1])) { // save new row $row = new facileFormsMenus($database); $database->setQuery("select max(ordering)+1 from #__facileforms_compmenus"); $row->ordering = $database->loadResult(); $row->published = $this->getInt(1, 'published', 1); $row->package = $this->getText(1, 'package'); $row->img = $this->getText(1, 'img'); $row->title = $this->getText(1, 'title', BFText::_('COM_BREEZINGFORMS_INSTALLER_UNKNOWN')); $row->name = $this->getText(1, 'name'); $row->page = $this->getInt(1, 'page', 1); $row->frame = $this->getInt(1, 'frame'); $row->border = $this->getInt(1, 'border'); $row->params = $this->getText(1, 'params'); if (!$row->store()) { $this->setError($row->getError(), true); return; } // if $this->menus[] = $row->id; if ($row->published) $this->pubmenus++; // final tasks $this->params[1]['menu_id'] = $row->id; $this->params[1]['submenu_ord'] = 0; $this->params[1]['emitted'] = true; } // if } // emitCompmenu
function copy($option, $pkg, $ids) { $database = JFactory::getDBO(); $total = count($ids); $row = new facileFormsMenus($database); $child = new facileFormsMenus($database); if (count($ids)) foreach ($ids as $id) { $row->load(intval($id)); $row->id = NULL; $row->ordering = 999999; $row->store(); $row->reorder('parent=0'); $database->setQuery("select id from #__facileforms_compmenus where parent=$id"); $cids = $database->loadObjectList(); for ($i = 0; $i < count($cids); $i++) { $cid = $cids[$i]; $child->load(intval($cid->id)); $child->id = NULL; $child->parent = $row->id; $child->store(); } // for } // foreach $msg = $total.' '.BFText::_('COM_BREEZINGFORMS_MENUS_SUCOPIED'); $result = updateComponentMenus(true); if($result != ''){ $msg = $result; } JFactory::getApplication()->redirect("index.php?option=$option&act=managemenus&pkg=$pkg&mosmsg=$msg"); } // copy