<?php

class ControllerExtensionModuleMfspromotions extends Controller
{
	public function index($setting)
	{
		static $module = 1;
		$this->load->model('extension/module/mfs_promotions');

		$slide_arr = self::getSlides($setting);

		$data['list'] = $slide_arr;
		$data['module'] = $module++;
		return $this->load->view('extension/module/mfs_promotions', $data);
	}

	public function getSlides($setting)
	{
		$list = array();
		$slides_arr = $this->model_extension_module_mfs_promotions->getListSlider($setting);
		foreach ($slides_arr as $slide_info) {
			$list[] = array(
				'slider_id' => $slide_info['id'],
				'title' => $slide_info['title'],
				'description' => html_entity_decode($slide_info['description']),
				'url' => $slide_info['url']
			);
		}
		return $list;
	}

}