Author Topic: trade centre open at a certain time and also the bank  (Read 3472 times)

Offline CuTe_MaN

trade centre open at a certain time and also the bank
« on: June 05, 2007, 03:29:37 pm »
Hello all,

I have an idea to use it with the shop, is it possible to let the Trade centre open certain time a day or a week or somthing that is set by the admin and also the bank is it possible to make the same?

I am planning to allow users to sell thier products at a certain time or certain day only

and they can also entre the bank at certain time so they cant deposit or withdrawl only at the time that admin specify.


Thx

CuTe_MaN

Offline Basil Beard

Re: trade centre open at a certain time and also the bank
« Reply #1 on: June 06, 2007, 12:44:54 am »
This shouldn't be too hard to code. php has a built in date function that allows you to extract the current date. You can use that, along with an if-statement, to not show any bank functions if the time isn't right. In shop-bank.php find

Code: [Select]
isAllowedTo('shop_bank');


and add
Code: [Select]
if (//put your time frame here. Google the php date function to find how this works) {

and add the end add

Code: [Select]
}
else {
        $context['shop_buy_message'] = 'You are not allowed to access the bank at this time';
// Set the page title

$context['page_title'] = $txt['shop'] . ' - ' . $txt['shop_bank'];

// Use the 'message' template

$context['sub_template'] = 'message';

}

A couple of examples of how your if statement might work:

Taking the Sabbith(bank closed on sunday)
Code: [Select]
if (date('w') != 0) {

Only weekends:
Code: [Select]
if (date('w') == 0 || date('w') == 6) {

Only open 9-5
Code: [Select]
if (9 <= date('G') < 17) {

Of course, there are many many other things you can do. Look here for how the date function works:
http://us.php.net/date

Edited by Daniel15: Fixed formatting
« Last Edit: June 08, 2007, 08:30:59 pm by Daniel15 »
Arrrrr!