function addNewColumnToManagedTable() { $table = $this->getManagedTable(); // TODO: optimalizalni, hogy a getCustomColumnIndexes ne csinaljon annyi query-t minden esetben, // ha tobbszor meghivjak (common field letrehozasanal): if ($this->type != customfield_separator && !$this->isFixField() && !in_array($this->columnIndex, CustomField::getCustomColumnIndexes($this->getManagedTable()))) { if (empty($this->userField)) { executeQuery("ALTER TABLE @{$table} ADD {$this->columnIndex} TEXT NOT NULL;"); } if ($table == "item" && !in_array($this->columnIndex, CustomField::getCustomColumnIndexes("search"))) { executeQuery("ALTER TABLE @search ADD {$this->columnIndex} TEXT NOT NULL;"); $this->updateDefaultOfSelectionTypeFieldOfCustomList(); } return TRUE; } return FALSE; }
function addCustomColumns() { executeQuery("ALTER TABLE @search \n ADD `listTitle` varchar(255) NOT NULL default '',\n ADD `listDescription` TEXT NOT NULL,\n ADD `iid` int(11) NOT NULL,\n ADD `creationtime` datetime NOT NULL,\n ADD `creationtime_from` datetime NOT NULL,\n ADD `creationtime_to` datetime NOT NULL,\n ADD `status` int(11) NOT NULL default '-1',\n ADD `clicked` varchar(255) NOT NULL default '',\n ADD `responded` varchar(255) NOT NULL default '',\n ADD `title` varchar(255) NOT NULL default '',\n ADD `description` varchar(255) NOT NULL default '',\n ADD `ownerName` TEXT NOT NULL,\n ADD `expirationTime` datetime NOT NULL,\n ADD `expirationTime_from` datetime NOT NULL,\n ADD `expirationTime_to` datetime NOT NULL,\n ADD `primarySort` int(11) NOT NULL,\n ADD `primaryDir` varchar(4) NOT NULL default 'ASC',\n ADD `primaryPersistent` int(11) NOT NULL,\n ADD `secondarySort` int(11) NOT NULL,\n ADD `secondaryDir` varchar(4) NOT NULL default 'ASC',\n ADD `secondaryPersistent` int(11) NOT NULL,\n ADD `limit` varchar(10) NOT NULL,\n ADD `columns` TEXT NOT NULL,\n ADD `displayedFor` int(11) NOT NULL default '1',\n ADD `pages` TEXT NOT NULL,\n ADD `displayInMenu` int(11) NOT NULL,\n ADD `categorySpecific` int(11) NOT NULL,\n ADD `recursive`int(11) NOT NULL,\n ADD `listStyle` int(11) NOT NULL,\n ADD `loop` int(11) NOT NULL default 0,\n ADD `autoScroll` int(11) NOT NULL default 60,\n ADD `cache` int(11) NOT NULL default 60,\n ADD `positionNormal` varchar(10) NOT NULL,\n ADD `positionScrollable` varchar(10) NOT NULL,\n ADD `exportFields` TEXT NOT NULL,\n ADD `exportFormat` int(11) NOT NULL DEFAULT 1,\n ADD `xmlType` varchar(20) NOT NULL DEFAULT 'RSS2.0',\n ADD `customAdListTemplate` VARCHAR( 255 ) NOT NULL\n "); $customSearchIndexes = CustomField::getCustomColumnIndexes("search"); $newIndexes = array(); foreach (CustomField::getCustomColumnIndexes("item") as $ci) { if (!in_array($ci, $customSearchIndexes)) { $newIndexes[] = $ci; } } $pieces = array_map(create_function('$v', 'return "ADD $v TEXT NOT NULL";'), $newIndexes); if (count($pieces)) { executeQuery("ALTER TABLE @search " . implode(",", $pieces)); } }