private function getForm()
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName('formProfile');
     // First name
     $e = $form->createElement('text', 'first_name', array('label' => 'First name', 'class' => 'width1', 'decorators' => $form->elementDecorators));
     $e->addFilter('StripTags');
     $form->addElement($e);
     // Last name
     $e = $form->createElement('text', 'last_name', array('label' => 'Last name', 'class' => 'width1', 'decorators' => $form->elementDecorators));
     $e->addFilter('StripTags');
     $form->AddElement($e);
     // Short Bio
     $e = $form->createElement('textarea', 'bio', array('label' => 'Short bio', 'class' => 'width1', 'decorators' => $form->elementDecorators));
     $e->addFilter('StripTags');
     $form->AddElement($e);
     // Location
     $e = $form->createElement('text', 'location', array('label' => 'Location', 'class' => 'width1', 'decorators' => $form->elementDecorators));
     $e->addFilter('StripTags');
     $form->AddElement($e);
     // use addElement() as a factory to create 'Post' button:
     $form->addElement('button', 'save', array('label' => 'Save', 'onclick' => "submitFormProfile();", 'decorators' => $form->buttonDecorators));
     return $form;
 }
 private function getForm()
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName('formAdvanced');
     // CNAME
     $e = $form->createElement('text', 'cname', array('size' => 37, 'label' => 'Own domain', 'decorators' => $form->elementDecorators));
     $e->setRequired(false);
     $e->addFilter('StringToLower');
     $e->setDescription("Fill-in your domain name (e.g. www.johndoe.com) and add a CNAME entry towards this domain (<a href='http://code.google.com/p/storytlr/wiki/CName'>help</a>)");
     $form->addElement($e);
     // Disqus
     $username = $this->_application->user->username;
     $host = $this->getHostname();
     $url = "http://{$username}.{$host}";
     $e = $form->createElement('text', 'disqus', array('size' => 37, 'label' => 'Disqus commenting', 'decorators' => $form->elementDecorators));
     $e->setRequired(false);
     $e->addFilter('StringToLower');
     $e->setDescription("Create a disqus web site for the url {$url} and fill-in its short-name (<a href='http://code.google.com/p/storytlr/wiki/FAQ'>help</a>)");
     $form->addElement($e);
     // Friend connect
     $e = $form->createElement('text', 'friendconnect', array('size' => 37, 'label' => 'Friend connect key', 'decorators' => $form->elementDecorators));
     $e->setRequired(false);
     $e->setDescription("Add Google Friend Connect to your site and make it social");
     $form->addElement($e);
     // Save button
     $e = $form->createElement('button', 'save', array('label' => 'Save', 'onclick' => "submitFormAdvanced();", 'decorators' => $form->buttonDecorators));
     $form->addElement($e);
     return $form;
 }
 public function getForm()
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setAction('admin/recover/submit');
     $form->setMethod('post');
     $form->setName('formRecover');
     // Create and configure email element:
     $e = $form->createElement('text', 'email', array('label' => 'Email:', 'decorators' => $form->elementDecorators));
     $e->addValidator(new Zend_Validate_EmailAddress());
     $e->setRequired(true);
     $form->addElement($e);
     // Submit button
     $button = $form->createElement('submit', 'post', array('label' => 'Recover', 'decorators' => $form->buttonDecorators));
     $form->addElement($button);
     return $form;
 }
 private function getForm()
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName('formPassword');
     // New password
     $e = $form->createElement('password', 'password', array('label' => 'New password:'******'decorators' => $form->elementDecorators));
     $e->addValidator('StringLength', false, array(6, 20));
     $e->setRequired(true);
     $form->addElement($e);
     // Confirm password
     $e = $form->createElement('password', 'confirm', array('label' => 'Confirm password:'******'decorators' => $form->elementDecorators));
     $e->addValidator('StringLength', false, array(6, 20));
     $e->setRequired(true);
     $form->addElement($e);
     // use addElement() as a factory to create 'Post' button:
     $form->addElement('button', 'save', array('label' => 'Save', 'onclick' => "submitFormPassword();", 'decorators' => $form->buttonDecorators));
     return $form;
 }
 private function getForm()
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName('formAdvanced');
     // CNAME
     $e = $form->createElement('text', 'cname', array('size' => 37, 'label' => 'Own domain', 'decorators' => $form->elementDecorators));
     $e->setRequired(false);
     $e->addFilter('StringToLower');
     $e->setDescription("Fill-in your domain name (e.g. www.johndoe.com) and add a CNAME entry towards this domain");
     $form->addElement($e);
     // Disqus
     $username = $this->_application->user->username;
     $host = $this->getHostname();
     $url = "http://{$username}.{$host}";
     $e = $form->createElement('text', 'disqus', array('size' => 37, 'label' => 'Disqus commenting', 'decorators' => $form->elementDecorators));
     $e->setRequired(false);
     $e->addFilter('StringToLower');
     $e->setDescription("Create a disqus web site for the url {$url} and fill-in its short-name (<a href='https://github.com/storytlr/storytlr/wiki/Frequently-Asked-Questions'>help</a>)");
     $form->addElement($e);
     // Friend connect
     $e = $form->createElement('text', 'friendconnect', array('size' => 37, 'label' => 'Friend connect key', 'decorators' => $form->elementDecorators));
     $e->setRequired(false);
     $e->setDescription("Add Google Friend Connect to your site and make it social");
     $form->addElement($e);
     // Header
     $e = $form->createElement('textarea', 'user_header', array('rows' => 5, 'cols' => 37, 'label' => 'Header Code', 'decorators' => $form->elementDecorators));
     $e->setRequired(false);
     $e->setDescription("Add code to the header of every page. Like OpenID delegation headers.");
     $form->addElement($e);
     // Footer
     $e = $form->createElement('textarea', 'user_footer', array('rows' => 5, 'cols' => 37, 'label' => 'Footer Code', 'decorators' => $form->elementDecorators));
     $e->setRequired(false);
     $e->setDescription("Add code to the bottom of every page. Good for analytics systems.");
     $form->addElement($e);
     // Save button
     $e = $form->createElement('button', 'save', array('label' => 'Save', 'onclick' => "submitFormAdvanced();", 'decorators' => $form->buttonDecorators));
     $form->addElement($e);
     return $form;
 }
 private function getForm()
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName('formPostEmail');
     // Create and configure secret element:
     $username = $form->createElement('text', 'secret', array('label' => 'Secret:', 'onkeyup' => 'updateName(this.value);', 'decorators' => $form->elementDecorators));
     $username->addFilter('StringToLower');
     $username->addValidator('alnum');
     $username->addValidator('regex', false, array('/^[a-z0-9]+$/'));
     $username->addValidator('stringLength', false, array(4, 20));
     //$username->addValidator(new Stuffpress_Validate_AvailableUsername(Zend_Db_Table::getDefaultAdapter(), 'users', 'username'));
     $username->setRequired(true);
     $username->setDescription("Minimum of 4 characters.<br/> This will be your private email to post to storytlr: <strong>" . $this->_application->user->username . ".<span id='secret_link'>secret</span>@submit.storytlr.com</strong>");
     $form->addElement($username);
     // Save button
     $e = $form->createElement('button', 'save', array('label' => 'Save', 'onclick' => "submitFormPostEmail();", 'decorators' => $form->buttonDecorators));
     $form->addElement($e);
     return $form;
 }
