-- --------------------------------------------------------
-- Host:                         127.0.0.1
-- Server version:               5.7.21 - MySQL Community Server (GPL)
-- Server OS:                    Win64
-- HeidiSQL Version:             11.0.0.5919
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;

-- Dumping structure for table selfinstaller.api
CREATE TABLE IF NOT EXISTS `api` (
  `api_id` int(11) NOT NULL AUTO_INCREMENT,
  `api_code` varchar(255) DEFAULT NULL,
  `api_descr` text,
  `api_content` text,
  `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 AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

-- Dumping data for table selfinstaller.api: ~2 rows (approximately)
/*!40000 ALTER TABLE `api` DISABLE KEYS */;
INSERT IGNORE INTO `api` (`api_id`, `api_code`, `api_descr`, `api_content`, `created_at`, `created_by`, `updated_at`, `updated_by`) VALUES
	(1, 'ContentArticleList', 'This is the API to display all the list of article', '<?php \r\n\r\n$sql = "SELECT * FROM content_article_translation t1 \r\n    INNER JOIN content_article t2 ON t1.article_translation_parent_id=t2.article_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[\'article_translation_language\'];\r\n        $arr2[\'title\'] = $row[\'article_translation_title\'];\r\n        $arr2[\'content\'] = $row[\'article_translation_content\'];\r\n        $arr2[\'tag\'] = $row[\'article_translation_tag\'];\r\n        \r\n        $arr2[\'portal_category\'] = $row[\'article_portal_category\'];\r\n        $arr2[\'category\'] = $row[\'article_category\'];\r\n        $arr2[\'subcategory\'] = $row[\'article_subcategory\'];\r\n        $arr2[\'status\'] = $row[\'article_status\'];\r\n        $arr2[\'article_date\'] = $row[\'article_date\'];\r\n        $arr2[\'sorting\'] = $row[\'article_sorting\'];\r\n        $arr2[\'url_related\'] = $row[\'article_url\'];\r\n        $arr2[\'thumbnail\'] = $row[\'article_image\'];\r\n        \r\n        $arr[] = $arr2;\r\n    }\r\n}\r\necho json_encode([\'result_status\'=>$status,\'data\'=>$arr]);', '2021-03-12 13:38:32', 3, '2021-03-12 14:08:23', 3),
	(2, 'ContentArticleDetails', 'This is the API to display the details of the article', '<?php \r\n$article_id = \'\';\r\n$arr = [];\r\n$status = \'failed\';\r\n$remark = \'\';\r\nif(isset($_GET[\'article_id\'])&&!empty($_GET[\'article_id\'])){\r\n    $article_id = $_GET[\'article_id\'];\r\n    $sql = "SELECT * FROM content_article_translation t1 \r\n        INNER JOIN content_article t2 ON t1.article_translation_parent_id=t2.article_id WHERE t2.article_id=".$article_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[\'article_translation_language\'];\r\n            $arr2[\'title\'] = $row[\'article_translation_title\'];\r\n            $arr2[\'content\'] = $row[\'article_translation_content\'];\r\n            $arr2[\'tag\'] = $row[\'article_translation_tag\'];\r\n            \r\n            $arr2[\'portal_category\'] = $row[\'article_portal_category\'];\r\n            $arr2[\'category\'] = $row[\'article_category\'];\r\n            $arr2[\'subcategory\'] = $row[\'article_subcategory\'];\r\n            $arr2[\'status\'] = $row[\'article_status\'];\r\n            $arr2[\'article_date\'] = $row[\'article_date\'];\r\n            $arr2[\'sorting\'] = $row[\'article_sorting\'];\r\n            $arr2[\'url_related\'] = $row[\'article_url\'];\r\n            $arr2[\'thumbnail\'] = $row[\'article_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 article_id using $_GET method\';\r\n}\r\necho json_encode([\'result_status\'=>$status,\'remark\'=>$remark,\'data\'=>$arr]);', '2021-03-12 14:02:57', 3, '2021-03-12 14:12:10', 3);
/*!40000 ALTER TABLE `api` ENABLE KEYS */;

/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
