diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 9e7b061b5..af735d7b6 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -300,16 +300,16 @@ class news_admin_ui extends e_admin_ui 'news_meta_description' => array('title' => LAN_DESCRIPTION,'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false), 'news_sef' => array('title' => 'SEF URL', 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false), 'user_name' => array('title' => LAN_NEWS_50, 'type' => 'text', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false), - 'news_datestamp' => array('title' => LAN_NEWS_32, 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'), - 'news_category' => array('title' => NWSLAN_6, 'type' => 'dropdown', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true), + 'news_datestamp' => array('title' => LAN_NEWS_32, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y', 'filter'=>true), + 'news_category' => array('title' => NWSLAN_6, 'type' => 'dropdown', 'data' => 'int', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true), 'news_start' => array('title' => "Start", 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'), 'news_end' => array('title' => "End", 'type' => 'datestamp', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'parms' => 'mask=%A %d %B %Y'), - 'news_class' => array('title' => NWSLAN_22, 'type' => 'userclasses', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true), + 'news_class' => array('title' => NWSLAN_22, 'type' => 'userclasses', 'data' => 'int', 'width' => 'auto', 'thclass' => '', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true), 'news_render_type' => array('title' => LAN_TEMPLATE, 'type' => 'dropdown', 'data' => 'comma', 'width' => 'auto', 'thclass' => 'center', 'class' => null, 'nosort' => false, 'batch'=>true, 'filter'=>true), - 'news_sticky' => array('title' => LAN_NEWS_28, 'type' => 'boolean', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false, 'batch'=>true, 'filter'=>true), - 'news_allow_comments' => array('title' => NWSLAN_15, 'type' => 'boolean', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false,'batch'=>true, 'filter'=>true,'readParms'=>'reverse=1','writeParms'=>'reverse=1'), + 'news_sticky' => array('title' => LAN_NEWS_28, 'type' => 'boolean', 'data' => 'int' , 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false, 'batch'=>true, 'filter'=>true), + 'news_allow_comments' => array('title' => NWSLAN_15, 'type' => 'boolean', 'data' => 'int', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center', 'nosort' => false,'batch'=>true, 'filter'=>true,'readParms'=>'reverse=1','writeParms'=>'reverse=1'), 'news_comment_total' => array('title' => LAN_NEWS_60, 'type' => 'number', 'width' => '10%', 'thclass' => '', 'class' => null, 'nosort' => false), 'options' => array('title' => LAN_OPTIONS, 'type' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center', 'nosort' => true, 'forced' => TRUE) diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index c2088d8ae..117ac7de9 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -2816,6 +2816,24 @@ class e_admin_controller_ui extends e_admin_controller // direct query $res = array($filter[1], $filter[2]); break; + + case 'datestamp': + + $dateConvert = array( + "hour" => "1 hour ago", + "day" => "24 hours ago", + "week" => "1 week ago", + "month" => "1 month ago", + "year" => "1 year ago" + ); + + $ky = $filter[2]; + $time = vartrue($dateConvert[$ky]); + $timeStamp = strtotime($time); + + $res = array($filter[1], $timeStamp); + + break; default: //something like handleListUrlTypeFilter(); for custom handling of 'url_type' field name filters @@ -2836,6 +2854,10 @@ class e_admin_controller_ui extends e_admin_controller } break; } + + //print_a($res); + //exit; + return $res; } @@ -3238,16 +3260,34 @@ class e_admin_controller_ui extends e_admin_controller if($filterField && $filterValue !== '' && isset($this->fields[$filterField])) { - if($this->fields[$filterField]['data'] == 'comma') + switch ($this->fields[$filterField]['data']) { - $searchQry[] = "FIND_IN_SET('".$tp->toDB($filterValue)."',".$this->fields[$filterField]['__tableField'].")"; - } - else - { - $searchQry[] = $this->fields[$filterField]['__tableField']." = '".$tp->toDB($filterValue)."'"; + case 'comma': + $searchQry[] = "FIND_IN_SET('".$tp->toDB($filterValue)."',".$this->fields[$filterField]['__tableField'].")"; + break; + + case 'int': + case 'integer': + if($this->fields[$filterField]['type'] == 'datestamp') // Past Month, Past Year etc. + { + $searchQry[] = $this->fields[$filterField]['__tableField']." > ".intval($filterValue); + } + else + { + $searchQry[] = $this->fields[$filterField]['__tableField']." = ".intval($filterValue); + } + break; + + default: + + $searchQry[] = $this->fields[$filterField]['__tableField']." = '".$tp->toDB($filterValue)."'"; + //exit; + break; } } + //echo 'type= '. $this->fields[$filterField]['data']; + // print_a($this->fields[$filterField]); } elseif($searchFilter && is_string($searchFilter)) { @@ -3451,7 +3491,7 @@ class e_admin_controller_ui extends e_admin_controller // Debug Filter Query. - // echo $qry.'
'; + // echo $qry.'
'; // print_a($_GET); return $qry; @@ -4705,12 +4745,23 @@ class e_admin_form_ui extends e_form } break; - case 'datestamp': // use $parm to determine unix-style or YYYY-MM-DD - //TODO last hour, today, yesterday, this-month, last-month etc. - /* foreach($val['parm'] as $k=>$name) + case 'datestamp': + //TODO today, yesterday, this-month, last-month . + + $dateFilters = array ( + 'hour' => "Past Hour", + "day" => "Past 24 hours", + "week" => "Past Week", + "month" => "Past Month", + "year" => "Past Year" + ); + + foreach($dateFilters as $k => $name) { - $text .= $frm->option($name, $type.'__'.$key."__".$k); - }*/ + $option['datestamp__'.$key.'__'.$k] = $name; + // $option['bool__'.$key.'__0'] = LAN_NO; + // $option[$key.'__'.$k] = $name; + } break; case 'userclass': diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index e5c3b804b..8102e76b3 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -539,9 +539,9 @@ class e_media // $text .= " "; // Manual filter, if onkeyup ajax fails for some reason. $text .= ""; // Manual filter, if onkeyup ajax fails for some reason. - $text .= " "; // see next page of images. + $text .= " "; // see next page of images. - $text .= ""; // see next page of images. + $text .= ""; // see next page of images. $text .= "
"; }