本文整理汇总了PHP中Zend_Db_Table_Abstract::getDefaultAdapter方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Table_Abstract::getDefaultAdapter方法的具体用法?PHP Zend_Db_Table_Abstract::getDefaultAdapter怎么用?PHP Zend_Db_Table_Abstract::getDefaultAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Table_Abstract
的用法示例。
在下文中一共展示了Zend_Db_Table_Abstract::getDefaultAdapter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authenticate
public static function authenticate(array $values)
{
$email = isset($values['email']) ? $values['email'] : null;
$senha = isset($values['senha']) ? $values['senha'] : null;
if (!count($values)) {
throw new Exception('Não foi passado valores para autenticar');
}
// Pegar os dados da autenticacao e checa
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter->setTableName('usuario')->setIdentityColumn('email')->setCredentialColumn('senha');
$authAdapter->setIdentity($email)->setCredential($senha)->setCredentialTreatment('MD5(?)');
$select = $authAdapter->getDbSelect();
$select->join(array('g' => 'grupo'), 'g.id = usuario.grupo_id', array('grupo' => 'nome'));
//Realiza autenticação
$result = $authAdapter->authenticate();
//Verifica se a autenticação foi válida
if ($result->isValid()) {
//Obtém dados do usuário
$usuario = $authAdapter->getResultRowObject();
//Armazena seus dados na sessão
$storage = Zend_Auth::getInstance()->getStorage();
$storage->write($usuario);
//Redireciona para o Index
return true;
}
return false;
}
示例2: init
public function init()
{
$this->getHelper('layout')->disableLayout();
$this->_db = Zend_Db_Table_Abstract::getDefaultAdapter();
$cfg = Zend_Registry::get('cfg');
$this->_docsPath = $cfg['docs']['path'];
}
示例3: save
/**
*
* @return int|bool
*/
public function save()
{
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter->beginTransaction();
try {
$row = $this->_checkNameDepartment($this->_data);
if (!empty($row)) {
$this->_message->addMessage('Departamentu iha tiha ona.', App_Message::ERROR);
return false;
}
if (empty($this->_data['id_department'])) {
$history = 'INSERE DEPARTAMENTU: %s DADUS PRINCIPAL - INSERE NOVO DEPARTAMENTU';
} else {
$history = 'ALTERA DEPARTAMENTU: %s DADUS PRINCIPAL - ALTERA DEPARTAMENTU';
}
$id = parent::_simpleSave();
$history = sprintf($history, $this->_data['name']);
$this->_sysAudit($history);
$dbAdapter->commit();
return $id;
} catch (Exception $e) {
$dbAdapter->rollBack();
$this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
return false;
}
}
示例4: save
/**
*
* @return int|bool
*/
public function save()
{
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter->beginTransaction();
try {
$row = $this->_checkClassTimor($this->_data);
if (!empty($row)) {
$this->_message->addMessage('Klase Timor-Leste iha tiha ona.', App_Message::ERROR);
return false;
}
if (empty($this->_data['id_isicclasstimor'])) {
$history = 'REJISTRU CLASSE TIMOR: %s-%s';
} else {
$history = 'ALTERA CLASSE TIMOR: %s-%s';
}
$id = parent::_simpleSave();
$history = sprintf($history, $this->_data['acronym'], $this->_data['name_classtimor']);
$this->_sysAudit($history);
$dbAdapter->commit();
return $id;
} catch (Exception $e) {
$dbAdapter->rollBack();
$this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
return false;
}
}
示例5: save
/**
*
* @return int|bool
*/
public function save()
{
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter->beginTransaction();
try {
$row = $this->_checkDistrict($this->_data);
if (!empty($row)) {
$this->_message->addMessage('Distritu iha tiha ona.', App_Message::ERROR);
return false;
}
if (empty($this->_data['id_adddistrict'])) {
$history = 'INSERE DISTRITU: %s - INSERIDO NOVO DISTRITU';
} else {
$history = 'ALTERA DISTRITU: %s - ALTUALIZADO DISTRITO COM SUCESSO';
}
$id = parent::_simpleSave();
$history = sprintf($history, $this->_data['District']);
$this->_sysAudit($history);
$dbAdapter->commit();
return $id;
} catch (Exception $e) {
$dbAdapter->rollBack();
$this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
return false;
}
}
示例6: save
/**
*
* @return int|bool
*/
public function save()
{
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter->beginTransaction();
try {
$row = $this->_checkCeop($this->_data);
if (!empty($row)) {
$this->_message->addMessage('CEOP iha tiha ona.', App_Message::ERROR);
return false;
}
if (empty($this->_data['id_dec'])) {
$history = 'INSERE CEOP-DEC: %s- INSERIDO NOVO CEOP-DEC COM SUCESSO';
$this->_data['fk_id_sysuser'] = Zend_Auth::getInstance()->getIdentity()->id_sysuser;
$this->_data['registry_date'] = Zend_Date::now()->toString('yyyy-MM-dd');
} else {
$history = 'ALTERA CEOP-DEC: %s DADUS PRINCIPAL - ALTERA CEOP-DEC';
}
$id = parent::_simpleSave();
$history = sprintf($history, $id);
$this->_sysAudit($history);
$dbAdapter->commit();
return $id;
} catch (Exception $e) {
$dbAdapter->rollBack();
$this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
return false;
}
}
示例7: save
/**
*
* @return int|bool
*/
public function save()
{
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter->beginTransaction();
try {
// $row = $this->_checkOcupationTimor( $this->_data );
//
// if ( !empty( $row ) ) {
// $this->_message->addMessage( 'Okupasaun Timor-Leste iha tiha ona.', App_Message::ERROR );
// return false;
// }
if (empty($this->_data['id_profocupationtimor'])) {
$history = 'INSERE OCUPASAUN TIMOR: %s DADUS PRINCIPAL - INSERE NOVO OCUPASAUN TIMOR';
} else {
$history = 'ALTERA Ocupasaun Timor: %s DADUS PRINCIPAL - ALTERA Ocupasaun Timor';
}
$id = parent::_simpleSave();
$history = sprintf($history, $this->_data['ocupation_name_timor']);
$this->_sysAudit($history);
$dbAdapter->commit();
return $id;
} catch (Exception $e) {
$dbAdapter->rollBack();
$this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
return false;
}
}
示例8: crearventa
public function crearventa($total, $mesa, $fecha, $puntos_venta, $descuento, $observacion, $id_usuario)
{
$data = array('total' => $total, 'mesa' => $mesa, 'fecha' => $fecha, 'puntos_venta' => $puntos_venta, 'descuento' => $descuento, 'observacion' => $observacion, 'id_usuario' => $id_usuario);
$this->insert($data, 0);
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
return $db->lastInsertId();
}
示例9: browseAction
public function browseAction()
{
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$sql = "SELECT * FROM evaluation WHERE is_deleted = 0";
$rowArray = $db->fetchAll($sql);
$this->view->assign('evaluations', $rowArray);
}
示例10: getAuthAdapter
public function getAuthAdapter($values)
{
$authAdapter = new Zend_Auth_Adapter_DbTable(Zend_Db_Table_Abstract::getDefaultAdapter(), 'Utenti', 'Username', 'Password');
$authAdapter->setIdentity($values['username']);
$authAdapter->setCredential($values['password']);
return $authAdapter;
}
示例11: save
/**
*
* @return int|bool
*/
public function save()
{
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter->beginTransaction();
try {
$row = $this->_checkTypeBankAccount($this->_data);
if (!empty($row)) {
$this->_message->addMessage('Tipu Konta Banku iha tiha ona.', App_Message::ERROR);
return false;
}
if (empty($this->_data['id_bank'])) {
$history = 'INSERE TIPU KONTA BANKU: %s - INSERIDO NOVO TIPU KONTA BANKU';
} else {
$history = 'ALTERA TIPU KONTA BANKU: %s - ALTERADO TIPU KONTA BANKU';
}
$id = parent::_simpleSave();
$history = sprintf($history, $this->_data['type_bankaccount']);
$this->_sysAudit($history);
$dbAdapter->commit();
return $id;
} catch (Exception $e) {
$dbAdapter->rollBack();
$this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
return false;
}
}
示例12: save
/**
*
* @return int|bool
*/
public function save()
{
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter->beginTransaction();
try {
$row = $this->_checkIsicGroup($this->_data);
if (!empty($row)) {
$this->_message->addMessage('Grupu Setor Industria iha tiha ona.', App_Message::ERROR);
return false;
}
$mapperDivision = new Register_Model_Mapper_IsicDivision();
$division = $mapperDivision->fetchRow($this->_data['fk_id_isicdivision']);
$this->_data['acronym'] = $division->acronym . $this->_data['acronym'];
if (empty($this->_data['id_isicgroup'])) {
$history = 'REJISTRU GRUPU: %s';
} else {
$history = 'ALTERA GRUPU: %s';
}
$id = parent::_simpleSave();
// Save the client history
$history = sprintf($history, $this->_data['acronym']);
$this->_sysAudit($history);
$dbAdapter->commit();
return $id;
} catch (Exception $e) {
$dbAdapter->rollBack();
$this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
return false;
}
}
示例13: auth
public function auth($usuario, $password)
{
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$authAdapter = new Zend_Auth_Adapter_DbTable($dbAdapter);
$authAdapter->setTableName('cn_admin')->setIdentityColumn('email')->setCredentialColumn('password')->setIdentity($usuario)->setCredential(md5($password));
$select = $authAdapter->getDbSelect();
$select->where('flagactive = 1');
$result = Zend_Auth::getInstance()->authenticate($authAdapter);
if ($result->isValid()) {
$storage = Zend_Auth::getInstance()->getStorage();
$bddResultRow = $authAdapter->getResultRowObject();
$storage->write($bddResultRow);
$msj = 'Bienvenido Usuario ' . $result->getIdentity();
$this->view->message = $this->_flashMessenger->success($msj);
$this->_identity = Zend_Auth::getInstance()->getIdentity();
$return = true;
} else {
switch ($result->getCode()) {
case Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND:
$msj = 'El usuario no existe';
break;
case Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID:
$msj = 'Password incorrecto';
break;
default:
$msj = 'Datos incorrectos';
break;
}
$this->view->message = $this->_flashMessenger->warning($msj);
$return = false;
}
return $return;
}
示例14: save
/**
*
* @return int|bool
*/
public function save()
{
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter->beginTransaction();
try {
$row = $this->_checkSubGroup($this->_data);
if (!empty($row)) {
$this->_message->addMessage('Sub-Grupu Okupasaun iha tiha ona.', App_Message::ERROR);
return false;
}
$mapperGroup = new Register_Model_Mapper_ProfGroup();
$group = $mapperGroup->fetchRow($this->_data['fk_id_profgroup']);
$this->_data['acronym'] = $group->acronym . $this->_data['acronym'];
if (empty($this->_data['id_profsubgroup'])) {
$history = 'INSERE SUB-GROUP: %s - INSERIDO NOVO SUB-GRUPO';
} else {
$history = 'ALTERA SUB-GROUP: %s - ALTERADO SUB-GROUP';
}
$id = parent::_simpleSave();
$history = sprintf($history, $this->_data['sub_group']);
$this->_sysAudit($history);
$dbAdapter->commit();
return $id;
} catch (Exception $e) {
$dbAdapter->rollBack();
$this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
return false;
}
}
示例15: save
/**
*
* @return int|bool
*/
public function save()
{
$dbAdapter = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter->beginTransaction();
try {
$row = $this->_checkGroup($this->_data);
if (!empty($row)) {
$this->_message->addMessage('Sesaun Industria iha tiha ona.', App_Message::ERROR);
return false;
}
if (empty($this->_data['id_isicsection'])) {
$history = 'REJISTRU SESAUN: %s';
} else {
$history = 'ALTERA SESAUN: %s';
}
$id = parent::_simpleSave();
$history = sprintf($history, $this->_data['name_section']);
$this->_sysAudit($history);
$dbAdapter->commit();
return $id;
} catch (Exception $e) {
$dbAdapter->rollBack();
$this->_message->addMessage($this->_config->messages->error, App_Message::ERROR);
return false;
}
}