getAll($get_all_tasks);
$final_results = array();
foreach($results AS $result)
$final_results[$result['id']] = $result;
return $final_results;
}
public function get_company_locations($company_id)
{
global $database;
// $database->debug = true;
$company_locations = array();
$get_company_locations = "
SELECT
id,
company_id,
CONCAT(address,', ',suburb,', ',state,', ',post_code,', ',country) AS 'name'
FROM tasks_locations
WHERE company_id = '$company_id'
AND status = '1'
";
$company_locations = $database->getAll($get_company_locations);
$final_results = array();
if(count($company_locations) > 0)
foreach($company_locations AS $result)
$final_results[$result['id']] = $result;
return $final_results;
}
public function get_location($location_id)
{
global $database;
$get_company_location = "
SELECT CONCAT(address,', ',suburb,', ',state,', ',post_code,', ',country) AS 'name'
FROM tasks_locations
WHERE id = $location_id
LIMIT 1
";
$location = $database->getOne($get_company_location);
return $location;
}
public function get_all_tasks_id()
{
global $database;
$get_tasks_id = "
SELECT id
FROM tasks
";
$tasks_id = $database->getAll($get_tasks_id);
return $tasks_id;
}
public function get_all_tasks_name()
{
global $database;
$get_tasks_name = "
SELECT company_name
FROM tasks
";
$tasks_name = $database->getAll($get_tasks_name);
return $tasks_name;
}
public function get_company_name($company_id)
{
global $database;
$get_name = "
SELECT company_name
FROM tasks
WHERE id = '$company_id'
LIMIT 1
";
$company_name = $database->getOne($get_name);
return $company_name;
}
public function company_details($company_id)
{
global $database;
$get_tasks = "
SELECT
company_name,
multi_location,
primary_location_id
FROM tasks
WHERE id = '$company_id'
LIMIT 1
";
$results = $database->getRow($get_tasks);
$location_id = $results['primary_location_id'];
$get_location = "
SELECT
CONCAT(address,', ',suburb,', ',state,', ',post_code,', ',country) AS 'address',
business_phone AS 'phone',
fax
FROM
tasks_locations
WHERE
id = $location_id
LIMIT 1
";
$locations = $database->getRow($get_location);
$company['company_name']=$results['company_name'];
if($results['multi_location']==1)
$company['multi_location']="Yes";
else
$company['multi_location']="No";
$company['address']=$locations['address'];
$company['phone']=$locations['phone'];
$company['fax']=$locations['fax'];
return $company;
}
public function get_multi_location($company_id)
{
global $database;
$get_multi = "
SELECT multi_location
FROM tasks
WHERE id = '$company_id'
LIMIT 1
";
$multi_location = $database->getOne($get_multi);
return $multi_location;
}
public function get_primary_location($company_id)
{
global $database;
$get_primary = "
SELECT primary_location_id
FROM tasks
WHERE id = '$company_id'
LIMIT 1
";
$primary_location = $database->getOne($get_primary);
return $primary_location;
}
}
?>