Permalink
Browse files

Merge branch 'JOINDIN-285'

  • Loading branch information...
2 parents 8595c88 + 4783427 commit 287e62a428538330e7606b715dee687acfb2283c @dstockto dstockto committed Mar 29, 2013
Showing with 23 additions and 22 deletions.
  1. +7 −6 src/system/application/helpers/common_helper.php
  2. +16 −16 src/system/application/views/search/main.php
@@ -186,13 +186,14 @@ function escape_allowing_presentation_tags($str)
/**
* Returns the javascript required for a datepicker for a form
*
- * @param string $day Day to select initially in datepicker
- * @param string $month Month to select initially in datepicker
- * @param string $year Year to select initially in datepicker
+ * @param string $day Day to select initially in datepicker
+ * @param string $month Month to select initially in datepicker
+ * @param string $year Year to select initially in datepicker
+ * @param int $monthFirstIndex Index of January in the dropdow.
*
* @return string
**/
- function form_datepicker($day, $month, $year)
+ function form_datepicker($day, $month, $year, $monthFirstIndex = 0)
{
$javascript = <<< JSCRIPT
<input type='hidden' id='{$day}_{$month}_{$year}' />
@@ -210,7 +211,7 @@ function form_datepicker($day, $month, $year)
var selectdte = function(dateText, inst) {
var vals = dateText.split('-');
yr.val(vals[2]);
- mo.get(0).selectedIndex = (vals[0]-1);
+ mo.get(0).selectedIndex = (vals[0]-1 + {$monthFirstIndex});
da.val(vals[1].replace(/^0/, ""));
};
$('#{$day}_{$month}_{$year}').datepicker({
@@ -233,7 +234,7 @@ function form_datepicker($day, $month, $year)
* Remove htmlspecialchars from a string, used for comments
* Because CI has decided to embed htmlspecialchars in the form helper...
*
- * @param string $comment Comment to decode
+ * @param string $comment Comment to decode
*
* @return string
*/
@@ -1,6 +1,6 @@
-<?php
+<?php
if (!empty($results)) {
- menu_pagetitle('Search for: ' . escape($this->validation->search_term));
+ menu_pagetitle('Search for: ' . escape($this->validation->search_term));
} else {
menu_pagetitle('Search');
}
@@ -9,53 +9,53 @@
<div class="box">
<?php echo form_open('/search'); ?>
-
+
<?php if (!empty($this->validation->error_string)): ?>
<?php $this->load->view('msg_error', array('msg' => $this->validation->error_string)); ?>
<?php endif; ?>
-
+
<div class="row">
<label for="search_term">Search term</label>
- <?php
+ <?php
$arr=array(
'name' => 'search_term',
'id' => 'search_term',
'size' => 50,
'value' => $this->validation->search_term
);
- echo form_input($arr);
+ echo form_input($arr);
?>
<div class="clear"></div>
</div>
-
+
<div class="row">
<label for="search_term">Date range</label>
<?php
foreach (range(1,12) as $v) { $start_mo[$v]=strftime('%B', strtotime('2000-' . $v . '-01')); }
foreach (range(1,31) as $v) { $start_day[$v]=sprintf('%02d', $v); }
foreach (range(date('Y')-5, date('Y')+5) as $v) { $start_yr[$v]=$v; }
-
+
$start_mo = array(''=>'Month') + $start_mo;
$start_day = array(''=>'Day') + $start_day;
$start_yr = array(''=>'Year') + $start_yr;
-
+
echo form_dropdown('start_mo', $start_mo, $this->validation->start_mo);
echo form_dropdown('start_day', $start_day, $this->validation->start_day);
echo form_dropdown('start_yr', $start_yr, $this->validation->start_yr);
- echo form_datepicker('start_day', 'start_mo', 'start_yr');
+ echo form_datepicker('start_day', 'start_mo', 'start_yr', 1);
echo ' - ';
echo form_dropdown('end_mo', $start_mo, $this->validation->end_mo);
echo form_dropdown('end_day', $start_day, $this->validation->end_day);
echo form_dropdown('end_yr', $start_yr, $this->validation->end_yr);
- echo form_datepicker('end_day', 'end_mo', 'end_yr');
+ echo form_datepicker('end_day', 'end_mo', 'end_yr', 1);
?>
<div class="clear"></div>
</div>
-
+
<div class="row row-buttons">
<?php echo form_submit(array('name' => 'sub', 'class' => 'btn'), 'Search'); ?>
</div>
-
+
<?php echo form_close(); ?>
</div>
@@ -86,7 +86,7 @@
?>
</div>
<?php endif; ?>
-
+
<?php if (!empty($results['users'])): ?>
<div class="box">
<h2>Users</h2>
@@ -97,7 +97,7 @@
?>
</div>
<?php endif; ?>
-
+
<?php endif; ?>
-<?php endif;
+<?php endif;

0 comments on commit 287e62a

Please sign in to comment.