Important Notice: Effective immediately, all support will be handled through Discord. Read more about the changes coming to Anodyne's services.

[MOD] Nova-UCIP-Stardate--Date/Time

A place to show off (and others to download) completed MODs. Note: support for MODs is handled by third parties, not Anodyne Productions.

Demonicpagan Sat Jun 01, 2013 10:05 am

Re: [MOD] Nova-UCIP-Stardate--Date/Time

I will double check. My development site is a few versions behind and need to update. I'll let you know if there are any issues after I update my development site.
Dustin Shea
Nova Dev Sim for Mod Devlopement - http://nova.stelth2000inc.com
GitHub Repos - http://www.github.com/demonicpagan
User avatar

Posts: 144


Stormwolfe Sat Jun 01, 2013 10:10 am

Re: [MOD] Nova-UCIP-Stardate--Date/Time

Awesome, thank you so much. It's greatly appreciated.

Regards,
User avatar

Posts: 467


Demonicpagan Sat Jun 01, 2013 10:33 am

Re: [MOD] Nova-UCIP-Stardate--Date/Time

Just updated my development site to 2.2.3 and the mod is working as it should. You can see it by going here: http://nova.stelth2000inc.com and it is in the upper left hand corner of the site.
Dustin Shea
Nova Dev Sim for Mod Devlopement - http://nova.stelth2000inc.com
GitHub Repos - http://www.github.com/demonicpagan
User avatar

Posts: 144


LordMalachi Wed Dec 10, 2014 2:53 am

Re: [MOD] Nova-UCIP-Stardate--Date/Time

Which file do we actually put the line of coding in, for it to show up?

'cause, I've followed all the steps, many times, and when it comes to pasting the needed line, theres no clear explanation of WHERE. It'd be a major help, if someone could let me know, as I really have missed having the stardate on the site D: Another one of SMS's long-living features, that we so need back!

And yes, I use NOVA2. The current version.
"Impossible is a word humans use far too often."—Seven Of Nine (Star Trek: Voyager)

Posts: 10


Demonicpagan Wed Dec 10, 2014 4:08 pm

Re: [MOD] Nova-UCIP-Stardate--Date/Time

In my README:

In any theme you want to add this MOD to add <?php echo $stardate;?> to where ever you want this to be displayed. Display alterations will need to be made in the file you uploaded in step 2.


So you need to know the directory structure of your Nova installation.

By default themes are installed in application/views and any one of those files inside any one of the themes that are installed you can place the
Code: Select all
<?php echo $stardate; ?>
code.
Dustin Shea
Nova Dev Sim for Mod Devlopement - http://nova.stelth2000inc.com
GitHub Repos - http://www.github.com/demonicpagan
User avatar

Posts: 144


AgentPhoenix Wed Dec 10, 2014 4:16 pm

Re: [MOD] Nova-UCIP-Stardate--Date/Time

More accurately, you'll want to place into one of the template files (which are conveniently prefixed with the word "template").
User avatar

Posts: 7596


LordMalachi Wed Dec 10, 2014 4:21 pm

Re: [MOD] Nova-UCIP-Stardate--Date/Time

I know where the template files are, and where skins are :P

But whenever I put the line of coding, into the template files, it still doesn't show up. Even after selecting TNG, in the parameters. I've uploaded everything, following all the steps, so its somewhat annoying D: I've put it across all the template files (within applications/views that is; not the ones inside for instance applications/views/main or applications/views/admin blah blah.), still nothing.
"Impossible is a word humans use far too often."—Seven Of Nine (Star Trek: Voyager)

Posts: 10


Demonicpagan Thu Dec 11, 2014 8:09 am

Re: [MOD] Nova-UCIP-Stardate--Date/Time

Two examples, one using the default theme, the other using the sunny theme.

Default theme (located within the div class, nav-sub):

Code: Select all

<?php

$sec 
= 'main';
$css = 'main.css';

$path = explode('/', dirname(__FILE__));

// Windows servers user back slashes, so we have to capture for that
if (count($path) <= 1)
    $path = explode('\\', dirname(__FILE__));

$pcount = count($path);
$skin_loc = $pcount -1;
$current_skin = $path[$skin_loc];

// set the final style location
$style_loc = APPFOLDER.'/views/'.$current_skin.'/'.$sec.'/css/'. $css;

