How to remove footer powered by in OpensourcePOS? - php

I wonder how can I remove footer option saying "Your are using Open Source POS Version blah blah". I've already tried to edit files but after saving and restarting server UI get blocked. that means we can't change in footer. is there anyway to edit this option without blocking UI?

Please Just add this in application/views/partial/header.php
<script type="text/javascript">
$(document).ready(function() {
$('.blockUI').remove();
});
</script>
Problem Solved :)

The footer signature "You are using Open Source Point Of Sale" with version, hash and link to the original distribution of the code MUST BE RETAINED, MUST BE VISIBLE IN EVERY PAGE and CANNOT BE MODIFIED.
Better leave it as it is. Someone went through a lot of trouble making it work, and lets you use it for free. Donate instead of altering stuff you are not supposed to touch.

Its against the license terms to remove the footer. It is always professional and to credit someone's work and effort. Anyway you just need to open application/views/partial/footer.php and remove the following code:
<div id="footer">
<div class="jumbotron push-spaces">
<strong><?php echo $this->lang->line('common_you_are_using_ospos'); ?>
<?php echo $this->config->item('application_version'); ?> - <?php echo substr($this->config->item('commit_sha1'), 0, 6); ?></strong>.
<?php echo $this->lang->line('common_please_visit_my'); ?>
<?php echo $this->lang->line('common_website'); ?>
<?php echo $this->lang->line('common_learn_about_project'); ?>
</div>
</div>

Related

Letter preview PHP/JQuery

I have a set of fields such as title, body, header, footer, signature and so on. When i fill these fields which are sections of a letter, a preview of what is being filled should show as the link given here: http://www.cvplaza.com/wp-content/uploads/2012/09/cover-letter-example.png
I will be developing this using codeigniter and want to know libraries or any other technologies to achieve this. I will also need to set predefined templates for the letter so once i loads them, i can then fill-in details and the preview fill format and show the final draft.
Something like this?
Guess some normal html would suffice, just create a html mockup, including some <address> tags etc (or whatever you want), and use some css to make it look like you want. Nothing special about it...
EDIT
reply on the comment: yes and no, ofcourse you can limit the number of characters or even words, but note that calculating dimensions based on text is nearly impossible. Except for monospace fonts every letter has it's own width, which is based on several variables, amongst others the rendering engine, which depends on the os and even the browser, the font chosen, etc. etc.
Except for if you have a lot of time and/or resources, I'd go with a practical solution. If you do have both, you can dynamically parse pdf files, using, eg. FPDF or TCPDF. Or you can look into dynamically parsing LaTeX, which gives you beautiful results with minimal effort in creating a page layout. But consider; is it worth the trouble?
In case of html and latex, you can create templates the way you would create normal html templates. An example for the template I created in the fiddle would look like this in php:
<div class="letter">
<header>
<div class="sender">
<address>
<?php echo $sender['name']; ?><br/>
<?php echo $sender['address']; ?><br/>
<?php echo $sender['city']; ?><br/>
<?php echo $sender['zip']; ?><br/>
</address>
</div>
<div class="date">
<?php echo $date; ?>
</div>
<div class="recipient">
<address>
<?php // recipient... ?>
</address>
</div>
</header>
<div class="body">
Dear <?php echo $recipient['full_name']; ?><br/>
<br/>
<strong><?php echo $subject; ?></strong><br/><br/>
<?php echo nl2br($message_body); ?>
</div>
</div>

Reusable user interface in PHP?