Exemple #7
0
 private function getForm($widget_id = 0)
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName("form_widget_{$widget_id}");
     // Create and configure title element:
     $e = $form->createElement('text', 'title', array('label' => 'Title:', 'class' => 'width1'));
     $e->addFilter('StripTags');
     $form->addElement($e);
     // Add a hidden element with the widget id
     $e = $form->createElement('hidden', 'id');
     $e->setValue($widget_id);
     $e->removeDecorator('HtmlTag');
     $form->addElement($e);
     // use addElement() as a factory to create 'Post' button:
     $e = $form->createElement('button', 'save', array('label' => 'Save', 'onclick' => "onSubmitFormWidget('{$this->_prefix}', {$widget_id});"));
     $e->setDecorators(array(array('ViewHelper'), array('HtmlTag', array('tag' => 'dd'))));
     $form->addElement($e);
     return $form;
 }
Exemple #8
0
 public function getForm()
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName("form_page");
     // Create and configure title element:
     $e = $form->createElement('text', 'title', array('label' => 'Title:', 'class' => 'width1'));
     $e->setRequired(true);
     $e->addValidator('stringLength', false, array(0, 32));
     $e->addFilter('StripTags');
     $form->addElement($e);
     // Create and configure title element:
     $e = $form->createElement('text', 'url', array('label' => 'Url:', 'class' => 'width1'));
     $e->setRequired(true);
     $e->addValidator('stringLength', false, array(0, 128));
     $e->addFilter('StripTags');
     $form->addElement($e);
     // Add a hidden element with the page id
     $e = $form->createElement('hidden', 'id');
     $e->removeDecorator('HtmlTag');
     $form->addElement($e);
     // Add a hidden element with the  page type
     $e = $form->createElement('hidden', 'type');
     $e->setValue('link');
     $e->removeDecorator('HtmlTag');
     $form->addElement($e);
     // Add a submit button
     $button = $form->createElement('submit', 'save', array('onClick' => 'onFormSubmit(); return false;', 'decorators' => array('ViewHelper')));
     $form->addElement($button);
     // Add a cancel button
     $element = $form->createElement('button', 'cancel', array('decorators' => array('ViewHelper')));
     $element->setAttrib('onClick', 'history.go(-1);return false;');
     $form->addElement($element);
     // Group elements
     $form->addDisplayGroup(array('save', 'cancel'), 'buttons', array('decorators' => $form->groupDecorators));
     return $form;
 }
