westdc-zf1/application/module/Order/Manager/Application.php

66 lines
1.5 KiB
PHP

<?php
namespace Order\Manager;
use \Helpers\View as view;
use \Helpers\dbh;
use \Order\Listener\ApplicationListener as Listener;
class Application
{
public $config;
public $db;
public $table;
public $keyword;
public $filter;
public function __construct($db = NULL,$auth = NULL)
{
if(empty($db))
{
$this->db = \Zend_Registry::get('db');
}else{
$this->db = $db;
}
$this->config = \Zend_Registry::get('config');
$Listener = new Listener();
@$this->events()->attachAggregate($Listener);
$this->table = new \Helpers\Table();
}
public function events(\Zend_EventManager_EventCollection $events = NULL)
{
if ($events !== NULL) {
$this->events = $events;
} elseif ($this->events === NULL) {
$this->events = new \Zend_EventManager_EventManager(__CLASS__);
}
return $this->events;
}
//已经通过的所有申请
public function passed()
{
$select=$this->db->select();
$select ->from('offlineapp')
->where('ts_approved is not null')
->where('pdflink is not null')
->where('status>=0')
->order('ts_created desc');
if(!empty($this->keyword))
{
$select ->where(" (username LIKE '%{$this->keyword}%' OR
unit LIKE '%{$this->keyword}%' OR
project_id LIKE '%{$this->keyword}%' OR
project_type LIKE '%{$this->keyword}%' OR
project_leader LIKE '%{$this->keyword}%' OR
project LIKE '%{$this->keyword}%' )");
}
return $select;
}
}