✏️ 正在编辑: CallcenterGravacao.php
路径:
/srv/systems_dir/yuppiecred-bkp/application/models/CallcenterGravacao.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_CallcenterGravacao { private $_id; private $_clienteId; private $_origem; private $_telefone; private $_ramal; private $_data; private $_arquivo; public function getId() { return $this->_id; } public function getClienteId() { return $this->_clienteId; } public function getOrigem() { return $this->_origem; } public function getTelefone() { return $this->_telefone; } public function getRamal() { return $this->_ramal; } public function getData() { return $this->_data; } public function getArquivo() { return $this->_arquivo; } public function setId($id) { $this->_id = $id; } public function setClienteId($clienteId) { $this->_clienteId = $clienteId; } public function setOrigem($origem) { $this->_origem = $origem; } public function setTelefone($telefone) { $this->_telefone = ltrim($telefone, '0'); } public function setRamal($ramal) { $this->_ramal = $ramal; } public function setData($data) { $this->_data = $data; } public function setArquivo($arquivo) { $this->_arquivo = $arquivo; } 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_CallcenterGravacao(); $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 a instância da classe(objeto) no banco de dados * @return int Retorna o id do objeto */ public function salvar() { $dbtable = new Model_DbTable_CallcenterGravacao(); if( $this->getId() > 0 ){ $dbtable->update($this); return $this->getId(); } else { return $dbtable->insert($this); } } /** * Exclui a instância da classe(objeto) no banco de dados * @return boolean TRUE em caso de sucesso na exclusão, FALSE caso contrário */ public function delete() { if( empty($this->getId()) ){ throw new Exception("Objeto não persistido no banco de dados"); } $fileName = PUBLIC_PATH . "/downloads/gravacoes/{$this->getArquivo()}"; if( file_exists($fileName)){ unlink($fileName); } $dbtable = new Model_DbTable_CallcenterGravacao(); return $dbtable->delete($this); } }
💾 保存文件
← 返回文件管理器