Skip to content

Commit

Permalink
Added admintool Icon functionality to Admintool Index
Browse files Browse the repository at this point in the history
Now in the template there is a Variable available

{TOOL_ICON}

that contains the fontawesome icon.

Icon is set in Module info.php
See Droplets as example

Need some help to support this in BE themes now .
  • Loading branch information
NorHei committed Oct 13, 2017
1 parent 51fc16a commit 46f2779
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
39 changes: 22 additions & 17 deletions wbce/admin/admintools/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
*/

require('../../config.php');
require_once(WB_PATH.'/framework/class.admin.php');
$admin = new admin('admintools', 'admintools');

// Include the WB functions file
require_once(WB_PATH.'/framework/functions.php');

// Setup template object, parse vars to it, then parse it
// Create new template object
Expand All @@ -37,23 +36,29 @@

// Insert tools into tool list
$template->set_block('main_block', 'tool_list_block', 'tool_list');
$results = $database->query("SELECT * FROM {TP}addons WHERE type = 'module' AND function LIKE '%tool%' AND `function` NOT LIKE '%hidden%' ORDER BY name");
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND `function` LIKE '%tool%' AND `function` NOT LIKE '%hidden%' AND `directory` not in ('".(implode("','",$_SESSION['MODULE_PERMISSIONS']))."') order by name");
if($results->numRows() > 0) {
while($tool = $results->fetchRow()) {
$template->set_var('TOOL_NAME', $tool['name']);
$template->set_var('TOOL_DIR', $tool['directory']);
// check if a module description exists for the displayed backend language
$tool_description = false;
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$tool['directory'].'/languages/'.LANGUAGE .'.php')) {
// read contents of the module language file into string
$data = @file_get_contents(WB_PATH .'/modules/' .$tool['directory'] .'/languages/' .LANGUAGE .'.php');
$tool_description = get_variable_content('module_description', $data, true, false);
}
$template->set_var('TOOL_DESCRIPTION', ($tool_description === False)? $tool['description'] :$tool_description);
$template->parse('tool_list', 'tool_list_block', true);
}
while($tool = $results->fetchRow()) {
$template->set_var('TOOL_NAME', $tool['name']);
$template->set_var('TOOL_DIR', $tool['directory']);
// check if a module description exists for the displayed backend language
$tool_description = false;
if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$tool['directory'].'/languages/'.LANGUAGE .'.php')) {
// read contents of the module language file into string
$data = @file_get_contents(WB_PATH .'/modules/' .$tool['directory'] .'/languages/' .LANGUAGE .'.php');
$tool_description = get_variable_content('module_description', $data, true, false);
}
$template->set_var('TOOL_DESCRIPTION', ($tool_description === False)? $tool['description'] :$tool_description);
$tool_default_icon= "fa fa-graduation-cap";
$tool_icon =false;
$data = @file_get_contents(WB_PATH .'/modules/' .$tool['directory'] .'/info.php');
$tool_icon = get_variable_content('module_icon', $data, true, false);
$template->set_var('TOOL_ICON', ($tool_icon === False)? $tool_default_icon :$tool_icon);

$template->parse('tool_list', 'tool_list_block', true);
}
} else {
$template->set_var('TOOL_LIST', $TEXT['NONE_FOUND']);
$template->set_var('TOOL_LIST', $TEXT['NONE_FOUND']);
}

// Parse template objects output
Expand Down
1 change: 1 addition & 0 deletions wbce/modules/droplets/info.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
$module_author = 'Ruud, pcwacht, WebBird, cwsoft, Norhei, Colinax';
$module_license = 'GNU General Public License';
$module_description = 'This tool allows you to manage your local Droplets.';
$module_icon = 'fa fa-eyedropper';
$module_home = 'http://www.wbce.org';
$module_guid = '9F2AC2DF-C3E1-4E15-BA4C-2A86E37FE6E5';

Expand Down

0 comments on commit 46f2779

Please sign in to comment.