/** * Escapes a date for use in SQL, includes surrounding quotes * * A `NULL` or invalid value will be returned as `'NULL'` * * @param string $value The date to escape * @return string The escaped date */ private function escapeDate($value) { if ($value === NULL) { return 'NULL'; } try { $value = new fDate($value); return "'" . $value->format('Y-m-d') . "'"; } catch (fValidationException $e) { return 'NULL'; } }
?> <div id="content" class="span-24 last"> <?php $tmpl->place('menuAdmin'); ?> <h2>Administration</h2><h3>Currency</h3> <table> <thead> <tr><th>Country</th><th>Exchange</th><th>Month</th><th>Year</th><th>Icon</th></tr> </thead> <tbody> <?php try { $currencies = Currency::findAll(); foreach ($currencies as $currency) { $tempDate = new fDate($currency->getMonth()); printf("<tr class=\"currencyRow\"><td class=\"hideFirst\" id=\"cId\">%s</td></td><td id=\"cCountry\" class=\"varInput\">%s</td><td id=\"cExchange\" class=\"varInput\">%s</td><td id=\"cMonth\" class=\"varInput\">%s</td><td id=\"cYear\" class=\"varInput\">%s</td>", $currency->prepareId(), $currency->prepareCountry(), $currency->prepareExchange(2), $tempDate->format('F'), $tempDate->format('Y')); printf("<td id=\"iconCell\" class=\"hideFirst\"><ul id=\"icons\" class=\"ui-widget ui-helper-clearfix\">\n\t\t\t\t\t\t\t\t<li id=\"save\" title=\"Save\" class=\"ui-state-default ui-corner-all\"><span class=\"ui-icon ui-icon-circle-check\"></span></li>\n\t\t\t\t\t\t\t\t<li id=\"cancel\" title=\"Cancel\" class=\"ui-state-default ui-corner-all\"><span class=\"ui-icon ui-icon-circle-close\"></span></li>\n\t\t\t\t\t\t\t\t</ul></td></tr>"); } } catch (fExpectedException $e) { echo $e->printMessage(); } ?> <tr id="newItem"> <td><input id="nuCountry" value="Input Country"></input></td> <td><input id="nuExchange" value="Input Value"></input></td> <td> <select id="nuMonth"> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option>
?> <th> Editar </th> <?php } ?> <?php if ($canDelete) { ?> <th> Eliminar </th> <?php } ?> </tr> <?php date_default_timezone_set('America/Mexico_City'); foreach ($banners as $banner) { $date1 = new fDate($banner->getCreated_at()); $id = $banner->prepareId_banner(); //$category = new Category(array('id_category' => $article->prepareId_category(), 'id_section' => $section_id)); //$user = new User($article->prepareId_user()); $status = $banner->getStatus(); $status = $status == true || $status == "Yes" || $status == 1 ? "Publicado" : "No publicado"; echo '<tr> <td> <input type="checkbox" class="check" value="' . $id . '" name="args[]" /> </td> '; $image = Banner::getImage($id, 1); if (!empty($image)) { echo ' <td> <img width="200" height="80" src="../uploads/banner/thumbs/' . $image . '"/> </td>'; } else { echo '<td> - </td>'; }
/** * @dataProvider lteProvider */ public function testLte($primary, $secondary, $result) { $date = new fDate($primary); $this->assertEquals($result, $date->lte($secondary)); }