Exemple #1
0
 public function __construct()
 {
     parent::__construct('addPhotoForm');
     $language = OW::getLanguage();
     // album suggest Field
     $albumField = new SuggestField('album');
     $albumField->setRequired(true);
     $albumField->setMinChars(1);
     $userId = OW::getUser()->getId();
     $responderUrl = OW::getRouter()->urlFor('PHOTO_CTRL_Upload', 'suggestAlbum', array('userId' => $userId));
     $albumField->setResponderUrl($responderUrl);
     $albumField->setLabel($language->text('photo', 'album'));
     $albumField->setId('ynmediaimporter_album_suggest');
     $this->addElement($albumField);
     // json hidden field
     $dataField = new HiddenField('json_data');
     $dataField->setId("ynmediaimporter_json_data");
     $this->addElement($dataField);
     $submit = new Submit('submit');
     $submit->setValue("Continue");
     $this->addElement($submit);
     $this->setAction(OW::getRouter()->urlForRoute("ynmediaimporter.addphoto"));
 }
 public function __construct(BOL_AuthorizationRole $role)
 {
     parent::__construct('edit-role-form');
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Users', 'ajaxEditRole'));
     $roleId = new HiddenField('roleId');
     $roleId->setValue($role->id);
     $this->addElement($roleId);
     $displayLabel = new CheckboxField('displayLabel');
     $displayLabel->setValue($role->displayLabel);
     $this->addElement($displayLabel);
     $color = new HiddenField('labelColor');
     $color->setValue(!empty($role->custom) ? $role->custom : '#999999');
     $color->setId('label-color-field');
     $this->addElement($color);
     $submit = new Submit('save');
     $this->addElement($submit);
     $js = 'owForms["' . $this->getName() . '"].bind("success", function(data){
         if ( data.error != undefined ){
             OW.error(data.error);
         }
         if ( data.message != undefined ){
             OW.info(data.message);
         }
         document.location.reload();
     });';
     OW::getDocument()->addOnloadScript($js);
 }