listing page

From SkyPHP

Jump to: navigation, search

page | listing page | profile page

A listing page is a page used for displaying the records in a primary table. Each record has a link to its profile page.

Contents

Anatomy of a Listing Page


Example 1 Standard Intranet Listing Page

<?
$title = 'Your Page title';
template::inc('intranet','top');
?>

<a href="/admin/../add-new"  class="addnew">Add New</a>

<?
            // display the filters
            include ( INCPATH . '/includes/listing-filter.php');

            // display the tabs
            snippet::tabs($tabs);

            // display the grid
            aql::grid(array(

                'model' => 'blog_article',

                'columns' => " title {
                                    label: Title;
                                    order by: title;
                               }
                               blog_name { 
                                    label: Blog;
                               }
                               fname_lname  { 
                                    label: Author;
                                    order by: person.fname;
                               }
                               market_name  { label:	Market; }
                               $post_time_column
                               note         { label:	Note; }
                               edit         { label:	Edit; }",

                'where' => $where,

                'order by' => 'post_time desc',

                'enable_sort' => true,

                'max_rows' => 50

            ));
?>



<?
template::inc('intranet','bottom');
?>

Example 1a Standard Intranet Listing Page

<?
$tabs = array(
	'My Profile' => '/admin/client/profile/' . $_POST['sky_ide'],
	'My Properties' => '/admin/client/property/' . $_POST['sky_ide'],
	'My Showings' => '/admin/client/showing/' . $_POST['sky_ide'],
	'My Marketing' => '/admin/client/marketing/' . $_POST['sky_ide'],	
	'My Offer' => '/admin/client/offer/' . $_POST['sky_ide']
);
snippet::tab_redirect($tabs);

$title = 'Your Page title';
template::inc('intranet','top');
?>

<a href="/admin/"  class="addnew">Add New</a>

<? /* 
SEARCH QUERY SNIPPET
*/
?>

<?

snippet::tabs( $tabs, NULL, array( 
    'div_class' => 'client_tabs' 
));


?>

$cols = "	
	name		{label:	Title		;}
	status		{label:	Status		;}
	fname		{label:	Author Name	;}
	market_name	{label:	Market		;}
	post_time	{label:	Post Time	;}
	edit		{label:	Edit		;}
    ";

$model = "table_name";
$where = "condition string";
$order_by = "field asc";


$clause = array(
    'table_name' => array(
        'where' => $where,
        'order by' => $order_by
    )
);

aql::grid(array(	
	"model" => $model, 
	"cols" => $cols,
	"clause" => $clause
));

template::inc('template_name','bottom');
?>


Example 2 AQL Intranet Listing Page (aql instead of model)


<?
$title = 'Your Page title';
template::inc('intranet','top');
?>

<a href="/admin/folder_name/add-new">Add New</a>

<? /* 
SEARCH QUERY SNIPPET
*/
?>

<?
$tabs = array(
	'My Profile' => '/admin/client/profile/' . $_POST['sky_ide'],
	'My Properties' => '/admin/client/property/' . $_POST['sky_ide'],
	'My Showings' => '/admin/client/showing/' . $_POST['sky_ide'],
	'My Marketing' => '/admin/client/marketing/' . $_POST['sky_ide'],	
	'My Offer' => '/admin/client/offer/' . $_POST['sky_ide']
);

$param = array( 'div_class' => 'client_tabs' );
snippet::tabs($tabs,NULL,$param);
snippet::tab_redirect($tabs);

?>

$aql = "table_name {
			id as name,
			title,
			introduction
		}";

$cols = "	
	name		{label:	Title		;}
	status		{label:	Status		;}
	fname		{label:	Author Name	;}
	market_name	{label:	Market		;}
	post_time	{label:	Post Time	;}
	edit		{label:	Edit		;}
     ";


$where = "condition string";
$order_by = "field asc";


$clause = array(
    'table_name' => array(
        'where' => $where,
        'order by' => $order_by
    )
);

$params = array (	
		"aql"=>$aql, 
		"cols"=>$cols,
		"clause"=>$clause
		);

aql::grid($params);
template::inc('template_name','bottom');
?>


Example Column ATTRIBUTES on Listing Page

           label: Album;
           order by: album.sort_name;
           align: right;
           hide: true;
           total: true;

font-size font-weight, color? enable sort limit no_matches_text

Example COMPONENTS on Listing Page

Each column is globally limited because it is only set to display data from any field in the table. This limitation is overcome with the use of "Components" as columns on a listing pages -- customizes a column. Components can simply format data or run complex scripts including Ajax.

Creating a component uses the following convention: (fields must be in the aql model) A component formatting a field is placed according to:

  • folder with the table name
  • sub-folder with the field name
  • file using the field-name.php

THE ID FOLDER If the component is placed in an "id folder", there is NO sub-folder, use file name with identifier such as location.php (address, city, state, zipcode fields). When creating a component in the "id folder" you need to add it to the model: id as location When naming the component in the id folder: DO NOT USE A FIELD NAME IT WILL CAUSE AN ERROR: "id as source" in the aql when there is a field called source See details: components


Example BUTTONS on Listing Page

Most listing pages have either edit/view buttons depending on whether the profile page is editable. Some listing pages have save buttons and some have both save and edit/view buttons as well as ajax column components that save data.

           edit() goes to editable profile page
           view() goes to read only profile page
           save() saves /inserted/updated data
           save() saves and goes to the next tab

Notes

$remember_uri = false;

  • append a question mark to the page url to reset the uri that is being remembered.
Personal tools