Ejemplo n.º 1
0
 public function init()
 {
     $this->setTitle('Compose Message');
     $this->setDescription('Create your new message with the form below. Your message can be addressed to up to 10 recipients.')->setAttrib('id', 'messages_compose');
     $user_level = Engine_Api::_()->user()->getViewer()->level_id;
     // init to
     $this->addElement('Text', 'to', array('label' => 'Send To', 'autocomplete' => 'off'));
     Engine_Form::addDefaultDecorators($this->to);
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('label' => 'Send To', 'required' => true, 'allowEmpty' => false, 'order' => 2, 'validators' => array('NotEmpty'), 'filters' => array('HtmlEntities')));
     Engine_Form::addDefaultDecorators($this->toValues);
     // init title
     $this->addElement('Text', 'title', array('label' => 'Subject', 'order' => 3, 'filters' => array(new Engine_Filter_Censor(), new Engine_Filter_HtmlSpecialChars())));
     // init body - editor
     $editor = Engine_Api::_()->getDbtable('permissions', 'authorization')->getAllowed('messages', $user_level, 'editor');
     if ($editor == 'editor') {
         $editorOptions = array('bbcode' => true, 'html' => true);
         if (Engine_Api::_()->authorization()->isAllowed('album', $user, 'create')) {
             $upload_url = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('action' => 'upload-photo'), 'messages_general', true);
         }
         if (!empty($upload_url)) {
             $editorOptions['upload_url'] = $upload_url;
             $editorOptions['plugins'] = array('table', 'fullscreen', 'media', 'preview', 'paste', 'code', 'image', 'textcolor', 'jbimages', 'link');
             $editorOptions['toolbar1'] = array('undo', 'redo', 'removeformat', 'pastetext', '|', 'code', 'media', 'image', 'jbimages', 'link', 'fullscreen', 'preview');
         }
         $this->addElement('TinyMce', 'body', array('disableLoadDefaultDecorators' => true, 'order' => 4, 'required' => true, 'editorOptions' => $editorOptions, 'allowEmpty' => false, 'decorators' => array('ViewHelper', 'Label', array('HtmlTag', array('style' => 'display: block;'))), 'filters' => array(new Engine_Filter_HtmlSpecialChars(), new Engine_Filter_Censor())));
     } else {
         // init body - plain text
         $this->addElement('Textarea', 'body', array('label' => 'Message', 'order' => 4, 'required' => true, 'allowEmpty' => false, 'filters' => array(new Engine_Filter_HtmlSpecialChars(), new Engine_Filter_Censor(), new Engine_Filter_EnableLinks())));
     }
     // init submit
     $this->addElement('Button', 'submit', array('label' => 'Send Message', 'order' => 5, 'type' => 'submit', 'ignore' => true));
 }
Ejemplo n.º 2
0
 public function init()
 {
     $this->setTitle('Compose Message');
     $this->setDescription('Create your new message with the form below. Your message can be addressed to up to 10 recipients.')->setAttrib('id', 'notice_compose');
     $user_level = Engine_Api::_()->user()->getViewer()->level_id;
     // init to
     $this->addElement('Text', 'to', array('label' => 'Send To', 'autocomplete' => 'off'));
     Engine_Form::addDefaultDecorators($this->to);
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('label' => 'Send To', 'required' => true, 'allowEmpty' => false, 'order' => 2, 'validators' => array('NotEmpty'), 'filters' => array('HtmlEntities')));
     Engine_Form::addDefaultDecorators($this->toValues);
     // init title
     $this->addElement('Text', 'title', array('label' => 'Subject', 'order' => 4, 'filters' => array(new Engine_Filter_Censor(), new Engine_Filter_HtmlSpecialChars())));
     // init body - editor
     $editor = Engine_Api::_()->getDbtable('permissions', 'authorization')->getAllowed('messages', $user_level, 'editor');
     if ($editor == 'editor') {
         $this->addElement('TinyMce', 'body', array('disableLoadDefaultDecorators' => true, 'order' => 5, 'required' => true, 'editorOptions' => array('bbcode' => true, 'html' => true), 'allowEmpty' => false, 'decorators' => array('ViewHelper', 'Label', array('HtmlTag', array('style' => 'display: block;'))), 'filters' => array(new Engine_Filter_HtmlSpecialChars(), new Engine_Filter_Censor(), new Engine_Filter_EnableLinks())));
     } else {
         // init body - plain text
         $this->addElement('Textarea', 'body', array('label' => 'Message', 'order' => 5, 'required' => true, 'allowEmpty' => false, 'filters' => array(new Engine_Filter_HtmlSpecialChars(), new Engine_Filter_Censor(), new Engine_Filter_EnableLinks())));
     }
     $this->addAdditionalElements();
     $this->loadDefaultDecorators();
     $this->getDecorator('Description')->setOption('escape', false);
     // init submit
     $this->addElement('Button', 'submit', array('label' => 'Send Message', 'order' => 7, 'type' => 'submit', 'ignore' => true));
 }
