/** * Lists all models. */ public function actionIndex($value = '') { list($leafs) = $this->getRelData(); $criteria = new CDbCriteria(); if (isset($_GET['keyword']) || !empty($_GET['keyword']) || strlen($_GET['keyword']) > 0 || strlen($_GET['leaf_id']) > 0) { $keyword = trim($_GET['keyword']); $criteria->condition = 'title like :keyword '; $criteria->params = array(':keyword' => "%{$keyword}%"); $opt['is_partial'] = true; } $opt['page_size'] = 20; $leaf_id = $_GET['leaf_id']; $is_include = $_GET['is_include']; if (strlen($leaf_id) > 0) { $criteria->condition .= ' AND find_in_set(category_id, :category_id)'; if ($is_include) { $leaf = Category::model()->findbypk($leaf_id); $leafs = Category::model()->findAll(array('select' => 'id, name', 'condition' => ' rgt <= :rgt AND lft >= :lft ', 'params' => array(':rgt' => $leaf->rgt, ':lft' => $leaf->lft))); $all_leafs = ''; foreach ($leafs as $_leaf) { $all_leafs .= $_leaf->id . ','; } $criteria->params[':category_id'] = $all_leafs; } else { $criteria->params[':category_id'] = $leaf_id; } } $criteria->order = 'update_time DESC'; $opt['criteria'] = $criteria; $opt['tpl_params'] = array('leafs' => $leafs); parent::actionIndex($opt); }
function __construct() { parent::__construct(new IModel(), new IView()); include_once "models/AgentModel.php"; include_once "modelviews/AgentModelView.php"; $this->agentViewModel = new AgentModelView(); }
public function __construct(\IModel $amodel, \IView $aview) { parent::__construct($amodel, $aview); require_once "models/AdminModel.php"; require_once "modelviews/AdminModelView.php"; $this->model = new AdminModel(); $this->viewmodel = new AdminModelView(); $this->db = new Database(); //check if this person is an administrator from level 3 upwards $this->createAdministrator(); }
/** * Lists all models. */ public function actionIndex() { $criteria = new CDbCriteria(); if (isset($_GET['keyword']) || !empty($_GET['keyword']) || strlen($_GET['keyword']) > 0) { $keyword = trim($_GET['keyword']); $criteria->condition = 'question like :keyword OR answer like :keyword'; $criteria->params = array(':keyword' => "%{$keyword}%"); $opt['is_partial'] = true; } $criteria->order = 'a_time DESC'; $opt['criteria'] = $criteria; parent::actionIndex($opt); }
function __construct() { parent::__construct(new IModel(), new IView()); include_once "entities/plane.php"; include_once "models/PlaneModel.php"; include_once "modelviews/PlaneModelView.php"; $this->db = new Database(); $this->db->createFields("planeID", "varchar(40)", "primary key"); $this->db->createFields("noofseats", "int", "not null"); $this->db->createFields("desc_note", "text", ""); $this->db->createFields("name", "varchar(40)", "not null"); $this->db->createFields("status", "int", "default 0"); $this->db->createTable("tbl_plane"); $this->modelView = new PlaneModelView(); }
function __construct() { parent::__construct(new IModel(), new IView()); include_once "entities/seat.php"; include_once "models/SeatModel.php"; include_once "modelviews/SeatModelView.php"; $this->db = new Database(); $this->db->createFields("planeID", "varchar(40)", "not null"); $this->db->createFields("seatNo", "int", ""); $this->db->createFields("type", "varchar(40)", ""); $this->db->createFields("price", "double", "default 0.0"); $this->db->createFields("desc_note", "text", ""); $this->db->createFields("seatID", "varchar(40)", "primary key"); $this->db->createFields("status", "int", "default 0"); $this->db->createTable("tbl_seat"); $this->modelview = new SeatModelView(); }
function __construct() { parent::__construct(new IModel(), new IView()); $this->db = new Database(); $this->db->createFields("flightID", "varchar(40)", " not null"); $this->db->createFields("booking_date", "varchar(40)", " not null"); $this->db->createFields("seatID", "varchar(40)", " not null"); $this->db->createFields("planeID", "varchar(40)", " not null"); $this->db->createFields("booking_id", "varchar(40)", " primary key"); $this->db->createFields("who_book", "varchar(40)", " "); $this->db->createFields("type", "varchar(40)", " not null"); $this->db->createFields("payment_id", "varchar(40)", ""); $this->db->createFields("children", "int", ""); $this->db->createFields("adults", "int", ""); $this->db->createFields("status", "int", ""); $this->db->createTable("tbl_booking"); include_once "modelviews/FlightModelView.php"; $this->viewModel = new FlightModelView(); }
function __construct() { parent::__construct(new IModel(), new IView()); include_once "entities/Flight.php"; include_once "models/FlightModel.php"; include_once "modelviews/FlightModelView.php"; $this->db = new Database(); $this->db->createFields("from_where", "varchar(40)", "not null"); $this->db->createFields("to_where", "varchar(40)", "not null"); $this->db->createFields("landingDate", "varchar(40)", "not null"); $this->db->createFields("BoardDate", "varchar(40)", "not null"); $this->db->createFields("LandingTime", "varchar(30)", "not null"); $this->db->createFields("BoardingTime", "varchar(30)", "not null"); $this->db->createFields("noofstop", "int", "default 0"); $this->db->createFields("price", "double", "default 0.0"); $this->db->createFields("id", "varchar(40)", "primary key"); $this->db->createFields("seats", "int", "default 0"); $this->db->createFields("planeID", "varchar(40)", "not null"); $this->db->createFields("status", "int", "default 0"); $this->db->createTable("tbl_flight"); $this->flightModelView = new FlightModelView(); }
/** * Displays a particular model. */ public function actionView() { $criteria = new CDbCriteria(); $model = $this->loadModel(); $keyword = trim($_GET['keyword']); $criteria->params = array(); $is_include = $_GET['is_include']; $criteria->condition = ' find_in_set(category_id, :category_id)'; if ($is_include) { $leafs = Category::model()->findAll(array('select' => 'id, name', 'condition' => ' rgt <= :rgt AND lft >= :lft ', 'params' => array(':rgt' => $model->rgt, ':lft' => $model->lft))); $all_leafs = ''; foreach ($leafs as $_leaf) { $all_leafs .= $_leaf->id . ','; } $criteria->params[':category_id'] = $all_leafs; } else { $criteria->params[':category_id'] = $model->id; } if ($_GET['model_type'] == 'attachment') { $opt['tpl'] = 'ajaxview_attachment'; $opt['controllerId'] = 'Attachment'; if (strlen($keyword) > 0) { $criteria->condition .= " AND t.screen_name like :keyword "; $criteria->params[':keyword'] = "%{$keyword}%"; } } else { $opt['tpl'] = 'ajaxview'; $opt['controllerId'] = 'Article'; if (strlen($keyword) > 0) { $criteria->condition .= " AND t.title like :keyword "; $criteria->params[':keyword'] = "%{$keyword}%"; } $criteria->order = 'create_time DESC'; $criteria->order = " t.sort_id DESC "; $opt['page_size'] = 12; } $opt['criteria'] = $criteria; $opt['tpl_params']['model'] = $model; parent::actionIndex($opt); }
function __construct(\IModel $amodel, \IView $aview) { parent::__construct($amodel, $aview); }
/** * Lists all models. */ public function actionIndex() { $criteria = new CDbCriteria(); if (isset($_GET['keyword']) || !empty($_GET['keyword']) || strlen($_GET['keyword']) > 0) { $keyword = trim($_GET['keyword']); $criteria->condition = 'username like :keyword OR email like :keyword '; $criteria->params = array(':keyword' => "%{$keyword}%"); $opt['is_partial'] = true; } $criteria->order = 'id desc'; $opt['criteria'] = $criteria; parent::actionIndex($opt); }