public function viewAction() { if (Zend_Auth::getInstance()->getIdentity()) $role = Zend_Auth::getInstance()->getIdentity()->status; $acl = new App_Acl(); if (!$acl->isAllowed($role, App_Resources::VIEW)) $this->getHelper('Redirector')->gotoSimpleAndExit('index', 'error', ''); $this->view->title = "HNA - Просмотр пользователя"; $this->view->headTitle($this->view->title); if ($this->getRequest()->isGet()) { $user_id = $this->_getParam('user_id'); $user = new Application_Model_DbTable_Hna(); $userinfo = $user->getUser($user_id); $this->view->user = $userinfo; $pay = new Application_Model_DbTable_Pays(); $userpay = $pay->getUserPays($user_id); $this->view->pay = $userpay; $log = new Application_Model_DbTable_Logs(); $userlog = $log->getUserLog($user_id); $admin = new Application_Model_DbTable_Admin(); $admins = $admin->getAdmins(); foreach ($admins as $key => $value) { $admin_list[$value['admin_id']] = $value['login']; } $this->view->admin = $admin_list; $this->view->log = $userlog; } }
public function getuserinfoAction() { if(Zend_Auth::getInstance()->getIdentity()) $role = Zend_Auth::getInstance()->getIdentity()->status; $acl = new App_Acl(); if(!$acl->isAllowed($role, App_Resources::PAYSUSERINFO)) $this->getHelper('Redirector')->gotoSimpleAndExit('index', 'error', ''); $this->_helper->viewRenderer->setNoRender (); $this->_helper->getHelper('layout')->disableLayout (); if ($this->getRequest()->isPost()) { $contract = $this->_getParam('login'); $userinfo = new Application_Model_DbTable_Hna(); $info = $userinfo->getUserInfo($contract); $userpays = new Application_Model_DbTable_Pays(); $pays = $userpays->getUserPays($info['user_id']); if($info['user_id']) { echo "{ 'user_id' : '" . $info['user_id'] . "'," . " 'surname' : '" . $info['surname'] . "'," . " 'firstname' : '" . $info['firstname'] . "'," . " 'lastname' : '" . $info['lastname'] . "'," . " 'connect' : " . $pays['connect'] . "," . " 'm1' : " . $pays['1'] . "," . " 'm2' : " . $pays['2'] . "," . " 'm3' : " . $pays['3'] . "," . " 'm4' : " . $pays['4'] . "," . " 'm5' : " . $pays['5'] . "," . " 'm6' : " . $pays['6'] . "," . " 'm7' : " . $pays['7'] . "," . " 'm8' : " . $pays['8'] . "," . " 'm9' : " . $pays['9'] . "," . " 'm10' : " . $pays['10'] . "," . " 'm11' : " . $pays['11'] . "," . " 'm12' : " . $pays['12'] . " }"; } else { echo "{ 'user_id' : '-1'}"; } } }
public function addPay($login,$connect,$m9,$m10,$m11,$m12,$m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8){ $login = $login; $modelid = new Application_Model_DbTable_Hna(); $id = $modelid->getUserId($login); $data = array( 'connect'=> (int)$connect, '9' => (int)$m9, '10' => (int)$m10, '11' => (int)$m11, '12' => (int)$m12, '1' => (int)$m1, '2' => (int)$m2, '3' => (int)$m3, '4' => (int)$m4, '5' => (int)$m5, '6' => (int)$m6, '7' => (int)$m7, '8' => (int)$m8, ); if ($id) { $modelpay = new Application_Model_DbTable_Pays(); $pays = $modelpay->getUserPays($id); $message = 'Добавлена оплата за:'; foreach ($pays as $key => $value) { if ( $value == 1 ){ $data[$key] = 1; } else { if($data[$key] == 1){ switch ($key){ case 'connect': $message .= ' подключение,'; break; case '9': $message .= ' сентябрь,'; break; case '10': $message .= ' октябрь,'; break; case '11': $message .= ' ноябрь,'; break; case '12': $message .= ' декабрь,'; break; case '1': $message .= ' январь,'; break; case '2': $message .= ' февраль,'; break; case '3': $message .= ' март,'; break; case '4': $message .= ' апрель,'; break; case '5': $message .= ' май,'; break; case '6': $message .= ' июнь,'; break; case '7': $message .= ' июль,'; break; case '8': $message .= ' август,'; break; } } } } $message = substr($message, 0, strlen($message)-1); $this->update($data, 'user_id=' . (int)$id); $userlog = new Application_Model_DbTable_Logs(); $userlog->addMessage((int)$id, Zend_Auth::getInstance()->getIdentity()->admin_id , 3, $message); } }