-- Table structure for table `Collection_401`
--

CREATE TABLE `Collection_401` (
  `Collection_401_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_401_1` varchar(254) NOT NULL,
  `Collection_401_2` varchar(254) NOT NULL,
  PRIMARY KEY (`Collection_401_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_401`
--

INSERT INTO `Collection_401` VALUES (1,'/','/about-us.html');

--
-- Table structure for table `Collection_403`
--

CREATE TABLE `Collection_403` (
  `Collection_403_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_403_1` varchar(254) DEFAULT NULL,
  `Collection_403_2` int(11) DEFAULT NULL,
  `Collection_403_3` bigint(20) DEFAULT NULL,
  `Collection_403_4` varchar(254) DEFAULT NULL,
  `Collection_403_5` int(11) DEFAULT NULL,
  `Collection_403_6` int(11) DEFAULT NULL,
  `Collection_403_7` text,
  PRIMARY KEY (`Collection_403_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_403`
--

INSERT INTO `Collection_403` VALUES (1,'Content',1,1,'CONTENT',1,1,'{{$content}}\r\n'),(2,'External Link',1,100,'LINK',NULL,NULL,NULL),(3,'Dynamic Page',1,90,'DYNAMIC',3,2,NULL),(4,'Homepage',689,3,'HOME',1,1,'{{$content}}'),(5,'Lander',688,2,'LANDER',1,1,'{{$content}}');

--
-- Table structure for table `Collection_404`
--

CREATE TABLE `Collection_404` (
  `Collection_404_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_404_1` int(11) DEFAULT NULL,
  `Collection_404_2` varchar(254) DEFAULT NULL,
  `Collection_404_3` text,
  `Collection_404_4` text,
  PRIMARY KEY (`Collection_404_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_404`
--

INSERT INTO `Collection_404` VALUES (1,2,'1','',''),(2,2,'2','',''),(3,2,'3','',''),(4,2,'6','Place the URL where to send the site visitor on the first line of this textbox.','$(\'#Collection_400_6_row .collection_field_name\').text(\'URL\');'),(5,2,'4','','$(\'#Collection_400_4_row .collection_field_name\').text(\'Link Text\');');

--
-- Table structure for table `Collection_405`
--

CREATE TABLE `Collection_405` (
  `Collection_405_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_405_1` varchar(254) DEFAULT NULL,
  `Collection_405_2` bigint(20) DEFAULT NULL,
  `Collection_405_3` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`Collection_405_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_405`
--

INSERT INTO `Collection_405` VALUES (1,'Content',6,6),(2,'Notes - Files for Download (PDF, XLS, ect.) ',7,2),(3,'H1',5,14),(4,'Intro',8,15);

--
-- Table structure for table `Collection_408`
--

CREATE TABLE `Collection_408` (
  `Collection_408_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_408_1` varchar(254) DEFAULT NULL,
  `Collection_408_2` text,
  `Collection_408_3` text,
  `Collection_408_4` varchar(254) DEFAULT NULL,
  `Collection_408_5` int(11) DEFAULT NULL,
  PRIMARY KEY (`Collection_408_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_408`
--

INSERT INTO `Collection_408` VALUES (1,'Pureti susce augue cuside leo sustain.','Pureti susce augue cuside leo sustain.','<p>Vestibulum non orci quis turpis adipisg consequat vel et augue. Aenean sed mattis orci, eget sodales quam. Fusce feugiat quam vel eros tincidunt, quis dignissim lectus aliquam. Integer sed lacinia nunc, et convallis mi. Morbi suipit turpis at massa sodales ultricies. Cur vulputate nibh eu odio suscipit elentum.</p>\r\n','/images/content1.jpg',1),(2,'Fuseco sicropot meciedo lorgumed.','Fuseco sicropot meciedo lorgumed.','<p>estibulum non orci quis turpis adipisg consequat vel et augue. Aenean sed mattis orci, eget sodales quam. Fusce feugiat quam vel eros tincidunt, quis dignissim lectus aliquam. Integer sed lacinia nunc, et convallis mi. Morbi suipit turpis at massa sodales ultricies. Cur vulputate nibh eu odio suscipit elentum.</p>\r\n','/images/content2.jpg',1),(3,'Aguemeciedo  lacueded  sustainabilty.','Aguemeciedo  lacueded  sustainabilty.','<p>estibulum non orci quis turpis adipisg consequat vel et augue. Aenean sed mattis orci, eget sodales quam. Fusce feugiat quam vel eros tincidunt, quis dignissim lectus aliquam. Integer sed lacinia nunc, et convallis mi. Morbi suipit turpis at massa sodales ultricies. Cur vulputate nibh eu odio suscipit elentum.</p>\r\n','/images/content3.jpg',1);

--
-- Table structure for table `Collection_409`
--

CREATE TABLE `Collection_409` (
  `Collection_409_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_409_1` int(11) DEFAULT NULL,
  `Collection_409_2` int(11) DEFAULT NULL,
  `Collection_409_3` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`Collection_409_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_409`
--

INSERT INTO `Collection_409` VALUES (1,560,3,1),(2,560,2,2),(3,560,1,3);

--
-- Table structure for table `Collection_410`
--

CREATE TABLE `Collection_410` (
  `Collection_410_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_410_1` varchar(254) DEFAULT NULL,
  `Collection_410_2` int(11) DEFAULT NULL,
  `Collection_410_3` text,
  `Collection_410_4` varchar(254) DEFAULT NULL,
  `Collection_410_5` varchar(254) DEFAULT NULL,
  PRIMARY KEY (`Collection_410_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_410`
--

INSERT INTO `Collection_410` VALUES (1,'Quote 1',1,'Pureti doeducer rudocpuo scede munduce agonsd. doed rudouo scede munduce agonsd.','Johnson Controls','John Tompson'),(2,'Quote 2',1,'Pureti doeducer rudocpuo scede munduce agonsd. doed rudouo scede munduce agonsd.','Lorem Ipsum','Dolor Imet');

--
-- Table structure for table `Collection_411`
--

CREATE TABLE `Collection_411` (
  `Collection_411_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_411_1` int(11) DEFAULT NULL,
  `Collection_411_2` int(11) DEFAULT NULL,
  PRIMARY KEY (`Collection_411_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_411`
--

INSERT INTO `Collection_411` VALUES (4,561,2),(3,561,1);

--
-- Table structure for table `Collection_412`
--

CREATE TABLE `Collection_412` (
  `Collection_412_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_412_1` varchar(254) DEFAULT NULL,
  `Collection_412_2` int(11) DEFAULT NULL,
  `Collection_412_3` varchar(254) DEFAULT NULL,
  `Collection_412_4` text,
  `Collection_412_5` int(11) DEFAULT NULL,
  `Collection_412_6` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`Collection_412_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_412`
--

INSERT INTO `Collection_412` VALUES (1,' Uses Light To Clean',1,'/images/l1.png','Aliquam nec tincidunt tellus, in imperdiet est. Fuse leo orci, lacinia a velit sed, eleifend susct augue. Duam nec tincunt tellus.',1,20),(2,' Cleans Windows',1,'/images/l2.png','Aliquam nec tincidunt tellus, in imperdiet est. Fuse leo orci, lacinia a velit sed, eleifend susct augue. Duam nec tincunt tellus.',NULL,NULL),(3,' Saves Time',1,'/images/l3.png','Aliquam nec tincidunt tellus, in imperdiet est. Fuse leo orci, lacinia a velit sed, eleifend susct augue. Duam nec tincunt tellus.',NULL,NULL),(4,' Purifies the Air',1,'/images/l4.png','Aliquam nec tincidunt tellus, in imperdiet est. Fuse leo orci, lacinia a velit sed, eleifend susct augue. Duam nec tincunt tellus.',NULL,NULL),(5,'One Step',1,'/images/l5.png','Aliquam nec tincidunt tellus, in imperdiet est. Fuse leo orci, lacinia a velit sed, eleifend susct augue. Duam nec tincunt tellus.',NULL,NULL),(6,' Any Fabric an Air Cleaner',1,'/images/l6.png','Aliquam nec tincidunt tellus, in imperdiet est. Fuse leo orci, lacinia a velit sed, eleifend susct augue. Duam nec tincunt tellus.',1,10);

--
-- Table structure for table `Collection_413`
--

CREATE TABLE `Collection_413` (
  `Collection_413_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_413_1` int(11) NOT NULL,
  `Collection_413_2` int(11) NOT NULL,
  `Collection_413_3` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`Collection_413_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_413`
--

INSERT INTO `Collection_413` VALUES (1,561,6,10),(2,561,2,20),(3,561,4,30),(4,561,3,40),(5,561,1,50),(6,561,5,60);

--
-- Table structure for table `Collection_414`
--

CREATE TABLE `Collection_414` (
  `Collection_414_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_414_1` varchar(254) DEFAULT NULL,
  `Collection_414_2` int(11) DEFAULT NULL,
  `Collection_414_3` bigint(20) DEFAULT NULL,
  `Collection_414_4` varchar(254) DEFAULT NULL,
  `Collection_414_5` text,
  PRIMARY KEY (`Collection_414_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_414`
--

INSERT INTO `Collection_414` VALUES (1,'Hertz',1,10,'/images/desktop/logo1.png','http://www.hertz.com'),(2,'Hertz 2',1,40,'/images/desktop/logo1.png','http://www.hertz.com'),(3,'HWKN',1,20,'/images/desktop/logo2.png','http://www.hwkn.com'),(4,'Johnson Controls',1,30,'/images/desktop/logo3.png','http://www.johnson-controls.com');

--
-- Table structure for table `Collection_415`
--

CREATE TABLE `Collection_415` (
  `Collection_415_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_415_1` int(11) DEFAULT NULL,
  `Collection_415_2` int(11) DEFAULT NULL,
  `Collection_415_3` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`Collection_415_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_415`
--

INSERT INTO `Collection_415` VALUES (1,10,1,10),(2,10,2,20),(3,11,1,10),(4,11,2,20),(5,12,1,10),(6,12,2,20);

--
-- Table structure for table `Collection_416`
--

CREATE TABLE `Collection_416` (
  `Collection_416_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_416_1` varchar(254) DEFAULT NULL,
  `Collection_416_2` int(11) DEFAULT NULL,
  `Collection_416_3` bigint(20) DEFAULT NULL,
  `Collection_416_4` varchar(254) DEFAULT NULL,
  `Collection_416_5` text,
  `Collection_416_6` text,
  `Collection_416_7` varchar(254) DEFAULT NULL,
  `Collection_416_8` varchar(254) DEFAULT NULL,
  `Collection_416_9` int(11) DEFAULT NULL,
  PRIMARY KEY (`Collection_416_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_416`
--

INSERT INTO `Collection_416` VALUES (1,'Manufactures',1,10,'/images/htab1.jpg','Reque ut, sagittis nuncated toe bedo.','Aliquam nec tincidunt tellus, in imperdiet est. Fusce leo orci, lacinia a velit sed, eleifend susct augue. Aliquam nec tincidunt tellus, in imperdiet est. Fusce le orci, lacinia a velit sed, eleifend suscipit augue. Aliquam nec do.','Read More','/link1.html',1),(2,'Architecture',1,20,'/images/htab1.jpg','Architecture','Aliquam nec tincidunt tellus, in imperdiet est. Fusce leo orci, lacinia a velit sed, eleifend susct augue. Aliquam nec tincidunt tellus, in imperdiet est. Fusce le orci, lacinia a velit sed, eleifend suscipit augue. Aliquam nec do.','Learn More','/link2.html',2),(3,'Hospitality',1,30,'/images/htab1.jpg','Hospitality','Aliquam nec tincidunt tellus, in imperdiet est. Fusce leo orci, lacinia a velit sed, eleifend susct augue. Aliquam nec tincidunt tellus, in imperdiet est. Fusce le orci, lacinia a velit sed, eleifend suscipit augue. Aliquam nec do.','Learn More','/link2.html',2),(4,'Healthcare',1,40,'/images/htab1.jpg','Healthcare','Aliquam nec tincidunt tellus, in imperdiet est. Fusce leo orci, lacinia a velit sed, eleifend susct augue. Aliquam nec tincidunt tellus, in imperdiet est. Fusce le orci, lacinia a velit sed, eleifend suscipit augue. Aliquam nec do.','Learn More','/link2.html',2),(5,'Property Management',1,60,'/images/htab1.jpg','Property Management','Aliquam nec tincidunt tellus, in imperdiet est. Fusce leo orci, lacinia a velit sed, eleifend susct augue. Aliquam nec tincidunt tellus, in imperdiet est. Fusce le orci, lacinia a velit sed, eleifend suscipit augue. Aliquam nec do.','Learn More','/link2.html',2);

--
-- Table structure for table `Collection_417`
--

CREATE TABLE `Collection_417` (
  `Collection_417_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_417_1` varchar(254) DEFAULT NULL,
  `Collection_417_2` varchar(254) DEFAULT NULL,
  `Collection_417_3` text,
  `Collection_417_4` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`Collection_417_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_417`
--


--
-- Table structure for table `Collection_5`
--

CREATE TABLE `Collection_5` (
  `Collection_5_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_5_1` int(11) DEFAULT NULL,
  `Collection_5_2` int(11) DEFAULT NULL,
  PRIMARY KEY (`Collection_5_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=43 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_5`
--


--
-- Table structure for table `Collection_50`
--

CREATE TABLE `Collection_50` (
  `Collection_50_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_50_1` varchar(254) DEFAULT NULL,
  `Collection_50_2` varchar(254) DEFAULT NULL,
  `Collection_50_3` varchar(254) DEFAULT NULL,
  `Collection_50_4` varchar(254) DEFAULT NULL,
  `Collection_50_5` varchar(254) DEFAULT NULL,
  `Collection_50_6` bigint(20) DEFAULT NULL,
  `Collection_50_7` varchar(254) DEFAULT NULL,
  PRIMARY KEY (`Collection_50_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=23 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_50`
--

INSERT INTO `Collection_50` VALUES (4,'Sample Video','/content/videos/video_50_2_4.flv','/content/videos/video_50_3_4.flv','/content/videos/video_50_4_4.jpg','/content/videos/video_50_5_4.jpg',1228848408,'on');

--
-- Table structure for table `Collection_6`
--

CREATE TABLE `Collection_6` (
  `Collection_6_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_6_1` varchar(254) NOT NULL DEFAULT '',
  `Collection_6_2` varchar(254) NOT NULL DEFAULT '',
  PRIMARY KEY (`Collection_6_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=15 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_6`
--

INSERT INTO `Collection_6` VALUES (1,'Collection Preview Module','collection_preview.php'),(2,'Collections Profile','collections.php'),(3,'Collection Settings Profile','collection_settings.php'),(4,'Collection Admin','collection.php'),(5,'Dashboard','dashboard.php'),(10,'Email Profile','EmailProfile.php'),(9,'Collection Templates Module','collection_templates.php'),(11,'Execute Code','ExecuteProfile.php'),(12,'Collection Reports Profile','collection_reports.php'),(13,'Collection Workflows','collection_workflows.php'),(14,'Collection List Preview','collection_list_preview.php');

--
-- Table structure for table `Collection_60`
--

CREATE TABLE `Collection_60` (
  `Collection_60_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_60_1` varchar(254) NOT NULL DEFAULT '',
  `Collection_60_2` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`Collection_60_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_60`
--

INSERT INTO `Collection_60` VALUES (1,'My Blog Topic 1',1),(2,'My Blog Topic 2',2);

--
-- Table structure for table `Collection_61`
--

CREATE TABLE `Collection_61` (
  `Collection_61_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_61_1` varchar(254) NOT NULL DEFAULT '',
  `Collection_61_2` int(11) NOT NULL DEFAULT '0',
  `Collection_61_3` text NOT NULL,
  `Collection_61_4` text,
  `Collection_61_5` bigint(20) DEFAULT NULL,
  `Collection_61_6` int(11) DEFAULT NULL,
  PRIMARY KEY (`Collection_61_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_61`
--

INSERT INTO `Collection_61` VALUES (1,'Nullam posuere tristique tortor. In bibendum.',1,'<div class=\"body\">\r\n<p>Aliquam risus justo, mollis in, laoreet a, consectetuer nec, risus. Nunc blandit sodales lacus. Nam luctus semper mi. In eu diam. Phasellus rutrum elit vel nisi. Cras mauris nulla, egestas quis, cursus at, venenatis ac, ante. Fusce accumsan enim et arcu. Duis sagittis libero at lacus. Suspendisse lacinia nulla eget urna.</p>\r\n<ul>\r\n    <li>Tristique</li>\r\n    <li>Aenean</li>\r\n    <li>Pretium</li>\r\n</ul>\r\n<p>In hac habitasse platea dictumst. Duis porttitor. Sed vulputate elementum nisl. Vivamus et mi at arcu mattis iaculis. Nullam posuere tristique tortor. In bibendum. Aenean ornare, nunc eget pretium porttitor, sem est pretium leo, non euismod nulla dui non diam. Pellentesque dictum faucibus leo. Vestibulum ac ante. Sed in est. Sed sodales nisl sit amet augue. Donec ultrices, augue ullamcorper posuere laoreet, turpis massa tristique justo, sed egestas metus magna sed purus. Fusce eleifend, dui ut posuere auctor, justo elit posuere sapien, at blandit enim quam fringilla mi.</p>\r\n</div>\r\n<p>In hac habitasse platea dictumst. Duis porttitor. Sed vulputate elementum nisl. Vivamus et mi at arcu mattis iaculis. Nullam posuere tristique tortor. In bibendum. Aenean ornare, nunc eget pretium porttitor, sem est pretium leo, non euismod nulla dui non diam. Pellentesque dictum faucibus leo. Vestibulum ac ante. Sed in est. Sed sodales nisl sit amet augue. Donec ultrices, augue ullamcorper posuere laoreet, turpis massa tristique justo, sed egestas metus magna sed purus. Fusce eleifend, dui ut posuere auctor, justo elit posuere sapien, at blandit enim quam fringilla mi.</p>','\r\n\r\nAliquam risus justo, mollis in, laoreet a, consectetuer nec, risus. Nunc blandit sodales lacus. Nam luctus semper mi. In eu diam. Phasellus rutrum elit vel nisi. Cras mauris nulla, egestas quis, cursus at, venenatis ac, ante. Fusce accumsan enim et arcu. Duis sagittis libero at lacus. Suspendisse lacinia nulla eget urna.  \r\n\r\n    \r\n-  Tristique  \r\n-  Aenean  \r\n-  Pretium  \r\n\r\n\r\n\r\nIn hac habitasse platea dictumst. Duis porttitor. Sed vulputate elementum nisl. Vivamus et mi at arcu mattis iaculis. Nullam posuere tristique tortor. In bibendum. Aenean ornare, nunc eget pretium porttitor, sem est pretium leo, non euismod nulla dui non diam. Pellentesque dictum faucibus  ...',1239899307,1);

--
-- Table structure for table `Collection_62`
--

CREATE TABLE `Collection_62` (
  `Collection_62_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_62_1` varchar(254) NOT NULL DEFAULT '',
  `Collection_62_2` text NOT NULL,
  `Collection_62_3` int(11) DEFAULT NULL,
  `Collection_62_4` int(11) DEFAULT NULL,
  `Collection_62_5` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`Collection_62_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_62`
--

INSERT INTO `Collection_62` VALUES (1,'In hac habitasse platea dictumst. Duis porttitor','Vestibulum ac ante. Sed in est. Sed sodales nisl sit amet augue. \r\nDonec ultrices, augue ullamcorper posuere laoreet, turpis massa tristique justo. \r\nSed egestas metus magna sed purus.',1,1,1239899556),(2,'Sed sodales nisl sit amet augue. ','Sed vulputate elementum nisl. \r\nVivamus et mi at arcu mattis iaculis. Nullam posuere tristique tortor. \r\nIn bibendum.',1,1,1239899584);

--
-- Table structure for table `Collection_7`
--

CREATE TABLE `Collection_7` (
  `Collection_7_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_7_1` int(11) DEFAULT NULL,
  `Collection_7_2` int(11) DEFAULT NULL,
  PRIMARY KEY (`Collection_7_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=153 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_7`
--

INSERT INTO `Collection_7` VALUES (70,1,10),(69,1,6),(68,1,5),(67,1,9),(66,1,3),(65,1,4),(64,1,1),(63,1,2),(71,1,11);

--
-- Table structure for table `Collection_8`
--

CREATE TABLE `Collection_8` (
  `Collection_8_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_8_1` varchar(254) NOT NULL DEFAULT '',
  `Collection_8_2` int(11) DEFAULT NULL,
  `Collection_8_3` varchar(254) DEFAULT NULL,
  `Collection_8_4` varchar(254) DEFAULT NULL,
  `Collection_8_5` text,
  `Collection_8_6` int(11) DEFAULT NULL,
  `Collection_8_7` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`Collection_8_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=52 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_8`
--

INSERT INTO `Collection_8` VALUES (2,'Users',NULL,NULL,NULL,NULL,NULL,2),(44,'Events',1,'&id=236','',NULL,11,50),(4,'System Settings',1,'&id=12&eid=1','',NULL,11,90),(5,'Dashboard',5,NULL,NULL,NULL,NULL,1),(6,'Site Users',1,'&id=1',NULL,NULL,2,NULL),(18,'Files',1,'&id=381','',NULL,17,12),(11,'Manage',NULL,NULL,NULL,NULL,NULL,3),(12,'All Content',1,'&id=13','',NULL,11,10),(13,'Pages',1,'&id=17','',NULL,11,20),(14,'User Groups',1,'&id=2',NULL,NULL,2,NULL),(15,'Collections',2,NULL,NULL,NULL,17,NULL),(16,'Admin Menu',1,'&id=8',NULL,NULL,17,NULL),(17,'System Modules',NULL,NULL,NULL,NULL,NULL,4),(22,'News',1,'&id=274','',NULL,11,60),(45,'Files Types',1,'&id=383','',NULL,17,13),(24,'Site Menu',1,'&id=276',NULL,NULL,11,7),(34,'Page Content',1,'&id=13&CollectionColumns[]=13-3&CollectionOperators[]=1&CFilterSelValue[]=1&CFilterTxtValue[]=&st=&Search=Apply+Filter&FilterSave=0&FilterName=','',NULL,11,1),(27,'Download Google Sitemap',11,'&collectionid=8&colid=5',NULL,'require_once \'MDB2.php\';\r\n	$db = MDB2::factory(DSN);\r\n    $db->setFetchMode(MDB2_FETCHMODE_ASSOC); \r\n    $db->setOption(\'portability\', MDB2_PORTABILITY_NONE);\r\n    $db->loadModule(\'Extended\');\r\n	\r\n	$CID = 276;\r\n	$CollectionTableName = \'Collection_\'.$CID;\r\n	//get the rotator name and nav browser info\r\n	$SQL = \"SELECT $CollectionTableName.*  FROM  $CollectionTableName WHERE 1 \";\r\n	$Pages = $db->queryAll($SQL);\r\n	foreach ($Pages as $k => $v)\r\n	{\r\n		foreach ($v as $kk => $vv)\r\n		{\r\n			$Pages[$k][$kk] = utf8_encode(htmlspecialchars ($vv));\r\n		}\r\n	}\r\n	\r\n	//we need to get news pages\r\n	$News[][\'Link\'] = \'/news/\';\r\n	$News[][\'Link\'] = \'/news/archives/\';\r\n	\r\n	$SQL = \"SELECT Collection_273.*  FROM  Collection_273 WHERE 1 \";\r\n	$NewsCategories = $db->queryAll($SQL);\r\n	if ($NewsCategories)\r\n	{\r\n		foreach ($NewsCategories as $k => $v)\r\n		{\r\n			$News[][\'Link\'] = \'/news/\'.$v[\'Collection_273_ID\'].\"/\";\r\n		}\r\n	}\r\n	\r\n	$SQL = \"SELECT Collection_275.* , Collection_274.*  FROM  Collection_274 INNER JOIN Collection_275 ON Collection_275_1 = Collection_274_ID WHERE 1  Group By Collection_274_ID \";\r\n	$NewsArticles = $db->queryAll($SQL);\r\n	if ($NewsArticles)\r\n	{\r\n		foreach ($NewsArticles as $k => $v)\r\n		{\r\n			$News[][\'Link\'] = \'/news/\'.$v[\'Collection_275_2\'].\"/\".$v[\'Collection_274_ID\'].\"/\";\r\n		}\r\n	}\r\n	\r\n	//we get the events\r\n	$SQL = \"SELECT Collection_236.*  FROM  Collection_236 WHERE 1 \";\r\n	$Events = $db->queryAll($SQL);\r\n	\r\n	//we get the events\r\n	$SQL = \"SELECT Collection_303.*  FROM  Collection_303 WHERE 1 \";\r\n	$Extra = $db->queryAll($SQL);\r\n	\r\n	\r\n		$filename = \'sitemap.xml\';\r\n		header(\"Content-type: text/xml\");\r\n        header(\"Content-Disposition: attachment; filename=\\\"$filename\\\"\");\r\n        header(\"Expires: 0\");\r\n        header(\"Cache-Control: must-revalidate, post-check=0,pre-check=0\");\r\n        header(\"Pragma: public\");\r\n	\r\n	$smarty->assign(\"Extra\", $Extra);\r\n	$smarty->assign(\"Events\", $Events);\r\n	$smarty->assign(\"News\", $News);\r\n	$smarty->assign(\"Pages\", $Pages);\r\n	$smarty->display(\'pagesXML.html\');\r\n',17,NULL),(28,'Front End Menu Tree',1,'&id=38',NULL,NULL,17,NULL),(35,'Bulk Page Add',11,'&menu_id=5&module_id=11&collectionid=90&colid=2&nd=1',NULL,NULL,17,1000),(36,'Homepage Rotator',1,'&id=304',NULL,NULL,11,40),(50,'Homepage Tabs',1,'&id=416','',NULL,11,42),(40,'Content that needs looked at',1,'&id=400&gs=&st=Collection_400_5+is+null&Search=Apply+Filter&FilterSave=0&FilterName=&&eid=2',NULL,NULL,11,-3),(41,'CM - Upload Site Map',11,'&menu_id=8&module_id=11&collectionid=90&colid=2&nd=1','',NULL,17,900),(42,'CM - Migrate Content',11,'&menu_id=10&module_id=11&collectionid=90&colid=2&nd=1','',NULL,17,910),(46,'Content Adlets',1,'&id=408','',NULL,11,11),(47,'Quotes',1,'&id=410','',NULL,11,13),(48,'Content Benefits',1,'&id=412','',NULL,11,12),(49,'Notables',1,'&id=414','',NULL,11,130),(51,'Request Info',1,'&id=417','',NULL,11,11000);

--
-- Table structure for table `Collection_80`
--

CREATE TABLE `Collection_80` (
  `Collection_80_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_80_1` varchar(254) DEFAULT NULL,
  `Collection_80_2` bigint(20) DEFAULT NULL,
  `Collection_80_3` varchar(254) DEFAULT NULL,
  `Collection_80_4` varchar(254) DEFAULT NULL,
  PRIMARY KEY (`Collection_80_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_80`
--

INSERT INTO `Collection_80` VALUES (1,'Site Gallery',1,'on','/images/gallery/image-1.jpg'),(4,'Small Gallery',2,'on','/images/gallery/image-2.jpg');

--
-- Table structure for table `Collection_81`
--

CREATE TABLE `Collection_81` (
  `Collection_81_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_81_1` varchar(254) DEFAULT NULL,
  `Collection_81_2` varchar(254) DEFAULT NULL,
  `Collection_81_3` varchar(254) DEFAULT NULL,
  `Collection_81_4` varchar(254) DEFAULT NULL,
  `Collection_81_5` int(11) DEFAULT NULL,
  `Collection_81_6` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`Collection_81_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=55 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_81`
--

INSERT INTO `Collection_81` VALUES (35,'Photo 1','/content/galleryphotos/eagle-stock-image-1.jpg','/content/galleryphotos/eagle-stock-image.jpg','Photo 1',1,NULL),(36,'Photo 2','/content/galleryphotos/photo_81_2_36.jpg','/content/galleryphotos/photo_81_3_36.jpg','Photo 2',1,NULL),(37,'Photo 3','/content/galleryphotos/photo_81_2_37.jpg','/content/galleryphotos/photo_81_3_37.jpg','Photo 3',1,NULL),(38,'Photo 4','/content/galleryphotos/photo_81_2_38.jpg','/content/galleryphotos/photo_81_3_38.jpg','Photo 4',1,NULL),(39,'Photo 5','/content/galleryphotos/photo_81_2_39.jpg','/content/galleryphotos/photo_81_3_39.jpg','Photo 5',1,NULL),(40,'Photo 6','/content/galleryphotos/photo_81_2_40.jpg','/content/galleryphotos/photo_81_3_40.jpg','Photo 6',1,NULL),(41,'Photo 7','/content/galleryphotos/photo_81_2_41.jpg','/content/galleryphotos/photo_81_3_41.jpg','Photo 7',1,NULL),(42,'Photo 8','/content/documents/quiz-widget.jpg','/content/documents/tnail-quiz-widget.jpg','Photo 8',1,NULL);

--
-- Table structure for table `Collection_89`
--

CREATE TABLE `Collection_89` (
  `Collection_89_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_89_1` varchar(254) DEFAULT NULL,
  `Collection_89_2` bigint(20) DEFAULT NULL,
  `Collection_89_3` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`Collection_89_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_89`
--

INSERT INTO `Collection_89` VALUES (1,'Event Main Image',200,150),(2,'Event Small Image',80,80);

--
-- Table structure for table `Collection_9`
--

CREATE TABLE `Collection_9` (
  `Collection_9_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_9_1` varchar(254) DEFAULT NULL,
  `Collection_9_2` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`Collection_9_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_9`
--

INSERT INTO `Collection_9` VALUES (1,'Content',1),(2,'System',100),(3,'Media',7),(4,'Shopping Cart',10),(5,'Site Forms',8),(6,'Settings',90);

--
-- Table structure for table `Collection_90`
--

CREATE TABLE `Collection_90` (
  `Collection_90_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_90_1` varchar(254) DEFAULT NULL,
  `Collection_90_2` text,
  PRIMARY KEY (`Collection_90_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_90`
--

INSERT INTO `Collection_90` VALUES (1,'Copy Collection Row','$CollectionID = $_GET[\'cid\'];\r\n$rowId = $_GET[\'rowid\'];\r\n$queryString = $_GET[\'querystring\'];\r\n\r\n$admin = false; \r\nif($_SESSION[\'FrontEndAdmin\'] == 1)\r\n{\r\n	$admin = true;\r\n}\r\n\r\nif(!$admin && !$api->CanUserAccess($_SESSION[\'AAuserid\'],  $CollectionID, $rowId))\r\n{\r\n		header(\'Location: admin.php?copy=0&\'.urldecode($queryString).\'eid=\'.$rowId.\'\');\r\n}\r\nelse\r\n{\r\n\r\n$selectedRow = $api-> getCollectionSingleRow (array(\'collection_id\' =>$CollectionID , \'row_id\' => $rowId));\r\nunset($selectedRow[$api->_getCollectionFieldName($CollectionID, \'ID\')]);\r\n\r\n$PUAccess = array();\r\n$RowUserAccess = $api->selectCollectionUserGroupAccessRow($CollectionID, $rowId);\r\nforeach ($RowUserAccess as $key => $value)\r\n{  \r\n	$PUAccess[$value[\'UserGroupId\']] = $value[\'UserGroupId\'];\r\n}\r\n\r\n$NewRowID = $api->insertCollectionRow_($CollectionID, $selectedRow , \'\' , \'\');\r\n$api->updateCollectionUserGroupAccessRow($CollectionID, $NewRowID, $PUAccess, $_SESSION[\'AAuserid\']);\r\n\r\n\r\nheader(\'Location: admin.php?copy=1&\'.urldecode($queryString).\'eid=\'.$NewRowID.\'\');\r\n\r\n}\r\n\r\ndie();\r\n'),(2,'Delete All Collection Rows','$CollectionID = $_GET[\'cid\'];\r\n$queryString = $_GET[\'querystring\'];\r\n\r\n$admin = false; \r\nif($_SESSION[\'FrontEndAdmin\'] == 1)\r\n{\r\n	$admin = true;\r\n}\r\n\r\n$selectedRow = $api-> getCollectionSingleRow (array(\'collection_id\' => 4, \'row_id\' => $CollectionID));\r\n$columnName = $api->_getCollectionFieldName(4, \'2\');\r\n\r\nif ($selectedRow[$columnName] == \'on\')\r\n{\r\n	header(\'Location: admin.php?systemerase=1&\'.urldecode($queryString));\r\n	die();\r\n}\r\n\r\nif(!$admin && !$api->CanUserAccess($_SESSION[\'AAuserid\'],  4, $CollectionID))\r\n{\r\n		header(\'Location: admin.php?erase=0&\'.urldecode($queryString));\r\n		die();\r\n}\r\nelse\r\n{\r\n\r\n$queryArray = array(\'collection_id\'=>$CollectionID);\r\n	\r\n	if(!$admin)\r\n	{\r\n		$queryArray[\'userId\']=$_SESSION[\'AAuserid\'];\r\n	}\r\n	\r\n	$table = $api->Filter($queryArray);\r\n	\r\n	$NumResults = count($table[\'AllResults\']);\r\n\r\n	$columnName = $api->_getCollectionFieldName($CollectionID, \'ID\');\r\n	$collectionSettings  = $api->getCollectionSettings($CollectionID);\r\n	$taxonomy = $api->getCollectionTaxonomy($CollectionID);\r\n	\r\n	foreach ($table[\'Results\'] as $k => $v)\r\n	{\r\n		$did = $v[$columnName];\r\n				\r\n		$args = array(  \'CollectionID\' => $CollectionID ,\r\n							\'ApplyFor\' => 3 , //admin front end\r\n							\'UserID\' => $user_id ,\r\n							\'SuperAdminUser\' => $admin ,\r\n							\'SubmittedData\' => $_POST ,\r\n							\'ExtraGetParams\' => $_GET ,\r\n							\'CollectionSettings\' => $collectionSettings ,\r\n							\'CollectionTaxonomy\' => $taxonomy ,\r\n							\'UploadDirectory\'  => $UploadDirectory ,\r\n							\'UploadPrefix\'  => $UploadPrefix ,\r\n							\'Smarty\'  => $smarty ,\r\n							\'DeleteID\' => intval($did),\r\n							\'OverrideWorkflowIDs\'=> array(0=>6)\r\n						 );	\r\n						 \r\n		$WorkFlowReturnArray = $api -> Workflow ( $args );				 	\r\n		\r\n	}\r\n\r\n\r\n}\r\n\r\nheader(\'Location: admin.php?erase=1&\'.urldecode($queryString));\r\ndie();'),(3,'Script to delete All entries from a Shopping Cart','require_once(\"MDB2.php\");\r\n$db = MDB2::factory(DSN);\r\n $db->setFetchMode(MDB2_FETCHMODE_ASSOC); \r\n $db->setOption(\'portability\', MDB2_PORTABILITY_NONE);\r\n $db->loadModule(\'Extended\');\r\nforeach ($_POST[\'deleteCollectionIDs\'] as $k => $v)\r\n{\r\n	$q = \"DELETE FROM Collection_\" . $v .\" WHERE Collection_\".$v.\"_\". $_POST[\'deleteFieldIDs\'][$k] .\" = \".$_POST[\'deleteFieldValues\'][$k].\" \";\r\n	$db->query($q);\r\n}\r\n\r\n$q = \"DELETE FROM Collection_\" . $_POST[\'parentCollectionID\'] .\" WHERE Collection_\".$_POST[\'parentCollectionID\'].\"_ID = \".$_POST[\'parentID\'] .\" \";\r\n$db->query($q);\r\n	\r\n	header(\'Location: \'. $_POST[\'originalURL\']);\r\n	die();'),(4,'Collection Fields JS Array','$CollectionID = $_GET[\'cid\'];\r\n$taxonomy = $api->getCollectionTaxonomyOrdered($CollectionID);\r\n\r\nforeach ($taxonomy  as $record)\r\n{\r\n	echo \"fields[\".$record[\"CollectionFieldId\"].\"] = \'\".str_replace(\"\'\",\"\\\'\",$record[\"CollectionFieldName\"]) .\"\';\";\r\n}\r\n\r\n'),(5,'Site Builder Macro','include $_SERVER[\'DOCUMENT_ROOT\'].\'/classes/PHPExcel/PHPExcel.php\';\r\ninclude $_SERVER[\'DOCUMENT_ROOT\'].\'/classes/PHPExcel/PHPExcel/Reader/Excel2007.php\';\r\n\r\n$errors = array();\r\n\r\nif ($_POST[\'acceptanduploaddata\'] == 1)\r\n{\r\n				\r\n		foreach ($_POST[\'importRow\'] as $k => $v)\r\n		{\r\n		if ($_POST[\'pageAdd\'][$k] == 1)\r\n		{\r\n			 $externalLink = intval($_POST[\'ExternalURL\'][$k]);\r\n			 \r\n			 if ( $externalLink == 0)\r\n			 {\r\n			 		//we check to see if we add the page or not\r\n					$q = \"SELECT * FROM Collection_17 WHERE Collection_17_3 = \'\".addslashes($_POST[\'PageFileName\'][$k]).\"\'\";\r\n					$res = $dbh->query($q);\r\n					\r\n					if ($res->numRows() == 0)\r\n					{\r\n								\r\n								if ($_POST[\'ContentNumeric\'][$k] == 1)\r\n								{\r\n										//we add the content based on an already created content\r\n										$q  = \"SELECT * FROM Collection_13 WHERE Collection_13_ID = \'\".$_POST[\'ContentToUse\'][$k].\"\'\";\r\n										$res = $dbh->query($q);\r\n										$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n										\r\n										$block_column_values = array(\r\n												\'Collection_13_1\' => \'CNT - \' . $_POST[\'PageName\'][$k],\r\n												\'Collection_13_2\' => \'\',\r\n												\'Collection_13_3\' => $row[\'Collection_13_3\'],\r\n												\'Collection_13_4\' => $row[\'Collection_13_4\'],\r\n												\'Collection_13_6\' => $row[\'Collection_13_6\'],\r\n												\'Collection_13_7\' => date(time()),\r\n												\'Collection_13_8\' => $row[\'Collection_13_8\'],\r\n												\'Collection_13_9\' => $row[\'Collection_13_9\']				\r\n										);\r\n										\r\n								}\r\n								else\r\n								{\r\n								\r\n										$CUSE = $_POST[\'ContentToUse\'][$k];\r\n										$CNT = html_entity_decode($_POST[\'CData\'.$CUSE]);\r\n										\r\n										$block_column_values = array(\r\n												\'Collection_13_1\' => \'CNT - \' . $_POST[\'PageName\'][$k],\r\n												\'Collection_13_2\' => \'\',\r\n												\'Collection_13_3\' => 1,\r\n												\'Collection_13_4\' => 1,\r\n												\'Collection_13_6\' => $CNT,\r\n												\'Collection_13_7\' => date(time()),\r\n												\'Collection_13_8\' => NULL,\r\n												\'Collection_13_9\' => NULL			\r\n										);\r\n								\r\n								}\r\n								\r\n								$ThisPageContentID = $api->insertCollectionRow_(13, $block_column_values , \'\' , \'\');\r\n								//$api -> insertCollectionUserGroupAccessRow(13, $ThisPageContentID, $ugroups, $UserID);\r\n								\r\n								//we add the actual page\r\n								$page_column_values = array(\r\n										\'Collection_17_1\' => \'CNT - \' . $_POST[\'PageName\'][$k],\r\n										\'Collection_17_2\' => $_POST[\'PageName\'][$k],\r\n										\'Collection_17_3\' => $_POST[\'PageFileName\'][$k],\r\n										\'Collection_17_4\' => 1,\r\n										\'Collection_17_5\' => $_POST[\'TemplateToUse\'][$k],\r\n										\'Collection_17_6\' => $ThisPageContentID,\r\n										\'Collection_17_7\' => \'\',\r\n										\'Collection_17_8\' => \'\',\r\n										\'Collection_17_9\' => date(time()),\r\n										\'Collection_17_10\' => \'on\'				\r\n								);\r\n								\r\n								$ThisPageID = $api->insertCollectionRow_(17, $page_column_values , \'\' , \'\');\r\n								//$api -> insertCollectionUserGroupAccessRow(17, $ThisPageID, $ugroups, $UserID);\r\n								\r\n					}//end add page\r\n			 \r\n			 }\r\n			 \r\n			 $TheParentPageName = $_POST[\'ParentPageName\'][$k];\r\n			 \r\n			 if ($TheParentPageName == \'\')\r\n			 {\r\n			 	$ParentID = NULL;\r\n			 }\r\n			 else\r\n			 {\r\n			 	$q = \"SELECT * FROM Collection_276 WHERE Collection_276_1 = \'\".addslashes($TheParentPageName).\"\'\";\r\n				$res = $dbh->query($q);\r\n				\r\n				if ($res->numRows() == 0)\r\n				{\r\n						$ParentID = NULL;\r\n				}\r\n				else\r\n				{\r\n						$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n						$ParentID = $row[\'Collection_276_ID\'];\r\n						\r\n				}\r\n				\r\n			 }\r\n			 \r\n			 $sortorder = 0;\r\n			 \r\n			 if ($ParentID == NULL)\r\n			 {\r\n			 		$q= \"SELECT * FROM Collection_276 WHERE Collection_276_7 IS NULL OR Collection_276_7 = \'\' Order By Collection_276_3 DESC\";			 \r\n			 }\r\n			 else\r\n			 {\r\n			 		$q= \"SELECT * FROM Collection_276 WHERE Collection_276_7 = \'\".$ParentID.\"\' Order By Collection_276_3 DESC\";\r\n			 }\r\n			 \r\n			 		$res = $dbh->query($q);\r\n					if($res->numRows() == 0)\r\n					{\r\n						$sortorder = 1;\r\n					}\r\n					else\r\n					{\r\n						$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n						$sortorder = intval($row[\'Collection_276_3\']) + 10;\r\n					}\r\n			 \r\n			 \r\n			 //time to add the site menu item\r\n			 $site_column_values = array(\r\n										\'Collection_276_1\' => $_POST[\'PageName\'][$k],\r\n										\'Collection_276_2\' => $_POST[\'PageURL\'][$k],\r\n										\'Collection_276_3\' => $sortorder,\r\n										\'Collection_276_4\' => \'on\',\r\n										\'Collection_276_5\' => NULL,\r\n										\'Collection_276_6\' => $_POST[\'PageNewWindow\'][$k],\r\n										\'Collection_276_7\' => $ParentID,\r\n										\'Collection_276_8\' => NULL,\r\n										\'Collection_276_9\' => NULL			\r\n								);\r\n			 $ThisSitePageID = $api->insertCollectionRow_(276, $site_column_values , \'\' , \'\');\r\n			//$api -> insertCollectionUserGroupAccessRow(276, $ThisSitePageID, $ugroups, $UserID);\r\n			\r\n		}//end if page and site menu add\r\n		}//end foreach import\r\n		\r\n		header(\'Location: /\'.ADMIN_APP_DIR.\'/admin.php?menu_id=6&module_id=11&collectionid=90&colid=2&nd=1\');\r\n		die();\r\n}\r\n\r\n//we check to see if we have something to upload\r\nif ($_POST[\'uploadexcelfile\'] == 1)\r\n{\r\n		$error = $_FILES[\"excelfile\"][\"error\"];\r\n		\r\n		if ($error == UPLOAD_ERR_OK ) {\r\n		\r\n					$fileName = $_FILES[\"excelfile\"][\"tmp_name\"];\r\n					\r\n					$inputFileType = PHPExcel_IOFactory::identify($fileName);\r\n					\r\n					if ($inputFileType == \'Excel2007\')\r\n					{\r\n				\r\n								$objReader = new PHPExcel_Reader_Excel2007();\r\n								$objReader->setReadDataOnly(true);\r\n								$objPHPExcel = $objReader->load($fileName);\r\n								\r\n								//$locatedSheet = $objPHPExcel->getSheetByName(\'ContentSheet\');\r\n								\r\n								//get the first sheet and start looping through the results\r\n								$ImportedData = array();\r\n								\r\n								$objWorksheet 		= $objPHPExcel->getActiveSheet();\r\n								$highestRow 		= $objWorksheet->getHighestRow(); // e.g. 10\r\n								$highestColumn 		= $objWorksheet->getHighestColumn(); // e.g \'F\'\r\n								$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); // e.g. 5\r\n								\r\n								//we skpi the first row\r\n								$firstRow = 2;\r\n								\r\n								for ($row = $firstRow; $row <= $highestRow; ++$row) {\r\n			 \r\n					 					$rowArray = array();\r\n										$rowArray[\'PageName\'] = $objWorksheet->getCellByColumnAndRow(0, $row)->getValue();\r\n										$rowArray[\'ParentPageName\'] = $objWorksheet->getCellByColumnAndRow(1, $row)->getValue();\r\n										$rowArray[\'PageURL\'] = $objWorksheet->getCellByColumnAndRow(2, $row)->getValue();\r\n										$rowArray[\'PageNewWindow\'] = $objWorksheet->getCellByColumnAndRow(3, $row)->getValue();\r\n										$rowArray[\'Content\'] = $objWorksheet->getCellByColumnAndRow(4, $row)->getValue();\r\n										$rowArray[\'Template\'] = $objWorksheet->getCellByColumnAndRow(5, $row)->getValue();\r\n										\r\n										$ImportedData[] = $rowArray;\r\n										\r\n								}//end loop through		\r\n					 \r\n								\r\n								if (count($ImportedData) == 0)\r\n								{\r\n									$errors[] = \"There is nothing to import. Please check the excel file.\";\r\n								}\r\n								else\r\n								{\r\n										\r\n										$Contents = array();\r\n										$ActContents = array();\r\n										\r\n										$TmpImportedData = $ImportedData;\r\n										\r\n										//we make a first loop to see if we have the required contents and templates\r\n										foreach ($ImportedData as $k => $v)\r\n										{\r\n												if (is_numeric($v[\'Content\']))\r\n												{\r\n														$ImportedData[$k][\'ContentNumeric\'] = 1;\r\n														$q= \"SELECT * FROM Collection_13 WHERE Collection_13_ID = \".$v[\'Content\'];\r\n														$res = $dbh->query($q);\r\n														if ($res->numRows() == 0)\r\n														{\r\n																$ImportedData[$k][\'Errors\'][] =  \'The content with id \' . $v[\'Content\'] . \' does not exist.\';\r\n																$Contents[$v[\'Content\']] = 0;\r\n																$ImportedData[$k][\'Issues\'] = 1;\r\n														}\r\n														else\r\n														{\r\n																$Contents[$v[\'Content\']] = 1;\r\n														}\r\n												}\r\n												else\r\n												{\r\n														$ImportedData[$k][\'ContentNumeric\'] = 0;\r\n														if ($v[\'Content\'] != \'\')\r\n														{\r\n																	//we look for the sheet\r\n																	$locatedSheet = $objPHPExcel->getSheetByName($v[\'Content\']);\r\n																	$contentforsheet = \'\';\r\n																	if ($locatedSheet)\r\n																		$contentforsheet = $locatedSheet->getCellByColumnAndRow(0, 1)->getValue();\r\n																	\r\n																	if ($contentforsheet != \'\')\r\n																	{\r\n																		$Contents[$v[\'Content\']] = 1;\r\n																		$ActContents[$v[\'Content\']] = htmlentities($contentforsheet);\r\n																	}\r\n																	else\r\n																	{\r\n																		$ImportedData[$k][\'Errors\'][] =  \'There is no sheet named \' . $v[\'Content\'] . \' or the right cell on this sheet is not filled with content.\';\r\n																		$Contents[$v[\'Content\']] = 0;\r\n																		$ImportedData[$k][\'Issues\'] = 1;\r\n																	}\r\n														}\r\n														\r\n												}\r\n												\r\n												if (is_numeric($v[\'Template\']))\r\n												{\r\n														$q= \"SELECT * FROM Collection_13 WHERE Collection_13_ID = \".$v[\'Template\'];\r\n														$res = $dbh->query($q);\r\n														if ($res->numRows() == 0)\r\n														{\r\n																$ImportedData[$k][\'Template\'] = 1;\r\n														}\r\n														else\r\n														{\r\n																\r\n														}\r\n												}\r\n												else\r\n												{\r\n														if ($v[\'Content\'] != \'\')\r\n														{\r\n															$ImportedData[$k][\'Template\'] = 1;\r\n														}	\r\n														\r\n												}\r\n												\r\n												\r\n												//we need to know if the url is external or internal\r\n												$urlData = parse_url($v[\'PageURL\']);\r\n												\r\n												if (isset($urlData[\'host\']))\r\n												{\r\n														$ImportedData[$k][\'ExternalURL\'] = 1;\r\n												}\r\n												else\r\n												{\r\n														$ImportedData[$k][\'ExternalURL\'] = 0;\r\n												}\r\n												\r\n												\r\n												if (isset($urlData[\'path\']) && !isset($urlData[\'host\']))\r\n												{\r\n														//internal link\r\n														if ($urlData[\'path\'] == \'/\')\r\n														{\r\n															$pageFileName = \'index\';\r\n														}\r\n														else\r\n														{\r\n																//remove the  first slash\r\n																$pageFileName = substr($urlData[\'path\'], 1);\r\n																$pageFileNameDetails = pathinfo ($urlData[\'path\']);\r\n																$pageFileName = substr($pageFileName, 0 , -( strlen($pageFileNameDetails[\'extension\']) + 1 ) );\r\n														}		\r\n														\r\n														//check to see if we have a page with that filename\r\n														$q = \"SELECT * FROM Collection_17 WHERE Collection_17_3 = \'\".addslashes($pageFileName).\"\'\";\r\n														$res = $dbh->query($q);\r\n														\r\n														$ImportedData[$k][\'PageAlreadyExists\'] = 0;\r\n														\r\n														if ($res->numRows() > 0)\r\n														{\r\n																$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n																$ImportedData[$k][\'PageAlreadyExists\'] = 1;\r\n																$ImportedData[$k][\'Issues\'] = 1;\r\n																$ImportedData[$k][\'Errors\'][] = \'There is a page with that filename already created on the site. You can still add the page, but only a site menu item will be added. <a href=\"/\'.ADMIN_APP_DIR.\'/admin.php?menu_id=13&module_id=1&id=17&eid=\'.$row[\'Collection_17_ID\'].\'\" target=\"_blank\">See Page</a>\';\r\n														}\r\n														\r\n														//check if the site menu link exists but only for internal links\r\n														$q = \"SELECT * FROM Collection_276 WHERE Collection_276_2 = \'\".addslashes($v[\'PageURL\']).\"\'\";\r\n														$res = $dbh->query($q);\r\n														\r\n														if ($res->numRows() > 0)\r\n														{\r\n																$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n																$ImportedData[$k][\'Issues\'] = 1;\r\n																$ImportedData[$k][\'Errors\'][] = \'There is a site menu link with that URL already created on the site. You can still add the site menu, but there can be issues with the site menu having duplicate URLs. <a href=\"/\'.ADMIN_APP_DIR.\'/admin.php?menu_id=13&module_id=1&id=276&eid=\'.$row[\'Collection_276_ID\'].\'\" target=\"_blank\">See Site Menu</a>\';\r\n														}\r\n														\r\n																												\r\n														$ImportedData[$k][\'PageFileName\'] = $pageFileName;\r\n														\r\n														//we check the page filename for duplicates\r\n														$found  = 0;\r\n														for ($i = 0; $i < $k; $i++)\r\n														{\r\n																if ($ImportedData[$i][\'PageFileName\'] == $pageFileName)\r\n																{\r\n																		$found = 1;\r\n																}\r\n														}\r\n														\r\n														if ($found == 1)\r\n														{\r\n																$ImportedData[$k][\'Errors\'][] = \'There is another row in this excel file that will use the same page. Only a site menu entry will be created. The page will be created upon adding the previous row with the same file name.\';\r\n														}\r\n														\r\n														\r\n												}\r\n												else\r\n												{\r\n														if (!isset($urlData[\'host\']))\r\n														{\r\n															$ImportedData[$k][\'Issues\'] = 1;\r\n															$ImportedData[$k][\'Errors\'][] = \'The page url does not seem to be okay, please correct and reupload.\';\r\n														}	\r\n												}\r\n												\r\n												//we check the parents to be okay $TmpImportedData\r\n												if ($v[\'ParentPageName\'] != \'\')\r\n												{\r\n														$found  = 0;\r\n														for ($i = 0; $i < $k; $i++)\r\n														{\r\n																if ($TmpImportedData[$i][\'PageName\'] == $v[\'ParentPageName\'])\r\n																{\r\n																		$found = 1;\r\n																}\r\n														}\r\n														\r\n														if ($found == 0)\r\n														{\r\n															$q = \"SELECT * FROM Collection_276 WHERE Collection_276_1 = \'\".addslashes($v[\'ParentPageName\']).\"\'\";\r\n															$res = $dbh->query($q);\r\n														\r\n															if ($res->numRows() > 0)\r\n															{\r\n																	$found = 1;\r\n																	$ImportedData[$k][\'Errors\'][] = \'This page does not have this parent page in the current excel file, but it is found in the current site menu tree configuration.\';\r\n															}\r\n														\r\n														}\r\n														\r\n														if ($found == 0)\r\n														{\r\n																$ImportedData[$k][\'Issues\'] = 1;\r\n																$ImportedData[$k][\'Errors\'][] = \'The parent page can´t be found. Please make sure that the parent page lives in a row above this row we are testing.\';\r\n														}\r\n												\r\n												}\r\n\r\n												\r\n										\r\n										}//end foreach loop\r\n										\r\n										\r\n										$smarty->assign(\'ImportedData\'		, $ImportedData);\r\n										$smarty->assign(\'ActContents\'		, $ActContents);\r\n										$smarty->assign(\'Contents\'			, $Contents);\r\n										\r\n										\r\n								}//end if we have something to import		\r\n								\r\n								\r\n								\r\n					}\r\n					else\r\n					{\r\n							$errors[] = \"The uploaded file type has to be in Excel2007 format.\";\r\n					}			//end if file type is not good\r\n					\r\n					\r\n					\r\n		\r\n		\r\n		}\r\n		else\r\n		{\r\n				$errors[] = \"There was a problem with the upload. Please try again.\";\r\n		\r\n		}//end if upload error\r\n\r\n}\r\n\r\n\r\n\r\n$smarty->assign(\'errors\',$errors);\r\n\r\n$page = array (\r\n			\"PageTitle\"    => \"Site Builder Macro\"\r\n 		);\r\n$smarty->assign(\"page\",$page);\r\n$smarty->display(ADMIN_APP_DIR.\'/site-builder-macro.html\');'),(6,'Site Builder Macro - Done','$page = array (\r\n			\"PageTitle\"    => \"Site Builder Macro - Done\"\r\n 		);\r\n$smarty->assign(\"page\",$page);\r\n$smarty->display(ADMIN_APP_DIR.\'/site-builder-macro-done.html\');'),(7,'DropboxStorage Access Token Set','$DropboxInfo = $api->getRowById(390 , intval($_GET[\'dboxid\']));\r\n\r\ninclude_once $_SERVER[\'DOCUMENT_ROOT\'].\'/classes/StorageDropbox/src/Dropbox/autoload.php\';\r\n\r\n$oauth = new Dropbox_OAuth_PEAR($DropboxInfo[\'Collection_390_3\'],$DropboxInfo[\'Collection_390_4\']);\r\nprint_r($_SESSION);\r\n$dropbox = new Dropbox_API($oauth);\r\n\r\n$oauth->setToken($_SESSION[\'oauth_tokens\']);\r\n\r\n$tokens = $oauth->getAccessToken();\r\n\r\n$q = \"UPDATE Collection_390 SET Collection_390_6 = \'\".addslashes($tokens[\'token\']).\"\' WHERE Collection_390_ID = \'\".intval($_GET[\'dboxid\']).\"\'\";\r\n$dbh->query($q);\r\n\r\n$q = \"UPDATE Collection_390 SET Collection_390_7 = \'\".addslashes($tokens[\'token_secret\']).\"\' WHERE Collection_390_ID = \'\".intval($_GET[\'dboxid\']).\"\'\";\r\n$dbh->query($q);\r\n\r\nheader(\'Location: /\'.ADMIN_APP_DIR.\'/admin.php?module_id=1&action=update&id=390&&eid=\'.intval($_GET[\'dboxid\']));\r\ndie();'),(8,'Content For Client Macro','include $_SERVER[\'DOCUMENT_ROOT\'].\'/classes/PHPExcel/PHPExcel.php\';\r\ninclude $_SERVER[\'DOCUMENT_ROOT\'].\'/classes/PHPExcel/PHPExcel/Reader/Excel2007.php\';\r\n\r\n$errors = array();\r\n\r\nif ($_POST[\'acceptanduploaddata\'] == 1)\r\n{\r\n		\r\n		$q = \"TRUNCATE TABLE Collection_400\";\r\n		$res = $dbh->query($q);\r\n				\r\n		$parentIDs = array();\r\n		\r\n		foreach ($_POST[\'importRow\'] as $k => $v)\r\n		{\r\n				\r\n				\r\n				$addArray = array();\r\n				\r\n				$addArray[\'Collection_400_1\'] = $_POST[\'PageName\'][$v];\r\n				$addArray[\'Collection_400_4\'] = ucwords(strtolower($_POST[\'PageName\'][$v]));\r\n				$addArray[\'Collection_400_3\'] = $_POST[\'pageActTemplate\'][$v];\r\n				\r\n				$addArray[\'Collection_400_2\'] = NULL;\r\n				\r\n				if (intval($_POST[\'ParentPageID\'][$v]) > 0)\r\n				{\r\n							$addArray[\'Collection_400_2\'] = $parentIDs[$_POST[\'ParentPageID\'][$v]];\r\n				}\r\n				\r\n				$ThisSitePageID = $api->insertCollectionRow_(400, $addArray , \'\' , \'\');\r\n				\r\n				$parentIDs[$v] = $ThisSitePageID;\r\n		\r\n		}//end foreach\r\n		\r\n		\r\n		header(\'Location: /\'.ADMIN_APP_DIR.\'/admin.php?module_id=1&action=update&id=400\');\r\n		die(\'\');\r\n}\r\n\r\n//we check to see if we have something to upload\r\nif ($_POST[\'uploadexcelfile\'] == 1)\r\n{\r\n		$error = $_FILES[\"excelfile\"][\"error\"];\r\n		\r\n		\r\n		\r\n		if ($error == UPLOAD_ERR_OK ) {\r\n		\r\n					$fileName = $_FILES[\"excelfile\"][\"tmp_name\"];\r\n					\r\n					$inputFileType = PHPExcel_IOFactory::identify($fileName);\r\n					$Level = 0;\r\n					$Counter = 0;\r\n					$Stack = array();\r\n					\r\n					$q = \"SELECT * FROM Collection_403 WHERE 1\";			\r\n					$res= $dbh->query($q);\r\n					\r\n					$Templates = array();\r\n					while ($row = $res->fetchRow(MDB2_FETCHMDOE_ASSOC))\r\n					{\r\n							$Templates[$row[\'Collection_403_4\']] = $row[\'Collection_403_ID\'];\r\n					}//end while\r\n					\r\n					\r\n					if ($inputFileType == \'Excel2007\')\r\n					{\r\n				\r\n								$objReader = new PHPExcel_Reader_Excel2007();\r\n								$objReader->setReadDataOnly(true);\r\n								$objPHPExcel = $objReader->load($fileName);\r\n								\r\n								//$locatedSheet = $objPHPExcel->getSheetByName(\'ContentSheet\');\r\n								\r\n								//get the first sheet and start looping through the results\r\n								$ImportedData = array();\r\n								\r\n								$objWorksheet 		= $objPHPExcel->getActiveSheet();\r\n								$highestRow 		= $objWorksheet->getHighestRow(); // e.g. 10\r\n								$highestColumn 		= $objWorksheet->getHighestColumn(); // e.g \'F\'\r\n								$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); // e.g. 5\r\n								\r\n								\r\n								\r\n								//we skpi the first row\r\n								$firstRow = 2;\r\n								\r\n								for ($row = $firstRow; $row <= $highestRow; ++$row) {\r\n			 \r\n					 					$TheLevel = 0;\r\n										$CellValue = \'\';\r\n										while ($TheLevel <= $highestColumnIndex)\r\n										{\r\n											$CellValue = $objWorksheet->getCellByColumnAndRow($TheLevel, $row)->getValue();\r\n											if ($CellValue != \'\')\r\n											{\r\n													break;\r\n											}\r\n											$TheLevel++;\r\n										}\r\n										\r\n																			\r\n										\r\n										if ($CellValue != \'\' )\r\n										{\r\n											\r\n																			\r\n											$rowArray = array();\r\n											$rowArray[\'PageName\'] = $CellValue;\r\n											\r\n											//we need to search one more cell further to see if we have the type of page stored\r\n											$tmpTheLevel = $TheLevel + 1;\r\n											$PageType = $objWorksheet->getCellByColumnAndRow($tmpTheLevel, $row)->getValue();\r\n											\r\n											if ($PageType == \'\')\r\n											{\r\n													//we need to assign manually the level\r\n													if ($TheLevel == 0)\r\n													{\r\n															$PageType = \'HOME\';\r\n													}\r\n													else\r\n													{\r\n															if ($TheLevel == 1)\r\n															{\r\n																	$PageType = \'LANDER\';\r\n															}\r\n															else\r\n															{\r\n																	$PageType = \'CONTENT\';\r\n															}\r\n													}\r\n											}//end if finding the page type\r\n											\r\n											$rowArray[\'Template\'] = $PageType;\r\n											\r\n											if ($TheLevel == 1 || $TheLevel == 0)\r\n											{\r\n													$rowArray[\'ParentPageName\'] = \'\';\r\n													$TheLevel = 1;\r\n											}\r\n											else\r\n											{\r\n													$tmpTheLevel = $TheLevel - 1;\r\n													\r\n													$rowArray[\'ParentPage\'] = $Stack[$tmpTheLevel];\r\n													$rowArray[\'ParentPageName\'] = $ImportedData[$Stack[$tmpTheLevel]][\'PageName\'];\r\n											\r\n											}//end if the level is 1 or 2\r\n										\r\n																					\r\n										$ImportedData[$Counter] = $rowArray;\r\n										\r\n										//the next row can only have this item as the parent\r\n										$Stack[$TheLevel] = $Counter;\r\n										\r\n										$Counter++;\r\n										\r\n										\r\n										\r\n										\r\n										}//end if cell value is empty and we need to skip the row\r\n										\r\n								}//end loop through		\r\n								\r\n								\r\n								\r\n								if (count($ImportedData) == 0)\r\n								{\r\n									$errors[] = \"There is nothing to import. Please check the excel file.\";\r\n								}\r\n								else\r\n								{\r\n										foreach ($ImportedData as $k => $v)\r\n										{\r\n												//we need to check if we have a template\r\n												$q = \"SELECT * FROM Collection_403 WHERE Collection_403_4 = \'\". addslashes($v[\'Template\']) . \"\'\";\r\n												$res = $dbh->query($q);\r\n												\r\n												if ($res->numRows() == 0)\r\n												{\r\n														$ImportedData[$k][\'Errors\'][] = \'This item does not have a valid template. The file should be edited and reuploaded.\';\r\n												}\r\n											\r\n										}\r\n										\r\n										$smarty->assign(\'ImportedData\'		, $ImportedData);\r\n										$smarty->assign(\'Templates\'			, $Templates);\r\n										\r\n								}//end if we have something to import		\r\n								\r\n								\r\n								\r\n					}\r\n					else\r\n					{\r\n							$errors[] = \"The uploaded file type has to be in Excel2007 format.\";\r\n					}			//end if file type is not good\r\n					\r\n					\r\n					\r\n		\r\n		\r\n		}\r\n		else\r\n		{\r\n				$errors[] = \"There was a problem with the upload. Please try again.\";\r\n		\r\n		}//end if upload error\r\n\r\n}\r\n\r\n\r\n\r\n$smarty->assign(\'errors\',$errors);\r\n\r\n$page = array (\r\n			\"PageTitle\"    => \"Initial Content Upload\"\r\n 		);\r\n$smarty->assign(\"page\",$page);\r\n$smarty->display(ADMIN_APP_DIR.\'/site-map-builder-macro.html\');'),(9,'Content For Client Macro - Done','$page = array (\r\n			\"PageTitle\"    => \"Initial Content Upload - Done\"\r\n 		);\r\n$smarty->assign(\"page\",$page);\r\n$smarty->display(ADMIN_APP_DIR.\'/site-map-builder-macro-done.html\');'),(10,'Content Migrate','/*\r\n		Collection 400 is the collection that stores the whole content tree\r\n		Collection 403 is the collection used for defining all the page types\r\n		\r\n*/\r\n\r\n\r\n	\r\n$q = \"SELECT * FROM Collection_400 INNER JOIN Collection_403 ON Collection_403_ID = Collection_400_3 group by Collection_400_ID Order By Collection_400_1\";\r\n$allRows = $dbh->queryAll($q);\r\n\r\n$q = \"SELECT * FROM Collection_403 Order By Collection_403_1\";\r\n$allTemplates = $dbh->queryAll($q);\r\n\r\n$q = \"SELECT * FROM Collection_405 Order By Collection_405_1\";\r\n$allFieldRelations = $dbh->queryAll($q);\r\n\r\n$q = \"SELECT CollectionFieldID , CollectionFieldName FROM CollectionTaxonomy WHERE CollectionID = 13 Order By CollectionSortOrder  \";\r\n$allFieldRelationsContent = $dbh->getAssoc($q);\r\n\r\n$q = \"SELECT CollectionFieldID , CollectionFieldName FROM CollectionTaxonomy WHERE CollectionID = 400 Order By CollectionSortOrder \";\r\n$allFieldRelationsMigration = $dbh->getAssoc($q);\r\n\r\n$smarty->assign(\'allFieldRelations\',$allFieldRelations);\r\n$smarty->assign(\'allFieldRelationsContent\',$allFieldRelationsContent);\r\n$smarty->assign(\'allFieldRelationsMigration\',$allFieldRelationsMigration);\r\n\r\n$smarty->assign(\'allRows\',$allRows);	\r\n$smarty->assign(\'allTemplates\',$allTemplates);\r\n	\r\n$smarty->assign(\'errors\',$errors);\r\n$smarty->assign(\'ourTreeID\',400);\r\n\r\n\r\nif ($_POST[\'migrate\'] == 1)\r\n{\r\n		/* \r\n				we start migrating the content \r\n		*/\r\n		\r\n		 include_once $_SERVER[\"DOCUMENT_ROOT\"] .\"/classes/classTree.php\";\r\n		 $tree 					= new Tree(); \r\n		 $CID 					= 400;\r\n		 $collectionSettings  	= $api ->getCollectionSettings($CID);\r\n		\r\n		 $TreeSettings 			= $collectionSettings[9];\r\n		 $SCID 					= $TreeSettings[\'ParentMenuColumn\'];\r\n		 $DisplayColumn 		= $TreeSettings[\'DisplayColumn\'];\r\n		\r\n		 $tree->setup(\'Collection_\'.$CID , \'Collection_\'.$CID.\'_ID\' , \'Collection_\'.$CID.\'_\'.$DisplayColumn , \'Collection_\'.$CID.\'_\'.$SCID);\r\n		 \r\n		 $rootId = $tree -> getRootID();\r\n		 \r\n		 function getNodePath ($NodeID , $tree)\r\n		 {\r\n		 			$tmpCatId = $NodeID;\r\n					$pathArray = array();\r\n					$pathArray[] = $Node;\r\n					while ( $tmpCatId != $rootId )\r\n					{\r\n							$parentCategories = $tree -> getParentsForNode ($tmpCatId);\r\n										\r\n							if (count($parentCategories) == 0)\r\n							{\r\n								$tmpCatId = $rootId;\r\n							}\r\n							else\r\n							{\r\n								$tmpCatId = $parentCategories[0][\'CategoryID\'];\r\n								$pathArray[] = $tmpCatId;\r\n							}\r\n							\r\n					}\r\n						\r\n							\r\n					$tmp = array();\r\n					$k = 0;\r\n					for ($i = count ($pathArray); $i--; $i>-1)\r\n					{\r\n						$tmp[$k] = $pathArray[$i];\r\n						$k++;\r\n					}\r\n					\r\n					return $tmp;\r\n					\r\n		 }//end function \r\n		 \r\n		 function textToParagraph ($text)\r\n		 {\r\n		 		$t = \"\";\r\n				foreach(preg_split(\"/((\\r?\\n)|(\\r\\n?))/\", $text) as $line){\r\n					// do stuff with $line\r\n					if($line !=\'\')\r\n					$t .= \"<p>\".$line.\"</p>\\n\";\r\n				} \r\n				return $t;\r\n		 }\r\n		 \r\n		/*\r\n				STEP 1\r\n				initialize all variables that we are going to use\r\n				\r\n		*/\r\n		\r\n		$ContentIDs 	= array();\r\n		$PageIDs 		= array();\r\n		$SideMenuIDs 	= array();\r\n		$URLs 			= array();\r\n		$ParentsIDs		= array();\r\n		\r\n		$MigrateFieldName = $api->_getCollectionFieldName(405,2);\r\n		$ContentFieldName = $api->_getCollectionFieldName(405,3);\r\n		\r\n		/*\r\n				STEP 2\r\n				prepare URLs and an array that stores ID and Parent ID\r\n		*/\r\n		\r\n		foreach ($allRows as $k => $v)\r\n		{\r\n				$url 	= preg_replace(\'/[^a-zA-Z0-9\\s\\._\\-]/\', \'\', strtolower($v[\'Collection_400_4\']));\r\n				$url 	= str_replace(\' \',\'-\',$url);\r\n				$url 	= str_replace(\'--\',\'-\',$url);\r\n				\r\n				$URLs[$v[\'Collection_400_ID\']] = $url;\r\n				$ParentsIDs[$v[\'Collection_400_ID\']] = $v[\'Collection_400_2\'];\r\n				\r\n		}//end foreach\r\n		\r\n		foreach ($allTemplates  as $k => $v)\r\n		{\r\n				$Templates[$v[\'Collection_403_ID\']] = $v;\r\n		\r\n		}//end foreach\r\n		/*\r\n				STEP 3\r\n				We need to know if a row has children or not\r\n		*/\r\n		$tmp = array();\r\n		foreach ($ParentsIDs as $k => $v)\r\n		{\r\n				$tmp[intval($v)] = intval($k);\r\n		}//end foreach\r\n		unset($tmp[0]);\r\n		\r\n		$HasChildrenArray = $tmp;\r\n		\r\n		\r\n		/*\r\n				STEP 4\r\n				Loop through all the items and start creating content , pages and site menu items\r\n		*/\r\n		\r\n		\r\n		foreach ($allRows as $k => $v)\r\n		{\r\n				$CreateContent = 1;\r\n				$CreatePage = 1;\r\n				$CreateSiteMenu = 1;\r\n				$PageDuplicate = 0;\r\n				$SiteMenuDuplicate = 0;\r\n				\r\n				$thePath = getNodePath ($v[\'Collection_400_ID\'] , $tree);\r\n				\r\n				$url = \"\";\r\n				\r\n				foreach ($thePath as $kpath => $vpath)\r\n				{\r\n						if ($vpath == \"\")\r\n						{\r\n						\r\n						}\r\n						else\r\n						{\r\n								$url.= \"/\".$URLs[$vpath];\r\n						}\r\n				}\r\n				\r\n				$url.= \"/\".$URLs[$v[\'Collection_400_ID\']];\r\n				\r\n				$urlforpage = substr($url,1);\r\n				\r\n				if ($HasChildrenArray[$v[\'Collection_400_ID\']])\r\n				{\r\n					$url.= \"/\";\r\n				}\r\n				else\r\n				{\r\n					$url.= \".html\";\r\n				}\r\n				\r\n				print \"<h3>\".$v[\'Collection_400_1\'] . \"</h3>\";\r\n				//print_r($thePath);\r\n				//print \"<br/>\".$url . \"<hr/>\";\r\n				\r\n				//there is an exception to this URL creation way\r\n				//if the page type is external link then the URL will be the one that is found inside the first line of the body content field\r\n				if ($v[\'Collection_400_3\'] == 2)\r\n				{\r\n					$url = strtok($v[\'Collection_400_6\'], \"\\n\");\r\n					\r\n					//we will also set the flag to not create content and page\r\n					$CreateContent 		= 0;\r\n					$CreatePage 		= 0;\r\n					\r\n				}	\r\n				\r\n				//if the page type is of home type , then we need the url to be /\r\n				if ($v[\'Collection_400_3\'] == 4)\r\n				{\r\n					$url = \"/\";\r\n					$urlforpage = \"index\";\r\n				}	\r\n				\r\n				\r\n				//before we add, we need to make sure there is no other content that will share the same page url\r\n				//if yes, we will have to update that page / content\r\n				$q = \"SELECT * FROM Collection_17 INNER JOIN Collection_13 ON Collection_13_ID = Collection_17_6 WHERE Collection_17_3 = \'\".$urlforpage.\"\' \";\r\n				$res = $dbh->query($q);\r\n				if ($res->numRows() > 0)\r\n				{\r\n						$PageDuplicate = 1;\r\n						$theDuplicatePage = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n				}		\r\n				\r\n				//we also need to look for a duplicate site menu item\r\n				$q = \"SELECT * FROM Collection_276  WHERE Collection_276_2 = \'\".$url.\"\' \";\r\n				$res = $dbh->query($q);\r\n				if ($res->numRows() > 0)\r\n				{\r\n						$SiteMenuDuplicate = 1;\r\n						$theDuplicateSiteMenu = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n				}		\r\n				\r\n				/*\r\n						WE CREATE THE CONTENT\r\n				*/\r\n				$ContentID = NULL;\r\n				if ($CreateContent == 1)\r\n				{\r\n							$Content = array();\r\n							$Content[\'Collection_13_1\'] = \'CNT - \'. $v[\'Collection_400_1\'];\r\n							\r\n							foreach ($allFieldRelations as $ak =>$av)\r\n							{\r\n									$FN1 = $api->_getCollectionFieldName(13,$av[$ContentFieldName]);\r\n									$FN2 = $api->_getCollectionFieldName(400,$av[$MigrateFieldName]);\r\n									\r\n									//exception\r\n									if ($av[$ContentFieldName] == 6)\r\n									{\r\n										$Content[$FN1] = textToParagraph ($v[$FN2]);\r\n									}\r\n									else\r\n									{\r\n										$Content[$FN1] = $v[$FN2];\r\n									}	\r\n							}//end foreach\r\n							\r\n							\r\n							\r\n							//if there is a special code \r\n							$TemplateCode = $Templates[$v[$api->_getCollectionFieldName(400,3)]][$api->_getCollectionFieldName(403,7)] ;\r\n							if ($TemplateCode != \'\')\r\n							{\r\n									//we need to compile the template and get the content\r\n									$smarty->assign(\'content\',textToParagraph ($v[$api->_getCollectionFieldName(400,6)]));\r\n									$smarty->assign(\'otherContent\', $v);\r\n									$Content[$api->_getCollectionFieldName(13,6)] = $smarty->fetch(\'string:\'.$TemplateCode);\r\n							}\r\n							\r\n							//content fields based on page type\r\n							$Content[\'Collection_13_3\'] = $Templates[$v[$api->_getCollectionFieldName(400,3)]][$api->_getCollectionFieldName(403,6)];\r\n							$Content[\'Collection_13_4\'] = $Templates[$v[$api->_getCollectionFieldName(400,3)]][$api->_getCollectionFieldName(403,5)];\r\n							\r\n							\r\n							\r\n							if ($PageDuplicate == 0)\r\n							{\r\n								$ContentID = $dbh->extended->getBeforeID(\'Collection_13\');\r\n								$dbh-> extended->autoExecute(\'Collection_13\', $Content, MDB2_AUTOQUERY_INSERT);\r\n								$ContentID = $dbh->extended->getAfterID($ContentID, \'Collection_13\');\r\n							}\r\n							else\r\n							{\r\n								$dbh->extended->autoExecute(\'Collection_13\', $Content, MDB2_AUTOQUERY_UPDATE, \' Collection_13_ID = \' . $theDuplicatePage[\'Collection_13_ID\']);	\r\n								$ContentID = $theDuplicatePage[\'Collection_13_ID\'];\r\n							}	\r\n							\r\n							\r\n				}//end if create content\r\n				/*\r\n						WE CREATE THE PAGE\r\n				*/\r\n				if ($CreatePage == 1 && $ContentID != NULL)\r\n				{\r\n						$Page = array();\r\n						$Page[\'Collection_17_1\'] = \'CNT - \'.$v[\'Collection_400_1\'];\r\n						$Page[\'Collection_17_2\'] = $v[\'Collection_400_4\'];\r\n						$Page[\'Collection_17_3\'] = $urlforpage;\r\n						$Page[\'Collection_17_4\'] = 1;\r\n						$Page[\'Collection_17_5\'] = $Templates[$v[$api->_getCollectionFieldName(400,3)]][$api->_getCollectionFieldName(403,2)] ;\r\n						$Page[\'Collection_17_6\'] = $ContentID;\r\n						$Page[\'Collection_17_7\'] = NULL;\r\n						$Page[\'Collection_17_8\'] = NULL;\r\n						$Page[\'Collection_17_9\'] = date(time());\r\n						$Page[\'Collection_17_10\'] = \'on\';\r\n						\r\n						if ($PageDuplicate == 0)\r\n						{\r\n							$PageID = $dbh->extended->getBeforeID(\'Collection_17\');\r\n							$dbh-> extended->autoExecute(\'Collection_17\', $Page, MDB2_AUTOQUERY_INSERT);\r\n							$PageID = $dbh->extended->getAfterID($PageID, \'Collection_17\');\r\n						}\r\n						else\r\n						{\r\n							$dbh->extended->autoExecute(\'Collection_17\', $Page, MDB2_AUTOQUERY_UPDATE, \' Collection_17_ID = \' . $theDuplicatePage[\'Collection_17_ID\']);	\r\n							$PageID = $theDuplicatePage[\'Collection_17_ID\'];\r\n						}	\r\n				\r\n				}//end if\r\n				\r\n				/*\r\n						WE CREATE THE SITE MENU\r\n				*/\r\n				if ($CreateSiteMenu == 1)\r\n				{\r\n						$SiteMenu = array();\r\n						$SiteMenu[\'Collection_276_1\'] = $v[\'Collection_400_4\'];\r\n						$SiteMenu[\'Collection_276_2\'] = $url;\r\n						$SiteMenu[\'Collection_276_3\'] = NULL;\r\n						$SiteMenu[\'Collection_276_4\'] = \'on\';\r\n						$SiteMenu[\'Collection_276_5\'] = NULL;\r\n						$SiteMenu[\'Collection_276_6\'] = NULL;\r\n						$SiteMenu[\'Collection_276_7\'] = NULL;\r\n						$SiteMenu[\'Collection_276_8\'] = NULL;\r\n						$SiteMenu[\'Collection_276_9\'] = NULL;\r\n						\r\n						if ($v[\'Collection_400_3\'] == 2)\r\n						{\r\n							$SiteMenu[\'Collection_276_6\'] = \'on\';\r\n						}\r\n						\r\n						if ($SiteMenuDuplicate == 0 )\r\n						{\r\n							$SiteMenuID = $dbh->extended->getBeforeID(\'Collection_276\');\r\n							$dbh-> extended->autoExecute(\'Collection_276\', $SiteMenu, MDB2_AUTOQUERY_INSERT);\r\n							$SiteMenuID = $dbh->extended->getAfterID($SiteMenuID, \'Collection_276\');\r\n						}\r\n						else\r\n						{\r\n							$SiteMenuID = $theDuplicateSiteMenu[\'Collection_276_ID\'];\r\n							$dbh->extended->autoExecute(\'Collection_276\', $SiteMenu, MDB2_AUTOQUERY_UPDATE, \' Collection_276_ID = \' . $theDuplicateSiteMenu[\'Collection_276_ID\']);	\r\n						}\r\n						\r\n						//we need to store this value so we can create the site menu tree structure a little bit later\r\n						$SideMenuIDs[$v[\'Collection_400_ID\']]  = $SiteMenuID;\r\n				\r\n				}//end if create site menu\r\n				\r\n				\r\n				\r\n				\r\n				\r\n				\r\n		}//end foreach all rows\r\n		\r\n		\r\n		/*\r\n				STEP 5\r\n				Go over the site menu one more time to be able to recreate the content site menu\r\n		*/\r\n		foreach ($allRows as $k => $v)\r\n		{\r\n				$TheID = $v[\'Collection_400_ID\'];\r\n				$TheParentID = $v[\'Collection_400_2\'];\r\n				\r\n				if ($TheParentID > 0)\r\n				{\r\n						$TheSiteMenuID = $SideMenuIDs[$TheID];\r\n						$TheSiteMenuParentID = $SideMenuIDs[$TheParentID];\r\n						\r\n						\r\n						$q = \"UPDATE Collection_276 SET Collection_276_7 = \'\".$TheSiteMenuParentID.\"\' WHERE Collection_276_ID = \'\".$TheSiteMenuID.\"\' \";\r\n						$dbh->query($q);\r\n						\r\n				}\r\n		\r\n		}//end foreach \r\n		\r\n		header(\'Location: /\'.ADMIN_APP_DIR.\'/admin.php?menu_id=11&module_id=11&collectionid=90&colid=2&nd=1\');\r\n		die(\'done\');\r\n\r\n}//end we start migrating the content\r\n\r\n\r\n$page = array (\r\n			\"PageTitle\"    => \"Content Migration\"\r\n 		);\r\n		\r\n		\r\n$smarty->assign(\"page\",$page);\r\n$smarty->display(ADMIN_APP_DIR.\'/site-map-builder-migrate.html\');'),(11,'Content Migrate - Done','$page = array (\r\n			\"PageTitle\"    => \"Content Migrate - Done\"\r\n 		);\r\n$smarty->assign(\"page\",$page);\r\n$smarty->display(ADMIN_APP_DIR.\'/site-map-builder-migrate-done.html\');');

--
-- Table structure for table `Collection_91`
--

CREATE TABLE `Collection_91` (
  `Collection_91_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_91_1` varchar(254) DEFAULT NULL,
  `Collection_91_2` int(11) DEFAULT NULL,
  `Collection_91_3` text,
  PRIMARY KEY (`Collection_91_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_91`
--

INSERT INTO `Collection_91` VALUES (1,'Photo Gallery Template',81,'<script src=\"/js/gallery.js\" type=\"text/javascript\"></script>\r\n<script type=\"text/javascript\">\r\n\r\nvar GalleryPageNum = {{$pageNum}};\r\nvar GalleryPerPage = {{$perPage}};\r\nvar GalleryCollectionID = {{$collectionID}};\r\nvar GalleryOrderBy = \'{{$orderby}}\';\r\n\r\nvar GalleryFilterColumns = \'{{$filterID}}\';\r\nvar GalleryCurentImage   = 0;\r\n\r\nvar GalleryTnailColumn   = \'3\';\r\nvar GalleryImageColumn   = \'2\';\r\nvar GalleryAltColumn     = \'4\';\r\n\r\n{{assign var=TnailColumn value=3}}\r\n{{assign var=ImageColumn value=2}}\r\n{{assign var=AltColumn   value=4}}\r\n\r\n</script>\r\n<div id=\"mediaList\">\r\n{{o2templateDisplay template=2}}\r\n</div>'),(2,'Photo Gallery Pictures Display Template',81,'{{assign var=theLinks value=$links.links}}\r\n{{if $theLinks|@count gt 1}}\r\n{{if $links.pagePrevious neq false}}\r\n	<a href=\"javascript: window.GalleryPageNum= 1; getMedia(\'mediaList\' );\"  style=\"text-decoration:none; \">First</a>  \r\n{{/if}}\r\n{{if $links.pagePrevious neq false}}\r\n	<a href=\"javascript: window.GalleryPageNum= {{$links.pagePrevious}}; getMedia(\'mediaList\' );\"  style=\"text-decoration:none; \"><<</a>  \r\n{{/if}}\r\n{{foreach from=$theLinks item=v key=k name=n}}\r\n	{{if $v eq true}}\r\n		{{$k}}\r\n	{{else}}\r\n		<a href=\"javascript: window.GalleryPageNum= {{$k}}; getMedia(\'mediaList\' ); \" >{{$k}}</a>\r\n	{{/if}}\r\n	{{if !$smarty.foreach.n.last}} | {{/if}}\r\n{{/foreach}}\r\n{{if $links.pageNext neq false}}\r\n	  <a href=\"javascript: window.GalleryPageNum= {{$links.pageNext}}; getMedia(\'mediaList\' );\" style=\"text-decoration:none; \">>></a>\r\n{{/if}}\r\n{{if $links.pageNext neq false}}\r\n	  <a href=\"javascript:  window.GalleryPageNum= {{$links.pageLast}}; getMedia(\'mediaList\' );\" style=\"text-decoration:none; \">Last</a>\r\n{{/if}}\r\n\r\n{{/if}}\r\n<div><img src=\"/images/sep.gif\" height=\"5\"/></div>\r\n{{if $table|@count eq 0}}\r\n<center>There are no pictures into this category</center>\r\n{{else}}\r\n\r\n{{assign var=Tnail value=\'Collection_\'|concat:$collectionID|concat:\'_\'|concat:$TnailColumn}}\r\n{{assign var=Image value=\'Collection_\'|concat:$collectionID|concat:\'_\'|concat:$ImageColumn}}\r\n{{assign var=Alt   value=\'Collection_\'|concat:$collectionID|concat:\'_\'|concat:$AltColumn}}\r\n{{assign var=ID   value=\'Collection_\'|concat:$collectionID|concat:\'_ID\'}}\r\n\r\n				<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" {{if $table|@count gt 7}}width=\"100%\"{{/if}}>\r\n				<tr valign=\"top\">\r\n				{{foreach from=$table item=v key=k name=n}}					\r\n					{{if $smarty.foreach.n.index % 7 eq 0 and $smarty.foreach.n.iteration gt 1}}</tr><tr valign=\"top\">{{/if}}\r\n					<td>\r\n						<img src=\"{{$v.$Tnail}}\" id=\"image_{{$smarty.foreach.n.index}}\" title=\"{{$v.$Alt}}\" class=\"gallery\" onClick=\"showBigImage(\'{{$v.$Image}}\' , \'{{$v.$Alt}}\' , {{$smarty.foreach.n.index}} )\" />\r\n					</td>\r\n				{{/foreach}}\r\n				</tr>\r\n				</table>\r\n				{{assign var=v value=$table[0]}}\r\n				<div id=\"gallerybigimage\">\r\n				{{assign var=imageWidth value=$v.$Image|getWidth}}\r\n				<img src=\"{{$v.$Image}}\" title=\"{{$v.$Alt}}\" id=\"galleryselectedimage\" {{if $imageWidth gt 780}} width=\"780\"{{/if}}/>\r\n				</div>\r\n				<input type=\"hidden\" name=\"gallerypicturesnumber\" value=\"{{$table|@count}}\"/>\r\n{{/if}}\r\n\r\n'),(3,' Default - List Rows Template',NULL,'<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\r\n<tr valign=\"top\">\r\n{{foreach from=$ResultsTaxonomy item=vv key=kk}}\r\n	{{if $vv.CollectionHidden neq 1}}\r\n	<th>{{$vv.CollectionFieldName}}</th>\r\n	{{/if}}\r\n{{/foreach}}\r\n</tr>\r\n{{assign var=Prefix value=\"Collection_\"|concat:$ResultsCollectionID|concat:\"_\"}}\r\n{{foreach from=$Results item=v key=k name=n}}\r\n<tr valign=\"top\">\r\n	{{foreach from=$ResultsTaxonomy item=vv key=kk}}\r\n	{{if $vv.CollectionHidden neq 1}}\r\n		{{assign var=fieldName value=$Prefix|concat:$vv.CollectionFieldId}}\r\n	<td {{if $smarty.foreach.n.index % 2 eq 0}} class=\"odd\"{{else}} class=\"even\"{{/if}}>\r\n		{{if $vv.CollectionFieldLookupCollectionID gt 0}}\r\n			{{assign var=lookupValue value=$v.$fieldName}}\r\n			{{assign var=lookups value=$ResultsLookups[$fieldName]}}\r\n			{{$lookups.$lookupValue}}\r\n		{{else}}\r\n		{{$v.$fieldName}}\r\n		{{/if}}\r\n	</td>\r\n	{{/if}}\r\n{{/foreach}}\r\n</tr>\r\n{{/foreach}}\r\n</table>\r\n\r\n<div>\r\n{{assign var=Params value=$smarty.server.REQUEST_URI|explode:\"?\"}}\r\n{{if $Params|@count gt 1}}\r\n	{{assign var=sign value=\"&\"}}\r\n	{{assign var=ParamsTmp value=$Params[1]}}\r\n	{{assign var=Params value=$ParamsTmp|explode:\"&\"}}\r\n	{{assign var=First value=0}}\r\n	{{foreach from=$Params item=v key=k name=n}}\r\n		{{assign var=Tmp value=$v|explode:\"=\"}}\r\n		{{if $Tmp[0] neq \'pageNum\'}}\r\n			{{if $First eq 1}}{{assign var=QueryString value=$QueryString|concat:\"&\"}}{{else}}{{assign var=QueryString value=$QueryString|concat:\"?\"}}{{/if}}\r\n			{{assign var=First value=1}}\r\n			{{assign var=QueryString value=$QueryString|concat:$v}}\r\n		{{/if}}\r\n		\r\n	{{/foreach}}\r\n	\r\n	{{if $QueryString eq \'\'}}{{assign var=sign value=\"?\"}}{{/if}}\r\n	\r\n	\r\n{{else}}\r\n	{{assign var=sign value=\"?\"}}\r\n{{/if}}\r\n\r\n\r\n\r\n{{assign var=theLinks value=$PageResults.links}}\r\n{{if $theLinks|@count gt 1}}\r\n{{if $PageResults.pagePrevious neq false}}\r\n	<a href=\"{{$smarty.server.SCRIPT_URL}}{{$QueryString}}{{$sign}}pageNum=1\"  style=\"text-decoration:none; \">First</a>  \r\n{{/if}}\r\n{{if $PageResults.pagePrevious neq false}}\r\n	<a href=\"{{$smarty.server.SCRIPT_URL}}{{$QueryString}}{{$sign}}pageNum={{$PageResults.pagePrevious}}\"  style=\"text-decoration:none; \"><<</a>  \r\n{{/if}}\r\n{{foreach from=$theLinks item=v key=k name=n}}\r\n	{{if $v eq true}}\r\n		{{$k}}\r\n	{{else}}\r\n		<a href=\"{{$smarty.server.SCRIPT_URL}}{{$QueryString}}{{$sign}}pageNum={{$k}}\">{{$k}}</a>\r\n	{{/if}}\r\n	{{if !$smarty.foreach.n.last}} | {{/if}}\r\n{{/foreach}}\r\n{{if $PageResults.pageNext neq false}}\r\n	  <a href=\"{{$smarty.server.SCRIPT_URL}}{{$QueryString}}{{$sign}}pageNum={{$PageResults.pageNext}}\" style=\"text-decoration:none; \">>></a>\r\n{{/if}}\r\n{{if $PageResults.pageNext neq false}}\r\n	  <a href=\"{{$smarty.server.SCRIPT_URL}}{{$QueryString}}{{$sign}}pageNum={{$PageResults.pageLast}}\" style=\"text-decoration:none; \">Last</a>\r\n{{/if}}\r\n{{/if}}\r\n</div>'),(4,'Republics',NULL,'<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\r\n<tr valign=\"top\">\r\n{{foreach from=$ResultsTaxonomy item=vv key=kk}}\r\n	{{if $vv.CollectionHidden neq 1}}\r\n	<th>{{$vv.CollectionFieldName}}</th>\r\n	{{/if}}\r\n{{/foreach}}\r\n</tr>\r\n{{assign var=Prefix value=\"Collection_\"|concat:$ResultsCollectionID|concat:\"_\"}}\r\n{{foreach from=$Results item=v key=k name=n}}\r\n<tr valign=\"top\">\r\n	{{foreach from=$ResultsTaxonomy item=vv key=kk}}\r\n	{{if $vv.CollectionHidden neq 1}}\r\n		{{assign var=fieldName value=$Prefix|concat:$vv.CollectionFieldId}}\r\n	<td {{if $smarty.foreach.n.index % 2 eq 0}} class=\"odd\"{{else}} class=\"even\"{{/if}}>\r\n		{{if $vv.CollectionFieldLookupCollectionID gt 0}}\r\n			{{assign var=lookupValue value=$v.$fieldName}}\r\n			{{assign var=lookups value=$ResultsLookups[$fieldName]}}\r\n			{{$lookups.$lookupValue}}\r\n		{{else}}\r\n		{{$v.$fieldName}}\r\n		{{/if}}\r\n	</td>\r\n	{{/if}}\r\n{{/foreach}}\r\n</tr>\r\n{{/foreach}}\r\n</table>\r\n\r\n<div>\r\n{{assign var=Params value=$smarty.server.REQUEST_URI|explode:\"?\"}}\r\n{{if $Params|@count gt 1}}\r\n	{{assign var=sign value=\"&\"}}\r\n	{{assign var=ParamsTmp value=$Params[1]}}\r\n	{{assign var=Params value=$ParamsTmp|explode:\"&\"}}\r\n	{{assign var=First value=0}}\r\n	{{foreach from=$Params item=v key=k name=n}}\r\n		{{assign var=Tmp value=$v|explode:\"=\"}}\r\n		{{if $Tmp[0] neq \'pageNum\'}}\r\n			{{if $First eq 1}}{{assign var=QueryString value=$QueryString|concat:\"&\"}}{{else}}{{assign var=QueryString value=$QueryString|concat:\"?\"}}{{/if}}\r\n			{{assign var=First value=1}}\r\n			{{assign var=QueryString value=$QueryString|concat:$v}}\r\n		{{/if}}\r\n		\r\n	{{/foreach}}\r\n	\r\n	{{if $QueryString eq \'\'}}{{assign var=sign value=\"?\"}}{{/if}}\r\n	\r\n	\r\n{{else}}\r\n	{{assign var=sign value=\"?\"}}\r\n{{/if}}\r\n\r\n\r\n\r\n{{assign var=theLinks value=$PageResults.links}}\r\n{{if $theLinks|@count gt 1}}\r\n{{if $PageResults.pagePrevious neq false}}\r\n	<a href=\"{{$smarty.server.SCRIPT_URL}}{{$QueryString}}{{$sign}}pageNum=1\"  style=\"text-decoration:none; \">First</a>  \r\n{{/if}}\r\n{{if $PageResults.pagePrevious neq false}}\r\n	<a href=\"{{$smarty.server.SCRIPT_URL}}{{$QueryString}}{{$sign}}pageNum={{$PageResults.pagePrevious}}\"  style=\"text-decoration:none; \"><<</a>  \r\n{{/if}}\r\n{{foreach from=$theLinks item=v key=k name=n}}\r\n	{{if $v eq true}}\r\n		{{$k}}\r\n	{{else}}\r\n		<a href=\"{{$smarty.server.SCRIPT_URL}}{{$QueryString}}{{$sign}}pageNum={{$k}}\">{{$k}}</a>\r\n	{{/if}}\r\n	{{if !$smarty.foreach.n.last}} | {{/if}}\r\n{{/foreach}}\r\n{{if $PageResults.pageNext neq false}}\r\n	  <a href=\"{{$smarty.server.SCRIPT_URL}}{{$QueryString}}{{$sign}}pageNum={{$PageResults.pageNext}}\" style=\"text-decoration:none; \">>></a>\r\n{{/if}}\r\n{{if $PageResults.pageNext neq false}}\r\n	  <a href=\"{{$smarty.server.SCRIPT_URL}}{{$QueryString}}{{$sign}}pageNum={{$PageResults.pageLast}}\" style=\"text-decoration:none; \">Last</a>\r\n{{/if}}\r\n{{/if}}\r\n</div>'),(5,'Video - Display Page',50,'{{if $Results|@count eq 0}}\r\n<center><h3>There are no videos to show for the moment</h3></center>\r\n{{else}}\r\n		{{capture name=jsinclude assign=JavaScriptJQueryIncludeCode}}\r\n				<script type=\"text/javascript\" src=\"/js/video/jquery.jwplayer.js\"></script>\r\n\r\n		{{/capture}}\r\n		{{capture name=jscode assign=JavaScriptJQueryCode}}\r\n\r\n						\r\n							$(\".siteVideo\").css({ cursor: \'pointer\'});\r\n							$(\".siteVideo\").each(function(){\r\n							\r\n								$(this).click(function(event){ \r\n											\r\n									var html 	= \'<video src=\"\'+$(this).attr(\'vsrc\')+\'\" height=\"\'+$(this).attr(\'vheight\')+\'\" id=\"o2player\" poster=\"\'+$(this).attr(\'vimg\')+\'\" width=\"\'+$(this).attr(\'vwidth\')+\'\"></video>\';\r\n									\r\n									\r\n									$(\'#o2player\').remove();\r\n									$(\'#videocontainer\').html(html);				\r\n\r\n									$(\'#o2player\').jwplayer({\r\n											flashplayer:\'/js/video/player.swf\',\r\n											skin:\'/js/video/five/five.xml\'\r\n									  });\r\n\r\n									\r\n										 \r\n								}); //end on click	\r\n						});\r\n						\r\n						$(\'#o2player\').jwplayer({\r\n											flashplayer:\'/js/video/player.swf\',\r\n											skin:\'/js/video/five/five.xml\'\r\n									  });\r\n										\r\n					\r\n    \r\n		{{/capture}}\r\n		\r\n		<table cellpadding=\"4\" cellspacing=\"4\" border=\"0\" width=\"100%\">\r\n		<tr valign=\"top\">\r\n		{{foreach from=$Results item=v key=k name=n}}  \r\n			{{if $smarty.foreach.n.index eq 0}}{{assign var=SelectedVideo value=$v}}{{/if}}\r\n			{{if $smarty.get.video eq $v.Collection_50_ID}}{{assign var=SelectedVideo value=$v}}{{/if}}\r\n			{{if $smarty.foreach.n.index gt 0 and $smarty.foreach.n.index % 5 eq 0}}</tr><tr valign=\"top\">{{/if}}\r\n			<td align=\"center\"><img class=\"siteVideo\" src=\"{{$v.Collection_50_5}}\" vsrc=\"{{$v.Collection_50_3}}\" vimg=\"{{$v.Collection_50_4}}\" alt=\"{{$v.Collection_50_1|addslashes}}\" vheight=\"{{$v.Collection_50_4|getHeight}}\" vwidth=\"{{$v.Collection_50_4|getWidth}}\" id=\"siteVideo{{$v.Collection_50_ID}}\"/><br/><p align=\"center\"><font size=\"-2\">{{$v.Collection_50_1}}</font></p></td>\r\n		{{/foreach}}\r\n		</tr>\r\n		</table>\r\n		<div id=\"videocontainer\"><video src=\"{{$SelectedVideo.Collection_50_3}}\" height=\"{{$SelectedVideo.Collection_50_4|getHeight}}\" id=\"o2player\" poster=\"{{$SelectedVideo.Collection_50_4}}\" width=\"{{$SelectedVideo.Collection_50_4|getWidth}}\"></video></div>\r\n{{/if}}'),(6,'Photo Gallery JQuery',81,'{{capture name=galeryincludes assign=tmp}}\r\n<link href=\"/style/jquery.gallery.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\">\r\n<link href=\"/style/jquery.select.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\">\r\n<script type=\"text/javascript\" src=\"/js/jquery.gallery.js\"></script>\r\n<script type=\"text/javascript\" src=\"/js/jquery.scrollcycle.js\"></script>\r\n<script type=\"text/javascript\" src=\"/js/jquery.select.js\"></script>\r\n{{/capture}}\r\n{{assign var=JavaScriptJQueryIncludeCode value=$JavaScriptJQueryIncludeCode|concat:\' \'|concat:$tmp}}\r\n{{capture name=galeryincludejs assign=tmp}}\r\n		\r\n		$(\"#galleryscroller\").jCarouselLite({\r\n			btnNext: \"#scrollRight\",\r\n			btnPrev: \"#scrollLeft\",\r\n			visible: {{if $table|@count gt 7}}7{{else}}{{math equation=\'x-1\' x=$table|@count}}{{/if}},\r\n			auto: 3000,\r\n			autoStart: false,\r\n			autoStartText: \'View Slideshow\',\r\n			autoStopText: \'Stop Slideshow\',\r\n			autoID: \'#galleryslideshow\',\r\n			speed: 500,\r\n			beforeStart: function(a) {\r\n           				\r\n						$.galleria.next();\r\n						\r\n       		}\r\n\r\n		});\r\n\r\n		\r\n		$(\'ul.gallerylist\').galleria({\r\n			history   : false, // activates the history object for bookmarking, back-button etc.\r\n			clickNext : true, // helper for making the image clickable\r\n			insert    : \'#main_gallery_image\', // the containing selector for our main image\r\n			onImage   : function(image,caption,thumb) { // let\'s add some image effects for demonstration purposes\r\n				\r\n				// fade in the image & caption\r\n				if(! ($.browser.mozilla && navigator.appVersion.indexOf(\"Win\")!=-1) ) { // FF/Win fades large images terribly slow\r\n					image.css(\'display\',\'none\').fadeIn(1000);\r\n				}\r\n				caption.css(\'display\',\'none\').fadeIn(1000);\r\n				\r\n				// fetch the thumbnail container\r\n				var _li = thumb.parents(\'li\');\r\n				\r\n				// fade out inactive thumbnail\r\n				_li.siblings().children(\'img.selected\').fadeTo(500,0.3);\r\n				\r\n				// fade in active thumbnail\r\n				thumb.fadeTo(\'fast\',1).addClass(\'selected\');\r\n				\r\n				// add a title for the clickable image\r\n				image.attr(\'title\',\'Next image >>\');\r\n			},\r\n			onThumb : function(thumb) { // thumbnail effects goes here\r\n				\r\n				// fetch the thumbnail container\r\n				var _li = thumb.parents(\'li\');\r\n				\r\n				// if thumbnail is active, fade all the way.\r\n				var _fadeTo = _li.is(\'.active\') ? \'1\' : \'0.3\';\r\n				\r\n				// fade in the thumbnail when finnished loading\r\n				thumb.css({display:\'none\',opacity:_fadeTo}).fadeIn(1500);\r\n				\r\n				// hover effects\r\n				thumb.hover(\r\n					function() { thumb.fadeTo(\'fast\',1); },\r\n					function() { _li.not(\'.active\').children(\'img\').fadeTo(\'fast\',0.3); } // don\'t fade out if the parent is active\r\n				)\r\n			}\r\n		});\r\n			\r\n		$(\"#gallerychooser\").selectbox({ onselectchange : function() { var obj = document.getElementById(\'gallerychooser\'); window.location = \'/photo-gallery/\'+obj.options[obj.selectedIndex].value+\'.html\'; } });\r\n{{/capture}}\r\n{{assign var=JavaScriptJQueryCode value=$JavaScriptJQueryCode|concat:\' \'|concat:$tmp}}\r\n{{if $table|@count eq 0}}\r\n<center>There are no pictures into this category</center>\r\n{{else}}\r\n{{assign var=Tnail value=\'Collection_\'|concat:$tableCollectionID|concat:\'_\'|concat:3}}\r\n{{assign var=Image value=\'Collection_\'|concat:$tableCollectionID|concat:\'_\'|concat:3}}\r\n{{assign var=Alt   value=\'Collection_\'|concat:$tableCollectionID|concat:\'_\'|concat:4}}\r\n{{assign var=ID   value=\'Collection_\'|concat:$tableCollectionID|concat:\'_ID\'}}\r\n\r\n<div id=\"photogallery\">\r\n<div id=\"main_gallery_image\"></div>\r\n\r\n<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"imageListContainer\"><tr valign=\"top\">\r\n<td><span id=\"scrollLeft\" class=\"arrow\"><</span></td>\r\n<td>\r\n<div id=\"galleryscroller\">\r\n<ul class=\"gallerylist\" >\r\n{{foreach from=$table item=v key=k name=n}}\r\n<li {{if $smarty.foreach.n.first}}class=\"active\"{{/if}}><img src=\"{{$v.$Image}}\" alt=\"{{$v.$Alt}}\" title=\"{{$v.$Alt}}\"></li>\r\n{{/foreach}}\r\n</ul>\r\n</div>\r\n</td>\r\n<td><span id=\"scrollRight\" class=\"arrow\">></span></td>\r\n</tr></table>\r\n</div>\r\n<div id=\"galleryslideshow\">View Slideshow</div>\r\n{{/if}}\r\n'),(7,'Rss feed for Twitter',NULL,'{{assign var=Prefix value=\"Collection_\"|concat:$ResultsCollectionID|concat:\"_\"}}\r\n{{foreach from=$Results item=v key=k name=n}}\r\n	{{assign var=RssName value=$Prefix|concat:\"1\"}}\r\n	{{assign var=RssUrl  value=$Prefix|concat:\"2\"}}\r\n	{{assign var=RssLimit  value=$Prefix|concat:\"3\"}}\r\n	{{assign var=RssID value=$Prefix|concat:\"ID\"}}\r\n	{{assign var=Limit value=$v.$RssLimit}}\r\n<div id=\"rss_{{$v.$RssID}}\" class=\"rssContainer\">\r\n	{{rssRead url=$v.$RssUrl var=RssData CollectionID=$ResultsCollectionID RowID=$v.$RssID}}\r\n	{{if $RssData.Items|@count eq 0}}\r\n		{{rssRead url=$v.$RssUrl var=RssData CollectionID=$ResultsCollectionID RowID=$v.$RssID}}\r\n	{{/if}}\r\n	{{if $RssData.Items|@count eq 0}}\r\n		{{rssRead url=$v.$RssUrl var=RssData CollectionID=$ResultsCollectionID RowID=$v.$RssID}}\r\n	{{/if}}\r\n	{{foreach from=$RssData.Items item=vv key=kk name=nn}}\r\n	{{if $smarty.foreach.nn.index lt $Limit or $Limit eq \'\' or $Limit eq 0}}\r\n	<div class=\"twitterdatalist\">\r\n	<p>{{$vv.title|findLinks}} {{*<a href=\"{{$vv.link}}\" target=\"_blank\">{{$vv.link|truncate:25:\"...\":true}}</a>*}}</p>\r\n	<label>about {{$vv.date_timestamp|timeAgo|lower}}</label></div>\r\n	{{/if}}	\r\n	{{/foreach}}\r\n</div>\r\n\r\n{{/foreach}}'),(8,'RSS feed for Blog',NULL,'{{assign var=Prefix value=\"Collection_\"|concat:$ResultsCollectionID|concat:\"_\"}}\r\n{{foreach from=$Results item=v key=k name=n}}\r\n	{{assign var=RssName value=$Prefix|concat:\"1\"}}\r\n	{{assign var=RssUrl  value=$Prefix|concat:\"2\"}}\r\n	{{assign var=RssLimit  value=$Prefix|concat:\"3\"}}\r\n	{{assign var=RssID value=$Prefix|concat:\"ID\"}}\r\n	{{assign var=Limit value=$v.$RssLimit}}\r\n<div id=\"rss_{{$v.$RssID}}\" class=\"rssContainer\">\r\n	{{rssRead url=$v.$RssUrl var=RssData CollectionID=$ResultsCollectionID RowID=$v.$RssID}}\r\n	{{if $RssData.Items|@count eq 0}}\r\n		{{rssRead url=$v.$RssUrl var=RssData CollectionID=$ResultsCollectionID RowID=$v.$RssID}}\r\n	{{/if}}\r\n	{{if $RssData.Items|@count eq 0}}\r\n		{{rssRead url=$v.$RssUrl var=RssData CollectionID=$ResultsCollectionID RowID=$v.$RssID}}\r\n	{{/if}}\r\n	{{foreach from=$RssData.Items item=vv key=kk name=nn}}\r\n	{{if $smarty.foreach.nn.index lt $Limit or $Limit eq \'\' or $Limit eq 0}}\r\n	<div class=\"twitterdatalist\">\r\n	<p>{{$vv.title|findLinks}} <a href=\"{{$vv.link}}\" target=\"_blank\">{{$vv.link|truncate:25:\"...\":true}}</a></p>\r\n	<label>about {{$vv.date_timestamp|timeAgo|lower}}</label></div>\r\n	{{/if}}	\r\n	{{/foreach}}\r\n</div>\r\n\r\n{{/foreach}}');

--
-- Table structure for table `Collection_92`
--

CREATE TABLE `Collection_92` (
  `Collection_92_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_92_1` varchar(254) DEFAULT NULL,
  `Collection_92_2` text,
  PRIMARY KEY (`Collection_92_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_92`
--

INSERT INTO `Collection_92` VALUES (1,'Lookup for Row Level Access','						\r\n						$fieldId 			= $v[\'FieldID\'];\r\n						$fieldTaxonomy 		= $api -> getFieldTaxonomy($CollectionID , $fieldId);\r\n						$fieldCollectionID 	= $fieldTaxonomy[\'CollectionFieldLookupCollectionID\'];\r\n						$fieldLookupColumn 	= $api ->getCollection($fieldCollectionID);\r\n						$fieldLookupColumn  = $fieldLookupColumn[0][\'LookupColumn\'];\r\n						\r\n						$queryArray 		= array(\'collection_id\'=>$fieldCollectionID ,\r\n													\'orderby\' => $fieldLookupColumn ,\r\n													\'desc\' => 0 \r\n													);\r\n						if(!$admin)\r\n						{\r\n							$queryArray[\'userId\']=$user_id;\r\n						}\r\n						\r\n						\r\n						\r\n						$fTable = $api->Filter($queryArray);\r\n						$fResults = $fTable[\'Results\'];\r\n						$smarty->assign(\'fResults\' , $fResults);\r\n						$fFieldName = $api -> _getCollectionFieldName($fieldCollectionID , $fieldLookupColumn);\r\n						$smarty->assign(\'fFieldName\' , $fFieldName);\r\n						$fFieldId = $api -> _getCollectionFieldName($fieldCollectionID , \'ID\');\r\n						$smarty->assign(\'fFieldId\' , $fFieldId);\r\n						\r\n						$actFieldName = $api -> _getCollectionFieldName($CollectionID , $fieldId);\r\n						$smarty->assign(\'actFieldName\' , $actFieldName);\r\n						\r\n						\r\n						$displayfields[$fieldId] = $smarty->fetch(ADMIN_APP_DIR.\"/lookupForRowLevel.html\");\r\n						\r\n						\r\n						'),(2,'Toolbar For Fck Editor and Row Level Users','$fieldId      = $v[\'FieldID\'];\r\n$fieldTaxonomy    = $api -> getFieldTaxonomy($CollectionID , $fieldId);\r\n$fieldCollectionID  = $fieldTaxonomy[\'CollectionFieldLookupCollectionID\'];\r\n\r\n$actFieldName = $api -> _getCollectionFieldName($CollectionID , $fieldId);\r\n$smarty->assign(\'actFieldName\' , $actFieldName);\r\n\r\ninclude_once $_SERVER[\'DOCUMENT_ROOT\'].\"/\".ADMIN_APP_DIR.\"/editor/ckeditor.php\";\r\n$CKEditorDisplay = new CKEditor();\r\n \r\n$CKEditorDisplay->basePath      = \'/\'.ADMIN_APP_DIR.\'/editor/\' ;\r\n$CKEditorDisplay->returnOutput  = true;\r\n    \r\n$CKEditorDisplay->config[\'width\'] = \'100%\';\r\n$CKEditorDisplay->config[\'height\'] = 450; \r\n$CKEditorDisplay->initialized = true;\r\n$CKEditorDisplay = CKeditorConfigSettings ($CKEditorDisplay);\r\n\r\n\r\n$CKEditorDisplay->config[\'contentsCss\'] = \"/content.css\";\r\n       \r\n      \r\n/*\r\nif ($CollectionID == 13 && $selectedRow[\'Collection_13_3\'] == 3)\r\n{\r\n  $CKEditorDisplay->config[\'fullPage\'] = true;\r\n}\r\n*/\r\n\r\nif(!$admin)\r\n{ \r\n  $CKEditorDisplay->config[\'toolbar\'] = \"RowLevel\";\r\n}\r\n\r\n    if ($_POST[$actFieldName] != \'\' )\r\n    {\r\n        $theValue =  $_POST[$actFieldName];\r\n    }\r\n    else\r\n    {\r\n        $theValue =  $selectedRow[$actFieldName]; \r\n    }\r\n\r\nif ($CollectionID == 13 && ( $selectedRow[\'Collection_13_3\'] == 3 || $selectedRow[\'Collection_13_4\'] == 3 ))\r\n{\r\n  $displayfields[$fieldId] = \'<textarea wrap=\"off\" class=\"input\" style=\"width: 100%; height: 450px\" id=\"\'.$actFieldName.\'\" name=\"\'.$actFieldName.\'\">\'.$theValue.\'</tex\'.\'\'.\'tarea>\';\r\n}\r\nelse\r\n{\r\n  $displayfields[$fieldId] = $CKEditorDisplay->editor($actFieldName, $theValue);\r\n}\r\n'),(3,'Selectbox With Values from 1 to 30','$fieldId 			= $v[\'FieldID\'];\r\n												\r\n						$tmpArray = array();\r\n						for ($i = 1 ; $i<31; $i++)\r\n						{\r\n							$tmpArray[$i] = $i;\r\n						}\r\n						$smarty->assign(\'fResults\' , $tmpArray);\r\n						$actFieldName = $api -> _getCollectionFieldName($CollectionID , $fieldId);\r\n						$smarty->assign(\'actFieldName\' , $actFieldName);\r\n						\r\n						$displayfields[$fieldId] = $smarty->fetch(ADMIN_APP_DIR.\"/calendar/period.html\");'),(4,'Color Picker','$fieldId 			= $v[\'FieldID\'];\r\n$fFieldName = $api -> _getCollectionFieldName($CollectionID , $fieldId);\r\n$string = \'<input type=\"text\" class=\"input\" style=\"width:60px; \" name=\"\'.$fFieldName.\'\" id=\"\'.$fFieldName.\'\" value=\"\'.$selectedRow[$fFieldName].\'\"/>\';\r\nif ($selectedRow[$fFieldName] != \'\')\r\n	$color = $selectedRow[$fFieldName];\r\nelse\r\n	$color = \'ffffff\';	\r\n$string .= \'<style type=\"text/css\">#ColorPicker_\'.$fFieldName.\' { width: 36px;	height: 36px;	 background: url(images/colorpicker/select2.png); cursor:pointer; background-position:-4px -4px;} </style>\';\r\n$string .= \'<style type=\"text/css\">#ColorPicker_\'.$fFieldName.\' div { width: 28px;	height: 28px;   background: url(images/colorpicker/select2.png); background-position:-4px -4px; } </style>\';\r\n\r\n$string .= \'<div id=\"ColorPicker_\'.$fFieldName.\'\"><div style=\"background-color: #\'.$color .\'\"></div></div>\';\r\n$displayfields[$fieldId] = $smarty->fetch(\'string:\'.$string);					'),(5,'Lookup for Event Type','						\r\n						$fieldId 			= $v[\'FieldID\'];\r\n						$fieldTaxonomy 		= $api -> getFieldTaxonomy($CollectionID , $fieldId);\r\n						$fieldCollectionID 	= $fieldTaxonomy[\'CollectionFieldLookupCollectionID\'];\r\n						$fieldLookupColumn 	= $api ->getCollection($fieldCollectionID);\r\n						$fieldLookupColumn  = $fieldLookupColumn[0][\'LookupColumn\'];\r\n						\r\n						$queryArray 		= array(\'collection_id\'=>$fieldCollectionID ,\r\n													\'orderby\' => $fieldLookupColumn ,\r\n													\'desc\' => 0 \r\n													);\r\n						if(!$admin)\r\n						{\r\n							$queryArray[\'userId\']=$user_id;\r\n						}\r\n						$fTable = $api->Filter($queryArray);\r\n						$fResults = $fTable[\'Results\'];\r\n						$smarty->assign(\'fResults\' , $fResults);\r\n						$fFieldName = $api -> _getCollectionFieldName($fieldCollectionID , $fieldLookupColumn);\r\n						$smarty->assign(\'fFieldName\' , $fFieldName);\r\n						$fFieldId = $api -> _getCollectionFieldName($fieldCollectionID , \'ID\');\r\n						$smarty->assign(\'fFieldId\' , $fFieldId);\r\n						$fFieldColor = $api -> _getCollectionFieldName($fieldCollectionID , \'3\');\r\n						$smarty->assign(\'fFieldColor\' , $fFieldColor);\r\n						\r\n						$actFieldName = $api -> _getCollectionFieldName($CollectionID , $fieldId);\r\n						$smarty->assign(\'actFieldName\' , $actFieldName);\r\n						\r\n						$displayfields[$fieldId] = $smarty->fetch(ADMIN_APP_DIR.\"/calendar/lookupForEventType.html\");\r\n						\r\n						\r\n						');

--
-- Table structure for table `Collection_93`
--

CREATE TABLE `Collection_93` (
  `Collection_93_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_93_1` varchar(254) DEFAULT NULL,
  `Collection_93_2` text,
  PRIMARY KEY (`Collection_93_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Collection_93`
--

INSERT INTO `Collection_93` VALUES (3,'Event Default Start Date','{{if $smarty.get.esd gt 0}}\r\n$(\'#{{$fieldName}}\').val(\'{{$smarty.get.esd}}\');\r\n$(\'#Fake_{{$fieldName}}\').val(\'{{$smarty.get.esd|date_format:\"%m/%d/%Y %I:%M%p\"}}\');\r\n{{/if}}\r\n{{if $smarty.get.hsd eq 1}}\r\n$(\'#{{$fieldName}}_row\').css({display:\'none\'});\r\n{{/if}}'),(4,'Event Default End Date','{{if $smarty.get.eed gt 0}}\r\n$(\'#{{$fieldName}}\').val(\'{{$smarty.get.eed}}\');\r\n$(\'#Fake_{{$fieldName}}\').val(\'{{$smarty.get.eed|date_format:\"%m/%d/%Y %I:%M%p\"}}\');\r\n{{/if}}\r\n{{if $smarty.get.hed eq 1}}\r\n$(\'#{{$fieldName}}_row\').css({display:\'none\'});\r\n{{/if}}'),(5,'Color Picker','$(\'#ColorPicker_{{$fieldName}}\').ColorPicker({\r\n			onSubmit: function(hsb, hex, rgb) {\r\n				$(\'#{{$fieldName}}\').val(hex);\r\n				$(\'#ColorPicker_{{$fieldName}} div\').css(\'backgroundColor\', \'#\' + hex);\r\n			},\r\n			onShow: function (colpkr) {\r\n				$(colpkr).fadeIn(500);\r\n				return false;\r\n			},\r\n			onHide: function (colpkr) {\r\n				$(colpkr).fadeOut(500);\r\n				return false;\r\n			},\r\n			onBeforeShow: function () {\r\n				$(this).ColorPickerSetColor($(\'#{{$fieldName}}\').val());\r\n			}\r\n		})\r\n		.bind(\'keyup\', function(){\r\n			$(this).ColorPickerSetColor(this.value);\r\n		});\r\n		\r\n		$(\'#{{$fieldName}}\').ColorPicker({\r\n			onSubmit: function(hsb, hex, rgb) {\r\n				$(\'#{{$fieldName}}\').val(hex);\r\n				$(\'#ColorPicker_{{$fieldName}} div\').css(\'backgroundColor\', \'#\' + hex);\r\n			},\r\n			onShow: function (colpkr) {\r\n				$(colpkr).fadeIn(500);\r\n				return false;\r\n			},\r\n			onHide: function (colpkr) {\r\n				$(colpkr).fadeOut(500);\r\n				return false;\r\n			},\r\n			onBeforeShow: function () {\r\n				$(this).ColorPickerSetColor($(\'#{{$fieldName}}\').val());\r\n			}\r\n		})\r\n		.bind(\'keyup\', function(){\r\n			$(this).ColorPickerSetColor(this.value);\r\n		});'),(6,'Event Type Change','$(\'#{{$fieldName}}\').change( function() {\r\n  var obj = $(this).selectedOptions().each(function(index){\r\n  			 $(\'#Collection_236_20\').val($(this).attr(\'colorcode\'));\r\n  }); \r\n});\r\n'),(8,'Auto Complete for Site Menu','function formatItem(row) {\r\n	return row[0];\r\n}\r\n\r\nfunction findValue(li) {\r\n	if( li == null ) return;\r\n\r\n	// if coming from an AJAX call, let\'s use the CityId as the value\r\n	if( !!li.extra ) var sValue = li.extra[0];\r\n\r\n	// otherwise, let\'s just display the value in the text box\r\n	else var sValue = li.selectValue;\r\n\r\n	\r\n}\r\n\r\nfunction selectItem(li) {\r\n	findValue(li);\r\n}\r\n\r\n\r\n\r\nvar ac = $(\'#{{$fieldName}}\').autocomplete(\"/{{$smarty.const.ADMIN_APP_DIR}}/autocomplete_backend.php\", { delay:10,\r\n			minChars:1,\r\n			matchSubset:1,\r\n			matchContains:1,\r\n			cacheLength:10,\r\n			onItemSelect:selectItem,\r\n			onFindValue:findValue,\r\n			formatItem:formatItem,\r\n			autoFill:true\r\n });\r\n $(\'#{{$fieldName}}\').parent().append(\'<img src=\"/{{$smarty.const.ADMIN_APP_DIR}}/images/arrow.gif\" id=\"{{$fieldName}}_ac\" value=\"find\"/>\');\r\n $(\'#{{$fieldName}}_ac\').click(function(){\r\n		ac[0].autocompleter.getResults();\r\n });\r\n $(\'#{{$fieldName}}_ac\').css(\'cursor\', \'pointer\');'),(9,'Tree Tool','$(\'#{{$fieldName}}\').parent().append(\'<div id=\"tree{{$fieldName}}\"></div>\');\r\n$(\'#tree{{$fieldName}}\').append(\'<div><input type=\"checkbox\" id=\"treeroot{{$fieldName}}\"/> This row will not have any parent</div>\');\r\n$(\'#tree{{$fieldName}}\').append(\'<div id=\"actree{{$fieldName}}\"></div>\');\r\nvar html = $.ajax({\r\n  url: \"/system/treeview.html\",\r\n  data: \"treeid={{$collection}}&eid={{$smarty.get.eid}}&frontendadmin=1\",\r\n  async: false\r\n }).responseText;\r\n \r\n $(\'#actree{{$fieldName}}\').html(html);\r\n \r\n $(\"#actree{{$fieldName}} ul\").treeview({\r\n		persist: \"location\",\r\n		collapsed: true,\r\n		unique: true,\r\n		toggle: function() {}\r\n	});\r\n	\r\n	{{if $smarty.get.eid gt 0}}\r\n		$(\"#{{$fieldName}}\").removeOption(\"{{$smarty.get.eid}}\");\r\n	{{else}}\r\n		$(\'#treeroot{{$fieldName}}\').attr(\'checked\', true);\r\n	{{/if}}\r\n	\r\n	{{if $fieldValue eq \'\'}}$(\'#treeroot{{$fieldName}}\').attr(\'checked\', true);\r\n	{{else}}\r\n	$(\"#actree{{$fieldName}} ul a[itemid={{$fieldValue}}]\").addClass(\'curentlyselected\');\r\n	{{/if}}\r\n	\r\n	$(\"#actree{{$fieldName}} ul a[itemid]\").each(function(){\r\n	\r\n			var notselectable = $(this).attr(\'notselectable\');\r\n			if (notselectable == 1) {  $(this).addClass(\'notselectable\'); }\r\n	\r\n			$(this).click(function(){\r\n					var itemid 		  = $(this).attr(\'itemid\');\r\n					var notselectable = $(this).attr(\'notselectable\');					\r\n					if (notselectable == 0)\r\n					{\r\n						$(\"#actree{{$fieldName}} ul a[itemid]\").removeClass(\'curentlyselected\');\r\n						$(this).addClass(\'curentlyselected\');\r\n						$(\'#{{$fieldName}}\').selectOptions(itemid, true);\r\n						$(\'#treeroot{{$fieldName}}\').attr(\'checked\', false);\r\n					}\r\n					else\r\n					{\r\n						alert(\'This row cannot be his own parent\');\r\n					}\r\n			\r\n			});\r\n			\r\n			$(\'#treeroot{{$fieldName}}\').click(function(){\r\n				$(\'#treeroot{{$fieldName}}\').attr(\'checked\', true);\r\n				$(\"#actree{{$fieldName}} ul a[itemid]\").removeClass(\'curentlyselected\');\r\n				$(\'#{{$fieldName}}\').selectOptions(\"\", true);\r\n			});\r\n			\r\n			$(\"#{{$fieldName}}\").change(function(){\r\n			\r\n			$(\"#actree{{$fieldName}} ul a[itemid]\").removeClass(\'curentlyselected\');\r\n					var thisValue = this.value;\r\n					\r\n					if (thisValue == \'\')\r\n					{\r\n							$(\'#treeroot{{$fieldName}}\').attr(\'checked\', true);\r\n					}\r\n					else\r\n					{\r\n							$(\'#treeroot{{$fieldName}}\').attr(\'checked\', false);\r\n							$(\"#actree{{$fieldName}} ul a[itemid=\"+thisValue+\"]\").addClass(\'curentlyselected\');\r\n					}\r\n			});\r\n\r\n			\r\n	});'),(10,'RSS Collection Feeds','{{literal}}function HideAllRepeatFields (){{{/literal}}\r\n	$(\'#Collection_{{$collection}}_5_row\').css({display:\'none\'});\r\n	$(\'#Collection_{{$collection}}_6_row\').css({display:\'none\'});\r\n	$(\'#Collection_{{$collection}}_7_row\').css({display:\'none\'});\r\n	$(\'#Collection_{{$collection}}_8_row\').css({display:\'none\'});\r\n{{literal}}}{{/literal}}\r\n\r\nvar fields = new Array();\r\n\r\n{{literal}}function GetFieldsForCollection (cid){{{/literal}}\r\nvar fields = new Array();\r\n\r\n$.ajax({\r\n   type: \"GET\",\r\n   url: \"/o2/admin.php?menu_id=4&module_id=11&collectionid=90&colid=2&cid=\"+cid,\r\n   async: false,\r\n   cache: false,\r\n   success: function(html){\r\n    \r\n	 eval(html);\r\n	 \r\n	 \r\n   }\r\n\r\n });\r\n\r\nreturn fields;\r\n{{literal}}}{{/literal}}\r\n\r\n\r\n{{literal}}function ShowAll (cid){{{/literal}}\r\n	\r\n	var fields = GetFieldsForCollection (cid);\r\n	\r\n	var optionsString = \'<option value=\"0\">Select Field...</option>\';\r\n	for (i in fields)\r\n	{\r\n		\r\n		optionsString = optionsString + \"<option value=\\\"\"+i+\"\\\">\"+fields[i]+\"</option>\";\r\n	}\r\n	\r\n	\r\n	\r\n	$(\'#Collection_{{$collection}}_5\').html(optionsString);\r\n	$(\'#Collection_{{$collection}}_6\').html(optionsString);\r\n	$(\'#Collection_{{$collection}}_7\').html(optionsString);\r\n	$(\'#Collection_{{$collection}}_8\').html(optionsString);\r\n	\r\n	var selectedValue = $(\'#Collection_{{$collection}}_5\').attr(\'selvalue\');\r\n	if (selectedValue != \'\'){ $(\'#Collection_{{$collection}}_5\').find(\'option[value=\'+selectedValue+\']\').attr(\'selected\',\'true\'); }\r\n	var selectedValue = $(\'#Collection_{{$collection}}_6\').attr(\'selvalue\');\r\n	if (selectedValue != \'\'){ $(\'#Collection_{{$collection}}_6\').find(\'option[value=\'+selectedValue+\']\').attr(\'selected\',\'true\'); }\r\n	var selectedValue = $(\'#Collection_{{$collection}}_7\').attr(\'selvalue\');\r\n	if (selectedValue != \'\'){ $(\'#Collection_{{$collection}}_7\').find(\'option[value=\'+selectedValue+\']\').attr(\'selected\',\'true\'); }\r\n	var selectedValue = $(\'#Collection_{{$collection}}_8\').attr(\'selvalue\');\r\n	if (selectedValue != \'\'){ $(\'#Collection_{{$collection}}_8\').find(\'option[value=\'+selectedValue+\']\').attr(\'selected\',\'true\'); }\r\n	\r\n	\r\n	$(\'#Collection_{{$collection}}_5_row\').css({display:\'\'});\r\n	$(\'#Collection_{{$collection}}_6_row\').css({display:\'\'});\r\n	$(\'#Collection_{{$collection}}_7_row\').css({display:\'\'});\r\n	$(\'#Collection_{{$collection}}_8_row\').css({display:\'\'});\r\n{{literal}}}{{/literal}}\r\n\r\n$(\'#{{$fieldName}}\').change(\r\n			{{literal}}function(){{{/literal}}\r\n				var value = this.value;\r\n				HideAllRepeatFields ();\r\n				\r\n				$(\'#Collection_{{$collection}}_5\').attr(\'selvalue\',\'\');\r\n				$(\'#Collection_{{$collection}}_6\').attr(\'selvalue\',\'\');\r\n				$(\'#Collection_{{$collection}}_7\').attr(\'selvalue\',\'\');\r\n				$(\'#Collection_{{$collection}}_8\').attr(\'selvalue\',\'\');\r\n				\r\n				ShowAll(value);\r\n			{{literal}}}{{/literal}}\r\n);\r\n\r\n\r\nHideAllRepeatFields ();\r\n\r\n{{if $selectedRow.$fieldName neq \'\'}}\r\n	ShowAll({{$selectedRow.$fieldName}});\r\n	$(\'#Collection_{{$collection}}_1\').parent().append(\"<a href=\\\"http://{{$smarty.server.HTTP_HOST}}/rss-feeds/rss-{{$smarty.get.eid}}.rss\\\" target=\\\"_blank\\\">View Feed</a>\");\r\n\r\n{{/if}}\r\n\r\n'),(13,'Content Migration','$(\'#Collection_400_1\').css(\'width\',\'80%\');\r\n$(\'#Collection_400_4\').css(\'width\',\'80%\');\r\n$(\'#Collection_400_5\').css(\'width\',\'80%\');\r\n\r\n$(\'#Collection_400_6\').css(\'width\',\'80%\');\r\n$(\'#Collection_400_6\').css(\'height\',\'200px\');\r\n$(\'#Collection_400_7\').css(\'width\',\'80%\');\r\n\r\n$(\'#useraccessobject\').css(\'display\',\'none\');\r\n\r\n$(\'.collection_field_name\').each(function(){ $(this).attr(\'defaultfieldname\',$(this).html()); });\r\n\r\nfunction setDefaultFieldNames()\r\n{\r\n		$(\'.collection_field_name\').each(function(){ $(this).html($(this).attr(\'defaultfieldname\')); });\r\n}\r\n\r\nfunction emptyFieldInfo()\r\n{\r\n		$(\'.collection_field_row .infotxt\').html(\'\');\r\n}\r\n\r\n{{assign var=acute value=\"&acu\"|concat:\"te;\"}}\r\n{{RunQuery q=\"SELECT * FROM Collection_403 WHERE 1 \" ResultsVar=TemplatesAvailable}}\r\nfunction ChangeFieldsForTemplate (value)\r\n{\r\n		emptyFieldInfo();\r\n		setDefaultFieldNames();\r\n{{foreach from=$TemplatesAvailable item=kv key=kk name=kn}}\r\n		if (value == {{$kv.Collection_403_ID}}) \r\n		{\r\n				\r\n				{{RunQuery q=\"SELECT * FROM Collection_404 WHERE Collection_404_1 = \'\"|concat:$kv.Collection_403_ID|concat:\"\'\" ResultsVar=AllFieldsToShow}}\r\n				{{if $AllFieldsToShow|@count eq 0}}\r\n						$(\'.collection_field_row\').css(\'display\',\'\');\r\n				{{else}}\r\n						$(\'.collection_field_row\').css(\'display\',\'none\');					\r\n						{{foreach from=$AllFieldsToShow key=kkk item=kvv name=knn}}\r\n						$(\'#Collection_400_{{$kvv.Collection_404_2}}_row\').css(\'display\',\'\');	\r\n						\r\n						{{$kvv.Collection_404_4}}\r\n						\r\n						{{if $kvv.Collection_404_3 neq \'\'}}\r\n							$(\'#Collection_400_{{$kvv.Collection_404_2}}_row .infotxt\').html(\'<div class=\"infotxtvalue\">{{$kvv.Collection_404_3|replace:\"\'\":$acute}}</div>\');\r\n						{{/if}}\r\n						\r\n						{{/foreach}}\r\n				{{/if}}\r\n		}		\r\n{{/foreach}}\r\n\r\n}\r\n\r\n$(\'#Collection_400_3\').change(function(){ var v = $(this).val(); ChangeFieldsForTemplate(v); });\r\n\r\nvar v = $(\'#Collection_400_3\').val(); ChangeFieldsForTemplate(v);\r\n');

--
-- Table structure for table `Collection_94`
--

CREATE TABLE `Collection_94` (
  `Collection_94_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_94_1` varchar(254) DEFAULT NULL,
  `Collection_94_2` text,
  `Collection_94_3` varchar(254) DEFAULT NULL,
  PRIMARY KEY (`Collection_94_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_94`
--



--
-- Table structure for table `Collection_95`
--

CREATE TABLE `Collection_95` (
  `Collection_95_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_95_1` varchar(254) NOT NULL,
  `Collection_95_2` int(11) NOT NULL,
  `Collection_95_3` bigint(20) NOT NULL,
  `Collection_95_4` varchar(254) DEFAULT NULL,
  `Collection_95_5` text,
  `Collection_95_6` text,
  `Collection_95_7` text,
  `Collection_95_8` text,
  PRIMARY KEY (`Collection_95_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_95`
--

INSERT INTO `Collection_95` VALUES (1,'Collection Rules',101,1,'on','You can set up simple <a href=\"admin.php?module_id=1&action=update&id=30\">rules</a> that will be available only  to one collection.','//workflow for rules\r\n\r\n//first we will apply the rules that apply to all cases\r\n\r\n$error = NULL;\r\n$errors = array();\r\n$ruleErrors = array();\r\n\r\nif (count($_FILES) > 0)\r\n{\r\n		//we start calculating the size that the uploaded files will occupy\r\n		$totalSize = 0;\r\n		foreach ($_FILES as $filek => $filev)\r\n		{\r\n			$totalSize = $totalSize + $_FILES[$filek][\"size\"];\r\n		}	\r\n		\r\n		\r\n		exec(\'du -c \'.$_SERVER[\'DOCUMENT_ROOT\'].\' | grep total\', $retval, $rval);\r\n				\r\n		$last_line 			= explode(\" \",$retval[0]);\r\n		$totalSizeOccupied 	= intval($last_line[0]) * 1000;	\r\n				\r\n		$companyInfoCollection = 12;\r\n		$crow = $this -> getFirstRow($companyInfoCollection);			\r\n		\r\n		$quotadisk = intval($crow[$this->_getCollectionFieldName($companyInfoCollection,20)]);\r\n		\r\n		$aaaa = ( $totalSizeOccupied + $totalSize ) / 1000000;\r\n				\r\n		if ($quotadisk < $aaaa && $quotadisk > 0)\r\n				$ruleErrors[] 		= \"Disk Quota Exceeded. Please talk with the hosting administrator to increase it. \";\r\n\r\n}\r\n\r\n\r\nswitch ($ApplyFor)\r\n{\r\ncase COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD:\r\n			\r\n			\r\n			foreach ($taxonomy  as $record)\r\n			{\r\n					$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n					$error = $this->verifyFieldValue($CollectionID, $SubmittedData[$column_name], $record);\r\n							\r\n					if($error != NULL)\r\n					{\r\n						$errors[$record[\"CollectionFieldId\"]] = 1;\r\n					}\r\n					\r\n					if (REMOTE_STORAGE == false)\r\n					{							\r\n							if ($_FILES[$column_name][\'error\'] != UPLOAD_ERR_OK && $res[$column_name] == \'\' && $record[\"CollectionInputType\"] == 7 && $record[\"CollectionFieldRequired\"] == 1)\r\n							{\r\n									$errors[$record[\"CollectionFieldId\"]] = 1;\r\n							}\r\n							\r\n					}		\r\n					else\r\n					{	\r\n						if ($record[\"CollectionInputType\"] == 7 && $record[\"CollectionFieldRequired\"] == 1 && $SubmittedData[$column_name] == \'\')\r\n						{\r\n							$errors[$record[\"CollectionFieldId\"]] = 1;\r\n						}	\r\n						\r\n					}\r\n							\r\n			}\r\n\r\n\r\n  break;  //end admin add specific code\r\ncase COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT:\r\n  			\r\n			$res 	= $this-> getCollectionSingleRow (array(\'collection_id\' =>$CollectionID , \'row_id\' => $EditID));\r\n			\r\n			foreach ($taxonomy  as $record)\r\n			{\r\n				$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n				\r\n				if ($_FILES[$column_name][\'error\'] == UPLOAD_ERR_NO_FILE && $res[$column_name] == \'\' && $record[\"CollectionInputType\"] == 7 && $record[\"CollectionFieldRequired\"] == 1)\r\n				{\r\n					$errors[$record[\"CollectionFieldId\"]] = 1;\r\n				}\r\n				\r\n				if (REMOTE_STORAGE == true && $record[\"CollectionInputType\"] == 7 && $record[\"CollectionFieldRequired\"] == 1 && $SubmittedData[$column_name] == \'\')\r\n				{		\r\n						$errors[$record[\"CollectionFieldId\"]] = 1;\r\n				}\r\n				\r\n				if (isset($SubmittedData[$column_name]) || $_FILES[$column_name][\'error\'] == UPLOAD_ERR_OK )\r\n				{\r\n				\r\n					$error = $this->verifyFieldValue($CollectionID, $SubmittedData[$column_name], $record);		\r\n					if($error != NULL)\r\n					{\r\n						$errors[$record[\"CollectionFieldId\"]] = 1;\r\n					}\r\n					\r\n				}\r\n			}\r\n			\r\n  \r\n  \r\n  break; //end admin edit specific code\r\ncase COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE:\r\n  \r\n  \r\n  \r\n  break;  //end admin delete specific code\r\ncase COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD:\r\n			\r\n			\r\n			\r\n			foreach ($taxonomy  as $record)\r\n			{\r\n				$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n				$error = $this->verifyFieldValue($CollectionID, $SubmittedData[$column_name], $record);\r\n							\r\n				if ($record[\'CollectionFieldRequired\'] == 1 && $SubmittedData[$column_name] == \"\")\r\n				{\r\n					if ($record[\"CollectionInputType\"] == 7 )\r\n					{\r\n						$errorupload = $_FILES[$column_name][\'error\'];\r\n						if ($errorupload != UPLOAD_ERR_OK && $res[$column_name] == \'\')\r\n						{\r\n							$errors[$record[\"CollectionFieldId\"]] = 1;\r\n						}\r\n						\r\n					}\r\n					else\r\n					{\r\n						$errors[$record[\"CollectionFieldId\"]] = 1;\r\n					}	\r\n				}\r\n				\r\n				\r\n				\r\n				\r\n				\r\n				if (($record[\'CollectionHidden\'] == 1 && $SubmittedData[$column_name] ==\'\' && $record[\'CollectionFormula\'] == 1) || ( $_FILES[$column_name][\'error\'] != UPLOAD_ERR_OK) )\r\n				{\r\n							//do not add the field into the edit \r\n				}\r\n				else\r\n				{\r\n					\r\n				}	\r\n	\r\n			}\r\n\r\n\r\n  break;  //end front end add specific code\r\ncase COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT:\r\n  				\r\n			$res 	= $this-> getCollectionSingleRow (array(\'collection_id\' =>$CollectionID , \'row_id\' => $EditID));\r\n			\r\n			foreach ($taxonomy  as $record)\r\n			{\r\n				$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n				$error = $this->verifyFieldValue($CollectionID, $SubmittedData[$column_name], $record);\r\n							\r\n				if ($record[\'CollectionFieldRequired\'] == 1 && $SubmittedData[$column_name] == \"\")\r\n				{\r\n					if ($record[\"CollectionInputType\"] == 7 )\r\n					{\r\n						$errorupload = $_FILES[$column_name][\'error\'];\r\n						if ($errorupload != UPLOAD_ERR_OK && $res[$column_name] == \'\')\r\n						{\r\n							$errors[$record[\"CollectionFieldId\"]] = 1;\r\n						}\r\n					}\r\n					else\r\n					{\r\n						if ($record[\"CollectionInputType\"] == 3 )\r\n						{\r\n						\r\n						}\r\n						else\r\n						{\r\n							$errors[$record[\"CollectionFieldId\"]] = 1;\r\n						}	\r\n					}	\r\n				}\r\n				\r\n				if (($record[\'CollectionHidden\'] == 1 && $SubmittedData[$column_name] ==\'\' && $record[\'CollectionFormula\'] == 1) || ( $_FILES[$column_name][\'error\'] != UPLOAD_ERR_OK) )\r\n				{\r\n					//do not add the field into the edit \r\n				}\r\n				else\r\n				{\r\n					\r\n				}	\r\n	\r\n			}	\r\n  \r\n  \r\n  break; //end front end edit specific code\r\ncase COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE:\r\n  \r\n  \r\n  \r\n  break;   //end front end delete specific code\r\ndefault:\r\n  \r\n  // we will not run any code here\r\n  \r\n} \r\n\r\n\r\n\r\n\r\n			$collection_table 	= $this->_getCollectionTableName(COLLECTION_RULES);\r\n			$addName 			= $this->_getCollectionFieldName(COLLECTION_RULES, COLLECTION_RULES_ADD);\r\n			$deleteName 		= $this->_getCollectionFieldName(COLLECTION_RULES, COLLECTION_RULES_DELETE);\r\n			$editName 			= $this->_getCollectionFieldName(COLLECTION_RULES, COLLECTION_RULES_EDIT);\r\n			$collectionName		= $this->_getCollectionFieldName(COLLECTION_RULES, COLLECTION_RULES_COLLECTION);\r\n			$pluginName			= $this->_getCollectionFieldName(COLLECTION_RULES, COLLECTION_RULES_FILE);\r\n			$collectionAdmin	= $this->_getCollectionFieldName(COLLECTION_RULES, COLLECTION_RULES_ADMIN);\r\n			$collectionFront	= $this->_getCollectionFieldName(COLLECTION_RULES, COLLECTION_RULES_FRONT_END);\r\n			$collectionSort		= $this->_getCollectionFieldName(COLLECTION_RULES, COLLECTION_RULES_SORT_ORDER);\r\n\r\nswitch ($ApplyFor)\r\n{\r\ncase COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD:\r\n\r\n   $q = \"SELECT $pluginName as pluginName FROM $collection_table WHERE $collectionAdmin=\'on\' and $addName=\'on\' and $collectionName=\'\".$CollectionID.\"\' Order By \". $collectionSort;\r\n   \r\n   $UserAccessGroups = $this->GetUserGroupAccess($UserID);\r\n   if ($SuperAdminUser || count($UserAccessGroups) > 0)\r\n   {\r\n			//do nothinh		   \r\n   }\r\n   else\r\n   {\r\n   		$ruleErrors[] = \"You do not have right to add into this collection row.\";\r\n   }\r\n   \r\n  break;  //end admin add specific code\r\ncase COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT:\r\n  \r\n  $q = \"SELECT $pluginName as pluginName FROM $collection_table WHERE $collectionAdmin=\'on\' and $editName =\'on\' and $collectionName=\'\".$CollectionID.\"\' Order By \". $collectionSort;\r\n  \r\n  if(!$SuperAdminUser && !$this->CanUserAccess($UserID,  $CollectionID, intval($EditID)))\r\n  {\r\n		$ruleErrors[] = \"You do not have right to edit this collection row.\";\r\n  }\r\n  \r\n  break; //end admin edit specific code\r\ncase COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE:\r\n  \r\n  $q = \"SELECT $pluginName as pluginName FROM $collection_table WHERE $collectionAdmin=\'on\' and $deleteName =\'on\' and $collectionName=\'\".$CollectionID.\"\' Order By \". $collectionSort;\r\n  \r\n  if(!$SuperAdminUser && !$this->CanUserAccess($UserID,  $CollectionID, intval($DeleteID)))\r\n  {\r\n		$ruleErrors[] = \"You do not have right to delete this collection row.\";\r\n  }\r\n  \r\n  break;  //end admin delete specific code\r\ncase COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD:\r\n\r\n  $q = \"SELECT $pluginName as pluginName FROM $collection_table WHERE $collectionFront=\'on\' and $addName=\'on\' and $collectionName=\'\".$CollectionID.\"\' Order By \". $collectionSort;\r\n\r\n  break;  //end front end add specific code\r\ncase COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT:\r\n  \r\n  $q = \"SELECT $pluginName as pluginName FROM $collection_table WHERE $collectionFront=\'on\' and $editName =\'on\' and $collectionName=\'\".$CollectionID.\"\' Order By \". $collectionSort;\r\n    \r\n  break; //end front end edit specific code\r\ncase COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE:\r\n  \r\n  $q = \"SELECT $pluginName as pluginName FROM $collection_table WHERE $collectionFront=\'on\' and $deleteName =\'on\' and $collectionName=\'\".$CollectionID.\"\' Order By \". $collectionSort;\r\n  \r\n  if(!$SuperAdminUser && !$this->CanUserAccess($UserID,  $CollectionID, intval($DeleteID)))\r\n  {\r\n		$ruleErrors[] = \"You do not have right to delete this collection row.\";\r\n  }\r\n  \r\n  break;   //end front end delete specific code\r\ndefault:\r\n  \r\n  // we will not run any code here\r\n  \r\n} \r\n\r\n$Rules = $this-> db -> queryAll($q);\r\n\r\nif ($Rules)\r\n	foreach ( $Rules as $k => $v )\r\n		eval($v[\'pluginName\']);\r\n\r\n\r\n\r\n/*\r\n				We will also see if the uploaded files are of the allowed type but only if \r\n				if we are on the front end\r\n*/\r\n\r\nif (count($_FILES) > 0 && ( REMOTE_STORAGE == true && ( $ApplyFor == COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD || $ApplyFor == COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT ) ) || REMOTE_STORAGE == false )\r\n{\r\n\r\n	foreach ($taxonomy  as $record)\r\n	{\r\n				$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n				if ( $record[\"CollectionInputType\"] == 7)\r\n				{\r\n							$errorupload = $_FILES[$column_name][\'error\'];\r\n							\r\n							if ($errorupload == UPLOAD_ERR_OK )\r\n							{	\r\n												\r\n												$UploadArgs = array();\r\n												$UploadArgs[\'UploadedFile\'] = $_FILES[$column_name];\r\n												$FileTypeErrors = $storage->CheckIfFileIsAllowedToBeUploaded($UploadArgs);\r\n\r\n												if (count($FileTypeErrors)> 0)\r\n												{\r\n														foreach ($FileTypeErrors as $ErrorKey => $ErrorValue)\r\n														{\r\n																$ruleErrors[] = $record[\"CollectionFieldName\"] . \" - \"  . $ErrorValue;\r\n														}\r\n												} //end if there are errors\r\n												\r\n							}	//end if error upload is no error				\r\n				}//end if field is of file type\r\n	} //end foreach\r\n\r\n}//end if we check file types\r\n\r\n\r\n\r\n$WorkFlowReturnArray[\'Errors\'] = $errors;\r\n$WorkFlowReturnArray[\'RuleErrors\'] = $ruleErrors;','{{if $smarty.post.save eq \'save\'}}\r\n\r\n{{else}}\r\n\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=101 ColumnID=1 Value=$CollectionID Collection_101_2=1 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_101_3 eq \'on\'}}{{assign var=wFlowRuleAddAdminActive value=\'checked\'}}{{else}}{{assign var=wFlowRuleAddAdminActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=101 ColumnID=1 Value=$CollectionID Collection_101_2=2 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_101_3 eq \'on\'}}{{assign var=wFlowRuleEditAdminActive value=\'checked\'}}{{else}}{{assign var=wFlowRuleEditAdminActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=101 ColumnID=1 Value=$CollectionID Collection_101_2=3 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_101_3 eq \'on\'}}{{assign var=wFlowRuleDeleteAdminActive value=\'checked\'}}{{else}}{{assign var=wFlowRuleDeleteAdminActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=101 ColumnID=1 Value=$CollectionID Collection_101_2=4 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_101_3 eq \'on\'}}{{assign var=wFlowRuleAddFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowRuleAddFrontEndActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=101 ColumnID=1 Value=$CollectionID Collection_101_2=5 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_101_3 eq \'on\'}}{{assign var=wFlowRuleEditFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowRuleEditFrontEndActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=101 ColumnID=1 Value=$CollectionID Collection_101_2=6 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_101_3 eq \'on\'}}{{assign var=wFlowRuleDeleteFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowRuleDeleteFrontEndActive value=\'\'}}{{/if}}\r\n\r\n{{/if}}\r\n\r\n\r\n<h3>Front End</h3>\r\n<p><input type=\"checkbox\" name=\"wFlowRuleAddFrontEndActive\" {{$wFlowRuleAddFrontEndActive}} /> Rules will be executed when a collection row is <em>added</em> using the front end of the site</p>\r\n<p><input type=\"checkbox\" name=\"wFlowRuleEditFrontEndActive\" {{$wFlowRuleEditFrontEndActive}} /> Rules will be executed when a collection row is <em>edited</em> using the front end of the site</p>\r\n<p><input type=\"checkbox\" name=\"wFlowRuleDeleteFrontEndActive\" {{$wFlowRuleDeleteFrontEndActive}} /> Rules will be executed when a collection row is <em>deleted</em> using the front end of the site</p>\r\n\r\n\r\n<h3>Administrator Area</h3>\r\n<p><input type=\"checkbox\" name=\"wFlowRuleAddAdminActive\" {{$wFlowRuleAddAdminActive}} /> Rules will be applied when a collection row is <em>added</em> in admin</p>\r\n<p><input type=\"checkbox\" name=\"wFlowRuleEditAdminActive\" {{$wFlowRuleEditAdminActive}} /> Rules will be applied when a collection row is <em>edited</em> in admin</p>\r\n<p><input type=\"checkbox\" name=\"wFlowRuleDeleteAdminActive\" {{$wFlowRuleDeleteAdminActive}} /> Rules will be applied when a collection row is <em>deleted</em> in admin</p>\r\n','//save workflow for rules\r\n$WCollectionID 				= $WorkFlowData[\'WFlowCollection\'];\r\n$WCollectionTable 			= $this -> _getCollectionTableName($WCollectionID);\r\n$WCollectionFieldName 		= $this->_getCollectionFieldName($WCollectionID, 1);\r\n$WCollectionFieldNameApply 	= $this->_getCollectionFieldName($WCollectionID, 2);\r\n\r\n$ApplyIn = array();\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD] 			= \'wFlowRuleAddAdminActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT] 			= \'wFlowRuleEditAdminActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE] 		= \'wFlowRuleDeleteAdminActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD] 		= \'wFlowRuleAddFrontEndActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT] 		= \'wFlowRuleEditFrontEndActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE] 		= \'wFlowRuleDeleteFrontEndActive\';\r\n\r\nforeach ($ApplyIn as $ApplyKey => $ApplyValue)\r\n{\r\n\r\n$q = \"SELECT * FROM \". $WCollectionTable. \" WHERE \" . $WCollectionFieldName . \" = \" . $CollectionID . \" AND \" . $WCollectionFieldNameApply . \" = \" . $ApplyKey;\r\n$res = $db->query($q);\r\n\r\nif ($res->numRows() == 0)\r\n{\r\n		$addArray = array();\r\n		$addArray[$WCollectionFieldName] = $CollectionID;\r\n		$addArray[$WCollectionFieldNameApply] = $ApplyKey;\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 4)] = $Data[$ApplyValue];\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_INSERT);\r\n}\r\nelse\r\n{\r\n		$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n		$addArray = array();\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 4)] = $Data[$ApplyValue];\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_UPDATE, \' \'.$this->_getCollectionFieldName($WCollectionID, \'ID\').\' = \' . $row[$this->_getCollectionFieldName($WCollectionID, \'ID\')]);\r\n}\r\n\r\n}//end foreach'),(2,'Write to Database',96,2,'on','After all the rules are okay, we can write to database.','//workflow for write to database\r\n//first we will apply the rules that apply to all cases\r\n\r\nif (count($WorkFlowReturnArray[\'Errors\']) == 0 && count ($WorkFlowReturnArray[\'RuleErrors\']) == 0)\r\n{\r\n				\r\n				switch ($ApplyFor)\r\n				{\r\n				case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD:\r\n				\r\n								\r\n								foreach ($taxonomy  as $record)\r\n								{\r\n										$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n										$column_values[$column_name] = CollectionConverter::ConvertValue($SubmittedData[$column_name], $record[\"CollectionFieldType\"]);											\r\n								}\r\n								\r\n								//save the row in the collection\r\n								$inserted_id = $this->insertCollectionRow_($CollectionID, $column_values , $UploadDirectory , $UploadPrefix);\r\n								\r\n								//save the user access levels for this row\r\n								$UserAccessGroups = $this->GetUserGroupAccess($UserID);\r\n								if ($SubmittedData[\'SelectedValuesUserGroups\'] || count($UserAccessGroups) > 0)\r\n								{\r\n									$ugroups = array();\r\n									foreach ($SubmittedData[\'SelectedValuesUserGroups\'] as $saveKey => $saveItem)\r\n									{\r\n											$ugroups[$saveItem] = $saveItem;\r\n									}\r\n									\r\n									//only super admins can update row access level\r\n									if ($SuperAdminUser) \r\n									{\r\n										$this->updateCollectionUserGroupAccessRow($CollectionID, $inserted_id, $ugroups, $UserID);\r\n									}	\r\n									else\r\n									{\r\n										$this->updateCollectionUserGroupAccessRow($CollectionID, $inserted_id, $UserAccessGroups, $UserID);\r\n									}\r\n								}\r\n								\r\n								//we need to save xrefs if they exist\r\n								if ($collectionSettings)\r\n								{\r\n									//we get to see if this collection has xrefs :)\r\n									if (count($collectionSettings[5]) > 0)\r\n									{						\r\n										$tmpCollectionsXRefSave  = $collectionSettings[5];\r\n										\r\n										foreach ($tmpCollectionsXRefSave as $key => $value)\r\n										{\r\n											$collectionXrefSave = $value[\'collectionXrefsSave\'];\r\n											$collectionXref 	= $value[\'collectionXrefs\'];\r\n											\r\n											//first we delete the xrefs\r\n											$this -> deleteCollectionXrefs ($collectionXrefSave  ,  $inserted_id);\r\n											if ($SubmittedData[\'SelectedValues_\'.$collectionXref])\r\n											{\r\n												foreach ($SubmittedData[\'SelectedValues_\'.$collectionXref] as $saveKey => $saveItem)\r\n												{\r\n														$xref_column_values = array();\r\n														\r\n														$field1 = $this-> _getCollectionFieldName($collectionXrefSave, 1);\r\n														$field2 = $this-> _getCollectionFieldName($collectionXrefSave, 2);\r\n														\r\n														$xref_column_values[$field1] = $inserted_id;\r\n														$xref_column_values[$field2] = $saveItem;\r\n														$res2 = $this->insertCollectionRow_($collectionXrefSave, $xref_column_values , $UploadDirectory , $UploadPrefix);\r\n												}\r\n											}\r\n										}\r\n									}\r\n									\r\n									if (count($collectionSettings[6]) > 0)\r\n									{\r\n												\r\n												$tmpCollectionsXRefWith  = $collectionSettings[6];\r\n												\r\n												foreach ($tmpCollectionsXRefWith as $key => $collection_value)\r\n												{\r\n													$value = $collection_value[\'collectionComplexXref\'];\r\n													$taxonomyXref = $this->getCollectionTaxonomy($value);\r\n													\r\n													if (count($SubmittedData[\'ExtAttribute_\'.$value.\'_ID\']) > 0)\r\n													{\r\n														\r\n														foreach ($SubmittedData[\'ExtAttribute_\'.$value.\'_ID\'] as $k => $v)\r\n														{\r\n																$XrefValues = array();\r\n																$del = 1;\r\n																foreach ($taxonomyXref as $kk => $vv )\r\n																{\r\n																	if ($vv[\'CollectionFieldRequired\'] == 1 && $SubmittedData[\'ExtAttribute_\'.$value.\'_\'.$vv[\'CollectionFieldId\']][$k] != \'\')\r\n																	{\r\n																		$del = 0;\r\n																	}\r\n																	$column_name = $this->_getCollectionFieldName($value, $vv[\'CollectionFieldId\']);\r\n																	$XrefValues[$column_name] = $SubmittedData[\'ExtAttribute_\'.$value.\'_\'.$vv[\'CollectionFieldId\']][$k];\r\n																	\r\n																}//end foreach\r\n																\r\n																$column_name = $this->_getCollectionFieldName($value, 1);\r\n																$XrefValues[$column_name] = $inserted_id;\r\n																\r\n																if ($del == 1 && $v !=0)\r\n																{\r\n																	//we will delete the entry\r\n																	$this->deleteCollectionRow_($value, $v);\r\n																}\r\n																else\r\n																{\r\n																	//we will add/edit the entry\r\n																	if ($v == 0)\r\n																	{\r\n																		//we will add the value\r\n																		if ($del == 0)\r\n																		{\r\n																		  $this->insertCollectionRow_($value, $XrefValues , $UploadDirectory , $UploadPrefix);	\r\n																		}\r\n																	}\r\n																	else\r\n																	{\r\n																		//we will edit the value\r\n																		$this->updateCollectionRow_($value,  $v , $XrefValues , $UploadDirectory , $UploadPrefix);\r\n																	}\r\n																}//end if delete =0\r\n																\r\n														}//end foreach\r\n														\r\n													}\r\n													\r\n													\r\n												}\r\n																			\r\n									}//end complex xref\r\n									\r\n									\r\n										\r\n								}//edn if save xrefs\r\n								\r\n								$WorkFlowReturnArray[\'InsertedID\'] = $inserted_id;\r\n				\r\n				  break;  //end admin add specific code\r\n				case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT:\r\n				  \r\n				  				//we need the edit id param to be set up\r\n								if (intval($EditID) > 0)\r\n								{\r\n										\r\n										if (count($this->revisionCollections[$CollectionID]) > 0)\r\n										{\r\n												//add new revision with previous data\r\n												$RevisionID = $this-> RevisionsAddRevisionForRow($CollectionID , $EditID , $UserID , COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT );\r\n										}\r\n										\r\n										foreach ($taxonomy  as $record)\r\n										{\r\n											$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n											if (isset($SubmittedData[$column_name]) || $_FILES[$column_name][\'error\'] == UPLOAD_ERR_OK )\r\n											{\r\n												$column_values[$column_name] = CollectionConverter::ConvertValue($SubmittedData[$column_name], $record[\"CollectionFieldType\"]);\r\n											}\r\n										}\r\n										\r\n										\r\n										\r\n										$res = $this->updateCollectionRow_($CollectionID, $EditID, $column_values , $UploadDirectory , $UploadPrefix);\r\n										\r\n										//user level access is only updated if the row is edited by admins\r\n										if ($SuperAdminUser)\r\n										{\r\n												if ($SubmittedData[\'SelectedValuesUserGroups\'])\r\n												{\r\n													$ugroups = array();\r\n													foreach ($SubmittedData[\'SelectedValuesUserGroups\'] as $saveKey => $saveItem)\r\n													{\r\n															$ugroups[$saveItem] = $saveItem;\r\n													}\r\n												}\r\n												$this->updateCollectionUserGroupAccessRow($CollectionID, $EditID, $ugroups, $UserID);	\r\n										}\r\n										\r\n										\r\n										//we need to save xrefs if they exist\r\n										if ($collectionSettings)\r\n										{\r\n											//we get to see if this collection has xrefs :)\r\n											if (count($collectionSettings[5]) > 0)\r\n											{\r\n												$edit_id = $EditID;\r\n												\r\n												$tmpCollectionsXRefSave  = $collectionSettings[5];\r\n												\r\n												foreach ($tmpCollectionsXRefSave as $key => $value)\r\n												{\r\n													$collectionXrefSave = $value[\'collectionXrefsSave\'];\r\n													$collectionXref 	= $value[\'collectionXrefs\'];\r\n													\r\n													//first we delete the xrefs\r\n													$this -> deleteCollectionXrefs ($collectionXrefSave , $edit_id);\r\n													if ($SubmittedData[\'SelectedValues_\'.$collectionXref])\r\n													{\r\n														foreach ($SubmittedData[\'SelectedValues_\'.$collectionXref] as $saveKey => $saveItem)\r\n														{\r\n																$xref_column_values = array();\r\n																\r\n																$field1 = $this-> _getCollectionFieldName($collectionXrefSave, 1);\r\n																$field2 = $this-> _getCollectionFieldName($collectionXrefSave, 2);\r\n																\r\n																$xref_column_values[$field1] = $edit_id;\r\n																$xref_column_values[$field2] = $saveItem;\r\n																\r\n																$res = $this->insertCollectionRow_($collectionXrefSave, $xref_column_values , $UploadDirectory , $UploadPrefix);\r\n														}\r\n													}\r\n												}\r\n											}	\r\n											\r\n											if (count($collectionSettings[6]) > 0)\r\n											{\r\n											\r\n														$tmpCollectionsXRefWith  = $collectionSettings[6];\r\n														\r\n														$edit_id = $EditID;														\r\n														\r\n														foreach ($tmpCollectionsXRefWith as $key => $collection_value)\r\n														{\r\n															$value = $collection_value[\'collectionComplexXref\'];\r\n															\r\n															$taxonomyXref = $this->getCollectionTaxonomy($value);\r\n															\r\n															if (count($SubmittedData[\'ExtAttribute_\'.$value.\'_ID\']) > 0)\r\n															{\r\n																\r\n																if ($args[\'ComplexXREFDelete\'] == 1)\r\n																{\r\n																	$this -> deleteCollectionXrefs ($value , $EditID);\r\n																}\r\n																\r\n																foreach ($SubmittedData[\'ExtAttribute_\'.$value.\'_ID\'] as $k => $v)\r\n																{\r\n																		$XrefValues = array();\r\n																		$del = 1;\r\n																		foreach ($taxonomyXref as $kk => $vv )\r\n																		{\r\n																			if ($vv[\'CollectionFieldRequired\'] == 1 && $SubmittedData[\'ExtAttribute_\'.$value.\'_\'.$vv[\'CollectionFieldId\']][$k] != \'\')\r\n																			{\r\n																				$del = 0;\r\n																			}\r\n																			$column_name = $this->_getCollectionFieldName($value, $vv[\'CollectionFieldId\']);\r\n																			$XrefValues[$column_name] = $SubmittedData[\'ExtAttribute_\'.$value.\'_\'.$vv[\'CollectionFieldId\']][$k];\r\n																			\r\n																		}//end foreach\r\n																		\r\n																		$column_name = $this->_getCollectionFieldName($value, 1);\r\n																		$XrefValues[$column_name] = $edit_id;\r\n																		\r\n																		\r\n																																				\r\n																		if ($del == 1 && $v !=0)\r\n																		{\r\n																			//we will delete the entry\r\n																			$this->deleteCollectionRow_($value, $v);\r\n																		}\r\n																		else\r\n																		{\r\n																			//we will add/edit the entry\r\n																			if ($v == 0)\r\n																			{\r\n																				//we will add the value\r\n																				if ($del == 0)\r\n																				{\r\n																				  $this->insertCollectionRow_($value, $XrefValues , $UploadDirectory , $UploadPrefix);	\r\n																				}\r\n																			}\r\n																			else\r\n																			{\r\n																				//we will edit the value\r\n																				$this->updateCollectionRow_($value,  $v , $XrefValues , $UploadDirectory , $UploadPrefix);\r\n																			}\r\n																		}//end if delete =0\r\n																		\r\n																}//end foreach\r\n																\r\n															}\r\n															\r\n															\r\n														}\r\n																					\r\n											}//end complex xref\r\n											\r\n											\r\n										}//edn if save xrefs\r\n								\r\n								$WorkFlowReturnArray[\'EditedID\'] = $EditID;\r\n								\r\n								}//end if we have edit id\r\n				  \r\n				  \r\n				  break; //end admin edit specific code\r\n				case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE:\r\n				  				\r\n								\r\n								if (count($this->revisionCollections[$CollectionID]) > 0)\r\n								{\r\n										//add new revision with previous data\r\n										$RevisionID = $this-> RevisionsDeleteRevisionForRow($CollectionID , $DeleteID );\r\n								}\r\n								\r\n								//we delete the row access levels\r\n								$this->deleteCollectionUserGroupAccessRow($CollectionID, $DeleteID);\r\n								//we delete the xrefs\r\n								if (count($collectionSettings[5]) > 0)\r\n								{\r\n									\r\n									$tmpCollectionsXRefSave  = $collectionSettings[5];\r\n									\r\n									foreach ($tmpCollectionsXRefSave as $key => $value)\r\n									{\r\n										$collectionXrefSave = $value[\'collectionXrefsSave\'];\r\n										$this -> deleteCollectionXrefs ($collectionXrefSave , $DeleteID);\r\n									}\r\n								}	\r\n								if (count($collectionSettings[6]) > 0)\r\n								{\r\n									$tmpCollectionsXRefWith  = $collectionSettings[6];\r\n									\r\n									foreach ($tmpCollectionsXRefWith as $key => $value)\r\n									{\r\n										$this -> deleteCollectionXrefs ($value[\'collectionComplexXref\'] , $DeleteID);\r\n									}\r\n								}\r\n								//we delete the actual row\r\n								$this->deleteCollectionRow_($CollectionID, $DeleteID);\r\n				  			\r\n				  \r\n				  break;  //end admin delete specific code\r\n				case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD:\r\n								\r\n							foreach ($taxonomy  as $record)\r\n							{\r\n								$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n																\r\n								if (($record[\'CollectionHidden\'] == 1 && $SubmittedData[$column_name] ==\'\' && $record[\'CollectionFormula\'] == 1) || ( $_FILES[$column_name][\'error\'] != UPLOAD_ERR_OK) )\r\n								{\r\n									//do not add the field into the edit \r\n								}\r\n								else\r\n								{\r\n									$column_values[$column_name] = CollectionConverter::ConvertValue($SubmittedData[$column_name], $record[\"CollectionFieldType\"]);\r\n								}	\r\n					\r\n							}\r\n							\r\n							//we need to treat the uploads in a different way if remote storage is active for front end\r\n							include_once $_SERVER[\'DOCUMENT_ROOT\'].\'/classes/class.storage.php\';\r\n 							$storage = new StorageAPI($this);\r\n							\r\n							define(\"REMOTE_STORAGE\", $storage->isRemoteStorageActive ());\r\n							print REMOTE_STORAGE . \"<hr/>\"; \r\n							if (REMOTE_STORAGE == true)\r\n							{\r\n										\r\n										//loop through every upload and get it done\r\n										foreach ($taxonomy  as $record)\r\n										{\r\n												$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n												if ($record[\'CollectionInputType\'] == 7 && $_FILES[$column_name][\'error\'] == UPLOAD_ERR_OK )\r\n												{\r\n															$FileTypeArray = $storage->getFileTypeFromFileUpload($_FILES[$column_name]);\r\n															$FileType = $FileTypeArray[\'FileType\'];\r\n															\r\n															$ActualFileName = $_FILES[$column_name][\"name\"];\r\n			\r\n															$storageArray = array();\r\n															$storageArray[\'ActualFileName\'] = $ActualFileName;\r\n															$storageArray[\'ActualFilePath\'] = $_FILES[$column_name][\"tmp_name\"];\r\n															$storageArray[\'FileTypeDetails\']	= $FileTypeArray;\r\n															$storageArray[\'UploadedFile\']		= $_FILES[$column_name];\r\n															\r\n															//we get the default storage setting for uploads on front end\r\n															$StorageMedia 	= intval($collectionSettings[2][\'RemoteStorageType\']);\r\n															$StorageFolder 	= intval($collectionSettings[2][\'RemoteStorageFolder\']);\r\n															\r\n															$storage->setStorage($StorageMedia , $StorageFolder);\r\n															\r\n															$returnDetails = $storage-> SendFileToStorage ($storageArray);\r\n															\r\n																														\r\n															if (count($returnDetails[\'errors\'])> 0)\r\n															{\r\n																	//we do not save anything\r\n															}\r\n															else\r\n															{\r\n																	$PathToTheUploadedFile 	= $returnDetails[\'path\'];\r\n																	$UploadedFileName 		= $returnDetails[\'filename\'];\r\n																	\r\n																	\r\n																	$args = array();\r\n																	$args[\'FileName\'] = $ActualFileName;\r\n																	$args[\'FileType\'] = $FileType;\r\n																	$args[\'PathToTheUploadedFile\'] = $PathToTheUploadedFile;	\r\n																	$args[\'UploadedFileName\'] = $UploadedFileName;\r\n																	\r\n																	$FileUploadID = $storage->SaveUploadedFile($args);\r\n																	\r\n																	if (intval($FileUploadID) > 0)\r\n																	{\r\n																				//add the path to the collection save array\r\n																				$column_values[$column_name] = $PathToTheUploadedFile;\r\n																	}\r\n																	else\r\n																	{\r\n																			//do nothing\r\n																	}			\r\n																	\r\n															}\r\n															\r\n												}\r\n											\r\n										}//end foreach\r\n										\r\n																	\r\n							}//end if remote storage active\r\n							\r\n														\r\n							//end remote storage code\r\n							\r\n							$inserted_id = $this->insertCollectionRow_($CollectionID, $column_values , $UploadDirectory , $UploadPrefix);\r\n								\r\n							$WorkFlowReturnArray[\'InsertedID\'] = $inserted_id;\r\n				\r\n				  break;  //end front end add specific code\r\n				case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT:\r\n				  \r\n				  										\r\n							foreach ($taxonomy  as $record)\r\n							{\r\n								$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n																\r\n								if (($record[\'CollectionHidden\'] == 1 && $SubmittedData[$column_name] ==\'\' && $record[\'CollectionFormula\'] == 1) || ( $_FILES[$column_name][\'error\'] != UPLOAD_ERR_OK) )\r\n								{\r\n									//do not add the field into the edit \r\n								}\r\n								else\r\n								{\r\n									$column_values[$column_name] = CollectionConverter::ConvertValue($SubmittedData[$column_name], $record[\"CollectionFieldType\"]);\r\n								}	\r\n					\r\n							}\r\n							\r\n							//we need to treat the uploads in a different way if remote storage is active for front end\r\n							include_once $_SERVER[\'DOCUMENT_ROOT\'].\'/classes/class.storage.php\';\r\n 							$storage = new StorageAPI($this);\r\n							\r\n							define(\"REMOTE_STORAGE\", $storage->isRemoteStorageActive ());\r\n							\r\n							if (REMOTE_STORAGE == true)\r\n							{\r\n										\r\n										\r\n										//loop through every upload and get it done\r\n										foreach ($taxonomy  as $record)\r\n										{\r\n												$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n												if ($record[\'CollectionInputType\'] == 7 && $_FILES[$column_name][\'error\'] == UPLOAD_ERR_OK )\r\n												{\r\n															$FileType = $storage->getFileTypeFromFileUpload($_FILES[$column_name]);\r\n															$ActualFileName = $_FILES[$column_name][\"name\"];\r\n			\r\n															$storageArray = array();\r\n															$storageArray[\'ActualFileName\'] = $ActualFileName;\r\n															$storageArray[\'ActualFilePath\'] = $_FILES[$column_name][\"tmp_name\"];\r\n															\r\n															//we get the default storage setting for uploads on front end\r\n															$StorageMedia 	= intval($collectionSettings[2][\'RemoteStorageType\']);\r\n															$StorageFolder 	= intval($collectionSettings[2][\'RemoteStorageFolder\']);\r\n											\r\n															$storage->setStorage($StorageMedia , $StorageFolder);\r\n															\r\n															$returnDetails = $storage-> SendFileToStorage ($storageArray);\r\n															\r\n															\r\n															\r\n															if (count($returnDetails[\'errors\'])> 0)\r\n															{\r\n																	//we do not save anything\r\n															}\r\n															else\r\n															{\r\n																	$PathToTheUploadedFile 	= $returnDetails[\'path\'];\r\n																	$UploadedFileName 		= $returnDetails[\'filename\'];\r\n																	\r\n																	\r\n																	$args = array();\r\n																	$args[\'FileName\'] = $ActualFileName;\r\n																	$args[\'FileType\'] = $FileType;\r\n																	$args[\'PathToTheUploadedFile\'] = $PathToTheUploadedFile;	\r\n																	$args[\'UploadedFileName\'] = $UploadedFileName;\r\n																	\r\n																	$FileUploadID = $storage->SaveUploadedFile($args);\r\n																	\r\n																	if (intval($FileUploadID) > 0)\r\n																	{\r\n																				//add the path to the collection save array\r\n																				$column_values[$column_name] = $PathToTheUploadedFile;\r\n																	}\r\n																	else\r\n																	{\r\n																			//do nothing\r\n																	}			\r\n																	\r\n															}\r\n															\r\n												}\r\n											\r\n										}//end foreach\r\n										\r\n																	\r\n							}//end if remote storage active\r\n							\r\n							//end remote storage code\r\n							\r\n							$this->updateCollectionRow_($CollectionID, $EditID , $column_values , $UploadDirectory , $UploadPrefix);\r\n							$WorkFlowReturnArray[\'EditedID\'] = $EditID;\r\n				  \r\n				  break; //end front end edit specific code\r\n				case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE:\r\n				  \r\n				  			\r\n				  \r\n				  break;   //end front end delete specific code\r\n				default:\r\n				  \r\n				  // we will not run any code here\r\n				  \r\n				} \r\n				\r\n		\r\n}','{{if $smarty.post.save eq \'save\'}}\r\n\r\n{{else}}\r\n\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=96 ColumnID=1 Value=$CollectionID Collection_96_2=1 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_96_3 eq \'on\'}}{{assign var=wFlowWriteAddAdminActive value=\'checked\'}}{{else}}{{assign var=wFlowWriteAddAdminActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=96 ColumnID=1 Value=$CollectionID Collection_96_2=2 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_96_3 eq \'on\'}}{{assign var=wFlowWriteEditAdminActive value=\'checked\'}}{{else}}{{assign var=wFlowWriteEditAdminActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=96 ColumnID=1 Value=$CollectionID Collection_96_2=3 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_96_3 eq \'on\'}}{{assign var=wFlowWriteDeleteAdminActive value=\'checked\'}}{{else}}{{assign var=wFlowWriteDeleteAdminActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=96 ColumnID=1 Value=$CollectionID Collection_96_2=4 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_96_3 eq \'on\'}}{{assign var=wFlowWriteAddFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowWriteAddFrontEndActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=96 ColumnID=1 Value=$CollectionID Collection_96_2=5 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_96_3 eq \'on\'}}{{assign var=wFlowWriteEditFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowWriteEditFrontEndActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=96 ColumnID=1 Value=$CollectionID Collection_96_2=6 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_96_3 eq \'on\'}}{{assign var=wFlowWriteDeleteFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowWriteDeleteFrontEndActive value=\'\'}}{{/if}}\r\n\r\n{{/if}}\r\n\r\n<h3>Front End</h3>\r\n<p><input type=\"checkbox\" id=\"wFlowWriteAddFrontEndActive\" name=\"wFlowWriteAddFrontEndActive\" {{$wFlowWriteAddFrontEndActive}} />\r\n Collection rows can be <em>added</em> using the front end of the site</p>\r\n<p><input type=\"checkbox\" id=\"wFlowWriteEditFrontEndActive\" name=\"wFlowWriteEditFrontEndActive\"  {{$wFlowWriteEditFrontEndActive}} /> Collection rows can be <em>edited</em> using the front end of the site</p>\r\n<p><input type=\"checkbox\" id=\"wFlowWriteDeleteFrontEndActive\" name=\"wFlowWriteDeleteFrontEndActive\" {{$wFlowWriteDeleteFrontEndActive}} /> Collection rows can be <em>deleted</em> using the front end of the site</p>\r\n\r\n\r\n<h3>Administrator Area</h3>\r\n<p><input type=\"checkbox\" id=\"wFlowWriteAddAdminActive\" name=\"wFlowWriteAddAdminActive\" {{$wFlowWriteAddAdminActive}} /> Collection rows can be <em>added</em> in admin</p>\r\n<p><input type=\"checkbox\" id=\"wFlowWriteEditAdminActive\" name=\"wFlowWriteEditAdminActive\" {{$wFlowWriteEditAdminActive}} /> Collection rows can be <em>edited</em> in admin</p>\r\n<p><input type=\"checkbox\" id=\"wFlowWriteDeleteAdminActive\" name=\"wFlowWriteDeleteAdminActive\" {{$wFlowWriteDeleteAdminActive}} /> Collection rows can be <em>deleted</em> in admin</p>\r\n','//save workflow for write to database\r\n$WCollectionID 				= $WorkFlowData[\'WFlowCollection\'];\r\n$WCollectionTable 			= $this -> _getCollectionTableName($WCollectionID);\r\n$WCollectionFieldName 		= $this->_getCollectionFieldName($WCollectionID, 1);\r\n$WCollectionFieldNameApply 	= $this->_getCollectionFieldName($WCollectionID, 2);\r\n\r\n$ApplyIn = array();\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD] 			= \'wFlowWriteAddAdminActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT] 			= \'wFlowWriteEditAdminActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE] 		= \'wFlowWriteDeleteAdminActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD] 		= \'wFlowWriteAddFrontEndActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT] 		= \'wFlowWriteEditFrontEndActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE] 		= \'wFlowWriteDeleteFrontEndActive\';\r\n\r\nforeach ($ApplyIn as $ApplyKey => $ApplyValue)\r\n{\r\n\r\n$q = \"SELECT * FROM \". $WCollectionTable. \" WHERE \" . $WCollectionFieldName . \" = \" . $CollectionID . \" AND \" . $WCollectionFieldNameApply . \" = \" . $ApplyKey;\r\n$res = $db->query($q);\r\n\r\nif ($res->numRows() == 0)\r\n{\r\n		$addArray = array();\r\n		$addArray[$WCollectionFieldName] = $CollectionID;\r\n		$addArray[$WCollectionFieldNameApply] = $ApplyKey;\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 4)] = $Data[$ApplyValue];\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_INSERT);\r\n}\r\nelse\r\n{\r\n		$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n		$addArray = array();\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 4)] = $Data[$ApplyValue];\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_UPDATE, \' \'.$this->_getCollectionFieldName($WCollectionID, \'ID\').\' = \' . $row[$this->_getCollectionFieldName($WCollectionID, \'ID\')]);\r\n}\r\n\r\n}//end foreach'),(3,'Send Email Alert',97,6,'on','o2 can send an email alert when a row was inserted into a certain collection','//workflow for sending email\r\n\r\n//we will only send email if there are no errors\r\n\r\nif (count($WorkFlowReturnArray[\'Errors\']) == 0 && count ($WorkFlowReturnArray[\'RuleErrors\']) == 0)\r\n{\r\n\r\n		switch ($ApplyFor)\r\n		{\r\n		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD:\r\n		\r\n		\r\n		\r\n		  break;  //end admin add specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT:\r\n		  \r\n		  \r\n		  \r\n		  break; //end admin edit specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE:\r\n		  \r\n		  \r\n		  \r\n		  break;  //end admin delete specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD:\r\n		\r\n					//we send email only if data was succesfuly saved\r\n							if ($WorkFlowReturnArray[\'InsertedID\'] > 0)\r\n							{\r\n							\r\n										\r\n										$EmailFrom 			= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 7)];\r\n										$EmailFromName 		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 6)];\r\n										$EmailHost 			= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 8)];\r\n										$EmailSubject		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 9)];\r\n										$EmailTemplate		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 10)];\r\n										$SendEmailTo		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 5)];\r\n										$EmailHTML			= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 11)];\r\n										$EmailToName		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 4)];\r\n										\r\n										require_once(\"class.phpmailer.php\");	\r\n				\r\n										$mail = new PHPMailer();\r\n										$mail->From     = $EmailFrom;\r\n										$mail->FromName = $EmailFromName;\r\n										$mail->Host     = $EmailHost;\r\n										$mail->Subject  = $EmailSubject;\r\n										\r\n										$page_id = $EmailTemplate;\r\n										\r\n										$collection_table = $this->_getCollectionTableName($CollectionID);\r\n										$query  = \"SELECT * FROM $collection_table WHERE \". COLLECTION_TABLE_FIELD_PREFIX . $CollectionID .\"_ID=\'\".$WorkFlowReturnArray[\'InsertedID\'].\"\'\";\r\n										$res =  $this->db->query($query);\r\n										$row =  $res -> fetchRow(MDB2_FETCHMODE_ASSOC);\r\n										\r\n										$i = 0;\r\n										foreach ($taxonomy as $key => $v )\r\n										{\r\n											$prefix = COLLECTION_TABLE_FIELD_PREFIX . $CollectionID. \"_\" . $v[\'CollectionFieldId\'];\r\n											if ($v[\'CollectionInputType\'] != 7)\r\n											{\r\n													if ($v[\'CollectionInputType\'] == 2)\r\n													{\r\n														\r\n														$emailArray[] = array ( \"taxonomy\" => $v , \"value\" => nl2br($column_values[$prefix]) , \"lookups\" => $lookups[$prefix]);\r\n													}\r\n													else\r\n													{\r\n														$emailArray[] = array ( \"taxonomy\" => $v , \"value\" => $column_values[$prefix] , \"lookups\" => $lookups[$prefix]);\r\n													}\r\n											}\r\n											else\r\n											{\r\n													if (stripos($row[$prefix], \'http\') !== 0) \r\n													{\r\n													   $emailArray[] = array ( \"taxonomy\" => $v , \"value\" => \"http://\" . $_SERVER[\'HTTP_HOST\'] . $row[$prefix] , \"lookups\" => $lookups[$prefix] );\r\n													}\r\n													else\r\n													{\r\n														$emailArray[] = array ( \"taxonomy\" => $v , \"value\" => $row[$prefix] , \"lookups\" => $lookups[$prefix] );\r\n													}\r\n\r\n\r\n													\r\n											}\r\n										\r\n										}\r\n										\r\n										$tmp = $this->getCollection($CollectionID);\r\n										$smarty -> assign (\"Collection\" , $tmp[0]);\r\n										$smarty -> assign (\"EmailData\" , $emailArray);\r\n										\r\n										$arr = array (\'id\' => $page_id, \'display\' => 1);\r\n										$Content = print_page_data($arr, $smarty);\r\n										\r\n										if ($EmailHTML == \'on\')\r\n										{\r\n											$mail->IsHTML (true);\r\n											$mail->AltBody = $Content;\r\n										}\r\n										else\r\n										{\r\n											$mail->IsHTML (false);\r\n										}	\r\n										\r\n										$mail->Body    = $Content;\r\n										\r\n										$tmpEmailAddressesNames = explode(\',\',$EmailToName);\r\n										$tmpEmailAddresses = explode(\',\',$SendEmailTo);\r\n										\r\n										foreach ($tmpEmailAddresses as $k => $v)\r\n										{\r\n												$mail->AddAddress($v , $tmpEmailAddressesNames[$k]);		\r\n										\r\n										}\r\n										\r\n												\r\n										$mail->Send();\r\n										$mail->ClearAddresses();\r\n							\r\n							\r\n							}\r\n		\r\n		  break;  //end front end add specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT:\r\n		  \r\n		  \r\n		  \r\n		  break; //end front end edit specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE:\r\n		  \r\n		  \r\n		  \r\n		  break;   //end front end delete specific code\r\n		default:\r\n		  \r\n		  // we will not run any code here\r\n		  \r\n		} \r\n\r\n\r\n\r\n} //end workflow for sending email','{{if $smarty.post.save eq \'save\'}}\r\n\r\n{{else}}\r\n\r\n	\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=97 ColumnID=1 Value=$CollectionID Collection_97_2=4 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_97_3 eq \'on\'}}{{assign var=wFlowEmailAddFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowEmailAddFrontEndActive value=\'\'}}{{/if}}\r\n	{{assign var=emailToName value=$Tmp.Collection_97_4}}\r\n	{{assign var=emailToAddress value=$Tmp.Collection_97_5}}\r\n	{{assign var=emailFromName value=$Tmp.Collection_97_6}}\r\n	{{assign var=emailFromAddress value=$Tmp.Collection_97_7}}\r\n	{{assign var=emailHost value=$Tmp.Collection_97_8}}\r\n	{{assign var=emailSubject value=$Tmp.Collection_97_9}}\r\n	{{assign var=emailHTML value=$Tmp.Collection_97_11}}\r\n	{{assign var=emailPage value=$Tmp.Collection_97_10}}\r\n	\r\n\r\n{{/if}}\r\n\r\n<p><input type=\"checkbox\" name=\"wFlowEmailAddFrontEndActive\" {{$wFlowEmailAddFrontEndActive}} /> Activate email sending capability</p>\r\n\r\n<h3>Recipient Info</h3>\r\n\r\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\r\n<tr>\r\n	<td width=\"150\"><p>Recipient Name</p></td>\r\n	<td>\r\n		<p><input type=\"text\" class=\"input\" size=\"40\" name=\"emailToName\" value=\"{{$emailToName}}\" /></p>\r\n	</td>\r\n</tr>\r\n<tr>\r\n	<td><p>Recipient Email Address</p></td>\r\n	<td>\r\n		<p><input type=\"text\" class=\"input\" size=\"40\" name=\"emailToAddress\" value=\"{{$emailToAddress}}\" /></p>\r\n	</td>\r\n</tr>\r\n</table>\r\n\r\n<h3>Sender Info</h3>\r\n\r\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\r\n<tr>\r\n	<td width=\"150\"><p>Sender Name</p></td>\r\n	<td>\r\n		<p><input type=\"text\" class=\"input\" size=\"40\" name=\"emailFromName\" value=\"{{$emailFromName}}\" /></p>\r\n	</td>\r\n</tr>\r\n<tr>\r\n	<td><p>Sender Email Address</p></td>\r\n	<td>\r\n		<p><input type=\"text\" class=\"input\" size=\"40\" name=\"emailFromAddress\" value=\"{{$emailFromAddress}}\" /></p>\r\n	</td>\r\n</tr>\r\n</table>\r\n\r\n<h3>Email Content Info</h3>\r\n\r\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\r\n<tr>\r\n	<td width=\"150\"><p>Host</p></td>\r\n	<td>\r\n		<p><input type=\"text\" class=\"input\" size=\"40\" name=\"emailHost\" value=\"{{$emailHost}}\" /></p>\r\n	</td>\r\n</tr>\r\n<tr>\r\n	<td><p>Email Subject</p></td>\r\n	<td>\r\n		<p><input type=\"text\" class=\"input\" size=\"40\" name=\"emailSubject\" value=\"{{$emailSubject}}\" /></p>\r\n	</td>\r\n</tr>\r\n<tr>\r\n	<td><p>HTML Email</p></td>\r\n	<td>\r\n		<p><select name=\"emailHTML\" class=\"input\">\r\n										<option value=\"on\" {{if $emailHTML eq \'on\'}}selected {{/if}}>YES</option>\r\n										<option value=\"\" {{if $emailHTML neq \'on\'}}selected {{/if}}>NO</option>\r\n								</select></p>\r\n	</td>\r\n</tr>\r\n<tr>\r\n	<td><p>Email Template</p></td>\r\n	<td>\r\n		{{getCollectionByCategory CollectionID=17 ColumnID=4 Value=2 OrderColumn=1 var=PagesEmail}}\r\n		<p><select name=\"emailPage\" class=\"input\">\r\n										<option value=\"\">Select an email template...</option>\r\n										{{foreach from=$PagesEmail item=vPage key=kPage}}\r\n										<option value=\"{{$vPage.Collection_17_ID}}\" {{if $emailPage eq $vPage.Collection_17_ID}}selected {{/if}}>{{$vPage.Collection_17_1}}</option>\r\n										{{/foreach}}\r\n			</select></p>\r\n	</td>\r\n</tr>\r\n</table>','//save workflow for email sending\r\n$WCollectionID 				= $WorkFlowData[\'WFlowCollection\'];\r\n$WCollectionTable 			= $this -> _getCollectionTableName($WCollectionID);\r\n$WCollectionFieldName 		= $this->_getCollectionFieldName($WCollectionID, 1);\r\n$WCollectionFieldNameApply 	= $this->_getCollectionFieldName($WCollectionID, 2);\r\n\r\n$ApplyIn = array();\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD] 		= \'wFlowEmailAddFrontEndActive\';\r\n\r\n\r\nforeach ($ApplyIn as $ApplyKey => $ApplyValue)\r\n{\r\n\r\n$q = \"SELECT * FROM \". $WCollectionTable. \" WHERE \" . $WCollectionFieldName . \" = \" . $CollectionID . \" AND \" . $WCollectionFieldNameApply . \" = \" . $ApplyKey;\r\n$res = $db->query($q);\r\n\r\nif ($res->numRows() == 0)\r\n{\r\n		$addArray = array();\r\n		$addArray[$WCollectionFieldName] = $CollectionID;\r\n		$addArray[$WCollectionFieldNameApply] = $ApplyKey;\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 4)] = $Data[\'emailToName\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 5)] = $Data[\'emailToAddress\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 6)] = $Data[\'emailFromName\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 7)] = $Data[\'emailFromAddress\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 8)] = $Data[\'emailHost\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 9)] = $Data[\'emailSubject\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 11)] = $Data[\'emailHTML\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 10)] = $Data[\'emailPage\'];\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_INSERT);\r\n}\r\nelse\r\n{\r\n		$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n		$addArray = array();\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 4)] = $Data[\'emailToName\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 5)] = $Data[\'emailToAddress\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 6)] = $Data[\'emailFromName\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 7)] = $Data[\'emailFromAddress\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 8)] = $Data[\'emailHost\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 9)] = $Data[\'emailSubject\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 11)] = $Data[\'emailHTML\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 10)] = $Data[\'emailPage\'];\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_UPDATE, \' \'.$this->_getCollectionFieldName($WCollectionID, \'ID\').\' = \' . $row[$this->_getCollectionFieldName($WCollectionID, \'ID\')]);\r\n}\r\n\r\n}//end foreach'),(4,'Approval',99,5,'on','Instead of writting to database this workflow will create copies and send email to admins to approve the entries.\r\nBy enabling this workflow, write to database workflow will be automaticaly disabled.','//workflow for approval\r\n//first we will apply the rules that apply to all cases\r\n\r\nif (count($WorkFlowReturnArray[\'Errors\']) == 0 && count ($WorkFlowReturnArray[\'RuleErrors\']) == 0)\r\n{\r\n				$WorkFlowReturnArray[\'ApprovalID\'] = 0; \r\n				switch ($ApplyFor)\r\n				{\r\n				case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD:\r\n														\r\n								foreach ($taxonomy  as $record)\r\n								{\r\n										$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n										$column_values[$column_name] = CollectionConverter::ConvertValue($SubmittedData[$column_name], $record[\"CollectionFieldType\"]);											\r\n								}\r\n								\r\n								//save the row in the collection\r\n								$inserted_id = $this->insertCollectionRow_($CollectionID, $column_values , $UploadDirectory , $UploadPrefix);\r\n								\r\n								//we need to add code so we can retreive the info and approve it\r\n								$approval_column_values = array();\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_COLLECTION_ID)] = $CollectionID;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_REFERENCE_ID)] = $inserted_id;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_CHANGED_DATA_ID)] = 0;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_ACTION_ID)] = COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_USER_ID)] = $UserID;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_TIMESTAMP)] = date(time());\r\n								\r\n								$mainApproveId = $this->insertCollectionRow_(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, $approval_column_values , \'\' , \'\');\r\n																\r\n								//save the user access levels for this row\r\n								$UserAccessGroups = $this->GetUserGroupAccess($UserID);\r\n								if ($SubmittedData[\'SelectedValuesUserGroups\'] || count($UserAccessGroups) > 0)\r\n								{\r\n									$ugroups = array();\r\n									foreach ($SubmittedData[\'SelectedValuesUserGroups\'] as $saveKey => $saveItem)\r\n									{\r\n											$ugroups[$saveItem] = $saveItem;\r\n									}\r\n									\r\n									//only super admins can update row access level\r\n									if ($SuperAdminUser) \r\n									{\r\n										$this->updateCollectionUserGroupAccessRow($CollectionID, $inserted_id, $ugroups, $UserID);\r\n									}	\r\n									else\r\n									{\r\n										\r\n										$this->updateCollectionUserGroupAccessRow($CollectionID, $inserted_id, $UserAccessGroups, $UserID);\r\n									}\r\n								}\r\n								\r\n								//we need to save xrefs if they exist\r\n								if ($collectionSettings)\r\n								{\r\n									//we get to see if this collection has xrefs :)\r\n									if (count($collectionSettings[5]) > 0)\r\n									{						\r\n										$tmpCollectionsXRefSave  = $collectionSettings[5];\r\n										\r\n										foreach ($tmpCollectionsXRefSave as $key => $value)\r\n										{\r\n											$collectionXrefSave = $value[\'collectionXrefsSave\'];\r\n											$collectionXref 	= $value[\'collectionXrefs\'];\r\n											\r\n											//first we delete the xrefs\r\n											$this -> deleteCollectionXrefs ($collectionXrefSave  ,  $inserted_id);\r\n											if ($SubmittedData[\'SelectedValues_\'.$collectionXref])\r\n											{\r\n												foreach ($SubmittedData[\'SelectedValues_\'.$collectionXref] as $saveKey => $saveItem)\r\n												{\r\n														$xref_column_values = array();\r\n														\r\n														$field1 = $this-> _getCollectionFieldName($collectionXrefSave, 1);\r\n														$field2 = $this-> _getCollectionFieldName($collectionXrefSave, 2);\r\n														\r\n														$xref_column_values[$field1] = $inserted_id;\r\n														$xref_column_values[$field2] = $saveItem;\r\n														$res2 = $this->insertCollectionRow_($collectionXrefSave, $xref_column_values , $UploadDirectory , $UploadPrefix);\r\n												}\r\n											}\r\n										}\r\n									}\r\n									\r\n									if (count($collectionSettings[6]) > 0)\r\n									{\r\n												\r\n												$tmpCollectionsXRefWith  = $collectionSettings[6];\r\n												\r\n												foreach ($tmpCollectionsXRefWith as $key => $collection_value)\r\n												{\r\n													$value = $collection_value[\'collectionComplexXref\'];\r\n													$taxonomyXref = $this->getCollectionTaxonomy($value);\r\n													\r\n													if (count($SubmittedData[\'ExtAttribute_\'.$value.\'_ID\']) > 0)\r\n													{\r\n														\r\n														foreach ($SubmittedData[\'ExtAttribute_\'.$value.\'_ID\'] as $k => $v)\r\n														{\r\n																$XrefValues = array();\r\n																$del = 1;\r\n																foreach ($taxonomyXref as $kk => $vv )\r\n																{\r\n																	if ($vv[\'CollectionFieldRequired\'] == 1 && $SubmittedData[\'ExtAttribute_\'.$value.\'_\'.$vv[\'CollectionFieldId\']][$k] != \'\')\r\n																	{\r\n																		$del = 0;\r\n																	}\r\n																	$column_name = $this->_getCollectionFieldName($value, $vv[\'CollectionFieldId\']);\r\n																	$XrefValues[$column_name] = $SubmittedData[\'ExtAttribute_\'.$value.\'_\'.$vv[\'CollectionFieldId\']][$k];\r\n																	\r\n																}//end foreach\r\n																\r\n																$column_name = $this->_getCollectionFieldName($value, 1);\r\n																$XrefValues[$column_name] = $inserted_id;\r\n																\r\n																if ($del == 1 && $v !=0)\r\n																{\r\n																	//we will delete the entry\r\n																	$this->deleteCollectionRow_($value, $v);\r\n																}\r\n																else\r\n																{\r\n																	//we will add/edit the entry\r\n																	if ($v == 0)\r\n																	{\r\n																		//we will add the value\r\n																		if ($del == 0)\r\n																		{\r\n																		  $this->insertCollectionRow_($value, $XrefValues , $UploadDirectory , $UploadPrefix);	\r\n																		}\r\n																	}\r\n																	else\r\n																	{\r\n																		//we will edit the value\r\n																		$this->updateCollectionRow_($value,  $v , $XrefValues , $UploadDirectory , $UploadPrefix);\r\n																	}\r\n																}//end if delete =0\r\n																\r\n														}//end foreach\r\n														\r\n													}\r\n													\r\n													\r\n												}\r\n																			\r\n									}//end complex xref\r\n									\r\n									\r\n										\r\n								}//edn if save xrefs\r\n								\r\n								$WorkFlowReturnArray[\'InsertedID\'] = $inserted_id;\r\n								$WorkFlowReturnArray[\'ApprovalID\'] = $mainApproveId;\r\n				\r\n				  break;  //end admin add specific code\r\n				case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT:\r\n				  \r\n				  				//we need the edit id param to be set up\r\n								if (intval($EditID) > 0)\r\n								{\r\n										\r\n										//we need to check if there was an edit made before to this row by the same user\r\n										$qTest = \"SELECT * FROM \" . $this-> _getCollectionTableName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID) . \" WHERE \r\n											 	\".$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_CHANGED_DATA_ID).\" = \'\".$EditID.\"\'\r\n												AND \".$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_USER_ID).\" = \'\".$UserID.\"\'\r\n										     \";\r\n											\r\n										$testRes = $this->db->query($qTest);	 \r\n										\r\n										if ($testRes -> numRows() == 0)\r\n										{\r\n										\r\n															foreach ($taxonomy  as $record)\r\n															{\r\n																	$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n																	$column_values[$column_name] = CollectionConverter::ConvertValue($SubmittedData[$column_name], $record[\"CollectionFieldType\"]);											\r\n															}\r\n															\r\n															//save the row in the collection\r\n															$inserted_id = $this->insertCollectionRow_($CollectionID, $column_values , $UploadDirectory , $UploadPrefix);\r\n															\r\n															//we need to add code so we can retreive the info and approve it\r\n															$approval_column_values = array();\r\n															$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_COLLECTION_ID)] = $CollectionID;\r\n															$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_REFERENCE_ID)] = $inserted_id;\r\n															$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_CHANGED_DATA_ID)] = $EditID;\r\n															$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_ACTION_ID)] = COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT;\r\n															$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_USER_ID)] = $UserID;\r\n															$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_TIMESTAMP)] = date(time());\r\n															\r\n															$mainApproveId = $this->insertCollectionRow_(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, $approval_column_values , \'\' , \'\');\r\n																							\r\n															//save the user access levels for this row\r\n															$UserAccessGroups = $this->GetUserGroupAccess($UserID);\r\n															if ($SubmittedData[\'SelectedValuesUserGroups\'] || count($UserAccessGroups) > 0)\r\n															{\r\n																$ugroups = array();\r\n																foreach ($SubmittedData[\'SelectedValuesUserGroups\'] as $saveKey => $saveItem)\r\n																{\r\n																		$ugroups[$saveItem] = $saveItem;\r\n																}\r\n																\r\n																//only super admins can update row access level\r\n																if ($SuperAdminUser) \r\n																{\r\n																	$this->updateCollectionUserGroupAccessRow($CollectionID, $inserted_id, $ugroups, $UserID);\r\n																}	\r\n																else\r\n																{\r\n																	\r\n																	$this->updateCollectionUserGroupAccessRow($CollectionID, $inserted_id, $UserAccessGroups, $UserID);\r\n																}\r\n															}\r\n															\r\n															//we need to save xrefs if they exist\r\n															if ($collectionSettings)\r\n															{\r\n																//we get to see if this collection has xrefs :)\r\n																if (count($collectionSettings[5]) > 0)\r\n																{						\r\n																	$tmpCollectionsXRefSave  = $collectionSettings[5];\r\n																	\r\n																	foreach ($tmpCollectionsXRefSave as $key => $value)\r\n																	{\r\n																		$collectionXrefSave = $value[\'collectionXrefsSave\'];\r\n																		$collectionXref 	= $value[\'collectionXrefs\'];\r\n																		\r\n																		//first we do not delete the xrefs because we create a new one and we do not want to erase the old ones\r\n																		//$this -> deleteCollectionXrefs ($collectionXrefSave  ,  $inserted_id);\r\n																		\r\n																		if ($SubmittedData[\'SelectedValues_\'.$collectionXref])\r\n																		{\r\n																			foreach ($SubmittedData[\'SelectedValues_\'.$collectionXref] as $saveKey => $saveItem)\r\n																			{\r\n																					$xref_column_values = array();\r\n																					\r\n																					$field1 = $this-> _getCollectionFieldName($collectionXrefSave, 1);\r\n																					$field2 = $this-> _getCollectionFieldName($collectionXrefSave, 2);\r\n																					\r\n																					$xref_column_values[$field1] = $inserted_id;\r\n																					$xref_column_values[$field2] = $saveItem;\r\n																					$res2 = $this->insertCollectionRow_($collectionXrefSave, $xref_column_values , $UploadDirectory , $UploadPrefix);\r\n																			}\r\n																		}\r\n																	}\r\n																}\r\n																\r\n																if (count($collectionSettings[6]) > 0)\r\n																{\r\n																			\r\n																			$tmpCollectionsXRefWith  = $collectionSettings[6];\r\n																			\r\n																			foreach ($tmpCollectionsXRefWith as $key => $collection_value)\r\n																			{\r\n																				$value = $collection_value[\'collectionComplexXref\'];\r\n																				$taxonomyXref = $this->getCollectionTaxonomy($value);\r\n																				\r\n																				if (count($SubmittedData[\'ExtAttribute_\'.$value.\'_ID\']) > 0)\r\n																				{\r\n																					\r\n																					foreach ($SubmittedData[\'ExtAttribute_\'.$value.\'_ID\'] as $k => $v)\r\n																					{\r\n																							$XrefValues = array();\r\n																							$del = 1;\r\n																							foreach ($taxonomyXref as $kk => $vv )\r\n																							{\r\n																								if ($vv[\'CollectionFieldRequired\'] == 1 && $SubmittedData[\'ExtAttribute_\'.$value.\'_\'.$vv[\'CollectionFieldId\']][$k] != \'\')\r\n																								{\r\n																									$del = 0;\r\n																								}\r\n																								$column_name = $this->_getCollectionFieldName($value, $vv[\'CollectionFieldId\']);\r\n					\r\n																								$XrefValues[$column_name] = $SubmittedData[\'ExtAttribute_\'.$value.\'_\'.$vv[\'CollectionFieldId\']][$k];\r\n																								\r\n																							}//end foreach\r\n																							\r\n																							$column_name = $this->_getCollectionFieldName($value, 1);\r\n																							$XrefValues[$column_name] = $inserted_id;\r\n																							\r\n																							if ($del == 1 && $v !=0)\r\n																							{\r\n																								//we will not delete any of the entries\r\n																								//$this->deleteCollectionRow_($value, $v);\r\n																							}\r\n																							else\r\n																							{\r\n																								\r\n																								if ($v == 0)\r\n																								{\r\n																									\r\n																									if ($del == 0)\r\n																									{\r\n																									  $this->insertCollectionRow_($value, $XrefValues , $UploadDirectory , $UploadPrefix);	\r\n																									}\r\n																								}\r\n																								else\r\n																								{\r\n																									\r\n																									$this->insertCollectionRow_($value, $XrefValues , $UploadDirectory , $UploadPrefix);	\r\n																								}\r\n																							}//end if delete =0\r\n																							\r\n																					}//end foreach\r\n																					\r\n																				}\r\n																				\r\n																				\r\n																			}\r\n																										\r\n																}//end complex xref\r\n																\r\n																\r\n																	\r\n															}//edn if save xrefs\r\n															\r\n															$WorkFlowReturnArray[\'ApprovalID\'] = $mainApproveId;\r\n															\r\n											}\r\n											else\r\n											{\r\n													//in this case we need to edit the row that was already pending\r\n													$pendingRow = $testRes -> fetchRow(MDB2_FETCHMODE_ASSOC);\r\n													$editPendingRowId = $pendingRow[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_REFERENCE_ID)];\r\n													\r\n													//we simply edit the row\r\n													foreach ($taxonomy  as $record)\r\n													{\r\n														$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n														if (isset($SubmittedData[$column_name]) || $_FILES[$column_name][\'error\'] == UPLOAD_ERR_OK )\r\n														{\r\n															$column_values[$column_name] = CollectionConverter::ConvertValue($SubmittedData[$column_name], $record[\"CollectionFieldType\"]);\r\n														}\r\n													}\r\n													\r\n													\r\n													\r\n													$res = $this->updateCollectionRow_($CollectionID, $editPendingRowId, $column_values , $UploadDirectory , $UploadPrefix);\r\n													\r\n													//user level access is only updated if the row is edited by admins\r\n													if ($SuperAdminUser)\r\n													{\r\n															if ($SubmittedData[\'SelectedValuesUserGroups\'])\r\n															{\r\n																$ugroups = array();\r\n																foreach ($SubmittedData[\'SelectedValuesUserGroups\'] as $saveKey => $saveItem)\r\n																{\r\n																		$ugroups[$saveItem] = $saveItem;\r\n																}\r\n															}\r\n															$this->updateCollectionUserGroupAccessRow($CollectionID, $editPendingRowId, $ugroups, $UserID);	\r\n													}\r\n													\r\n													\r\n													//we need to save xrefs if they exist\r\n													if ($collectionSettings)\r\n													{\r\n														//we get to see if this collection has xrefs :)\r\n														if (count($collectionSettings[5]) > 0)\r\n														{\r\n															$edit_id = $editPendingRowId;\r\n															\r\n															$tmpCollectionsXRefSave  = $collectionSettings[5];\r\n															\r\n															foreach ($tmpCollectionsXRefSave as $key => $value)\r\n															{\r\n																$collectionXrefSave = $value[\'collectionXrefsSave\'];\r\n																$collectionXref 	= $value[\'collectionXrefs\'];\r\n																\r\n																//first we delete the xrefs\r\n																$this -> deleteCollectionXrefs ($collectionXrefSave , $edit_id);\r\n																if ($SubmittedData[\'SelectedValues_\'.$collectionXref])\r\n																{\r\n																	foreach ($SubmittedData[\'SelectedValues_\'.$collectionXref] as $saveKey => $saveItem)\r\n																	{\r\n																			$xref_column_values = array();\r\n																			\r\n																			$field1 = $this-> _getCollectionFieldName($collectionXrefSave, 1);\r\n																			$field2 = $this-> _getCollectionFieldName($collectionXrefSave, 2);\r\n																			\r\n																			$xref_column_values[$field1] = $edit_id;\r\n																			$xref_column_values[$field2] = $saveItem;\r\n																			\r\n																			$res = $this->insertCollectionRow_($collectionXrefSave, $xref_column_values , $UploadDirectory , $UploadPrefix);\r\n																	}\r\n																}\r\n															}\r\n														}	\r\n														\r\n														if (count($collectionSettings[6]) > 0)\r\n														{\r\n														\r\n																	$tmpCollectionsXRefWith  = $collectionSettings[6];\r\n																	\r\n																	$edit_id = $editPendingRowId;														\r\n																	\r\n																	foreach ($tmpCollectionsXRefWith as $key => $collection_value)\r\n																	{\r\n																		$value = $collection_value[\'collectionComplexXref\'];\r\n																		\r\n																		$taxonomyXref = $this->getCollectionTaxonomy($value);\r\n																		\r\n																		if (count($SubmittedData[\'ExtAttribute_\'.$value.\'_ID\']) > 0)\r\n																		{\r\n																			\r\n																			$this -> deleteCollectionXrefs ($value , $editPendingRowId);\r\n																			\r\n																			foreach ($SubmittedData[\'ExtAttribute_\'.$value.\'_ID\'] as $k => $v)\r\n																			{\r\n																					$XrefValues = array();\r\n																					$del = 1;\r\n																					foreach ($taxonomyXref as $kk => $vv )\r\n																					{\r\n																						if ($vv[\'CollectionFieldRequired\'] == 1 && $SubmittedData[\'ExtAttribute_\'.$value.\'_\'.$vv[\'CollectionFieldId\']][$k] != \'\')\r\n																						{\r\n																							$del = 0;\r\n																						}\r\n																						$column_name = $this->_getCollectionFieldName($value, $vv[\'CollectionFieldId\']);\r\n																						$XrefValues[$column_name] = $SubmittedData[\'ExtAttribute_\'.$value.\'_\'.$vv[\'CollectionFieldId\']][$k];\r\n																						\r\n																					}//end foreach\r\n																					\r\n																					$column_name = $this->_getCollectionFieldName($value, 1);\r\n																					$XrefValues[$column_name] = $edit_id;\r\n																					\r\n																					\r\n																					$this->insertCollectionRow_($value, $XrefValues , $UploadDirectory , $UploadPrefix);	\r\n																						\r\n\r\n																					\r\n																			}//end foreach\r\n																			\r\n																		}\r\n																		\r\n																		\r\n																	}\r\n																								\r\n														}//end complex xref\r\n														\r\n														\r\n													}//edn if save xrefs\r\n													\r\n													\r\n													$WorkFlowReturnArray[\'ApprovalID\'] = $pendingRow[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, \'ID\')];;\r\n													$WorkFlowReturnArray[\'ApprovalNoEmail\'] = 1;\r\n											} //end if desire to edit twice the same row by the same user\r\n								\r\n								\r\n								$WorkFlowReturnArray[\'EditedID\'] = $inserted_id;\r\n								\r\n								\r\n								}//end if we have edit id\r\n				  \r\n				  \r\n				  break; //end admin edit specific code\r\n				case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE:\r\n				  				\r\n								$approval_column_values = array();\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_COLLECTION_ID)] = $CollectionID;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_REFERENCE_ID)] = $DeleteID;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_CHANGED_DATA_ID)] = $DeleteID;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_ACTION_ID)] = COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_USER_ID)] = $UserID;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_TIMESTAMP)] = date(time());\r\n							\r\n								$mainApproveId = $this->insertCollectionRow_(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, $approval_column_values , \'\' , \'\');\r\n								\r\n								$WorkFlowReturnArray[\'DeletedID\'] = $DeleteID;\r\n								$WorkFlowReturnArray[\'ApprovalID\'] = $mainApproveId;				\r\n								  			\r\n				  \r\n				  break;  //end admin delete specific code\r\n				case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD:\r\n								\r\n							foreach ($taxonomy  as $record)\r\n							{\r\n								$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n																\r\n								if (($record[\'CollectionHidden\'] == 1 && $SubmittedData[$column_name] ==\'\' && $record[\'CollectionFormula\'] == 1) || ( $_FILES[$column_name][\'error\'] != UPLOAD_ERR_OK) )\r\n								{\r\n									//do not add the field into the edit \r\n								}\r\n								else\r\n								{\r\n									$column_values[$column_name] = CollectionConverter::ConvertValue($SubmittedData[$column_name], $record[\"CollectionFieldType\"]);\r\n								}	\r\n					\r\n							}\r\n							\r\n							$inserted_id = $this->insertCollectionRow_($CollectionID, $column_values , $UploadDirectory , $UploadPrefix);\r\n							\r\n								$approval_column_values = array();\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_COLLECTION_ID)] = $CollectionID;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_REFERENCE_ID)] = $inserted_id;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_CHANGED_DATA_ID)] = 0;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_ACTION_ID)] = COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_USER_ID)] = $UserID;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_TIMESTAMP)] = date(time());\r\n							\r\n								$mainApproveId = $this->insertCollectionRow_(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, $approval_column_values , \'\' , \'\');\r\n								\r\n							$WorkFlowReturnArray[\'InsertedID\'] = $inserted_id;\r\n							$WorkFlowReturnArray[\'ApprovalID\'] = $mainApproveId;\r\n				\r\n				  break;  //end front end add specific code\r\n				case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT:\r\n				  \r\n				  						//we need to check if there was an edit made before to this row by the same user\r\n										$qTest = \"SELECT * FROM \" . $this-> _getCollectionTableName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID) . \" WHERE \r\n											 	\".$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_CHANGED_DATA_ID).\" = \'\".$EditID.\"\'\r\n												AND \".$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_USER_ID).\" = \'\".$UserID.\"\'\r\n										     \";\r\n										$testRes = $this->db->query($qTest);	 \r\n										\r\n										if ($testRes -> numRows() == 0)\r\n										{	\r\n							\r\n													foreach ($taxonomy  as $record)\r\n													{\r\n														$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n																						\r\n														if (($record[\'CollectionHidden\'] == 1 && $SubmittedData[$column_name] ==\'\' && $record[\'CollectionFormula\'] == 1) || ( $_FILES[$column_name][\'error\'] != UPLOAD_ERR_OK) )\r\n														{\r\n															//do not add the field into the edit \r\n														}\r\n														else\r\n														{\r\n															$column_values[$column_name] = CollectionConverter::ConvertValue($SubmittedData[$column_name], $record[\"CollectionFieldType\"]);\r\n														}	\r\n											\r\n													}\r\n													\r\n													$inserted_id = $this->insertCollectionRow_($CollectionID, $column_values , $UploadDirectory , $UploadPrefix);\r\n													\r\n														$approval_column_values = array();\r\n														$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_COLLECTION_ID)] = $CollectionID;\r\n														$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_REFERENCE_ID)] = $inserted_id;\r\n														$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_CHANGED_DATA_ID)] = $EditID;\r\n														$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_ACTION_ID)] = COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT;\r\n														$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_USER_ID)] = $UserID;\r\n														$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_TIMESTAMP)] = date(time());\r\n													\r\n														$mainApproveId = $this->insertCollectionRow_(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, $approval_column_values , \'\' , \'\');\r\n													\r\n													\r\n													$WorkFlowReturnArray[\'ApprovalID\'] = $mainApproveId;\r\n													\r\n										}\r\n										else\r\n										{\r\n												$pendingRow = $testRes -> fetchRow(MDB2_FETCHMODE_ASSOC);\r\n												$editPendingRowId = $pendingRow[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_REFERENCE_ID)];\r\n												\r\n												foreach ($taxonomy  as $record)\r\n												{\r\n													$column_name = $this->_getCollectionFieldName($CollectionID, $record[\"CollectionFieldId\"]);\r\n																					\r\n													if (($record[\'CollectionHidden\'] == 1 && $SubmittedData[$column_name] ==\'\' && $record[\'CollectionFormula\'] == 1) || ( $_FILES[$column_name][\'error\'] != UPLOAD_ERR_OK) )\r\n													{\r\n														//do not add the field into the edit \r\n													}\r\n													else\r\n													{\r\n														$column_values[$column_name] = CollectionConverter::ConvertValue($SubmittedData[$column_name], $record[\"CollectionFieldType\"]);\r\n													}	\r\n										\r\n												}\r\n							\r\n												$this->updateCollectionRow_($CollectionID, $editPendingRowId , $column_values , $UploadDirectory , $UploadPrefix);\r\n													\r\n										\r\n												$WorkFlowReturnArray[\'ApprovalID\'] = $pendingRow[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, \'ID\')];;\r\n												$WorkFlowReturnArray[\'ApprovalNoEmail\'] = 1;\r\n										}			\r\n													\r\n										$WorkFlowReturnArray[\'EditedID\'] = $EditID;	\r\n													\r\n				  \r\n				  break; //end front end edit specific code\r\n				case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE:\r\n				  			\r\n							$approval_column_values = array();\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_COLLECTION_ID)] = $CollectionID;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_REFERENCE_ID)] = $DeleteID;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_CHANGED_DATA_ID)] = $DeleteID;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_ACTION_ID)] = COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_USER_ID)] = $UserID;\r\n								$approval_column_values[$this-> _getCollectionFieldName(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, COLLECTION_WORKFLOW_APPROVE_TABLE_TIMESTAMP)] = date(time());\r\n							\r\n								$mainApproveId = $this->insertCollectionRow_(COLLECTION_WORKFLOW_APPROVE_TABLE_ID, $approval_column_values , \'\' , \'\');\r\n							\r\n							$WorkFlowReturnArray[\'DeletedID\'] = $DeleteID;\r\n				  			$WorkFlowReturnArray[\'ApprovalID\'] = $mainApproveId;\r\n				  \r\n				  break;   //end front end delete specific code\r\n				default:\r\n				  \r\n				  // we will not run any code here\r\n				  \r\n				} \r\n				\r\n		if ($WorkFlowReturnArray[\'ApprovalID\'] > 0 && $WorkFlowReturnArray[\'ApprovalNoEmail\'] != 1)\r\n		{\r\n				//we are going to send the approval email\r\n				$args = array();\r\n				$args[\'changeid\'] 	= $WorkFlowReturnArray[\'ApprovalID\'];\r\n				$args[\'settingid\'] 	= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, \'ID\')];\r\n				\r\n				$EmailFrom 			= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 5)];\r\n				$EmailFromName 		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 6)];\r\n				$EmailSubject		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 7)];\r\n				$EmailTemplate		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 9)];\r\n				$SendEmailTo		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 4)];\r\n				$EmailToName		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 10)];\r\n				\r\n				require_once(\"class.phpmailer.php\");	\r\n								\r\n				$mail = new PHPMailer();\r\n				$mail->From     = $EmailFrom;\r\n				$mail->FromName = $EmailFromName;\r\n				$mail->Subject  = $EmailSubject;\r\n				\r\n				$page_id = $EmailTemplate;\r\n														\r\n				$smarty -> assign (\"args\" , $args);\r\n				\r\n				$arr = array (\'id\' => $page_id, \'display\' => 1);\r\n				$Content = print_page_data($arr, $smarty);\r\n				\r\n				$mail->IsHTML (true);\r\n				$mail->AltBody = $Content;\r\n				$mail->Body    = $Content;\r\n				\r\n				$mail->AddAddress($EmailToName.\" <\".$SendEmailTo.\">\");			\r\n				$mail->Send();\r\n				$mail->ClearAddresses();\r\n		}\r\n}','{{if $smarty.post.save eq \'save\'}}\r\n\r\n{{else}}\r\n\r\n	\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=99 ColumnID=1 Value=$CollectionID Collection_99_2=1 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_99_3 eq \'on\'}}{{assign var=wFlowApproveActive value=\'checked\'}}{{else}}{{assign var=wFlowApproveActive value=\'\'}}{{/if}}\r\n	{{assign var=approveToAddress value=$Tmp.Collection_99_4}}\r\n	{{assign var=approveFromName value=$Tmp.Collection_99_5}}\r\n	{{assign var=approveFromAddress value=$Tmp.Collection_99_6}}\r\n	{{assign var=approveSubject value=$Tmp.Collection_99_7}}\r\n	{{assign var=approveNotes value=$Tmp.Collection_99_8}}\r\n	{{assign var=approvePage value=$Tmp.Collection_99_9}}\r\n	{{assign var=approveToName value=$Tmp.Collection_99_10}}\r\n\r\n\r\n{{/if}}\r\n\r\n{{capture name=jsWorkflowCodeApproval assign=tmpJSApproval}}\r\n				\r\n		$(\"#wFlowApproveActive\").click(function(){ var ch = $(this).attr(\'checked\'); \r\n		\r\n				if (ch == true)\r\n				{\r\n						$(\'#wFlowWriteAddFrontEndActive\').attr(\'checked\',false);\r\n						$(\'#wFlowWriteEditFrontEndActive\').attr(\'checked\',false);\r\n						$(\'#wFlowWriteDeleteFrontEndActive\').attr(\'checked\',false);\r\n						\r\n						$(\'#wFlowWriteAddAdminActive\').attr(\'checked\',false);\r\n						$(\'#wFlowWriteEditAdminActive\').attr(\'checked\',false);\r\n						$(\'#wFlowWriteDeleteAdminActive\').attr(\'checked\',false);\r\n				}\r\n		\r\n		});\r\n		\r\n		$(\"#wFlowWriteAddFrontEndActive\").click(function(){ var ch = $(this).attr(\'checked\');  if (ch == true) {  $(\'#wFlowApproveActive\').attr(\'checked\',false);  } });\r\n		$(\"#wFlowWriteEditFrontEndActive\").click(function(){ var ch = $(this).attr(\'checked\');  if (ch == true) {  $(\'#wFlowApproveActive\').attr(\'checked\',false);  } });\r\n		$(\"#wFlowWriteDeleteFrontEndActive\").click(function(){ var ch = $(this).attr(\'checked\');  if (ch == true) {  $(\'#wFlowApproveActive\').attr(\'checked\',false);  } });\r\n		\r\n		$(\"#wFlowWriteAddAdminActive\").click(function(){ var ch = $(this).attr(\'checked\');  if (ch == true) {  $(\'#wFlowApproveActive\').attr(\'checked\',false);  } });\r\n		$(\"#wFlowWriteEditAdminActive\").click(function(){ var ch = $(this).attr(\'checked\');  if (ch == true) {  $(\'#wFlowApproveActive\').attr(\'checked\',false);  } });\r\n		$(\"#wFlowWriteDeleteAdminActive\").click(function(){ var ch = $(this).attr(\'checked\');  if (ch == true) {  $(\'#wFlowApproveActive\').attr(\'checked\',false);  } });\r\n\r\n{{/capture}}\r\n{{assign var=JavascriptJQueryCode value=$JavascriptJQueryCode|concat:\" \"|concat:$tmpJSApproval}} \r\n\r\n{{RunQuery ResultsVar=XREFsTest q=\"SELECT * FROM CollectionSettings_5  WHERE collectionXrefsSave = \"|concat:$CollectionID}}\r\n{{RunQuery ResultsVar=XREFsTest2 q=\"SELECT * FROM CollectionSettings_6  WHERE collectionComplexXref = \"|concat:$CollectionID}}\r\n\r\n{{if $XREFsTest|@count gt 0 or $XREFsTest2|@count gt 0}}\r\n<div class=\"ui-state-error ui-corner-all\" style=\"padding: 0pt 0.7em;\">\r\n<p style=\"margin-top:4px; margin-bottom:4px;\">\r\n<span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: 0.3em;\"></span>\r\n<strong>Alert:</strong>\r\nThis workflow is disabled because another collection uses this collection to store information.\r\n</p>\r\n</div>\r\n{{else}}\r\n\r\n<p><input type=\"checkbox\" id=\"wFlowApproveActive\" name=\"wFlowApproveActive\" {{$wFlowApproveActive}} /> Activate approval workflow</p>\r\n\r\n<h3>Email Verification Settings</h3>\r\n\r\n<table cellpadding=\"4\" cellspacing=\"0\" border=\"0\">\r\n<tr>\r\n	<td><p>Recipient Name</p></td>\r\n	<td>\r\n		<p><input type=\"text\" class=\"input\" size=\"40\" name=\"approveToName\" value=\"{{$approveToName}}\" /></p>\r\n	</td>\r\n</tr>\r\n<tr>\r\n	<td><p>Recipient Email Address</p></td>\r\n	<td>\r\n		<p><input type=\"text\" class=\"input\" size=\"40\" name=\"approveToAddress\" value=\"{{$approveToAddress}}\" /></p>\r\n	</td>\r\n</tr>\r\n<tr>\r\n	<td width=\"150\"><p>Sender Name</p></td>\r\n	<td>\r\n		<p><input type=\"text\" class=\"input\" size=\"40\" name=\"approveFromName\" value=\"{{$approveFromName}}\" /></p>\r\n	</td>\r\n</tr>\r\n<tr>\r\n	<td><p>Sender Email Address</p></td>\r\n	<td>\r\n		<p><input type=\"text\" class=\"input\" size=\"40\" name=\"approveFromAddress\" value=\"{{$approveFromAddress}}\" /></p>\r\n	</td>\r\n</tr>\r\n<tr>\r\n	<td><p>Subject</p></td>\r\n	<td>\r\n		<p><input type=\"text\" class=\"input\" size=\"40\" name=\"approveSubject\" value=\"{{$approveSubject}}\" /></p>\r\n	</td>\r\n</tr>\r\n\r\n<tr valign=\"top\">\r\n	<td width=\"150\"><p>Notes</p></td>\r\n	<td>\r\n		<p><text{{**}}area class=\"input\" cols=\"40\" rows=\"8\" name=\"approveNotes\">{{$approveNotes}}</text{{**}}area></p>\r\n	</td>\r\n</tr>\r\n<tr>\r\n	<td><p>Email Template</p></td>\r\n	<td>\r\n		{{getCollectionByCategory CollectionID=17 ColumnID=4 Value=2 OrderColumn=1 var=PagesEmail}}\r\n		<p><select name=\"approvePage\" class=\"input\">\r\n										<option value=\"\">Select an email template...</option>\r\n										{{foreach from=$PagesEmail item=vPage key=kPage}}\r\n										<option value=\"{{$vPage.Collection_17_ID}}\" {{if $approvePage eq $vPage.Collection_17_ID}}selected {{/if}}>{{$vPage.Collection_17_1}}</option>\r\n										{{/foreach}}\r\n			</select></p>\r\n	</td>\r\n</tr>\r\n</table>\r\n{{/if}}','//save workflow for approve\r\n$WCollectionID 				= $WorkFlowData[\'WFlowCollection\'];\r\n$WCollectionTable 			= $this -> _getCollectionTableName($WCollectionID);\r\n$WCollectionFieldName 		= $this->_getCollectionFieldName($WCollectionID, 1);\r\n$WCollectionFieldNameApply 	= $this->_getCollectionFieldName($WCollectionID, 2);\r\n\r\n$ApplyIn = array();\r\n\r\n//we save the same settings for each workflowapply\r\n\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD] 			= \'wFlowApproveActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT] 		    = \'wFlowApproveActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE] 		= \'wFlowApproveActive\';\r\n\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD] 		= \'wFlowApproveActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT] 		= \'wFlowApproveActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE] 		= \'wFlowApproveActive\';\r\n\r\n\r\nforeach ($ApplyIn as $ApplyKey => $ApplyValue)\r\n{\r\n\r\n$q = \"SELECT * FROM \". $WCollectionTable. \" WHERE \" . $WCollectionFieldName . \" = \" . $CollectionID . \" AND \" . $WCollectionFieldNameApply . \" = \" . $ApplyKey;\r\n$res = $db->query($q);\r\n\r\nif ($res->numRows() == 0)\r\n{\r\n		$addArray = array();\r\n		$addArray[$WCollectionFieldName] = $CollectionID;\r\n		$addArray[$WCollectionFieldNameApply] = $ApplyKey;\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 4)] = $Data[\'approveToAddress\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 5)] = $Data[\'approveFromName\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 6)] = $Data[\'approveFromAddress\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 7)] = $Data[\'approveSubject\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 8)] = $Data[\'approveNotes\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 9)] = $Data[\'approvePage\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 10)] = $Data[\'approveToName\'];\r\n		\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_INSERT);\r\n}\r\nelse\r\n{\r\n		$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n		$addArray = array();\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 4)] = $Data[\'approveToAddress\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 5)] = $Data[\'approveFromName\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 6)] = $Data[\'approveFromAddress\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 7)] = $Data[\'approveSubject\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 8)] = $Data[\'approveNotes\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 9)] = $Data[\'approvePage\'];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 10)] = $Data[\'approveToName\'];\r\n		\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_UPDATE, \' \'.$this->_getCollectionFieldName($WCollectionID, \'ID\').\' = \' . $row[$this->_getCollectionFieldName($WCollectionID, \'ID\')]);\r\n}\r\n\r\n}//end foreach'),(5,'Collection Behaviours',102,6,'on','After a collection row is added we can define other simple <a href=\"admin.php?module_id=1&action=update&id=31\">behaviours</a> that will work only for one collection.','//workflow for behaviours\r\n\r\n//we will only run behaviours if there are no errors\r\n\r\nif (count($WorkFlowReturnArray[\'Errors\']) == 0 && count ($WorkFlowReturnArray[\'RuleErrors\']) == 0)\r\n{\r\n		\r\n		$collection_table 	= $this->_getCollectionTableName(COLLECTION_BEHAVIOURS);\r\n		$addName 			= $this->_getCollectionFieldName(COLLECTION_BEHAVIOURS, COLLECTION_BEHAVIOURS_ADD);\r\n		$deleteName 		= $this->_getCollectionFieldName(COLLECTION_BEHAVIOURS, COLLECTION_BEHAVIOURS_DELETE);\r\n		$editName 			= $this->_getCollectionFieldName(COLLECTION_BEHAVIOURS, COLLECTION_BEHAVIOURS_EDIT);\r\n		$collectionName		= $this->_getCollectionFieldName(COLLECTION_BEHAVIOURS, COLLECTION_BEHAVIOURS_COLLECTION);\r\n		$pluginName			= $this->_getCollectionFieldName(COLLECTION_BEHAVIOURS, COLLECTION_BEHAVIOURS_CODE);\r\n		$idName				= $this->_getCollectionFieldName(COLLECTION_BEHAVIOURS, \'ID\');\r\n		$adminName 			= $this->_getCollectionFieldName(COLLECTION_BEHAVIOURS, COLLECTION_BEHAVIOURS_ADMIN);\r\n		$collectionFront	= $this->_getCollectionFieldName(COLLECTION_BEHAVIOURS, COLLECTION_BEHAVIOURS_FRONT_END);\r\n		$collectionSort		= $this->_getCollectionFieldName(COLLECTION_BEHAVIOURS, COLLECTION_BEHAVIOURS_SORT_ORDER);\r\n		\r\n		switch ($ApplyFor)\r\n		{\r\n		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD:\r\n					\r\n					$q = \"SELECT $pluginName as pluginName FROM $collection_table WHERE $addName=\'on\' and $adminName=\'on\' and $collectionName=\'\".$CollectionID.\"\' order by \" . $collectionSort;\r\n		\r\n		\r\n		  break;  //end admin add specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT:\r\n		  \r\n		  			$q = \"SELECT $pluginName as pluginName FROM $collection_table WHERE $editName=\'on\' and $adminName=\'on\' and $collectionName=\'\".$CollectionID.\"\' order by \" . $collectionSort;\r\n		  \r\n		  break; //end admin edit specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE:\r\n		  \r\n		  		$q = \"SELECT $pluginName as pluginName FROM $collection_table WHERE $deleteName=\'on\' and $adminName=\'on\' and $collectionName=\'\".$CollectionID.\"\' order by \" . $collectionSort;\r\n		  \r\n		  break;  //end admin delete specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD:\r\n		\r\n					$q = \"SELECT $pluginName as pluginName FROM $collection_table WHERE $addName=\'on\' and $collectionFront=\'on\' and $collectionName=\'\".$CollectionID.\"\' order by \" . $collectionSort;\r\n		\r\n		  break;  //end front end add specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT:\r\n		  \r\n		  			$q = \"SELECT $pluginName as pluginName FROM $collection_table WHERE $editName=\'on\' and $collectionFront=\'on\' and $collectionName=\'\".$CollectionID.\"\' order by \" . $collectionSort;\r\n		  \r\n		  break; //end front end edit specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE:\r\n		  \r\n		  			$q = \"SELECT $pluginName as pluginName FROM $collection_table WHERE $deleteName=\'on\' and $collectionFront=\'on\' and $collectionName=\'\".$CollectionID.\"\' order by \" . $collectionSort;\r\n		  \r\n		  break;   //end front end delete specific code\r\n		default:\r\n		  \r\n		  // we will not run any code here\r\n		  \r\n		} \r\n\r\n		$Behaviours = $this-> db -> queryAll($q);\r\n		\r\n		if ($Behaviours)\r\n			foreach ( $Behaviours as $k => $v )\r\n				eval($v[\'pluginName\']);\r\n				\r\n				\r\n		//we run functions if necessary\r\n		$funcArray = array();\r\n		$funcArray[1] = addslashes($ExtraGetParams[\'func\']);\r\n		$funcArray[2] = $ApplyFor;\r\n		\r\n		$functionsToRun = $this -> getRowsByColValues( COLLECTION_WORKFLOW_FUNCTIONS_TABLE_ID , $funcArray);		\r\n		\r\n		\r\n		\r\n		if (count($functionsToRun) > 0)\r\n		{\r\n				$funcCodeName = $this->_getCollectionFieldName(COLLECTION_WORKFLOW_FUNCTIONS_TABLE_ID, COLLECTION_WORKFLOW_FUNCTIONS_CODE_ID);\r\n				\r\n				foreach ($functionsToRun as $funcKey => $funcValue)\r\n				{\r\n												\r\n						if ($funcValue[$funcCodeName] != \'\')\r\n						{\r\n							eval ($funcValue[$funcCodeName]);\r\n						}				\r\n				}\r\n				\r\n				\r\n		}\r\n				\r\n		\r\n} //end workflow for extra behaviours','{{if $smarty.post.save eq \'save\'}}\r\n\r\n{{else}}\r\n\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=102 ColumnID=1 Value=$CollectionID Collection_102_2=1 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_102_3 eq \'on\'}}{{assign var=wFlowBehaviourAddAdminActive value=\'checked\'}}{{else}}{{assign var=wFlowBehaviourAddAdminActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=102 ColumnID=1 Value=$CollectionID Collection_102_2=2 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_102_3 eq \'on\'}}{{assign var=wFlowBehaviourEditAdminActive value=\'checked\'}}{{else}}{{assign var=wFlowBehaviourEditAdminActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=102 ColumnID=1 Value=$CollectionID Collection_102_2=3 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_102_3 eq \'on\'}}{{assign var=wFlowBehaviourDeleteAdminActive value=\'checked\'}}{{else}}{{assign var=wFlowBehaviourDeleteAdminActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=102 ColumnID=1 Value=$CollectionID Collection_102_2=4 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_102_3 eq \'on\'}}{{assign var=wFlowBehaviourAddFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowBehaviourAddFrontEndActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=102 ColumnID=1 Value=$CollectionID Collection_102_2=5 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_102_3 eq \'on\'}}{{assign var=wFlowBehaviourEditFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowBehaviourEditFrontEndActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=102 ColumnID=1 Value=$CollectionID Collection_102_2=6 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_102_3 eq \'on\'}}{{assign var=wFlowBehaviourDeleteFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowBehaviourDeleteFrontEndActive value=\'\'}}{{/if}}\r\n\r\n{{/if}}\r\n\r\n<h3>Front End</h3>\r\n<p><input type=\"checkbox\" name=\"wFlowBehaviourAddFrontEndActive\" {{$wFlowBehaviourAddFrontEndActive}} /> Behaviours will be executed when a collection row is <em>added</em> using the front end of the site</p>\r\n<p><input type=\"checkbox\" name=\"wFlowBehaviourEditFrontEndActive\" {{$wFlowBehaviourEditFrontEndActive}} /> Behaviours will be executed when a collection row is <em>edited</em> using the front end of the site</p>\r\n<p><input type=\"checkbox\" name=\"wFlowBehaviourDeleteFrontEndActive\" {{$wFlowBehaviourDeleteFrontEndActive}} /> Behaviours will be executed when a collection row is <em>deleted</em> using the front end of the site</p>\r\n\r\n\r\n<h3>Administrator Area</h3>\r\n<p><input type=\"checkbox\" name=\"wFlowBehaviourAddAdminActive\" {{$wFlowBehaviourAddAdminActive}} /> Behaviours will be executed when a collection row is <em>added</em> in admin</p>\r\n<p><input type=\"checkbox\" name=\"wFlowBehaviourEditAdminActive\" {{$wFlowBehaviourEditAdminActive}} /> Behaviours will be executed when a collection row is <em>edited</em> in admin</p>\r\n<p><input type=\"checkbox\" name=\"wFlowBehaviourDeleteAdminActive\" {{$wFlowBehaviourDeleteAdminActive}} /> Behaviours will be executed when a collection row is <em>deleted</em> in admin</p>\r\n','//save workflow for behaviours\r\n$WCollectionID 				= $WorkFlowData[\'WFlowCollection\'];\r\n$WCollectionTable 			= $this -> _getCollectionTableName($WCollectionID);\r\n$WCollectionFieldName 		= $this->_getCollectionFieldName($WCollectionID, 1);\r\n$WCollectionFieldNameApply 	= $this->_getCollectionFieldName($WCollectionID, 2);\r\n\r\n$ApplyIn = array();\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD] 			= \'wFlowBehaviourAddAdminActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT] 			= \'wFlowBehaviourEditAdminActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE] 		= \'wFlowBehaviourDeleteAdminActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD] 		= \'wFlowBehaviourAddFrontEndActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT] 		= \'wFlowBehaviourEditFrontEndActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE] 		= \'wFlowBehaviourDeleteFrontEndActive\';\r\n\r\nforeach ($ApplyIn as $ApplyKey => $ApplyValue)\r\n{\r\n\r\n$q = \"SELECT * FROM \". $WCollectionTable. \" WHERE \" . $WCollectionFieldName . \" = \" . $CollectionID . \" AND \" . $WCollectionFieldNameApply . \" = \" . $ApplyKey;\r\n$res = $db->query($q);\r\n\r\nif ($res->numRows() == 0)\r\n{\r\n		$addArray = array();\r\n		$addArray[$WCollectionFieldName] = $CollectionID;\r\n		$addArray[$WCollectionFieldNameApply] = $ApplyKey;\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 4)] = $Data[$ApplyValue];\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_INSERT);\r\n}\r\nelse\r\n{\r\n		$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n		$addArray = array();\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 4)] = $Data[$ApplyValue];\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_UPDATE, \' \'.$this->_getCollectionFieldName($WCollectionID, \'ID\').\' = \' . $row[$this->_getCollectionFieldName($WCollectionID, \'ID\')]);\r\n}\r\n\r\n}//end foreach'),(6,'Redirect',98,7,'on','Redirecting is useful on the front end side and avoid the alert when visitors refresh the pages after submitting forms.','//workflow for redirecting\r\n\r\n//we will only redirecting if there are no errors\r\n\r\nif (count($WorkFlowReturnArray[\'Errors\']) == 0 && count ($WorkFlowReturnArray[\'RuleErrors\']) == 0)\r\n{\r\n\r\n		switch ($ApplyFor)\r\n		{\r\n		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD:\r\n		\r\n						//if being in admin there are 2 situations\r\n						//we execute from inside the cms or from the front end as a dialog window\r\n						if ($ExtraGetParams[\'dialog\']==1)\r\n						{\r\n								if (isset($WorkFlowReturnArray[\'ApprovalID\']) )\r\n								{\r\n									if ($SuperAdminUser == true)\r\n									{\r\n											$smarty->assign(\'AwaitingApprovalRowID\',$WorkFlowReturnArray[\'EditedID\']);\r\n									}\r\n									\r\n									$smarty->assign(\'AwaitingApproval\',1);\r\n								}	\r\n								$smarty->display (ADMIN_APP_DIR.\'/closeDialog.html\');\r\n								die();\r\n						}\r\n						\r\n						if (isset($WorkFlowReturnArray[\'ApprovalID\']) )\r\n						{\r\n							if ($SuperAdminUser == true)\r\n							{\r\n								header(\"Location: /\".ADMIN_APP_DIR.\"/admin.php?\". $QueryURLString.\"&apinfo=approve&eid=\".$WorkFlowReturnArray[\'InsertedID\']);\r\n							}\r\n							else\r\n							{\r\n								header(\"Location: /\".ADMIN_APP_DIR.\"/admin.php?\". $QueryURLString.\"&apinfo=waitapprove\");\r\n							}	\r\n						}\r\n						else\r\n						{\r\n							header(\"Location: /\".ADMIN_APP_DIR.\"/admin.php?\". $QueryURLString.\"&eid=\".$WorkFlowReturnArray[\'InsertedID\']);\r\n						}\r\n						die();\r\n		\r\n		  break;  //end admin add specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT:\r\n		  			\r\n						if ($ExtraGetParams[\'dialog\']==1)\r\n						{\r\n								if (isset($WorkFlowReturnArray[\'ApprovalID\']) )\r\n								{\r\n									if ($SuperAdminUser == true)\r\n									{\r\n											$smarty->assign(\'AwaitingApprovalRowID\',$WorkFlowReturnArray[\'EditedID\']);\r\n									}\r\n									\r\n									$smarty->assign(\'AwaitingApproval\',1);\r\n								}	\r\n								$smarty->display (ADMIN_APP_DIR.\'/closeDialog.html\');\r\n								die();\r\n						}\r\n						\r\n						if (isset($WorkFlowReturnArray[\'ApprovalID\']) )\r\n						{\r\n							if ($SuperAdminUser == true)\r\n							{\r\n								header(\"Location: /\".ADMIN_APP_DIR.\"/admin.php?\". $QueryURLString.\"&apinfo=approve&eid=\".$WorkFlowReturnArray[\'EditedID\']);\r\n							}\r\n							else\r\n							{\r\n								header(\"Location: /\".ADMIN_APP_DIR.\"/admin.php?\". $QueryURLString.\"&apinfo=waitapprove&eid=\".$ExtraGetParams[\'eid\']);\r\n							}	\r\n						}\r\n						else\r\n						{\r\n							header(\"Location: /\".ADMIN_APP_DIR.\"/admin.php?\". $QueryURLString.\"&eid=\".$EditID);\r\n						}	\r\n						die();\r\n		  \r\n		  \r\n		  break; //end admin edit specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE:\r\n		  \r\n		  				if ($ExtraGetParams[\'dialog\']==1)\r\n						{\r\n								$smarty->display (ADMIN_APP_DIR.\'/closeDialog.html\');\r\n								die();\r\n						}\r\n						\r\n						if ($SuperAdminUser == true && isset($WorkFlowReturnArray[\'ApprovalID\']))\r\n						{\r\n							header(\"Location: /\".ADMIN_APP_DIR.\"/admin.php?\". $QueryURLString.\"&eid=\".$ExtraGetParams[\'did\']);\r\n						}\r\n						else\r\n						{\r\n							header(\"Location: /\".ADMIN_APP_DIR.\"/admin.php?\". $QueryURLString);\r\n						}\r\n						die();\r\n		  \r\n		  break;  //end admin delete specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD:\r\n		\r\n					\r\n					$RedirectActive		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 3)];\r\n					$RedirectURL 		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 4)];\r\n					$RedirectHTTPS		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 5)];\r\n						\r\n					\r\n					if ($RedirectActive == \'on\')		\r\n					{\r\n							$pos = strpos($RedirectURL, \'http\');\r\n							\r\n							if ($pos == false)\r\n							{\r\n									\r\n									$tmpUrl = $smarty->fetch(\'string:\'. $RedirectURL);\r\n									if ($RedirectHTTPS == \'on\')\r\n									{\r\n											$urlTo = \'https://\' . $_SERVER[\'HTTP_HOST\']. $tmpUrl;\r\n									}\r\n									else\r\n									{\r\n											$urlTo = \'http://\' . $_SERVER[\'HTTP_HOST\']. $tmpUrl;\r\n									}\r\n							}\r\n							else\r\n							{\r\n									$urlTo = $RedirectURL;\r\n							}\r\n							\r\n							header(\'Location: \'. $urlTo);\r\n							die();\r\n					}		\r\n		\r\n		  break;  //end front end add specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT:\r\n		  		\r\n				\r\n					$RedirectActive		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 3)];\r\n					$RedirectURL 		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 4)];\r\n					$RedirectHTTPS		= $WorkFlow[\'WorkflowSetting\'][$this->_getCollectionFieldName($WFlowCollection, 5)];\r\n					\r\n					\r\n					\r\n					if ($RedirectActive == \'on\')		\r\n					{\r\n							$pos = strpos($RedirectURL, \'http\');\r\n							\r\n							if ($pos == false)\r\n							{\r\n									\r\n									$tmpUrl = $smarty->fetch(\'string:\'. $RedirectURL);\r\n									if ($RedirectHTTPS == \'on\')\r\n									{\r\n											$urlTo = \'https://\' . $_SERVER[\'HTTP_HOST\']. $tmpUrl;\r\n									}\r\n									else\r\n									{\r\n											$urlTo = \'http://\' . $_SERVER[\'HTTP_HOST\']. $tmpUrl;\r\n									}\r\n							}\r\n							else\r\n							{\r\n									$urlTo = $RedirectURL;\r\n							}\r\n							header(\'Location: \'. $urlTo);\r\n							die();\r\n					}		\r\n		  \r\n		  \r\n		  break; //end front end edit specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE:\r\n		  \r\n		  \r\n		  \r\n		  break;   //end front end delete specific code\r\n		default:\r\n		  \r\n		  // we will not run any code here\r\n		  \r\n		} \r\n\r\n\r\n\r\n} //end workflow for redirecting','{{capture name=jsWorkflowCode assign=tmpJS}}		\r\n\r\n{{/capture}}\r\n{{assign var=JavascriptJQueryCode value=$JavascriptJQueryCode|concat:\" \"|concat:$tmpJS}} \r\n\r\n{{if $smarty.post.save eq \'save\'}}\r\n\r\n{{else}}\r\n\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=98 ColumnID=1 Value=$CollectionID Collection_98_2=4 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_98_3 eq \'on\'}}{{assign var=wFlowRedirectAddFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowRedirectAddFrontEndActive value=\'\'}}{{/if}}\r\n	{{if $Tmp.Collection_98_5 eq \'on\'}}{{assign var=wFlowRedirectAddFrontEndHTTPS value=\'checked\'}}{{else}}{{assign var=wFlowRedirectAddFrontEndHTTPS value=\'\'}}{{/if}}\r\n	{{assign var=wFlowRedirectAddFrontEndURL value=$Tmp.Collection_98_4}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=98 ColumnID=1 Value=$CollectionID Collection_98_2=5 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_98_3 eq \'on\'}}{{assign var=wFlowRedirectEditFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowRedirectEditFrontEndActive value=\'\'}}{{/if}}\r\n	{{if $Tmp.Collection_98_5 eq \'on\'}}{{assign var=wFlowRedirectEditFrontEndHTTPS value=\'checked\'}}{{else}}{{assign var=wFlowRedirectEditFrontEndHTTPS value=\'\'}}{{/if}}\r\n	{{assign var=wFlowRedirectEditFrontEndURL value=$Tmp.Collection_98_4}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=98 ColumnID=1 Value=$CollectionID Collection_98_2=6 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_98_3 eq \'on\'}}{{assign var=wFlowRedirectDeleteFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowRedirectDeleteFrontEndActive value=\'\'}}{{/if}}\r\n	{{if $Tmp.Collection_98_5 eq \'on\'}}{{assign var=wFlowRedirectDeleteFrontEndHTTPS value=\'checked\'}}{{else}}{{assign var=wFlowRedirectDeleteFrontEndHTTPS value=\'\'}}{{/if}}\r\n	{{assign var=wFlowRedirectDeleteFrontEndURL value=$Tmp.Collection_98_4}}\r\n\r\n{{/if}}\r\n\r\n<h3>Redirect on Add</h3>\r\n\r\n<p><input type=\"checkbox\" name=\"wFlowRedirectAddFrontEndActive\" {{$wFlowRedirectAddFrontEndActive}} /> Activate redirecting</p>\r\n<p><input type=\"checkbox\" name=\"wFlowRedirectAddFrontEndHTTPS\" {{$wFlowRedirectAddFrontEndHTTPS}} /> Activate redirecting to <strong>https</strong></p>\r\n<p>Url to redirect <input type=\"text\" class=\"input\" name=\"wFlowRedirectAddFrontEndURL\" value=\"{{$wFlowRedirectAddFrontEndURL|addslashes}}\" size=\"40\"/></p>\r\n\r\n<h3>Redirect on Edit</h3>\r\n\r\n<p><input type=\"checkbox\" name=\"wFlowRedirectEditFrontEndActive\" {{$wFlowRedirectEditFrontEndActive}} /> Activate redirecting</p>\r\n<p><input type=\"checkbox\" name=\"wFlowRedirectEditFrontEndHTTPS\" {{$wFlowRedirectEditFrontEndHTTPS}} /> Activate redirecting to <strong>https</strong></p>\r\n<p>Url to redirect <input type=\"text\" class=\"input\" name=\"wFlowRedirectEditFrontEndURL\" value=\"{{$wFlowRedirectEditFrontEndURL|addslashes}}\" size=\"40\"/></p>\r\n\r\n<h3>Redirect on Delete</h3>\r\n\r\n<p><input type=\"checkbox\" name=\"wFlowRedirectDeleteFrontEndActive\" {{$wFlowRedirectDeleteFrontEndActive}} /> Activate redirecting</p>\r\n<p><input type=\"checkbox\" name=\"wFlowRedirectDeleteFrontEndHTTPS\" {{$wFlowRedirectDeleteFrontEndHTTPS}} /> Activate redirecting to <strong>https</strong></p>\r\n<p>Url to redirect <input type=\"text\" class=\"input\" name=\"wFlowRedirectDeleteFrontEndURL\" value=\"{{$wFlowRedirectDeleteFrontEndURL|addslashes}}\" size=\"40\"/></p>\r\n','//save workflow for redirecting\r\n$WCollectionID 				= $WorkFlowData[\'WFlowCollection\'];\r\n$WCollectionTable 			= $this -> _getCollectionTableName($WCollectionID);\r\n$WCollectionFieldName 		= $this->_getCollectionFieldName($WCollectionID, 1);\r\n$WCollectionFieldNameApply 	= $this->_getCollectionFieldName($WCollectionID, 2);\r\n\r\n$ApplyIn = array();\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD] 		= \'wFlowRedirectAddFrontEndActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT] 		= \'wFlowRedirectEditFrontEndActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE] 		= \'wFlowRedirectDeleteFrontEndActive\';\r\n\r\n$ApplyInHTTPS = array();\r\n$ApplyInHTTPS[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD] 		= \'wFlowRedirectAddFrontEndHTTPS\';\r\n$ApplyInHTTPS[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT] 		= \'wFlowRedirectEditFrontEndHTTPS\';\r\n$ApplyInHTTPS[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE] 	= \'wFlowRedirectDeleteFrontEndHTTPS\';\r\n\r\n$ApplyInURL = array();\r\n$ApplyInURL[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD] 		= \'wFlowRedirectAddFrontEndURL\';\r\n$ApplyInURL[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT] 	= \'wFlowRedirectEditFrontEndURL\';\r\n$ApplyInURL[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE] 	= \'wFlowRedirectDeleteFrontEndURL\';\r\n\r\n\r\nforeach ($ApplyIn as $ApplyKey => $ApplyValue)\r\n{\r\n\r\n$q = \"SELECT * FROM \". $WCollectionTable. \" WHERE \" . $WCollectionFieldName . \" = \" . $CollectionID . \" AND \" . $WCollectionFieldNameApply . \" = \" . $ApplyKey;\r\n$res = $db->query($q);\r\n\r\nif ($res->numRows() == 0)\r\n{\r\n		$addArray = array();\r\n		$addArray[$WCollectionFieldName] = $CollectionID;\r\n		$addArray[$WCollectionFieldNameApply] = $ApplyKey;\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 4)] = $Data[$ApplyInURL[$ApplyKey]];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 5)] = $Data[$ApplyInHTTPS[$ApplyKey]];\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_INSERT);\r\n}\r\nelse\r\n{\r\n		$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n		$addArray = array();\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 4)] = $Data[$ApplyInURL[$ApplyKey]];\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 5)] = $Data[$ApplyInHTTPS[$ApplyKey]];\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_UPDATE, \' \'.$this->_getCollectionFieldName($WCollectionID, \'ID\').\' = \' . $row[$this->_getCollectionFieldName($WCollectionID, \'ID\')]);\r\n}\r\n\r\n}//end foreach'),(7,'Audit',104,3,'on','Collection actions will be recorded when this workflow is active.','//workflow for audit\r\n\r\n//we will only run audit if there are no errors\r\n\r\nif (count($WorkFlowReturnArray[\'Errors\']) == 0 && count ($WorkFlowReturnArray[\'RuleErrors\']) == 0)\r\n{\r\n		\r\n		$columnValues = array();\r\n		$CollectionIDFieldName		= $this->_getCollectionFieldName(105, 1);\r\n		$UserIDFieldName			= $this->_getCollectionFieldName(105, 2);\r\n		$RowIDFieldName				= $this->_getCollectionFieldName(105, 3);\r\n		$ActionFieldName			= $this->_getCollectionFieldName(105, 4);\r\n		$TimeFieldName				= $this->_getCollectionFieldName(105, 5);\r\n		\r\n		$columnValues[$CollectionIDFieldName] = $CollectionID;\r\n		$columnValues[$UserIDFieldName] = $UserID;\r\n		\r\n		$columnValues[$ActionFieldName] = $ApplyFor;\r\n		$columnValues[$TimeFieldName] = date(time());\r\n		\r\n		switch ($ApplyFor)\r\n		{\r\n		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD:\r\n					\r\n					$columnValues[$RowIDFieldName] = $WorkFlowReturnArray[\'InsertedID\'];\r\n		\r\n		\r\n		  break;  //end admin add specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT:\r\n		  \r\n		  			$columnValues[$RowIDFieldName] = $WorkFlowReturnArray[\'EditedID\'];\r\n		  \r\n		  break; //end admin edit specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE:\r\n		  \r\n		  			$columnValues[$RowIDFieldName] = $DeleteID;\r\n		  \r\n		  break;  //end admin delete specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD:\r\n		\r\n					$columnValues[$RowIDFieldName] = $WorkFlowReturnArray[\'InsertedID\'];\r\n		\r\n		  break;  //end front end add specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT:\r\n		  \r\n		  			$columnValues[$RowIDFieldName] = $WorkFlowReturnArray[\'EditedID\'];\r\n		  \r\n		  break; //end front end edit specific code\r\n		case COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE:\r\n		  \r\n		  			$columnValues[$RowIDFieldName] = $DeleteID;\r\n		  \r\n		  break;   //end front end delete specific code\r\n		default:\r\n		  \r\n		  // we will not run any code here\r\n		  \r\n		} \r\n\r\n		$auditrow = $this->insertCollectionRow_(105, $columnValues , \'\' , \'\');\r\n		\r\n		$WorkFlowReturnArray[\'AuditInsertedID\'] = $auditrow;\r\n		\r\n		\r\n\r\n} //end workflow for audit','{{if $smarty.post.save eq \'save\'}}\r\n\r\n{{else}}\r\n\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=104 ColumnID=1 Value=$CollectionID Collection_104_2=1 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_104_3 eq \'on\'}}{{assign var=wFlowAuditAddAdminActive value=\'checked\'}}{{else}}{{assign var=wFlowAuditAddAdminActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=104 ColumnID=1 Value=$CollectionID Collection_104_2=2 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_104_3 eq \'on\'}}{{assign var=wFlowAuditEditAdminActive value=\'checked\'}}{{else}}{{assign var=wFlowAuditEditAdminActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=104 ColumnID=1 Value=$CollectionID Collection_104_2=3 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_104_3 eq \'on\'}}{{assign var=wFlowAuditDeleteAdminActive value=\'checked\'}}{{else}}{{assign var=wFlowAuditDeleteAdminActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=104 ColumnID=1 Value=$CollectionID Collection_104_2=4 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_104_3 eq \'on\'}}{{assign var=wFlowAuditAddFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowAuditAddFrontEndActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=104 ColumnID=1 Value=$CollectionID Collection_104_2=5 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_104_3 eq \'on\'}}{{assign var=wFlowAuditEditFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowAuditEditFrontEndActive value=\'\'}}{{/if}}\r\n	\r\n	{{getCollectionByCategory OrderColumn=1 CollectionID=104 ColumnID=1 Value=$CollectionID Collection_104_2=6 var=TmpVars}}{{assign var=Tmp value=$TmpVars[0]}}\r\n	{{if $Tmp.Collection_104_3 eq \'on\'}}{{assign var=wFlowAuditDeleteFrontEndActive value=\'checked\'}}{{else}}{{assign var=wFlowAuditDeleteFrontEndActive value=\'\'}}{{/if}}\r\n\r\n{{/if}}\r\n\r\n<h3>Front End</h3>\r\n<p><input type=\"checkbox\" name=\"wFlowAuditAddFrontEndActive\" {{$wFlowAuditAddFrontEndActive}} /> Action will be recorded when a collection row is <em>added</em> using the front end of the site</p>\r\n<p><input type=\"checkbox\" name=\"wFlowAuditEditFrontEndActive\" {{$wFlowAuditEditFrontEndActive}} /> Action will be recorded when a collection row is <em>edited</em> using the front end of the site</p>\r\n<p><input type=\"checkbox\" name=\"wFlowAuditDeleteFrontEndActive\" {{$wFlowAuditDeleteFrontEndActive}} /> Action will be recorded when a collection row is <em>deleted</em> using the front end of the site</p>\r\n\r\n\r\n<h3>Administrator Area</h3>\r\n<p><input type=\"checkbox\" name=\"wFlowAuditAddAdminActive\" {{$wFlowAuditAddAdminActive}} /> Action will be recorded when a collection row is <em>added</em> in admin</p>\r\n<p><input type=\"checkbox\" name=\"wFlowAuditEditAdminActive\" {{$wFlowAuditEditAdminActive}} /> Action will be recorded when a collection row is <em>edited</em> in admin</p>\r\n<p><input type=\"checkbox\" name=\"wFlowAuditDeleteAdminActive\" {{$wFlowAuditDeleteAdminActive}} /> Action will be recorded when a collection row is <em>deleted</em> in admin</p>\r\n','//save workflow for behaviours\r\n$WCollectionID 				= $WorkFlowData[\'WFlowCollection\'];\r\n$WCollectionTable 			= $this -> _getCollectionTableName($WCollectionID);\r\n$WCollectionFieldName 		= $this->_getCollectionFieldName($WCollectionID, 1);\r\n$WCollectionFieldNameApply 	= $this->_getCollectionFieldName($WCollectionID, 2);\r\n\r\n$ApplyIn = array();\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_ADD] 			= \'wFlowAuditAddAdminActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_EDIT] 			= \'wFlowAuditEditAdminActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_ADMIN_DELETE] 		= \'wFlowAuditDeleteAdminActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_ADD] 		= \'wFlowAuditAddFrontEndActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_EDIT] 		= \'wFlowAuditEditFrontEndActive\';\r\n$ApplyIn[COLLECTION_WORKFLOW_APPLY_IN_FRONTEND_DELETE] 		= \'wFlowAuditDeleteFrontEndActive\';\r\n\r\nforeach ($ApplyIn as $ApplyKey => $ApplyValue)\r\n{\r\n\r\n$q = \"SELECT * FROM \". $WCollectionTable. \" WHERE \" . $WCollectionFieldName . \" = \" . $CollectionID . \" AND \" . $WCollectionFieldNameApply . \" = \" . $ApplyKey;\r\n$res = $db->query($q);\r\n\r\nif ($res->numRows() == 0)\r\n{\r\n		$addArray = array();\r\n		$addArray[$WCollectionFieldName] = $CollectionID;\r\n		$addArray[$WCollectionFieldNameApply] = $ApplyKey;\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_INSERT);\r\n}\r\nelse\r\n{\r\n		$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);\r\n		$addArray = array();\r\n		$addArray[$this->_getCollectionFieldName($WCollectionID, 3)] = $Data[$ApplyValue];\r\n		$db->extended->autoExecute($WCollectionTable, $addArray, MDB2_AUTOQUERY_UPDATE, \' \'.$this->_getCollectionFieldName($WCollectionID, \'ID\').\' = \' . $row[$this->_getCollectionFieldName($WCollectionID, \'ID\')]);\r\n}\r\n\r\n}//end foreach');

--
-- Table structure for table `Collection_96`
--

CREATE TABLE `Collection_96` (
  `Collection_96_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_96_1` int(11) NOT NULL,
  `Collection_96_2` int(11) NOT NULL,
  `Collection_96_3` varchar(254) DEFAULT NULL,
  `Collection_96_4` varchar(254) DEFAULT NULL,
  PRIMARY KEY (`Collection_96_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=604 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_96`
--

INSERT INTO `Collection_96` VALUES (4,1,1,'on','on'),(5,1,2,'on','on'),(6,1,3,'on','on'),(7,2,1,'on','on'),(8,2,2,'on','on'),(9,2,3,'on','on'),(10,3,1,'on','on'),(11,3,2,'on','on'),(12,3,3,'on','on'),(13,4,1,'on','on'),(14,4,2,'on','on'),(15,4,3,'on','on'),(16,5,1,'on','on'),(17,5,2,'on','on'),(18,5,3,'on','on'),(19,6,1,'on','on'),(20,6,2,'on','on'),(21,6,3,'on','on'),(22,7,1,'on','on'),(23,7,2,'on','on'),(24,7,3,'on','on'),(25,8,1,'on','on'),(26,8,2,'on','on'),(27,8,3,'on','on'),(28,9,1,'on','on'),(29,9,2,'on','on'),(30,9,3,'on','on'),(31,10,1,'on','on'),(32,10,2,'on','on'),(33,10,3,'on','on'),(34,11,1,'on','on'),(35,11,2,'on','on'),(36,11,3,'on','on'),(37,12,1,'on','on'),(38,12,2,'on','on'),(39,12,3,'on','on'),(40,13,1,'on','on'),(41,13,2,'on','on'),(42,13,3,'on','on'),(43,14,1,'on','on'),(44,14,2,'on','on'),(45,14,3,'on','on'),(46,15,1,'on','on'),(47,15,2,'on','on'),(48,15,3,'on','on'),(49,16,1,'on','on'),(50,16,2,'on','on'),(51,16,3,'on','on'),(52,17,1,'on','on'),(53,17,2,'on','on'),(54,17,3,'on','on'),(55,18,1,'on','on'),(56,18,2,'on','on'),(57,18,3,'on','on'),(58,19,1,'on','on'),(59,19,2,'on','on'),(60,19,3,'on','on'),(61,20,1,'on','on'),(62,20,2,'on','on'),(63,20,3,'on','on'),(64,21,1,'on','on'),(65,21,2,'on','on'),(66,21,3,'on','on'),(67,22,1,'on','on'),(68,22,2,'on','on'),(69,22,3,'on','on'),(70,23,1,'on','on'),(71,23,2,'on','on'),(72,23,3,'on','on'),(73,24,1,'on','on'),(74,24,2,'on','on'),(75,24,3,'on','on'),(76,25,1,'on','on'),(77,25,2,'on','on'),(78,25,3,'on','on'),(79,26,1,'on','on'),(80,26,2,'on','on'),(81,26,3,'on','on'),(91,30,1,'on','on'),(92,30,2,'on','on'),(93,30,3,'on','on'),(94,31,1,'on','on'),(95,31,2,'on','on'),(96,31,3,'on','on'),(97,32,1,'on','on'),(98,32,2,'on','on'),(99,32,3,'on','on'),(100,38,1,'on','on'),(101,38,2,'on','on'),(102,38,3,'on','on'),(103,38,1,'on','on'),(104,39,2,'on','on'),(105,39,3,'on','on'),(106,50,1,'on','on'),(107,50,2,'on','on'),(108,50,3,'on','on'),(109,60,1,'on','on'),(110,60,2,'on','on'),(111,60,3,'on','on'),(112,61,1,'on','on'),(113,61,2,'on','on'),(114,61,3,'on','on'),(115,62,1,'on','on'),(116,62,2,'on','on'),(117,62,3,'on','on'),(118,60,1,'on','on'),(119,80,2,'on','on'),(120,80,3,'on','on'),(121,60,1,'on','on'),(122,81,2,'on','on'),(123,81,3,'on','on'),(124,60,1,'on','on'),(125,89,2,'on','on'),(126,89,3,'on','on'),(127,90,1,'on','on'),(128,90,2,'on','on'),(129,90,3,'on','on'),(130,91,1,'on','on'),(131,91,2,'on','on'),(132,91,3,'on','on'),(133,92,1,'on','on'),(134,92,2,'on','on'),(135,92,3,'on','on'),(136,93,1,'on','on'),(137,93,2,'on','on'),(138,93,3,'on','on'),(139,94,1,'on','on'),(140,94,2,'on','on'),(141,94,3,'on','on'),(142,95,1,'on','on'),(143,95,2,'on','on'),(144,95,3,'on','on'),(145,96,1,'on','on'),(146,96,2,'on','on'),(147,96,3,'on','on'),(148,97,1,'on','on'),(149,97,2,'on','on'),(150,97,3,'on','on'),(151,98,1,'on','on'),(152,98,2,'on','on'),(153,98,3,'on','on'),(154,99,1,'on','on'),(155,99,2,'on','on'),(156,99,3,'on','on'),(157,100,1,'on','on'),(158,100,2,'on','on'),(159,100,3,'on','on'),(160,101,1,'on','on'),(161,101,2,'on','on'),(162,101,3,'on','on'),(163,102,1,'on','on'),(164,102,2,'on','on'),(165,102,3,'on','on'),(166,103,1,'on','on'),(167,103,2,'on','on'),(168,103,3,'on','on'),(169,129,1,'on','on'),(170,129,2,'on','on'),(171,129,3,'on','on'),(172,130,1,'on','on'),(173,130,2,'on','on'),(174,130,3,'on','on'),(175,131,1,'on','on'),(176,131,2,'on','on'),(177,131,3,'on','on'),(178,132,1,'on','on'),(179,132,2,'on','on'),(180,132,3,'on','on'),(181,133,1,'on','on'),(182,133,2,'on','on'),(183,133,3,'on','on'),(184,134,1,'on','on'),(185,134,2,'on','on'),(186,134,3,'on','on'),(187,135,1,'on','on'),(188,135,2,'on','on'),(189,135,3,'on','on'),(190,136,1,'on','on'),(191,136,2,'on','on'),(192,136,3,'on','on'),(193,137,1,'on','on'),(194,137,2,'on','on'),(195,137,3,'on','on'),(196,138,1,'on','on'),(197,138,2,'on','on'),(198,138,3,'on','on'),(199,139,1,'on','on'),(200,139,2,'on','on'),(201,139,3,'on','on'),(202,140,1,'on','on'),(203,140,2,'on','on'),(204,140,3,'on','on'),(205,141,1,'on','on'),(206,141,2,'on','on'),(207,141,3,'on','on'),(208,142,1,'on','on'),(209,142,2,'on','on'),(210,142,3,'on','on'),(211,143,1,'on','on'),(212,143,2,'on','on'),(213,143,3,'on','on'),(214,144,1,'on','on'),(215,144,2,'on','on'),(216,144,3,'on','on'),(217,146,1,'on','on'),(218,146,2,'on','on'),(219,146,3,'on','on'),(220,147,1,'on','on'),(221,147,2,'on','on'),(222,147,3,'on','on'),(223,148,1,'on','on'),(224,148,2,'on','on'),(225,148,3,'on','on'),(226,149,1,'on','on'),(227,149,2,'on','on'),(228,149,3,'on','on'),(229,150,1,'on','on'),(230,150,2,'on','on'),(231,150,3,'on','on'),(232,151,1,'on','on'),(233,151,2,'on','on'),(234,151,3,'on','on'),(235,152,1,'on','on'),(236,142,2,'on','on'),(237,152,3,'on','on'),(238,153,1,'on','on'),(239,143,2,'on','on'),(240,153,3,'on','on'),(241,154,1,'on','on'),(242,144,2,'on','on'),(243,154,3,'on','on'),(244,159,1,'on','on'),(245,149,2,'on','on'),(246,159,3,'on','on'),(247,160,1,'on','on'),(248,160,2,'on','on'),(249,160,3,'on','on'),(253,162,1,'on','on'),(254,162,2,'on','on'),(255,162,3,'on','on'),(256,163,1,'on','on'),(257,163,2,'on','on'),(258,163,3,'on','on'),(259,236,1,'on','on'),(260,236,2,'on','on'),(261,236,3,'on','on'),(262,237,1,'on','on'),(263,237,2,'on','on'),(264,237,3,'on','on'),(265,238,1,'on','on'),(266,238,2,'on','on'),(267,238,3,'on','on'),(268,239,1,'on','on'),(269,239,2,'on','on'),(270,239,3,'on','on'),(271,240,1,'on','on'),(272,240,2,'on','on'),(273,240,3,'on','on'),(274,241,1,'on','on'),(275,241,2,'on','on'),(276,241,3,'on','on'),(277,273,1,'on','on'),(278,273,2,'on','on'),(279,273,3,'on','on'),(280,274,1,'on','on'),(281,274,2,'on','on'),(282,274,3,'on','on'),(283,275,1,'on','on'),(284,275,2,'on','on'),(285,275,3,'on','on'),(286,276,1,'on','on'),(287,276,2,'on','on'),(288,276,3,'on','on'),(295,303,1,'on','on'),(296,303,2,'on','on'),(297,303,3,'on','on'),(298,304,1,'on','on'),(299,304,2,'on','on'),(300,304,3,'on','on'),(307,324,3,'on','on'),(306,324,2,'on','on'),(305,324,1,'on','on'),(311,32,4,'on','on'),(312,32,5,NULL,NULL),(313,32,6,NULL,NULL),(314,129,4,NULL,NULL),(315,129,5,NULL,NULL),(316,129,6,NULL,NULL),(317,13,4,NULL,NULL),(318,13,5,NULL,NULL),(319,13,6,NULL,NULL),(320,17,4,NULL,NULL),(321,17,5,NULL,NULL),(322,17,6,NULL,NULL),(323,325,1,'on','on'),(324,325,2,'on','on'),(325,325,3,'on','on'),(326,326,1,'on','on'),(327,326,2,'on','on'),(328,326,3,'on','on'),(329,276,4,NULL,NULL),(330,276,5,NULL,NULL),(331,276,6,NULL,NULL),(332,80,1,'on','on'),(333,80,4,NULL,NULL),(334,80,5,NULL,NULL),(335,80,6,NULL,NULL),(336,81,1,'on','on'),(337,81,4,NULL,NULL),(338,81,5,NULL,NULL),(339,81,6,NULL,NULL),(340,236,4,NULL,NULL),(341,236,5,NULL,NULL),(342,236,6,NULL,NULL),(343,274,4,NULL,NULL),(344,274,5,NULL,NULL),(345,274,6,NULL,NULL),(346,327,1,'on','on'),(347,327,2,'on','on'),(348,327,3,'on','on'),(394,342,1,'on','on'),(393,341,3,'on','on'),(387,339,3,'on','on'),(386,339,2,'on','on'),(385,339,1,'on','on'),(392,341,2,'on','on'),(391,341,1,'on','on'),(402,138,6,NULL,NULL),(401,138,5,'on','on'),(404,139,5,'on','on'),(403,139,4,'on','on'),(400,138,4,'on','on'),(399,159,3,'on','on'),(398,159,2,'on','on'),(397,159,1,'on','on'),(396,342,3,'on','on'),(395,342,2,'on','on'),(406,141,4,'on','on'),(405,139,6,NULL,NULL),(408,141,6,NULL,NULL),(407,141,5,'on','on'),(412,150,4,'on','on'),(411,149,6,NULL,NULL),(410,149,5,'on','on'),(409,149,4,'on','on'),(413,150,5,'on','on'),(414,150,6,NULL,NULL),(471,62,6,NULL,NULL),(469,62,4,NULL,NULL),(470,62,5,NULL,NULL),(513,390,3,'on','on'),(512,390,2,'on','on'),(511,390,1,'on','on'),(484,381,1,'on','on'),(485,381,2,'on','on'),(486,381,3,'on','on'),(490,383,1,'on','on'),(491,383,2,'on','on'),(492,383,3,'on','on'),(519,392,3,'on','on'),(518,392,2,'on','on'),(517,392,1,'on','on'),(510,389,3,'on','on'),(509,389,2,'on','on'),(508,389,1,'on','on'),(520,1,4,'on','on'),(521,1,5,'on','on'),(522,1,6,NULL,NULL),(523,393,1,'on','on'),(524,393,2,'on','on'),(525,393,3,'on','on'),(526,394,1,'on','on'),(527,394,2,'on','on'),(528,394,3,'on','on'),(529,395,1,'on','on'),(530,395,2,'on','on'),(531,395,3,'on','on'),(532,396,1,'on','on'),(533,396,2,'on','on'),(534,396,3,'on','on'),(535,397,1,'on','on'),(536,397,2,'on','on'),(537,397,3,'on','on'),(538,398,1,'on','on'),(539,398,2,'on','on'),(540,398,3,'on','on'),(541,23,4,NULL,NULL),(542,23,5,NULL,NULL),(543,23,6,NULL,NULL),(544,399,1,'on','on'),(545,399,2,'on','on'),(546,399,3,'on','on'),(547,400,1,'on','on'),(548,400,2,'on','on'),(549,400,3,'on','on'),(550,401,1,'on','on'),(551,401,2,'on','on'),(552,401,3,'on','on'),(558,403,3,'on','on'),(557,403,2,'on','on'),(556,403,1,'on','on'),(559,404,1,'on','on'),(560,404,2,'on','on'),(561,404,3,'on','on'),(562,405,1,'on','on'),(563,405,2,'on','on'),(564,405,3,'on','on'),(571,408,1,'on','on'),(572,408,2,'on','on'),(573,408,3,'on','on'),(574,409,1,'on','on'),(575,409,2,'on','on'),(576,409,3,'on','on'),(577,410,1,'on','on'),(578,410,2,'on','on'),(579,410,3,'on','on'),(580,411,1,'on','on'),(581,411,2,'on','on'),(582,411,3,'on','on'),(583,412,1,'on','on'),(584,412,2,'on','on'),(585,412,3,'on','on'),(586,413,1,'on','on'),(587,413,2,'on','on'),(588,413,3,'on','on'),(589,414,1,'on','on'),(590,414,2,'on','on'),(591,414,3,'on','on'),(592,415,1,'on','on'),(593,415,2,'on','on'),(594,415,3,'on','on'),(595,416,1,'on','on'),(596,416,2,'on','on'),(597,416,3,'on','on'),(598,417,1,'on','on'),(599,417,2,'on','on'),(600,417,3,'on','on'),(601,417,4,'on','on'),(602,417,5,NULL,NULL),(603,417,6,NULL,NULL);

--
-- Table structure for table `Collection_97`
--

CREATE TABLE `Collection_97` (
  `Collection_97_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_97_1` int(11) NOT NULL,
  `Collection_97_2` int(11) NOT NULL,
  `Collection_97_3` varchar(254) DEFAULT NULL,
  `Collection_97_4` varchar(254) NOT NULL,
  `Collection_97_5` varchar(254) NOT NULL,
  `Collection_97_6` varchar(254) NOT NULL,
  `Collection_97_7` varchar(254) NOT NULL,
  `Collection_97_8` varchar(254) DEFAULT NULL,
  `Collection_97_9` varchar(254) NOT NULL,
  `Collection_97_10` int(11) NOT NULL,
  `Collection_97_11` varchar(254) DEFAULT NULL,
  PRIMARY KEY (`Collection_97_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=23 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_97`
--

INSERT INTO `Collection_97` VALUES (19,62,4,NULL,'','','','','','',0,'on'),(2,32,4,'on','Dinescu Daniel','ddinescu@oxiem.com','Experience Site','contact@experience.oxiem.com','localhost','Contact Message',4,'on'),(3,129,4,NULL,'','','','','','',0,''),(4,13,4,NULL,'','','','','','',0,''),(5,17,4,NULL,'','','','','','',0,''),(6,276,4,NULL,'','','','','','',0,''),(7,80,4,NULL,'','','','','','',0,''),(8,81,4,NULL,'','','','','','',0,''),(9,236,4,NULL,'','','','','','',0,''),(10,274,4,NULL,'','','','','','',0,''),(12,138,4,NULL,'','','','','','',0,''),(13,139,4,NULL,'','','','','','',0,''),(14,141,4,NULL,'','','','','','',0,''),(15,149,4,NULL,'','','','','','',0,''),(16,150,4,NULL,'','','','','','',0,''),(20,1,4,NULL,'','','','','','',0,''),(21,23,4,NULL,'','','','','','',0,'on'),(22,417,4,'on','Dinescu Daniel','ddinescu@oxiem.com','Pureti Website','info@pureti.com','localhost','Request Info Message',4,'on');

--
-- Table structure for table `Collection_98`
--

CREATE TABLE `Collection_98` (
  `Collection_98_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_98_1` int(11) NOT NULL,
  `Collection_98_2` int(11) NOT NULL,
  `Collection_98_3` varchar(254) DEFAULT NULL,
  `Collection_98_4` varchar(254) DEFAULT NULL,
  `Collection_98_5` varchar(254) DEFAULT NULL,
  PRIMARY KEY (`Collection_98_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=597 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_98`
--

INSERT INTO `Collection_98` VALUES (1,1,1,'on','',''),(2,1,2,'on','',''),(3,1,3,'on','',''),(4,2,1,'on','',''),(5,2,2,'on','',''),(6,2,3,'on','',''),(7,3,1,'on','',''),(8,3,2,'on','',''),(9,3,3,'on','',''),(10,4,1,'on','',''),(11,4,2,'on','',''),(12,4,3,'on','',''),(13,5,1,'on','',''),(14,5,2,'on','',''),(15,5,3,'on','',''),(16,6,1,'on','',''),(17,6,2,'on','',''),(18,6,3,'on','',''),(19,7,1,'on','',''),(20,7,2,'on','',''),(21,7,3,'on','',''),(22,8,1,'on','',''),(23,8,2,'on','',''),(24,8,3,'on','',''),(25,9,1,'on','',''),(26,9,2,'on','',''),(27,9,3,'on','',''),(28,10,1,'on','',''),(29,10,2,'on','',''),(30,10,3,'on','',''),(31,11,1,'on','',''),(32,11,2,'on','',''),(33,11,3,'on','',''),(34,12,1,'on','',''),(35,12,2,'on','',''),(36,12,3,'on','',''),(37,13,1,'on','',''),(38,13,2,'on','',''),(39,13,3,'on','',''),(40,14,1,'on','',''),(41,14,2,'on','',''),(42,14,3,'on','',''),(43,15,1,'on','',''),(44,15,2,'on','',''),(45,15,3,'on','',''),(46,16,1,'on','',''),(47,16,2,'on','',''),(48,16,3,'on','',''),(49,17,1,'on','',''),(50,17,2,'on','',''),(51,17,3,'on','',''),(52,18,1,'on','',''),(53,18,2,'on','',''),(54,18,3,'on','',''),(55,19,1,'on','',''),(56,19,2,'on','',''),(57,19,3,'on','',''),(58,20,1,'on','',''),(59,20,2,'on','',''),(60,20,3,'on','',''),(61,21,1,'on','',''),(62,21,2,'on','',''),(63,21,3,'on','',''),(64,22,1,'on','',''),(65,22,2,'on','',''),(66,22,3,'on','',''),(67,23,1,'on','',''),(68,23,2,'on','',''),(69,23,3,'on','',''),(70,24,1,'on','',''),(71,24,2,'on','',''),(72,24,3,'on','',''),(73,25,1,'on','',''),(74,25,2,'on','',''),(75,25,3,'on','',''),(76,26,1,'on','',''),(77,26,2,'on','',''),(78,26,3,'on','',''),(88,30,1,'on','',''),(89,30,2,'on','',''),(90,30,3,'on','',''),(91,31,1,'on','',''),(92,31,2,'on','',''),(93,31,3,'on','',''),(94,32,1,'on','',''),(95,32,2,'on','',''),(96,32,3,'on','',''),(97,38,1,'on','',''),(98,38,2,'on','',''),(99,38,3,'on','',''),(100,38,1,'on','',''),(101,39,2,'on','',''),(102,39,3,'on','',''),(103,50,1,'on','',''),(104,50,2,'on','',''),(105,50,3,'on','',''),(106,60,1,'on','',''),(107,60,2,'on','',''),(108,60,3,'on','',''),(109,61,1,'on','',''),(110,61,2,'on','',''),(111,61,3,'on','',''),(112,62,1,'on','',''),(113,62,2,'on','',''),(114,62,3,'on','',''),(115,60,1,'on','',''),(116,80,2,'on','',''),(117,80,3,'on','',''),(118,60,1,'on','',''),(119,81,2,'on','',''),(120,81,3,'on','',''),(121,60,1,'on','',''),(122,89,2,'on','',''),(123,89,3,'on','',''),(124,90,1,'on','',''),(125,90,2,'on','',''),(126,90,3,'on','',''),(127,91,1,'on','',''),(128,91,2,'on','',''),(129,91,3,'on','',''),(130,92,1,'on','',''),(131,92,2,'on','',''),(132,92,3,'on','',''),(133,93,1,'on','',''),(134,93,2,'on','',''),(135,93,3,'on','',''),(136,94,1,'on','',''),(137,94,2,'on','',''),(138,94,3,'on','',''),(139,95,1,'on','',''),(140,95,2,'on','',''),(141,95,3,'on','',''),(142,96,1,'on','',''),(143,96,2,'on','',''),(144,96,3,'on','',''),(145,97,1,'on','',''),(146,97,2,'on','',''),(147,97,3,'on','',''),(148,98,1,'on','',''),(149,98,2,'on','',''),(150,98,3,'on','',''),(151,99,1,'on','',''),(152,99,2,'on','',''),(153,99,3,'on','',''),(154,100,1,'on','',''),(155,100,2,'on','',''),(156,100,3,'on','',''),(157,101,1,'on','',''),(158,101,2,'on','',''),(159,101,3,'on','',''),(160,102,1,'on','',''),(161,102,2,'on','',''),(162,102,3,'on','',''),(163,103,1,'on','',''),(164,103,2,'on','',''),(165,103,3,'on','',''),(166,129,1,'on','',''),(167,129,2,'on','',''),(168,129,3,'on','',''),(169,130,1,'on','',''),(170,130,2,'on','',''),(171,130,3,'on','',''),(172,131,1,'on','',''),(173,131,2,'on','',''),(174,131,3,'on','',''),(175,132,1,'on','',''),(176,132,2,'on','',''),(177,132,3,'on','',''),(178,133,1,'on','',''),(179,133,2,'on','',''),(180,133,3,'on','',''),(181,134,1,'on','',''),(182,134,2,'on','',''),(183,134,3,'on','',''),(184,135,1,'on','',''),(185,135,2,'on','',''),(186,135,3,'on','',''),(187,136,1,'on','',''),(188,136,2,'on','',''),(189,136,3,'on','',''),(190,137,1,'on','',''),(191,137,2,'on','',''),(192,137,3,'on','',''),(193,138,1,'on','',''),(194,138,2,'on','',''),(195,138,3,'on','',''),(196,139,1,'on','',''),(197,139,2,'on','',''),(198,139,3,'on','',''),(199,140,1,'on','',''),(200,140,2,'on','',''),(201,140,3,'on','',''),(202,141,1,'on','',''),(203,141,2,'on','',''),(204,141,3,'on','',''),(205,142,1,'on','',''),(206,142,2,'on','',''),(207,142,3,'on','',''),(208,143,1,'on','',''),(209,143,2,'on','',''),(210,143,3,'on','',''),(211,144,1,'on','',''),(212,144,2,'on','',''),(213,144,3,'on','',''),(214,146,1,'on','',''),(215,146,2,'on','',''),(216,146,3,'on','',''),(217,147,1,'on','',''),(218,147,2,'on','',''),(219,147,3,'on','',''),(220,148,1,'on','',''),(221,148,2,'on','',''),(222,148,3,'on','',''),(223,149,1,'on','',''),(224,149,2,'on','',''),(225,149,3,'on','',''),(226,150,1,'on','',''),(227,150,2,'on','',''),(228,150,3,'on','',''),(229,151,1,'on','',''),(230,151,2,'on','',''),(231,151,3,'on','',''),(232,152,1,'on','',''),(233,142,2,'on','',''),(234,152,3,'on','',''),(235,153,1,'on','',''),(236,143,2,'on','',''),(237,153,3,'on','',''),(238,154,1,'on','',''),(239,144,2,'on','',''),(240,154,3,'on','',''),(241,159,1,'on','',''),(242,149,2,'on','',''),(243,159,3,'on','',''),(244,160,1,'on','',''),(245,160,2,'on','',''),(246,160,3,'on','',''),(250,162,1,'on','',''),(251,162,2,'on','',''),(252,162,3,'on','',''),(253,163,1,'on','',''),(254,163,2,'on','',''),(255,163,3,'on','',''),(256,236,1,'on','',''),(257,236,2,'on','',''),(258,236,3,'on','',''),(259,237,1,'on','',''),(260,237,2,'on','',''),(261,237,3,'on','',''),(262,238,1,'on','',''),(263,238,2,'on','',''),(264,238,3,'on','',''),(265,239,1,'on','',''),(266,239,2,'on','',''),(267,239,3,'on','',''),(268,240,1,'on','',''),(269,240,2,'on','',''),(270,240,3,'on','',''),(271,241,1,'on','',''),(272,241,2,'on','',''),(273,241,3,'on','',''),(274,273,1,'on','',''),(275,273,2,'on','',''),(276,273,3,'on','',''),(277,274,1,'on','',''),(278,274,2,'on','',''),(279,274,3,'on','',''),(280,275,1,'on','',''),(281,275,2,'on','',''),(282,275,3,'on','',''),(283,276,1,'on','',''),(284,276,2,'on','',''),(285,276,3,'on','',''),(292,303,1,'on','',''),(293,303,2,'on','',''),(294,303,3,'on','',''),(295,304,1,'on','',''),(296,304,2,'on','',''),(297,304,3,'on','',''),(304,324,3,'on','',''),(303,324,2,'on','',''),(302,324,1,'on','',''),(308,32,4,'on','/contact-us-thank-you.html',NULL),(309,32,5,NULL,'',NULL),(310,32,6,NULL,'',NULL),(311,129,4,NULL,'',NULL),(312,129,5,NULL,'',NULL),(313,129,6,NULL,'',NULL),(314,13,4,NULL,'',NULL),(315,13,5,NULL,'',NULL),(316,13,6,NULL,'',NULL),(317,17,4,NULL,'',NULL),(318,17,5,NULL,'',NULL),(319,17,6,NULL,'',NULL),(320,325,1,'on','',''),(321,325,2,'on','',''),(322,325,3,'on','',''),(323,326,1,'on','',''),(324,326,2,'on','',''),(325,326,3,'on','',''),(326,276,4,NULL,'',NULL),(327,276,5,NULL,'',NULL),(328,276,6,NULL,'',NULL),(329,80,4,NULL,'',NULL),(330,80,5,NULL,'',NULL),(331,80,6,NULL,'',NULL),(332,81,4,NULL,'',NULL),(333,81,5,NULL,'',NULL),(334,81,6,NULL,'',NULL),(335,236,4,NULL,'',NULL),(336,236,5,NULL,'',NULL),(337,236,6,NULL,'',NULL),(338,274,4,NULL,'',NULL),(339,274,5,NULL,'',NULL),(340,274,6,NULL,'',NULL),(341,327,1,'on','',''),(342,327,2,'on','',''),(343,327,3,'on','',''),(389,342,1,'on','',''),(388,341,3,'on','',''),(382,339,3,'on','',''),(381,339,2,'on','',''),(380,339,1,'on','',''),(387,341,2,'on','',''),(386,341,1,'on','',''),(393,138,5,'on','/checkout/shipping-information.html',NULL),(395,139,4,'on','/checkout/payment-information.html',NULL),(394,138,6,NULL,'',NULL),(392,138,4,'on','/checkout/shipping-information.html',NULL),(391,342,3,'on','',''),(390,342,2,'on','',''),(396,139,5,'on','/checkout/payment-information.html',NULL),(397,139,6,NULL,'',NULL),(398,141,4,'on','/checkout/payment-check.html',NULL),(399,141,5,'on','/checkout/payment-check.html',NULL),(400,141,6,NULL,'',NULL),(401,149,4,'on','/checkout/payment-check.html',NULL),(402,149,5,'on','/checkout/payment-check.html',NULL),(403,149,6,NULL,'',NULL),(404,150,4,'on','/checkout/payment-check.html',NULL),(405,150,5,'on','/checkout/payment-check.html',NULL),(406,150,6,NULL,'',NULL),(463,62,6,NULL,'',NULL),(461,62,4,NULL,'',NULL),(462,62,5,NULL,'',NULL),(464,81,1,'on',NULL,NULL),(506,390,3,'on','',''),(505,390,2,'on','',''),(504,390,1,'on','',''),(477,381,1,'on','',''),(478,381,2,'on','',''),(479,381,3,'on','',''),(483,383,1,'on','',''),(484,383,2,'on','',''),(485,383,3,'on','',''),(512,392,3,'on','',''),(511,392,2,'on','',''),(510,392,1,'on','',''),(503,389,3,'on','',''),(502,389,2,'on','',''),(501,389,1,'on','',''),(513,1,4,'on','/register-done.html',NULL),(514,1,5,'on','/welcome.html',NULL),(515,1,6,NULL,'',NULL),(516,393,1,'on','',''),(517,393,2,'on','',''),(518,393,3,'on','',''),(519,394,1,'on','',''),(520,394,2,'on','',''),(521,394,3,'on','',''),(522,395,1,'on','',''),(523,395,2,'on','',''),(524,395,3,'on','',''),(525,396,1,'on','',''),(526,396,2,'on','',''),(527,396,3,'on','',''),(528,397,1,'on','',''),(529,397,2,'on','',''),(530,397,3,'on','',''),(531,398,1,'on','',''),(532,398,2,'on','',''),(533,398,3,'on','',''),(534,23,4,NULL,'',NULL),(535,23,5,NULL,'',NULL),(536,23,6,NULL,'',NULL),(537,399,1,'on','',''),(538,399,2,'on','',''),(539,399,3,'on','',''),(540,400,1,'on','',''),(541,400,2,'on','',''),(542,400,3,'on','',''),(543,401,1,'on','',''),(544,401,2,'on','',''),(545,401,3,'on','',''),(551,403,3,'on','',''),(550,403,2,'on','',''),(549,403,1,'on','',''),(552,404,1,'on','',''),(553,404,2,'on','',''),(554,404,3,'on','',''),(555,405,1,'on','',''),(556,405,2,'on','',''),(557,405,3,'on','',''),(564,408,1,'on','',''),(565,408,2,'on','',''),(566,408,3,'on','',''),(567,409,1,'on','',''),(568,409,2,'on','',''),(569,409,3,'on','',''),(570,410,1,'on','',''),(571,410,2,'on','',''),(572,410,3,'on','',''),(573,411,1,'on','',''),(574,411,2,'on','',''),(575,411,3,'on','',''),(576,412,1,'on','',''),(577,412,2,'on','',''),(578,412,3,'on','',''),(579,413,1,'on','',''),(580,413,2,'on','',''),(581,413,3,'on','',''),(582,414,1,'on','',''),(583,414,2,'on','',''),(584,414,3,'on','',''),(585,415,1,'on','',''),(586,415,2,'on','',''),(587,415,3,'on','',''),(588,416,1,'on','',''),(589,416,2,'on','',''),(590,416,3,'on','',''),(591,417,1,'on','',''),(592,417,2,'on','',''),(593,417,3,'on','',''),(594,417,4,'on','/request-info-thank-you.html',NULL),(595,417,5,NULL,'',NULL),(596,417,6,NULL,'',NULL);

--
-- Table structure for table `Collection_99`
--

CREATE TABLE `Collection_99` (
  `Collection_99_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Collection_99_1` int(11) NOT NULL,
  `Collection_99_2` int(11) NOT NULL,
  `Collection_99_3` varchar(254) DEFAULT NULL,
  `Collection_99_4` varchar(254) NOT NULL,
  `Collection_99_5` varchar(254) NOT NULL,
  `Collection_99_6` varchar(254) NOT NULL,
  `Collection_99_7` varchar(254) NOT NULL,
  `Collection_99_8` text,
  `Collection_99_9` int(11) NOT NULL,
  `Collection_99_10` varchar(254) NOT NULL,
  PRIMARY KEY (`Collection_99_ID`)
) ENGINE=MyISAM AUTO_INCREMENT=133 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Collection_99`
--

INSERT INTO `Collection_99` VALUES (114,62,6,NULL,'','','','','',0,''),(109,62,1,NULL,'','','','','',0,''),(110,62,2,NULL,'','','','','',0,''),(111,62,3,NULL,'','','','','',0,''),(112,62,4,NULL,'','','','','',0,''),(113,62,5,NULL,'','','','','',0,''),(7,129,1,NULL,'','','','','',0,''),(45,236,3,NULL,'ddinescu@oxiem.com','Oxiem CMS','info@oxiem.com','Event Approval Required','',441,'Dinescu Daniel'),(8,129,2,NULL,'','','','','',0,''),(44,236,2,NULL,'ddinescu@oxiem.com','Oxiem CMS','info@oxiem.com','Event Approval Required','',441,'Dinescu Daniel'),(9,129,3,NULL,'','','','','',0,''),(42,81,6,NULL,'','','','','',0,''),(43,236,1,NULL,'ddinescu@oxiem.com','Oxiem CMS','info@oxiem.com','Event Approval Required','',441,'Dinescu Daniel'),(10,129,4,NULL,'','','','','',0,''),(38,81,2,NULL,'','','','','',0,''),(39,81,3,NULL,'','','','','',0,''),(40,81,4,NULL,'','','','','',0,''),(41,81,5,NULL,'','','','','',0,''),(11,129,5,NULL,'','','','','',0,''),(34,80,4,NULL,'','','','','',0,''),(35,80,5,NULL,'','','','','',0,''),(36,80,6,NULL,'','','','','',0,''),(37,81,1,NULL,'','','','','',0,''),(12,129,6,NULL,'','','','','',0,''),(26,276,2,NULL,'','','','','',0,''),(27,276,3,NULL,'','','','','',0,''),(28,276,4,NULL,'','','','','',0,''),(29,276,5,NULL,'','','','','',0,''),(30,276,6,NULL,'','','','','',0,''),(31,80,1,NULL,'','','','','',0,''),(32,80,2,NULL,'','','','','',0,''),(33,80,3,NULL,'','','','','',0,''),(25,276,1,NULL,'','','','','',0,''),(13,13,1,NULL,'bsterzenbach@oxiem.com','Oxiem CMS','approval@oxiem.com','Content approval needed','',441,'Bill'),(14,13,2,NULL,'bsterzenbach@oxiem.com','Oxiem CMS','approval@oxiem.com','Content approval needed','',441,'Bill'),(15,13,3,NULL,'bsterzenbach@oxiem.com','Oxiem CMS','approval@oxiem.com','Content approval needed','',441,'Bill'),(16,13,4,NULL,'bsterzenbach@oxiem.com','Oxiem CMS','approval@oxiem.com','Content approval needed','',441,'Bill'),(17,13,5,NULL,'bsterzenbach@oxiem.com','Oxiem CMS','approval@oxiem.com','Content approval needed','',441,'Bill'),(18,13,6,NULL,'bsterzenbach@oxiem.com','Oxiem CMS','approval@oxiem.com','Content approval needed','',441,'Bill'),(19,17,1,NULL,'bsterzenbach@oxiem.com','Oxiem CMS','approval@oxiem.com','Page needs approval','',441,'Bill'),(20,17,2,NULL,'bsterzenbach@oxiem.com','Oxiem CMS','approval@oxiem.com','Page needs approval','',441,'Bill'),(21,17,3,NULL,'bsterzenbach@oxiem.com','Oxiem CMS','approval@oxiem.com','Page needs approval','',441,'Bill'),(22,17,4,NULL,'bsterzenbach@oxiem.com','Oxiem CMS','approval@oxiem.com','Page needs approval','',441,'Bill'),(23,17,5,NULL,'bsterzenbach@oxiem.com','Oxiem CMS','approval@oxiem.com','Page needs approval','',441,'Bill'),(24,17,6,NULL,'bsterzenbach@oxiem.com','Oxiem CMS','approval@oxiem.com','Page needs approval','',441,'Bill'),(46,236,4,NULL,'ddinescu@oxiem.com','Oxiem CMS','info@oxiem.com','Event Approval Required','',441,'Dinescu Daniel'),(47,236,5,NULL,'ddinescu@oxiem.com','Oxiem CMS','info@oxiem.com','Event Approval Required','',441,'Dinescu Daniel'),(48,236,6,NULL,'ddinescu@oxiem.com','Oxiem CMS','info@oxiem.com','Event Approval Required','',441,'Dinescu Daniel'),(49,274,1,NULL,'ddinescu@oxiem.com','Oxiem CMS','info@oxiem.com','News Approval Needed','',441,'Dinescu Daniel'),(50,274,2,NULL,'ddinescu@oxiem.com','Oxiem CMS','info@oxiem.com','News Approval Needed','',441,'Dinescu Daniel'),(51,274,3,NULL,'ddinescu@oxiem.com','Oxiem CMS','info@oxiem.com','News Approval Needed','',441,'Dinescu Daniel'),(52,274,4,NULL,'ddinescu@oxiem.com','Oxiem CMS','info@oxiem.com','News Approval Needed','',441,'Dinescu Daniel'),(53,274,5,NULL,'ddinescu@oxiem.com','Oxiem CMS','info@oxiem.com','News Approval Needed','',441,'Dinescu Daniel'),(54,274,6,NULL,'ddinescu@oxiem.com','Oxiem CMS','info@oxiem.com','News Approval Needed','',441,'Dinescu Daniel'),(66,138,6,NULL,'','','','','',0,''),(65,138,5,NULL,'','','','','',0,''),(64,138,4,NULL,'','','','','',0,''),(63,138,3,NULL,'','','','','',0,''),(62,138,2,NULL,'','','','','',0,''),(61,138,1,NULL,'','','','','',0,''),(67,139,1,NULL,'','','','','',0,''),(68,139,2,NULL,'','','','','',0,''),(69,139,3,NULL,'','','','','',0,''),(70,139,4,NULL,'','','','','',0,''),(71,139,5,NULL,'','','','','',0,''),(72,139,6,NULL,'','','','','',0,''),(73,141,1,NULL,'','','','','',0,''),(74,141,2,NULL,'','','','','',0,''),(75,141,3,NULL,'','','','','',0,''),(76,141,4,NULL,'','','','','',0,''),(77,141,5,NULL,'','','','','',0,''),(78,141,6,NULL,'','','','','',0,''),(79,149,1,NULL,'','','','','',0,''),(80,149,2,NULL,'','','','','',0,''),(81,149,3,NULL,'','','','','',0,''),(82,149,4,NULL,'','','','','',0,''),(83,149,5,NULL,'','','','','',0,''),(84,149,6,NULL,'','','','','',0,''),(85,150,1,NULL,'','','','','',0,''),(86,150,2,NULL,'','','','','',0,''),(87,150,3,NULL,'','','','','',0,''),(88,150,4,NULL,'','','','','',0,''),(89,150,5,NULL,'','','','','',0,''),(90,150,6,NULL,'','','','','',0,''),(91,32,1,NULL,'','','','','',0,''),(92,32,2,NULL,'','','','','',0,''),(93,32,3,NULL,'','','','','',0,''),(94,32,4,NULL,'','','','','',0,''),(95,32,5,NULL,'','','','','',0,''),(96,32,6,NULL,'','','','','',0,''),(115,1,1,NULL,'','','','','',0,''),(116,1,2,NULL,'','','','','',0,''),(117,1,3,NULL,'','','','','',0,''),(118,1,4,NULL,'','','','','',0,''),(119,1,5,NULL,'','','','','',0,''),(120,1,6,NULL,'','','','','',0,''),(121,23,1,NULL,'','','','','',0,''),(122,23,2,NULL,'','','','','',0,''),(123,23,3,NULL,'','','','','',0,''),(124,23,4,NULL,'','','','','',0,''),(125,23,5,NULL,'','','','','',0,''),(126,23,6,NULL,'','','','','',0,''),(127,417,1,NULL,'','','','','',0,''),(128,417,2,NULL,'','','','','',0,''),(129,417,3,NULL,'','','','','',0,''),(130,417,4,NULL,'','','','','',0,''),(131,417,5,NULL,'','','','','',0,''),(132,417,6,NULL,'','','','','',0,'');

--
-- Table structure for table `Rev_Collection_13`
--

CREATE TABLE `Rev_Collection_13` (
  `RevisionID` int(11) NOT NULL AUTO_INCREMENT,
  `RevisionUserID` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionCreateTime` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionReason` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionSetID` bigint(20) unsigned NOT NULL DEFAULT '0',
  `Collection_13_ID` int(11) NOT NULL DEFAULT '0',
  `Collection_13_1` varchar(254) NOT NULL DEFAULT '',
  `Collection_13_2` longtext,
  `Collection_13_3` int(11) DEFAULT NULL,
  `Collection_13_4` int(11) DEFAULT NULL,
  `Collection_13_6` longtext,
  `Collection_13_7` bigint(20) DEFAULT NULL,
  `Collection_13_8` longtext,
  `Collection_13_9` longtext,
  `Collection_13_10` longtext,
  `Collection_13_11` varchar(254) DEFAULT NULL,
  `Collection_13_12` varchar(254) DEFAULT NULL,
  `Collection_13_13` varchar(254) DEFAULT NULL,
  `Collection_13_14` longtext,
  `Collection_13_15` longtext,
  `Collection_13_16` varchar(254) DEFAULT NULL,
  `Collection_13_17` longtext,
  `Collection_13_18` varchar(254) DEFAULT NULL,
  PRIMARY KEY (`RevisionID`)
) ENGINE=MyISAM AUTO_INCREMENT=193 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Rev_Collection_13`
--



--
-- Table structure for table `Rev_Collection_19`
--

CREATE TABLE `Rev_Collection_19` (
  `RevisionID` int(11) NOT NULL AUTO_INCREMENT,
  `RevisionUserID` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionCreateTime` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionReason` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionSetID` bigint(20) unsigned NOT NULL DEFAULT '0',
  `Collection_19_ID` int(11) NOT NULL DEFAULT '0',
  `Collection_19_1` int(11) DEFAULT NULL,
  `Collection_19_2` int(11) DEFAULT NULL,
  PRIMARY KEY (`RevisionID`)
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `Rev_Collection_19`
--

INSERT INTO `Rev_Collection_19` VALUES (1,22,1366836275,2,88,1103,17,2),(2,22,1366836275,2,88,1102,17,1),(3,22,1366836275,2,88,1101,17,3),(4,22,1366836642,2,89,1152,17,3),(5,22,1366836642,2,89,1151,17,1),(6,22,1366836642,2,89,1150,17,2),(7,22,1366836759,2,90,1155,17,3),(8,22,1366836759,2,90,1154,17,1),(9,22,1366836759,2,90,1153,17,2),(10,22,1366836828,2,91,1158,17,3),(11,22,1366836828,2,91,1157,17,1),(12,22,1366836828,2,91,1156,17,2);

--
-- Table structure for table `Rev_Collection_409`
--

CREATE TABLE `Rev_Collection_409` (
  `RevisionID` int(11) NOT NULL AUTO_INCREMENT,
  `RevisionUserID` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionCreateTime` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionReason` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionSetID` bigint(20) unsigned NOT NULL DEFAULT '0',
  `Collection_409_ID` int(11) NOT NULL DEFAULT '0',
  `Collection_409_1` int(11) DEFAULT NULL,
  `Collection_409_2` int(11) DEFAULT NULL,
  `Collection_409_3` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`RevisionID`)
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Rev_Collection_409`
--

INSERT INTO `Rev_Collection_409` VALUES (1,1,1386150804,2,166,1,560,3,1),(2,1,1386150804,2,166,2,560,2,2),(3,1,1386150804,2,166,3,560,1,3),(4,1,1386150831,2,167,1,560,3,1),(5,1,1386150831,2,167,2,560,2,2),(6,1,1386150831,2,167,3,560,1,3),(7,1,1386154344,2,168,1,560,3,1),(8,1,1386154344,2,168,2,560,2,2),(9,1,1386154344,2,168,3,560,1,3);

--
-- Table structure for table `Rev_Collection_411`
--

CREATE TABLE `Rev_Collection_411` (
  `RevisionID` int(11) NOT NULL AUTO_INCREMENT,
  `RevisionUserID` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionCreateTime` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionReason` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionSetID` bigint(20) unsigned NOT NULL DEFAULT '0',
  `Collection_411_ID` int(11) NOT NULL DEFAULT '0',
  `Collection_411_1` int(11) DEFAULT NULL,
  `Collection_411_2` int(11) DEFAULT NULL,
  PRIMARY KEY (`RevisionID`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Rev_Collection_411`
--

INSERT INTO `Rev_Collection_411` VALUES (1,1,1386159459,2,173,1,561,1),(2,1,1386159459,2,173,2,561,2);

--
-- Table structure for table `Rev_Collection_413`
--

CREATE TABLE `Rev_Collection_413` (
  `RevisionID` int(11) NOT NULL AUTO_INCREMENT,
  `RevisionUserID` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionCreateTime` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionReason` bigint(20) unsigned NOT NULL DEFAULT '0',
  `RevisionSetID` bigint(20) unsigned NOT NULL DEFAULT '0',
  `Collection_413_ID` int(11) NOT NULL DEFAULT '0',
  `Collection_413_1` int(11) NOT NULL DEFAULT '0',
  `Collection_413_2` int(11) NOT NULL DEFAULT '0',
  `Collection_413_3` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`RevisionID`)
) ENGINE=MyISAM AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `Rev_Collection_413`
--

INSERT INTO `Rev_Collection_413` VALUES (1,1,1386144162,2,144,1,561,6,10),(2,1,1386144162,2,144,2,561,2,20),(3,1,1386144162,2,144,3,561,4,30),(4,1,1386144162,2,144,4,561,3,40),(5,1,1386144162,2,144,5,561,1,50),(6,1,1386144162,2,144,6,561,5,60),(7,1,1386159126,2,171,1,561,6,10),(8,1,1386159126,2,171,2,561,2,20),(9,1,1386159126,2,171,3,561,4,30),(10,1,1386159126,2,171,4,561,3,40),(11,1,1386159126,2,171,5,561,1,50),(12,1,1386159126,2,171,6,561,5,60),(13,1,1386159257,2,172,1,561,6,10),(14,1,1386159257,2,172,2,561,2,20),(15,1,1386159257,2,172,3,561,4,30),(16,1,1386159257,2,172,4,561,3,40),(17,1,1386159257,2,172,5,561,1,50),(18,1,1386159257,2,172,6,561,5,60),(19,1,1386159459,2,173,1,561,6,10),(20,1,1386159459,2,173,2,561,2,20),(21,1,1386159459,2,173,3,561,4,30),(22,1,1386159459,2,173,4,561,3,40),(23,1,1386159459,2,173,5,561,1,50),(24,1,1386159459,2,173,6,561,5,60);

--
-- Table structure for table `collectionrowrolexref`
--

CREATE TABLE `collectionrowrolexref` (
  `CollectionId` int(11) NOT NULL DEFAULT '0',
  `CollectionRowId` int(11) NOT NULL DEFAULT '0',
  `UserGroupId` int(11) NOT NULL DEFAULT '0',
  `CreatedDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `CreatedBy` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`CollectionId`,`CollectionRowId`,`UserGroupId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `collectionrowrolexref`
--

INSERT INTO `collectionrowrolexref` VALUES (1,2,1,'2013-01-24 16:13:29',1),(6,5,6,'2009-06-22 15:02:08',1),(6,1,11,'2009-06-22 15:01:33',1),(4,13,1,'2010-09-11 16:07:41',1),(4,1,1,'2010-09-11 16:17:45',1),(4,305,2,'2009-02-17 04:27:58',1),(13,25,1,'2012-05-07 13:33:31',1),(17,2,1,'2012-05-07 16:54:27',2),(274,9,1,'2013-12-06 17:38:43',1),(4,17,6,'2010-09-11 16:08:39',1),(13,2,1,'2013-12-06 17:34:41',1),(17,14,1,'2008-09-13 15:56:16',1),(17,1,1,'2013-12-04 08:47:22',1),(6,11,6,'2009-06-22 15:02:41',1),(13,251,1,'2013-12-06 17:51:59',1),(4,304,2,'2010-09-13 08:17:36',1),(17,233,1,'2008-11-03 18:14:18',1),(4,303,2,'2008-12-04 09:30:12',1),(4,302,1,'2008-11-28 17:18:01',2),(4,288,1,'2010-09-13 08:17:24',1),(4,306,2,'2009-02-19 14:27:14',1),(4,344,2,'2010-11-11 16:47:03',1),(4,307,2,'2009-05-26 11:17:57',1),(4,307,5,'2009-05-26 11:17:57',1),(6,1,12,'2009-06-22 15:01:33',1),(6,5,1,'2009-06-22 15:02:08',1),(6,11,1,'2009-06-22 15:02:41',1),(4,13,6,'2010-09-11 16:07:41',1),(4,240,6,'2009-06-22 15:07:19',1),(4,236,12,'2010-09-13 08:16:06',1),(4,38,6,'2010-09-13 08:16:14',1),(6,1,10,'2009-06-22 15:01:33',1),(6,1,9,'2009-06-22 15:01:33',1),(6,1,8,'2009-06-22 15:01:33',1),(6,1,7,'2009-06-22 15:01:33',1),(6,1,6,'2009-06-22 15:01:33',1),(6,1,1,'2009-06-22 15:01:33',1),(6,5,7,'2009-06-22 15:02:08',1),(6,5,8,'2009-06-22 15:02:08',1),(6,5,9,'2009-06-22 15:02:08',1),(6,5,10,'2009-06-22 15:02:08',1),(6,5,11,'2009-06-22 15:02:08',1),(6,5,12,'2009-06-22 15:02:08',1),(6,11,7,'2009-06-22 15:02:41',1),(6,11,8,'2009-06-22 15:02:41',1),(6,11,9,'2009-06-22 15:02:41',1),(6,11,10,'2009-06-22 15:02:41',1),(6,11,11,'2009-06-22 15:02:41',1),(6,11,12,'2009-06-22 15:02:41',1),(4,240,7,'2009-06-22 15:07:19',1),(4,240,8,'2009-06-22 15:07:19',1),(4,240,9,'2009-06-22 15:07:19',1),(4,240,10,'2009-06-22 15:07:19',1),(4,240,11,'2009-06-22 15:07:19',1),(4,240,12,'2009-06-22 15:07:19',1),(4,236,11,'2010-09-13 08:16:06',1),(4,236,10,'2010-09-13 08:16:06',1),(4,236,9,'2010-09-13 08:16:06',1),(4,236,8,'2010-09-13 08:16:06',1),(4,236,7,'2010-09-13 08:16:06',1),(4,236,6,'2010-09-13 08:16:06',1),(4,314,2,'2009-09-22 13:32:51',1),(4,314,5,'2009-09-22 13:32:51',1),(4,315,2,'2009-09-22 13:33:26',1),(4,315,5,'2009-09-22 13:33:26',1),(4,316,2,'2009-09-22 13:34:08',1),(4,316,5,'2009-09-22 13:34:08',1),(4,317,2,'2009-09-22 13:35:10',1),(4,317,5,'2009-09-22 13:35:10',1),(4,318,2,'2009-09-22 14:20:36',1),(4,318,5,'2009-09-22 14:20:36',1),(4,319,2,'2009-09-22 14:54:16',1),(4,319,5,'2009-09-22 14:54:16',1),(4,320,2,'2009-09-22 14:55:10',1),(4,320,5,'2009-09-22 14:55:10',1),(4,321,2,'2009-09-22 14:55:31',1),(4,321,5,'2009-09-22 14:55:31',1),(4,322,2,'2009-09-22 16:24:06',1),(4,322,5,'2009-09-22 16:24:06',1),(4,323,2,'2009-10-02 15:18:30',1),(4,323,5,'2009-10-02 15:18:30',1),(4,340,2,'2010-09-13 14:57:01',1),(4,324,2,'2010-09-13 08:32:24',1),(129,5,6,'2011-10-26 14:32:09',1),(4,346,13,'2010-11-30 15:37:47',2),(4,17,1,'2010-09-11 16:08:39',1),(17,452,1,'2010-03-02 15:47:51',1),(13,536,1,'2010-03-02 15:47:08',1),(13,525,6,'2010-06-30 17:08:06',1),(4,344,5,'2010-11-11 16:47:03',1),(17,462,1,'2010-05-05 18:41:24',1),(4,345,1,'2010-11-30 15:13:09',2),(13,542,1,'2010-05-05 18:32:07',1),(17,461,1,'2010-05-05 18:37:49',1),(13,541,1,'2010-05-05 18:30:40',1),(17,460,1,'2010-05-05 18:36:59',1),(13,544,1,'2010-05-05 18:37:49',1),(17,458,1,'2010-05-05 18:30:40',1),(38,7,6,'2010-02-19 15:50:40',1),(38,7,1,'2010-02-19 15:50:40',1),(4,274,6,'2010-09-13 08:18:00',1),(129,5,1,'2011-10-26 14:32:09',1),(17,459,1,'2010-05-05 18:32:07',1),(4,325,2,'2010-02-22 14:51:23',1),(4,325,5,'2010-02-22 14:51:23',1),(4,326,2,'2010-02-22 14:51:34',1),(4,326,5,'2010-02-22 14:51:34',1),(17,463,1,'2010-05-16 23:59:17',1),(13,547,1,'2010-05-18 12:02:36',1),(4,373,2,'2011-02-08 02:47:53',1),(13,548,1,'2010-05-18 12:10:52',1),(17,465,1,'2010-05-18 13:29:24',1),(17,466,1,'2010-05-18 15:10:31',2),(4,327,13,'2010-09-13 08:21:46',1),(4,327,2,'2010-09-13 08:21:46',1),(4,327,1,'2010-09-13 08:21:46',1),(4,343,2,'2010-10-11 17:32:09',1),(4,343,5,'2010-10-11 17:32:09',1),(4,328,2,'2010-07-07 09:10:02',1),(4,328,5,'2010-07-07 09:10:02',1),(4,329,2,'2010-07-07 09:12:28',1),(4,329,5,'2010-07-07 09:12:28',1),(4,330,2,'2010-07-07 09:13:57',1),(4,330,5,'2010-07-07 09:13:57',1),(4,331,2,'2010-07-07 09:15:55',1),(4,331,5,'2010-07-07 09:15:55',1),(4,332,2,'2010-07-07 09:20:29',1),(4,332,5,'2010-07-07 09:20:29',1),(4,333,2,'2010-07-07 09:22:31',1),(4,333,5,'2010-07-07 09:22:31',1),(4,334,2,'2010-07-07 09:24:14',1),(4,334,5,'2010-07-07 09:24:14',1),(4,335,2,'2010-07-07 09:25:19',1),(4,335,5,'2010-07-07 09:25:19',1),(13,580,6,'2010-07-21 13:57:33',1),(13,581,6,'2010-07-09 20:48:22',2),(13,582,6,'2010-07-09 20:46:27',2),(13,583,6,'2010-07-09 20:48:58',2),(13,584,6,'2010-07-09 20:47:12',2),(13,585,6,'2010-07-09 20:43:00',2),(13,586,6,'2010-07-09 20:44:00',2),(13,587,6,'2010-07-09 20:44:52',2),(13,588,6,'2010-07-14 12:30:26',1),(13,589,6,'2010-08-14 12:59:09',1),(13,590,6,'2010-08-14 12:58:13',1),(13,591,6,'2010-07-14 12:30:57',1),(13,592,6,'2010-07-09 20:37:31',2),(13,593,6,'2010-07-09 20:39:05',2),(13,594,6,'2010-07-09 20:41:27',2),(13,595,6,'2010-07-09 20:40:34',2),(17,484,1,'2010-07-07 21:53:52',2),(17,484,2,'2010-07-07 21:53:52',2),(17,485,1,'2010-07-07 21:43:22',2),(17,485,2,'2010-07-07 21:43:22',2),(17,486,1,'2010-07-07 21:44:59',2),(17,486,2,'2010-07-07 21:44:59',2),(17,487,1,'2010-07-07 21:46:00',2),(17,487,2,'2010-07-07 21:46:00',2),(17,488,1,'2010-07-07 21:46:56',2),(17,488,2,'2010-07-07 21:46:56',2),(17,489,1,'2010-07-07 21:55:00',2),(17,489,2,'2010-07-07 21:55:00',2),(17,490,1,'2010-07-07 21:56:18',2),(17,490,2,'2010-07-07 21:56:18',2),(17,491,1,'2010-07-07 21:57:43',2),(17,491,2,'2010-07-07 21:57:43',2),(17,492,1,'2010-07-07 21:59:55',2),(17,492,2,'2010-07-07 21:59:55',2),(17,493,1,'2010-07-07 22:01:12',2),(17,493,2,'2010-07-07 22:01:12',2),(17,495,1,'2010-07-07 22:02:12',2),(17,495,2,'2010-07-07 22:02:12',2),(17,496,1,'2010-07-07 22:02:58',2),(17,496,2,'2010-07-07 22:02:58',2),(17,497,1,'2010-07-07 22:03:56',2),(17,497,2,'2010-07-07 22:03:56',2),(17,498,1,'2010-07-07 22:04:58',2),(17,498,2,'2010-07-07 22:04:58',2),(17,499,1,'2010-07-07 22:05:54',2),(17,499,2,'2010-07-07 22:05:54',2),(17,500,1,'2010-07-07 22:06:45',2),(17,500,2,'2010-07-07 22:06:45',2),(13,601,6,'2010-07-09 02:10:13',1),(13,612,6,'2010-07-09 19:05:53',1),(13,613,6,'2010-07-09 19:04:55',1),(13,615,6,'2010-07-22 17:35:47',1),(17,514,1,'2010-07-13 14:43:55',1),(17,514,2,'2010-07-13 14:43:55',1),(13,618,6,'2010-07-16 13:22:09',1),(17,516,1,'2010-07-16 12:19:27',1),(17,516,2,'2010-07-16 12:19:27',1),(17,519,1,'2010-07-31 23:43:38',1),(17,519,2,'2010-07-31 23:43:38',1),(13,261,1,'2013-07-12 07:48:12',1),(13,261,2,'2013-07-12 07:48:12',1),(4,336,2,'2010-07-20 15:28:36',1),(4,336,5,'2010-07-20 15:28:36',1),(4,337,2,'2010-07-20 18:19:29',1),(4,337,5,'2010-07-20 18:19:29',1),(13,622,6,'2010-07-22 18:33:39',1),(17,521,1,'2010-07-22 18:20:33',1),(17,521,2,'2010-07-22 18:20:33',1),(4,338,2,'2010-07-22 18:21:39',1),(4,338,5,'2010-07-22 18:21:39',1),(13,623,6,'2010-07-22 22:10:13',1),(17,522,1,'2010-07-22 22:04:19',1),(17,522,2,'2010-07-22 22:04:19',1),(17,527,2,'2010-08-27 05:00:34',2),(17,527,1,'2010-08-27 05:00:34',2),(13,632,6,'2010-08-30 21:47:14',1),(4,345,13,'2010-11-30 15:13:09',2),(4,345,2,'2010-11-30 15:13:09',2),(4,339,2,'2010-09-13 08:34:15',1),(4,340,5,'2010-09-13 14:57:01',1),(4,346,1,'2010-11-30 15:37:47',2),(4,341,2,'2010-09-16 10:56:48',1),(4,346,2,'2010-11-30 15:37:47',2),(4,342,2,'2010-09-16 10:57:04',1),(4,-1,13,'2010-12-03 15:14:22',2),(4,-1,2,'2010-12-03 15:14:22',2),(4,-1,1,'2010-12-03 15:14:22',2),(4,347,13,'2010-11-30 17:33:50',2),(4,347,2,'2010-11-30 17:33:50',2),(4,347,1,'2010-11-30 17:33:50',2),(4,348,13,'2010-12-01 19:45:59',2),(4,348,2,'2010-12-01 19:45:59',2),(4,348,1,'2010-12-01 19:45:59',2),(4,350,13,'2010-12-02 16:58:46',2),(4,350,2,'2010-12-02 16:58:46',2),(4,350,1,'2010-12-02 16:58:46',2),(4,359,2,'2010-12-02 17:50:18',1),(4,359,5,'2010-12-02 17:50:18',1),(4,360,13,'2010-12-03 14:38:43',2),(4,360,2,'2010-12-03 14:38:43',2),(4,360,1,'2010-12-03 14:38:43',2),(4,361,13,'2010-12-03 14:48:23',2),(4,361,2,'2010-12-03 14:48:23',2),(4,361,1,'2010-12-03 14:48:23',2),(4,366,13,'2010-12-03 15:13:42',2),(4,366,2,'2010-12-03 15:13:42',2),(4,366,1,'2010-12-03 15:13:42',2),(4,368,13,'2010-12-04 23:11:46',2),(4,368,2,'2010-12-04 23:11:46',2),(4,368,1,'2010-12-04 23:11:46',2),(4,374,2,'2011-02-08 02:49:47',1),(4,375,2,'2011-02-08 02:51:18',1),(4,376,2,'2011-02-08 02:53:17',1),(13,690,1,'2013-12-06 16:48:36',1),(17,562,1,'2013-12-06 16:46:01',1),(17,563,1,'2013-12-06 16:46:33',1);


