We also verify whether the
dates entered in the Start Date and End Date text boxes are valid.
We first process the dates with strtotime that parses a string and transforms it into a Unix timestamp. This
function is useful, because it also accepts entries such as ???now???, ???tomorrow???, ???last Friday???, ???next Tuesday???, and
so on as input values.
The resulting timestamp is then processed with the strftime function, which transforms it into the YYYY/MM/DD
HH:MM:SS format. Have a look at how these date/time values are parsed:
// Check if the start date is in accepted format
if (($this->mStartDate == '') ||
($timestamp = strtotime($this->mStartDate)) == -1)
CHAPTER 14 ?– ACCEPTING CUSTOMER ORDERS 452
$this->mErrorMessage = 'The start date is invalid. ';
else
// Transform date to YYYY/MM/DD HH:MM:SS format
$this->mStartDate =
strftime('%Y/%m/%d %H:%M:%S', strtotime($this->mStartDate));
?– Note Check http://www.php.net/strtotime to see what input formats are supported by the strtotime
function and http://www.php.net/strftime for more details about strftime. You can find a useful
strototime tutorial at http://www.programmers-corner.com/tutorial/80.
Apart from this detail, the admin_orders.tpl template file is pretty simple and doesn??™t introduce any new
theoretical elements for you.
Displaying Order Details
In this section, you??™ll create the admin_order_details componentized template, which allows
the administrator to edit the details of a particular order.
Pages:
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571