db = \Zend_Registry::get('db'); }else{ $this->db = $db; } $this->config = \Zend_Registry::get('config'); } //提交申请 public function updateUserInfo(\Zend_EventManager_Event $e) { //根据pdflink字段,以判断是否已经提交 //在数据库中创建rules,在更新offlineapp表时同时更新users表中对应的信息 $formData = $e->getParam('formData'); $uid = $e->getParam('uid'); try{ $sql="SELECT id FROM ".$this->tbl_offlineapp." WHERE userid=? AND (pdflink IS null OR pdflink='') AND (ts_approved IS null)"; $row = $this->db->fetchRow($sql,array($uid)); $dbh = new dbh($this->db); $formData['username'] = $formData['realname']; unset($formData['realname']); unset($formData['save']); if ($row) { $s = $dbh->update($this->tbl_offlineapp,$formData," id={$row['id']} "); return $s; } else { $s = $dbh->insert($this->tbl_offlineapp,$formData); return $s; } }catch(Exception $e) { return $e->getMessage(); } return true; } }