Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
Fix : wrong directory path, environment switch, and template var
Browse files Browse the repository at this point in the history
  • Loading branch information
drajathasan committed Dec 26, 2020
1 parent 3ff5a79 commit c007a46
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/SLiMSTarsius/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function compile()
foreach ($this->arguments as $id => $value) {
if ($id > 1)
{
$this->arguments[$map[2]] = $value;
$this->arguments[$map[2]][] = $value;
}
else
{
Expand Down
6 changes: 4 additions & 2 deletions src/SLiMSTarsius/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ public function create($dest, $pluginName)
$destinantion = ($this->env === 'development_src')?$dest.'/tests/plugins/':$dest.'/plugins/';
$template = ($this->env === 'development_src')?$dest.'/tests/template/':$dest.'/vendor/drajat/slims-tarsius/tests/template/';

if (count(explode(' ', trim($pluginName))) > 1)
if (count($pluginName) > 1)
{
die('Hanya bisa membuat 1 plugin dalam 1 perintah!');
die("Hanya bisa membuat 1 plugin dalam 1 perintah!\n");
}

$pluginName = $pluginName[0];

// set message
echo 'Membuat plugin '.$pluginName."\n";
// get information and make plugin
Expand Down
3 changes: 1 addition & 2 deletions src/SLiMSTarsius/Tarmagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public static function getEnvironment($dir)
{
if (file_exists($dir.'/sysconfig.inc.php'))
{
include_once $dir.'/sysconfig.inc.php';
self::$environment = ENVIRONMENT;
self::$environment = 'development';
}
else
{
Expand Down
15 changes: 15 additions & 0 deletions tests/plugins/buku_induk/buku_induk.plugin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* Plugin Name: buku_induk
* Plugin URI: https://github.com/drajathasan/buku_induk
* Description: Dummy plugin
* Version: 1.0.0
* Author: Drajat Hasan
* Author URI: https://github.com/drajathasan/
*/

// get plugin instance
$plugin = \SLiMS\Plugins::getInstance();

// registering menus
$plugin->registerMenu('bibliography', 'Buku Induk', __DIR__ . '/index.php');
60 changes: 60 additions & 0 deletions tests/plugins/buku_induk/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* @Created by : Drajat Hasan
* @Date : 2020-12-26 21:30:57
* @File name : index.php
*/

defined('INDEX_AUTH') OR die('Direct access not allowed!');

// IP based access limitation
require LIB . 'ip_based_access.inc.php';
do_checkIP('smc');
do_checkIP('smc-bibliography');
// start the session
require SB . 'admin/default/session.inc.php';
require SIMBIO . 'simbio_GUI/table/simbio_table.inc.php';
require SIMBIO . 'simbio_GUI/form_maker/simbio_form_table_AJAX.inc.php';
require SIMBIO . 'simbio_GUI/paging/simbio_paging.inc.php';
require SIMBIO . 'simbio_DB/datagrid/simbio_dbgrid.inc.php';

// privileges checking
$can_read = utility::havePrivilege('bibliography', 'r');

if (!$can_read) {
die('<div class="errorBox">' . __('You are not authorized to view this section') . '</div>');
}

function httpQuery($query = [])
{
return http_build_query(array_unique(array_merge($_GET, $query)));
}

$page_title = 'Buku Induk';

/* Action Area */

/* End Action Area */
?>
<div class="menuBox">
<div class="menuBoxInner memberIcon">
<div class="per_title">
<h2><?php echo $page_title; ?></h2>
</div>
<div class="sub_section">
<div class="btn-group">
<a href="<?= $_SERVER['PHP_SELF'] . '?' . httpQuery() ?>" class="btn btn-default">Daftar</a>
</div>
<form name="search" action="<?= $_SERVER['PHP_SELF'] . '?' . httpQuery() ?>" id="search" method="get" class="form-inline"><?php echo __('Search'); ?>
<input type="text" name="keywords" class="form-control col-md-3"/>
<input type="submit" id="doSearch" value="<?php echo __('Search'); ?>"
class="s-btn btn btn-default"/>
</form>
</div>
</div>
</div>

<?php
/* Datagrid area */

/* End datagird */
4 changes: 2 additions & 2 deletions tests/template/dot-plugin.Template
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Plugin URI: {plugin_uri}
* Description: {description}
* Version: {version}
* Author: {author_uri}
* Author URI: {label_menu}
* Author: {author}
* Author URI: {author_uri}
*/

// get plugin instance
Expand Down
8 changes: 7 additions & 1 deletion tests/template/index-plugin.Template
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ if (!$can_read) {
die('<div class="errorBox">' . __('You are not authorized to view this section') . '</div>');
}

function httpQuery($query = [])
{
return http_build_query(array_unique(array_merge($_GET, $query)));
}

$page_title = '{label_menu}';

/* Action Area */
Expand All @@ -38,7 +43,7 @@ $page_title = '{label_menu}';
</div>
<div class="sub_section">
<div class="btn-group">
<a href="<?=$_SERVER['PHP_SELF']?>" class="btn btn-default">Daftar</a>
<a href="<?= $_SERVER['PHP_SELF'] . '?' . httpQuery() ?>" class="btn btn-default">Daftar</a>
</div>
<form name="search" action="<?= $_SERVER['PHP_SELF'] . '?' . httpQuery() ?>" id="search" method="get" class="form-inline"><?php echo __('Search'); ?>
<input type="text" name="keywords" class="form-control col-md-3"/>
Expand All @@ -51,4 +56,5 @@ $page_title = '{label_menu}';

<?php
/* Datagrid area */

/* End datagird */

0 comments on commit c007a46

Please sign in to comment.