public function imageAction() { $userModel = new UserModel(); $userData = $userModel->fetchRow($userModel->getUserById($_GET['user'])); //print_r($userData); if ($userData['nmuserimage'] == '') { $userData['nmuserimage'] = 'noUserPhoto_flat.png'; } $this->view->image = $userData['nmuserimage']; }
public function alterAction() { $cdusergslab = $this->_request->getParam("cdusergslab"); $userModel = new UserModel(); $dataUser = $userModel->fetchRow($userModel->getUserByCd($cdusergslab)); $arrayPopulateForm = array(); foreach ($dataUser as $id => $value) { $arrayPopulateForm["_" . $id] = $value; } $this->_form->addAttributesForm($this->view->baseUrl . "/cadastre/user/save", "user_cadastre_form"); $buttonInclude = $this->_form->createButton("Hidden", "Incluir Função", "include", $this->view->baseUrl . "/cadastre/role", "_blank", "includeForm"); $buttonPrint = $this->_form->createButton("Hidden", "Impressões", "prints", "#", "_blank", "print_btn"); $params = array("includeForm" => $buttonInclude, "print_btn" => $buttonPrint); $this->_form->createFormToolbar(true, true, $params, true); $this->_form->setValues($arrayPopulateForm); $this->_form->addElementsForm(); $this->view->form = $this->_form; }
public function __updateSession() { Zend_Loader::loadClass('UserModel'); $model = new UserModel(); if ($this->_user) { $user = $model->fetchRow("user_id= " . $this->_user->user_id)->toArray(); unset($user['password']); $std_user = new stdClass(); foreach ($user as $key => $value) { $std_user->{$key} = $value; } $auth = Zend_Auth::getInstance(); $auth->getStorage()->write($std_user); $this->_user = $std_user; } }
public function myactivityAction() { $usertable = new UserModel(); $db1 = $usertable->getAdapter(); $uid = $_SESSION["userinfo"][0][id]; $user = $usertable->fetchRow($db1->quoteInto('id=?', $uid))->toArray(); $table = new User_ActivityModel(); $db2 = $table->getAdapter(); $activitytable = new ActivityModel(); $db3 = $activitytable->getAdapter(); //$where = $db2->quoteInto('userid = ? ', $uid); //$flag0 = count($table->fetchAll($where) ->toArray()) ; $result = $db3->query('SELECT activity.* FROM activity,userconactivity WHERE activity.id = userconactivity.activityid and userconactivity.userid =? order by activity.begin desc', $uid)->fetchAll(); $this->view->result = $result; $this->view->type = $user['type']; }
public function myreplyAction() { $page = $this->getRequest()->getParam('page'); $account = $_COOKIE["account"]; $usertable = new UserModel(); $db1 = $usertable->getAdapter(); $answertable = new AnswerModel(); $db3 = $answertable->getAdapter(); //查找当前用户ID $result = $usertable->fetchRow($db1->quoteInto('email = ?', $account))->toArray(); $uid = $result['id']; $num = $db3->query('SELECT COUNT(*) as num FROM answer,User WHERE answer.userid = User.id and User.id =? order by time desc', $uid)->fetchAll()[0][num]; $pages = ceil($num / 3); if ($page == "") { $page = 0; } if ($page < 3) { if ($pages > 3) { $set = array(1, 2, 3, 4); } else { $set = array(); for ($i = 1; $i <= $pages; $i++) { $set[] = $i; } } } else { if ($page >= 3) { if ($page + 3 <= $pages) { $set = array($page, $page + 1, $page + 2, $page + 3); } else { $set = array(); for ($i = $page; $i <= $pages; $i++) { $set[] = $i; } } } } $count = 6; $offset = $page * 6; $select = $db3->select(); $select->from('answer', '*'); $select->join('question', 'answer.questionid=question.id', '*'); $select->where('answer.userid=?', 7)->limit($count, $offset); $sql = $select->__toString(); $questions = $db3->fetchAll($sql); // print_r($questions); /* $where = $db3->quoteInto('userid = ?', 7); $order = 'begin by time desc'; $count = 6; $offset =$page*6; $questions = $answertable->fetchAll($where, $order, $count, $offset)->toArray(); */ $this->view->results = $questions; $this->view->user = $result; $this->view->page = $page; $this->view->count = $set; }