// set up the link tag parameters
$link = array(
    'href'    =>     $style_loc,
    'rel'    =>     'stylesheet',
    'type'    =>     'text/css',
    'media'        => 'screen',
    'charset'    => 'utf-8'
);

// load the panel helper
$this->load->helper('panel');

// set up the locations of the icons
$panel = array(
    'inbox'        => array('src' => APPFOLDER.'/views/'.$current_skin.'/'.$sec.'/images/panel-mail.png'),
    'writing'    => array('src' => APPFOLDER.'/views/'.$current_skin.'/'.$sec.'/images/panel-writing.png'),
    'dashboard'    => array('src' => APPFOLDER.'/views/'.$current_skin.'/'.$sec.'/images/panel-dashboard.png'),
);

$button_login = array(
    'class' => 'button-signin',
    'value' => 'submit',
    'type' => 'submit',
    'name' => 'submit',
    'content' => ucwords(lang('actions_login'))
);

?><!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title><?php echo $title;?></title>
        
        <meta name="description" content="<?php echo $this->config->item('meta_desc');?>" />
        <meta name="keywords" content="<?php echo $this->config->item('meta_keywords');?>" />
        <meta name="author" content="<?php echo $this->config->item('meta_author');?>" />
        
        <?php echo $_redirect;?>
        
        <?php echo link_tag($link);?>
        
        <!--[if lt IE 9]>
        <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
        
        <?php include_once($this->config->item('include_head_main'));?>
        
        <script type="text/javascript" src="<?php echo base_url() . APPFOLDER;?>/views/<?php echo $current_skin;?>/jquery.blockUI.js"></script>
        
        <?php echo $javascript;?>
        
        <script type="text/javascript">
            $(document).ready(function(){
                $('body').click(function(event){
                    if (! $(event.target).closest('div').hasClass('signin-panel'))
                    {
                        $.unblockUI();
                    }
                });
                
                $('a#userpanel').unbind('click').click(function(){
                    $.blockUI({
                        message: $('#panel'),
                        css: { 
                            border: '0', 
                            cursor: 'cursor',
                            background: 'transparent',
                            width: '800px',
                            top: '10%',
                            left: '50%',
                            margin: '0 0 0 -400px'
                        }
                    });
                    
                    return false;
                });
            });
            
            // if the escape key is pressed, close the menu
            $(document).keyup(function(event){
                if (event.keyCode == 27) {
                    $.unblockUI();
                }
            });
        </script>
    </head>
    <body>
        <noscript>
            <div class="system_warning"><?php echo lang_output('text_javascript_off', '');?></div>
        </noscript>
        
        <?php if (Auth::is_logged_in()): ?>
            <div id="panel" class="hidden">
                <div class="panel-body">
                    <table class="table100">
                        <tbody>
                            <tr>
                                <td class="panel_1 align_top"><?php echo $panel_1;?></td>
                                <td class="panel_spacer"></td>
                                <td class="panel_2 align_top"><?php echo $panel_2;?></td>
                                <td class="panel_spacer"></td>
                                <td class="panel_3 align_top"><?php echo $panel_3;?></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        <?php endif;?>
        
        <header>
            <div class="wrapper">
                <div class="signin-container">
                    <?php if ( ! Auth::is_logged_in()): ?>
                        <div class="signin-panel corner-upper-left corner-lower-left corner-lower-right">
                            <?php echo form_open('login/check_login');?>
                                <table>
                                    <tbody>
                                        <tr>
                                            <td>
                                                <?php echo ucwords(lang('labels_email_address'));?><br>
                                                <input type="text" name="email" class="signin-panel-input">
                                            </td>
                                            <td>
                                                <?php echo ucfirst(lang('labels_password'));?><br>
                                                <input type="password" name="password" class="signin-panel-input">
                                            </td>
                                            <td class="align_bottom"><?php echo form_button($button_login);?></td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <input id="remember" type="checkbox" name="remember" value="yes">
                                                <label for="remember"><?php echo ucfirst(lang('actions_remember').' '.lang('labels_me'));?></label>
                                            </td>
                                            <td><?php echo anchor('login/reset_password', lang('login_forgot'));?></td>
                                            <td></td>
                                        </tr>
                                    </tbody>
                                </table>
                            <?php echo form_close();?>
                        </div>
                    <?php else: ?>
                        <a href="<?php echo site_url('login/logout');?>" class="signin corner-upper-left corner-upper-right corner-lower-left corner-lower-right"><?php echo ucfirst(lang('actions_logout'));?></a>
                        
                        <div class="logged-in-controls">
                            <?php if (Auth::is_logged_in()): ?>
                                <?php echo panel_inbox(true, true, false, '(x)', img($panel['inbox']));?> &nbsp;
                                <?php echo panel_writing(true, true, false, '(x)', img($panel['writing']));?> &nbsp;
                                <?php echo panel_dashboard(false, img($panel['dashboard']));?>
                            <?php endif;?>
                        </div>
                    <?php endif;?>
                </div>
            
                <div style="clear:both;"></div>
                
                <div id="menu">
                    <div class="nav-main">
                        <?php echo $nav_main;?>
                    </div>
                </div>
            </div>
        </header>
        
        <div class="wrapper">
            <div id="body">
                <div class="nav-sub">
                    <?php echo $stardate;?>
                    <?php echo $nav_sub;?>
                </div>
            
                <div class="content">
                    <?php echo $flash_message;?>
                    <?php echo $content;?>
                    <?php echo $ajax;?>
                
                    <div style="clear:both;"></div>
                </div>
                
                <footer>
                    Powered by <strong><?php echo APP_NAME;?></strong> from <a href="http://www.anodyne-productions.com" target="_blank">Anodyne Productions</a> | 
                    <?php echo anchor('main/credits', 'Site Credits');?>
                </footer>
            </div>
        </div>
    </body>