Exemple #9
0
	private function getFormCommon($source_id = 0, $item_id=0, $type='text', $date=false, $edit=false, $tags=false, $lat=false, $long=false, $elev=false) {
		// Create the basic form		
		$form = new Stuffpress_Form();

		// Add the form element details
		$form->setAction('admin/post/submit');
		$form->setMethod('post');
		$form->setName("formPost");
		
		// Create and configure tags element:
		$element = $form->createElement('text', 'tags',  array('label' => 'Tags:', 'decorators' => array('ViewHelper', 'Errors')));
		$element->addValidator('stringLength', false, array(0, 256));
		$element->addFilter('StripTags');
		$element->setValue($tags);
		$element->setRequired(false);
		$form->addElement($element);
		
		// Create and configure latitude element:
		$element = $form->createElement('hidden', 'latitude',  array('label' => 'Latitude:', 'decorators' => array('ViewHelper', 'Errors')));
		$element->addValidator('between', false, array(-180.0, 180.0));
		$element->setValue($lat);
		$element->setRequired(false);
		$form->addElement($element);

		// Create and configure longitude element:
		$element = $form->createElement('hidden', 'longitude',  array('label' => 'Longitude:', 'decorators' => array('ViewHelper', 'Errors')));
		$element->addValidator('between', false, array(-180.0, 180.0));
		$element->setValue($long);
		$element->setRequired(false);
		$form->addElement($element);
		
		// Add a radio button element for the date_type
		$element = $form->createElement('hidden', 'date_type');
		$element->setRequired(false);
		$element->setDecorators(array('ViewHelper'));
		$form->addElement($element);
				
		if ($date) {
			$timestamp = $date;
			$this->view->date_text = Stuffpress_Date::date("F d, Y h:i A", $timestamp, $this->_properties->getProperty('timezone'));
			$element->setValue('other');
		} else {
			$timestamp = time();
			$this->view->date_text = "Now";
			$element->setValue('now');
		}		
				
		$form->addElement($element);
		
		// Create and configure date element:
		$element = $form->createElement('hidden', 'date');
		$element->setRequired(false);
		$element->setDecorators(array('ViewHelper'));
		$element->setValue(Stuffpress_Date::date("F d, Y h:i A", $timestamp, $this->_properties->getProperty('timezone')));
		$form->addElement($element);
		
		// Add a twitter element if required
		if ($this->_properties->getProperty('twitter_auth')) {
			$checked = (!$item_id && in_array($source_id, unserialize($this->_properties->getProperty('twitter_services')))) ? true : false;
			$element = $form->createElement('checkbox', 'twitter_notify',  array('label' => 'Twitter:', 'decorators' => array('ViewHelper', 'Errors'), 'class' => 'css'));
			$element->setValue($checked);
			$element->setRequired(true);
			$form->addElement($element);		
		}
		
		// Add a hidden element with the item id
		$element = $form->createElement('hidden', 'item');
		$element->setDecorators(array(array('ViewHelper')));
		$element->setValue($item_id);
		$form->addElement($element);

		// Add a hidden element with the item id
		$element = $form->createElement('hidden', 'source');
		$element->setDecorators(array(array('ViewHelper')));
		$element->setValue($source_id);
		$form->addElement($element);		
		
		// Add a hidden element with the type
		$element = $form->createElement('hidden', 'type');
		$element->setDecorators(array(array('ViewHelper')));
		$element->setValue($type);
		$form->addElement($element);
		
		// If a bookmarklet, we also need to remember it
		$element = $form->createElement('hidden', 'bookmarklet');
		$element->setDecorators(array(array('ViewHelper')));
		$element->setValue($this->_bookmarklet);
		$form->addElement($element);
		
		// Add a hidden element with action
		$element = $form->createElement('hidden', 'mode');
		$element->setDecorators(array(array('ViewHelper')));
		$element->setValue($edit ? 'edit' : 'create');
		$form->addElement($element);

		// use addElement() as a factory to create 'Post' button:
		$form->addElement('button', 'post', array('label' => ($edit ? 'Save' : 'Post'), 'onclick' => "submitFormPost();", 'decorators' => $form->buttonDecorators));

		return $form;
	}
 private function getForm($sources)
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setAction('admin/story/submit');
     $form->setName('formCreateStory');
     // Title
     $e = $form->createElement('text', 'title', array('size' => 25, 'label' => 'Title', 'decorators' => array('ViewHelper', 'Errors'), 'maxlength' => 35));
     $e->setRequired(true);
     $e->addValidator('stringLength', false, array(0, 40));
     $e->addFilter('StripTags');
     $form->addElement($e);
     // Subtitle
     $e = $form->createElement('text', 'subtitle', array('size' => 25, 'label' => 'Subtitle', 'decorators' => array('ViewHelper', 'Errors'), 'maxlength' => 35));
     $e->setRequired(false);
     $e->addValidator('stringLength', false, array(0, 40));
     $e->addFilter('StripTags');
     $form->addElement($e);
     // From
     // TODO Validate the date
     $e = $form->createElement('text', 'date_from', array('size' => 25, 'readonly' => 'readonly', 'label' => 'From', 'decorators' => array('ViewHelper', 'Errors')));
     $e->setRequired(true);
     $form->addElement($e);
     // To
     // TODO Validate the date
     $e = $form->createElement('text', 'date_to', array('size' => 25, 'label' => 'To', 'readonly' => 'readonly', 'decorators' => array('ViewHelper', 'Errors')));
     $e->setRequired(true);
     $form->addElement($e);
     // Sources
     $e = new Zend_Form_Element_MultiCheckbox('sources', array('decorators' => array('ViewHelper', 'Errors'), 'multiOptions' => $sources, 'class' => 'checkbox'));
     $e->setLabel('Sources');
     $form->addElement($e);
     // Save button
     $e = $form->createElement('submit', 'post', array('label' => 'Create', 'decorators' => $form->buttonDecorators));
     $form->addElement($e);
     return $form;
 }
 private function getFormSettings()
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName('formSettings');
     // Timezone setting
     $e = $form->createElement('select', 'timezoneid', array('label' => 'Timezone', 'class' => 'width1', 'decorators' => array('ViewHelper', 'Errors'), 'registerInArrayValidator' => false));
     $form->addElement($e);
     // Notifications
     $e = new Zend_Form_Element_MultiCheckbox('alerts', array('decorators' => array('ViewHelper', 'Errors'), 'multiOptions' => array('on_comment' => 'When someone comments on my items', 'on_news' => 'When storytlr releases cool new features')));
     $e->setLabel('Notifications');
     $form->addElement($e);
     // Privacy
     $e = new Zend_Form_Element_MultiCheckbox('privacy', array('decorators' => array('ViewHelper', 'Errors'), 'multiOptions' => array('is_private' => 'Make my lifestream private')));
     $e->setLabel('Privacy');
     $form->addElement($e);
     // Save button
     $e = $form->createElement('button', 'save', array('label' => 'Save', 'onclick' => "submitFormSettings();", 'decorators' => $form->buttonDecorators));
     $form->addElement($e);
     return $form;
 }