Ejemplo n.º 3
0
Archivo: Ad.php Proyecto: robeendey/ce
 public function init()
 {
     // Set form attributes
     $this->setTitle('Create Advertisement');
     $this->setDescription('Follow this guide to design and create a new advertisement.');
     $this->setAttrib('id', 'form-upload');
     $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     // Title
     $this->addElement('Text', 'name', array('label' => 'Advertisement Name', 'allowEmpty' => false, 'required' => true, 'validators' => array(array('NotEmpty', true), array('StringLength', false, array(1, 64))), 'filters' => array('StripTags', new Engine_Filter_Censor(), new Engine_Filter_EnableLinks())));
     $this->addElement('Radio', 'media_type', array('id' => 'mediatype', 'label' => 'Advertisement Media', 'onchange' => "updateTextFields(this)", 'multiOptions' => array("0" => "Upload Banner Image", "1" => "Insert Banner HTML"), 'description' => 'CORE_FORM_ADMIN_ADS_AD_MEDIATYPE_DESCRIPTION'));
     //    $this->media->getDecorator('Description')->setOption('placement', 'append');
     // Init file
     $fancyUpload = new Engine_Form_Element_FancyUpload('file');
     $fancyUpload->clearDecorators()->addDecorator('FormFancyUpload')->addDecorator('viewScript', array('viewScript' => '_FancyUpload.tpl', 'placement' => ''));
     Engine_Form::addDefaultDecorators($fancyUpload);
     $fancyUpload->setLabel("Upload Banner Image");
     $this->addElement($fancyUpload);
     $this->addElement('Hidden', 'photo_id');
     $this->addDisplayGroup(array('file'), 'upload_image');
     $upload_image_group = $this->getDisplayGroup('upload_image');
     $this->addElement('Textarea', 'html_code', array('label' => 'HTML Code'));
     // Buttons
     $this->addElement('Button', 'preview_html', array('label' => 'Preview', 'ignore' => true, 'onclick' => 'javascript:preview();', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('html_code', 'preview_html'), 'html_field');
     $html_code_group = $this->getDisplayGroup('html_code');
     // init submit
     $this->addElement('Button', 'submit', array('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true));
 }
Ejemplo n.º 4
0
 public function init()
 {
     $this->setAttrib('enctype', 'multipart/form-data')->setAttrib('name', 'EditPhoto');
     $this->addElement('Image', 'current', array('label' => 'Current Photo', 'ignore' => true, 'decorators' => array(array('ViewScript', array('viewScript' => '_formEditImage.tpl', 'class' => 'form element', 'testing' => 'testing')))));
     Engine_Form::addDefaultDecorators($this->current);
     $this->addElement('File', 'Filedata', array('label' => 'Choose New Photo', 'destination' => APPLICATION_PATH . '/public/temporary/', 'multiFile' => 1, 'validators' => array(array('Count', false, 1), array('Extension', false, 'jpg,jpeg,png,gif')), 'onchange' => 'javascript:uploadSignupPhoto();'));
     $this->addElement('Hidden', 'coordinates', array('filters' => array('HtmlEntities')));
     $this->addElement('Button', 'done', array('label' => 'Save Photo', 'type' => 'submit'));
 }
Ejemplo n.º 5
0
 public function init()
 {
     $this->setAttrib('enctype', 'multipart/form-data')->setAttrib('name', 'CropPhoto');
     $this->addElement('Image', 'current', array('label' => 'Main Photo', 'ignore' => true, 'decorators' => array(array('ViewScript', array('viewScript' => '_formCropImage.tpl', 'class' => 'form element', 'testing' => 'testing')))));
     Engine_Form::addDefaultDecorators($this->current);
     $this->addElement('Hidden', 'coordinates', array('filters' => array('HtmlEntities')));
     $this->addElement('Button', 'done', array('label' => 'Save Photo', 'type' => 'submit', 'onsubmit' => 'lassoEnd()', 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'href' => 'javascript:void(0)', 'onclick' => 'parent.Smoothbox.close()', 'class' => 'smoothbox', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('done', 'cancel'), 'buttons');
 }
Ejemplo n.º 6
0
 /**
  * Load default decorators
  *
  * @return void
  */
 public function loadDefaultDecorators()
 {
     if ($this->loadDefaultDecoratorsIsDisabled()) {
         return;
     }
     $decorators = $this->getDecorators();
     if (empty($decorators)) {
         Engine_Form::addDefaultDecorators($this);
     }
 }
Ejemplo n.º 7
0
 public function init()
 {
     $view = Zend_Registry::get('Zend_View');
     $settings = Engine_Api::_()->getApi('settings', 'core');
     $viewer = Engine_Api::_()->user()->getViewer();
     $this->setTitle('Edit Feedback');
     //Category
     $this->addElement('Select', 'category_id', array('required' => true, 'allowEmpty' => false, 'label' => '*Category'));
     //Custom field
     $customFields = new Ynfeedback_Form_Feedback_Fields(array_merge(array('item' => $this->_item), $this->_formArgs));
     $this->addSubForms(array('fields' => $customFields));
     //Business name
     $this->addElement('Text', 'title', array('label' => '*Feedback', 'allowEmpty' => false, 'required' => true, 'validators' => array(array('NotEmpty', true), array('StringLength', false, array(1, 100))), 'filters' => array('StripTags', new Engine_Filter_Censor())));
     //description
     $this->addElement('Textarea', 'description', array('label' => '*Description', 'allowEmpty' => false, 'required' => true, 'filters' => array(), 'validators' => array(array('NotEmpty', true))));
     //Co-authors
     $this->addElement('Text', 'to', array('label' => 'Co-authors', 'autocomplete' => 'off'));
     Engine_Form::addDefaultDecorators($this->to);
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('style' => 'margin-top:-5px', 'order' => 5, 'filters' => array('HtmlEntities')));
     Engine_Form::addDefaultDecorators($this->toValues);
     //Severity
     $this->addElement('Select', 'severity', array('required' => true, 'allowEmpty' => false, 'label' => 'Severity'));
     $tableSeverity = Engine_Api::_()->getDbTable('severities', 'ynfeedback');
     $this->severity->addMultiOptions($tableSeverity->getSeverityArray());
     // Privacy
     $viewOptions = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('ynfeedback_idea', $viewer, 'auth_view');
     $commentOptions = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('ynfeedback_idea', $viewer, 'auth_comment');
     $availableLabels = array('everyone' => $view->translate('Everyone'), 'owner_network' => $view->translate('Friends and Networks'), 'owner_member_member' => $view->translate('Friends of Friends'), 'owner_member' => $view->translate('Friends Only'), 'owner' => $view->translate('Just Me'));
     $viewOptions = array_intersect_key($availableLabels, array_flip($viewOptions));
     $commentOptions = array_intersect_key($availableLabels, array_flip($commentOptions));
     // View
     if (!empty($viewOptions) && count($viewOptions) >= 1) {
         // Make a hidden field
         if (count($viewOptions) == 1) {
             $this->addElement('hidden', 'auth_view', array('value' => key($viewOptions)));
             // Make select box
         } else {
             $this->addElement('Select', 'auth_view', array('label' => 'Privacy', 'multiOptions' => $viewOptions, 'value' => key($viewOptions)));
         }
     }
     // Comment
     if (!empty($commentOptions) && count($commentOptions) >= 1) {
         // Make a hidden field
         if (count($commentOptions) == 1) {
             $this->addElement('hidden', 'auth_comment', array('value' => key($commentOptions)));
             // Make select box
         } else {
             $this->addElement('Select', 'auth_comment', array('label' => 'Comment Privacy', 'multiOptions' => $commentOptions, 'value' => key($commentOptions)));
         }
     }
     $this->addElement('Button', 'submit_button', array('value' => 'submit_button', 'label' => 'Save Changes', 'onclick' => 'removeSubmit()', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'Cancel', 'link' => true, 'prependText' => ' or ', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit_button', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper')));
 }
Ejemplo n.º 8
0
 /**
  * Load default decorators
  *
  * @return void
  */
 public function loadDefaultDecorators()
 {
     if ($this->loadDefaultDecoratorsIsDisabled()) {
         return;
     }
     $decorators = $this->getDecorators();
     if (empty($decorators)) {
         $this->addDecorator('Tooltip')->addDecorator('Image');
         Engine_Form::addDefaultDecorators($this);
     }
 }
Ejemplo n.º 9
0
 public function init()
 {
     $this->setAttrib('enctype', 'multipart/form-data')->setAttrib('name', 'EditPhoto');
     $this->addElement('Image', 'current', array('label' => 'Current Photo', 'ignore' => true, 'decorators' => array(array('ViewScript', array('viewScript' => '_formEditImage.tpl', 'class' => 'form element', 'testing' => 'testing')))));
     Engine_Form::addDefaultDecorators($this->current);
     $this->addElement('File', 'Filedata', array('label' => 'Choose New Photo', 'destination' => APPLICATION_PATH . '/public/temporary/', 'multiFile' => 1, 'validators' => array(array('Count', false, 1), array('Extension', false, 'jpg,jpeg,png,gif')), 'onchange' => 'javascript:uploadSignupPhoto();'));
     $this->addElement('Hidden', 'coordinates', array('filters' => array('HtmlEntities')));
     $this->addElement('Button', 'done', array('label' => 'Save Photo', 'type' => 'submit', 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'remove', array('label' => 'remove photo', 'link' => true, 'prependText' => ' or ', 'href' => Zend_Controller_Front::getInstance()->getRouter()->assemble(array('action' => 'remove-photo')), 'onclick' => null, 'class' => 'smoothbox', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('done', 'remove'), 'buttons');
 }
Ejemplo n.º 10
0
 public function init()
 {
     $auth = Engine_Api::_()->authorization()->context;
     $user = $this->getItem();
     $this->setTitle('Privacy Settings')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     // Init blocklist
     $this->addElement('Hidden', 'blockList', array('label' => 'Blocked Members', 'description' => 'Adding a person to your block list makes your profile (and all of your other content) unviewable to them. Any connections you have to the blocked person will be canceled.', 'order' => -1));
     Engine_Form::addDefaultDecorators($this->blockList);
     // Init search
     $this->addElement('Checkbox', 'search', array('label' => 'Do not display me in searches, browsing members, or the "Online Members" list.', 'checkedValue' => 0, 'uncheckedValue' => 1));
     $availableLabels = array('owner' => 'Only Me', 'member' => 'Only My Followers', 'network' => 'Followers & Networks', 'registered' => 'All Registered Members', 'everyone' => 'Everyone');
     // Init profile view
     $view_options = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('user', $user, 'auth_view');
     $view_options = array_intersect_key($availableLabels, array_flip($view_options));
     $this->addElement('Radio', 'privacy', array('label' => 'Profile Privacy', 'description' => 'Who can view your profile?', 'multiOptions' => $view_options));
     foreach ($this->_roles as $role) {
         if (1 === $auth->isAllowed($user, $role, 'view')) {
             $this->privacy->setValue($role);
         }
     }
     $availableLabelsComment = array('owner' => 'Only Me', 'member' => 'Only My Followers', 'network' => 'Followers & Networks', 'registered' => 'All Registered Members');
     // Init profile comment
     $comment_options = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('user', $user, 'auth_comment');
     $comment_options = array_intersect_key($availableLabelsComment, array_flip($comment_options));
     $this->addElement('Radio', 'comment', array('label' => 'Profile Posting Privacy', 'description' => 'Who can post on your profile?', 'multiOptions' => $comment_options));
     foreach ($this->_roles as $role) {
         if (1 === $auth->isAllowed($user, $role, 'comment')) {
             $this->comment->setValue($role);
         }
     }
     $this->addElement('Radio', 'private_contact', array('label' => 'Private Contact Information', 'description' => 'Who can view my private contact information?', 'multiOptions' => array(0 => 'Everyone', 1 => 'Followers & Professionals', 2 => 'Professionals Only')));
     $availableLabels = array('owner' => 'Only Me', 'member' => 'Only My Followers', 'network' => 'Followers & Networks', 'registered' => 'All Registered Members');
     // Init profile view
     $get_notification_options = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('ynmember_user', $user, 'auth_get_notification');
     $get_notification_options = array_intersect_key($availableLabels, array_flip($get_notification_options));
     $this->addElement('Radio', 'get_notification_privacy', array('label' => 'Get Notification Privacy', 'description' => 'Who can get notification for some of my action? Actions: Create new items. 
                     Join/attend Club/Event. 
                     All actions on members (follow/rate member, etc...). 
                     Like/comment an item.', 'multiOptions' => $get_notification_options));
     foreach ($this->_roles as $role) {
         if (1 === $auth->isAllowed($user, $role, 'get_notification')) {
             $this->get_notification_privacy->setValue($role);
         }
     }
     // Init publishtypes
     if (Engine_Api::_()->getApi('settings', 'core')->getSetting('activity.publish', true)) {
         $this->addElement('MultiCheckbox', 'publishTypes', array('label' => 'Recent Activity Privacy', 'description' => 'Which of the following things do you want to have published about you in the recent activity feed? Note that changing this setting will only affect future news feed items.'));
     }
     // Init submit
     $this->addElement('Button', 'submit', array('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true));
     return $this;
 }
Ejemplo n.º 11
0
 public function init()
 {
     $this->setTitle('Ask for Recommendations')->setDescription('Search member who will be asked for recommendations.')->setAttrib('class', 'global_form_popup');
     $this->addElement('Text', 'to', array('autocomplete' => 'off'));
     Engine_Form::addDefaultDecorators($this->to);
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('style' => 'margin-top:-5px', 'order' => 1, 'filters' => array('HtmlEntities')));
     Engine_Form::addDefaultDecorators($this->toValues);
     $this->addElement('Button', 'submit_btn', array('label' => 'Submit', 'type' => 'submit', 'order' => 3, 'ignore' => true, 'decorators' => array('ViewHelper')));
     $onclick = 'parent.Smoothbox.close();';
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'order' => 4, 'link' => true, 'prependText' => ' or ', 'onclick' => $onclick, 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit_btn', 'cancel'), 'buttons');
 }
Ejemplo n.º 12
0
 public function init()
 {
     $view = Zend_Registry::get('Zend_View');
     $description = $view->translate('Search sport which will be added as your sport. You can add up to %s sport(s).', 2 - $this->getCount());
     $this->setTitle('Add Sports')->setDescription($description)->setAttrib('class', 'global_form_popup');
     $this->addElement('Text', 'to', array('autocomplete' => 'off'));
     Engine_Form::addDefaultDecorators($this->to);
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('style' => 'margin-top:-5px', 'order' => 1, 'filters' => array('HtmlEntities')));
     Engine_Form::addDefaultDecorators($this->toValues);
     $this->addElement('Button', 'submit_btn', array('label' => 'Submit', 'type' => 'submit', 'order' => 3, 'ignore' => true, 'decorators' => array('ViewHelper')));
     $onclick = 'parent.Smoothbox.close();';
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'order' => 4, 'link' => true, 'prependText' => ' or ', 'onclick' => $onclick, 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit_btn', 'cancel'), 'buttons');
 }
Ejemplo n.º 13
0
 public function init()
 {
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('label' => 'Blog Title', 'style' => 'margin-top:-5px', 'order' => 0, 'validators' => array('NotEmpty'), 'filters' => array('HtmlEntities')));
     Engine_Form::addDefaultDecorators($this->toValues);
     $this->addElement('Text', 'to', array('label' => 'Blog Title', 'autocomplete' => 'off', 'order' => 1, 'required' => true, 'allowEmpty' => false, 'description' => 'Start typing a blog title to see a list of suggestions'));
     Engine_Form::addDefaultDecorators($this->to);
     $this->to->getDecorator("Description")->setOption("placement", "append");
     $this->to->setAttrib('required', true);
     $this->addElement('Dummy', 'import', array('decorators' => array(array('ViewScript', array('viewScript' => '_import.tpl', 'class' => 'form element')))));
     $this->addElement('Button', 'submit', array('label' => 'Import', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'href' => '', 'onclick' => 'parent.Smoothbox.close();', 'decorators' => array('ViewHelper')));
     // DisplayGroup: buttons
     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper')));
 }
Ejemplo n.º 14
0
 public function init()
 {
     $user = Engine_Api::_()->user()->getViewer();
     $this->setTitle('Create New Sponsor')->setAttrib('id', 'ynrespnosive_sponsor_create_form')->setAttrib('class', 'global_form_popup')->setMethod("POST")->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     $this->addElement('Text', 'to', array('autocomplete' => 'off', 'label' => 'Select an Existing Event as Reference'));
     Engine_Form::addDefaultDecorators($this->to);
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('label' => 'Select an Existing Event as Reference', 'required' => true, 'allowEmpty' => false, 'style' => 'margin-top:-5px', 'order' => 1, 'validators' => array('NotEmpty'), 'filters' => array('HtmlEntities')));
     Engine_Form::addDefaultDecorators($this->toValues);
     // Photo
     $this->addElement('File', 'photo', array('label' => 'Logo'));
     $this->photo->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     // Buttons
     $this->addElement('Button', 'submit', array('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => false, 'onClick' => 'javascript:parent.Smoothbox.close();', 'prependText' => ' or ', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper')));
 }
Ejemplo n.º 15
0
 public function init()
 {
     $this->setTitle('Compose Message');
     $this->setDescription('Create your new message with the form below. Your message can be addressed to up to 10 recipients.')->setAttrib('id', 'messages_compose');
     // init to
     $this->addElement('Text', 'to', array('label' => 'Send To', 'autocomplete' => 'off'));
     Engine_Form::addDefaultDecorators($this->to);
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('required' => true, 'allowEmpty' => false, 'order' => 2, 'validators' => array('NotEmpty'), 'filters' => array('HtmlEntities')));
     Engine_Form::addDefaultDecorators($this->toValues);
     // init title
     $this->addElement('Text', 'title', array('label' => 'Subject', 'order' => 3, 'filters' => array(new Engine_Filter_Censor(), new Engine_Filter_HtmlSpecialChars())));
     // init body
     $this->addElement('Textarea', 'body', array('label' => 'Message', 'order' => 4, 'required' => true, 'allowEmpty' => false, 'filters' => array(new Engine_Filter_HtmlSpecialChars(), new Engine_Filter_Censor(), new Engine_Filter_EnableLinks())));
     // init submit
     $this->addElement('Button', 'submit', array('label' => 'Send Message', 'order' => 5, 'type' => 'submit', 'ignore' => true));
 }
Ejemplo n.º 16
0
 public function init()
 {
     $this->setTitle('Event Owner Transfer')->setDescription('Please choose a member you want to transfer the owner role to:')->setAttrib('class', 'global_form_popup')->setMethod('post')->setAttrib('id', 'ynevent_transfer');
     $this->addElement('Text', 'to', array('autocomplete' => 'off'));
     Engine_Form::addDefaultDecorators($this->to);
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('label' => 'Member', 'required' => true, 'allowEmpty' => false, 'style' => 'margin-top:-5px', 'order' => 1, 'validators' => array('NotEmpty'), 'filters' => array('HtmlEntities')));
     Engine_Form::addDefaultDecorators($this->toValues);
     $this->addElement('Button', 'submit', array('label' => 'Submit', 'type' => 'submit', 'order' => 3, 'ignore' => true));
     $onclick = 'parent.Smoothbox.close();';
     $session = new Zend_Session_Namespace('mobile');
     if ($session->mobile) {
         $onclick = '';
     }
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'order' => 4, 'link' => true, 'prependText' => ' or ', 'onclick' => $onclick));
     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons');
 }
