Exemple #1
0
 public function testUpdate()
 {
     $table = new Application_Model_DbTable_Users();
     $users = $table->find(1);
     $user = $users->current();
     Zend_Debug::dump($user);
     $this->assertSame($user->username, 'admin');
     $this->assertSame($user->id, '1');
     $list = $user->toArray();
     Zend_Debug::dump($list);
 }
Exemple #2
0
 public function editAction()
 {
     $form = new Application_Form_User();
     $form->envoyer->setLabel('Modifier');
     $this->view->form = $form;
     $id = $this->_getParam('id', 0);
     $users = new Application_Model_DbTable_Users();
     $user = $users->find($id)->current();
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             $user->username = $form->getValue('username');
             $user->password = $form->getValue('password');
             $user->role = $form->getValue('role');
             $user->token = $form->getValue('token');
             $user->save();
             /* Traitemeent supplémentaire */
             /* Transfert du WSDL > le répertoire client */
             /* maj de la base */
             // TODO A clarifier quels est la meilheur méthode pour réaliser l'upload
             $fullFilePath = $form->wsdl->getFileName();
             $uploadedData = $form->getValues();
             //Zend_Debug::dump( $form->getValues(), '$uploadedData');
             //Zend_Debug::dump($fullFilePath, '$fullFilePath');
             if ($form->wsdl->re) {
                 $this->_helper->redirector('index');
             }
         } else {
             $form->populate($formData);
         }
     } else {
         if ($id > 0) {
             $form->populate($user->toArray());
         }
     }
 }