Exemple #12
0
 private function getForm()
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setAction('admin/auth/login');
     $form->setMethod('post');
     $form->setName('formLoginMain');
     // Create and configure username element:
     $username = $form->createElement('text', 'username', array('label' => 'Username:'******'decorators' => $form->noDecorators));
     $username->addValidator('alnum');
     $username->addValidator('stringLength', false, array(4, 20));
     $username->setRequired(true);
     $username->addFilter('StringToLower');
     $form->addElement($username);
     // Create and configure password element:
     $password = $form->createElement('password', 'password', array('label' => 'Password:'******'decorators' => $form->noDecorators));
     $password->addValidator('StringLength', false, array(6, 20));
     $password->setRequired(true);
     $form->addElement($password);
     // Remember me
     $element = $form->createElement('checkbox', 'remember', array('label' => 'Remember:', 'decorators' => $form->noDecorators, 'class' => 'remember'));
     $element->setRequired(true);
     $form->addElement($element);
     // Add a hidden element with a target url
     $target = $form->createElement('hidden', 'target');
     $target->setDecorators(array(array('ViewHelper')));
     // Add a hidden element with a bookmarklet flag
     $bk = $form->createElement('hidden', 'bookmarklet');
     $bk->setDecorators(array(array('ViewHelper')));
     $bk->setValue($this->_bookmarklet);
     // Add elements to form:
     $form->addElement($target);
     $form->addElement($bk);
     $form->addElement('submit', 'login', array('label' => 'Sign in', 'decorators' => $form->noDecorators));
     return $form;
 }
 private function getFormColors()
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName('formTheme');
     // Colors
     $element = $form->createElement('text', 'color_title', array('title' => 'Title', 'value' => "ffffff"));
     $element->setDecorators(array(array('ViewHelper')));
     $form->addElement($element);
     $element = $form->createElement('text', 'color_subtitle', array('title' => 'Subtitle', 'value' => "ffffff"));
     $element->setDecorators(array(array('ViewHelper')));
     $form->addElement($element);
     $element = $form->createElement('text', 'color_sidebar_border', array('title' => 'Sidebar border', 'value' => "ffffff"));
     $element->setDecorators(array(array('ViewHelper')));
     $form->addElement($element);
     $element = $form->createElement('text', 'color_background', array('title' => 'Sidebar background', 'value' => "ffffff"));
     $element->setDecorators(array(array('ViewHelper')));
     $form->addElement($element);
     $element = $form->createElement('text', 'color_link', array('title' => 'Link color', 'value' => "ffffff"));
     $element->setDecorators(array(array('ViewHelper')));
     $form->addElement($element);
     $element = $form->createElement('text', 'color_sidebar_text', array('title' => 'Sidebar text', 'value' => "ffffff"));
     $element->setDecorators(array(array('ViewHelper')));
     $form->addElement($element);
     $element = $form->createElement('text', 'color_sidebar_header', array('title' => 'Sidebar headers', 'value' => "ffffff"));
     $element->setDecorators(array(array('ViewHelper')));
     $form->addElement($element);
     $form->addElement('button', 'save', array('label' => 'Save colors', 'onclick' => "submitFormColors();", 'decorators' => array('ViewHelper')));
     $form->addElement('button', 'reset', array('label' => 'Reset', 'onclick' => "resetFormColors();", 'decorators' => array('ViewHelper')));
     return $form;
 }
 private function getForm($source_id = 0, $item_id = 0)
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName("form_add_comment_{$source_id}_{$item_id}");
     // Create and configure comment element:
     $comment = $form->createElement('textarea', 'comment', array('label' => 'Comment:', 'rows' => 4, 'cols' => 60, 'decorators' => $form->elementDecorators));
     $comment->setRequired(true);
     $comment->addFilter('StripTags');
     if ($this->_application->user) {
         $name = $form->createElement('hidden', 'name');
         $name->setValue($this->_application->user->username);
         $name->setDecorators(array(array('ViewHelper')));
         $email = $form->createElement('hidden', 'email');
         $email->setValue($this->_application->user->email);
         $email->setDecorators(array(array('ViewHelper')));
         $config = Zend_Registry::get('configuration');
         $host = $config->web->host;
         $url = $this->_application->getPublicDomain();
         $website = $form->createElement('hidden', 'website');
         $website->setValue($url);
         $website->setDecorators(array(array('ViewHelper')));
         $website->addFilter('StripTags');
     } else {
         // Create and configure username element:
         $name = $form->createElement('text', 'name', array('label' => 'Name:', 'decorators' => $form->elementDecorators));
         $name->addFilter('StringToLower');
         $name->addValidator('alnum');
         $name->addValidator('stringLength', false, array(4, 20));
         $name->setRequired(true);
         // Create and configure email element:
         $email = $form->createElement('text', 'email', array('label' => 'Email (confidential):', 'decorators' => $form->elementDecorators));
         $email->addValidator(new Zend_Validate_EmailAddress());
         $email->setRequired(true);
         // Create and configure website element:
         // TODO Add URL validator
         $website = $form->createElement('text', 'website', array('label' => 'Website (optional):', 'decorators' => $form->elementDecorators));
         $website->addFilter('StripTags');
         $website->setRequired(false);
     }
     $options = new Zend_Form_Element_MultiCheckbox('options', array('decorators' => $form->elementDecorators, 'multiOptions' => array('notify' => 'Notify me of followup comments via e-mail')));
     $options->setValue(array('notify'));
     // Add elements to form:
     $form->addElement($comment);
     $form->addElement($name);
     $form->addElement($email);
     $form->addElement($website);
     $form->addElement($options);
     // Add a hidden element with the source id
     $element = $form->createElement('hidden', 'source');
     $element->setValue($source_id);
     $element->setDecorators(array(array('ViewHelper')));
     $form->addElement($element);
     // Add a hidden element with the item id
     $element = $form->createElement('hidden', 'item');
     $element->setValue($item_id);
     $element->setDecorators(array(array('ViewHelper')));
     $form->addElement($element);
     // Post button
     $button = $form->createElement('button', 'post', array('label' => 'Post', 'onclick' => "submitFormAddComment({$source_id}, {$item_id});", 'decorators' => array('ViewHelper')));
     $button->setDecorators(array(array('ViewHelper')));
     $form->addElement($button);
     // Cancel button
     $button = $form->createElement('button', 'cancel', array('label' => 'Cancel', 'onclick' => "cancelFormAddComment({$source_id}, {$item_id});", 'decorators' => array('ViewHelper')));
     $button->setDecorators(array(array('ViewHelper')));
     $form->addElement($button);
     $form->addDisplayGroup(array('post', 'cancel'), 'buttons', array('decorators' => $form->groupDecorators));
     return $form;
 }