Ejemplo n.º 17
0
 public function init()
 {
     $this->setAttrib('enctype', 'multipart/form-data')->setAttrib('id', 'SignupForm');
     $this->addElement('Image', 'current', array('label' => 'Current Photo', 'ignore' => true, 'decorators' => array(array('ViewScript', array('viewScript' => '_formSignupImage.tpl', 'class' => 'form element')))));
     Engine_Form::addDefaultDecorators($this->current);
     $this->addElement('File', 'Filedata', array('label' => 'Choose New Photo', 'destination' => APPLICATION_PATH . '/public/temporary/', 'multiFile' => 1, 'validators' => array(array('Count', false, 1), array('Size', false, 612000), array('Extension', false, 'jpg,png,gif,jpeg')), 'onchange' => 'javascript:uploadSignupPhoto();'));
     $this->addElement('Hash', 'token');
     $this->addElement('Hidden', 'coordinates', array('order' => 1));
     $this->addElement('Hidden', 'uploadPhoto', array('order' => 2));
     $this->addElement('Hidden', 'nextStep', array('order' => 3));
     $this->addElement('Hidden', 'skip', array('order' => 4));
     // Element: done
     $this->addElement('Button', 'done', array('label' => 'Save Photo', 'type' => 'submit', 'onclick' => 'javascript:finishForm();', 'decorators' => array('ViewHelper')));
     // Element: skip
     $this->addElement('Cancel', 'skip-link', array('label' => 'skip', 'prependText' => ' or ', 'link' => true, 'href' => 'javascript:void(0);', 'onclick' => 'skipForm(); return false;', 'decorators' => array('ViewHelper')));
     // DisplayGroup: buttons
     $this->addDisplayGroup(array('done', 'skip-link'), 'buttons', array());
 }
Ejemplo n.º 18
0
 public function init()
 {
     $auth = Engine_Api::_()->authorization()->context;
     $user = $this->getItem();
     $this->setTitle('Privacy Settings')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     // Init blocklist
     $this->addElement('Hidden', 'blockList', array('label' => 'Blocked Members', 'description' => 'Adding a person to your block list makes your profile (and all of your other content) unviewable to them. Any connections you have to the blocked person will be canceled. To add someone to your block list, visit that person\'s profile page.', 'order' => -1));
     Engine_Form::addDefaultDecorators($this->blockList);
     // Init search
     $this->addElement('Checkbox', 'search', array('label' => 'Do not display me in searches, browsing members, or the "Online Members" list.', 'checkedValue' => 0, 'uncheckedValue' => 1));
     // Init showprofileviews
     /*
     $this->addElement('Checkbox', 'show_profileviewers', array(
       'label' => 'Yes, display users who viewed my profile.',
       //'description' => 'Show Profile Views',
     ));
     */
     $availableLabels = array('owner' => 'Only Me', 'member' => 'Only My Friends', 'network' => 'Friends & Networks', 'registered' => 'All Registered Members', 'everyone' => 'Everyone');
     // Init profile view
     $view_options = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('user', $user, 'auth_view');
     $view_options = array_intersect_key($availableLabels, array_flip($view_options));
     $this->addElement('Radio', 'privacy', array('label' => 'Profile Privacy', 'description' => 'Who can view your profile?', 'multiOptions' => $view_options));
     foreach ($this->_roles as $role) {
         if (1 === $auth->isAllowed($user, $role, 'view')) {
             $this->privacy->setValue($role);
         }
     }
     // Init profile comment
     $comment_options = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('user', $user, 'auth_comment');
     $comment_options = array_intersect_key($availableLabels, array_flip($comment_options));
     $this->addElement('Radio', 'comment', array('label' => 'Profile Posting Privacy', 'description' => 'Who can post on your profile?', 'multiOptions' => $comment_options));
     foreach ($this->_roles as $role) {
         if (1 === $auth->isAllowed($user, $role, 'comment')) {
             $this->comment->setValue($role);
         }
     }
     // Init publishtypes
     if (Engine_Api::_()->getApi('settings', 'core')->getSetting('activity.publish', true)) {
         $this->addElement('MultiCheckbox', 'publishTypes', array('label' => 'Recent Activity Privacy', 'description' => 'Which of the following things do you want to have published about you in the recent activity feed? Note that changing this setting will only affect future news feed items.'));
     }
     // Init submit
     $this->addElement('Button', 'submit', array('label' => 'Save Changes', 'type' => 'submit', 'ignore' => true));
     return $this;
 }