</html>


Sunny Theme (located within the div class, nav-sub):
Code: Select all

<?php
/*
|---------------------------------------------------------------
| TEMPLATE - MAIN
|---------------------------------------------------------------
|
| File: application/views/sunny/template_main.php
| Skin Version: 1.0
|
| Main layout file used by the sunny skin.
|
| $sec options are: main, wiki, admin, login
| $css can be anything you want (with a .css extension of course)
|
*/

$sec = 'main'; /* set the section of the system */
$css = 'main.css'; /* the name of the main css file */

$path_raw = dirname(__FILE__); /* absolute path of the current file */
$path = explode('/', $path_raw); /* explode the string into an array */

if (count($path) <= 1)
{
 /* Windows servers use back slashes, so we have to capture for that */
    $path = explode('\\', $path_raw);
}

$pcount = count($path); /* count the number of keys in the array */
$skin_loc = $pcount -1; /* create the first element used */
$current_skin = $path[$skin_loc];

/* set the final style location */
$style_loc = APPFOLDER . '/views/' . $current_skin . '/' . $sec . '/css/' . $css;

/* set up the link tag parameters */
$link = array(
    'href'    =>     $style_loc,
    'rel'    =>     'stylesheet',
    'type'    =>     'text/css',
    'media'        => 'screen',
    'charset'    => 'utf-8'
);

echo "<?xml version='1.0' encoding='UTF-8'?>\r\n";

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <title><?php echo $title;?></title>
        
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <meta name="language" content="en" />
        <meta name="description" content="<?php echo $this->config->item('meta_desc');?>" />
        <meta name="keywords" content="<?php echo $this->config->item('meta_keywords');?>" />
        <meta name="author" content="<?php echo $this->config->item('meta_author');?>" />
        
        <?php echo $_redirect;?>
        
        <!-- STYLESHEETS -->
        <?php echo link_tag($link); ?>
        
        <!-- JAVASCRIPT FILES -->
        <?php include_once($this->config->item('include_head_main')); ?>
        
        <?php echo $javascript;?>
    </head>
    <body>
        <noscript>
            <span class="UITheme">
                <div class="system_warning ui-state-error"><?php echo lang_output('text_javascript_off', '');?></div>
            </span>
        </noscript>
        
        <?php if ($this->session->userdata('userid') !== FALSE): ?>
            <!-- USER PANEL -->
            <div id="panel" class="UITheme">
                <div class="panel-body">
                    <div class="wrapper">
                        <table class="table100">
                            <tbody>
                                <tr>
                                    <td class="panel_1 align_top"><?php echo $panel_1;?></td>
                                    <td class="panel_spacer"></td>
                                    <td class="panel_2 align_top"><?php echo $panel_2;?></td>
                                    <td class="panel_spacer"></td>
                                    <td class="panel_3 align_top"><?php echo $panel_3;?></td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="panel-handle ui-state-default">
                    <div class="wrapper">
                        <?php echo $panel_workflow;?>
                    </div>
                </div>
            </div>
        <?php endif; ?>
        
        <!-- HEAD -->
        <div class="wrapper">
            <div id="head">
                <?php echo img(APPFOLDER .'/views/'. $current_skin .'/'. $sec .'/images/head-logo.png', FALSE);?>
                
                <div id="menu">
                    <div class="nav-main">
                        <?php echo $nav_main;?>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- BODY -->
        <div id="body">
            <div class="wrapper">
                <!-- SUB NAVIGATION -->
                <div class="nav-sub">
                    <!-- Set UCIP Stardate and Local Server Time/Date -->
                    <?php echo $stardate;?>
                    <?php echo $nav_sub;?>
                    
                    <div class="footer">
                        Powered by <strong><?php echo APP_NAME;?></strong> from <a href="http://www.anodyne-productions.com" target="_blank">Anodyne Productions</a><br /><br />
                        <?php echo anchor('main/credits', 'Site Credits');?>
                        <br /><br />
                        Execution: {elapsed_time}s | Memory Usage: {memory_usage}
                    </div>
                </div>
                
                <!-- PAGE CONTENT -->
                <div class="content">
                    <?php echo $flash_message;?>
                    <?php echo $content;?>
                    <?php echo $ajax;?>
                    
                    <div style="clear:both;">&nbsp;</div>
                </div>
            </div>
        </div>
    </body>