Exemple #15
0
 private function getTwitterLoginForm()
 {
     $form = new Stuffpress_Form();
     // Add the form element details
     $form->setMethod('post');
     $form->setName('formTwitterLogin');
     $form->setAction('admin/sns/login');
     // Twitter account
     $e = $form->createElement('text', 'username', array('size' => 12, 'label' => 'Username', 'decorators' => array('ViewHelper', 'Errors')));
     $e->setRequired(true);
     $form->addElement($e);
     // Twitter account
     $e = $form->createElement('password', 'password', array('size' => 12, 'label' => 'Password', 'decorators' => array('ViewHelper', 'Errors')));
     $e->setRequired(true);
     $form->addElement($e);
     // Save button
     $form->addElement('submit', 'login', array('label' => 'Sign in', 'decorators' => $form->buttonDecorators));
     return $form;
 }
 public function getForm()
 {
     $form = new Stuffpress_Form();
     $domain = $this->_config->web->host;
     // Add the form element details
     $form->setAction('admin/register/signup');
     $form->setMethod('post');
     $form->setName('formRegister');
     // Create and configure email element:
     $email = $form->createElement('text', 'email', array('label' => 'Email:', 'decorators' => $form->elementDecorators));
     $email->addValidator(new Zend_Validate_EmailAddress());
     $email->setRequired(true);
     // Create and configure username element:
     $username = $form->createElement('text', 'username', array('label' => 'Username:'******'onkeyup' => 'updateName(this.value);', 'decorators' => $form->elementDecorators));
     $username->addFilter('StringToLower');
     $username->addValidator('alnum');
     $username->addValidator('regex', false, array('/^[a-z0-9]+$/'));
     $username->addValidator('stringLength', false, array(4, 20));
     $username->addValidator(new Stuffpress_Validate_AvailableUsername(Zend_Db_Table::getDefaultAdapter(), 'users', 'username'));
     $username->setRequired(true);
     $username->setDescription("Minimum of 4 characters.<br/> This will be your link: <strong>http://<span id='user_link'>username</span>.{$domain}</strong>");
     // Create and configure password element:
     $password = $form->createElement('password', 'password', array('label' => 'Password:'******'decorators' => $form->elementDecorators));
     $password->addValidator('StringLength', false, array(6, 20));
     $password->setDescription("Minimum of 6 characters.");
     $password->setRequired(true);
     // Add elements to form:
     $form->addElement($email);
     $form->addElement($username);
     $form->addElement($password);
     $form->addElement('submit', 'register', array('label' => 'Sign up', 'decorators' => $form->buttonDecorators));
     return $form;
 }
Exemple #17
0
	private function getTwitterConfigForm() {
		$form = new Stuffpress_Form();
			
		// Add the form element details
		$form->setMethod('post');
		$form->setName('formTwitterConfig');
		
		// Sources
		$e = new Zend_Form_Element_MultiCheckbox('twitter_services', array(
			'decorators' => array('ViewHelper', 'Errors'),
			'multiOptions' => $this->getAvailableSources(),
			'class' => 'checkbox'
		));
		$form->addElement($e);

		// Save button
		$e = $form->createElement('button', 'save', array('label' => 'Save', 'onclick' => "submitFormTwitterConfig();", 'decorators' => $form->buttonDecorators));
		$form->addElement($e);

		return $form;
	}