<?php
php
class table extends Plugins
{
const NAME = 'Table Plugin Example';
const AUTHOR = 'misiek08';
const VERSION = PHPInSimMod::VERSION;
const DESCRIPTION = 'Plugin to generate button table. Can be used for showing results or other info.';
private $data = array(array('test', 'test2', 'test3'),array('teste', 'teste2', 'teste3'),array('tester', 'tester2', 'tester3'));
private $header = array('1st', '2nd', '3rd');
private $width = 10;
private $height = 8;
private $x = 50;
private $y = 50;
/* Remember about this:
define('IS_X_MIN', 0);
define('IS_X_MAX', 110);
define('IS_Y_MIN', 30);
define('IS_Y_MAX', 170);
*/
public function __construct()
{
$this->registerSayCommand('prism table', 'cmdTable', "Shows defined in code table for used.");
$this->registerSayCommand('prism deltable', 'deltable', 'test');
}
public function cmdTable($cmd, $UCID)
{
$cols = count($this->header);
$rows = count($this->data);
$id = 70;
for($i = 0; $i < $rows; $i++){
for($j = 0; $j < $cols; $j++){
$this->createButton($UCID,
$id,
(($j + 1) * $this->width) + $this->x,
(($i + 1) * $this->height) + $this->y,
$this->width,
$this->height,
$this->data[$i][$j]);
$id ++;
echo (($i + 1) * $this->height) + $this->y . PHP_EOL;
}
}
return PLUGIN_HANDLED;
}
private function createButton($UCID, $id, $x, $y, $w, $h, $text){
$btn = new IS_BTN();
$btn->UCID($UCID)
->L($x)
->T($y)
->ClickID($id)
->W($w)
->H($h)
->Text($text)
->Send();
}
public function deltable($cmd, $UCID)
{
$MSX = new IS_MSX;
$MSX->Msg('test, '.$UCID)->Send();
$btnrem = new IS_BFN();
$btnrem->UCID($UCID)
->SubT(BFN_CLEAR)
->Send();
return PLUGIN_STOP;
}
}
?>
<?php
php
$NavLinks = array(
array('File' => 'cruise.php', 'LinkText' => 'Cruise', 'Plugin' => 'Cruise')
);
?>
<?php
php
Foreach($NavLinks as $info){
if(in_array($info['Plugin'], $PRISM->plugins->getPlugins()) ){
echo("<li".(( basename($SERVER["SCRIPT_NAME"]) == $info["File"] ) ? ' id="menu-active"' : '')."><a href=\"{$info["File"]}\"><span>{$info["LinkText"]}</span></a></li>");
}}
?>
<?php
php
if (!isset($_SESSION['user'])){
if (isset($_POST['login'])){
$adminUser = isset($_POST['loginUser']) ? $_POST['loginUser'] : '';
$adminPass = isset($_POST['loginPass']) ? $_POST['loginPass'] : '';
if ($adminUser && $adminPass){
if ($PRISM->admins->isPasswordCorrect($adminUser, $adminPass)){
if (!isset($_SESSION)){
$_SESSION = array('counter' => 1, 'staticvar' => 'mooh', 'lasttime' => time());
}
$_SESSION['user'] = $adminUser;
<p class="msg info">You are now logged in!</p>
php
}
}
}else{
<h3 class="tit">Login</h3>
<form method="post" action="login.php">
<label for="username">Username: </label> <input type="text" name="loginUser" size="20" class="input-text">
<label for="password">Password: </label><input type="password" name="loginPass" size="20" class="input-text"><br><br>
<label for="autologin">Remember Me?: </label><input type="checkbox" name="autologin">
<input type="submit" value="Log In" name="login">
</form>
php
}}else{
<p class="msg info">Your Already logged in.</p>
php
}
?>
<?php
php
if (isset($SERVER['PHP_AUTH_USER']))
{
if (!isset($_SESSION))
$_SESSION = array('user' => $SERVER['PHP_AUTH_USER'], 'counter' => 0);
else
$_SESSION['user'] = $SERVER['PHP_AUTH_USER'];
$_SESSION['autoLogin'] = TRUE;
}
else
{
if (isset($_SESSION['autoLogin'])) unset($_SESSION['autoLogin']);
}
?>
<?php
php
if (isset($_SESSION))
{
$_SESSION['counter']++;
$_SESSION['lasttime'] = time();
}
else
{
$_SESSION = array
(
'counter' => 1,
'staticvar' => 'mooh',
'lasttime' => time()
);
}
?>