This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
case 'index': | |
default: | |
$list = array(); | |
if(isset($_SESSION['flash'])){ | |
$flash = $_SESSION['flash']; | |
unset($_SESSION['flash']); | |
} | |
if(isset($_POST['q']) && !empty($_POST['q'])){ | |
$list = ActiveRecord::PublicSearch('mar',$_POST['q']); | |
$page_title = 'Search Results'; | |
$page_header = 'search results'; | |
$out .= '<p class="global_search"><a href="' . BASE_URL . 'mar/index">Back to List</a></p>'; | |
$count = count($list); | |
$out .= '<div class="search_results"><span class="number">' . number_format($count) . '</span> ' . pluralize('result',$count) . ' for the search string "' . h($_POST['q']) . '"</div>'; | |
if($count == 0) $out .= '<p class="search_error">Oops, please search again with a different term.</p>'; | |
}else{ | |
$list = ActiveRecord::FindAll('mar','1=1','added_at DESC'); | |
$page_title = 'Connections'; | |
// $page_header = ''; | |
} | |
$total = ActiveRecord::Count('mar'); | |
foreach($list as $person) { | |
$out .= '<div class="' . alternate() . ' entry"><span class="name">' . $person->full_name() . '</span> ' . | |
$person->link_for('edit','first',array('text'=>'Edit')) . ' ' . $person->link_for('view','first',array('text'=>'View')) . ' <br/> ' . $person->added_at . '</div>'; | |
} | |
$search_term = (isset($_POST['q'])) ? trim(strip_tags($_POST['q'])) : ''; | |
include(APP_ROOT . '/views/index.php'); | |
break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment