✏️ 正在编辑: RoteiroOperacional.php
路径:
/srv/systems_dir/yuppiecred-bkp/application/models/RoteiroOperacional.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_RoteiroOperacional { private $_id; private $_grupoId; private $_tipoDocumento; private $_arquivo; private $_descricao; private $_bancoId; private $_url; private $_ext; private $_link; public function getId() { return $this->_id; } public function getArquivo() { return $this->_arquivo; } public function getDescricao() { return $this->_descricao; } public function getBancoId() { return $this->_bancoId; } public function setId($id) { $this->_id = $id; return $this; } public function setArquivo($arquivo) { $this->_arquivo = $arquivo; return $this; } public function setDescricao($descricao) { $this->_descricao = $descricao; return $this; } public function setBancoId($bancoId) { $this->_bancoId = $bancoId; return $this; } public function getUrl() { return $this->_url; } public function getExt() { return $this->_ext; } public function setUrl($url) { $this->_url = $url; return $this; } public function setExt($ext) { $this->_ext = $ext; return $this; } public function getGrupoId() { return $this->_grupoId; } public function getTipoDocumento() { return $this->_tipoDocumento; } public function setGrupoId($grupoId) { $this->_grupoId = $grupoId; } public function setTipoDocumento($tipoDocumento) { $this->_tipoDocumento = $tipoDocumento; } public function getLink() { return $this->_link; } public function setLink($link) { $this->_link = $link; } public function __construct($options = null) { if( is_array($options) ){ $this->setOptions($options); } } public function setOptions(array $options) { $methods = get_class_methods($this); foreach ( $options as $key => $value ) { $explode = explode("_", $key); $methodName = ''; foreach ( $explode as $v ) { $methodName .= ucfirst($v); } $key = $methodName != '' ? $methodName : $key; $method = 'set' . ucfirst($key); if( in_array($method, $methods) ){ $this->$method($value); } } return $this; } public function _toArray() { $dbtable = new Model_DbTable_RoteiroOperacional(); $info = $dbtable->info(); $methods = get_class_methods($this); $data = array(); foreach ( $info['cols'] as $key ) { $col = $key; $explode = explode("_", $key); $methodName = ''; foreach ( $explode as $v ) { $methodName .= ucfirst($v); } $key = $methodName != '' ? $methodName : $key; $method = 'get' . ucfirst($key); if( in_array($method, $methods) ){ $data[$col] = $this->$method(); } } return $data; } /** * Insere ou altera o registro passado por parâmetro * @param Model_RoteiroOperacional $roteiro */ public function salvar(Model_RoteiroOperacional $roteiro) { $dbtable = new Model_DbTable_RoteiroOperacional(); if( $roteiro->getId() > 0 ){ $dbtable->update($roteiro->_toArray(), "id = " . $roteiro->getId()); return $roteiro->getId(); } else { return $dbtable->insert($roteiro->_toArray()); } } /** * Exclui o registro passado por parâmetro * @param int $id * @return int The number of rows deleted */ public function excluir($id) { if( $id > 0 ){ $dbtable = new Model_DbTable_RoteiroOperacional(); return $dbtable->delete("id = " . $id); } return null; } /** * Retorna uma lista * @param string $where * @param string $order * @param int $count * @param int $offset * @return array */ public function listar($where = null, $order = null, $count = null, $offset = null) { $params = array(); if( isset($where['banco_id']) ){ $params[] = "banco_id = '" . $where['banco_id'] . "'"; } if( isset($where['grupo_id']) ){ $params[] = "grupo_id = '" . $where['grupo_id'] . "'"; } if( isset($where['descricao']) ){ $params[] = "descricao LIKE '%" . $where['descricao'] . "%'"; } if( count($params) > 0 ){ $where = implode(' AND ', $params); } $dbtable = new Model_DbTable_RoteiroOperacional(); return $dbtable->fetchAll($where, $order, $count, $offset); } /** * Retorna um fetchRow do item passado por parâmetro * @param int $id * @return Zend_Db_Table_Row_Abstract | null */ public function exibir($id) { $dbtable = new Model_DbTable_RoteiroOperacional(); return $dbtable->fetchRow("id = " . $id); } public function getArquivosAuxiliares($where = null, $order = null) { $dbtable = new Model_DbTable_RoteiroOperacional(); $select = $dbtable->getAdapter()->select()->from(array( 'roteiro' => 'tb_roteiros_operacionais' ), array('id', 'descricao', 'link', 'arquivo', 'banco_id', 'grupo_id')) ->joinLeft(array( 'grupo_documento' => 'tb_tipos' ), 'grupo_documento.id = roteiro.grupo_id', array( 'grupo' => 'grupo_documento.descricao' )) ->joinLeft(array( 'banco' => 'tb_bancos' ), 'banco.id = roteiro.banco_id', array( 'banco' => 'banco.nome' )) ->where('roteiro.excluido <> 1') ->order($order); if( isset($where['banco_id']) ){ $select->where("banco_id = " . $where['banco_id']); } if( isset($where['grupo_id']) ){ $select->where("grupo_id = " . $where['grupo_id']); } if( isset($where['descricao']) ){ $select->where("descricao LIKE '%" . $where['descricao'] . "%'"); } return $dbtable->getAdapter()->fetchAll($select); } public static function getSeguranca() { $dbtable = new Model_DbTable_RoteiroOperacional(); $select = $dbtable->getAdapter()->select()->from(['roteiro' => 'tb_roteiros_operacionais'], ['id', 'descricao', 'link', 'arquivo']) ->joinLeft(['grupo_documento' => 'tb_tipos'], 'grupo_documento.id = roteiro.grupo_id', []) ->where("grupo_documento.descricao = 'Segurança da Informação'") ->where('roteiro.excluido <> 1') ; return $dbtable->getAdapter()->fetchRow($select); } }
💾 保存文件
← 返回文件管理器