public function buildAction() { $project = new Application_Model_DbTable_Project(); if ($this->getRequest()->isGet()) { $type = $this->_request->get('type'); $db = $project->getAdapter(); $select = $db->select(); $select->from('ui_project', $type); $select->where('id = ?', BLOGGER_ID); $data = $db->fetchRow($select); $this->view->type = $type; $this->view->content = $data[$type]; } if ($this->getRequest()->isPost()) { $db = $project->getAdapter(); $type = $this->_request->getPost('type'); $set = array($type => $this->_request->getPost('content')); $where = $db->quoteInto('id = ?', BLOGGER_ID); $rows_affected = $db->update('ui_project', $set, $where); $this->_redirect('/'); } }
public function indexAction() { //显示文章列表和摘要 $project = new Application_Model_DbTable_Project(); $db = $project->getAdapter(); $select = $db->select(); $select->from('ui_project', 'main_page'); $select->where('id = ?', BLOGGER_ID); $data = $db->fetchOne($select); if ($data) { $this->view->main_page = $data; } else { $this->view->main_page = ''; } }
public function checknickAction($name = null) { if ($this->getRequest()->isXmlHttpRequest() || $this->_request->getParam('ajax') == 1) { $name = trim($this->_request->getParam('name')); if ($name != "tiger") { $account = new Application_Model_DbTable_Project(); $db = $account->getAdapter(); $select = $db->select(); $select->from('ui_project', 'name'); $select->where('name = ?', $name); $result = $db->fetchAll($select); } else { $result = array('tiger'); } if (count($result) == 0) { $check = true; } else { $check = false; } $this->_helper->layout->setLayout('empty_layout'); $this->_helper->viewRenderer->setNoRender(); $this->_response->appendBody($check); } }