<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Engine_Form_Decorator_FormMusicHTMLUpload extends Zend_Form_Decorator_Abstract
{
  public function render($content)
  {
    $element = $this->getElement();
    $view = $element->getView();

    $context = 'name="' . $element->getName() . '"';
    $context .= ' data-url="' . $element->url . '"';
    if (!empty($element->{'form'})) {
      $context .= ' data-form-id="' . $element->{'form'} . '"';
    }
    if (!empty($element->{'multi'})) {
      $context .= ' multiple="multiple"';
    }
    if (!empty($element->{'accept'})) {
      $context .= ' accept="' . $element->{'accept'} . '"';
    }

    $description = $element->getAttrib('description');
    $sizeText = $element->getAttrib('size_text') ? $element->getAttrib('size_text') : 'mp3 (max. 45MB)';
    $maxSize = $element->getAttrib('max_size') ? (int) $element->getAttrib('max_size') : (45 * 1024 * 1024);
    $uploadSong = !empty($element->getAttrib('upload_song'));

    return $view->partial('upload/music-upload.tpl', 'core', array(
      'name' => $element->getName(),
      'element' => $element,
      'context' => $context,
      'description' => $description,
      'sizeText' => $sizeText,
      'maxSize' => $maxSize,
      'uploadSong' => $uploadSong,
    ));
  }
}