For most of my projects I make an administration interface, which has the same design for every project. The design of the header, the footer, the topbar, the leftmenu, the css, etc. are always the same. It is a pity to create the views every time; so I was thinking: maybe there would be a nice way to put the admin interface in my MVC library, as it is reused by every project?
But for the moment, in every single view I got code like the following:
<?php $this->_include('/includes/doctype.php'); ?>
<head>
<?php $this->_include('/includes/head.php'); ?>
<title>Some title</title>
</head>
<body>
<?php $this->_include('/includes/topbar.php'); ?>
<div id="page">
<?php $this->_include('/includes/header.php'); ?>
<?php $this->_include('/includes/leftmenu.php'); ?>
<div id="content" role="main">
<h1>Some title</h1>
<p>Blah blah blah.</p>
</div><!-- /#content -->
<?php $this->_include('/includes/footer.php'); ?>
</div><!-- /#page -->
</body>
</html>
Would it be a good idea to extract the custom content from the structure of the interface, and put that structure in my library somehow to make it reusable?
After that how will it be possible to customize the title and the actual menus?
I do this all the time. I have a custom header and footer file that are called at the start and end of every page.
<?PHP
Require("includes/header.php");
...
Require("includes/footer.php");
?>
The header provides a database handle, a datetime string and handles logon, priveleges, logging of pageviews etc.
The footer provides a standard HTML page but includes some systematised variables. It also generates the menu dynamically from the driving database then closes the database connection.
This way when I write code, I don't get mixed up in the HTML and any bugs are easy to find.
I like variables akin to:
$display_scripts - adds extra data in the head section.
$display_onload_scripts - adds onload scripts to body section.
$display_style_sheets - option to include link to additional stylesheets
$display_above_menu - will appear above the menubar. NOT recommended.
$display_below_menu - will appear immediately below the menubar.
$display_one_column - page contents when only one column is to be used
$display_left_column - page contents when two columns used. Left pane.
$display_right_column - page contents when two columns used. Right pane.
$display_footer - appears in footer division.
My main code then just has to generate the appropriate variable. Fundamentally, what you need to do is examine the source of a good age you have produced then replace the stuff you want to change with variables.
Here is a schematised version of the file I use (pseudocode) to give you an idea of how I do it.
// Code here generates the menu from database
// Code here genereates popup alert messages from other users
//permanent links to external style sheets go here.
//You can also select skins here.
<?PHP
echo $display_style_sheets;
echo "<title>".$display_page_title."</title>";
?>
<script type="text/javascript" src="JAVASCRIPT GOES HERE.js"></script>
</head>
<body <?PHP echo $display_onload_scripts;?> >
<div id="page_area" >
<div id="banner">
</div>
<?php
echo $display_above_menu;
if(!$hide_menu){echo $display_menu;} //Insert the menu variable here.
echo $display_below_menu;
?>
<div id="content_area">
<div id="inner_content">
<?PHP
if($display_number_of_columns==1)
{
echo "<div id='onecolumn'>".$display_one_column."</div>"; //I only use this one
}
if($display_number_of_columns==2)
{
echo "<div id='leftcolumn'>".$display_left_column."</div>"; //these are left for legacy support from before I got better at CSS.
echo "<div id='rightcolumn'>".$display_right_column."</div>";
}
echo "<div id='footer'>".$display_footer."</div>"; //just in case - I hardly use it.
echo $display_pop_box; //for user alert messages to other users
?>
</div>
</div>
</div>
<div id="logbox"> Automatic Logout statement</div> //this is called by JS to activate timeouts.
</body>
</html>
<?PHP
$mysqlidb->close();
?>
Sorry it's such a lot of code. The layout allows easy adaptation and makes it simple to find the offending variable if things are not going as expected. There are more elegant solutions but this works well for me and is very fast.

Can a Joomla module “know” what position it's in? (2)

