Ejemplo n.º 1
0
 public function edit($nNavigationMenuId, $aData)
 {
     $oModelNavigationResource = new Admin_Model_NavigationResource();
     $oModelNavigationOption = new Admin_Model_NavigationOption();
     $oGenereteSessionId = new AppCms2_GenereteSessionId();
     try {
         $this->_db->beginTransaction();
         $oRow = $this->find($nNavigationMenuId)->current();
         if ($oRow instanceof Zend_Db_Table_Row_Abstract) {
             $oRow->label = $aData["label"];
             $oRow->desc = $aData["desc"];
             $oRow->image_id = $aData["image_id"];
             $oRow->visible = $aData["visible"];
             if ($oRow->save()) {
                 $aGenereteSessionId = $oGenereteSessionId->generatePassword();
                 $sNavigationResource = "menu_resource_{$aData["navigation_module_id"]}_{$aData["navigation_controller_id"]}_{$aData["navigation_action_id"]}_{$aGenereteSessionId["user_password"]}";
                 $nNavigationResourceId = $oModelNavigationResource->add($sNavigationResource);
                 if (isset($nNavigationResourceId)) {
                     $aData["navigation_resource_id"] = $nNavigationResourceId;
                     $nNavigationOptionId = $oRow->navigation_option_id;
                     if ($oModelNavigationOption->edit($nNavigationOptionId, $aData)) {
                         $this->_db->commit();
                         return $nNavigationOptionId;
                     }
                 }
             }
         }
         $this->_db->rollBack();
         return null;
     } catch (Zend_Exception $e) {
         $this->_db->rollBack();
         return null;
     }
 }
Ejemplo n.º 2
0
 public function passwordremindAction()
 {
     $this->_helper->layout()->setLayout("borrower/layout_login");
     $oModelUser = new Admin_Model_User();
     $oModelVUser = new Admin_Model_VUser();
     $oModelUserNewPassword = new Admin_Model_UserNewPassword();
     $oFormPasswordRemind = new Admin_Form_PasswordRemind();
     $oGenereteSessionId = new AppCms2_GenereteSessionId();
     $aPostData = array();
     $sSuccess = "";
     if ($this->_request->isPost()) {
         $aPostData = $this->_request->getPost();
         if ($oFormPasswordRemind->isValid($aPostData)) {
             $sEmailAddress = $oFormPasswordRemind->getValue("user_email_address");
             $nUserId = $oModelUser->findUserByEmailAddress($sEmailAddress);
             if (is_numeric($nUserId)) {
                 $aParam = $oModelVUser->getUserParam($nUserId)->toArray();
                 $aParam["salt"] = $oModelUser->getUserSalt($nUserId);
                 $aParam = array_merge($aParam, $oGenereteSessionId->generatePassword($aParam["salt"]));
                 if ($oModelUserNewPassword->addPassword($nUserId, $aParam)) {
                     $sEmailAddress = $oModelUser->findEmailAddress($nUserId);
                     $oMail = new AppCms2_Controller_Plugin_Mail();
                     $oMail->sendNewPassword($sEmailAddress, $aParam);
                     $sSuccess = "OK";
                 } else {
                     $sSuccess = "NO OK";
                 }
             } else {
                 $sSuccess = "USER";
             }
         }
     }
     $this->view->oFormPasswordRemind = $oFormPasswordRemind;
     $this->view->sSuccess = $sSuccess;
 }