Skip to content

Commit 99ae4e5

Browse files
committed
Fixes bugs and adds additional packages to package manager
1 parent e4d1432 commit 99ae4e5

File tree

3 files changed

+65
-7
lines changed

3 files changed

+65
-7
lines changed

system/core/controller.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,20 @@ public function getModel($model, $app, $namespace = 'Strider')
6060
public function render($view, Template $template)
6161
{
6262
$templateData = $template->toArray();
63-
$twigLoader = new \Twig_Loader_Filesystem(Config::$viewStorage);
63+
$app = Globals::app();
64+
$controller = Globals::controller();
65+
if ($app == null) $app = 'init';
66+
if ($controller == null) $controller = $app;
67+
$twigLoader = new \Twig_Loader_Filesystem(Config::$filePath . Config::$appStorage . $app . '/' . Config::$viewStorage);
6468
$twig = new \Twig_Environment($twigLoader, array('debug' => Config::$debugMode));
6569
if (Config::$debugMode)
6670
{
6771
$twig->addExtension(new \Twig_Extension_Debug());
6872
}
69-
if (Config::$debugMode) $dataArray['sessionData'] = $_SESSION;
70-
array_push($templateData, $templateData->toArray());
73+
74+
$globals = Globals::toArray();
75+
$templateData = array_merge($templateData, $globals);
76+
dBug($templateData);
7177
echo $twig->render($view . '.' . Config::$viewFileType, $templateData);
7278
}
7379
}

system/core/package.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,29 @@ public function __construct()
6767
'public/components/select2/select2-bootstrap.css'
6868
)
6969
),
70+
'metismenu' => array(
71+
'js' => array(
72+
'public/components/metismenu/dist/metisMenu.min.js'
73+
),
74+
'css' => array(
75+
'public/components/metismenu/dist/metisMenu.min.css'
76+
)
77+
),
7078
'tinymce' => array(
7179
'js' => array(
7280
'public/components/tinymce-dist/jquery.tinymce.min.js',
7381
'public/components/tinymce-dist/tinymce.min.js'
7482
),
7583
'css' => array(
76-
'public/components/tinymce-dist/themes/modern/theme.min.js'
84+
'public/components/tinymce-dist/themes/modern/theme.min.css'
85+
)
86+
),
87+
'sbadmin2' => array(
88+
'js' => array(
89+
'public/components/startbootstrap-sb-admin-2/dist/js/sb-admin-2.js'
90+
),
91+
'css' => array(
92+
'public/components/startbootstrap-sb-admin-2/dist/css/sb-admin-2.css'
7793
)
7894
),
7995
);
@@ -103,8 +119,8 @@ public function getPackages(array $packageList)
103119
$item = $this->getPackage($package);
104120
if ($item != false)
105121
{
106-
if (is_array($item['css'])) $css = array_merge($css, $item['css']);
107-
if (is_array($item['js'])) $js = array_merge($js, $item['js']);
122+
if (isset($item['css']) && is_array($item['css'])) $css = array_merge($css, $item['css']);
123+
if (isset($item['js']) && is_array($item['js'])) $js = array_merge($js, $item['js']);
108124
}
109125
}
110126

system/core/template.php

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static function existValue($key)
3636

3737
/**
3838
* Adds a JavaScript file to the JavaScript file list
39-
* @param $file Adds a file to the JavaScript include list
39+
* @param string $file The file to be added
4040
* @return bool Returns true if file was added, false if not
4141
*/
4242
public static function addJs($file)
@@ -49,6 +49,24 @@ public static function addJs($file)
4949
return false;
5050
}
5151

52+
/**
53+
* Adds a list of JavaScript files to the JavaScript file list
54+
* @param array $array List of files to be added
55+
* @return bool Returns true if files were added, false if not
56+
*/
57+
public static function addJsFiles(array $array)
58+
{
59+
if (!is_array($array)) return false;
60+
foreach($array as $include)
61+
{
62+
if (!in_array($include, self::$jsIncludes))
63+
{
64+
self::$jsIncludes[] = $include;
65+
}
66+
}
67+
return true;
68+
}
69+
5270
/**
5371
* Adds a CSS file to the CSS file list
5472
* @param $file Adds a file to the CSS include list
@@ -64,6 +82,24 @@ public static function addCSS($file)
6482
return false;
6583
}
6684

85+
/**
86+
* Adds a CSS file to the CSS file list
87+
* @param $file Adds a file to the CSS include list
88+
* @return bool Returns true if file was added, false if not
89+
*/
90+
public static function addCSSFiles(array $array)
91+
{
92+
if (!is_array($array)) return false;
93+
foreach($array as $include)
94+
{
95+
if (!in_array($include, self::$cssIncludes))
96+
{
97+
self::$cssIncludes[] = $include;
98+
}
99+
}
100+
return true;
101+
}
102+
67103
/**
68104
* Returns the JavaScript include list as injectable HTML
69105
* @return string|null Returns a HTML rendered include list or null if no includes exist

0 commit comments

Comments
 (0)