This is my very first question at StackOverflow.
I was trying to post comment in the post Can a Joomla module "know" what position it's in?, but could find no way to do that so I have to post another question here. Any tips regarding how to do this properly is greatly apprieciated.
Anyway, here is my questions:
I tried the code mentioned in the above post but it seemed didn't work. I'm not only quite new to PHP, but also coding, so I'm not sure if it's me or the code. here's what I did to the module's default.php file:
1)to ensure I insert the code at the right place, I insert
<?php echo(print_r($module)); ?>
and it output 1 at the right position;
2)the position-name that I need to determine is "showcase-a", so I insert code
<?php if ($module->position == 'showcase-a'):?>test<?php endif;?>
to the above place, but this time it does't show anything;
3)then I tried this code:
<?php if ($module):?><span>test</span><?php endif; ?>
But still it does't display "test" at the position as I expected.
4)I tried
<?php if (1):?><span>test</span><?php endif; ?>
and the test "test" displays as good. So I didn't code the IF statement wrong.
Now I'm totally lost. Since print_r($module) outputs 1, $module must be positive, why PHP ignore test in 3)? This is just a side question for the sake of PHP learning. What I still need to solve is let the module determine which position itself is in.
Please help. Thank you!
I'm not sure about using it in the template (although it doesn't seem wrong altogether) but my modules oftentimes access the position like this:
$module->position
in the module (so mod_something.php) so try to put it there, if it's available just set a variable and it will be available in the view too.
If $module->position didn't work for you. $module->position may only work for joomla 1.7, 2.5 and + but i'm not sure. $module->position works in joomla 2.5.
Otherwise you need to make a module.php function
Check out the file
/templates/you-template/html/modules.php
For example you make your position the following in your template (for example index.php)
<jdoc:include type="modules" name="header" style="includeposition" />
inside of
/templates/you-template/html/modules.php
You make a function like this :
<?php
function modChrome_includeposition($module, &$params, &$attribs){
//Set a value to $module->position
$module->position='WHATEVER YOUWANT';
?>
<div class="moduletable <?php echo $params->get('moduleclass_sfx').' '.$module->name; ?>">
<?php
if($module->showtitle){
?>
<div class="modtitle">
<div class="fleche">
<span>
<?php
echo $module->title;
?>
</span>
</div>
</div>
<?php
}
?>
<div class="modcontent">
<?php echo $module->content; ?>
<div class="clear">
</div>
</div>
</div>
<?php
}
?>
make different functions names that sets different values if needed.
the function name will match the syle you set:
modChrome_includeposition($module, &$params, &$attribs)
because
style="includeposition"
inside of your jdoc.

New(relatively) to code igniter : some basic questions

