<?
$item = $this->item;
$title = $item['id'] ? 'Edit Activity' : 'Create Activity';
$title = $this->_($title);
$method = $item['id'] ? 'put' : 'post';
$this->headTitle($title, 'SET');
$this->textDelay('breadcrumbText', $title);

if($this->form){
	$form = $this->form;
} else {
    if($item['id']) {
        $form = new Activity\Form\MessageEditForm();
    } else {
        $form = new Activity\Form\MessageCreateForm();
    }
}
$form->useSubFormGroup()
     ->setMethod($item['id'] ? 'put' : 'post')
     ->setView($this)
     ->setAction($this->uri('/admin/activity/'))
     ->bind($item)
     ->prepare();
?>

<div class="row">
    <form <?=$this->formAttr($form)?>>
        <?=$form->restful();?>
        <?=$form->helper('id');?>
        <div class="span10">
            <div class="slate">
                <div class="page-header">
                    <?if($item['id']):?>
                    <div class="btn-group pull-right">
                        <a href="<?=$this->uri('/admin/activity/remove/' . $item['id'], 'c', array('c' => $this->uri('/admin/activity/' . $item['id']))); ?>" class="btn"><?=$this->_('Delete')?></a>
                    </div>
                    <?endif?>
                    <h2><?=$title?></h2>
                </div>
                <fieldset class="">
                    <?=$form->helper('messageType', 'formHidden', array('class' => ''))?>        
                    <div class="control-group <?=$form->isError('content') ? 'error' : '';?>">
                        <?=$form->helper('content', 'label', array('class' => 'control-label'))?>
                        <div class="controls">
                            <?=$form->helper('content', 'formTextarea', array('class' => 'span9', 'rows' => 5))?>        
                            <div class="help-block"><?=$form->helper('content', 'formElementErrors')?></div>
                        </div>
                    </div>
                    <?=$form->helper('reference_id', array('class' => ''))?>
                    <?=$form->helper(array('MessageFile', 'file_id'), array('class' => ''))?>
                </fieldset>
            </div>
        </div><!--span10 end-->
        <div class="span10 listing-buttons">
            <button class="btn btn-info btn-large">Save</button>
        </div>
    </form>
</div>

<div class="row">
    <div class="span10">
        <div class="slate">
    <?=$item['ContentHtml']?>
        </div>
    </div>
</div>
