File: app/model/ListModel.php

Recommend this page to a friend!
  Classes of Ali YILMAZ  >  PHP PhoneBook  >  app/model/ListModel.php  >  Download  
File: app/model/ListModel.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP PhoneBook
Phone book manager application based on MVC
Author: By
Last change:
Date: 9 months ago
Size: 861 bytes
 

Contents

Class file image Download
<?php
$tblname
= 'phonebook';

$list = array();
$limit = 5;
$column = $this->increments('phonebook');

if(
$this->post){

   
$options['search']['scope'] = 'LIKE';
   
    if(!isset(
$this->post['keyword'])){
       
$this->post['keyword'] = '';
    }
   
    if(!isset(
$this->post['columns'])){
       
$this->post['columns'] = $this->columnList($tblname);
    }
    foreach (
$this->post['columns'] as $column) {
       
$options['search']['or'][] = array($column=>'%'.$this->post['keyword'].'%');
    }
   
}

// Limit control
if(!empty($this->post['limit'])){
   
$limit = $this->post['limit'];
}

// Sort control
if(empty($this->post['sort'])){
   
$this->post['sort'] = 'desc';
}

$options['limit'] = array(
       
'end' => $limit
);

$options['sort'] = $column.':'.$this->post['sort'];

$list = $this->getData($tblname, $options);

?>

For more information send a message to info at phpclasses dot org.