Ejemplo n.º 19
0
 public function init()
 {
     $view = $this->getView();
     $baseUrl = $view->layout()->staticBaseUrl;
     $view->headScript()->appendFile($baseUrl . 'externals/autocompleter/Observer.js')->appendFile($baseUrl . 'externals/autocompleter/Autocompleter.js')->appendFile($baseUrl . 'externals/autocompleter/Autocompleter.Local.js')->appendFile($baseUrl . 'externals/autocompleter/Autocompleter.Request.js');
     $view->headScript()->appendScript("\r\n        \twindow.addEvent('domready', function() {\r\n        \t\tvar viewBookFunc = function() {        \t\t\t\r\n\t        \t\tvar isAboutBookChk = \$('hasParent').get('checked');\r\n\t        \t\tif (!isAboutBookChk) {\r\n\t        \t\t\t\$('book-wrapper').set('style','display:none');\r\n\t        \t\t} else {\r\n\t        \t\t\t\$('book-wrapper').set('style','display:block');\r\n\t        \t\t\t\$('book').focus();\r\n\t        \t\t}\t\r\n        \t\t}\r\n        \t\t\r\n        \t\t\$('hasParent').addEvent('click', viewBookFunc);\r\n        \t\t\r\n        \t\tviewBookFunc();\r\n        \t});\r\n        ");
     $view->headStyle()->appendStyle('#parentBookValue-wrapper{height:0}');
     $this->setMethod('POST')->setTitle($this->_postName)->setAttrib('class', 'global_form book_form');
     $filter = new Engine_Filter_Html();
     $allowed_tags = array_map('trim', explode(',', Book_Plugin_Constants::ALLOWED_HTML_TAGS));
     $filter->setAllowedTags($allowed_tags);
     $this->addElement('Checkbox', 'hasParent', array('label' => 'This post is about a specific book.', 'value' => 0, 'order' => 1));
     $this->addElement('Text', 'book', array('label' => 'Book', 'autocomplete' => 'off', 'order' => 2));
     $this->addElement('Hidden', 'parentBookValue', array('allowEmpty' => true, 'order' => 3));
     Engine_Form::addDefaultDecorators($this->parentBookValue);
     $this->addElement('Text', 'post_name', array('label' => 'Title', 'required' => true, 'allowEmpty' => false, 'filters' => array(new Engine_Filter_Censor(), new Engine_Filter_StringLength(array('max' => '127'))), 'order' => 4));
     // init photo
     $this->addElement('File', 'photo', array('label' => 'Post Image', 'description' => 'The image should have the size with the portion 200px * 150px'));
     $this->photo->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     // init description
     $this->addElement('TinyMce', 'content', array('order' => 5, 'label' => 'Content', 'editorOptions' => array('theme_advanced_buttons1' => array('undo', 'redo', 'cleanup', 'removeformat', 'pasteword', '|', 'media', 'image', 'fullscreen', 'preview', 'emotions'), 'theme_advanced_buttons2' => array('fontselect', 'fontsizeselect', 'bold', 'italic', 'underline', 'strikethrough', 'forecolor', 'backcolor', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', '|', 'outdent', 'indent', 'blockquote'), 'width' => '800px', 'height' => '450px', 'content_css' => '/application/modules/Book/externals/styles/editor.css', 'upload_url' => Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'book', 'controller' => 'index', 'action' => 'upload'), 'default', true)), 'required' => true, 'allowEmpty' => false, 'filters' => array(new Engine_Filter_Censor(), $filter, new Book_Filter_HTMLPurifier())));
     Engine_Form::addDefaultDecorators($this->getElement('content'));
     // init tag
     $this->addElement('Text', 'tags', array('label' => 'Tags (Keywords)', 'description' => 'Separate tags with commas.', 'filters' => array('StripTags', new Engine_Filter_Censor()), 'order' => 6));
     $this->tags->getDecorator("Description")->setOption("placement", "append");
     // init author autocomplete
     $this->addElement('Text', 'tags_user', array('label' => 'Tag Users', 'autocomplete' => 'off', 'filters' => array('StripTags', new Engine_Filter_Censor()), 'order' => 7, 'description' => 'You can tag your friends here'));
     $this->tags_user->getDecorator("Description")->setOption("placement", "append");
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('allowEmpty' => true, 'order' => 8, 'filters' => array('HtmlEntities'), 'required' => false));
     Engine_Form::addDefaultDecorators($this->toValues);
     // init author autocomplete
     $this->addElement('Text', 'tags_book', array('label' => 'Tag Books', 'autocomplete' => 'off', 'filters' => array('StripTags', new Engine_Filter_Censor()), 'order' => 9, 'description' => 'You can tag the books that having the similar content with this one'));
     $this->tags_book->getDecorator("Description")->setOption("placement", "append");
     // Init to Values
     $this->addElement('Hidden', 'toBookValues', array('allowEmpty' => true, 'filters' => array('HtmlEntities'), 'order' => 10));
     Engine_Form::addDefaultDecorators($this->toBookValues);
     $this->addDisplayGroup(array('tags', 'tags_user', 'toValues', 'tags_book', 'toBookValues'), 'tag_group', array('order' => 11));
     // Element: submit
     $this->addElement('Button', 'submit', array('label' => 'Post', 'type' => 'submit', 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper'), 'order' => 12));
 }
Ejemplo n.º 20
0
 public function init()
 {
     $view = $this->getView();
     $baseUrl = $view->layout()->staticBaseUrl;
     $this->setMethod('POST')->setTitle($this->_chapterTitle)->setAttrib('class', 'global_form book_form');
     //init name textfield
     $this->addElement('Text', 'title', array('label' => 'Name', 'maxlength' => '256', 'allowEmpty' => false, 'filters' => array(new Engine_Filter_HtmlSpecialChars(), 'StripTags', new Engine_Filter_Censor(), new Engine_Filter_StringLength(array('max' => '256')))));
     // is published
     $this->addElement('Checkbox', 'published', array('label' => 'Publish chapter', 'value' => 1));
     // init photo
     $this->addElement('File', 'photo', array('label' => 'Chapter Image', 'description' => 'The image should have the size (140px * 230px)'));
     $this->photo->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     // init description
     $this->addElement('TinyMce', 'content', array('label' => 'Content', 'editorOptions' => array('width' => '900px', 'height' => '400px', 'content_css' => '/application/modules/Book/externals/styles/editor.css', 'theme_advanced_buttons1' => array('undo', 'redo', 'cleanup', 'removeformat', 'pasteword', '|', 'media', 'image', 'fullscreen', 'preview', 'emotions'), 'theme_advanced_buttons2' => array('fontselect', 'fontsizeselect', 'bold', 'italic', 'underline', 'strikethrough', 'forecolor', 'backcolor', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', '|', 'outdent', 'indent', 'blockquote', '|', 'code'), 'upload_url' => Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'book', 'controller' => 'index', 'action' => 'upload'), 'default', true)), 'allowEmpty' => false, 'decorators' => array('ViewHelper'), 'filters' => array(new Engine_Filter_Censor(), new Book_Filter_HTMLPurifier())));
     Engine_Form::addDefaultDecorators($this->getElement('content'));
     // Element: submit
     $this->addElement('Button', 'submit', array('label' => 'Post', 'type' => 'submit', 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper')));
 }
Ejemplo n.º 21
0
 public function init()
 {
     $auth = Engine_Api::_()->authorization()->context;
     $user = Engine_Api::_()->user()->getViewer();
     // Init form
     $this->setTitle('Add New Songs')->setDescription('Choose music from your computer to add to this playlist.')->setAttrib('id', 'form-upload-music')->setAttrib('name', 'playlist_create')->setAttrib('enctype', 'multipart/form-data')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     // Init name
     $this->addElement('Text', 'title', array('label' => 'Playlist Name', 'maxlength' => '63', 'filters' => array(new Engine_Filter_Censor(), new Engine_Filter_StringLength(array('max' => '63')))));
     // Init descriptions
     $this->addElement('Textarea', 'description', array('label' => 'Playlist Description', 'maxlength' => '300', 'filters' => array('StripTags', new Engine_Filter_Censor(), new Engine_Filter_StringLength(array('max' => '300')), new Engine_Filter_EnableLinks())));
     // Init search checkbox
     $this->addElement('Checkbox', 'search', array('label' => "Show this playlist in search results", 'value' => 1, 'checked' => true));
     // AUTHORIZATIONS
     $availableLabels = $this->_roles;
     // Element: auth_view
     $viewOptions = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('music_playlist', $user, 'auth_view');
     $viewOptions = array_intersect_key($availableLabels, array_flip($viewOptions));
     if (count($viewOptions) >= 1) {
         $this->addElement('Select', 'auth_view', array('label' => 'Privacy', 'description' => 'Who may see this playlist?', 'multiOptions' => $viewOptions, 'value' => key($viewOptions)));
         $this->auth_view->getDecorator('Description')->setOption('placement', 'append');
     }
     // Element: auth_comment
     $commentOptions = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('music_playlist', $user, 'auth_comment');
     $commentOptions = array_intersect_key($availableLabels, array_flip($commentOptions));
     if (count($commentOptions) >= 1) {
         $this->addElement('Select', 'auth_comment', array('label' => 'Comment Privacy', 'description' => 'Who may post comments on this playlist?', 'multiOptions' => $commentOptions, 'value' => key($commentOptions)));
         $this->auth_comment->getDecorator('Description')->setOption('placement', 'append');
     }
     // Init playlist art
     $this->addElement('File', 'art', array('label' => 'Playlist Artwork'));
     $this->art->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     // Init file uploader
     $fancyUpload = new Engine_Form_Element_FancyUpload('file');
     $fancyUpload->clearDecorators()->addDecorator('FormFancyUpload')->addDecorator('viewScript', array('viewScript' => '_FancyUpload.tpl', 'placement' => ''));
     Engine_Form::addDefaultDecorators($fancyUpload);
     $this->addElement($fancyUpload);
     // Init hidden file IDs
     $this->addElement('Hidden', 'fancyuploadfileids');
     // Init submit
     $this->addElement('Button', 'submit', array('label' => 'Save Music to Playlist', 'type' => 'submit'));
 }
Ejemplo n.º 22
0
 public function init()
 {
     $view = $this->getView();
     $baseUrl = $view->layout()->staticBaseUrl;
     $view->headScript()->appendFile($baseUrl . 'externals/autocompleter/Observer.js')->appendFile($baseUrl . 'externals/autocompleter/Autocompleter.js')->appendFile($baseUrl . 'externals/autocompleter/Autocompleter.Local.js')->appendFile($baseUrl . 'externals/autocompleter/Autocompleter.Request.js');
     $view->headScript()->appendScript('
     	window.addEvent("domready", function() {
     		var showOrHideContent = function() {
     			if (!$("is_long").get("checked")) {
     				$("content-wrapper").set("style", "display:block");
     			} else {
     				$("content-wrapper").set("style", "display:none");
     			}
     		}
     		showOrHideContent();
     		$("is_long").addEvent("click", showOrHideContent);
     	});
     ');
     $this->setMethod('POST')->setTitle($this->_workTitle)->setAttrib('class', 'global_form book_form');
     //init name textfield
     $this->addElement('Text', 'title', array('label' => 'Work name', 'maxlength' => '256', 'allowEmpty' => false, 'required' => true, 'filters' => array(new Engine_Filter_HtmlSpecialChars(), 'StripTags', new Engine_Filter_Censor(), new Engine_Filter_StringLength(array('max' => '256')))));
     // is published
     $this->addElement('Checkbox', 'published', array('label' => 'Publish work', 'value' => 1));
     // init photo
     $this->addElement('File', 'photo', array('label' => 'Work Image', 'description' => 'The image should have the size with the portion 200px * 150px'));
     $this->photo->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     // init description
     $this->addElement('TinyMce', 'description', array('label' => 'Description', 'editorOptions' => array('editor_selector' => 'editor_description', 'width' => '850px', 'height' => '150px', 'content_css' => '/application/modules/Book/externals/styles/editor.css', 'theme_advanced_buttons1' => array('undo', 'redo', 'cleanup', 'removeformat', 'pasteword', '|', 'media', 'image', 'fullscreen', 'preview', 'emotions'), 'theme_advanced_buttons2' => array('fontselect', 'fontsizeselect', 'bold', 'italic', 'underline', 'strikethrough', 'forecolor', 'backcolor', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', '|', 'outdent', 'indent', 'blockquote'), 'upload_url' => Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'book', 'controller' => 'index', 'action' => 'upload'), 'default', true)), 'allowEmpty' => false, 'decorators' => array('ViewHelper'), 'filters' => array(new Engine_Filter_Censor(), new Book_Filter_HTMLPurifier())));
     $this->getElement('description')->setAttrib('class', 'editor_description');
     Engine_Form::addDefaultDecorators($this->getElement('description'));
     $this->addElement('Checkbox', 'is_long', array('label' => 'This is a story with many chapters', 'value' => 1, 'checked' => false));
     // init description
     $this->addElement('TinyMce', 'content', array('label' => 'Content', 'editorOptions' => array('editor_selector' => 'editor_content', 'width' => '850px', 'height' => '450px', 'content_css' => '/application/modules/Book/externals/styles/editor.css', 'theme_advanced_buttons1' => array('undo', 'redo', 'cleanup', 'removeformat', 'pasteword', '|', 'media', 'image', 'fullscreen', 'preview', 'emotions'), 'theme_advanced_buttons2' => array('fontselect', 'fontsizeselect', 'bold', 'italic', 'underline', 'strikethrough', 'forecolor', 'backcolor', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', '|', 'outdent', 'indent', 'blockquote'), 'upload_url' => Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'book', 'controller' => 'index', 'action' => 'upload'), 'default', true)), 'allowEmpty' => false, 'decorators' => array('ViewHelper'), 'filters' => array(new Engine_Filter_Censor(), new Book_Filter_HTMLPurifier())));
     $this->getElement('content')->setAttrib('class', 'editor_content');
     Engine_Form::addDefaultDecorators($this->getElement('content'));
     // Element: submit
     $this->addElement('Button', 'submit', array('label' => 'Post', 'type' => 'submit', 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper')));
 }
Ejemplo n.º 23
0
 public function init()
 {
     $this->setTitle('Relationship');
     $this->setAttribs(array('class' => 'ynmember-form-edit-relationship global_form'));
     //Init Relationship status
     $tableRelationship = Engine_Api::_()->getItemTable('ynmember_relationship');
     $relationship = $tableRelationship->getAllRelationships();
     $relationshipOptions = array('0' => '');
     foreach ($relationship as $item) {
         $relationshipOptions[$item->getIdentity()] = $item->status;
     }
     $this->addElement('Select', 'relationship', array('label' => 'Relationship Status', 'multiOptions' => $relationshipOptions, 'onchange' => 'changeStatus();'));
     $this->addElement('Text', 'with', array('label' => 'With', 'autocomplete' => 'off'));
     Engine_Form::addDefaultDecorators($this->with);
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('label' => 'With', 'required' => false, 'allowEmpty' => true, 'style' => 'margin-top:-5px', 'order' => 1, 'filters' => array('HtmlEntities')));
     Engine_Form::addDefaultDecorators($this->toValues);
     $this->addElement('Text', 'anniversary', array('label' => 'Anniversary', 'class' => 'date_picker input_small', 'required' => false, 'allowEmpty' => true));
     $this->addElement('hidden', 'auth_view', array('value' => 'self', 'order' => '99'));
     // Buttons
     $this->addElement('Button', 'submit', array('label' => 'Save', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper')));
 }
Ejemplo n.º 24
0
 public function init()
 {
     // Init form
     $this->setTitle('Add New Photos')->setDescription('Choose photos on your computer to add to this classified listing. (2MB maximum)')->setAttrib('id', 'form-upload')->setAttrib('class', 'global_form classified_form_upload')->setAttrib('name', 'albums_create')->setAttrib('enctype', 'multipart/form-data')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     $fancyUpload = new Engine_Form_Element_FancyUpload('file');
     $fancyUpload->clearDecorators()->addDecorator('FormFancyUpload')->addDecorator('viewScript', array('viewScript' => '_FancyUpload.tpl', 'placement' => ''));
     Engine_Form::addDefaultDecorators($fancyUpload);
     $this->addElement($fancyUpload);
     $this->addElement('Hidden', 'fancyuploadfileids');
     //$this->addElement('FancyUpload', 'file');
     /*
     $this->addElement('Hidden', 'file', array(
       'decorators' => array(
         array('ViewScript', array(
           'viewScript' => '_formUpload.tpl',
         ))
       )
     ));
     self::addDefaultDecorators($this->file);
     */
     // Init submit
     $this->addElement('Button', 'submit', array('label' => 'Save Photos', 'type' => 'submit'));
 }
Ejemplo n.º 25
0
 public function init()
 {
     $this->setTitle('Merge Feedbacks')->setDescription('Please note that after merging feedbacks, all original feedbacks will be deleted permanantly.')->setAttrib('class', 'global_form');
     //Heading
     $this->addElement('heading', 'heading_1', array('label' => '1. Search feedback'));
     $this->addElement('Text', 'to', array('autocomplete' => 'off', 'label' => 'Feedback'));
     Engine_Form::addDefaultDecorators($this->to);
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('style' => 'margin-top:-5px', 'order' => 2, 'filters' => array('HtmlEntities')));
     Engine_Form::addDefaultDecorators($this->toValues);
     //Heading
     $this->addElement('heading', 'heading_2', array('label' => '2. Select feedback to use for title and description'));
     //list ideas
     $this->addElement('Select', 'listFeedback', array('required' => true, 'allowEmpty' => false, 'label' => 'Choose Feedback'));
     $this->listFeedback->setRegisterInArrayValidator(false);
     //title
     $this->addElement('Text', 'title', array('label' => 'Title', 'description' => 'Edit if necessary', 'allowEmpty' => false, 'required' => true, 'validators' => array(array('NotEmpty', true)), 'filters' => array('StripTags', new Engine_Filter_Censor())));
     //description
     $this->addElement('Textarea', 'description', array('label' => 'Description', 'description' => 'Edit if necessary', 'allowEmpty' => false, 'required' => true, 'filters' => array(new Engine_Filter_HtmlSpecialChars(), new Engine_Filter_Censor(), new Engine_Filter_EnableLinks()), 'validators' => array(array('NotEmpty', true))));
     //Heading
     $this->addElement('heading', 'heading_5', array('description' => 'All settings of this feedback will be used for the new one'));
     //Heading
     $this->addElement('heading', 'heading_3', array('label' => '3. Select feedback owner'));
     //list owners
     $this->addElement('Select', 'listOwner', array('required' => true, 'label' => 'Choose Owner', 'allowEmpty' => false, 'description' => 'Other owners will be co-authors of this feedback'));
     $this->listOwner->getDecorator("Description")->setOption("placement", "append")->setEscape(FALSE);
     $this->listOwner->setRegisterInArrayValidator(false);
     //Heading
     $this->addElement('heading', 'heading_4', array('label' => '4. Feedback options'));
     $this->addElement('Checkbox', 'send_notification', array('label' => 'Send notifications to inform owner and co-authors about new feedback', 'checkedValue' => '1', 'uncheckedValue' => '0', 'value' => 1));
     $this->addElement('Checkbox', 'move_activity', array('label' => 'Move all activities from old feedbacks to this new one (including likes, comments, followers, votes)', 'checkedValue' => '1', 'uncheckedValue' => '0', 'value' => 1));
     $this->addElement('Checkbox', 'move_material', array('label' => 'Move all materials from old feedbacks to this new one (including files and screenshots)', 'checkedValue' => '1', 'uncheckedValue' => '0', 'value' => 1));
     // Buttons
     $this->addElement('Button', 'submit_button', array('label' => 'Save', 'onclick' => 'removeSubmit()', 'type' => 'submit', 'ignore' => true, 'values' => 1, 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit_button', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper')));
 }
Ejemplo n.º 26
0
 public function init()
 {
     $view = Zend_Registry::get('Zend_View');
     $settings = Engine_Api::_()->getApi('settings', 'core');
     $viewer = Engine_Api::_()->user()->getViewer();
     $this->setTitle('Add New Feedback');
     //Category
     $this->addElement('Select', 'category_id', array('required' => true, 'allowEmpty' => false, 'label' => '*Category'));
     //Custom field
     if (!$this->_item) {
         $customFields = new Ynfeedback_Form_Feedback_Fields($this->_formArgs);
     }
     if (get_class($this) == 'Ynfeedback_Form_Feedback_Create') {
         $customFields->setIsCreation(true);
     }
     $this->addSubForms(array('fields' => $customFields));
     //title
     $this->addElement('Text', 'title', array('label' => '*Feedback', 'allowEmpty' => false, 'required' => true, 'validators' => array(array('NotEmpty', true), array('StringLength', false, array(1, 100))), 'filters' => array('StripTags', new Engine_Filter_Censor())));
     if (isset($_GET['title']) && !empty($_GET['title'])) {
         $this->getElement('title')->setValue($_GET['title']);
     }
     //description
     $this->addElement('Textarea', 'description', array('label' => '*Description', 'allowEmpty' => false, 'required' => true, 'filters' => array(new Engine_Filter_HtmlSpecialChars(), new Engine_Filter_Censor(), new Engine_Filter_EnableLinks()), 'validators' => array(array('NotEmpty', true))));
     //Co-authors
     $this->addElement('Text', 'to', array('label' => 'Co-authors', 'autocomplete' => 'off'));
     Engine_Form::addDefaultDecorators($this->to);
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('style' => 'margin-top:-5px', 'order' => 5, 'filters' => array('HtmlEntities')));
     Engine_Form::addDefaultDecorators($this->toValues);
     //Severity
     $this->addElement('Select', 'severity', array('required' => true, 'allowEmpty' => false, 'label' => 'Severity'));
     $tableSeverity = Engine_Api::_()->getDbTable('severities', 'ynfeedback');
     $this->severity->addMultiOptions($tableSeverity->getSeverityArray());
     if ($viewer->getIdentity()) {
         // Privacy
         $viewOptions = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('ynfeedback_idea', $viewer, 'auth_view');
         $commentOptions = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('ynfeedback_idea', $viewer, 'auth_comment');
         $availableLabels = array('everyone' => $view->translate('Everyone'), 'owner_network' => $view->translate('Friends and Networks'), 'owner_member_member' => $view->translate('Friends of Friends'), 'owner_member' => $view->translate('Friends Only'), 'owner' => $view->translate('Just Me'));
         $viewOptions = array_intersect_key($availableLabels, array_flip($viewOptions));
         $commentOptions = array_intersect_key($availableLabels, array_flip($commentOptions));
         // View
         if (!empty($viewOptions) && count($viewOptions) >= 1) {
             // Make a hidden field
             if (count($viewOptions) == 1) {
                 $this->addElement('hidden', 'auth_view', array('value' => key($viewOptions)));
                 // Make select box
             } else {
                 $this->addElement('Select', 'auth_view', array('label' => 'Privacy', 'multiOptions' => $viewOptions, 'value' => key($viewOptions)));
             }
         }
         // Comment
         if (!empty($commentOptions) && count($commentOptions) >= 1) {
             // Make a hidden field
             if (count($commentOptions) == 1) {
                 $this->addElement('hidden', 'auth_comment', array('value' => key($commentOptions)));
                 // Make select box
             } else {
                 $this->addElement('Select', 'auth_comment', array('label' => 'Comment Privacy', 'multiOptions' => $commentOptions, 'value' => key($commentOptions)));
             }
         }
     } else {
         //name
         $this->addElement('Text', 'guest_name', array('label' => '*Your Name', 'allowEmpty' => false, 'required' => true, 'validators' => array(array('NotEmpty', true)), 'filters' => array('StripTags', new Engine_Filter_Censor())));
         //email
         $this->addElement('Text', 'guest_email', array('label' => '*Your Email', 'allowEmpty' => false, 'required' => true, 'description' => $view->translate('We will not show your email but your name for this feedback.'), 'validators' => array(array('NotEmpty', true), array('StringLength', false, array(1, 64))), 'filters' => array('StripTags', new Engine_Filter_Censor())));
         $this->guest_email->getDecorator("Description")->setOption("placement", "append");
     }
     $this->addElement('Button', 'submit_button', array('value' => 'submit_button', 'label' => 'Create', 'onclick' => 'removeSubmit()', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'Cancel', 'link' => true, 'prependText' => ' or ', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit_button', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper')));
 }
Ejemplo n.º 27
0
 public function init()
 {
     $user = Engine_Api::_()->user()->getViewer();
     $this->setTitle('Add New Player Card');
     $this->addElement('File', 'photo', array('label' => 'Card Photo'));
     $this->photo->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     $this->addElement('Text', 'first_name', array('label' => 'First Name', 'allowEmpty' => false, 'required' => true, 'validators' => array(array('NotEmpty', true), array('StringLength', false, array(1, 64))), 'filters' => array('StripTags', new Engine_Filter_Censor())));
     $this->first_name->setAttrib('required', true);
     $this->addElement('Text', 'last_name', array('label' => 'Last Name', 'allowEmpty' => false, 'required' => true, 'validators' => array(array('NotEmpty', true), array('StringLength', false, array(1, 64))), 'filters' => array('StripTags', new Engine_Filter_Censor())));
     $this->last_name->setAttrib('required', true);
     $relations = Engine_Api::_()->getDbTable('relations', 'user')->getRelationArray();
     $relations['0'] = 'Other';
     $this->addElement('Select', 'relation_id', array('label' => 'Relation', 'multiOptions' => $relations, 'onchange' => 'showOther()', 'required' => (bool) Engine_Api::_()->getApi('settings', 'core')->getSetting('user.relation_require', 1)));
     $this->addElement('Textarea', 'relation_other', array('label' => 'Relation Other', 'validators' => array(array('NotEmpty', true)), 'filters' => array('StripTags', new Engine_Filter_Censor(), new Engine_Filter_EnableLinks(), new Engine_Filter_StringLength(array('max' => 100)))));
     $this->addElement('Textarea', 'description', array('label' => 'Description', 'validators' => array(array('NotEmpty', true)), 'filters' => array('StripTags', new Engine_Filter_Censor(), new Engine_Filter_EnableLinks(), new Engine_Filter_StringLength(array('max' => 10000)))));
     $sportCattable = Engine_Api::_()->getDbtable('sportcategories', 'user');
     $node = $sportCattable->getNode(0);
     $categories = $node->getChilren();
     $sport_categories[0] = '';
     foreach ($categories as $category) {
         $sport_categories[$category->getIdentity()] = $category->getTitle();
     }
     $this->addElement('Select', 'category_id', array('label' => 'Sport Category', 'multiOptions' => $sport_categories, 'onchange' => 'subCategories()'));
     $gender = new Engine_Form_Element_Select('gender');
     $gender->setLabel("Gender");
     $gender->setAllowEmpty(false);
     $gender->setMultiOptions(array('1' => 'Male', '2' => 'Female'));
     $gender->setRequired(true);
     $this->addElement($gender);
     $birthday = new Fields_Form_Element_Birthdate('birth_date');
     $birthday->setLabel("Date of Birth");
     $birthday->setAllowEmpty(false);
     $birthday->setRequired(true);
     $birthday->setYearMax(Engine_Api::_()->getApi('settings', 'core')->getSetting('user.max_year', 2003));
     $birthday->setYearMin(Engine_Api::_()->getApi('settings', 'core')->getSetting('user.min_year', 1985));
     $this->addElement($birthday);
     $birthday->setAttrib('required', true);
     $this->birth_date->setAttrib('required', true);
     $countriesAssoc = Engine_Api::_()->getDbTable('locations', 'user')->getLocationsAssoc(0);
     $countriesAssoc = array('' => '') + $countriesAssoc;
     $this->addElement('Select', 'country_id', array('label' => 'Country', 'multiOptions' => $countriesAssoc, 'required' => true));
     $this->country_id->setAttrib('required', true);
     $this->addElement('Select', 'province_id', array('label' => 'Province/State'));
     $this->addElement('Select', 'city_id', array('label' => 'City'));
     $languages = Engine_Api::_()->getDbTable('languages', 'user')->getLanguagesArray();
     $this->addElement('MultiCheckbox', 'languages', array('label' => 'Languages', 'required' => false, 'allowEmpty' => true, 'multiOptions' => $languages));
     $this->languages->getDecorator("Description")->setOption("placement", "append");
     $this->addElement('Select', 'referred_foot', array('label' => 'Preferred Foot', 'multiOptions' => array('1' => 'Left', '2' => 'Right', '0' => 'Both')));
     $positions = $sportCattable->getMultiOptions('--', '', FALSE);
     $this->addElement('Select', 'position_id', array('label' => 'Position', 'multiOptions' => $positions));
     // View for specific users
     $this->addElement('Text', 'user', array('label' => 'Allow view for', 'autocomplete' => 'off', 'order' => '16'));
     $this->addElement('Hidden', 'user_ids', array('filters' => array('HtmlEntities'), 'order' => '17'));
     Engine_Form::addDefaultDecorators($this->user_ids);
     // View
     $availableLabels = array('everyone' => 'Everyone', 'owner_network' => 'Followers and Networks', 'owner_member' => 'My Followers', 'owner' => 'Only Me');
     $viewOptions = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('user_playercard', $user, 'auth_view');
     $viewOptions = array_intersect_key($availableLabels, array_flip($viewOptions));
     if (!empty($viewOptions) && count($viewOptions) >= 1) {
         // Make a hidden field
         if (count($viewOptions) == 1) {
             $this->addElement('hidden', 'auth_view', array('value' => key($viewOptions)));
             // Make select box
         } else {
             $this->addElement('Select', 'auth_view', array('label' => 'Who can view this player', 'multiOptions' => $viewOptions, 'value' => key($viewOptions), 'onchange' => 'privacyChange()'));
         }
     }
     // Buttons
     $this->addElement('Button', 'submit', array('label' => 'Post Player Card', 'type' => 'submit', 'ignore' => true, 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper')));
 }
Ejemplo n.º 28
0
 public function init()
 {
     // Init form
     $this->setTitle('Add New Video')->setAttrib('id', 'form-upload')->setAttrib('name', 'video_create')->setAttrib('enctype', 'multipart/form-data')->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array()));
     //->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module'=>'album', 'controller'=>'album', 'action'=>'upload-photo', 'format' => 'json'), 'default'));
     $user = Engine_Api::_()->user()->getViewer();
     // Init name
     $this->addElement('Text', 'title', array('label' => 'Video Title', 'maxlength' => '100', 'allowEmpty' => false, 'required' => true, 'filters' => array('StripTags', new Engine_Filter_Censor(), new Engine_Filter_StringLength(array('max' => '100')))));
     // init tag
     $this->addElement('Text', 'tags', array('label' => 'Tags (Keywords)', 'autocomplete' => 'off', 'description' => 'Separate tags with commas.', 'filters' => array(new Engine_Filter_Censor())));
     $this->tags->getDecorator("Description")->setOption("placement", "append");
     // Init descriptions
     $this->addElement('Textarea', 'description', array('label' => 'Video Description', 'filters' => array('StripTags', new Engine_Filter_Censor(), new Engine_Filter_EnableLinks())));
     // prepare categories
     $categories = Engine_Api::_()->video()->getCategories();
     if (count($categories) != 0) {
         $categories_prepared[0] = "";
         foreach ($categories as $category) {
             $categories_prepared[$category->category_id] = $category->category_name;
         }
         // category field
         $this->addElement('Select', 'category_id', array('label' => 'Category', 'multiOptions' => $categories_prepared));
     }
     // Init search
     $this->addElement('Checkbox', 'search', array('label' => "Show this video in search results", 'value' => 1));
     // View
     $availableLabels = array('everyone' => 'Everyone', 'registered' => 'All Registered Members', 'owner_network' => 'Friends and Networks', 'owner_member_member' => 'Friends of Friends', 'owner_member' => 'Friends Only', 'owner' => 'Just Me');
     $viewOptions = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('video', $user, 'auth_view');
     $viewOptions = array_intersect_key($availableLabels, array_flip($viewOptions));
     if (!empty($viewOptions) && count($viewOptions) >= 1) {
         $this->addElement('Select', 'auth_view', array('label' => 'Privacy', 'description' => 'Who may see this video?', 'multiOptions' => $viewOptions, 'value' => key($viewOptions)));
         $this->auth_view->getDecorator('Description')->setOption('placement', 'append');
     }
     // Comment
     $commentOptions = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('video', $user, 'auth_comment');
     $commentOptions = array_intersect_key($availableLabels, array_flip($commentOptions));
     if (!empty($commentOptions) && count($commentOptions) >= 1) {
         $this->addElement('Select', 'auth_comment', array('label' => 'Comment Privacy', 'description' => 'Who may post comments on this video?', 'multiOptions' => $commentOptions, 'value' => key($commentOptions)));
         $this->auth_comment->getDecorator('Description')->setOption('placement', 'append');
     }
     // Init video
     $this->addElement('Select', 'type', array('label' => 'Video Source', 'multiOptions' => array('0' => ' '), 'onchange' => "updateTextFields()"));
     //YouTube, Vimeo
     $video_options = array();
     $video_options[1] = "YouTube";
     $video_options[2] = "Vimeo";
     //My Computer
     $allowed_upload = Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('video', $user, 'upload');
     $ffmpeg_path = Engine_Api::_()->getApi('settings', 'core')->video_ffmpeg_path;
     if (!empty($ffmpeg_path) && $allowed_upload) {
         $video_options[3] = "My Computer";
     }
     $this->type->addMultiOptions($video_options);
     //ADD AUTH STUFF HERE
     // Init url
     $this->addElement('Text', 'url', array('label' => 'Video Link (URL)', 'description' => 'Paste the web address of the video here.', 'maxlength' => '50'));
     $this->url->getDecorator("Description")->setOption("placement", "append");
     $this->addElement('Hidden', 'code', array('order' => 1));
     $this->addElement('Hidden', 'id', array('order' => 2));
     $this->addElement('Hidden', 'ignore', array('order' => 3));
     // Init file
     //$this->addElement('FancyUpload', 'file');
     $fancyUpload = new Engine_Form_Element_FancyUpload('file');
     $fancyUpload->clearDecorators()->addDecorator('FormFancyUpload')->addDecorator('viewScript', array('viewScript' => '_FancyUpload.tpl', 'placement' => ''));
     Engine_Form::addDefaultDecorators($fancyUpload);
     $this->addElement($fancyUpload);
     // Init submit
     $this->addElement('Button', 'upload', array('label' => 'Save Video', 'type' => 'submit'));
     //$this->addElements(Array($album, $name, $description, $search, $file, $submit));
 }
Ejemplo n.º 29
0
 public function init()
 {
     $settings = Engine_Api::_()->getApi('settings', 'core');
     $view = Zend_Registry::get("Zend_View");
     $user = Engine_Api::_()->user()->getViewer();
     $this->setTitle('Add New Campaign')->setDescription("NEW_CAMPAIGN_DESCRIPTION");
     $maxCharTitle = $settings->getSetting('tfcampaign_max_title', "300");
     $this->addElement('Text', 'title', array('label' => 'Title', 'description' => $view->translate("Maximum %s characters.", $maxCharTitle), 'allowEmpty' => false, 'required' => true, 'validators' => array(array('NotEmpty', true), array('StringLength', false, array(1, $maxCharTitle))), 'filters' => array('StripTags', new Engine_Filter_Censor())));
     $this->title->setAttrib('required', true);
     $maxCharDesc = $settings->getSetting('tfcampaign_max_description', "300");
     $this->addElement('Textarea', 'description', array('label' => 'Description', 'description' => $view->translate("Maximum %s characters.", $maxCharDesc), 'validators' => array(array('NotEmpty', true), array('StringLength', false, array(1, $maxCharDesc))), 'filters' => array('StripTags', new Engine_Filter_Censor())));
     $this->description->setAttrib('required', true);
     // Start time
     $start = new Engine_Form_Element_CalendarDateTime('start_date');
     $start->setLabel("Start Time");
     $start->setAllowEmpty(false);
     $this->addElement($start);
     // End time
     $end = new Engine_Form_Element_CalendarDateTime('end_date');
     $end->setLabel("End Time");
     $end->setAllowEmpty(false);
     $this->addElement($end);
     $sportCattable = Engine_Api::_()->getDbtable('sportcategories', 'user');
     $node = $sportCattable->getNode(0);
     $categories = $node->getChilren();
     foreach ($categories as $category) {
         $sport_categories[$category->getIdentity()] = $category->getTitle();
     }
     $this->addElement('Select', 'category_id', array('label' => 'Sport Category', 'multiOptions' => $sport_categories, 'onchange' => 'subCategories()'));
     $positions = $sportCattable->getMultiOptions('--', '', FALSE);
     array_shift($positions);
     $this->addElement('Select', 'position_id', array('label' => 'Position', 'multiOptions' => $positions));
     $this->addElement('Select', 'referred_foot', array('label' => 'Preferred Foot', 'multiOptions' => array('1' => 'Left', '2' => 'Right', '0' => 'Both')));
     /*
     $this->addElement('File', 'photo', array(
           'label' => 'Campaign Photo'
         ));
     $this -> photo -> setAllowEmpty(true);
         $this -> photo -> addValidator('Extension', false, 'jpg,png,gif,jpeg');
     $this -> photo -> setAttrib('accept', 'image/*');
     */
     $arrAge = array();
     $arrAge[] = "Any";
     for ($i = 1; $i <= 100; $i++) {
         $arrAge[] = $i;
     }
     $this->addElement('Select', 'from_age', array('label' => 'From Age', 'multiOptions' => $arrAge));
     $this->addElement('Select', 'to_age', array('label' => 'To Age', 'multiOptions' => $arrAge));
     $gender = new Engine_Form_Element_Select('gender');
     $gender->setLabel("Gender");
     $gender->setAllowEmpty(false);
     $gender->setMultiOptions(array('0' => 'Any', '1' => 'Male', '2' => 'Female'));
     $gender->setRequired(true);
     $this->addElement($gender);
     $countriesAssoc = Engine_Api::_()->getDbTable('locations', 'user')->getLocationsAssoc(0);
     $countriesAssoc = array('0' => 'Any') + $countriesAssoc;
     $this->addElement('Select', 'country_id', array('label' => 'Country', 'multiOptions' => $countriesAssoc));
     $this->addElement('Select', 'province_id', array('label' => 'Province/State'));
     $this->addElement('Select', 'city_id', array('label' => 'City'));
     $languages = Engine_Api::_()->getDbTable('languages', 'user')->getLanguagesArray();
     $this->addElement('MultiCheckbox', 'languages', array('label' => 'Languages', 'required' => false, 'allowEmpty' => true, 'multiOptions' => $languages, 'filters' => array('StripTags', new Engine_Filter_Censor())));
     $this->languages->getDecorator("Description")->setOption("placement", "append");
     $this->addElement('Select', 'percentage', array('label' => 'Matching Percentage', 'description' => 'The minimum percentage of matching.', 'multiOptions' => array('25' => '25%', '50' => '50%', '75' => '75%', '100' => '100%'), 'value' => 25));
     // View for specific users
     $this->addElement('Text', 'user', array('label' => 'Allow view for', 'autocomplete' => 'off', 'order' => '16'));
     $this->addElement('Hidden', 'user_ids', array('filters' => array('HtmlEntities'), 'order' => '18'));
     Engine_Form::addDefaultDecorators($this->user_ids);
     $allowPrivate = Engine_Api::_()->getApi('settings', 'core')->getSetting('tfcampaign_private_allow', 1);
     if ($allowPrivate) {
         // View
         $availableLabels = array('everyone' => 'Everyone', 'registered' => 'All Registered Members', 'owner_network' => 'Followers and Networks', 'owner_member_member' => 'Followers of Followers', 'owner_member' => 'My Followers', 'owner' => 'Only Me');
         $viewOptions = (array) Engine_Api::_()->authorization()->getAdapter('levels')->getAllowed('tfcampaign_campaign', $user, 'auth_view');
         $viewOptions = array_intersect_key($availableLabels, array_flip($viewOptions));
         if (!empty($viewOptions) && count($viewOptions) >= 1) {
             // Make a hidden field
             if (count($viewOptions) == 1) {
                 $this->addElement('hidden', 'auth_view', array('value' => key($viewOptions)));
                 // Make select box
             } else {
                 $this->addElement('Select', 'auth_view', array('label' => 'Who may see this campaign', 'multiOptions' => $viewOptions, 'value' => key($viewOptions), 'onchange' => 'privacyChange()'));
                 $this->auth_view->getDecorator('Description')->setOption('placement', 'append');
             }
         }
     }
     // Buttons
     $this->addElement('Button', 'submit', array('label' => 'Post Campaign ', 'type' => 'submit', 'ignore' => true, 'onClick' => 'return checkValid();', 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper')));
 }
Ejemplo n.º 30
0
 public function init()
 {
     $view = $this->getView();
     $baseUrl = $view->layout()->staticBaseUrl;
     $view->headScript()->appendFile($baseUrl . 'externals/autocompleter/Observer.js')->appendFile($baseUrl . 'externals/autocompleter/Autocompleter.js')->appendFile($baseUrl . 'externals/autocompleter/Autocompleter.Local.js')->appendFile($baseUrl . 'externals/autocompleter/Autocompleter.Request.js')->appendScript("\r\n\t\t\twindow.addEvent('domready', function() {\r\n\t\t\t\ten4.book.onCreateEditBook();\t\t\t\t\r\n\t\t\t});\r\n\t\t");
     $this->setMethod('POST')->setTitle($this->_bookTitle)->setAttrib('class', 'global_form book_form');
     //init name textfield
     $this->addElement('Text', 'book_name', array('label' => 'Name', 'maxlength' => '256', 'allowEmpty' => false, 'required' => true, 'filters' => array(new Engine_Filter_HtmlSpecialChars(), 'StripTags', new Engine_Filter_Censor(), new Engine_Filter_StringLength(array('max' => '256')))));
     // init photo
     $this->addElement('File', 'photo', array('label' => 'Book Image', 'description' => 'The image should have the size (140px * 230px)', 'required' => true));
     $this->photo->addValidator('Extension', false, 'jpg,png,gif,jpeg');
     $this->addDisplayGroup(array('book_name', 'photo'), 'basic_information');
     $this->basic_information->setLegend('Basic information (required)');
     // init author autocomplete
     $this->addElement('Text', 'authors', array('label' => 'Author', 'autocomplete' => 'off', 'order' => 1));
     // Init to Values
     $this->addElement('Hidden', 'toValues', array('allowEmpty' => true, 'filters' => array('HtmlEntities'), 'order' => 2));
     Engine_Form::addDefaultDecorators($this->toValues);
     // Is foreigner
     $this->addElement('Checkbox', 'is_foreign', array('label' => 'Is Foreigner', 'value' => '0', 'order' => 3));
     // init author autocomplete
     $this->addElement('Text', 'translators', array('label' => 'Translator', 'autocomplete' => 'off', 'filters' => array('StripTags', new Engine_Filter_Censor()), 'order' => 4));
     // Init to Values
     $this->addElement('Hidden', 'toTranslatorValues', array('allowEmpty' => true, 'filters' => array('HtmlEntities'), 'order' => 5));
     Engine_Form::addDefaultDecorators($this->toTranslatorValues);
     // int category and sub category
     $categoriesOptions = Engine_Api::_()->getDbTable('categories', 'book')->getMultiOptions();
     $categoryElement = new Engine_Form_Element_Select('category_id', array('label' => 'Category', 'multiOptions' => $categoriesOptions, 'order' => 6));
     $this->addElement($categoryElement);
     // Published date
     $publishedDate = new Engine_Form_Element_Birthdate('published_date', array('yearMax' => intval(date("Y")) + 1));
     $publishedDate->setLabel("Published Date");
     $publishedDate->setAllowEmpty(true);
     $publishedDate->setOrder(7);
     $this->addElement($publishedDate);
     // Price
     $this->addElement('Text', 'price', array('label' => 'Price', 'description' => Book_Plugin_Constants::CURRENCY_CODE, 'validators' => array(array('Int', true), array('GreaterThan', true, array(0))), 'filters' => array(new Book_Filter_HTMLPurifier(), new Book_Filter_Null()), 'order' => 8));
     // Size
     $this->addElement('Text', 'size', array('label' => 'Size', 'maxlength' => '256', 'filters' => array(new Engine_Filter_HtmlSpecialChars(), 'StripTags', new Engine_Filter_Censor(), new Engine_Filter_StringLength(array('max' => '64'))), 'order' => 9));
     // Publisher
     $this->addElement('Select', 'publisher_id', array('label' => 'Publisher', 'multiOptions' => array_merge(array('0' => ''), Book_Plugin_Utilities::getPublishers()), 'order' => 10));
     // Book company
     $this->addElement('Select', 'book_company_id', array('label' => 'Book Company', 'multiOptions' => array_merge(array('0' => ''), Book_Plugin_Utilities::getBookCompanies()), 'order' => 11));
     // Type
     $this->addElement('Select', 'type', array('label' => 'Cover Type', 'multiOptions' => array_merge(array('0' => ''), Book_Plugin_CoverType::getAllBookTypes('id')), 'order' => 12));
     // Number of page
     $this->addElement('Text', 'num_page', array('label' => 'Number of page', 'validators' => array(array('Int', true), array('GreaterThan', true, array(0))), 'filters' => array(new Book_Filter_Null()), 'order' => 13));
     // ISBN
     $this->addElement('Text', 'isbn', array('label' => 'ISBN', 'maxlength' => '32', 'filters' => array(new Engine_Filter_HtmlSpecialChars(), 'StripTags', new Engine_Filter_Censor(), new Engine_Filter_StringLength(array('max' => '32'))), 'order' => 14));
     $this->addDisplayGroup(array('authors', 'toValues', 'is_foreign', 'translators', 'toTranslatorValues', 'category_id', 'published_date', 'price', 'size', 'publisher_id', 'book_company_id', 'type', 'num_page', 'isbn'), 'advanced_information');
     $this->advanced_information->setLegend(Zend_Registry::get('Zend_Translate')->_('Advanced information') . ' <span id="book_arrow_control" class="book_arrow book_view_less">&nbsp;</span>');
     $this->advanced_information->removeDecorator('Fieldset');
     $this->advanced_information->addDecorator(new Book_Form_Decorator_Fieldset());
     $view->headScript()->appendScript("\r\n\t\t\twindow.addEvent('domready', function() {\r\n\t\t\t\t\$('advanced_information-wrapper').setStyle('display','none');\t\t\t\r\n\t\t\t\t\r\n\t\t\t\t\$('fieldset-advanced_information').getElement('legend').removeEvent('click').addEvent('click', function() {\r\n\t\t\t\t\t\$(this).getElement('span').toggleClass('book_view_less');\r\n\t\t\t\t\t\$(this).getElement('span').toggleClass('book_view_more');\r\n\t\t\t\t\tif (\$(this).getElement('span').hasClass('book_view_less')) {\r\n\t\t\t\t\t\t\$('advanced_information-wrapper').setStyle('display','none');\t\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\$('advanced_information-wrapper').setStyle('display','block');\r\n\t\t\t\t\t}\t\t\t\t\r\n\t\t\t\t});\t\r\n\t\t\t});\r\n\t\t");
     // init description
     $this->addElement('TinyMce', 'description', array('label' => 'Description', 'editorOptions' => array('width' => '800px', 'height' => '450px', 'content_css' => '/application/modules/Book/externals/styles/editor.css', 'theme_advanced_buttons1' => array('undo', 'redo', 'cleanup', 'removeformat', 'pasteword', '|', 'media', 'image', 'fullscreen', 'preview', 'emotions'), 'theme_advanced_buttons2' => array('fontselect', 'fontsizeselect', 'bold', 'italic', 'underline', 'strikethrough', 'forecolor', 'backcolor', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', '|', 'outdent', 'indent', 'blockquote'), 'upload_url' => Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'book', 'controller' => 'index', 'action' => 'upload'), 'default', true)), 'allowEmpty' => false, 'decorators' => array('ViewHelper'), 'filters' => array(new Engine_Filter_Censor(), new Book_Filter_HTMLPurifier())));
     Engine_Form::addDefaultDecorators($this->getElement('description'));
     // Element: submit
     $this->addElement('Button', 'submit', array('label' => 'Post', 'type' => 'submit', 'decorators' => array('ViewHelper')));
     $this->addElement('Cancel', 'cancel', array('label' => 'cancel', 'link' => true, 'prependText' => ' or ', 'decorators' => array('ViewHelper')));
     $this->addDisplayGroup(array('submit', 'cancel'), 'buttons', array('decorators' => array('FormElements', 'DivDivDivWrapper')));
 }