groupID = $groupID; } public function init() { $this->setName("GroupEdit"); $this->setMethod('post'); $this->addElement('text', 'title', array( 'filters' => array('StringTrim'), 'validators' => array( array('StringLength', false, array(0, 50)), ), 'required' => true, 'label' => 'Title:', 'value' => $_POST['title'], )); $this->addElement('text', 'description', array( 'filters' => array('StringTrim'), 'validators' => array( array('StringLength', false, array(0, 140)), ), 'required' => false, 'label' => 'Description:', 'value' => $_POST['description'], )); $this->addElement('submit', 'save', array( 'required' => false, 'ignore' => true, 'label' => 'Save', )); if(strpos($_SERVER['HTTP_REFERER'], '/user/group/show')) { if(strpos($_SERVER['HTTP_REFERER'], '/groupID/')) { $this->addElement('button', 'cancel', array( 'required' => false, 'ignore' => true, 'label' => 'Cancel', 'onclick' => 'location.href="/user/group/show/groupID/' . $this->groupID . '"', )); } else { $this->addElement('button', 'cancel', array( 'required' => false, 'ignore' => true, 'label' => 'Cancel', 'onclick' => 'location.href="/user/group/show/"', )); } } else { $this->addElement('button', 'cancel', array( 'required' => false, 'ignore' => true, 'label' => 'Cancel', 'onclick' => 'location.href="/user/group/showall"', )); } } }