Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class AdminVideoController extends ModuleAdminController {
- public function __construct()
- {
- $this->table = 'video';
- $this->className = 'Video';
- $this->lang = false;
- $this->fields_list = array(
- 'id_video' => array('title' => $this->l('ID'), 'align' => 'center'),
- 'title' => array('title' => $this->l('Título')),
- 'url' => array('title' => $this->l('URL')),
- 'related_product_1' => array('title' => $this->l('Related product #1')),
- 'related_product_2' => array('title' => $this->l('Related product #2')),
- 'related_product_3' => array('title' => $this->l('Related product #3')),
- 'related_product_4' => array('title' => $this->l('Related product #4')),
- 'related_product_5' => array('title' => $this->l('Related product #5')),
- 'related_product_6' => array('title' => $this->l('Related product #6')),
- 'active' => array('title' => $this->l('Activo'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)
- );
- parent::__construct();
- }
- public function renderList()
- {
- $this->addRowAction('edit');
- $this->addRowAction('delete');
- $this->addRowAction('details');
- $this->displayInformation($this->l('Este interface permite-lhe associar um video do YouTube a 6 produtos').'<br />');
- $this->displayInformation($this->l('Apenas um video poderá estar activo de cada vez'));
- return parent::renderList();
- }
- public function renderForm()
- {
- if (!($obj = $this->loadObject(true)))
- return;
- $this->fields_form = array(
- 'legend' => array(
- 'title' => $this->l('Video da semana'),
- 'image' => '../img/admin/world.gif'
- ),
- 'input' => array(
- array(
- 'type' => 'text',
- 'label' => $this->l('Name'),
- 'name' => 'title',
- 'size' => 33,
- 'required' => true,
- 'desc' => $this->l('Title')
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('URL'),
- 'name' => 'url',
- 'size' => 33,
- 'required' => true,
- 'desc' => $this->l('Video URL')
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('Related product #1'),
- 'name' => 'related_product_1',
- 'desc' => $this->l('Video URL')
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('Related product #2'),
- 'name' => 'related_product_2',
- 'desc' => $this->l('Video URL')
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('Related product #3'),
- 'name' => 'related_product_3',
- 'desc' => $this->l('Video URL')
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('Related product #4'),
- 'name' => 'related_product_4',
- 'desc' => $this->l('Video URL')
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('Related product #5'),
- 'name' => 'related_product_5',
- 'desc' => $this->l('Video URL')
- ),
- array(
- 'type' => 'text',
- 'label' => $this->l('Related product #6'),
- 'name' => 'related_product_6',
- 'desc' => $this->l('Video URL')
- ),
- array(
- 'type' => 'radio',
- 'label' => $this->l('Active:'),
- 'name' => 'active',
- 'required' => false,
- 'class' => 't',
- 'is_bool' => true,
- 'values' => array(
- array(
- 'id' => 'active_on',
- 'value' => 1,
- 'label' => $this->l('Enabled')
- ),
- array(
- 'id' => 'active_off',
- 'value' => 0,
- 'label' => $this->l('Disabled')
- )
- ),
- 'desc' => $this->l('One video at the time')
- )
- )
- );
- if (Shop::isFeatureActive())
- {
- $this->fields_form['input'][] = array(
- 'type' => 'shop',
- 'label' => $this->l('Shop association:'),
- 'name' => 'checkBoxShopAsso',
- );
- }
- $this->fields_form['submit'] = array(
- 'title' => $this->l(' Save '),
- 'class' => 'button'
- );
- if (!($obj = $this->loadObject(true)))
- return;
- return parent::renderForm();
- }
- public function postProcess(){
- $result = parent::postProcess();
- if (Tools::getValue('submitAdd'.$this->table) && $result)
- {
- $sql = 'call sp_FixDefault(Tools::getValue('url'));';
- if (!Db::getInstance()->query($sql))
- die('Error; could not update to the DB.');
- }
- return $result;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement