Exemplo n.º 1
0
 /**
  *  form to edit userpic
  */
 public function action_profile_edit_userpic()
 {
     // get id
     #$user_id = $this->request->getParameter('id');
     $user_id = 2;
     // fetch userdata
     $data = Doctrine::getTable('CsUsers')->fetchSingleUserData($user_id);
     // Create a new form
     // @todo form object with auto-population of values
     $form = new Clansuite_Form('userpic_form', 'post', '/account&sub=profile&action=update&type=edituserpic');
     /**
      * user_id as hidden field
      */
     $form->addElement('hidden')->setName('userpic_form[user_id]')->setValue($data['user_id']);
     // Assign some formlements
     $form->addDecorator('fieldset')->setLegend('Edit your User-Picture');
     $form->addGroup('userpic');
     $form->addElement('jquploadify')->addToGroup('userpic')->setName('userpic_form[userpic]')->setLabel(_('Upload your User-Picture:'))->setDescription('max. 150x150px and max 1Mb');
     $form->addElement('submitbutton')->setValue('Submit');
     $form->addElement('resetbutton')->setValue('Reset');
     $form->addElement('cancelbutton');
     // Debugging Form Object
     #Clansuite_Debug::printR($form);
     // Debugging Form HTML Output
     #Clansuite_Debug::printR($form->render());
     // assign the html of the form to the view
     $this->getView()->assign('form', $form->render());
     $this->display();
 }