public function getUserParam($nId) { $oModelUser = new Admin_Model_User(); $oRow = $this->find($nId)->current(); if ($oRow instanceof Zend_Db_Table_Row_Abstract) { $aRow = $oModelUser->findUser($oRow->user_id); return $aRow; } return null; }
public function __construct($options = null) { $this->_oAuth = AppCms2_Controller_Plugin_ModuleAuth::getInstance(); $oModelUser = new Admin_Model_User(); $oModelUserCategory = new Admin_Model_UserCategory(); if ($this->_oAuth->hasIdentity()) { $this->_aUser = $oModelUser->findUser($this->_oAuth->getStorage()->read()->user_id); } $oChatUserRecipients = $oModelUser->findAskOnline(); if (isset($oChatUserRecipients)) { foreach ($oChatUserRecipients as $oRow) { $aUserParam = $oModelUser->findUser($oRow->id); $this->_aChatUserRecipients[$oRow->id] = trim($aUserParam["first_name"] . " " . $aUserParam["last_name"]); } } $oAllCategory = $oModelUserCategory->getAll(); if (isset($oAllCategory)) { foreach ($oAllCategory as $oRow) { $this->_aCategory[$oRow->id] = trim($oRow->name); } } parent::__construct($options); }
public function ordernumberAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->getHelper("layout")->disableLayout(); $oMail = new AppCms2_Controller_Plugin_Mail(); if ($this->_request->isPost()) { $aPostData = $this->_request->getPost(); $sHash = md5($aPostData["merchant_id"] . $aPostData["amount"] . $aPostData["descr"] . $aPostData["order_id"] . $aPostData["product_id"] . $aPostData["user_id"] . $aPostData["url"] . $aPostData["restricted"] . $aPostData["time"] . $this->_sAuthKey2); if ($sHash === $aPostData["hash"]) { $oModelVOrderJournal = new Borrower_Model_VOrderJournal(); $oModelOrderCart = new Borrower_Model_OrderCart(); $oModelOrderJournalOrderCart = new Borrower_Model_OrderJournalOrderCart(); $oModelOrderPayment = new User_Model_OrderPayment(); $oModelOrderPaymentHistory = new User_Model_OrderPaymentHistory(); $oModelOrderJournal = new User_Model_OrderJournal(); $oGenereteSessionId = new AppCms2_GenereteSessionId(); $oModelUser = new Admin_Model_User(); $oDb = Zend_Db_Table::getDefaultAdapter(); try { $oDb->beginTransaction(); $nUserId = (int) $aPostData["user_id"]; $nAmount = (int) $aPostData["amount"]; $oUserOrderJournal = $oModelVOrderJournal->getUserOrderJournal($nUserId); $nOrderCartId = $oModelOrderCart->getOrderCartId($nUserId); //pobiera id koszyka użytkownika foreach ($oUserOrderJournal as $oValue) { //sprawdza czy na pewno wszystkie zamówienia znajdują się w koszyku $bIsExists = $oModelOrderJournalOrderCart->findOrderJournal($oValue->id, $nOrderCartId); if (!$bIsExists) { $oModelOrderJournalOrderCart->addOrderJournalOrderCart(array("order_journal_id" => $oValue->id, "order_cart_id" => $nOrderCartId)); } } $oCart = $oModelOrderJournalOrderCart->getCartJournals($nOrderCartId); //pobiera id czasopism znajdujących się w koszyku $nCartCount = $oCart->count(); foreach ($oCart as $oValue) { $sPaymentDescr .= $oValue->order_journal_id; if ($nCartCount > 1) { $sPaymentDescr .= "; "; } } $sPaymentDescr = trim($sPaymentDescr); $aUserParam = $oModelUser->findUser($nUserId); $aPaymentParam = $oGenereteSessionId->generatePaymentParam(); $aPaymentParam["user_id"] = $nUserId; $aPaymentParam["amount"] = $nAmount; $aPaymentParam["descr"] = "Zamówienie nr " . $sPaymentDescr; $aPaymentParam["first_name"] = $aUserParam["first_name"]; $aPaymentParam["last_name"] = $aUserParam["last_name"]; $aPaymentParam["email_address"] = $aUserParam["email_address"]; $aPaymentParam["is_starting"] = 1; $aPaymentParam["date_is_starting"] = time(); $aPaymentParam["payment_type"] = 2; $nOrderPaymentId = $oModelOrderPayment->addRow($aPaymentParam); //tworzy nowy rekord w tabeli płatności i zwraca jego id $oModelOrderJournal->setOrderPaymentId($oCart, $nOrderPaymentId); //łączy czasopismo z płatnością $oModelOrderPaymentHistory->setOrderPaymentHistory($oCart, $nOrderPaymentId); //dodaje informacje do tabeli z historią płatności echo $nOrderPaymentId; $oDb->commit(); } catch (Zend_Exception $e) { $oDb->rollBack(); } } } exit; }
private function setUserParam() { $oModelUser = new Admin_Model_User(); $this->_aUserParam = $oModelUser->findUser($this->_nUserId); }