I'm typing this on an iPad so forgive me if being concise is a bit rude. My question is:
Is it ever ok to have simple logic inside a view? For instance,
<HTML>
<!-- ... Stuff
-->
<?php if($this->session->userdata('authorized'): ?>
<p>You are authorized</p>
<?php else: ?>
<p>You are not authorized</p>
<?php endif; ?> // Question 1, is this the proper use of an endif:?
<!-- .. Stuff
->>
</HTML>
/* Starting to type the rest of message on my laptop. Big thank yous to the coders on
this site who made my pc login transfer my unsaved, half typed iPad post */
The above was just a leftover comment in the code that would have made the limited php use look ugly. I wanted to let it be seen though.
Anyways, on to question #2:
Is it even proper to use a simple conditional like this in a view?
Thanks for reading, and hello again.
In answer to the first question:
That is the proper use of an endif, all is valid and recommended way by codeigniter.
In terms of the second question, this method can be used in a view file; however I would recommend using it in the $data array passed to the page meaning it will be accessed as $authorised; I say this as it will make more sense to a front end designer.
Information on the $data array can be found here, just navigate to "Adding logic to the controller".
I hope this is of help to you.
I recommend you to use differents views in the controller for each case:
// In the controller
if($this->session->userdata('authorized')
$this->load->view('not_autorized.php');
else
$this->load->view('view.php');
So you get clean code an views.
Use the Language class to store your 'You are authorized' and 'You are not authorized' text. Do your session check in the controller, and pass the correct language value to the view in the data array.
Edit: Additional question from STONYFTW:
What approach should one take with a bit of more complex code, such as:?
<?php if(!$this->session->userdata('isLoggedIn')): ?>
<div id="login_form">
<?php echo form_open('login/validateCredentials'); ?>
<?php echo form_input('username', 'Username'); ?>
<?php echo form_password('password', 'Password'); ?>
<?php echo form_submit('submit', 'Log In'); ?>
<div id="login_form_link_container">
<?php echo anchor('login/register', 'Register')." ".anchor('login/recover','Forgot Pass?'); ?>
</div>
</div>
<?php endif; ?>

Loading dynamic php&mysql pages without refreshing - AJAX

For the last few days I am wandering arround the web for a script which would have the elementss I wish for.. The best thusfar is this one http://www.queness.com/post/328/a-simple-ajax-driven-website-with-jqueryphp, but there are a lot problems, where i need better solution:
I want no hashtags: I want all links for loading pages like folder (www.site.com/first/site/). This works magicaly on github (click here https://github.com/spjoe/deluge-yarss-plugin, and click on a random file and go back while watching adress bar). If someone knew what or how are they doing it would be really cool.
I need dynamic content: The script above only loads "cases" from switch function, while I need the php to check the url and find a file in mysql database and echo out content from desired tables based on the url, if it is found in the db ofcourse (if I point a link to site.com/harvey the php should find Harvey in the db and display for example his phone, adress and other details, while this must not be preloaded but requested only on click due to bandwight issues).
History: I would like to have an option where back and forward movements on the site would work flawlessly and with the animation as it works while clicking links..
Working links inside changable div: Because there is a problem with some scripts which don't change content where the link is inside it (for example first content box includes navigation, which should be replaced with different navigation in the second box), again this work very well with github..
I hope you give me some links or even more help with some code..
I think the script you are looking for is pjax, it has exactly all the features you want. You can find it on github: https://github.com/defunkt/jquery-pjax/tree/heroku
EDIT
You can use it with any server-side language you like. For example,
<script src="jquery.js"></script>
<script src="jquery.cookie.js"></script>
<script src="jquery.pjax.js"></script>
<script type="text/javascript">
$(function(){
$('nav a').pjax('#content')
})
</script>
in your website's head,
<nav>
<a href="otherContent1.php" >click me for other content</a>
<a href="otherContent2.php" >click me for even more additional content</a>
</nav>
<section id="content">
<h1>Original Content</h2>
<p>
this will be replaced by pjax with the content's of otherContent1.php or otherContent2.php
</p>
</section>
in your main template and modify your php code so that it looks for the HTTP_X_PJAX header. If it's present (see xhr.setRequestHeader('X-PJAX', 'true')) render only the part that should replace the contents of <section id="content">, else render the whole page. Pjax is then intelligent enough that if it works, it will replace only the contents of <section id="content">, and if it doesn't work, you still have regular links working. pjax will even take care of google analytics, if you're using it, so your tracking is still working.
EDIT2: Example
Ok, here you have a sample php page. be aware that I did not test this, i just wrote it quick and dirty here on stack overflow to show how you could solve this. This code is untested and certainly not production ready. But as an example, you could do something like this (the file should be named index.php):
<?php
$render_template=true;
if ($_SERVER["HTTP_X_PJAX"])
{
$render_template=false;
}
?>
<?php
if ($render_template) {
?>
<html>
<head>
<meta charset="utf-8" />
<title>Testing Pjax</title>
<script src="jquery.js"></script>
<script src="jquery.cookie.js"></script>
<script src="jquery.pjax.js"></script>
<script type="text/javascript">
$(function(){
$('nav a').pjax('#content')
})
</script>
</head>
<body>
Date in template: <?php echo $today = date("D M j G:i:s T Y"); ?>
<nav>
<a href="index.php?content=1" >click me for other content</a>
<a href="index.php?content=2" >click me for even more additional content</a>
</nav>
<section id="content">
<?php
}
?>
<?php
if ($_Get["content"]==1)
{
?>
<h1>Content=1</h1>
Date in content: <?php echo $today = date("D M j G:i:s T Y"); ?>
<p>
this will be replaced by pjax with the content's of index.php?content=1 or index.php?content=2
</p>
<?php
} else {
?>
<h1>Content 2=2</h1>
Date in content: <?php echo $today = date("D M j G:i:s T Y"); ?>
<p>
this will be replaced by pjax with the content's of index.php?content=1 or index.php?content=2
</p>
<?php
}
?>
<?php
if ($render_template) {
?>
</section>
</body>
</html>
<?php
}
?>
If you want the URL to display the "Correct" url when you ajax a page request you can use PJAX it changes the history with pushState but it doesn't work on ie6-ie9 check out CanIUse: History for compatibility issues.

Categories