43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
|
|
class Nat_to_test extends MY_Controller
|
|
{
|
|
var $db_smartone;
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
|
|
$this->db_smartone = $this->load->database('onedev');
|
|
}
|
|
|
|
function generate()
|
|
{
|
|
// truncate
|
|
$this->db_smartone->query("TRUNCATE");
|
|
|
|
$parents =
|
|
$this->db_smartone->select("DISTINCT(Nat_RelationParentID) parentid", false)
|
|
->join('nat_test', 'Nat_RelationParentID = Nat_TestID')
|
|
->where("Nat_RelationIsActive", "Y")
|
|
->order_by('Nat_TestSequence')
|
|
->get('nat_relation')
|
|
->result_array();
|
|
|
|
foreach ($parents as $k => $v)
|
|
{
|
|
// INSERT top parent
|
|
$this->db_smartone->query("");
|
|
|
|
$parent_1 =
|
|
$this->db_smartone->select()
|
|
->join('nat_test', 'Nat_RelationParentID = Nat_TestID')
|
|
->where('Nat_RelationParentID', $v['parentid'])
|
|
->where('Nat_RelationIsActive', "Y")
|
|
->order_by('Nat_TestSequence')
|
|
->get('nat_relation')
|
|
->result_array();
|
|
|
|
}
|
|
}
|
|
}
|
|
?>
|