-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFriendship.php
50 lines (42 loc) · 1.64 KB
/
Friendship.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace koolreport\codeigniter;
use \koolreport\core\Utility;
trait Friendship
{
public function __constructFriendship()
{
//assets folder
$assets = Utility::get($this->reportSettings, "assets");
if ($assets == null) {
$document_root = Utility::getDocumentRoot();
$script_folder = str_replace("\\", "/", realpath(dirname($_SERVER["SCRIPT_FILENAME"])));
$asset_path = $script_folder . "/assets";
$asset_url = Utility::strReplaceFirst($document_root, "", $script_folder) . "/assets";
if (!is_dir($asset_path . "/koolreport_assets")) {
if (!is_dir($asset_path)) {
mkdir($asset_path, 0755);
}
mkdir($asset_path . "/koolreport_assets", 0755);
}
$assets = array(
"url" => $asset_url . "/koolreport_assets",
"path" => $asset_path . "/koolreport_assets",
);
$this->reportSettings["assets"] = $assets;
}
if (!file_exists($file_path = APPPATH . 'config/' . ENVIRONMENT . '/database.php')
&& !file_exists($file_path = APPPATH . 'config/database.php')) {
return;
}
include $file_path;
$dbSources = array();
foreach ($db as $name => $dbconfig) {
$dbSources[$name] = array(
"class" => CIDataSource::class,
"name" => $name,
);
}
$dataSources = Utility::get($this->reportSettings, "dataSources", array());
$this->reportSettings["dataSources"] = array_merge($dbSources, $dataSources);
}
}