| Current Path : /var/www/html/dynawebv3.blunetdev.com/backend/modules/contentNews/ |
| Current File : /var/www/html/dynawebv3.blunetdev.com/backend/modules/contentNews/up.sql |
CREATE TABLE IF NOT EXISTS `content_news` (
`news_id` int(11) NOT NULL AUTO_INCREMENT,
`news_date` date DEFAULT NULL,
`news_category` varchar(255) DEFAULT NULL,
`news_subcategory` varchar(255) DEFAULT NULL,
`news_status` varchar(255) DEFAULT NULL,
`news_url` varchar(255) DEFAULT NULL,
`news_sorting` int(11) DEFAULT NULL,
`news_image` varchar(255) DEFAULT NULL,
`news_portal_category` varchar(255) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`created_by` int(11) DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
PRIMARY KEY (`news_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `content_news_translation` (
`news_translation_id` int(11) NOT NULL AUTO_INCREMENT,
`news_translation_parent_id` int(11) DEFAULT NULL,
`news_translation_title` text CHARACTER SET utf8mb4 DEFAULT NULL,
`news_translation_content` text CHARACTER SET utf8mb4 DEFAULT NULL,
`news_translation_tag` text CHARACTER SET utf8mb4 DEFAULT NULL,
`news_translation_main` int(11) DEFAULT NULL,
`news_translation_language` varchar(255) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`created_by` int(11) DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
PRIMARY KEY (`news_translation_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE IF NOT EXISTS `ref` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cat` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`descr` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`descr_en` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`sort` int(11) DEFAULT NULL,
`param1` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`icon_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_by` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` int(11) DEFAULT NULL,
`updated_by` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`updated_at` int(11) DEFAULT NULL,
`deleted_at` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
insert into `ref`(`cat`,`code`,`descr`,`descr_en`,`sort`,`param1`,`icon_name`,`created_by`,`created_at`,`updated_by`,`updated_at`,`deleted_at`) values
('NEWSSTATUS','active','Active',NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('NEWSSTATUS','inactive','Inactive',NULL,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('NEWSSTATUS','archived','Archived',NULL,3,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('NEWSPORTAL','portal01','Homepage',NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('NEWSCATEGORY','newscategory01','Main News',NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('NEWSLANGUAGE','Malay','Malay',NULL,7,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('NEWSLANGUAGE','Chinese','Chinese',NULL,2,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('NEWSLANGUAGE','English','English',NULL,3,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('NEWSLANGUAGE','Hindi','Hindi',NULL,4,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('NEWSLANGUAGE','Arabic','Arabic',NULL,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('NEWSLANGUAGE','Japanese','Japanese',NULL,5,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('NEWSLANGUAGE','Tamil','Tamil',NULL,8,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
('NEWSLANGUAGE','Korean','Korean',NULL,6,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
CREATE TABLE IF NOT EXISTS `api` (
`api_id` int(11) NOT NULL AUTO_INCREMENT,
`api_code` varchar(255) DEFAULT NULL,
`api_descr` text DEFAULT NULL,
`api_content` text DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`created_by` int(11) DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`updated_by` int(11) DEFAULT NULL,
PRIMARY KEY (`api_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into `api`(`api_code`,`api_descr`,`api_content`,`created_at`,`created_by`,`updated_at`,`updated_by`) values
('ContentNewsList','This is the API to display all the list of news','<?php \r\n\r\n$sql = \"SELECT * FROM content_news_translation t1 \r\n INNER JOIN content_news t2 ON t1.news_translation_parent_id=t2.news_id\";\r\n$model = Yii::$app->db->createCommand($sql)->queryAll();\r\n$arr = [];\r\n$status = \'failed\';\r\nif(!empty($model)){\r\n foreach($model as $row){\r\n $status = \'success\';\r\n $arr2 = [];\r\n $arr2[\'language\'] = $row[\'news_translation_language\'];\r\n $arr2[\'title\'] = $row[\'news_translation_title\'];\r\n $arr2[\'content\'] = $row[\'news_translation_content\'];\r\n $arr2[\'tag\'] = $row[\'news_translation_tag\'];\r\n \r\n $arr2[\'portal_category\'] = $row[\'news_portal_category\'];\r\n $arr2[\'category\'] = $row[\'news_category\'];\r\n $arr2[\'subcategory\'] = $row[\'news_subcategory\'];\r\n $arr2[\'status\'] = $row[\'news_status\'];\r\n $arr2[\'news_date\'] = $row[\'news_date\'];\r\n $arr2[\'sorting\'] = $row[\'news_sorting\'];\r\n $arr2[\'url_related\'] = $row[\'news_url\'];\r\n $arr2[\'thumbnail\'] = $row[\'news_image\'];\r\n \r\n $arr[] = $arr2;\r\n }\r\n}\r\necho json_encode([\'result_status\'=>$status,\'data\'=>$arr]);',NOW(),3,NOW(),3),
('ContentNewsDetails','This is the API to display the details of the news','<?php \r\n$news_id = \'\';\r\n$arr = [];\r\n$status = \'failed\';\r\n$remark = \'\';\r\nif(isset($_GET[\'news_id\'])&&!empty($_GET[\'news_id\'])){\r\n $news_id = $_GET[\'news_id\'];\r\n $sql = \"SELECT * FROM content_news_translation t1 \r\n INNER JOIN content_news t2 ON t1.news_translation_parent_id=t2.news_id WHERE t2.news_id=\".$news_id;\r\n $model = Yii::$app->db->createCommand($sql)->queryAll();\r\n \r\n if(!empty($model)){\r\n foreach($model as $row){\r\n $status = \'success\';\r\n $arr2 = [];\r\n $arr2[\'language\'] = $row[\'news_translation_language\'];\r\n $arr2[\'title\'] = $row[\'news_translation_title\'];\r\n $arr2[\'content\'] = $row[\'news_translation_content\'];\r\n $arr2[\'tag\'] = $row[\'news_translation_tag\'];\r\n \r\n $arr2[\'portal_category\'] = $row[\'news_portal_category\'];\r\n $arr2[\'category\'] = $row[\'news_category\'];\r\n $arr2[\'subcategory\'] = $row[\'news_subcategory\'];\r\n $arr2[\'status\'] = $row[\'news_status\'];\r\n $arr2[\'news_date\'] = $row[\'news_date\'];\r\n $arr2[\'sorting\'] = $row[\'news_sorting\'];\r\n $arr2[\'url_related\'] = $row[\'news_url\'];\r\n $arr2[\'thumbnail\'] = $row[\'news_image\'];\r\n \r\n $arr[] = $arr2;\r\n }\r\n }else{\r\n $remark = \'Record not found\';\r\n }\r\n \r\n}else{\r\n $remark = \'Please specify the news_id using $_GET method\';\r\n}\r\necho json_encode([\'result_status\'=>$status,\'remark\'=>$remark,\'data\'=>$arr]);',NOW(),3,NOW(),3);
insert into `backend_menu`(`menu_name`,`menu_param`,`menu_class`,`menu_link`,`menu_active_route`,`menu_parent_id`,`menu_status`) values
('News','','fa fa-file-text','/contentNews/content-news/index','',0,1);
insert into `route`(`name`,`alias`,`type`,`status`) values ('/contentNews/content-news/index','index','contentNews/content-news',1);