public function lockAction() { header('Content-type: application/json'); $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper('layout')->disableLayout(); $id = $this->_getParam('id', 0); $clientDb = new Admin_Model_DbTable_Client(); $client = $clientDb->getClient($id); if ($this->isLocked($client['locked'], $client['lockedtime'])) { $userDb = new Users_Model_DbTable_User(); $user = $userDb->getUser($client['locked']); echo Zend_Json::encode(array('message' => $this->view->translate('MESSAGES_ACCESS_DENIED_%1$s', $user['name']))); } else { $clientDb->lock($id, $this->_user['id'], $this->_date); } }
/** * Create the user condition * * @param int|string $id * @return string */ protected function _createUserCondition($id) { $table = new Users_Model_DbTable_User(); $adapter = $table->getAdapter(); $conditions = array(); foreach (array('user_id', 'user_username') as $field) { $conditions[] = $adapter->quoteInto($field . ' = ?', $id); } return implode(' OR ', $conditions); }