Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, October 15, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  Assign a filter to its own button?

phpMyEdit Configuration     Assign a filter to its own button?
Post new topic   Reply to topic    
 
jtzako     Joined: 12 Jan 2017   Posts: 16  
Post Posted: 2017-01-12 19:03
Back to top  Reply with quote     

I'd like to create buttons or tabs of some sort in List view that will let me filter based on one of my fields.

I have a column that has the date in it. I want a separate button for each month of the year.

I am able to make a filter using the built in filters, but I dont know if it is possible to assign a filter to a button.

i.e.

$opts['filters'] = "Date like '12/%'";

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2017-01-12 23:26
Back to top  Reply with quote     

near the top of the page, change date_column to your column's name


$fl2 = array_key_exists('fl2', @$_REQUEST) ? strip_tags(stripslashes(trim(@$_REQUEST['fl2']))) : '';

if($fl2 > '') {

$opts['cgi']['persist'] = array('fl2' => $fl2);

$opts['filters'] = 'date_column REGEXP "^'.$fl2.'"';

echo "\n".'<p>'.htmlentities($opts['filters'], ENT_QUOTES, 'UTF-8').'</p>';


}


near the page footer try this

$this_year = date('Y');
$string1 = '';
$separator = ' &ndash; ';
foreach(range(1, 12, 1) as $mo){
$string1 .= '<a href="'.basename($_SERVER['PHP_SELF']).'?fl2='.$this_year.'-'.sprintf("%02d", $mo).'" hreflang="en-us">'.$this_year.'-'.sprintf("%02d", $mo).'</a>';
$mo < 12 ? $string1 .= $separator : '';
}
echo "\n".'<p>'.$string1.'</p>';

 
jtzako     Joined: 12 Jan 2017   Posts: 16  
Post Posted: 2017-01-13 00:47
Back to top  Reply with quote     

Thanks a bunch, this worked great.

I made some changes so it wont print the REGEX line up top, and detects which month it is and makes a button with the months actual name instead of a numbered link. I also added an ALL button for an easy way back to the full list.

/ Get the month for filtering
$month = array_key_exists('month', @$_REQUEST) ? strip_tags(stripslashes(trim(@$_REQUEST['month']))) : '';

if($month > '') {

$opts['cgi']['persist'] = array('month' => $month);

$opts['filters'] = 'CMDate REGEXP "^'.$month.'"';

// echo "\n".'<p><font color=black>'.htmlentities($opts['filters'], ENT_QUOTES, 'UTF-8').'</font></p>';

}

$this_year = date('Y');
$string1 = '';
$separator = ' ';
$cmmonth = '';
foreach(range(1, 12, 1) as $mo){
if ($mo == "01") { $cmmonth = "January"; } elseif ($mo == "02") { $cmmonth = "February"; } elseif ($mo == "03") { $cmmonth = "March"; }
elseif ($mo == "04") { $cmmonth = "April"; } elseif ($mo == "05") { $cmmonth = "May"; } elseif ($mo == "06") { $cmmonth = "June"; }
elseif ($mo == "07") { $cmmonth = "July"; } elseif ($mo == "08") { $cmmonth = "August"; } elseif ($mo == "09") { $cmmonth = "September"; }
elseif ($mo == "10") { $cmmonth = "October"; } elseif ($mo == "11") { $cmmonth = "November"; } elseif ($mo == "12") { $cmmonth = "December"; }
$string1 .= '<a href="'.basename($_SERVER['PHP_SELF']).'?month='.sprintf("%02d", $mo).'" hreflang="en-us" class="button">'.sprintf("$cmmonth").'</a>';
$mo < 12 ? $string1 .= $separator : '';
}
echo "\n".'<p>'.$string1.' <a href="'.basename($_SERVER['PHP_SELF']).'?month="" hreflang="en-us" class="button">All</a></p>';

 
RandyBonnette     Joined: 25 Apr 2019   Posts: 1  
Post Posted: 2019-04-25 07:34
Back to top  Reply with quote     

Hello,
Perhaps, someone has a solution here. I did the same thing with my buttons for each filter.
I have a CGI Persist in my page and it just stopped working. In case I Change or Add a record the ?month= disappears and it seems to me everything goes back to default. What could be the solution? I tried a different browser and cleared the cache (just as mentioned in the older thread).
Thanks.

Older topics' reference >> CGI Persist configuration not working to write my paper and verify variables

 
johnkavitas     Joined: 31 Dec 2020   Posts: 2  
Post Posted: 2020-12-31 11:38
Back to top  Reply with quote     

For several years Write Essay Today for me has been providing Cheap essay writing services
for students at all academic levels including High School, College, University, and Undergraduate.
We specialize in preparing essays, Do my essay, Write my lab reports, Write my Assignment
and write my thesis papers on a wide variety of subjects.

https://writeessaytoday.com/

 
hannahberry     Joined: 12 Aug 2020   Posts: 4  
Post Posted: 2021-02-24 09:38
Back to top  Reply with quote     

Games that bring relaxation in them geometry dash

 
emilyalbert     Joined: 03 Feb 2023   Posts: 1  
Post Posted: 2023-02-03 18:24
Back to top  Reply with quote     

I would like to add buttons or tabs in List view to allow me to filter by one of my fields. A column has the date in it. I need a button that is different for each month. top mobile app development companies

 
maryrosesolero     Joined: 21 Feb 2024   Posts: 10  
Post Posted: 2024-02-22 14:23
Back to top  Reply with quote     

Thanks a bunch, this worked great.
drywall repair contractor

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy