<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
class Core_Form_Admin_Widget_Ads extends Core_Form_Admin_Widget_Standard
{
  public function init()
  {
    parent::init();

    // Set form attributes
    $this
      ->setTitle('Ad Campaign')
      ->setDescription('Please choose an advertisement campaign.')
      ->setAttrib('id', 'form-upload');
      
    $campaigns = Engine_Api::_()->getDbtable('adcampaigns', 'core')->fetchAll();

    if( engine_count($campaigns) > 0 ) {
      // Element: adcampaign_id
      $this->addElement('Select', 'adcampaign_id', array(
        'label' => 'Ad Campaign',
      ));
      
      $this->adcampaign_id->addMultiOption(0, '');
      foreach( $campaigns as $campaign ) {
        $this->adcampaign_id->addMultiOption($campaign->adcampaign_id, $campaign->name);
      }
    }

    $this->addElement('Text', "count", array(
      'label' => 'How many ads want to show in this widget?',
      'value' => 1
    )); 

  }
}