</html>
Dustin Shea
Nova Dev Sim for Mod Devlopement - http://nova.stelth2000inc.com
GitHub Repos - http://www.github.com/demonicpagan
User avatar

Posts: 144


LordMalachi Sat Dec 13, 2014 7:16 am

Re: [MOD] Nova-UCIP-Stardate--Date/Time

Indeed, thats how I've got mine. Still, it won't show up. Thats why is baffling, and annoying :P All the files are installed in the correct areas, but no matter how many times I reinstall, or paste the coding into those lines... nothing.

I should note, I always set it for 'TNG' and the year 2397. As for altering the UCIP stuff, I'm not fussed the way its laid out; I just want it to show :P
"Impossible is a word humans use far too often."—Seven Of Nine (Star Trek: Voyager)

Posts: 10


Demonicpagan Sat Dec 13, 2014 8:45 am

Re: [MOD] Nova-UCIP-Stardate--Date/Time

I am at a loss as to what is going on without physically seeing the box setup to review your setup, then.
Dustin Shea
Nova Dev Sim for Mod Devlopement - http://nova.stelth2000inc.com
GitHub Repos - http://www.github.com/demonicpagan
User avatar

Posts: 144


LordMalachi Sat Dec 13, 2014 12:18 pm

Re: [MOD] Nova-UCIP-Stardate--Date/Time

I know, its freaking weird. I'm having problems with skins now too; some make NOVA look like a white page, with everything as basic HTML.. ugh, I don't know what it is. I know I've installed everything properly, just, yeah.

So for now, I can't do anything. I don't know how looking at it, will make a difference, because I've got the same as you did in those examples. And everything is installed in their correct folders. Maybe its my domain? I use Hosting24, and CPanel (naturally), but I don't see how. Then again, I might know how to install things, but I'm not a coding expert whatsoever.
"Impossible is a word humans use far too often."—Seven Of Nine (Star Trek: Voyager)

Posts: 10


CO_Argent Wed Dec 23, 2015 4:59 pm

Re: [MOD] Nova-UCIP-Stardate--Date/Time

The mod works on v2.4.5.

I have one minor technical problem though, relating to modifying how the stardate is displayed. TOS uses 4 digit stardates. The default for the mod is five digits. For example, the date for December 23, 2287 should be 9720.93, but the mod displays it as 59720.93.

The code is below:

$ms = ($stardateInput->format('U') - $stardateOrigin->format('U')) * 1000;
$starYear = ($ms / (60 * 60 * 24 * 365.2422)) * 2.63510833;
$stardate = floor(floor(floor($starYear * 1000)) / 10) / 100;

// Convert TOS Stardate to Human readable date
$dateOut = ($stardate / 1000) * 60 * 60 * 24 * 365.2422 / 2.63510833;
$ms = floor($dateOut + $stardateOrigin->format('U'));
$date = new DateTime("@$ms");

Does anyone know how I should modify this to show only four digits? Math has never been my strong suite :D Thanks in advance!

Posts: 5


Previous

Return to Nova MODs

Who is online

Users browsing this forum: No registered users and 1 guest

cron