<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class User_Form_Activity_Post extends Engine_Form
{
  public function init()
  {
    $this->addElement('text', 'body', array(
      'required' => true,
      //'decorators' => array('ViewHelper'),
      'filters' => array(
        'HtmlEntities',
        new Engine_Filter_Censor(),
      )
    ));

    $this->addElement('button', 'submit', array(
      'type' => 'submit',
      'label' => 'Post',
      'ignore' => true,
      //'decorators' => array('ViewHelper')
    ));

    //if( $this->_activityObject )
    //{
      $this->addElement('hidden', 'subject_type', array(
        //'decorators' => array('ViewHelper'),
        'validators' => array(
          array(
            'Alpha',
            false
          )
        )
      ));

      $this->addElement('hidden', 'subject_id', array(
        //'decorators' => array('ViewHelper'),
        'validators' => array(
          array(
            'Int',
            false
          )
        )
      ));
    //}

    $this->addElement('hidden', 'return_url', array(
        'value' => Zend_Controller_Front::getInstance()->getRouter()->assemble(array())
    ));

    $this->setAction(Zend_Controller_Front::getInstance()->getRouter()->assemble(array('controller' => 'edit', 'action' => 'post'), 'user_extended'));
  }

  public function setActivityObject(Core_Model_Item_Abstract $object)
  {
    $this->subject_type->setValue($object->getType());
    $this->subject_id->setValue($object->getIdentity());
    return $this;
  }
}
